[PATCH v2 1/2] ipa: rpi: awb: Add a const for the default colour temperature

Naushir Patuck naush at raspberrypi.com
Thu Oct 3 10:02:26 CEST 2024


A default CT of 4500K is used in a couple of places. Add a constexpr
value for the default CT value and use it instead.

Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
Reviewed-by: David Plowman <david.plowman at raspberrypi.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/ipa/rpi/controller/rpi/awb.cpp | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/src/ipa/rpi/controller/rpi/awb.cpp b/src/ipa/rpi/controller/rpi/awb.cpp
index f45525bce2d1..3904fed615f7 100644
--- a/src/ipa/rpi/controller/rpi/awb.cpp
+++ b/src/ipa/rpi/controller/rpi/awb.cpp
@@ -20,6 +20,8 @@ using namespace libcamera;
 
 LOG_DEFINE_CATEGORY(RPiAwb)
 
+constexpr double DefaultCT = 4500.0;
+
 #define NAME "rpi.awb"
 
 /*
@@ -214,7 +216,7 @@ void Awb::initialise()
 		syncResults_.gainB = 1.0 / config_.ctB.eval(syncResults_.temperatureK);
 	} else {
 		/* random values just to stop the world blowing up */
-		syncResults_.temperatureK = 4500;
+		syncResults_.temperatureK = DefaultCT;
 		syncResults_.gainR = syncResults_.gainG = syncResults_.gainB = 1.0;
 	}
 	prevSyncResults_ = syncResults_;
@@ -716,7 +718,11 @@ void Awb::awbGrey()
 		sumR += *ri, sumB += *bi;
 	double gainR = sumR.G / (sumR.R + 1),
 	       gainB = sumB.G / (sumB.B + 1);
-	asyncResults_.temperatureK = 4500; /* don't know what it is */
+	/*
+	 * The grey world model can't estimate the colour temperature, use a
+	 * default value.
+	 */
+	asyncResults_.temperatureK = DefaultCT;
 	asyncResults_.gainR = gainR;
 	asyncResults_.gainG = 1.0;
 	asyncResults_.gainB = gainB;
-- 
2.34.1



More information about the libcamera-devel mailing list