diff options
author | He Junyan <junyan.he@intel.com> | 2020-12-22 23:43:52 +0800 |
---|---|---|
committer | He Junyan <junyan.he@intel.com> | 2021-01-06 00:08:10 +0800 |
commit | 5523b75550111a6eae828c3053a5015bef233090 (patch) | |
tree | d2002f99f7eb06a5c3c7e5e7b8cd494882f13949 /gst-libs | |
parent | 0a34b6882e4480b22bcde4ce1236a9d6725a6da8 (diff) |
libs: decoder: Add decode_with_surface_id for AV1 film_grain.
The AV1 film_graim feature needs two surfaces the same time for
decoding. One is for recon surface which will be used as reference
later, and the other one is for display. The GstVaapiPicture should
contain the surface for display, while the vaBeginPicture() need
the recon surface as the target.
We add a gst_vaapi_picture_decode_with_surface_id API to handle this
kind of requirement.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/191>
Diffstat (limited to 'gst-libs')
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_av1.c | 6 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_objects.c | 17 | ||||
-rw-r--r-- | gst-libs/gst/vaapi/gstvaapidecoder_objects.h | 5 |
3 files changed, 23 insertions, 5 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_av1.c b/gst-libs/gst/vaapi/gstvaapidecoder_av1.c index 5d5610c7..062b310b 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_av1.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_av1.c @@ -945,11 +945,13 @@ static GstVaapiDecoderStatus av1_decode_current_picture (GstVaapiDecoderAV1 * decoder) { GstVaapiDecoderAV1Private *priv = &decoder->priv; - GstVaapiPicture *const picture = (GstVaapiPicture *) priv->current_picture; + GstVaapiPictureAV1 *const picture = + (GstVaapiPictureAV1 *) priv->current_picture; g_assert (picture); - if (!gst_vaapi_picture_decode (picture)) + if (!gst_vaapi_picture_decode_with_surface_id (GST_VAAPI_PICTURE (picture), + GST_VAAPI_SURFACE_PROXY_SURFACE_ID (picture->recon_proxy))) return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN; return GST_VAAPI_DECODER_STATUS_SUCCESS; diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_objects.c b/gst-libs/gst/vaapi/gstvaapidecoder_objects.c index 8139e140..159625f8 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_objects.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_objects.c @@ -242,7 +242,8 @@ do_decode (VADisplay dpy, VAContextID ctx, VABufferID * buf_id, void **buf_ptr) } gboolean -gst_vaapi_picture_decode (GstVaapiPicture * picture) +gst_vaapi_picture_decode_with_surface_id (GstVaapiPicture * picture, + VASurfaceID surface_id) { GstVaapiIqMatrix *iq_matrix; GstVaapiBitPlane *bitplane; @@ -254,13 +255,14 @@ gst_vaapi_picture_decode (GstVaapiPicture * picture) guint i; g_return_val_if_fail (GST_VAAPI_IS_PICTURE (picture), FALSE); + g_return_val_if_fail (surface_id != VA_INVALID_SURFACE, FALSE); va_display = GET_VA_DISPLAY (picture); va_context = GET_VA_CONTEXT (picture); - GST_DEBUG ("decode picture 0x%08x", picture->surface_id); + GST_DEBUG ("decode picture 0x%08x", surface_id); - status = vaBeginPicture (va_display, va_context, picture->surface_id); + status = vaBeginPicture (va_display, va_context, surface_id); if (!vaapi_check_status (status, "vaBeginPicture()")) return FALSE; @@ -319,6 +321,15 @@ gst_vaapi_picture_decode (GstVaapiPicture * picture) return TRUE; } +gboolean +gst_vaapi_picture_decode (GstVaapiPicture * picture) +{ + g_return_val_if_fail (GST_VAAPI_IS_PICTURE (picture), FALSE); + + return gst_vaapi_picture_decode_with_surface_id (picture, + picture->surface_id); +} + /* Mark picture as output for internal purposes only. Don't push frame out */ static void do_output_internal (GstVaapiPicture * picture) diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_objects.h b/gst-libs/gst/vaapi/gstvaapidecoder_objects.h index 16ef2550..cc301d17 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_objects.h +++ b/gst-libs/gst/vaapi/gstvaapidecoder_objects.h @@ -198,6 +198,11 @@ gst_vaapi_picture_decode (GstVaapiPicture * picture); G_GNUC_INTERNAL gboolean +gst_vaapi_picture_decode_with_surface_id (GstVaapiPicture * picture, + VASurfaceID surface_id); + +G_GNUC_INTERNAL +gboolean gst_vaapi_picture_output (GstVaapiPicture * picture); G_GNUC_INTERNAL |