summaryrefslogtreecommitdiff
path: root/gst-libs/gst
diff options
context:
space:
mode:
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-10-31 16:37:14 +0100
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2012-11-16 16:50:30 +0100
commit531b1ceab4245f823690d2a961e7a4815f4f890c (patch)
treec609846b5e51b7cc56e483376ed38fc4be79019b /gst-libs/gst
parent1b95cd564ca33a16ebbe4291d3109ae98da4c770 (diff)
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.
Diffstat (limited to 'gst-libs/gst')
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_h264.c18
1 files changed, 5 insertions, 13 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
index 9b63f182..fcc671ab 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c
@@ -470,9 +470,7 @@ dpb_add(GstVaapiDecoderH264 *decoder, GstVaapiPictureH264 *picture)
guint i;
// Remove all unused pictures
- if (GST_VAAPI_PICTURE_IS_IDR(picture))
- dpb_flush(decoder);
- else {
+ if (!GST_VAAPI_PICTURE_IS_IDR(picture)) {
i = 0;
while (i < priv->dpb_count) {
GstVaapiPictureH264 * const picture = priv->dpb[i];
@@ -1666,7 +1664,7 @@ init_picture_ref_lists(GstVaapiDecoderH264 *decoder)
priv->long_ref_count = long_ref_count;
}
-static gboolean
+static void
init_picture_refs(
GstVaapiDecoderH264 *decoder,
GstVaapiPictureH264 *picture,
@@ -1715,7 +1713,6 @@ init_picture_refs(
default:
break;
}
- return TRUE;
}
static gboolean
@@ -1740,6 +1737,7 @@ init_picture(
if (nalu->type == GST_H264_NAL_SLICE_IDR) {
GST_DEBUG("<IDR>");
GST_VAAPI_PICTURE_FLAG_SET(picture, GST_VAAPI_PICTURE_FLAG_IDR);
+ dpb_flush(decoder);
}
/* Initialize slice type */
@@ -1769,6 +1767,7 @@ init_picture(
else
base_picture->structure = GST_VAAPI_PICTURE_STRUCTURE_BOTTOM_FIELD;
+ /* Initialize reference flags */
if (nalu->ref_idc) {
GstH264DecRefPicMarking * const dec_ref_pic_marking =
&slice_hdr->dec_ref_pic_marking;
@@ -1783,14 +1782,7 @@ init_picture(
}
init_picture_poc(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;
- }
+ init_picture_refs(decoder, picture, slice_hdr);
return TRUE;
}