diff options
author | James Almer <jamrial@gmail.com> | 2019-04-13 16:10:19 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2019-04-14 14:51:51 -0300 |
commit | 62074b8f85e083212abdf09c849e148e7634f5a2 (patch) | |
tree | 928a18f238ee1ef633e33f8f17526ffbde220891 /libavcodec/cbs_av1_syntax_template.c | |
parent | b18c8688dd4f097776572d4f78f12f19881c8057 (diff) | |
download | ffmpeg-62074b8f85e083212abdf09c849e148e7634f5a2.tar.gz |
avcodec/cbs_av1: add a function to strip trailing zeroes from a buffer size
Factor it out from cbs_av1_read_metadata_itut_t35()
Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/cbs_av1_syntax_template.c')
-rw-r--r-- | libavcodec/cbs_av1_syntax_template.c | 10 |
1 files changed, 1 insertions, 9 deletions
diff --git a/libavcodec/cbs_av1_syntax_template.c b/libavcodec/cbs_av1_syntax_template.c index 76eb90b279..56009145e8 100644 --- a/libavcodec/cbs_av1_syntax_template.c +++ b/libavcodec/cbs_av1_syntax_template.c @@ -1674,15 +1674,7 @@ static int FUNC(metadata_itut_t35)(CodedBitstreamContext *ctx, RWContext *rw, #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. - { - GetBitContext tmp = *rw; - current->payload_size = 0; - for (i = 0; get_bits_left(rw) >= 8; i++) { - if (get_bits(rw, 8)) - current->payload_size = i; - } - *rw = tmp; - } + current->payload_size = cbs_av1_get_payload_bytes_left(rw); current->payload_ref = av_buffer_alloc(current->payload_size); if (!current->payload_ref) |