summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-14 14:25:34 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-16 16:50:31 +0100
commit79d253c01cc2d92b529ffd4824545ebaf1c3cb2e (patch)
tree10c2e162fdb16425925e293d836c34fe844d5693
parent3cb52124adf5e497c6226c52a2b77f29a139e620 (diff)
h264: fix VAPictureParameterBufferH264.ReferenceFrames[] construction.
... for interlaced streams. The short_ref[] and long_ref[] arrays may contain up to 32 fields but VA ReferenceFrames[] array expects up to 16 reference frames, thus including both fields.
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_h264.c25
1 files changed, 16 insertions, 9 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
index f9998a2d..8e88220c 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
@@ -2458,8 +2458,12 @@ vaapi_init_picture(VAPictureH264 *pic)
}
static void
-vaapi_fill_picture(VAPictureH264 *pic, GstVaapiPictureH264 *picture)
+vaapi_fill_picture(VAPictureH264 *pic, GstVaapiPictureH264 *picture,
+ guint picture_structure)
{
+ if (!picture_structure)
+ picture_structure = picture->structure;
+
pic->picture_id = picture->base.surface_id;
pic->flags = 0;
@@ -2473,7 +2477,7 @@ vaapi_fill_picture(VAPictureH264 *pic, GstVaapiPictureH264 *picture)
pic->frame_idx = picture->frame_num;
}
- switch (picture->structure) {
+ switch (picture_structure) {
case GST_VAAPI_PICTURE_STRUCTURE_FRAME:
pic->TopFieldOrderCnt = picture->field_poc[TOP_FIELD];
pic->BottomFieldOrderCnt = picture->field_poc[BOTTOM_FIELD];
@@ -2507,11 +2511,14 @@ fill_picture(
guint i, n;
/* Fill in VAPictureParameterBufferH264 */
- vaapi_fill_picture(&pic_param->CurrPic, picture);
- for (i = 0, n = 0; i < priv->short_ref_count; i++, n++)
- vaapi_fill_picture(&pic_param->ReferenceFrames[n], priv->short_ref[i]);
- for (i = 0; i < priv->long_ref_count; i++, n++)
- vaapi_fill_picture(&pic_param->ReferenceFrames[n], priv->long_ref[i]);
+ vaapi_fill_picture(&pic_param->CurrPic, picture, 0);
+
+ for (i = 0, n = 0; i < priv->dpb_count; i++) {
+ GstVaapiFrameStore * const fs = priv->dpb[i];
+ if (gst_vaapi_frame_store_has_reference(fs))
+ vaapi_fill_picture(&pic_param->ReferenceFrames[n++],
+ fs->buffers[0], fs->structure);
+ }
for (; n < G_N_ELEMENTS(pic_param->ReferenceFrames); n++)
vaapi_init_picture(&pic_param->ReferenceFrames[n]);
@@ -2793,7 +2800,7 @@ fill_RefPicList(GstVaapiDecoderH264 *decoder, GstVaapiSliceH264 *slice)
slice_hdr->num_ref_idx_l0_active_minus1;
for (i = 0; i < priv->RefPicList0_count && priv->RefPicList0[i]; i++)
- vaapi_fill_picture(&slice_param->RefPicList0[i], priv->RefPicList0[i]);
+ vaapi_fill_picture(&slice_param->RefPicList0[i], priv->RefPicList0[i], 0);
for (; i <= slice_param->num_ref_idx_l0_active_minus1; i++)
vaapi_init_picture(&slice_param->RefPicList0[i]);
@@ -2804,7 +2811,7 @@ fill_RefPicList(GstVaapiDecoderH264 *decoder, GstVaapiSliceH264 *slice)
slice_hdr->num_ref_idx_l1_active_minus1;
for (i = 0; i < priv->RefPicList1_count && priv->RefPicList1[i]; i++)
- vaapi_fill_picture(&slice_param->RefPicList1[i], priv->RefPicList1[i]);
+ vaapi_fill_picture(&slice_param->RefPicList1[i], priv->RefPicList1[i], 0);
for (; i <= slice_param->num_ref_idx_l1_active_minus1; i++)
vaapi_init_picture(&slice_param->RefPicList1[i]);
return TRUE;