diff options
author | Niklas Haas <git@nand.wakku.to> | 2015-03-14 21:13:44 +0100 |
---|---|---|
committer | Niklas Haas <git@nand.wakku.to> | 2015-03-14 21:14:50 +0100 |
commit | a0e747ab357fdad41a3c020ba0435c5d582039b6 (patch) | |
tree | def604f996c3e4a7b84ae403376318d1b035e84d /video/out/gl_video.c | |
parent | efe0fb75bc4bc3572edd241e60f31d620413a919 (diff) | |
download | mpv-a0e747ab357fdad41a3c020ba0435c5d582039b6.tar.bz2 mpv-a0e747ab357fdad41a3c020ba0435c5d582039b6.tar.xz |
vo_opengl: only clamp when necessary
This essentially makes it so that every gamma function that crops up
somewhere has a corresponding clamp in front of it.
Diffstat (limited to 'video/out/gl_video.c')
-rw-r--r-- | video/out/gl_video.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 5eec1b3513..3c94e3c439 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -1343,11 +1343,10 @@ static void pass_convert_yuv(struct gl_video *p) lessThanEqual(vec3(0.0181), color.rgb));) } - GLSL(color.rgb = clamp(color.rgb, 0.0, 1.0);) - if (p->user_gamma_enabled) { p->use_indirect = true; gl_sc_uniform_f(sc, "user_gamma", user_gamma); + GLSL(color.rgb = clamp(color.rgb, 0.0, 1.0);) GLSL(color.rgb = pow(color.rgb, vec3(1.0 / user_gamma));) } @@ -1398,6 +1397,7 @@ static void pass_render_main(struct gl_video *p) bool use_linear = p->opts.linear_scaling || p->opts.sigmoid_upscaling || use_cms || p->image_params.gamma == MP_CSP_TRC_LINEAR; if (use_linear) { + GLSL(color.rgb = clamp(color.rgb, 0.0, 1.0);) p->use_indirect = true; switch (p->image_params.gamma) { case MP_CSP_TRC_SRGB: |