summaryrefslogtreecommitdiff
path: root/libavcodec/cbs_h2645.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_h2645.c
parentbdfc1d3cd33079b44dcb1f2ba02bfc69b811a3ca (diff)
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_h2645.c')
-rw-r--r--libavcodec/cbs_h2645.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
index d42073cc5a..095e449ddc 100644
--- a/libavcodec/cbs_h2645.c
+++ b/libavcodec/cbs_h2645.c
@@ -233,6 +233,16 @@ static int cbs_write_se_golomb(CodedBitstreamContext *ctx, PutBitContext *pbc,
return 0;
}
+// payload_extension_present() - true if we are before the last 1-bit
+// in the payload structure, which must be in the last byte.
+static int cbs_h265_payload_extension_present(GetBitContext *gbc, uint32_t payload_size,
+ int cur_pos)
+{
+ int bits_left = payload_size * 8 - cur_pos;
+ return (bits_left > 0 &&
+ (bits_left > 7 || show_bits(gbc, bits_left) & MAX_UINT_BITS(bits_left - 1)));
+}
+
#define HEADER(name) do { \
ff_cbs_trace_header(ctx, name); \
} while (0)