aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/cbs_vp9.c
diff options
context:
space:
mode:
authorMark Thompson <sw@jkqxz.net>2018-10-27 20:41:00 +0100
committerMark Thompson <sw@jkqxz.net>2018-10-30 22:22:27 +0000
commitedcdf3512376b64d6add61fb5c21b418ebbba1e3 (patch)
tree83a77782f09f83110ffb754cd9393bb82f488207 /libavcodec/cbs_vp9.c
parentad5ca1fb72fc1e0d7cdeec85b279608f8195c96e (diff)
downloadffmpeg-edcdf3512376b64d6add61fb5c21b418ebbba1e3.tar.gz
cbs_vp9: Ensure that reserved zero bits are actually zero
Diffstat (limited to 'libavcodec/cbs_vp9.c')
-rw-r--r--libavcodec/cbs_vp9.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c
index 7498be4b73..c03ce986c0 100644
--- a/libavcodec/cbs_vp9.c
+++ b/libavcodec/cbs_vp9.c
@@ -314,6 +314,12 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc,
current->name = prob; \
} while (0)
+#define fixed(width, name, value) do { \
+ av_unused uint32_t fixed_value = value; \
+ CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \
+ 0, &fixed_value, value, value)); \
+ } while (0)
+
#define infer(name, value) do { \
current->name = value; \
} while (0)
@@ -331,6 +337,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc,
#undef fle
#undef delta_q
#undef prob
+#undef fixed
#undef infer
#undef byte_alignment
@@ -370,6 +377,11 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc,
xf(8, name.prob, current->name, subs, __VA_ARGS__); \
} while (0)
+#define fixed(width, name, value) do { \
+ CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \
+ 0, value, value, value)); \
+ } while (0)
+
#define infer(name, value) do { \
if (current->name != (value)) { \
av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \
@@ -392,6 +404,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc,
#undef fle
#undef delta_q
#undef prob
+#undef fixed
#undef infer
#undef byte_alignment