How can I make sure libjpeg-turbo is being used

Forum for questions and support relating to the 1.26.x releases only.
Locked
axelm
Posts: 46
Joined: Wed Feb 06, 2013 1:50 pm

How can I make sure libjpeg-turbo is being used

Post 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
lpallard
Posts: 87
Joined: Fri Mar 05, 2010 10:59 pm

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

Post 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 ;)
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

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

Post 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
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
lpallard
Posts: 87
Joined: Fri Mar 05, 2010 10:59 pm

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

Post 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/
User avatar
knight-of-ni
Posts: 2404
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

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

Post 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.
Visit my blog for ZoneMinder related projects using the Raspberry Pi, Orange Pi, Odroid, and the ESP8266
All of these can be found at https://zoneminder.blogspot.com/
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

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

Post 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
Kfir Itzhak.
Locked