summaryrefslogtreecommitdiff
path: root/gst/gl/effects
diff options
context:
space:
mode:
authorMatthew Waters <ystreet00@gmail.com>2012-08-20 13:27:50 +1000
committerMatthew Waters <ystreet00@gmail.com>2014-03-15 18:36:47 +0100
commitbeff5a3710e83351629dc9585e2d7c223ea0c8c6 (patch)
tree1ebbbde4900c674dada08c2f8a9caa0a0d6c44ec /gst/gl/effects
parent96163f158913590463a5c88731985657e189491a (diff)
downloadgstreamer-plugins-bad-beff5a3710e83351629dc9585e2d7c223ea0c8c6.tar.gz
[566/906] effects: avoid using tanh in sin_fragment
It produces weird results on nouveau. Provide an alternative implementation with (1-sinh)*cosh
Diffstat (limited to 'gst/gl/effects')
-rw-r--r--gst/gl/effects/gstgleffectssources.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gst/gl/effects/gstgleffectssources.c b/gst/gl/effects/gstgleffectssources.c
index 28e3dd21d..efe5a03a3 100644
--- a/gst/gl/effects/gstgleffectssources.c
+++ b/gst/gl/effects/gstgleffectssources.c
@@ -458,7 +458,7 @@ const gchar *sin_fragment_source =
/* sqrt(3)/2 = 0.866 */
" float sinh = 0.866*(color.g - color.b);"
/* 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
* 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
@@ -467,9 +467,9 @@ const gchar *sin_fragment_source =
* the circle where cosine is positive */
/* take a slightly purple color trying to get rid of human skin reds */
/* tanh = +-1.0 for h = +-45, where yellow=60, magenta=-60 */
- " float a = smoothstep (-1.0, -0.5, tanh);"
- " float b = smoothstep (-0.1, 0.4, tanh);"
- " float mix = (a - b) * step (0.0, cosh);"
+ " float a = smoothstep (0.3, 1.0, sch);"
+ " float b = smoothstep (-0.4, -0.1, sinh);"
+ " float mix = a * b;"
" gl_FragColor = color * mix + luma * (1.0 - mix);"
"}";