skia_bench on android measures a number of things. One portion of the benchmark measures libjpeg performance, specifically for 565 and 8888 image types that are specific to android.
Android (including the latest ice cream sandwich release) uses the old and quite crusty libjpeg library. This library while functional is missing a great deal of optimization. The libjpeg-turbo project (http://libjpeg-turbo.org) is a souped up and more importantly drop in replacement API compatible version of libjpeg. It is compatible with both versions 6.x and 8 that are in wide use across many a distro. However because libjpeg doesn’t have simd (Single instruction, multiple data) optimizations using NEON on ARM for instance, distributions have been pitching libjpeg for libjpeg-turbo.
At Linaro our Android Ice Cream Sandwich for instance replaces libjpeg with libjpeg-turbo. Likewise we recently worked with Ubuntu and as a result Precise (version 12.04) now includes libjpeg-turbo.
So what kind of performance bump can one see by switching from libjpeg to libjpeg-turbo?
https://wiki.linaro.org/TomGall/LibJpeg8 includes lots of raw numbers on intel and ARM machines. In short performance improvements measured by tjbench are on the order of 200% to 300%.
libjpeg-turbo doesn’t include support for Android. So earlier this year, we ported libjpeg-turbo so it would include Android dependency on the aforementioned nonstandard 8888 and 565 formats. This was a good first step however, no work had been done to optimize for 565 or 8888. Thus the performance for 565 and 8888 was about the same for libjpeg and libjpeg-turbo.
I’d like to see Android switch to use libjpeg-turbo so this week it was time to do some optimization that would give credence to that desire. Optimizations that can be measure with skia_bench would be the way to go.
Hack. Hack. Hack.
The results? A comparison of android’s libjpeg, libjpeg-turbo without 565 or 8888 optimizations and libjpeg-turbo with 565 and 8888 optimizations can be found at : https://wiki.linaro.org/TomGall/SkiaBenchNumbers . Smaller numbers are better.
Half the time not bad or put another way, the newly improved libjpeg-turbo is 2 times faster than the old libjpeg! I’m sure you’d like that improvement on your Android phone or tablet! I would!
Now we get to another part of the story that is important also reflects another aspect of what makes Linaro an important leader in ARM for Linux and Android. You see the optimization code for 565 and 8888 already sort of existed. It was sitting out in a git archive more or less gathering dust. The essential step of putting it together with the already optimized libjpeg-turbo hadn’t been done. The code also hadn’t been pushing upstream to the communities that would most benefit. In Linaro we want Linux and Android on ARM to shine.
While it’s all put together and it works, that’s great. Now comes the most important steps, getting google’s Android engineers (and perhaps cyanogen mod too!) to accept it so that all might benefit. That’s the bar for success we aim for at Linaro and we will succeed.
Code : git://git.linaro.org/people/tomgall/libjpeg-turbo/libjpeg-turbo.git
Pull from the android branch. git checkout -b android origin/android