[vlc-commits] [Git][videolan/vlc][3.0.x] avcodec: d3d11va: fix AV1 bit depth handling

Steve Lhomme (@robUx4) gitlab at videolan.org
Sat Oct 24 13:53:15 UTC 2026



Steve Lhomme pushed to branch 3.0.x at VideoLAN / VLC


Commits:
2366e389 by Massimiliano De Palma at 2026-10-21T15:46:15+02:00
avcodec: d3d11va: fix AV1 bit depth handling

AV1 uses the same decoder GUID for 8-bit and 10-bit streams, so the output
bit depth cannot be inferred from the GUID. Pass the validated decoder-mode
bit depth to the output setup callback and consider P010 for 10-bit input.

Preserve renderer-format priority and NV12 fallbacks. Update the DXVA2
callback signature without changing its output selection.

- - - - -


4 changed files:

- modules/codec/avcodec/d3d11va.c
- modules/codec/avcodec/directx_va.c
- modules/codec/avcodec/directx_va.h
- modules/codec/avcodec/dxva2.c


Changes:

=====================================
modules/codec/avcodec/d3d11va.c
=====================================
@@ -135,7 +135,7 @@ static char *DxDescribe(vlc_va_sys_t *);
 static int DxCreateVideoService(vlc_va_t *);
 static void DxDestroyVideoService(vlc_va_t *);
 static int DxGetInputList(vlc_va_t *, input_list_t *);
-static int DxSetupOutput(vlc_va_t *, const GUID *, int surface_width, int surface_height);
+static int DxSetupOutput(vlc_va_t *, const GUID *, int bit_depth, int surface_width, int surface_height);
 
 static int DxCreateDecoderSurfaces(vlc_va_t *, int codec_id,
                                    const video_format_t *fmt, unsigned *surface_count);
@@ -556,10 +556,7 @@ static int DxGetInputList(vlc_va_t *va, input_list_t *p_list)
     return VLC_SUCCESS;
 }
 
-extern const GUID DXVA_ModeHEVC_VLD_Main10;
-extern const GUID DXVA_ModeVP9_VLD_10bit_Profile2;
-
-static int DxSetupOutput(vlc_va_t *va, const GUID *input, int surface_width, int surface_height)
+static int DxSetupOutput(vlc_va_t *va, const GUID *input, int bit_depth, int surface_width, int surface_height)
 {
     vlc_va_sys_t *sys = va->sys;
     directx_sys_t *dx_sys = &sys->dx_sys;
@@ -588,7 +585,7 @@ static int DxSetupOutput(vlc_va_t *va, const GUID *input, int surface_width, int
     int idx = 0;
     if ( sys->render != DXGI_FORMAT_UNKNOWN )
         processorInput[idx++] = sys->render;
-    if (IsEqualGUID(input, &DXVA_ModeHEVC_VLD_Main10) || IsEqualGUID(input, &DXVA_ModeVP9_VLD_10bit_Profile2))
+    if (bit_depth == 10)
         processorInput[idx++] = DXGI_FORMAT_P010;
     processorInput[idx++] = DXGI_FORMAT_NV12;
     processorInput[idx++] = DXGI_FORMAT_420_OPAQUE;


=====================================
modules/codec/avcodec/directx_va.c
=====================================
@@ -508,7 +508,7 @@ static int FindVideoServiceConversion(vlc_va_t *va, directx_sys_t *dx_sys,
 
         /* */
         msg_Dbg(va, "Trying to use '%s' as input", mode->name);
-        if (dx_sys->pf_setup_output(va, mode->guid, surface_width, surface_height)==VLC_SUCCESS)
+        if (dx_sys->pf_setup_output(va, mode->guid, mode->bit_depth, surface_width, surface_height)==VLC_SUCCESS)
         {
             dx_sys->input = *mode->guid;
             err = VLC_SUCCESS;


=====================================
modules/codec/avcodec/directx_va.h
=====================================
@@ -74,7 +74,7 @@ typedef struct
      * Find a suitable decoder configuration for the input and set the
      * internal state to use that output
      */
-    int (*pf_setup_output)(vlc_va_t *, const GUID *input, int surface_width, int surface_height);
+    int (*pf_setup_output)(vlc_va_t *, const GUID *input, int bit_depth, int surface_width, int surface_height);
 
 } directx_sys_t;
 


=====================================
modules/codec/avcodec/dxva2.c
=====================================
@@ -142,7 +142,7 @@ static void D3dDestroyDeviceManager(vlc_va_t *);
 static int DxCreateVideoService(vlc_va_t *);
 static void DxDestroyVideoService(vlc_va_t *);
 static int DxGetInputList(vlc_va_t *, input_list_t *);
-static int DxSetupOutput(vlc_va_t *, const GUID *, int surface_width, int surface_height);
+static int DxSetupOutput(vlc_va_t *, const GUID *, int bit_depth, int surface_width, int surface_height);
 
 static int DxCreateVideoDecoder(vlc_va_t *, int codec_id,
                                 const video_format_t *, unsigned *surface_count);
@@ -494,9 +494,9 @@ static int DxGetInputList(vlc_va_t *va, input_list_t *p_list)
     return VLC_SUCCESS;
 }
 
-static int DxSetupOutput(vlc_va_t *va, const GUID *input, int surface_width, int surface_height)
+static int DxSetupOutput(vlc_va_t *va, const GUID *input, int bit_depth, int surface_width, int surface_height)
 {
-    VLC_UNUSED(surface_width); VLC_UNUSED(surface_height);
+    VLC_UNUSED(bit_depth); VLC_UNUSED(surface_width); VLC_UNUSED(surface_height);
     vlc_va_sys_t *sys = va->sys;
 
     const D3DADAPTER_IDENTIFIER9 *identifier = &sys->d3d_dev.identifier;



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2366e38911e5ed8cc1b99d6af2aa5d144d376b66

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/2366e38911e5ed8cc1b99d6af2aa5d144d376b66
You're receiving this email because of your account on code.videolan.org. Manage all notifications: https://code.videolan.org/-/profile/notifications | Help: https://code.videolan.org/help




More information about the vlc-commits mailing list