[vlc-devel] [vlc-commits] d3d11va: find the best output format for the source GUID

Steve Lhomme robux4 at ycbcr.xyz
Wed Dec 18 09:10:27 CET 2019


On 2019-12-17 8:27, Steve Lhomme wrote:
> vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Dec 17 08:12:13 2019 +0100| [88b5a9d6eac020c27972fb454ab10d82412f31b8] | committer: Steve Lhomme
> 
> d3d11va: find the best output format for the source GUID
> 
> Taking in account the bitdepth and chroma subsampling.

While this is the most appropriate way to handle the best possible 
output format, it conflicts with the hardcoded chroma that the generic 
VA code assumes the module will use before it gets to decide (here).

For example if the source if 444 the VA code will decide we'll use 
VLC_CODEC_D3D11_OPAQUE_444, but then the decoder might find out only 
NV12 output is supported which is VLC_CODEC_D3D11_OPAQUE.

I'll see if we can get rid of the generic VA pick, since we don't need 
to guess it first to initialize the vout.

> Log the format that was picked that way.
> 
>> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=88b5a9d6eac020c27972fb454ab10d82412f31b8
> ---
> 
>   modules/codec/avcodec/d3d11va.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/modules/codec/avcodec/d3d11va.c b/modules/codec/avcodec/d3d11va.c
> index 65d99dbed3..394f5fddf7 100644
> --- a/modules/codec/avcodec/d3d11va.c
> +++ b/modules/codec/avcodec/d3d11va.c
> @@ -248,10 +248,11 @@ static void Close(vlc_va_t *va)
>   
>   static const struct vlc_va_operations ops = { Get, Close, };
>   
> -static const d3d_format_t *GetDirectRenderingFormat(vlc_va_t *vd, vlc_fourcc_t i_src_chroma)
> +static const d3d_format_t *GetDirectRenderingFormat(vlc_va_t *vd, const directx_va_mode_t *mode)
>   {
>       UINT supportFlags = D3D11_FORMAT_SUPPORT_DECODER_OUTPUT | D3D11_FORMAT_SUPPORT_SHADER_LOAD;
> -    return FindD3D11Format( vd, &vd->sys->d3d_dev, i_src_chroma, D3D11_RGB_FORMAT|D3D11_YUV_FORMAT, 0, 0, 0, true, supportFlags );
> +    return FindD3D11Format( vd, &vd->sys->d3d_dev, 0, D3D11_RGB_FORMAT|D3D11_YUV_FORMAT,
> +                            mode->bit_depth, mode->log2_chroma_h+1, mode->log2_chroma_w+1, true, supportFlags );
>   }
>   
>   static const d3d_format_t *GetDirectDecoderFormat(vlc_va_t *vd, vlc_fourcc_t i_src_chroma)
> @@ -465,11 +466,14 @@ static int DxSetupOutput(vlc_va_t *va, const directx_va_mode_t *mode, const vide
>   
>       DXGI_FORMAT processorInput[6];
>       int idx = 0;
> -    const d3d_format_t *decoder_format = GetDirectRenderingFormat(va, fmt->i_chroma);
> +    const d3d_format_t *decoder_format = GetDirectRenderingFormat(va, mode);
>       if (decoder_format == NULL)
>           decoder_format = GetDirectDecoderFormat(va, fmt->i_chroma);
>       if (decoder_format != NULL)
> +    {
> +        msg_Dbg(va, "favor decoder format %s", decoder_format->name);
>           processorInput[idx++] = decoder_format->formatTexture;
> +    }
>   
>       if (mode->bit_depth > 10)
>           processorInput[idx++] = DXGI_FORMAT_P016;
> 
> _______________________________________________
> vlc-commits mailing list
> vlc-commits at videolan.org
> https://mailman.videolan.org/listinfo/vlc-commits
> 


More information about the vlc-devel mailing list