32-bit color vs 24-bit color test results...

Forum for questions and support relating to the 1.30.x releases only.
Post Reply
Tantamount
Posts: 71
Joined: Wed Feb 03, 2016 7:51 am

32-bit color vs 24-bit color test results...

Post by Tantamount » Sun Oct 30, 2016 9:09 am

The setup:
OS: CentOS 7 64-bit
Memory: 16 gigs
CPU: Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz (8 cores)
Zoneminder 1.30

Zoneminder configurations that may affect results:
CPU_EXTENSIONS is enabled
FAST_IMAGE_BLENDS is disabled
JPEG_FILE_QUALITY = 90

All monitors except for one was set to "None" and disabled. Server is dedicated to Zoneminder only.

One monitor was set up new through ONVIF:
Camera: Reolink RLC-411 2560x1440@30fps 8192 bitrate h.264 (https://www.amazon.com/Security-AutoFoc ... B01B2OEZOO)
Camera settings were adjusted so that night mode ran at 30fps no matter how dark things got.
Source Type: ffmpeg
Function Modect
Enabled
Analysis FPS 5.00
Reference Image Blend %ge 12
Alarm Reference Image Blend %ge 12
source path = rtsp
Remote Method = RTP/RTSP
Capture Width 2560
Capture Height 1440
everything else is default.

Camera is inside my garage at night -- the image is static - no motion or changing light sources. The default "all" zone covers the entire image and is set to "Active" with whatever the default sensitivity setting that comes with.

I wrote this quick perl script to capture cpu usage for the two processes zmc and zma -- note that the output of ps is already averaged throughout the lifetime of the process -- I just wanted to be doubly sure. Also, I'd let things run for a few minutes before running the script to let things settle:

Code: Select all

#!/usr/bin/perl

use strict;
use warnings;
use Time::HiRes qw(usleep nanosleep);

my $zmcCpuAverage = 0;
my $zmaCpuAverage = 0;

for (my $i = 0;$i != 120; $i++)
{
        $zmcCpuAverage = $zmcCpuAverage + `ps --noheader -C zmc -o %cpu`;
        $zmaCpuAverage = $zmaCpuAverage + `ps --noheader -C zma -o %cpu`;
        #poll every 1/2 second
        usleep(500000);
        print ".";
}

$zmcCpuAverage = $zmcCpuAverage / 120;
$zmaCpuAverage = $zmaCpuAverage / 120;

print "\nZMC CPU Average: $zmcCpuAverage\n";
print "ZMA CPU Average: $zmaCpuAverage\n";
print "Total: " . ($zmcCpuAverage + $zmaCpuAverage) . "\n";
Results:
24-bit color:
ZMC CPU Average: 42.8775
ZMA CPU Average: 21.7991666666667
Total: 64.6766666666667

32-bit color:
ZMC CPU Average: 41
ZMA CPU Average: 24.2491666666667
Total: 65.2491666666667

Winner: 24-bit by a difference of 0.5725.

After turning on FAST_IMAGE_BLENDS and restarting Zoneminder:

24-bit color:
ZMC CPU Average: 41.9191666666667
ZMA CPU Average: 7.35916666666665
Total: 49.27833333333335

32-bit color:
ZMC CPU Average: 40.7991666666667
ZMA CPU Average: 5.5
Total: 46.2991666666667

Winner: 32-bit by a difference of 2.97916666666665

After turning off CPU_EXTENSIONS and restarting Zoneminder:

24-bit color:
ZMC CPU Average: 42.245
ZMA CPU Average: 9.93499999999999
Total: 52.17999999999999

32-bit color:
ZMC CPU Average: 40.9658333333333
ZMA CPU Average: 11.6566666666667
Total: 52.6225

Winner: 24-bit color by a difference of 0.44250000000001

After re-enabling CPU_EXTENSIONS and changing JPG quality to the default of 70:

24-bit color:
ZMC CPU Average: 42.7575
ZMA CPU Average: 7.25999999999999
Total: 50.0175

32-bit color:
ZMC CPU Average: 41.0866666666667
ZMA CPU Average: 5.5
Total: 46.5866666666667

Winner: 32-bit color by a difference of 3.4308333333333

After changing JPG quality to 100:

24-bit color:
ZMC CPU Average: 42.0925
ZMA CPU Average: 7.60000000000001
Total: 49.69250000000001

32-bit color:
ZMC CPU Average: 40.8000000000001
ZMA CPU Average: 4.8
Total: 45.6000000000001

Winner: 32-bit color by a difference of 4.09249999999991

Note: At no point did an alarm trigger during these tests.

Conclusions:
If there was big differences between the two color spaces, recent hardware doesn't show them. With that said, with ALL optimization configurations enabled, there is a slight speed improvement choosing 32-bit.

I was surprised how little the CPU_EXTENSIONS settings had on things, and how huge of an effect FAST_IMAGE_BLENDS had! This really should be defaulted to on.

Are there any other testing options people would like me to try? Anything wrong with the testing I have done? I could try to trigger an alarm for each test, but I need to figure out how to do this identically between tests.
2 LaView LV-PB932F4
4 ReoLink RLC-411
CentOS 7.4 - 8 Core Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 16 Gigs ram (Running under XenServer as a VM)
ZoneMinder Version : 1.31.1 Release : 1.320.20180206gitga177d8e9.el7.centos

User avatar
knight-of-ni
Posts: 2332
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: 32-bit color vs 24-bit color test results...

Post by knight-of-ni » Sun Oct 30, 2016 1:40 pm

Tantamount wrote: Conclusions:
If there was big differences between the two color spaces, recent hardware doesn't show them. With that said, with ALL optimization configurations enabled, there is a slight speed improvement choosing 32-bit.

I was surprised how little the CPU_EXTENSIONS settings had on things, and how huge of an effect FAST_IMAGE_BLENDS had! This really should be defaulted to on.

Are there any other testing options people would like me to try? Anything wrong with the testing I have done? I could try to trigger an alarm for each test, but I need to figure out how to do this identically between tests.
From the source code:
https://github.com/ZoneMinder/ZoneMinde ... pm.in#L770
https://github.com/ZoneMinder/ZoneMinde ... pm.in#L785

ZM_FAST_IMAGE_BLENDS and ZM_CPU_EXTENSIONS are in fact on by default.

Machines with support for older version of SSE instructions set, or no SSE support at all, will see less benefit or none at all. You'd be surprised how many old machines are out there which are still running zonemnider.

32bit colorspace allows zoneminder to use use bit shifting, rather than division, on certain jpeg manipulations. This is where the performance boost comes from. This also depends on what kind of cameras you are using and how they are programmed in zoneminder.
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/

User avatar
iconnor
Posts: 1380
Joined: Fri Oct 29, 2010 1:43 am
Location: Toronto
Contact:

Re: 32-bit color vs 24-bit color test results...

Post by iconnor » Sun Oct 30, 2016 7:06 pm

I think the motion detection is largely over shadowed by the h264 decompression. Great to have this data though. Thanks for your efforts.

Tantamount
Posts: 71
Joined: Wed Feb 03, 2016 7:51 am

Re: 32-bit color vs 24-bit color test results...

Post by Tantamount » Sun Oct 30, 2016 8:18 pm

knnniggett wrote: From the source code:
https://github.com/ZoneMinder/ZoneMinde ... pm.in#L770
https://github.com/ZoneMinder/ZoneMinde ... pm.in#L785

ZM_FAST_IMAGE_BLENDS and ZM_CPU_EXTENSIONS are in fact on by default.
I'm pretty sure ZM_CPU_EXTENSIONS was on by default, but FAST_IMAGE_BLENDS wasn't on by default for me -- Could this be an RPM package thing?
2 LaView LV-PB932F4
4 ReoLink RLC-411
CentOS 7.4 - 8 Core Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 16 Gigs ram (Running under XenServer as a VM)
ZoneMinder Version : 1.31.1 Release : 1.320.20180206gitga177d8e9.el7.centos

Tantamount
Posts: 71
Joined: Wed Feb 03, 2016 7:51 am

Re: 32-bit color vs 24-bit color test results...

Post by Tantamount » Sun Oct 30, 2016 8:22 pm

knnniggett wrote:
Tantamount wrote: 32bit colorspace allows zoneminder to use use bit shifting, rather than division, on certain jpeg manipulations. This is where the performance boost comes from. This also depends on what kind of cameras you are using and how they are programmed in zoneminder.
Knnniggett,

For some of the tests, 24-bit was faster. Why?
2 LaView LV-PB932F4
4 ReoLink RLC-411
CentOS 7.4 - 8 Core Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 16 Gigs ram (Running under XenServer as a VM)
ZoneMinder Version : 1.31.1 Release : 1.320.20180206gitga177d8e9.el7.centos

User avatar
knight-of-ni
Posts: 2332
Joined: Thu Oct 18, 2007 1:55 pm
Location: Shiloh, IL

Re: 32-bit color vs 24-bit color test results...

Post by knight-of-ni » Mon Oct 31, 2016 12:29 pm

Tantamount wrote: Knnniggett,

For some of the tests, 24-bit was faster. Why?
Keep in mind that, when we tell users to turn on 32bit colorspace, the assumption is that they have not turned off the other two variables in your test. See below for how to confirm both variables are defaulted to on.

I'm not sure we can really talk about a difference of < 1% cpu time. That's like comparing two video cards, finding one plays a certain game at 1 fps faster, and thus declaring it the winner. That's not to say the data you generated is not useful. Can you run the test again using a camera streaming mjpeg, instead of h264?

While you are at it, it would be helpful if you ran this test with no value in the Analysis FPS field. That feature was donated by a volunteer fairly recently and has not received thorough testing. It would be nice to have some data verifying this feature does what it says without any side effects.

Looks like we never added help text to that field. Description of it is in the conversation surrounding the pull request:
https://github.com/ZoneMinder/ZoneMinder/pull/956
Tantamount wrote: I'm pretty sure ZM_CPU_EXTENSIONS was on by default, but FAST_IMAGE_BLENDS wasn't on by default for me -- Could this be an RPM package thing?
When I built the zoneminder rpms in zmrepo, I did not change the defaults of either of those variables. You can see for yourself.
Default values are on your file-system in this sql script:
/usr/share/zoneminder/db/zm_create.sql

Feel free to search it.
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/

Tantamount
Posts: 71
Joined: Wed Feb 03, 2016 7:51 am

Re: 32-bit color vs 24-bit color test results...

Post by Tantamount » Wed Nov 02, 2016 12:42 am

knnniggett wrote:While you are at it, it would be helpful if you ran this test with no value in the Analysis FPS field. That feature was donated by a volunteer fairly recently and has not received thorough testing. It would be nice to have some data verifying this feature does what it says without any side effects.
I got a chance to try this. Interesting results.

First, CPU usage for ZMA went up considerably... from 7 or 8% to 49-50%.
Second, all events captured after this went into slow motion mode when I attempted to play them back. Super smooth, slow motion -- like around 60 fps or something playing back at 30 fps.

I've entered in 30 fps in that field for now -- since that's what most of my cameras work off of. ZMA CPU utilization dropped in half as a result.
2 LaView LV-PB932F4
4 ReoLink RLC-411
CentOS 7.4 - 8 Core Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz, 16 Gigs ram (Running under XenServer as a VM)
ZoneMinder Version : 1.31.1 Release : 1.320.20180206gitga177d8e9.el7.centos

Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests