Consider using libjpeg-turbo in place of libjpeg (Feature #1200)
Description
http://www.libjpeg-turbo.org/Main/HomePage
It's apparently a drop-in replacement for libjpeg 6b, as used by OpenCV, but much faster thanks to SIMD/MMX optimizations. Recently adopted by Fedora, Firefox and Chrome.
Our main use case is speeding up compressed_image_transport in ROS.
Associated revisions
Merge pull request #1200 from shervinemami:patch-1
History
Updated by René van Velzen over 13 years ago
https://bbs.archlinux.org/viewtopic.php?pid=796792#p796792
OpenCV 2.3.0 uses libjpeg 6b. Various tests by various users on various platform show roughly double performance on average up to a 500%+ increase for libjpeg-turbo. The link above shows a benchmark with 6b, 8b and turbo. Maybe this will help with the choice of a possible transition?
Updated by Patrick Mihelich over 13 years ago
I think the main question here is whether this is OpenCV's problem. On Linux at least, OpenCV uses the system install of libjpeg. Ubuntu/Debian have been looking at packaging the turbo version r1, so this may just get fixed upstream as distros switch over. Also, power users have the option of just swapping in libjpeg-turbo for libjpeg on their system, as they're ABI compatible.
I assume OpenCV uses the system libjpeg on Mac OS X, not so sure about Windows.
Updated by Patrick Mihelich over 13 years ago
Meant to link: https://bugs.launchpad.net/ubuntu/+bug/612377
Updated by Vadim Pisarevsky over 13 years ago
As far as I can see, we use our own copy of libjpeg on MacOSX, for some reason it does not find system jpeg codec. On Windows we use our libjpeg too.
As I understand, libjpeg-turbo uses gnu assembler for optimized kernels, therefore, it can be tricky to build optimized libjpeg-turbo on Windows. On Linux, as you said, we normally just use system libjpeg.
Therefore, the effect of switching to libjpeg-turbo will zero on Linux, unless we change the policy - prefer own libjpeg over the system one and zero on Windows, unless we can handle gas-optimized code somehow.
Updated by Alexander Shishkov about 13 years ago
- Description changed from http://www.libjpeg-turbo.org/Main/HomePage It's apparently a drop-in rep... to http://www.libjpeg-turbo.org/Main/HomePage It's apparently a drop-in rep... More
Updated by Andrey Kamaev almost 13 years ago
Actually libjpeg-turbo uses Netwide Assembler for x86/x64 optimizations which will introduce extra dependency for the OpenCV build.
Anyway OpenCV can be build with libjepeg-turbo instead of regular libjpeg. Just pass paths to it's includes and binaries as CMake arguments:
cmake -DWITH_JPEG=ON -DBUILD_JPEG=OFF -DJPEG_INCLUDE_DIR=/path/to/libjepeg-turbo/include/ -DJPEG_LIBRARY=/path/to/libjpeg-turbo/lib/libjpeg.a /path/to/OpenCV
This works fine with the current trunk (r7490).
- Status changed from Open to Cancelled
Updated by Andrey Kamaev almost 13 years ago
- Target version set to 2.4.0