[libcamera-devel] [RFC PATCH 1/1] ipa: ipu3: awb: Correct the coefficient factor

Jean-Michel Hautbois jeanmichel.hautbois at ideasonboard.com
Thu Jun 16 11:11:49 CEST 2022


The factor used right now in the IPU3 is 8192, as stated in the
documentation : "Precision u3.13, range [0, 8)".

Testing it in more depth made this assumption debatable, as it seems
that the gain is 1.0 when the value is 4096.

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

diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
index 5c232d92..2a7d30ab 100644
--- a/src/ipa/ipu3/algorithms/awb.cpp
+++ b/src/ipa/ipu3/algorithms/awb.cpp
@@ -451,10 +451,10 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)
 	params->acc_param.bnr.opt_center_sqr.y_sqr_reset = params->acc_param.bnr.opt_center.y_reset
 							* params->acc_param.bnr.opt_center.y_reset;
 	/* Convert to u3.13 fixed point values */
-	params->acc_param.bnr.wb_gains.gr = 8192 * context.activeState.awb.gains.green;
-	params->acc_param.bnr.wb_gains.r  = 8192 * context.activeState.awb.gains.red;
-	params->acc_param.bnr.wb_gains.b  = 8192 * context.activeState.awb.gains.blue;
-	params->acc_param.bnr.wb_gains.gb = 8192 * context.activeState.awb.gains.green;
+	params->acc_param.bnr.wb_gains.gr = 0 * context.activeState.awb.gains.green;
+	params->acc_param.bnr.wb_gains.r  = 4096 * context.activeState.awb.gains.red;
+	params->acc_param.bnr.wb_gains.b  = 4096 * context.activeState.awb.gains.blue;
+	params->acc_param.bnr.wb_gains.gb = 0 * context.activeState.awb.gains.green;
 
 	LOG(IPU3Awb, Debug) << "Color temperature estimated: " << asyncResults_.temperatureK;
 
-- 
2.34.1



More information about the libcamera-devel mailing list