mirror of
https://github.com/ZoneMinder/zoneminder.git
synced 2026-11-07 05:03:00 -05:00
On GRAY8 and planar YUV images CheckSignal compared the Y byte with the low byte of the RGB setting, which is its blue component. A camera showing the default #0000BE decodes to Y=35 and never counted as lost; only a colour whose blue byte happened to equal the luma matched. Compare with the BT.601 luma of the colour in limited range (YUV420P, YUV422P) and in full range (J formats, GRAY8). The low byte still matches, so setups that stored the luma there (#000023, as the V4L2 probe does for GREY) keep working. fixes #5240 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.4 KiB
C++
39 lines
1.4 KiB
C++
/*
|
|
* This file is part of the ZoneMinder Project. See AUTHORS file for Copyright information
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License as published by the
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
* option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
* more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License along
|
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "zm_catch2.h"
|
|
|
|
#include "zm_rgb.h"
|
|
|
|
TEST_CASE("rgb_to_luma") {
|
|
SECTION("limited range, as YUV420P/YUV422P hold it") {
|
|
REQUIRE(rgb_to_luma(0, 0, 0, false) == 16);
|
|
REQUIRE(rgb_to_luma(255, 255, 255, false) == 235);
|
|
// The default SignalCheckColour #0000BE; a decoded solid #0000BE picture
|
|
// holds Y=35 in every pixel.
|
|
REQUIRE(rgb_to_luma(0x00, 0x00, 0xBE, false) == 35);
|
|
}
|
|
|
|
SECTION("full range, as the J formats and GRAY8 hold it") {
|
|
REQUIRE(rgb_to_luma(0, 0, 0, true) == 0);
|
|
REQUIRE(rgb_to_luma(255, 255, 255, true) == 255);
|
|
REQUIRE(rgb_to_luma(0x00, 0x00, 0xBE, true) == 22);
|
|
REQUIRE(rgb_to_luma(255, 0, 0, true) == 76);
|
|
REQUIRE(rgb_to_luma(0, 255, 0, true) == 150);
|
|
}
|
|
}
|