Commit Graph

9 Commits

Author SHA1 Message Date
Jean-Philippe Andre 3f73d20502 Evas filters: Prevent division by 0
While it really shouldn't happen, let's just add a quick if()
and make Coverity shut up.

Fixes:
 - CID 1191912
 - CID 1191911
 - CID 1191910
 - CID 1191909
2014-10-28 10:54:51 +09:00
Jean-Philippe Andre deb8a637e4 Evas filters: Remove useless include 2014-04-04 18:35:22 +09:00
Jean-Philippe Andre 634034af46 Evas filters: Add template optimizable files for box blur
The new files (i386, sse3 and neon) are basically empty and fallback
to the C version. This is just to pave the way for full low-level
optimization... if someone has the time and skills to do it :)

Add both Alpha and RGBA template files.
2014-04-02 14:53:00 +09:00
Jean-Philippe Andre c7616dd738 Evas filters: Fix blur corner cases with small images
If the buffer size is smaller than the blurring kernel, then
special precautions must be taken to properly read the source
pixels. Also, fix the corner cases near the left & right edges
(or top & bottom).
2014-03-21 15:23:02 +09:00
Jean-Philippe Andre 592204fe73 Evas filters: Optimize RGBA blur as well
Same as Alpha blur, use combination of box blurs,
and put all that code into optimizable functions.
2014-03-12 14:08:02 +09:00
Jean-Philippe Andre 4443ecfa8b Evas filters: Optimize alpha box blur
Use two optimizable functions for BOX blur: vertical and horizontal.
These functions will run as many times as requested (from 1 to 6 max).

The horizontal case is pretty straightforward as the source is already
contiguous (nice in terms of cache hits). The only catch is to swap
src and dst without ever writing to the input buffer.

In case of vertical blur, we apply the same method as above, after
rotating the column into a horizontal (contiguous) span, and rotating
it back afterwards.

Now, the same needs to be done for RGBA :)
2014-03-12 14:08:02 +09:00
Jean-Philippe Andre 4e249143a5 Evas filters: Prepare optimization paths for BOX blur
Actually, there is a very nice trick with BOX blur.
Pass BOX blur 3 times and you can approximate a GAUSSIAN
blur with up to 3% accuracy. This is way more than enough
for just a simple graphical effect.

So, despite the crappy quality of BOX blur, we should
optimize it a lot so we can replace large GAUSSIAN blurs
with series of BOX blurs instead.

Source: Wikipedia's page on box blur :)

This commit also moves around some duplicated definitions.
2014-03-12 14:08:02 +09:00
Jean-Philippe Andre 9c3a3373b3 Evas filters: Add basic optimization for RGBA gaussian blur 2014-03-12 14:08:01 +09:00
Jean-Philippe Andre cb69700389 Evas filters: Add optimizable blur function
Prepare optimization paths for blur operations, as they are VERY
costly. This simple change, when using gcc -O3 flag, boosts
horizontal blur performance by > 50%, because STEP is 1 (and
so, memory accesses, increments, etc... are all very simple)

The objective is to have support for NEON, MMX, SSE, too, with
runtime detection.
2014-03-12 14:08:01 +09:00