From 2e8949d77b1503bcd51e4cc6a92ab204db371302 Mon Sep 17 00:00:00 2001 From: Gwenole Beauchesne Date: Tue, 16 Oct 2012 16:52:04 +0200 Subject: [PATCH] h264: add flag to compile with strict DPB ordering mode. Allow build with strict DPB ordering mode whereby evicted entries are replaced by the next entries, in order instead of optimizing it away with the last entry in the DPB. This is only useful for debugging purpose, against a reference SW decoder for example. --- gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c index 9dfd38d..8785923 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c @@ -37,6 +37,9 @@ #define DEBUG 1 #include "gstvaapidebug.h" +/* Defined to 1 if strict ordering of DPB is needed. Only useful for debug */ +#define USE_STRICT_DPB_ORDERING 0 + typedef struct _GstVaapiPictureH264 GstVaapiPictureH264; typedef struct _GstVaapiPictureH264Class GstVaapiPictureH264Class; typedef struct _GstVaapiSliceH264 GstVaapiSliceH264; @@ -369,9 +372,13 @@ static void dpb_remove_index(GstVaapiDecoderH264 *decoder, guint index) { GstVaapiDecoderH264Private * const priv = decoder->priv; - guint num_pictures = --priv->dpb_count; + guint i, num_pictures = --priv->dpb_count; - if (index != num_pictures) + if (USE_STRICT_DPB_ORDERING) { + for (i = index; i < num_pictures; i++) + gst_vaapi_picture_replace(&priv->dpb[i], priv->dpb[i + 1]); + } + else if (index != num_pictures) gst_vaapi_picture_replace(&priv->dpb[index], priv->dpb[num_pictures]); gst_vaapi_picture_replace(&priv->dpb[num_pictures], NULL); } -- 2.7.4