[vlc-commits] direct3d11: use values directly from the SMPTE ST 2084 standard
Steve Lhomme
git at videolan.org
Fri Mar 10 19:40:44 CET 2017
vlc | branch: master | Steve Lhomme <robUx4 at videolabs.io> | Tue Mar 7 16:39:05 2017 +0100| [782a826b637b54bc03f9491847a316906fbec53f] | committer: Jean-Baptiste Kempf
direct3d11: use values directly from the SMPTE ST 2084 standard
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=782a826b637b54bc03f9491847a316906fbec53f
---
modules/video_output/win32/direct3d11.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/modules/video_output/win32/direct3d11.c b/modules/video_output/win32/direct3d11.c
index e7c9185..0718e99 100644
--- a/modules/video_output/win32/direct3d11.c
+++ b/modules/video_output/win32/direct3d11.c
@@ -345,6 +345,12 @@ static const char* globPixelShaderDefault = "\
}\
";
+#define ST2084_PQ_CONSTANTS "const float ST2084_m1 = 2610.0 / (4096.0 * 4);\
+const float ST2084_m2 = (2523.0 / 4096.0) * 128.0;\
+const float ST2084_c1 = 3424.0 / 4096.0;\
+const float ST2084_c2 = (2413.0 / 4096.0) * 32.0;\
+const float ST2084_c3 = (2392.0 / 4096.0) * 32.0;"
+
static int Direct3D11MapPoolTexture(picture_t *picture)
{
picture_sys_t *p_sys = picture->p_sys;
@@ -1608,9 +1614,10 @@ 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);\
+ ST2084_PQ_CONSTANTS
+ "rgb = pow(rgb, 1.0/ST2084_m2);\
+ rgb = max(rgb - ST2084_c1, 0.0) / (ST2084_c2 - ST2084_c3 * rgb);\
+ rgb = pow(rgb, 1.0/ST2084_m1);\
return rgb";
src_transfer = TRANSFER_FUNC_LINEAR;
break;
More information about the vlc-commits
mailing list