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

Steve Lhomme git at videolan.org
Tue Dec 17 08:27:02 CET 2019


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.

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;



More information about the vlc-commits mailing list