[vlc-commits] direct3d11: guestimate the luminance peak when we know the output transfer

Steve Lhomme git at videolan.org
Thu May 9 15:31:12 CEST 2019


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Thu May  9 12:09:46 2019 +0200| [9d435e79aaafd99daeec1f773d128e1631bbe5a0] | committer: Steve Lhomme

direct3d11: guestimate the luminance peak when we know the output transfer

And simplify the d3d11_local_swapchain access

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

 modules/video_output/win32/direct3d11.c | 38 ++++++++++++++++-----------------
 1 file changed, 18 insertions(+), 20 deletions(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index b0c60a32a7..d02589d4e6 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -186,7 +186,7 @@ static void UpdatePicQuadPosition(vout_display_t *);
 
 static int Control(vout_display_t *, int, va_list);
 
-static void SelectSwapchainColorspace(vout_display_t *vd, const struct direct3d_cfg_t *cfg);
+static void SelectSwapchainColorspace(struct d3d11_local_swapchain *, const struct direct3d_cfg_t *);
 
 static int UpdateDisplayFormat(vout_display_t *vd, struct output_cfg_t *out)
 {
@@ -197,6 +197,21 @@ static int UpdateDisplayFormat(vout_display_t *vd, struct output_cfg_t *out)
     sys->display.primaries = out->primaries;
     sys->display.b_full_range = out->full_range;
 
+    /* guestimate the display peak luminance */
+    switch (sys->display.transfer)
+    {
+    case TRANSFER_FUNC_LINEAR:
+    case TRANSFER_FUNC_SRGB:
+        sys->display.luminance_peak = DEFAULT_SRGB_BRIGHTNESS;
+        break;
+    case TRANSFER_FUNC_SMPTE_ST2084:
+        sys->display.luminance_peak = MAX_PQ_BRIGHTNESS;
+        break;
+    default:
+        sys->display.luminance_peak = DEFAULT_SRGB_BRIGHTNESS;
+        break;
+    }
+
     return VLC_SUCCESS;
 }
 
@@ -435,7 +450,7 @@ static bool UpdateSwapchain( void *opaque, const struct direct3d_cfg_t *cfg )
 
     D3D11_ClearRenderTargets( &display->d3d_dev, sys->display.pixelFormat, display->swapchainTargetView );
 
-    SelectSwapchainColorspace(vd, cfg);
+    SelectSwapchainColorspace(display, cfg);
 
     return true;
 }
@@ -1134,10 +1149,8 @@ static bool canHandleConversion(const dxgi_color_space *src, const dxgi_color_sp
 }
 #endif
 
-static void SelectSwapchainColorspace(vout_display_t *vd, const struct direct3d_cfg_t *cfg)
+static void SelectSwapchainColorspace(struct d3d11_local_swapchain *display, const struct direct3d_cfg_t *cfg)
 {
-    vout_display_sys_t *sys = vd->sys;
-    struct d3d11_local_swapchain *display = &sys->internal_swapchain;
     HRESULT hr;
     int best = -1;
     int score, best_score = 0;
@@ -1229,21 +1242,6 @@ static void SelectSwapchainColorspace(vout_display_t *vd, const struct direct3d_
     else
         msg_Err(display->obj, "Failed to set colorspace %s. (hr=0x%lX)", display->colorspace->name, hr);
 done:
-    /* guestimate the display peak luminance */
-    switch (display->colorspace->transfer)
-    {
-    case TRANSFER_FUNC_LINEAR:
-    case TRANSFER_FUNC_SRGB:
-        sys->display.luminance_peak = DEFAULT_SRGB_BRIGHTNESS;
-        break;
-    case TRANSFER_FUNC_SMPTE_ST2084:
-        sys->display.luminance_peak = MAX_PQ_BRIGHTNESS;
-        break;
-    /* there is no other output transfer on Windows */
-    default:
-        vlc_assert_unreachable();
-    }
-
     if (dxgiswapChain3)
         IDXGISwapChain3_Release(dxgiswapChain3);
 }



More information about the vlc-commits mailing list