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.
TylerSchwend
Posts: 22
Joined: Sat Nov 05, 2011 11:03 pm

Re: ZM 1.25.0 Performance Patch - Completed

Post by TylerSchwend »

When will these changes become official contribs to the Zoneminder source? Would like to see these changes as standard rather than another patch.
gblanco
Posts: 28
Joined: Sun Jul 17, 2011 2:15 pm
Location: Porto Alegre, Brazil

Re: ZM 1.25.0 Performance Patch - Completed

Post by gblanco »

Hi,

i have a issue with this patch ....


May 16 09:12:35 SecuritySystem zms[3557]: INF [Authenticated user 'admin']
May 16 09:12:35 SecuritySystem zms[3557]: ERR [Got unexpected memory map file size 0, expected 30722560]
May 16 09:12:35 SecuritySystem zms[3557]: INF [Got signal 7 (Bus error), crashing]
May 16 09:12:35 SecuritySystem zms[3557]: ERR [Signal address is 0x10293, no eip]
May 16 09:12:35 SecuritySystem zms[3557]: ERR [Backtrace: /lib/x86_64-linux-gnu/libpthread.so.0(+0xfc60) [0x7f4e653a1c60]]
May 16 09:12:35 SecuritySystem zms[3557]: ERR [Backtrace: /usr/lib/cgi-bin/nph-zms() [0x467991]]
May 16 09:12:35 SecuritySystem zms[3557]: ERR [Backtrace: /usr/lib/cgi-bin/nph-zms() [0x46c96a]]
May 16 09:12:35 SecuritySystem zms[3557]: ERR [Backtrace: /usr/lib/cgi-bin/nph-zms() [0x4c9846]]
May 16 09:12:35 SecuritySystem zms[3557]: ERR [Backtrace: /usr/lib/cgi-bin/nph-zms() [0x40bb04]]
May 16 09:12:35 SecuritySystem zms[3557]: ERR [Backtrace: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xff) [0x7f4e64473eff]]
May 16 09:12:35 SecuritySystem zms[3557]: ERR [Backtrace: /usr/lib/cgi-bin/nph-zms() [0x40af19]]
May 16 09:12:35 SecuritySystem zms[3557]: INF [Backtrace complete, please execute the following command for more information]
May 16 09:12:35 SecuritySystem zms[3557]: INF [addr2line -e /usr/lib/cgi-bin/nph-zms() 0x7f4e653a1c60 0x467991 0x46c96a 0x4c9846 0x40bb04 0x7f4e64473eff 0x40af19]


guiseco@SecuritySystem:~$ addr2line -e /usr/lib/cgi-bin/nph-zms 0x7f4e653a1c60 0x467991 0x46c96a 0x4c9846 0x40bb04 0x7f4e64473eff 0x40af19
??:0
/home/guiseco/mastertheknife-ZoneMinder-kfir-e413042/src/zm_monitor.cpp:439
/home/guiseco/mastertheknife-ZoneMinder-kfir-e413042/src/zm_monitor.cpp:2545
/home/guiseco/mastertheknife-ZoneMinder-kfir-e413042/src/zm_stream.cpp:40
/home/guiseco/mastertheknife-ZoneMinder-kfir-e413042/src/zms.cpp:262
??:0
??:0


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 »

Hi gblanco,

Have you tried restarting ZM after changing monitor options?

mastertheknife
Kfir Itzhak.
gblanco
Posts: 28
Joined: Sun Jul 17, 2011 2:15 pm
Location: Porto Alegre, Brazil

Re: ZM 1.25.0 Performance Patch - Completed

Post by gblanco »

Hi,

Yes, many times ...
This error only occurs in "montage" view !

this is the only issue with your patch !!!
tibetfreedom
Posts: 163
Joined: Fri Oct 22, 2010 11:21 am

Re: ZM 1.25.0 Performance Patch - Completed

Post by tibetfreedom »

Hi I am using this with a camera that is meant to be 540 TV lines in PAL Format.
However the only image I get is at 320*240
or
924 x 576
which seems odd…

Am I missing anything ?
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:Hi I am using this with a camera that is meant to be 540 TV lines in PAL Format.
However the only image I get is at 320*240
or
924 x 576
which seems odd…

Am I missing anything ?
If using shared memory instead of mmap (default), perhaps shmmax or shmall are too low. For PAL, the maximum capture resolution should be 768x576 or 720x576 depending on your hardware.

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

Re: ZM 1.25.0 Performance Patch - Completed

Post by mastertheknife »

gblanco wrote:Hi,

Yes, many times ...
This error only occurs in "montage" view !

this is the only issue with your patch !!!
I have been unable to reproduce the problem. Perhaps you let me look or let me know how to reproduce the problem, so i can fix it.

mastertheknife
Kfir Itzhak.
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 all,

The deinterlacing code is now included in the code. There are few deinterlacing techniques included:
1) Discard: This simply copies the even lines into the odd lines. This is the fastest technique, but results in lowest quality.
2) Linear: The odd lines are average of the line above and line below. Should result in slightly better quality than discard, and may be a little slower.
3) Blend: The odd and even lines are blended together. This may create a ghosting effect.
4) Four field motion adaptive deinterlacing: Motion detection is done between the current frame and the next frame, and only motion areas are deinterlaced (using Linear). This is the best technique, results in the best quality, but it is the slowest of all and at the moment, is not perfect yet and white lines may show up sometimes (quite rare), a bug i couldn't fix so far.

To update existing database, run this SQL statement:

Code: Select all

ALTER TABLE `Monitors` ADD `Deinterlacing` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `Orientation`
Enjoy,
mastertheknife
Kfir Itzhak.
marcodefreitas
Posts: 21
Joined: Wed Oct 21, 2009 6:45 pm

Re: ZM 1.25.0 Performance Patch - Completed

Post by marcodefreitas »

Great job, mastertheknife.
Can I recommend a feature to speed-up ZM database connection?
The_Penguin
Posts: 4
Joined: Sun Oct 30, 2011 1:19 am

Re: ZM 1.25.0 Performance Patch - Completed

Post by The_Penguin »

TylerSchwend wrote:When will these changes become official contribs to the Zoneminder source? Would like to see these changes as standard rather than another patch.
I don't believe anyone answered this question.

Why wouldn't these changes get rolled in to the official source?
Carrier82
Posts: 96
Joined: Sat Jul 28, 2012 8:30 pm

Re: ZM 1.25.0 Performance Patch - Completed

Post by Carrier82 »

Hi and thank you for your excellent work, mastertheknife. I'm trying to compile the performance patch on a low-end Aspire One with ubuntu 12.04. I get the following error on compilation:

zm_mpeg.cpp: Jäsenfunktio ”double VideoStream::EncodeFrame(const uint8_t*, int, bool, unsigned int)”:
zm_mpeg.cpp:423:77: virhe: ”av_rescale_q” on esittelemättä tällä näkyvyysalueella
make[2]: *** [zm_mpeg.o] Virhe 1

error: av_rescale_q not introduced on this zone or something? What could be wrong? I do have libjpegturbo-8-dev installed... Sorry if the solution is simple, but it's been 15 years since i've last compiled something on Linux... :)
Carrier82
Posts: 96
Joined: Sat Jul 28, 2012 8:30 pm

Re: ZM 1.25.0 Performance Patch - Completed

Post by Carrier82 »

Oh, and I did use ZM_SSL_LIB=openssl on the configure line as configure suggested.
Carrier82
Posts: 96
Joined: Sat Jul 28, 2012 8:30 pm

Re: ZM 1.25.0 Performance Patch - Completed

Post by Carrier82 »

Some googling gave libav: undocumented API change: libavutil/avutil.h doesn't include mathematics.h any more. This can be fixed by adding #include <libavutil/mathematics.h> in the file cap_ffmpeg_impl.hpp (or something similar) before
#include <ffmpeg/avcodec.h>. I'll try that when I get home.
Carrier82
Posts: 96
Joined: Sat Jul 28, 2012 8:30 pm

Re: ZM 1.25.0 Performance Patch - Completed

Post by Carrier82 »

Adding #include "mathematics.h" to the top of /usr/include/libavutil/avutil.h fixed this problem in case somebody else experiences problems with Ubuntu 12.04 and this patch. Thank you for reading.
Dopey
Posts: 2
Joined: Fri Aug 24, 2012 8:17 am

Re: ZM 1.25.0 Performance Patch - Completed

Post by Dopey »

This is a very very good patch.

I don't know if the original author of zoneminder is aware of it but it would benefit zoneminder to include it in the official source code !
Post Reply