[PATCH 07/10] ipa: rkisp1: Damp color temperature regulation

Stefan Klug stefan.klug at ideasonboard.com
Mon Feb 17 11:01:48 CET 2025


Damp the regulation of the color temperature with the same factor as the
gains.  Not damping the color temperature leads to visible flicker, as
the CCM changes too much.

Signed-off-by: Stefan Klug <stefan.klug at ideasonboard.com>
---
 src/ipa/rkisp1/algorithms/awb.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
index 9244a1e64f41..347d38d226b4 100644
--- a/src/ipa/rkisp1/algorithms/awb.cpp
+++ b/src/ipa/rkisp1/algorithms/awb.cpp
@@ -320,8 +320,6 @@ void Awb::process(IPAContext &context,
 	    rgbMeans.b() < kMeanMinThreshold)
 		return;
 
-	activeState.awb.automatic.temperatureK = estimateCCT(rgbMeans);
-
 	/*
 	 * Estimate the red and blue gains to apply in a grey world. The green
 	 * gain is hardcoded to 1.0. Avoid divisions by zero by clamping the
@@ -343,8 +341,11 @@ void Awb::process(IPAContext &context,
 
 	/* Filter the values to avoid oscillations. */
 	double speed = 0.2;
+	double ct = estimateCCT(rgbMeans);
+	ct = ct * speed + activeState.awb.automatic.temperatureK * (1 - speed);
 	gains = gains * speed + activeState.awb.automatic.gains * (1 - speed);
 
+	activeState.awb.automatic.temperatureK = static_cast<unsigned int>(ct);
 	activeState.awb.automatic.gains = gains;
 
 	LOG(RkISP1Awb, Debug)
-- 
2.43.0



More information about the libcamera-devel mailing list