codecs: h264decoder: Fix for MMCO type 2

As per 8.2.5.4.2, we should mark a picture which has
LongTermPicNum == long_term_pic_num as "unused for reference",
not pic_num.

Passing conformance bitstream test with MR2_MW_A

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1768>
This commit is contained in:
Seungha Yang 2020-11-05 18:42:37 +09:00 committed by GStreamer Merge Bot
parent 0e53668a9b
commit e78dc91f9e
3 changed files with 14 additions and 10 deletions

View File

@ -2207,7 +2207,7 @@ modify_ref_pic_list (GstH264Decoder * self, int list)
case 2: case 2:
/* (8-28) */ /* (8-28) */
g_assert (num_ref_idx_lX_active_minus1 + 1 < 32); g_assert (num_ref_idx_lX_active_minus1 + 1 < 32);
pic = gst_h264_dpb_get_long_ref_by_pic_num (priv->dpb, pic = gst_h264_dpb_get_long_ref_by_long_term_pic_num (priv->dpb,
list_mod->value.long_term_pic_num); list_mod->value.long_term_pic_num);
if (!pic) { if (!pic) {
GST_WARNING_OBJECT (self, "Malformed stream, no pic num %d", GST_WARNING_OBJECT (self, "Malformed stream, no pic num %d",

View File

@ -333,16 +333,19 @@ gst_h264_dpb_get_short_ref_by_pic_num (GstH264Dpb * dpb, gint pic_num)
} }
/** /**
* gst_h264_dpb_get_long_ref_by_pic_num: * gst_h264_dpb_get_long_ref_by_long_term_pic_num:
* @dpb: a #GstH264Dpb * @dpb: a #GstH264Dpb
* @pic_num: a picture number * @pic_num: a long term picture number
* *
* Find a long term reference picture which has matching picture number * Find a long term reference picture which has matching long term picture number
* *
* Returns: (nullable) (transfer none): a #GstH264Picture * Returns: (nullable) (transfer none): a #GstH264Picture
*
* Since: 1.20
*/ */
GstH264Picture * GstH264Picture *
gst_h264_dpb_get_long_ref_by_pic_num (GstH264Dpb * dpb, gint pic_num) gst_h264_dpb_get_long_ref_by_long_term_pic_num (GstH264Dpb * dpb,
gint long_term_pic_num)
{ {
gint i; gint i;
@ -352,11 +355,12 @@ gst_h264_dpb_get_long_ref_by_pic_num (GstH264Dpb * dpb, gint pic_num)
GstH264Picture *picture = GstH264Picture *picture =
g_array_index (dpb->pic_list, GstH264Picture *, i); g_array_index (dpb->pic_list, GstH264Picture *, i);
if (picture->ref && picture->long_term && picture->pic_num == pic_num) if (picture->ref && picture->long_term &&
picture->long_term_pic_num == long_term_pic_num)
return picture; return picture;
} }
GST_WARNING ("No long term reference picture for %d", pic_num); GST_WARNING ("No long term reference picture for %d", long_term_pic_num);
return NULL; return NULL;
} }
@ -736,7 +740,7 @@ gst_h264_dpb_perform_memory_management_control_operation (GstH264Dpb * dpb,
case 2: case 2:
/* 8.2.5.4.2 Mark a long term reference picture as unused so it can be /* 8.2.5.4.2 Mark a long term reference picture as unused so it can be
* removed if outputted */ * removed if outputted */
other = gst_h264_dpb_get_long_ref_by_pic_num (dpb, other = gst_h264_dpb_get_long_ref_by_long_term_pic_num (dpb,
ref_pic_marking->long_term_pic_num); ref_pic_marking->long_term_pic_num);
if (other) { if (other) {
other->ref = FALSE; other->ref = FALSE;

View File

@ -180,8 +180,8 @@ GstH264Picture * gst_h264_dpb_get_short_ref_by_pic_num (GstH264Dpb * dpb,
gint pic_num); gint pic_num);
GST_CODECS_API GST_CODECS_API
GstH264Picture * gst_h264_dpb_get_long_ref_by_pic_num (GstH264Dpb * dpb, GstH264Picture * gst_h264_dpb_get_long_ref_by_long_term_pic_num (GstH264Dpb * dpb,
gint pic_num); gint long_term_pic_num);
GST_CODECS_API GST_CODECS_API
GstH264Picture * gst_h264_dpb_get_lowest_frame_num_short_ref (GstH264Dpb * dpb); GstH264Picture * gst_h264_dpb_get_lowest_frame_num_short_ref (GstH264Dpb * dpb);