From d66598eeed10175b946fda8c76712714f578bb56 Mon Sep 17 00:00:00 2001 From: Niklas Haas Date: Wed, 7 Jan 2015 08:25:22 +0100 Subject: video: Remove some stale CMS code, minor cosmetics This removes an old code path that was disabled in 016bb14. --- video/csputils.c | 6 +----- video/out/gl_video.c | 5 +---- video/out/gl_video_shaders.glsl | 12 ++++-------- 3 files changed, 6 insertions(+), 17 deletions(-) diff --git a/video/csputils.c b/video/csputils.c index 9b558c9a3e..ea83739e8e 100644 --- a/video/csputils.c +++ b/video/csputils.c @@ -476,11 +476,7 @@ void mp_get_xyz2rgb_coeffs(struct mp_csp_params *params, // want to linearize any brightness additions. 2 is a reasonable // approximation for any sort of gamma function that could be in use. // As this is an aesthetic setting only, any exact values do not matter. - if (brightness < 0) { - brightness *= -brightness; - } else { - brightness *= brightness; - } + brightness *= fabs(brightness); for (int i = 0; i < 3; i++) m->c[i] = brightness; diff --git a/video/out/gl_video.c b/video/out/gl_video.c index 12dc4d503a..af9e759f40 100644 --- a/video/out/gl_video.c +++ b/video/out/gl_video.c @@ -1124,10 +1124,7 @@ static void compile_shaders(struct gl_video *p) shader_def_opt(&header_final, "USE_3DLUT", p->use_lut_3d); // 3DLUT overrides SRGB shader_def_opt(&header_final, "USE_SRGB", p->opts.srgb && !p->use_lut_3d); - shader_def_opt(&header_final, "USE_CONST_LUMA_INV_APPROX", - use_const_luma && !use_cms && p->opts.approx_gamma); - shader_def_opt(&header_final, "USE_CONST_LUMA_INV_BT2020", - use_const_luma && !use_cms && !p->opts.approx_gamma); + shader_def_opt(&header_final, "USE_CONST_LUMA_INV", use_const_luma && !use_cms); shader_def_opt(&header_final, "USE_DITHER", p->dither_texture != 0); shader_def_opt(&header_final, "USE_TEMPORAL_DITHER", p->opts.temporal_dither); diff --git a/video/out/gl_video_shaders.glsl b/video/out/gl_video_shaders.glsl index 1549539d2c..2f5940c26f 100644 --- a/video/out/gl_video_shaders.glsl +++ b/video/out/gl_video_shaders.glsl @@ -453,14 +453,10 @@ void main() { // Adapt and compand from the linear BT2020 source to the sRGB output color = srgb_compand(color); #endif - // If none of these options took care of companding again, we have to do - // it manually here for the previously-expanded channels. This again - // comes in two flavours, one for the approximate gamma system and one - // for the actual gamma system. -#ifdef USE_CONST_LUMA_INV_APPROX - color = pow(color, vec3(1.0/1.95)); -#endif -#ifdef USE_CONST_LUMA_INV_BT2020 + // If none of these options took care of companding again (ie. CMS is + // disabled), we still need to re-compand const luma signals, because + // they always come out as linear light (and we can't simply output that). +#ifdef USE_CONST_LUMA_INV color = bt2020_compand(color); #endif #ifdef USE_DITHER -- cgit v1.2.3