[vlc-devel] [PATCH 4/5] direct3d11: generalize the full to studio/limited conversion used on the Xbox

Steve Lhomme robux4 at videolabs.io
Mon Mar 6 17:57:52 CET 2017


---
 modules/video_output/win32/direct3d11.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 9ef7791a4b..fedfb090b9 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -111,6 +111,7 @@ struct vout_display_sys_t
     vout_display_sys_win32_t sys;
 
     video_transfer_func_t    display_transfer; /* TODO may go in vout_display_info_t */
+    bool                     display_is_limited_range;
 
 #if !VLC_WINSTORE_APP
     HINSTANCE                hdxgi_dll;        /* handle of the opened dxgi dll */
@@ -1433,6 +1434,12 @@ static int Direct3D11Open(vout_display_t *vd, video_format_t *fmt)
     /* TODO adjust the swapchain transfer function based on the source */
     sys->display_transfer = TRANSFER_FUNC_SRGB;
 
+#if VLC_WINSTORE_APP
+    if (isXboxHardware(sys->d3ddevice)) {
+        sys->display_is_limited_range = 1;
+    }
+#endif
+
     // look for the requested pixel format first
     sys->picQuadConfig = GetOutputFormat(vd, fmt->i_chroma, 0, true, false);
 
@@ -2244,8 +2251,7 @@ static int SetupQuad(vout_display_t *vd, const video_format_t *fmt, d3d_quad_t *
     memcpy(colorspace.Colorspace, ppColorspace, sizeof(colorspace.Colorspace));
     memcpy(colorspace.WhitePoint, WHITE_POINT_D65_TO_FULL, sizeof(colorspace.WhitePoint));
 
-#if VLC_WINSTORE_APP
-    if (isXboxHardware(sys->d3ddevice)) {
+    if (sys->display_is_limited_range) {
         static const FLOAT FULL_TO_STUDIO_RATIO = (256.f - 16.f - 20.f) / 256.f;
         /* limit to 16-235 range as it's expanded again by the hardware */
         WHITE_POINT_D65_TO_FULL[0] += FULL_TO_STUDIO_SHIFT;
@@ -2261,7 +2267,6 @@ static int SetupQuad(vout_display_t *vd, const video_format_t *fmt, d3d_quad_t *
             colorspace.Colorspace[2 * 4] *= FULL_TO_STUDIO_RATIO;
         }
     }
-#endif
 
     constantInit.pSysMem = &colorspace;
 
-- 
2.11.1



More information about the vlc-devel mailing list