Speeding up SVG pixel filters with SMP

Some SVG filters (lighting and turbulence filters for example) execute
a huge number of pixel manipulations, which cannot be sped up by graphics
accelerators, since their algorithm is too complex. Fortunately, a different
source can provide us raw power: Simmetric Multi Processing (SMP).

Using SMP we can split up a task to smaller (data independent) tasks, which
can be executed independently. For most SVG filters, pixels can be
calculated independently. If the operation is simple (like displacing
or copying pixels) the gain of using multiple CPUs are limited. However,
the story is totally different for lighting and turbulence filters:
they require a lot of floating point operations for each pixel!

My current approach allocates a worker thread, and split up the task
between the main and the worker thread. To utilize the CPU caches
better, the image is horizontally cut in the middle. The upper
side is processed by the main, and the bottom side is by the
secondary thread.

The following two videos show the effect of SMP enabled filters on two,
identical multicore embedded systems (NVidia Tegra system with an ARM core). The right screen displays an unmodified WebKit-based test brower running a small SVG demo, and the effect of SMP can be seen on the left side.

The SVG source of the demo is attached to this post. To start the animation, just click on the background.

vid1.flv1.95 MB
vid2.flv2.36 MB
demo.zip3.57 KB

Changmin Lee (not verified) - 11/29/2010 - 14:21

Hi, your work looks very nice.
I'm also working on WebKit for mobile. So, can you split up a task to a number of worker threads? By any chance, can I see the source code of the SVG filters? If then, I really appreciate it.

zoltan.herczeg - 11/30/2010 - 14:09

Hi, this is the bug report which dedicated to this effort:

Actually only 2 threads are used. OpenMP in GCC allows using multiple threads.

Changmin Lee (not verified) - 12/01/2010 - 05:36

Thank you so much. I think it is worth attempting the parallelization since SVG will play an important role in even mobile devices.
Anyway, if there is an improvement I'll give you some feedback. Have a nice day!

marro (not verified) - 04/01/2011 - 15:38

can GPU shaders help ?

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • No HTML tags allowed
  • Lines and paragraphs break automatically.

More information about formatting options

This question is for testing whether you are a human visitor and to prevent automated spam submissions.
Fill in the blank