Commit graph

48 commits

Author SHA1 Message Date
Matthew Waters
7b03a572d9 [647/906] remove dependecy on glew 2014-03-15 18:36:52 +01:00
Matthew Waters
fa3c3b8434 [642/906] add gstglconfig.h for apps to find out what our capabilites are
ie libgstgl can be compiled with any combination of opengl/gles2
2014-03-15 18:36:52 +01:00
Matthew Waters
cc8e54541b [624/906] OPENGL_ES2 => HAVE_GLES2 and add HAVE_OPENGL
use GstGLAPI to determine which code paths to execute.
perform some cleanups
2014-03-15 18:36:51 +01:00
Matthew Waters
93f7e993ad [603/906] update FSF address 2014-03-15 18:36:50 +01:00
Matthew Waters
beff5a3710 [566/906] effects: avoid using tanh in sin_fragment
It produces weird results on nouveau.
Provide an alternative implementation with (1-sinh)*cosh
2014-03-15 18:36:47 +01:00
Matthew Waters
96163f1589 [565/906] effects: fix shader compilation with mesa drivers 2014-03-15 18:36:47 +01:00
Filippo Argiolas
00030c2bdd [454/906] blur: fix gaussian kernel computation 2014-03-15 18:36:41 +01:00
Filippo Argiolas
17a33cd19a [453/906] blur: give up some accuracy for speed
Settle with 7x7 gaussian convolution kernels, maybe slightly less
accurate than previous 9x9 but fast enough to be able to use it on i915.
About a 20% percent speed gain (again, roughly measured with
videotestsrc and glimagesink sync=false). No noticeable rendering
difference with current effects.
2014-03-15 18:36:41 +01:00
Filippo Argiolas
a9aa0ab2ee [452/906] sin: get rid of hls conversion code
Get rid of buggy and complicated hls conversion code for the sin effect.
The only thing needed was hue anyway and it is easily calculated using
Preucil formula for rgb to polar coordinates conversion.
Now works on i915 (removed all the IF blocks). Still needs some tuning,
I wonder if it will ever work properly.
2014-03-15 18:36:41 +01:00
Filippo Argiolas
3d14e9684d [449/906] sobel: drop unused single pass sobel shader
Drop unused sobel shader, if anyone still needs it, git log is your
friend.
2014-03-15 18:36:41 +01:00
Filippo Argiolas
b3c4eb4c61 [442/906] blur: optimize coordinates calculations
Save 28 instructions on i915 (mainly redundant MOVs) and gain a 25%
(roughly measured with videotestsrc and glimagesink sync=false) speed
bump
2014-03-15 18:36:40 +01:00
Filippo Argiolas
5fd66383ab [441/906] sobel: convolve only luma
Rework Sobel a little bit again making it work as the old one:
1. desaturate input texture
2. calculate horizontal convolution for x gradient and vertical
   convolution for y gradient at the same time (halves the number of
   needed texture lookups)
3. store results in a single texture (red and green channel)
4. calculate remaining convolution (same as above switching vertical and
   horizontal)
5. calculate length of gradient using red and green as x and y
   components.
Optimize wherever possible, store kernels as constants in the shaders,
remove unneeded uniforms. Restore invert property carefully avoiding
using IF.
Still not sure if "full color" convolution will be needed, glfiltersobel
is to be intended as a demo filter and xray, the only effect which uses
sobel only needs edge intensity. Dropping it for now.
2014-03-15 18:36:40 +01:00
Filippo Argiolas
49df4dca3c [440/906] sobel: implement sobel filter using separable kernels
Reimplement sobel in a multipass fully separated convolution:
- calculate x gradient map convolving first horizontally with blurring
  kernel and then vertically with differentiating kernel
- calculate y gradient map convolving first vertically with blurring
  kernel and then horizonally with differentiating kernel
- calculate length of the gradient vector
Particular care was needed with normalization of the blurring kernel and
with grey level offset of the differentiating one to prevent overflow of
rgb values from the [0.0,1.0] range in intermediate passes.
Now works on i915.
2014-03-15 18:36:40 +01:00
Filippo Argiolas
002f069962 [439/906] sobel: get rid of #version 120 dependent array constructors 2014-03-15 18:36:40 +01:00
Julien Isorce
28a11181c8 [436/906] gleffectssources: fix some warnings from msvc9 2014-03-15 18:36:40 +01:00
Filippo Argiolas
0cae67172a [430/906] convolution: save some indirection grouping math and sampling
Thanks to Eric Anholt I've finally understood (at least I hope) how to
count texture indirections and save up some.  Texture sampling dependent
on the result of some math counts as an indirection phase. Grouped
texture lookups with no math involved count as a single indirection.
Math on the coordinates count as indirection.
So the best thing is to group all the math involving coordinates and
then do all the lookups.
This saves enough indirections to make glfilterblur and glow effect
work, albeit a bit slowly, on i915.
2014-03-15 18:36:39 +01:00
Filippo Argiolas
b59d050e84 [427/906] rgb_to_curve: save up a texture indirection
Apparently assigning gl_TexCoord to a temp count as an indirection.
Using it directly avoids it and limits indirections to four not
exceeding i915 limit. Now xpro effect works on i915.
2014-03-15 18:36:39 +01:00
Vinson Lee
f6b0a1db7b [426/906] multiply: fix a compilation error with Apple compiler
Fix multiply_fragment_source to compile with Apple GLSL compiler.

https://bugzilla.gnome.org/show_bug.cgi?id=616748
2014-03-15 18:36:39 +01:00
Filippo Argiolas
7ee7688ae8 [425/906] twirl: get rid of polar coordinates conversion
Get rid of polar coordinates in the twirl effect. The same can be done
using a rotation matrix, saving alu instructions and, most of all,
avoiding the use of the evil atan() function (which uses IF operators).
Calculate rotation angle in a saner, understandable way.
Works on i915! (Hope it still works elsewhere too as I'm not able to
test at the moment)
2014-03-15 18:36:39 +01:00
Filippo Argiolas
797250d9c2 [424/906] tunnel: get rid of polar coordinates conversion
Get rid of polar coordinates in the tunnel effect as the same can easily
be done just clamping the radius and multiplying.
Remove the evil atan() call that uses branching and a lot of unneeded alu
instructions. Now works on i915!
2014-03-15 18:36:39 +01:00
Filippo Argiolas
98752e51da [423/906] convolution: generate gaussian kernel on the fly
Generate a normalized gaussian kernel with given size and standard
deviation on the fly.
Remove "norm_const" uniform from convolution shaders and provide a
normalized kernel instead. Remove norm_offset uniform as it was always
zero, will reintroduce it if really needed in the future. Thanks to Eric
Anholt for suggesting it.
Save some ALU instruction calculating directly the coordinate for
texture lookup instead of summing an offset.
Still exceed maximum indirect texture lookups on i915, the only solution
I see is using a 3x3 kernel.
2014-03-15 18:36:39 +01:00
Filippo Argiolas
e602d818e3 [422/906] convolution: reduce the number of register used
Reduce the number of register calculating texture lookup offset on the
fly. It was just a simple sequence, no need to store it in a array.
Fixes maximum number of registers exceeded error with i915. Still
exceed maximum indirect texture lookups and maximum ALU instructions.
Maybe we should gave up some blur goodness and use lightly more little
kernels.
2014-03-15 18:36:39 +01:00
Filippo Argiolas
a3454365fc [421/906] convolution: don't check kernel[i] to be non zero
Apparently saving up some texture lookup for zero kernel elements is
definitely not worth the use of branching. This way convolution
fragment programs also work where IF operator is not supported (tested
on i915 and nouveau). See also discussion on bug #615696.
Thanks to Eric Anholt for spotting this.
2014-03-15 18:36:39 +01:00
Filippo Argiolas
4ff22b2c67 [418/906] effects: disable gst-indent in the sources
Fix some crazy formatting caused by gst-indent previous runs and disable
the script for this file. The best would be to move shaders into
separate files and load them at runtime or hardcode them at compile
time.
2014-03-15 18:36:39 +01:00
Julien Isorce
e002f92e6d [408/906] gleffects: start to make it compatible with OpenGL ES 2.0
For now only identity, mirror and squeeze effects are available.
Maybe some factorization is needed about compilation shader
before to put the other effects since only a copy/past is needed,
at least until effect number 9: heat.
The effects from 10:sepia to 15:glow require more work.
2014-03-15 18:36:38 +01:00
Filippo Argiolas
d02a585e7b [395/906] differencematte: fix regressions from gdkpixbuf to libpng migration
The background image needs to be scaled to fit current texture size.
Previously this was done by gdk_pixbuf_scale_simple but that's been
removed.
Create a texture from the background pixbuf with correct dimensions and
use interpolation shader to scale it to the right size. Interpolation
fragment shader doesn't have too much sense if all the textures don't
have the same size so this seemed the most natural place to do the
scaling. It could probably be done with some custom texture mapping
outside the shader but it involved more code.

Fixes bug #599883.
2014-03-15 18:36:37 +01:00
David Schleef
d015d5862d [310/906] Global reindent
Indent parameters:
INDENT_PARAMETERS="--braces-on-if-line \
        --case-brace-indentation0 \
        --case-indentation2 \
        --braces-after-struct-decl-line \
        --line-length80 \
        --no-tabs \
        --cuddle-else \
        --dont-line-up-parentheses \
        --honour-newlines \
        --continuation-indentation4 \
        --tab-size8 \
        --indent-level2"
2014-03-15 18:36:33 +01:00
David Schleef
43e574aa8f [298/906] Revert "Fix indention"
This reverts commit 96e4ab18c2cf9876f6c031b9aba6282d0bd45a93.

You should have asked first.  And you would have been told "no",
because it causes people on development branches to do a huge
amount of extra work.
2014-03-15 18:36:32 +01:00
Sebastian Dröge
369b1d4ff2 [295/906] Fix indention 2014-03-15 18:36:32 +01:00
Filippo Argiolas
5f8cc769b7 [246/906] Add multiply fragment shader
Add a fragment shader to blend two textures with multiply blend mode
2014-03-15 18:36:29 +01:00
Filippo Argiolas
a729d080f4 [245/906] Add invert property to sobel filter
Add an invert property to sobel_fragment_source and Sobel filter. Useful
to have dark edges with white background.
2014-03-15 18:36:29 +01:00
Filippo Argiolas
a80fecd888 [236/906] import sobel edge detector from cvs branch 2014-03-15 18:36:28 +01:00
Filippo Argiolas
5425839342 [195/906] fix gstgldifferencematte and add an example app to test it dragging an image over the video (works with pixbufoverlay too, see pixbufdrop --help) 2014-03-15 18:36:26 +01:00
Filippo Argiolas
745a078f7f [194/906] another typo, restore old twirl fragment source 2014-03-15 18:36:26 +01:00
Filippo Argiolas
4c907f53be [193/906] fix typos 2014-03-15 18:36:26 +01:00
Filippo Argiolas
8024aa7483 [192/906] complete differencematte filter.. I did it quickly, probably still needs some work 2014-03-15 18:36:26 +01:00
Filippo Argiolas
3faa943819 [191/906] little cleanup. add first draft of gstgldifferencematte. still doesn't work 2014-03-15 18:36:26 +01:00
Filippo Argiolas
30ab0747cc [184/906] add a couple of macros to autotools to compile with uintrepid automake. remove array constructor so we don't have to depend on glsl #version 120. 2014-03-15 18:36:25 +01:00
Filippo Argiolas
35b7b488f3 [176/906] fix a typo 2014-03-15 18:36:25 +01:00
Filippo Argiolas
85502ef8cd [175/906] add sin effect (desaturate everything but red shades). still needs some tuning. 2014-03-15 18:36:25 +01:00
Filippo Argiolas
c87eb37c32 [169/906] import remaining distortion effects from cvs branch (fisheye, twirl, bulge, tunnel, square) 2014-03-15 18:36:25 +01:00
Filippo Argiolas
5b1f62a079 [166/906] add rgb_to_luma_fragment source and correspondent effect. use the latter for a cross processing effect. 2014-03-15 18:36:24 +01:00
Filippo Argiolas
e009d7b400 [165/906] import luma_to_curve effects (Sepia, Heat) from cvs branch with better texture memory handling (teximage curves only once). Sepia curve still needs some love. 2014-03-15 18:36:24 +01:00
Filippo Argiolas
c5bd6fdbc5 [164/906] rename blend_fragment_source to sum_fragment_source and add uniform blending parameters 2014-03-15 18:36:24 +01:00
Filippo Argiolas
aa7e3867ac [163/906] import glow effect (maybe the most tricky) from cvs branch 2014-03-15 18:36:24 +01:00
Filippo Argiolas
e8d27cadf7 [162/906] import stretch effect from cvs 2014-03-15 18:36:24 +01:00
Filippo Argiolas
ebde5b5501 [161/906] import squeeze effect from cvs 2014-03-15 18:36:24 +01:00
Filippo Argiolas
962e4cd8a1 [160/906] forgot to add a file 2014-03-15 18:36:24 +01:00