diff options
author | Niklas Haas <git@haasn.xyz> | 2017-06-10 02:05:28 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-06-18 20:54:44 +0200 |
commit | 326e02e955fbd88b5fbd489a14cf332b1e450957 (patch) | |
tree | 36356313f212dadf85890fba1e5f3a0cdcbae933 /video/out | |
parent | da7ae75e2626750bb254ac174b21fecba5eb41cd (diff) | |
download | mpv-326e02e955fbd88b5fbd489a14cf332b1e450957.tar.bz2 mpv-326e02e955fbd88b5fbd489a14cf332b1e450957.tar.xz |
vo_opengl: implement sony s-log1 trc
Source: https://pro.sony.com/bbsccms/assets/files/mkt/cinema/solutions/slog_manual.pdf
Not 100% confident in the implementation since the values from the spec
seem to be very subtly off (~1%), but it should be close enough for
practical purposes.
Diffstat (limited to 'video/out')
-rw-r--r-- | video/out/opengl/video_shaders.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/video/out/opengl/video_shaders.c b/video/out/opengl/video_shaders.c index 26f751afb2..63a4713a34 100644 --- a/video/out/opengl/video_shaders.c +++ b/video/out/opengl/video_shaders.c @@ -235,6 +235,11 @@ static const float VLOG_B = 0.00873, VLOG_C = 0.241514, VLOG_D = 0.598206; +// Common constants for Sony S-Log +static const float SLOG_A = 0.432699, + SLOG_B = 0.037584, + SLOG_C = 0.616596 + 0.03; + // Linearize (expand), given a TRC as input. In essence, this is the ITU-R // EOTF, calculated on an idealized (reference) monitor with a white point of // MP_REF_WHITE and infinite contrast. @@ -298,6 +303,11 @@ void pass_linearize(struct gl_shader_cache *sc, enum mp_csp_trc trc) " lessThanEqual(vec3(0.181), color.rgb)); \n", VLOG_D, VLOG_C, VLOG_B); break; + case MP_CSP_TRC_S_LOG1: + GLSLF("color.rgb = pow(vec3(10.0), (color.rgb - vec3(%f)) / vec3(%f))\n" + " - vec3(%f);\n", + SLOG_C, SLOG_A, SLOG_B); + break; default: abort(); } @@ -363,6 +373,10 @@ void pass_delinearize(struct gl_shader_cache *sc, enum mp_csp_trc trc) " lessThanEqual(vec3(0.01), color.rgb)); \n", VLOG_C / M_LN10, VLOG_B, VLOG_D); break; + case MP_CSP_TRC_S_LOG1: + GLSLF("color.rgb = vec3(%f) * log(color.rgb + vec3(%f)) + vec3(%f);\n", + SLOG_A / M_LN10, SLOG_B, SLOG_C); + break; default: abort(); } |