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>
This commit is contained in:
David Plowman
2023-11-22 09:13:02 +00:00
committed by Laurent Pinchart
parent fd84180d7a
commit 2fae9603e6

View File

@@ -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;
}