decoder: h264: track corrupted frames.

Mark the picture as "corrupted" if it is reconstructed from corrupted
references or if those references are fake, e.g. resulting from lost
frames.

This is useful for notifying the upper layer, or downstream elements,
that the decoded frame may contain artefacts.

https://bugzilla.gnome.org/show_bug.cgi?id=703921
This commit is contained in:
Gwenole Beauchesne 2015-06-24 13:58:17 +02:00
parent 939bdb08a5
commit 80a7ab0959

View file

@ -2875,6 +2875,37 @@ exec_picture_refs_modification(
exec_picture_refs_modification_1(decoder, picture, slice_hdr, 1);
}
static gboolean
check_picture_ref_corruption(GstVaapiDecoderH264 *decoder,
GstVaapiPictureH264 *RefPicList[32], guint RefPicList_count)
{
const guint corrupted_flags =
GST_VAAPI_PICTURE_FLAG_CORRUPTED | GST_VAAPI_PICTURE_FLAG_GHOST;
guint i;
for (i = 0; i < RefPicList_count; i++) {
GstVaapiPictureH264 * const picture = RefPicList[i];
if (picture && (GST_VAAPI_PICTURE_FLAGS(picture) & corrupted_flags))
return TRUE;
}
return FALSE;
}
static void
mark_picture_refs(GstVaapiDecoderH264 *decoder, GstVaapiPictureH264 *picture)
{
GstVaapiDecoderH264Private * const priv = &decoder->priv;
if (GST_VAAPI_PICTURE_IS_CORRUPTED(picture))
return;
if (check_picture_ref_corruption(decoder,
priv->RefPicList0, priv->RefPicList0_count) ||
check_picture_ref_corruption(decoder,
priv->RefPicList1, priv->RefPicList1_count))
GST_VAAPI_PICTURE_FLAG_SET(picture, GST_VAAPI_PICTURE_FLAG_CORRUPTED);
}
static void
init_picture_ref_lists(GstVaapiDecoderH264 *decoder,
GstVaapiPictureH264 *picture)
@ -2975,6 +3006,8 @@ init_picture_refs(
default:
break;
}
mark_picture_refs(decoder, picture);
}
static GstVaapiPictureH264 *