X-Git-Url: https://git.sesse.net/?p=movit;a=blobdiff_plain;f=lift_gamma_gain_effect.frag;h=9047d64bbc2230c263e6fb5a6025642435cf8cd0;hp=775941ebc641e35049b7b333422eed4b9e237dcc;hb=c2371eea5dadf97add7c1a71b8ea660973c9c6de;hpb=b10c546f579c7ccb5939161e61a71cd18a3f9bbd diff --git a/lift_gamma_gain_effect.frag b/lift_gamma_gain_effect.frag index 775941e..9047d64 100644 --- a/lift_gamma_gain_effect.frag +++ b/lift_gamma_gain_effect.frag @@ -6,6 +6,10 @@ vec4 FUNCNAME(vec2 tc) { vec4 x = INPUT(tc); x.rgb /= x.aaa; + + // pow() of negative numbers is undefined, so clip out-of-gamut values. + x.rgb = max(x.rgb, 0.0); + x.rgb = pow(x.rgb, vec3(1.0/2.2)); x.rgb += PREFIX(lift) * (vec3(1) - x.rgb); x.rgb = pow(x.rgb, PREFIX(inv_gamma_22));