[FFmpeg-devel] [PATCH 2/2 v2] avcodec/cbs_av1: add support for Padding OBUs
Mark Thompson
sw at jkqxz.net
Sun Apr 14 20:22:31 EEST 2019
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,
- Mark
More information about the ffmpeg-devel
mailing list