[vlc-commits] dxva2: set the i_chroma corresponding to the decoded format

Steve Lhomme git at videolan.org
Wed Jan 8 08:28:14 CET 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Wed Dec 18 14:44:16 2019 +0100| [700bb33fb793e9cc68cbf715ba67d79752bead20] | committer: Steve Lhomme

dxva2: set the i_chroma corresponding to the decoded format

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=700bb33fb793e9cc68cbf715ba67d79752bead20
---

 modules/codec/avcodec/dxva2.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/modules/codec/avcodec/dxva2.c b/modules/codec/avcodec/dxva2.c
index a6e3f1ae47..59b8d88473 100644
--- a/modules/codec/avcodec/dxva2.c
+++ b/modules/codec/avcodec/dxva2.c
@@ -280,17 +280,10 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat hwfmt, const
 
     va->sys = sys;
 
-    switch (fmt_out->i_chroma)
-    {
-        case VLC_CODEC_D3D9_OPAQUE_10B:
-            sys->render = MAKEFOURCC('P','0','1','0');
-            break;
-        case VLC_CODEC_D3D9_OPAQUE:
-            sys->render =  MAKEFOURCC('N','V','1','2');
-            break;
-        default:
-            vlc_assert_unreachable();
-    }
+    if (desc->comp[0].depth > 8)
+        sys->render = MAKEFOURCC('P','0','1','0');
+    else
+        sys->render =  MAKEFOURCC('N','V','1','2');
 
     /* Load dll*/
     sys->dxva2_dll = LoadLibrary(TEXT("DXVA2.DLL"));
@@ -327,6 +320,10 @@ static int Open(vlc_va_t *va, AVCodecContext *ctx, enum PixelFormat hwfmt, const
         goto error;
     }
 
+    if (sys->render == MAKEFOURCC('P','0','1','0'))
+        final_fmt.i_chroma = VLC_CODEC_D3D9_OPAQUE_10B;
+    else
+        final_fmt.i_chroma = VLC_CODEC_D3D9_OPAQUE;
     err = va_pool_SetupDecoder(va, sys->va_pool, ctx, &final_fmt, sys->hw.surface_count);
     if (err != VLC_SUCCESS)
         goto error;



More information about the vlc-commits mailing list