anyone know of a free open-source jpeg encoding library for C/C++? Currently I'm using ImageMagick, which is easy to use, but it's pretty slow. I compared it to an evaluation of Intel Performance Primitives and the speed of IPP is insane. Unfortunately it also costs 200$, and I don't need 99% of the IPP). Also it will only work fast on Intel.
Anyone do any tests? Any other good libraries out there faster than ImageMagick?
Edit: I was using 8 bit version of ImageMagick which is supposed to be faster.
ImageMagick uses libjpeg (a.k.a Independent JPEG Group library). If you improve the speed of libjpeg, ImageMagick JPEG speed will increase.
There are a few options:
- Compile an optimized libjpeg. If you have a modern gcc and at least a Pentium 4, you can try
-O3 -msse2
and see if it can boost your speed. Then you can use LD_LIBRARY_PATH
or some other way to load your libjpeg instead of the system one.
- Try out libjpeg-mmx. It is unmaintained, and supposedly buggy and with security flaws, but it may give a speed boost in your case.
Check out libjpeg/SIMD, in the trunk of TigerVNC (http://www.tigervnc.com). We have optimized 64-bit and 32-bit versions which are almost as fast as IPP at compressing/decompressing baseline JPEG:
http://www.mail-archive.com/tigervnc-devel@lists.sourceforge.net/msg00403.html
I believe that GIL, which is a library in Boost, contains a way to save image data in JPEG format. I don't know the speed of it, though. Given that the library is sponsored by Adobe, I would expect that it's pretty well done.
AMD offers Framewave, an open sourced alternative to IPP.
If you look around you might find an old version of the Intel JPEG Library. It's not opensource but it is fast. It was fast enough to get 25fps on a 733MHz P-III.
There's also the Independent JPEG Group which is fairly old and I can't vouch for it's speed. But it should be stable.
Found through this page.
I did some timing encoding a 512x512 jpeg using 100% quality (I know 100% is not lossless). Basically ImageMagick was only slightly slower than libjpeg. For 100 images the difference was on the order of 10th of a seconds. I then got libjpeg with SIMD extension (http://cetus.sakura.ne.jp/softlab/jpeg-x86simd/jpegsimd.html#source) and that thing 6-10 times faster. Note it really depends on the type of image. Images with lots of black are really fast, images with detail everywhere are really slow - I believe it's the encoding algorithm. I may have to give libjpeg-mmx a try because it looks more maintained than the japanese version I got that I don't even know what the license is.
I've also tried to get Framewave to work and couldn't even get it off the ground. The header files are missing definition of some structure and the forums provide absolutely no support. I can't believe it's "sponsored by AMD."