AVCENC: Pass the H264 RefPicList0/1 by using slice_param instead of hacked DPB reference
authorZhao Yakui <yakui.zhao@intel.com>
Thu, 9 May 2013 06:21:32 +0000 (14:21 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 24 Jun 2013 08:46:16 +0000 (16:46 +0800)
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
(cherry picked from commit 968a9bf006679ad8d752fa1ddcd4bb80fc8c5e51)

test/encode/avcenc.c

index 5549060..fafb366 100644 (file)
@@ -151,6 +151,8 @@ static struct {
     int i_dpb_output_delay_length;
 } avcenc_context;
 
+static  VAPictureH264 ReferenceFrames[16], RefPicList0[32], RefPicList1[32];
+
 static void create_encode_pipe()
 {
     VAEntrypoint entrypoints[5];
@@ -442,6 +444,23 @@ static void avcenc_update_slice_parameter(int slice_type)
     slice_param->idr_pic_id = 0;
 
     /* FIXME: fill other fields */
+    if ((slice_type == SLICE_TYPE_P) || (slice_type == SLICE_TYPE_B)) {
+       int j;
+       slice_param->RefPicList0[0].picture_id = surface_ids[SID_REFERENCE_PICTURE_L0];
+       for (j = 1; j < 32; j++) {
+           slice_param->RefPicList0[j].picture_id = VA_INVALID_SURFACE;
+           slice_param->RefPicList0[j].flags = VA_PICTURE_H264_INVALID;
+       }
+    }
+
+    if ((slice_type == SLICE_TYPE_B)) {
+       int j;
+       slice_param->RefPicList1[0].picture_id = surface_ids[SID_REFERENCE_PICTURE_L1];
+       for (j = 1; j < 32; j++) {
+           slice_param->RefPicList1[j].picture_id = VA_INVALID_SURFACE;
+           slice_param->RefPicList1[j].flags = VA_PICTURE_H264_INVALID;
+       }
+    }
 
     va_status = vaCreateBuffer(va_dpy,
                                avcenc_context.context_id,