mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
h264: minor clean-ups.
Move DPB flush up if the current picture to decode is an IDR. Besides, don't bother to check for IDR pictures in dpb_add() function since an explicit DPB flush was already performed in this case.
This commit is contained in:
parent
d180a3a9f6
commit
afddf11e22
1 changed files with 5 additions and 13 deletions
|
@ -470,9 +470,7 @@ dpb_add(GstVaapiDecoderH264 *decoder, GstVaapiPictureH264 *picture)
|
||||||
guint i;
|
guint i;
|
||||||
|
|
||||||
// Remove all unused pictures
|
// Remove all unused pictures
|
||||||
if (GST_VAAPI_PICTURE_IS_IDR(picture))
|
if (!GST_VAAPI_PICTURE_IS_IDR(picture)) {
|
||||||
dpb_flush(decoder);
|
|
||||||
else {
|
|
||||||
i = 0;
|
i = 0;
|
||||||
while (i < priv->dpb_count) {
|
while (i < priv->dpb_count) {
|
||||||
GstVaapiPictureH264 * const picture = priv->dpb[i];
|
GstVaapiPictureH264 * const picture = priv->dpb[i];
|
||||||
|
@ -1666,7 +1664,7 @@ init_picture_ref_lists(GstVaapiDecoderH264 *decoder)
|
||||||
priv->long_ref_count = long_ref_count;
|
priv->long_ref_count = long_ref_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
init_picture_refs(
|
init_picture_refs(
|
||||||
GstVaapiDecoderH264 *decoder,
|
GstVaapiDecoderH264 *decoder,
|
||||||
GstVaapiPictureH264 *picture,
|
GstVaapiPictureH264 *picture,
|
||||||
|
@ -1715,7 +1713,6 @@ init_picture_refs(
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -1740,6 +1737,7 @@ init_picture(
|
||||||
if (nalu->type == GST_H264_NAL_SLICE_IDR) {
|
if (nalu->type == GST_H264_NAL_SLICE_IDR) {
|
||||||
GST_DEBUG("<IDR>");
|
GST_DEBUG("<IDR>");
|
||||||
GST_VAAPI_PICTURE_FLAG_SET(picture, GST_VAAPI_PICTURE_FLAG_IDR);
|
GST_VAAPI_PICTURE_FLAG_SET(picture, GST_VAAPI_PICTURE_FLAG_IDR);
|
||||||
|
dpb_flush(decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize slice type */
|
/* Initialize slice type */
|
||||||
|
@ -1769,6 +1767,7 @@ init_picture(
|
||||||
else
|
else
|
||||||
base_picture->structure = GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD;
|
base_picture->structure = GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD;
|
||||||
|
|
||||||
|
/* Initialize reference flags */
|
||||||
if (nalu->ref_idc) {
|
if (nalu->ref_idc) {
|
||||||
GstH264DecRefPicMarking * const dec_ref_pic_marking =
|
GstH264DecRefPicMarking * const dec_ref_pic_marking =
|
||||||
&slice_hdr->dec_ref_pic_marking;
|
&slice_hdr->dec_ref_pic_marking;
|
||||||
|
@ -1783,14 +1782,7 @@ init_picture(
|
||||||
}
|
}
|
||||||
|
|
||||||
init_picture_poc(decoder, picture, slice_hdr);
|
init_picture_poc(decoder, picture, slice_hdr);
|
||||||
|
init_picture_refs(decoder, picture, slice_hdr);
|
||||||
if (GST_VAAPI_PICTURE_IS_IDR(picture))
|
|
||||||
dpb_flush(decoder);
|
|
||||||
|
|
||||||
if (!init_picture_refs(decoder, picture, slice_hdr)) {
|
|
||||||
GST_ERROR("failed to initialize references");
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue