summaryrefslogtreecommitdiffstats
path: root/video/out/gpu/video_shaders.c
diff options
context:
space:
mode:
authorNiklas Haas <git@haasn.dev>2022-01-03 04:31:50 +0100
committerNiklas Haas <github-daiK1o@haasn.dev>2022-01-07 06:28:14 +0100
commitf3fccfc395ddb7a504ab2aae48452178fa92d907 (patch)
treef273e2a3e74820aeb718601bd709e84cebf123e0 /video/out/gpu/video_shaders.c
parent2332445d8d78d569015cabbacb3d9cf5552e5c73 (diff)
downloadmpv-f3fccfc395ddb7a504ab2aae48452178fa92d907.tar.bz2
mpv-f3fccfc395ddb7a504ab2aae48452178fa92d907.tar.xz
vo_gpu: add --gamut-mapping-mode
Merge --gamut-clipping and --gamut-warning into a single option, --gamut-mapping-mode, better corresponding to the new vo_gpu_next APIs and allowing us to easily extend this option as new modes are added in the future.
Diffstat (limited to 'video/out/gpu/video_shaders.c')
-rw-r--r--video/out/gpu/video_shaders.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/video/out/gpu/video_shaders.c b/video/out/gpu/video_shaders.c
index d7774a61e5..6dcef77fa0 100644
--- a/video/out/gpu/video_shaders.c
+++ b/video/out/gpu/video_shaders.c
@@ -882,7 +882,7 @@ void pass_color_map(struct gl_shader_cache *sc, bool is_linear,
gl_sc_uniform_mat3(sc, "cms_matrix", true, &m[0][0]);
GLSL(color.rgb = cms_matrix * color.rgb;)
- if (opts->gamut_clipping) {
+ if (!opts->gamut_mode || opts->gamut_mode == GAMUT_DESATURATE) {
GLSL(float cmin = min(min(color.r, color.g), color.b);)
GLSL(if (cmin < 0.0) {
float luma = dot(dst_luma, color.rgb);
@@ -907,8 +907,8 @@ void pass_color_map(struct gl_shader_cache *sc, bool is_linear,
GLSLF("color.rgb *= vec3(%f);\n", 1.0 / dst_range);
- // Warn for remaining out-of-gamut colors is enabled
- if (opts->gamut_warning) {
+ // Warn for remaining out-of-gamut colors if enabled
+ if (opts->gamut_mode == GAMUT_WARN) {
GLSL(if (any(greaterThan(color.rgb, vec3(1.005))) ||
any(lessThan(color.rgb, vec3(-0.005)))))
GLSL(color.rgb = vec3(1.0) - color.rgb;) // invert