[FFmpeg-cvslog] vaapi_h264: Write bitstream restriction fields

Mark Thompson git at videolan.org
Thu Mar 23 12:16:56 EET 2017


ffmpeg | branch: master | Mark Thompson <sw at jkqxz.net> | Sat Oct  1 11:01:08 2016 +0100| [ec17ab381ede4f31c4bdd2767d8f62d24aaf430a] | committer: Mark Thompson

vaapi_h264: Write bitstream restriction fields

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ec17ab381ede4f31c4bdd2767d8f62d24aaf430a
---

 libavcodec/vaapi_encode_h264.c | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/libavcodec/vaapi_encode_h264.c b/libavcodec/vaapi_encode_h264.c
index e90ed64..b550f6f 100644
--- a/libavcodec/vaapi_encode_h264.c
+++ b/libavcodec/vaapi_encode_h264.c
@@ -84,7 +84,12 @@ typedef struct VAAPIEncodeH264MiscSequenceParams {
     char vcl_hrd_parameters_present_flag;
     char low_delay_hrd_flag;
     char pic_struct_present_flag;
-    char bitstream_restriction_flag;
+
+    char motion_vectors_over_pic_boundaries_flag;
+    unsigned int max_bytes_per_pic_denom;
+    unsigned int max_bits_per_mb_denom;
+    unsigned int max_num_reorder_frames;
+    unsigned int max_dec_pic_buffering;
 
     unsigned int cpb_cnt_minus1;
     unsigned int bit_rate_scale;
@@ -263,7 +268,13 @@ static void vaapi_encode_h264_write_vui(PutBitContext *pbc,
 
     u(1, vvui_field(bitstream_restriction_flag));
     if (vseq->vui_fields.bits.bitstream_restriction_flag) {
-        av_assert0(0 && "bitstream restrictions not supported");
+        u(1, mseq_var(motion_vectors_over_pic_boundaries_flag));
+        ue(mseq_var(max_bytes_per_pic_denom));
+        ue(mseq_var(max_bits_per_mb_denom));
+        ue(vvui_field(log2_max_mv_length_horizontal));
+        ue(vvui_field(log2_max_mv_length_vertical));
+        ue(mseq_var(max_num_reorder_frames));
+        ue(mseq_var(max_dec_pic_buffering));
     }
 }
 
@@ -831,6 +842,16 @@ static int vaapi_encode_h264_init_sequence_params(AVCodecContext *avctx)
             mseq->matrix_coefficients      = avctx->colorspace;
         }
 
+        vseq->vui_fields.bits.bitstream_restriction_flag = 1;
+        mseq->motion_vectors_over_pic_boundaries_flag = 1;
+        mseq->max_bytes_per_pic_denom = 0;
+        mseq->max_bits_per_mb_denom   = 0;
+        vseq->vui_fields.bits.log2_max_mv_length_horizontal = 16;
+        vseq->vui_fields.bits.log2_max_mv_length_vertical   = 16;
+
+        mseq->max_num_reorder_frames = (avctx->max_b_frames > 0);
+        mseq->max_dec_pic_buffering  = vseq->max_num_ref_frames;
+
         vseq->bits_per_second = avctx->bit_rate;
 
         vseq->vui_fields.bits.timing_info_present_flag = 1;



More information about the ffmpeg-cvslog mailing list