diff options
author | Niklas Haas <git@haasn.dev> | 2021-05-22 21:18:51 +0200 |
---|---|---|
committer | Niklas Haas <git@haasn.dev> | 2021-05-22 21:18:51 +0200 |
commit | 6c1dd02f322eba2990f4cd9a6b8ddd7a94fbf1dc (patch) | |
tree | d9f0118348e3c62d8fc398f8240dcd984745a6ed /video/out/gpu | |
parent | f4e89dde36644edec7d09856ac83140317f0b687 (diff) | |
download | mpv-6c1dd02f322eba2990f4cd9a6b8ddd7a94fbf1dc.tar.bz2 mpv-6c1dd02f322eba2990f4cd9a6b8ddd7a94fbf1dc.tar.xz |
vo_gpu: fix extreme clipping with --gamut-clipping for HDR outputs
Checking against 1.0 is wrong for this code, because it's in an absolute
luminance scale relative to reference white. We should be normalizing
this by `dst.sig_peak`.
Diffstat (limited to 'video/out/gpu')
-rw-r--r-- | video/out/gpu/video_shaders.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/video/out/gpu/video_shaders.c b/video/out/gpu/video_shaders.c index 91c9aac865..d39b867e2a 100644 --- a/video/out/gpu/video_shaders.c +++ b/video/out/gpu/video_shaders.c @@ -888,7 +888,8 @@ void pass_color_map(struct gl_shader_cache *sc, bool is_linear, float coeff = cmin / (cmin - luma); color.rgb = mix(color.rgb, vec3(luma), coeff); }) - GLSL(float cmax = max(max(color.r, color.g), color.b);) + GLSLF("float cmax = 1.0/%f * max(max(color.r, color.g), color.b);\n", + dst.sig_peak); GLSL(if (cmax > 1.0) color.rgb /= cmax;) } } |