summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Plowman <david.plowman@raspberrypi.com>2023-11-22 09:13:02 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2023-11-22 18:33:17 +0200
commit2fae9603e6cc483d9d0d74868721b272776513cf (patch)
tree8f35228d6498e5c7e6feb380d3cfe134deaa5cf6 /src
parentfd84180d7a09eb9f4891f740735b28af68c201af (diff)
ipa: rpi: alsc: Do not allow zero colour ratio statistics
The algorithm computes R/G and B/G colour ratio statistics which we should not allow to go to zero because there is clearly no gain you could apply to R or B to equalise them. Instead flag such regions as having "insufficient data" in the normal manner. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Naushir Patuck <naush@raspberrypi.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/ipa/rpi/controller/rpi/alsc.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ipa/rpi/controller/rpi/alsc.cpp b/src/ipa/rpi/controller/rpi/alsc.cpp
index b7413611..8a205c60 100644
--- a/src/ipa/rpi/controller/rpi/alsc.cpp
+++ b/src/ipa/rpi/controller/rpi/alsc.cpp
@@ -548,7 +548,9 @@ static void calculateCrCb(const RgbyRegions &awbRegion, Array2D<double> &cr,
for (unsigned int i = 0; i < cr.size(); i++) {
auto s = awbRegion.get(i);
- if (s.counted <= minCount || s.val.gSum / s.counted <= minG) {
+ /* Do not return unreliable, or zero, colour ratio statistics. */
+ if (s.counted <= minCount || s.val.gSum / s.counted <= minG ||
+ s.val.rSum / s.counted <= minG || s.val.bSum / s.counted <= minG) {
cr[i] = cb[i] = InsufficientData;
continue;
}