]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/cbs_vp9.c
avfilter/vf_v360: remove w/h changing for flat output
[ffmpeg] / libavcodec / cbs_vp9.c
index 7498be4b73b4066360d2fef898102a132a262199..bd172100fcdbf4a0ab0021d0f9d508f75e3152e3 100644 (file)
@@ -267,14 +267,14 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc,
 #define RWContext GetBitContext
 
 #define xf(width, name, var, subs, ...) do { \
-        uint32_t value = 0; \
+        uint32_t value; \
         CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \
                                    SUBSCRIPTS(subs, __VA_ARGS__), \
                                    &value, 0, (1 << width) - 1)); \
         var = value; \
     } while (0)
 #define xs(width, name, var, subs, ...) do { \
-        int32_t value = 0; \
+        int32_t value; \
         CHECK(cbs_vp9_read_s(ctx, rw, width, #name, \
                              SUBSCRIPTS(subs, __VA_ARGS__), &value)); \
         var = value; \
@@ -282,7 +282,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc,
 
 
 #define increment(name, min, max) do { \
-        uint32_t value = 0; \
+        uint32_t value; \
         CHECK(cbs_vp9_read_increment(ctx, rw, min, max, #name, &value)); \
         current->name = value; \
     } while (0)
@@ -305,7 +305,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc,
 
 #define prob(name, subs, ...) do { \
         uint8_t prob_coded; \
-        int8_t prob; \
+        uint8_t prob; \
         xf(1, name.prob_coded, prob_coded, subs, __VA_ARGS__); \
         if (prob_coded) \
             xf(8, name.prob, prob, subs, __VA_ARGS__); \
@@ -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; \
+        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: " \
@@ -383,7 +395,7 @@ static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc,
 
 #include "cbs_vp9_syntax_template.c"
 
-#undef READ
+#undef WRITE
 #undef READWRITE
 #undef RWContext
 #undef xf
@@ -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
 
@@ -444,7 +457,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
         }
         if (pos + index_size != frag->data_size) {
             av_log(ctx->log_ctx, AV_LOG_WARNING, "Extra padding at "
-                   "end of superframe: %zu bytes.\n",
+                   "end of superframe: %"SIZE_SPECIFIER" bytes.\n",
                    frag->data_size - (pos + index_size));
         }
 
@@ -461,7 +474,7 @@ static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx,
     return 0;
 }
 
-static void cbs_vp9_free_frame(void *unit, uint8_t *content)
+static void cbs_vp9_free_frame(void *opaque, uint8_t *content)
 {
     VP9RawFrame *frame = (VP9RawFrame*)content;
     av_buffer_unref(&frame->data_ref);
@@ -525,7 +538,7 @@ static int cbs_vp9_write_unit(CodedBitstreamContext *ctx,
         if (err < 0) {
             av_log(ctx->log_ctx, AV_LOG_ERROR, "Unable to allocate a "
                    "sufficiently large write buffer (last attempt "
-                   "%zu bytes).\n", priv->write_buffer_size);
+                   "%"SIZE_SPECIFIER" bytes).\n", priv->write_buffer_size);
             return err;
         }
     }