mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
[566/906] effects: avoid using tanh in sin_fragment
It produces weird results on nouveau. Provide an alternative implementation with (1-sinh)*cosh
This commit is contained in:
parent
96163f1589
commit
beff5a3710
1 changed files with 4 additions and 4 deletions
|
@ -458,7 +458,7 @@ const gchar *sin_fragment_source =
|
||||||
/* sqrt(3)/2 = 0.866 */
|
/* sqrt(3)/2 = 0.866 */
|
||||||
" float sinh = 0.866*(color.g - color.b);"
|
" float sinh = 0.866*(color.g - color.b);"
|
||||||
/* hue = atan2 h */
|
/* hue = atan2 h */
|
||||||
" float tanh = sinh/cosh;"
|
" float sch = (1.0-sinh)*cosh;"
|
||||||
/* ok this is a little trick I came up because I didn't find any
|
/* ok this is a little trick I came up because I didn't find any
|
||||||
* detailed proof of the Preucil formula. The issue is that tan(h) is
|
* detailed proof of the Preucil formula. The issue is that tan(h) is
|
||||||
* pi-periodic so the smoothstep thing gives both reds (h = 0) and
|
* pi-periodic so the smoothstep thing gives both reds (h = 0) and
|
||||||
|
@ -467,9 +467,9 @@ const gchar *sin_fragment_source =
|
||||||
* the circle where cosine is positive */
|
* the circle where cosine is positive */
|
||||||
/* take a slightly purple color trying to get rid of human skin reds */
|
/* take a slightly purple color trying to get rid of human skin reds */
|
||||||
/* tanh = +-1.0 for h = +-45, where yellow=60, magenta=-60 */
|
/* tanh = +-1.0 for h = +-45, where yellow=60, magenta=-60 */
|
||||||
" float a = smoothstep (-1.0, -0.5, tanh);"
|
" float a = smoothstep (0.3, 1.0, sch);"
|
||||||
" float b = smoothstep (-0.1, 0.4, tanh);"
|
" float b = smoothstep (-0.4, -0.1, sinh);"
|
||||||
" float mix = (a - b) * step (0.0, cosh);"
|
" float mix = a * b;"
|
||||||
" gl_FragColor = color * mix + luma * (1.0 - mix);"
|
" gl_FragColor = color * mix + luma * (1.0 - mix);"
|
||||||
"}";
|
"}";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue