[FFmpeg-devel] [PATCH 2/2 v2] avcodec/cbs_av1: add support for Padding OBUs

James Almer jamrial at gmail.com
Sun Apr 14 21:56:51 EEST 2019


On 4/14/2019 2:22 PM, Mark Thompson wrote:
> On 13/04/2019 20:25, James Almer wrote:
>> Based on itut_t35 Matadata OBU parsing code.
>>
>> Signed-off-by: James Almer <jamrial at gmail.com>
>> ---
>>  libavcodec/cbs_av1.c                 | 20 ++++++++++++++++++++
>>  libavcodec/cbs_av1.h                 |  7 +++++++
>>  libavcodec/cbs_av1_syntax_template.c | 24 ++++++++++++++++++++++++
>>  3 files changed, 51 insertions(+)
>>
>> ...
>> diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c
>> index 56009145e8..675bfe5bb4 100644
>> --- a/libavcodec/cbs_av1_syntax_template.c
>> +++ b/libavcodec/cbs_av1_syntax_template.c
>> @@ -1755,3 +1755,27 @@ static int FUNC(metadata_obu)(CodedBitstreamContext *ctx, RWContext *rw,
>>  
>>      return 0;
>>  }
>> +
>> +static int FUNC(padding)(CodedBitstreamContext *ctx, RWContext *rw,
> 
> The standard calls this function "padding_obu".
> 
>> +                         AV1RawPadding *current)
>> +{
>> +    int i, err;
>> +
>> +    HEADER("Padding");
>> +
>> +#ifdef READ
>> +    // The payload runs up to the start of the trailing bits, but there might
>> +    // be arbitrarily many trailing zeroes so we need to read through twice.
>> +    current->payload_size = cbs_av1_get_payload_bytes_left(rw);
>> +
>> +    current->payload_ref = av_buffer_alloc(current->payload_size);
>> +    if (!current->payload_ref)
>> +        return AVERROR(ENOMEM);
>> +    current->payload = current->payload_ref->data;
>> +#endif
>> +
>> +    for (i = 0; i < current->payload_size; i++)
>> +        xf(8, obu_padding_byte[i], current->payload[i], 0x00, 0xff, 1, i);
>> +
>> +    return 0;
>> +}
>>
> 
> LGTM with that.
> 
> Thanks,

Changed and pushed. Thanks!


More information about the ffmpeg-devel mailing list