[vlc-devel] [PATCH 01/10] avcodec: va: add a function to quickly check if the format might be decoded

Steve Lhomme robux4 at ycbcr.xyz
Fri Dec 20 16:07:23 CET 2019


For now it's meant to replace the function that actually forces the 
output format. It does the same but just telling if it might work or 
not. Further down my branch I get rid of this code. (ie coming later)

After that there's still a whitelist of allowed hardware formats we try 
to load a module for. For example we don't allow CUDA to try to load a 
module. We also keep track of the hardware pixel format to track changes 
on GetFormat(). So we'd need to get the info of which one is selected by 
the current va as well. It's not impossible but that's a bit of work.

On 2019-12-20 15:48, Rémi Denis-Courmont wrote:
> 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
> 
> 
> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser 
> ma brièveté.
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list