summaryrefslogtreecommitdiff
path: root/gst-libs
diff options
context:
space:
mode:
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>2017-03-28 10:53:20 -0700
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>2017-03-28 10:53:20 -0700
commitdbbe340906008c5088d2c048c589e84bde829b62 (patch)
treec8ba1644e953475c8acbbc2c6dcee8ae2f2abba2 /gst-libs
parent7f8b3254509b005b6c2351b53dda56fd5ad31e68 (diff)
encoder: h264: Fix B frame encoding artifacts
The current implementation is updating the POC values only in Slice parameter Buffer.But we are not filling the picture order count and reference flags in VAPictureH264 while populating VA Picture/Slice structures.The latest intel-vaapi-driver is directly accessing the above fields from VAPicutreH264 provided as RefPicLists, which resulted some wrong maths and prediction errors in driver. https://bugzilla.gnome.org/show_bug.cgi?id=780620
Diffstat (limited to 'gst-libs')
-rw-r--r--gst-libs/gst/vaapi/gstvaapiencoder_h264.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
index bd5e7912..21d5d198 100644
--- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c
@@ -1894,6 +1894,10 @@ fill_picture (GstVaapiEncoderH264 * encoder, GstVaapiEncPicture * picture,
pic_param->ReferenceFrames[i].picture_id =
GST_VAAPI_SURFACE_PROXY_SURFACE_ID (ref_pic->pic);
+ pic_param->ReferenceFrames[i].TopFieldOrderCnt = ref_pic->poc;
+ pic_param->ReferenceFrames[i].flags |=
+ VA_PICTURE_H264_SHORT_TERM_REFERENCE;
+ pic_param->ReferenceFrames[i].frame_idx = ref_pic->frame_num;
++i;
}
g_assert (i <= 16 && i <= ref_pool->max_ref_frames);
@@ -2002,6 +2006,11 @@ add_slice_headers (GstVaapiEncoderH264 * encoder, GstVaapiEncPicture * picture,
for (; i_ref < reflist_0_count; ++i_ref) {
slice_param->RefPicList0[i_ref].picture_id =
GST_VAAPI_SURFACE_PROXY_SURFACE_ID (reflist_0[i_ref]->pic);
+ slice_param->RefPicList0[i_ref].TopFieldOrderCnt =
+ reflist_0[i_ref]->poc;
+ slice_param->RefPicList0[i_ref].flags |=
+ VA_PICTURE_H264_SHORT_TERM_REFERENCE;
+ slice_param->RefPicList0[i_ref].frame_idx = reflist_0[i_ref]->frame_num;
}
g_assert (i_ref == 1);
}
@@ -2014,6 +2023,11 @@ add_slice_headers (GstVaapiEncoderH264 * encoder, GstVaapiEncPicture * picture,
for (; i_ref < reflist_1_count; ++i_ref) {
slice_param->RefPicList1[i_ref].picture_id =
GST_VAAPI_SURFACE_PROXY_SURFACE_ID (reflist_1[i_ref]->pic);
+ slice_param->RefPicList1[i_ref].TopFieldOrderCnt =
+ reflist_1[i_ref]->poc;
+ slice_param->RefPicList1[i_ref].flags |=
+ VA_PICTURE_H264_SHORT_TERM_REFERENCE;
+ slice_param->RefPicList1[i_ref].flags |= reflist_1[i_ref]->frame_num;
}
g_assert (i_ref == 1);
}