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.
This commit is contained in:
Gwenole Beauchesne 2012-10-16 16:52:04 +02:00
parent 26b7c46eda
commit 2e8949d77b

View file

@ -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);
}