aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cbs_h265_syntax_template.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2020-04-20 17:33:55 -0300
committerJames Almer <jamrial@gmail.com>2020-05-03 19:53:01 -0300
commit3a41bac4e2d0891dcfc19b73a3dfae0e70237084 (patch)
tree14d0c00cea4b9be43381ff10a5eb2a3ae6fccaae /libavcodec/cbs_h265_syntax_template.c
parentbdfc1d3cd33079b44dcb1f2ba02bfc69b811a3ca (diff)
downloadffmpeg-3a41bac4e2d0891dcfc19b73a3dfae0e70237084.tar.gz
avcodec/cbs_h265: move the payload_extension_present check into its own function
Will be reused in the following patch. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/cbs_h265_syntax_template.c')
-rw-r--r--libavcodec/cbs_h265_syntax_template.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c
index a51b12cfc6..ed08b06e9c 100644
--- a/libavcodec/cbs_h265_syntax_template.c
+++ b/libavcodec/cbs_h265_syntax_template.c
@@ -1572,7 +1572,7 @@ static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw,
int err, i, length;
#ifdef READ
- int start_pos, end_pos, bits_left;
+ int start_pos, end_pos;
start_pos = get_bits_count(rw);
#endif
@@ -1651,12 +1651,9 @@ static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw,
}
#ifdef READ
- // payload_extension_present() - true if we are before the last 1-bit
- // in the payload structure, which must be in the last byte.
end_pos = get_bits_count(rw);
- bits_left = *payload_size * 8 - (end_pos - start_pos);
- if (bits_left > 0 &&
- (bits_left > 7 || ff_ctz(show_bits(rw, bits_left)) < bits_left - 1))
+ if (cbs_h265_payload_extension_present(rw, *payload_size,
+ end_pos - start_pos))
flag(use_alt_cpb_params_flag);
else
infer(use_alt_cpb_params_flag, 0);