[libcamera-devel] [PATCH 01/13] ipa: ipu3: awb: Set a threshold for the green saturation

Jean-Michel Hautbois jeanmichel.hautbois at ideasonboard.com
Wed Oct 13 17:41:13 CEST 2021


We can have a saturation ratio per cell, giving the percentage of pixels
over a threshold within a cell where 100% is set to 0xff.

The parameter structure 'ipu3_uapi_awb_config_s' contains four fields to
set the threshold, one per channel.
The blue field is also used to configure the ImgU and make it calculate
the saturation ratio or not.

Set a green value saturated when it is more than 230 (90% of the maximum
value 255, coded as 8191).

Signed-off-by: Jean-Michel Hautbois <jeanmichel.hautbois at ideasonboard.com>
---
 src/ipa/ipu3/algorithms/awb.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
index e2b18336..5574bd44 100644
--- a/src/ipa/ipu3/algorithms/awb.cpp
+++ b/src/ipa/ipu3/algorithms/awb.cpp
@@ -326,9 +326,9 @@ void Awb::process(IPAContext &context, const ipu3_uapi_stats_3a *stats)
 
 void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)
 {
-	params->acc_param.awb.config.rgbs_thr_gr = 8191;
+	params->acc_param.awb.config.rgbs_thr_gr = (90 * 8191 / 100);
 	params->acc_param.awb.config.rgbs_thr_r = 8191;
-	params->acc_param.awb.config.rgbs_thr_gb = 8191;
+	params->acc_param.awb.config.rgbs_thr_gb = (90 * 8191 / 100);
 	params->acc_param.awb.config.rgbs_thr_b = IPU3_UAPI_AWB_RGBS_THR_B_INCL_SAT
 					       | IPU3_UAPI_AWB_RGBS_THR_B_EN
 					       | 8191;
-- 
2.30.2



More information about the libcamera-devel mailing list