[vlc-devel] [PATCH 1/4] direct3d11: use values directly from the SMPTE ST 2084 standard

Steve Lhomme robux4 at videolabs.io
Mon Mar 6 16:09:22 CET 2017


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

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index e7c9185609..806dcea932 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1608,9 +1608,15 @@ static HRESULT CompilePixelShader(vout_display_t *vd, const d3d_format_t *format
         case TRANSFER_FUNC_SMPTE_ST2084:
             /* ST2084 to Linear */
             psz_src_transform =
-                    "rgb = pow(rgb, 1.0/78.843750);\
-                    rgb = max(rgb - 0.835938, 0.0) / (18.851562 - 18.687500 * rgb);\
-                    rgb = pow(rgb, 1.0/0.159302);\
+                   "const float m1 = 2610.0 / (4096.0 * 4);\
+                    const float m2 = (2523.0 / 4096.0) * 128.0;\
+                    const float c1 = 3424.0 / 4096.0;\
+                    const float c2 = (2413.0 / 4096.0) * 32.0;\
+                    const float c3 = (2392.0 / 4096.0) * 32.0;\
+                    \
+                    rgb = pow(rgb, 1.0/m2);\
+                    rgb = max(rgb - c1, 0.0) / (c2 - c3 * rgb);\
+                    rgb = pow(rgb, 1.0/m1);\
                     return rgb";
             src_transfer = TRANSFER_FUNC_LINEAR;
             break;
-- 
2.11.1



More information about the vlc-devel mailing list