Page 1 of 1

How can I make sure libjpeg-turbo is being used

Posted: Mon Sep 30, 2013 3:50 pm
by axelm
Hi guys,

During the weekend I reinstalled my zm server. Moved from Fedora 18 to Ubuntu 12.04.3 LTS and upgraded to 1.26.3. Everything's working after some hiccups and now I'd like to know if libjpeg-turbo is being used or just normal libjpeg. Can someone tell me the command to check that?

Thanks
Axel

Re: How can I make sure libjpeg-turbo is being used

Posted: Mon Oct 07, 2013 11:15 pm
by lpallard
When I set the source color depth to 32 bit, I immediately get :

"libjpeg-turbo is required for JPEG encoding directly from RGB32 source"

in the logs... So I am sure that its not using libjpeg-turbo... If I only could make it work ;)

Re: How can I make sure libjpeg-turbo is being used

Posted: Fri Oct 11, 2013 12:21 pm
by knight-of-ni
There are two general methods for installing libjpeg-turbo:

Method 1: Install libjpeg-turbo alongside libjpeg. In this case, the files from libjpeg-turbo are placed into a non-standard folder.

However, this presents a problem. Because they are in a non-standard folder, applications won't be able to find these files by themselves. It will be up to you to force the application(s) in question to find these files. In theory, one way to do do this would be to modify your library search path to search the libjpeg-turbo folder before it searchs /usr/include. Another way would be to try and get zoneminder to see the libjpeg-turbo files by adding the necessary configure flags.

If you have libjpeg-turbo installed, yet zoneminder complains it cannot find it then this is the issue you face.

Method 2: Replace the libjpeg library entirely with libjpeg-turbo. For this method, the libjpeg-turbo files are located in /usr/include, replacing the same files from the old libjpeg library. This forces applications to use libjpeg-trubo because that becomes the only choice. The implementation of this method is going to be distro specfic. You need to find a libjpeg-tubro package that places the files under /usr/include rather than /opt/libjpeg-turbo or any other folder. On CentOS 6, this is fairly simple: sudo yum install libjpeg-turbo libjpeg-turbo-devel. If your distro (e.g. slackware perhaps) does not have a libjpeg-turbo library that places the files under /usr/include, it may be possible to rebuild the rpm from the CentOS repo and use that: http://vault.centos.org/6.4/os/Source/S ... l6.src.rpm

Re: How can I make sure libjpeg-turbo is being used

Posted: Fri Oct 11, 2013 1:01 pm
by lpallard
"Another way would be to try and get zoneminder to see the libjpeg-turbo files by adding the necessary configure flags."

Could you provide these "necessary" configure flags? I confirm what you are saying. If libjpeg (the standard one) is installed, on my slackware machine libjpeg-turbo will install itself in /opt/libjpeg-turbo/... instead of being with the other libraries in /usr/lib64/

That explains why ZM couldnt find it. I tried uninstalling the standard libjpeg library, and reinstall the turbo one in /usr/lib64/ so ZM can find it, but it breaks other system components that are expecting the standard version of libjpeg...

I need both in parrallel.
Thanks!!

PS: slackware has a package for both versions... For salckware users, please see

http://slackbuilds.org/repository/14.0/ ... peg-turbo/

Re: How can I make sure libjpeg-turbo is being used

Posted: Fri Oct 11, 2013 1:19 pm
by knight-of-ni
I was intentionally vague because I don't have the exact answer for you.
The answer is going to vary with different distros.

You could try ./configure --with-extralibs="/path/to/libjpeg-turbo"

However, what you really need to do is read the libjeg-turbo documentation:
http://www.libjpeg-turbo.org/Documentat ... umentation

The instructions to get your applications(s) to see libjpeg-turbo are in the README-turbo.txt file.

Re: How can I make sure libjpeg-turbo is being used

Posted: Fri Oct 11, 2013 2:25 pm
by mastertheknife
knnniggett wrote:You could try ./configure --with-extralibs="/path/to/libjpeg-turbo"
That won't work. Need to also use header files from libjpeg-turbo, as they define colorspace extensions that ZM needs for BGR24 and 32bit RGB formats.
Need to modify the CPPFLAGS to search for headers in /opt/libjpeg-turbo/include first.
In the case of cmake, its possible to use the environment variables CMAKE_INCLUDE_PATH and CMAKE_LIBRARY_PATH or CMAKE_PREFIX_PATH (uses /include for include and /lib for libraries).
These paths are searched first, so no problem. But as of ZM 1.26.4, the cmake method requires CMAKE_REQUIRED_INCLUDES="/opt/libjpeg-turbo/include" (for example) to pass the header checks (will be fixed in the next version).

To verify that libjpeg-turbo is in use, you can try: cat /proc/<pid>/maps | grep libjpeg