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>
This commit is contained in:
He Junyan 2020-12-22 23:43:52 +08:00
parent 0a34b6882e
commit 5523b75550
3 changed files with 23 additions and 5 deletions

View file

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

View file

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

View file

@ -196,6 +196,11 @@ G_GNUC_INTERNAL
gboolean
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);