diff options
author | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2015-06-24 13:58:17 +0200 |
---|---|---|
committer | Gwenole Beauchesne <gwenole.beauchesne@intel.com> | 2015-07-20 15:25:46 +0200 |
commit | 80a7ab09591474d20e158f774d50ce1e5c32d35e (patch) | |
tree | 4643640012a1e65f794a8e377fd613646ac9f757 /gst-libs | |
parent | 939bdb08a5f23e46e4507774931874fcc721946b (diff) | |
download | gst-vaapi-80a7ab09591474d20e158f774d50ce1e5c32d35e.tar.gz |
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
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_h264.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c index 677e73b7..45a5e5aa 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_h264.c @@ -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 * |