Just use g_file_get_contents() instead of home-made file loading.
Fixes two issues - one is that we should pass "r" to fopen and
not O_RDONLY, the other is that an incorrect variable was used
to read the file length, leading to an empty shader file.
Spotted by: Wang Xin-yu (王昕宇) <comicfans44@gmail.com>
https://bugzilla.gnome.org/show_bug.cgi?id=702844https://bugzilla.gnome.org/show_bug.cgi?id=702845
Conflicts:
gst/gl/gstglfiltershader.c
'if statement has empty body', which were real bugs and
'comparison of unsigned expression < 0 is always false', which was
only an unneeded comparison.
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.
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.
Add a new convenience function in GstGLFilter that just draws an input
texture to a target texture using a simple shader with just a "tex"
uniform sampler.
Move draw_texture from glfiltersobel to glfilter. Still need to update
other plugins to this.
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.
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.