0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

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`.
This commit is contained in:
Niklas Haas 2021-05-22 21:18:51 +02:00
parent f4e89dde36
commit 6c1dd02f32

View File

@ -888,7 +888,8 @@ void pass_color_map(struct gl_shader_cache *sc, bool is_linear,
float coeff = cmin / (cmin - luma); float coeff = cmin / (cmin - luma);
color.rgb = mix(color.rgb, vec3(luma), coeff); 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;) GLSL(if (cmax > 1.0) color.rgb /= cmax;)
} }
} }