[PATCH v2 13/17] ipa: rkisp1: awb: Use gains from color temperature curve

Stefan Klug stefan.klug at ideasonboard.com
Wed Mar 19 17:11:18 CET 2025


Use the color gains for white balance if calibrated light sources are
contained in the tuning file. The results are generally better
especially when large uniformly colored objects are in the scene. Pure
grey world model is still available by removing the color gains from the
tuning file.

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

diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
index 58b8370d2c61..286d9e3e2018 100644
--- a/src/ipa/rkisp1/algorithms/awb.cpp
+++ b/src/ipa/rkisp1/algorithms/awb.cpp
@@ -218,6 +218,16 @@ void Awb::prepare(IPAContext &context, const uint32_t frame,
 		auto &awb = context.activeState.awb;
 		frameContext.awb.gains = awb.automatic.gains;
 		frameContext.awb.temperatureK = awb.automatic.temperatureK;
+
+		const auto &gains = awbAlgo_->gainsFromColourTemperature(
+			awb.automatic.temperatureK);
+		if (gains) {
+			frameContext.awb.gains.r() = gains->r();
+			frameContext.awb.gains.g() = 1.0;
+			frameContext.awb.gains.b() = gains->b();
+		} else {
+			frameContext.awb.gains = awb.automatic.gains;
+		}
 	}
 
 	auto gainConfig = params->block<BlockType::AwbGain>();
-- 
2.43.0



More information about the libcamera-devel mailing list