[FFmpeg-devel] [PATCH] cbs_av1: Make fake OBU size length field a write option

Mark Thompson sw at jkqxz.net
Tue Sep 26 23:05:58 EEST 2023


On 26/09/2023 10:19, Andreas Rheinhardt wrote:
> Mark Thompson:
>> This is an option to modify the behaviour of the writer, not a syntax
>> field.
>> ---
>> Tested by hacking av1_metadata.  For example, adding:
>>
>> av_opt_set_int(ctx->common.output->priv_data, "fixed_obu_size_length",
>> 7, 0);
>>
>> gets you OBU headers that look like:
>>
>> [trace_headers @ 0x55706fcb2880] OBU header
>> [trace_headers @ 0x55706fcb2880] 0
>> obu_forbidden_bit                                           0 = 0
>> [trace_headers @ 0x55706fcb2880] 1
>> obu_type                                                 0100 = 4
>> [trace_headers @ 0x55706fcb2880] 5
>> obu_extension_flag                                          0 = 0
>> [trace_headers @ 0x55706fcb2880] 6
>> obu_has_size_field                                          1 = 1
>> [trace_headers @ 0x55706fcb2880] 7
>> obu_reserved_1bit                                           0 = 0
>> [trace_headers @ 0x55706fcb2880] 8           obu_size
>> 10101110100010101000000010000000100000001000000000000000 = 1326
>>
>> It's not obvious that there is any value in exposing this option more
>> generally, though?  It could made a visible option of av1_metadata or
>> others if there is any use-case for it.
>>
>> Thanks,
>>
>> - Mark
>>
>>
>>   libavcodec/cbs_av1.c          | 31 +++++++++++++++++++++----------
>>   libavcodec/cbs_av1.h          |  5 ++++-
>>   libavcodec/vaapi_encode_av1.c |  4 +++-
>>   3 files changed, 28 insertions(+), 12 deletions(-)
> 
> What is the advantage of this? Why would people want to waste space?

Because they want to be able to write a different size into the field later without realigning all the following bytes.

VAAPI seems to require this, hence the previous code which added a fake syntax element field to the OBU structure containing the size to be written with, which this patch is replacing with an external option.

Thanks,

- Mark


More information about the ffmpeg-devel mailing list