From ed7d3dadbfa06e1f098930329313e24704c748ce Mon Sep 17 00:00:00 2001 From: zhongcong Date: Fri, 24 May 2013 19:00:54 +0800 Subject: [PATCH 1/2] h264: fix exec reference picture marking error --- gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c index da4dee9..ddfabf2 100755 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c @@ -2946,8 +2946,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_FLAG_LONG_TERM_REFERENCE, TRUE); } /* 8.2.5.4.4. Mark pictures with LongTermFramIdx > max_long_term_frame_idx @@ -3010,9 +3009,23 @@ exec_ref_pic_marking_adaptive_mmco_6( GstH264RefPicMarking *ref_pic_marking ) { + GstVaapiDecoderH264Private * const priv = decoder->priv; + GstVaapiDecPicBufLayer * dpb_layer = priv->current_dpb_layer; + gint32 i; + + for (i = 0; i < dpb_layer->long_ref_count; i++) { + if (dpb_layer->long_ref[i]->long_term_frame_idx == ref_pic_marking->long_term_frame_idx) + break; + } + if (i != dpb_layer->long_ref_count) { + gst_vaapi_picture_h264_set_reference(dpb_layer->long_ref[i], 0, TRUE); + ARRAY_REMOVE_INDEX(dpb_layer->long_ref, i); + } + + dpb_layer->long_ref[dpb_layer->long_ref_count++] = picture; 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, TRUE); } /* 8.2.5.4. Adaptive memory control decoded reference picture marking process */ -- 1.7.9.5 From 7726e842fa57e5ea79ec25d5f3f13a5347fda045 Mon Sep 17 00:00:00 2001 From: zhongcong Date: Wed, 29 May 2013 20:18:05 +0800 Subject: [PATCH 2/2] h264: fix exec reference picture marking error add new --- gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c index ddfabf2..a77caa2 100755 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c @@ -3025,7 +3025,8 @@ exec_ref_pic_marking_adaptive_mmco_6( dpb_layer->long_ref[dpb_layer->long_ref_count++] = picture; 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, TRUE); + GST_VAAPI_PICTURE_FLAG_LONG_TERM_REFERENCE, + GST_VAAPI_PICTURE_IS_FRAME(picture) || !GST_VAAPI_PICTURE_IS_FIRST_FIELD(picture)); } /* 8.2.5.4. Adaptive memory control decoded reference picture marking process */ -- 1.7.9.5