On 03-03-13 11:26, Yale Zhang wrote:
Hi. I'm using Inkscape to author a comic and the slow speed for certain things is very annoying. I'm already have OpenMP turned on and using 4 cores.
- *large blurs are slow* - I'm an expert with writing SIMD code, so I
was thinking about vectorizing the Gaussian IIR filter with SIMD intrinsics, even though it's harder than for a FIR. But I noticed there isn't any SIMD code in Inkscape so does that mean it's something to avoid. I'm pretty sure no current compiler is smart enough to vectorize it, and besides, Inkscape is compiled with -O2, meaning -ftree-vectorize isn't on by default.
Vectorizing the IIR code would be great (although you may want to make sure that in the end it all still works on a wide variety of architectures). But the code is pretty tricky. It's perhaps one of the most efficient ways to implement a blur using an IIR filter, but it's also extremely prone to numerical issues and the like. One way this is reflected in the code is the absolute necessity of the clamping operations. Also, in the past we've had trouble with using 32bit floats... (Only in specific instances.)
In other words: test the resulting code quite well.
(I've been experimenting with different ways of approximating a Gaussian blur that are more stable, but haven't really found a completely convincing alternative yet.)