]> git.sesse.net Git - movit/commit
Clip below-zero (out-of-gamut) colors in LiftGammaGainEffect.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 28 Sep 2013 22:16:48 +0000 (00:16 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sat, 28 Sep 2013 22:16:48 +0000 (00:16 +0200)
commit58e7b9a8164bdaad7b0c698b2d0d80db53d79a5c
treee217d268ef94bac693e2b73cd40f6c4838d49baf
parent29f588a91a202a6d515dfb7383ecacc25668b7f7
Clip below-zero (out-of-gamut) colors in LiftGammaGainEffect.

pow(x, y) for x < 0 is undefined, and behaves differently on nVidia
and Intel. This can reasonably happen when having inputs from a different
gamut, or just a complex chain before the LGG effect; there's nothing
in Movit that prohibits out-of-sRGB-gamut colors. Thus, we need to detect
such inputs and clamp them.

We could in theory check for the special case of y=1 (no gamma change)
and allow negative values through then, but this wouldn't seem like a good
solution, especially if animating gamma.

Found and debugged by Christophe Thommeret.
lift_gamma_gain_effect.frag
lift_gamma_gain_effect_test.cpp