ZM 1.25.0 Performance Patch - Completed

If you've made a patch to quick fix a bug or to add a new feature not yet in the main tree then post it here so others can try it out.
Post Reply
tibetfreedom
Posts: 163
Joined: Fri Oct 22, 2010 11:21 am

Re: ZM 1.25.0 Performance Patch - Completed

Post by tibetfreedom »

mastertheknife wrote: Make sure to recompile ZoneMinder after installing libjpeg-turbo.

mastertheknife
libjpeg-turbo was always installed do I need to alter the configure commands ?
tibetfreedom
Posts: 163
Joined: Fri Oct 22, 2010 11:21 am

Re: ZM 1.25.0 Performance Patch - Completed

Post by tibetfreedom »

mastertheknife wrote:ZoneMinder wasn't compiled against libjpeg-turbo. If you intend to use the BGR24 capture palette, or 32bit target format you need libjpeg-turbo installed and ZoneMinder compiled against libjpeg.h from libjpeg-turbo instead of stock libjpeg.h.
Make sure to recompile ZoneMinder after installing libjpeg-turbo.

About the no option found errors, do you have multiple versions of ZM installed?

mastertheknife
Oh, sorry I must have mis understood, I thought the whole thing was meant to use 32bit Colour space as in the tables you posted.
I think I am missing something and I don't understand.
I really appreciate the work you have done, I have the system running nicely using YUV420 24Bit Colour and PAL 640 * 480 which is better than It ever was, however I thought I could / should use 32 bit BGR with your setup for best results.
I must have misunderstood the instructions you gave, if you can be really patient with me can you explain where I went wrong.

Thanks.
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: ZM 1.25.0 Performance Patch - Completed

Post by mastertheknife »

Do you have a bt878 card? If yes, you are probably better off using BGR24, rather than YUV420 as your capture palette.
Does your processor have SSSE3? If yes, then BGR32+32bit target might be slightly faster than BGR24+24bit.

Anyways, if you are getting those libjpeg-turbo required errors, then ZM doesn't think you have libjpeg-turbo. Make sure you installed libjpeg-turbo properly, especially the step of symlinking the header files. After that, re-compile ZM and hopefully all is well.

mastertheknife
Kfir Itzhak.
tibetfreedom
Posts: 163
Joined: Fri Oct 22, 2010 11:21 am

Re: ZM 1.25.0 Performance Patch - Completed

Post by tibetfreedom »

mastertheknife wrote:Do you have a bt878 card? If yes, you are probably better off using BGR24, rather than YUV420 as your capture palette.
Does your processor have SSSE3? If yes, then BGR32+32bit target might be slightly faster than BGR24+24bit.

Anyways, if you are getting those libjpeg-turbo required errors, then ZM doesn't think you have libjpeg-turbo. Make sure you installed libjpeg-turbo properly, especially the step of symlinking the header files. After that, re-compile ZM and hopefully all is well.

mastertheknife
Thanks,
I can't set 32 bit anything, so I will recompile libjeg-turbo.
What sim link thing should I do ?
Also I may have two executables or installations running side by side, I shouldn't have as I used the same ./configure string as I used in the initial configuration, however upon a restart I get a database error and the web interface reports that, If I stop and start from the web interface It all works OK again apart from the libjpeg-turbo issue.
Thanks very much for your help over this.
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: ZM 1.25.0 Performance Patch - Completed

Post by mastertheknife »

If you want to have 2 versions of ZM installed at the same time, e.g. one stock one patched, its perfectly ok to use the same ./configure line. But if you do that, to switch versions, you need to stop ZM and run "sudo make install" on the version you want to run, and then start ZM.



About libjpeg-turbo, try running these commands:

Code: Select all

ln -s /opt/libjpeg-turbo/lib/libjpeg.a /usr/lib/libjpeg.a
ln -s /opt/libjpeg-turbo/include/jconfig.h /usr/include/jconfig.h
ln -s /opt/libjpeg-turbo/include/jerror.h /usr/include/jerror.h
ln -s /opt/libjpeg-turbo/include/jmorecfg.h /usr/include/jmorecfg.h
ln -s /opt/libjpeg-turbo/include/jpeglib.h /usr/include/jpeglib.h
After this, type "make" to recompile ZM and then "sudo make install" to install it.

mastertheknife
Kfir Itzhak.
tibetfreedom
Posts: 163
Joined: Fri Oct 22, 2010 11:21 am

Re: ZM 1.25.0 Performance Patch - Completed

Post by tibetfreedom »

mastertheknife wrote:If you want to have 2 versions of ZM installed at the same time, e.g. one stock one patched, its perfectly ok to use the same ./configure line. But if you do that, to switch versions, you need to stop ZM and run "sudo make install" on the version you want to run, and then start ZM.



About libjpeg-turbo, try running these commands:

Code: Select all

ln -s /opt/libjpeg-turbo/lib/libjpeg.a /usr/lib/libjpeg.a
ln -s /opt/libjpeg-turbo/include/jconfig.h /usr/include/jconfig.h
ln -s /opt/libjpeg-turbo/include/jerror.h /usr/include/jerror.h
ln -s /opt/libjpeg-turbo/include/jmorecfg.h /usr/include/jmorecfg.h
ln -s /opt/libjpeg-turbo/include/jpeglib.h /usr/include/jpeglib.h
After this, type "make" to recompile ZM and then "sudo make install" to install it.

mastertheknife
Thank you very much I will do this later.
I did do a make make install on the patched Zoneminder 1.5 but for some reason ( I suspect I have not altered the script to launch the correct version at boot time at ) upon a reboot zone minder fails (but Runs) and I have to stop it and start again.
I will do the stuff above and report back good or bad.
Thanks.
I have to say that even now the CPU utilisation is down but about 95% on the previous non patched version, this really is a vast improvement on performance, it would be nice to get 32 bit colour though.
Lastly yes I am using that capture card you mentioned.
Cheers
tibetfreedom
Posts: 163
Joined: Fri Oct 22, 2010 11:21 am

Re: ZM 1.25.0 Performance Patch - Completed

Post by tibetfreedom »

mastertheknife wrote:If you want to have 2 versions of ZM installed at the same time, e.g. one stock one patched, its perfectly ok to use the same ./configure line. But if you do that, to switch versions, you need to stop ZM and run "sudo make install" on the version you want to run, and then start ZM.



About libjpeg-turbo, try running these commands:

Code: Select all

ln -s /opt/libjpeg-turbo/lib/libjpeg.a /usr/lib/libjpeg.a
ln -s /opt/libjpeg-turbo/include/jconfig.h /usr/include/jconfig.h
ln -s /opt/libjpeg-turbo/include/jerror.h /usr/include/jerror.h
ln -s /opt/libjpeg-turbo/include/jmorecfg.h /usr/include/jmorecfg.h
ln -s /opt/libjpeg-turbo/include/jpeglib.h /usr/include/jpeglib.h
After this, type "make" to recompile ZM and then "sudo make install" to install it.

mastertheknife

Odd looks like they already exist.

Code: Select all

root@CCTV:~# ln -s /opt/libjpeg-turbo/lib/libjpeg.a /usr/lib/libjpeg.a
ln: creating symbolic link `/usr/lib/libjpeg.a': File exists
root@CCTV:~# ln -s /opt/libjpeg-turbo/include/jconfig.h /usr/include/jconfig.h
ln: creating symbolic link `/usr/include/jconfig.h': File exists
root@CCTV:~# ln -s /opt/libjpeg-turbo/include/jerror.h /usr/include/jerror.h
ln: creating symbolic link `/usr/include/jerror.h': File exists
root@CCTV:~# ln -s /opt/libjpeg-turbo/include/jmorecfg.h /usr/include/jmorecfg.h
ln: creating symbolic link `/usr/include/jmorecfg.h': File exists
root@CCTV:~# ln -s /opt/libjpeg-turbo/include/jpeglib.h /usr/include/jpeglib.h
ln: creating symbolic link `/usr/include/jpeglib.h': File exists
I am wondering I think there are two versions running…
The patch here… where would a startup script launch it from…
My current script launches the old version I think…
Is the new version in the same location ? … ZM_PATH_BIN="/usr/local/bin"

Code: Select all

#!/bin/sh
# description: Control ZoneMinder as a Service
# chkconfig: 2345 99 99

# Source function library.
#. /etc/rc.d/init.d/functions

prog=ZoneMinder
ZM_PATH_BIN="/usr/local/bin"
export LD_LIBRARY_PATH=/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH 
command="$ZM_PATH_BIN/zmpkg.pl"

start() {
        echo -n "Starting $prog: "
        $command start
        RETVAL=$?
        [ $RETVAL = 0 ] && echo success
        [ $RETVAL != 0 ] && echo failure
        echo
        [ $RETVAL = 0 ] && touch /var/lock/subsys/zm
        return $RETVAL
}
stop() {
        echo -n $"Stopping $prog: "
        $command stop
        RETVAL=$?
        [ $RETVAL = 0 ] && echo success
        [ $RETVAL != 0 ] && echo failure
        echo
        [ $RETVAL = 0 ] && rm -f /var/lock/subsys/zm
}
status() {
        result=`$command status`
        if [ "$result" = "running" ]; then
                echo "ZoneMinder is running"
                RETVAL=0
        else
                echo "ZoneMinder is stopped"
                RETVAL=1
        fi
}

case "$1" in
'start')
        start
        ;;
'stop')
        stop
        ;;
'restart')
        stop
        start
        ;;
'status')
        status
        ;;
*)
        echo "Usage: $0 { start | stop | restart | status }"
        RETVAL=1
        ;;
esac
exit $RETVAL
kazy
Posts: 7
Joined: Mon Jan 23, 2012 1:42 pm

Re: ZM 1.25.0 Performance Patch - Completed

Post by kazy »

Hello,

I'm pretty new on linux and Zoneminder and i want to give a try to your Patch.
Seem to be a very great work !! Thx for this :)

Unfortunatly i have some troubles to make it work at home (certainly because of my newbi state :p )
here a quick list, if someone can give me some help
1) I don't see the ZM_CPU_EXTENSIONS option in zomeminder option windows

ps : sorry for parse post, problem with new comer restriction and URL detection >_<
Last edited by kazy on Thu Jan 26, 2012 11:48 am, edited 1 time in total.
kazy
Posts: 7
Joined: Mon Jan 23, 2012 1:42 pm

Re: ZM 1.25.0 Performance Patch - Completed

Post by kazy »

2) I can't see anymore picture in monitor view i have the error
ava. net.SocketException: Unexpected end of file from server"
3) in log file i have this error message
Attempt to fetch integer value for ZM_BLEND_ALARMED_IMAGES, actual type is boolean. Try running 'zmupdate.pl -f' to reload config
and also this error
socket_sendto( /tmp/zm/zms-588298s.sock ) failed: No such file or directory
I have try to install the patch 3 times. But nothing have change.
thanks in advance for your help ;)
kazy
Posts: 7
Joined: Mon Jan 23, 2012 1:42 pm

Re: ZM 1.25.0 Performance Patch - Completed

Post by kazy »

ok, all is fine now :p

Problem was my old ZM 1.24 installation + ffmpeg.
After a last try to apply the patch with correct ./configure "params", all seems to work fine.

ZM_CPU_EXTENSIONS and 32bits options are present.

I will test during 2-3 days to bring my feedback :p
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: ZM 1.25.0 Performance Patch - Completed

Post by mastertheknife »

Hi kazy,

Good to see you got it all sorted!

mastertheknife
Kfir Itzhak.
tibetfreedom
Posts: 163
Joined: Fri Oct 22, 2010 11:21 am

Re: ZM 1.25.0 Performance Patch - Completed

Post by tibetfreedom »

You are attempting to use a format that requires libjpeg-turbo, but ZoneMinder was not compiled against libjpeg-turbo. Make sure that libjpeg-turbo's header files are used, and not standard libjpeg's header files.

Please I can't find out how to enable this… I have installed libjpeg-turbo, but have not either compiled gainst it or enabled it in the lib conf where ever that is……

can you do a simple how to on this… ?

I have compiled with the following…

Many Many thanks, your distro is still loads better than the standard non patched…

./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --with-libarch=lib --with-mysql=/usr --with-ffmpeg=/usr --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-debug=yes --enable-crashtrace=yes ZM_SSL_LIB=openssl CPPFLAGS="-D__STDC_CONSTANT_MACROS"
tibetfreedom
Posts: 163
Joined: Fri Oct 22, 2010 11:21 am

Re: ZM 1.25.0 Performance Patch - Completed

Post by tibetfreedom »

still have this issue...
kazy
Posts: 7
Joined: Mon Jan 23, 2012 1:42 pm

Re: ZM 1.25.0 Performance Patch - Completed

Post by kazy »

I have use this guide to install zoneminder with ZM1.25 sources
http://www.zoneminder.com/wiki/index.ph ... _Cambozola

in this guide there are some change to make for libjpeg-turbo:

wget http://downloads.sourceforge.net/projec ... rror=voxel

mv libjpeg-turbo_1.1.0_amd64.deb?use_mirror=voxel libjpeg-turbo_1.1.0_amd64.deb && \
dpkg -i libjpeg-turbo_1.1.0_amd64.deb

ln -s /opt/libjpeg-turbo/lib/libjpeg.a /usr/lib/libjpeg.a && \
ln -s /opt/libjpeg-turbo/include/jconfig.h /usr/include/jconfig.h && \
ln -s /opt/libjpeg-turbo/include/jerror.h /usr/include/jerror.h && \
ln -s /opt/libjpeg-turbo/include/jmorecfg.h /usr/include/jmorecfg.h && \
ln -s /opt/libjpeg-turbo/include/jpeglib.h /usr/include/jpeglib.h


#######################
#Configure Lib Paths#
#######################
echo "/opt/libjpeg-turbo/lib" > /etc/ld.so.conf.d/libjpeg-turbo.conf && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/ffmpeg.conf && \
echo "LD_LIBRARY_PATH=/usr/local/lib:/opt/libjpeg-turbo/lib:$LD_LIBRARY_PATH" >> /etc/bash.bashrc && \
echo "export LD_LIBRARY_PATH" >> /etc/bash.bashrc

ldconfig

What's work for me


I have also use this configuration command:
./configure --prefix=/usr/local --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --with-libarch=/usr/local/lib --with-mysql=/usr/bin --with-ffmpeg=/usr/local/bin --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-debug=yes --enable-crashtrace=yes CPPFLAGS="-D__STDC_CONSTANT_MACROS")"

note that i have use
--prefix=/usr/local
and
--with-libarch=/usr/local/lib

I have compare params lines in zm.conf after installation with my files and libs location to find the good ./configure params to use for me :)
mastertheknife
Posts: 678
Joined: Wed Dec 16, 2009 4:32 pm
Location: Israel

Re: ZM 1.25.0 Performance Patch - Completed

Post by mastertheknife »

tibetfreedom wrote:You are attempting to use a format that requires libjpeg-turbo, but ZoneMinder was not compiled against libjpeg-turbo. Make sure that libjpeg-turbo's header files are used, and not standard libjpeg's header files.

Please I can't find out how to enable this… I have installed libjpeg-turbo, but have not either compiled gainst it or enabled it in the lib conf where ever that is……

can you do a simple how to on this… ?

I have compiled with the following…

Many Many thanks, your distro is still loads better than the standard non patched…

./configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --with-libarch=lib --with-mysql=/usr --with-ffmpeg=/usr --with-webdir=/var/www/zm --with-cgidir=/usr/lib/cgi-bin --with-webuser=www-data --with-webgroup=www-data --enable-debug=yes --enable-crashtrace=yes ZM_SSL_LIB=openssl CPPFLAGS="-D__STDC_CONSTANT_MACROS"
Did you install libjpeg-turbo from the debian\ubuntu repository? if yes, then thats the issue. Their libjpeg-turbo package only provides the libraries, but not the header files.

mastertheknife
Kfir Itzhak.
Post Reply