From e95a42ea6e9e7235623c71ea2aa2b13c92380ac2 Mon Sep 17 00:00:00 2001 From: Cong Zhong Date: Fri, 24 May 2013 19:00:54 +0800 Subject: [PATCH] decoder: h264: fix long-term reference picture marking process. Fix reference picture marking process with memory_management_control_op set to 3 and 6, i.e. assign LongTermFrameIdx to a short-term reference picture, or the current picture. This fixes decoding of FRExt_MMCO4_Sony_B. https://bugs.freedesktop.org/show_bug.cgi?id=64624 https://bugzilla.gnome.org/show_bug.cgi?id=724518 [squashed, edited to use GST_VAAPI_PICTURE_IS_COMPLETE() macro] Signed-off-by: Gwenole Beauchesne --- gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c index d392a42659..b870c92c1a 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c @@ -2264,7 +2264,7 @@ exec_ref_pic_marking_adaptive_mmco_3( ref_picture->long_term_frame_idx = ref_pic_marking->long_term_frame_idx; gst_vaapi_picture_h264_set_reference(ref_picture, GST_VAAPI_PICTURE_FLAG_LONG_TERM_REFERENCE, - GST_VAAPI_PICTURE_IS_FRAME(picture)); + GST_VAAPI_PICTURE_IS_COMPLETE(picture)); } /* 8.2.5.4.4. Mark pictures with LongTermFramIdx > max_long_term_frame_idx @@ -2325,9 +2325,22 @@ exec_ref_pic_marking_adaptive_mmco_6( GstH264RefPicMarking *ref_pic_marking ) { + GstVaapiDecoderH264Private * const priv = &decoder->priv; + guint i; + + for (i = 0; i < priv->long_ref_count; i++) { + if (priv->long_ref[i]->long_term_frame_idx == ref_pic_marking->long_term_frame_idx) + break; + } + if (i != priv->long_ref_count) { + gst_vaapi_picture_h264_set_reference(priv->long_ref[i], 0, TRUE); + ARRAY_REMOVE_INDEX(priv->long_ref, i); + } + picture->long_term_frame_idx = ref_pic_marking->long_term_frame_idx; gst_vaapi_picture_h264_set_reference(picture, - GST_VAAPI_PICTURE_FLAG_LONG_TERM_REFERENCE, FALSE); + GST_VAAPI_PICTURE_FLAG_LONG_TERM_REFERENCE, + GST_VAAPI_PICTURE_IS_COMPLETE(picture)); } /* 8.2.5.4. Adaptive memory control decoded reference picture marking process */