[PATCH] ipa: rpi: controller: rpi: Fix colour gain typo in AGC

David Plowman david.plowman at raspberrypi.com
Thu May 22 15:03:18 CEST 2025


A simple typo crept in where the red gain had been re-typed rather
than using the correct green gain. In particular, this was causing
very dark images for sensors that use large red gains, such as the
IMX477 outdoors.

Fixes: 29892f1c56c6 ("ipa: libipa: colour: Use the RGB class to model RGB values")
Signed-off-by: David Plowman <david.plowman at raspberrypi.com>
---
 src/ipa/rpi/controller/rpi/agc_channel.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/ipa/rpi/controller/rpi/agc_channel.cpp b/src/ipa/rpi/controller/rpi/agc_channel.cpp
index a5562760..b2999364 100644
--- a/src/ipa/rpi/controller/rpi/agc_channel.cpp
+++ b/src/ipa/rpi/controller/rpi/agc_channel.cpp
@@ -717,7 +717,7 @@ static double computeInitialY(StatisticsPtr &stats, AwbStatus const &awb,
 
 	/* Factor in the AWB correction if needed. */
 	if (stats->agcStatsPos == Statistics::AgcStatsPos::PreWb)
-		sum *= RGB<double>{ { awb.gainR, awb.gainR, awb.gainB } };
+		sum *= RGB<double>{ { awb.gainR, awb.gainG, awb.gainB } };
 
 	double ySum = ipa::rec601LuminanceFromRGB(sum);
 
-- 
2.34.1



More information about the libcamera-devel mailing list