[vlc-devel] [PATCH 2/4] direct3d11: handle output to a SMPTE ST 2084 display

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


This is especially important for sub pictures that are not HDR but displayed on
HDR display.
---
 modules/video_output/win32/direct3d11.c | 24 +++++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index 806dcea932..31cc4e6242 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -1643,8 +1643,30 @@ static HRESULT CompilePixelShader(vout_display_t *vd, const d3d_format_t *format
                             rgb = hable(32.0 * rgb) / HABLE_DIV;\
                             return rgb";
                     }
-                    break;
                 }
+                else
+                    msg_Warn(vd, "don't know how to transfer from %d to sRGB", src_transfer);
+                break;
+
+            case TRANSFER_FUNC_SMPTE_ST2084:
+                if (src_transfer == TRANSFER_FUNC_LINEAR)
+                {
+                    /* Linear to ST2084 */
+                    psz_src_transform =
+                           "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, m1);\
+                            rgb = (c1 + c2 * rgb) / (1 + c3 * rgb);\
+                            rgb = pow(rgb, m3);\
+                            return rgb";
+                }
+                else
+                    msg_Warn(vd, "don't know how to transfer from %d to SMPTE ST 2084", src_transfer);
+                break;
             default:
                 msg_Warn(vd, "don't know how to transfer from %d to %d", src_transfer, sys->display_transfer);
                 break;
-- 
2.11.1



More information about the vlc-devel mailing list