[vlc-devel] [PATCH 01/10] avcodec: va: add a function to quickly check if the format might be decoded
Rémi Denis-Courmont
remi at remlab.net
Fri Dec 20 15:48:58 CET 2019
Why is this needed anymore? It should be possible to add a new VA without changing the avcodec plugin.
Le 18 décembre 2019 16:53:04 GMT+02:00, Steve Lhomme <robux4 at ycbcr.xyz> a écrit :
>Similar to vlc_va_GetChroma() but without forcing an output format.
>---
> modules/codec/avcodec/va.c | 57 ++++++++++++++++++++++++++++++++++++++
> modules/codec/avcodec/va.h | 9 ++++++
> 2 files changed, 66 insertions(+)
>
>diff --git a/modules/codec/avcodec/va.c b/modules/codec/avcodec/va.c
>index fc3ef3fe8ab..f045304efb5 100644
>--- a/modules/codec/avcodec/va.c
>+++ b/modules/codec/avcodec/va.c
>@@ -95,6 +95,63 @@ vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat
>hwfmt, enum PixelFormat swfmt)
> }
> }
>
>+bool vlc_va_MightDecode(enum PixelFormat hwfmt, enum PixelFormat
>swfmt)
>+{
>+ switch (hwfmt)
>+ {
>+ case AV_PIX_FMT_VAAPI_VLD:
>+ switch (swfmt)
>+ {
>+ case AV_PIX_FMT_YUVJ420P:
>+ case AV_PIX_FMT_YUV420P:
>+ case AV_PIX_FMT_YUV420P10LE:
>+ return true;
>+ default:
>+ return false;
>+ }
>+ case AV_PIX_FMT_DXVA2_VLD:
>+ switch (swfmt)
>+ {
>+ case AV_PIX_FMT_YUV420P10LE:
>+ case AV_PIX_FMT_YUVJ420P:
>+ case AV_PIX_FMT_YUV420P:
>+ return true;
>+ default:
>+ return false;
>+ }
>+ break;
>+
>+ case AV_PIX_FMT_D3D11VA_VLD:
>+ switch (swfmt)
>+ {
>+ case AV_PIX_FMT_YUV420P10LE:
>+ case AV_PIX_FMT_YUVJ420P:
>+ case AV_PIX_FMT_YUV420P:
>+ return true;
>+ default:
>+ return false;
>+ }
>+ break;
>+
>+ case AV_PIX_FMT_VDPAU:
>+ switch (swfmt)
>+ {
>+ case AV_PIX_FMT_YUVJ444P:
>+ case AV_PIX_FMT_YUV444P:
>+ case AV_PIX_FMT_YUVJ422P:
>+ case AV_PIX_FMT_YUV422P:
>+ case AV_PIX_FMT_YUVJ420P:
>+ case AV_PIX_FMT_YUV420P:
>+ return true;
>+ default:
>+ return false;
>+ }
>+ break;
>+ default:
>+ return false;
>+ }
>+}
>+
> static int vlc_va_Start(void *func, bool forced, va_list ap)
> {
> vlc_va_t *va = va_arg(ap, vlc_va_t *);
>diff --git a/modules/codec/avcodec/va.h b/modules/codec/avcodec/va.h
>index 95d1303f683..8ef429f4f96 100644
>--- a/modules/codec/avcodec/va.h
>+++ b/modules/codec/avcodec/va.h
>@@ -64,6 +64,15 @@ typedef int (*vlc_va_open)(vlc_va_t *,
>AVCodecContext *, const AVPixFmtDescripto
> */
>vlc_fourcc_t vlc_va_GetChroma(enum PixelFormat hwfmt, enum PixelFormat
>swfmt);
>
>+/**
>+ * Determines whether the hardware acceleration PixelFormat can be
>used to
>+ * decode pixels similar to the software PixelFormat.
>+ * @param hwfmt the hardware acceleration pixel format
>+ * @param swfmt the software pixel format
>+ * @return true if the hardware acceleration should be supported
>+ */
>+bool vlc_va_MightDecode(enum PixelFormat hwfmt, enum PixelFormat
>swfmt);
>+
> /**
> * Creates an accelerated video decoding back-end for libavcodec.
> * @param obj parent VLC object
>--
>2.17.1
>
>_______________________________________________
>vlc-devel mailing list
>To unsubscribe or modify your subscription options:
>https://mailman.videolan.org/listinfo/vlc-devel
--
Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20191220/9456cf76/attachment.html>
More information about the vlc-devel
mailing list