[PATCH 13/15] ipa: rkisp1: awb: Don't calculate RGB means if stats are missing

Laurent Pinchart laurent.pinchart at ideasonboard.com
Mon Feb 24 00:04:01 CET 2025


When statistics are missing we can't meaningfully calculate the RGB
means. Move their calculation after checking if stats are available.

Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
 src/ipa/rkisp1/algorithms/awb.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
index af34b81beb96..7f333ef86518 100644
--- a/src/ipa/rkisp1/algorithms/awb.cpp
+++ b/src/ipa/rkisp1/algorithms/awb.cpp
@@ -282,7 +282,6 @@ void Awb::process(IPAContext &context,
 	const rkisp1_cif_isp_stat *params = &stats->params;
 	const rkisp1_cif_isp_awb_stat *awb = &params->awb;
 	IPAActiveState &activeState = context.activeState;
-	RGB<double> rgbMeans = calculateRgbMeans(frameContext, awb);
 
 	metadata.set(controls::AwbEnable, frameContext.awb.autoEnabled);
 	metadata.set(controls::ColourGains, {
@@ -296,6 +295,8 @@ void Awb::process(IPAContext &context,
 		return;
 	}
 
+	RGB<double> rgbMeans = calculateRgbMeans(frameContext, awb);
+
 	/*
 	 * If the means are too small we don't have enough information to
 	 * meaningfully calculate gains. Freeze the algorithm in that case.
-- 
Regards,

Laurent Pinchart



More information about the libcamera-devel mailing list