diff options
author | He Junyan <junyan.he@intel.com> | 2021-07-20 23:36:38 +0800 |
---|---|---|
committer | GStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org> | 2021-07-21 15:23:17 +0000 |
commit | be223ad316bbd044dd9e3ea51e33b53edcd00b2b (patch) | |
tree | e8d8cf1e5f369e83bc2de623dd6fc06d6a3c1ca8 /gst-libs/gst | |
parent | b4e388744944b851872b4e8f5338ef8d3e72cd7d (diff) | |
download | gstreamer-plugins-bad-be223ad316bbd044dd9e3ea51e33b53edcd00b2b.tar.gz |
codecs: h264dec: Add a flag to record whether picture is reference.
The picture->ref field will change from time to time according to decoder's
state and reference sliding window. We need another flag to record whether
the picture is a reference picture when it is created, and this can help
the bumping check.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/2373>
Diffstat (limited to 'gst-libs/gst')
-rw-r--r-- | gst-libs/gst/codecs/gsth264decoder.c | 1 | ||||
-rw-r--r-- | gst-libs/gst/codecs/gsth264picture.c | 10 | ||||
-rw-r--r-- | gst-libs/gst/codecs/gsth264picture.h | 2 |
3 files changed, 11 insertions, 2 deletions
diff --git a/gst-libs/gst/codecs/gsth264decoder.c b/gst-libs/gst/codecs/gsth264decoder.c index 189ed2620..da70095a6 100644 --- a/gst-libs/gst/codecs/gsth264decoder.c +++ b/gst-libs/gst/codecs/gsth264decoder.c @@ -2199,6 +2199,7 @@ gst_h264_decoder_init_gap_picture (GstH264Decoder * self, picture->frame_num = picture->pic_num = frame_num; picture->dec_ref_pic_marking.adaptive_ref_pic_marking_mode_flag = FALSE; picture->ref = GST_H264_PICTURE_REF_SHORT_TERM; + picture->ref_pic = TRUE; picture->dec_ref_pic_marking.long_term_reference_flag = FALSE; picture->field = GST_H264_PICTURE_FIELD_FRAME; diff --git a/gst-libs/gst/codecs/gsth264picture.c b/gst-libs/gst/codecs/gsth264picture.c index e7bf8c687..417986c62 100644 --- a/gst-libs/gst/codecs/gsth264picture.c +++ b/gst-libs/gst/codecs/gsth264picture.c @@ -707,7 +707,7 @@ gst_h264_dpb_needs_bump (GstH264Dpb * dpb, GstH264Picture * to_insert, return FALSE; } - if (to_insert->ref != GST_H264_PICTURE_REF_NONE) { + if (to_insert->ref_pic) { GST_TRACE ("No empty frame buffer for ref frame, need bumping."); return TRUE; } @@ -1055,7 +1055,13 @@ gst_h264_picture_set_reference (GstH264Picture * picture, g_return_if_fail (picture != NULL); picture->ref = reference; + if (reference > GST_H264_PICTURE_REF_NONE) + picture->ref_pic = TRUE; - if (other_field && picture->other_field) + if (other_field && picture->other_field) { picture->other_field->ref = reference; + + if (reference > GST_H264_PICTURE_REF_NONE) + picture->other_field->ref_pic = TRUE; + } } diff --git a/gst-libs/gst/codecs/gsth264picture.h b/gst-libs/gst/codecs/gsth264picture.h index 4e9a7a0b8..962ed5e66 100644 --- a/gst-libs/gst/codecs/gsth264picture.h +++ b/gst-libs/gst/codecs/gsth264picture.h @@ -143,6 +143,8 @@ struct _GstH264Picture gboolean idr; gint idr_pic_id; GstH264PictureReference ref; + /* Whether a reference picture. */ + gboolean ref_pic; gboolean needed_for_output; gboolean mem_mgmt_5; |