[libcamera-devel] [RFC PATCH 2/2] ipa: rkisp1: awb: switch to RGB means mode

Quentin Schulz foss+libcamera at 0leil.net
Thu May 12 10:42:44 CEST 2022


From: Quentin Schulz <quentin.schulz at theobroma-systems.com>

While YCbCr means mode works just fine, it requires a conversion to RGB
before computing necessary RGB gains.

By using RGB means mode directly, this conversion can be spared.

This was tested on a Rockchip PX30-based custom board and on a Theobroma
Puma SoM + Haikou devkit and all fitted with an OV5675 sensor, using
custom kernels based on upstream Linux kernel (respectively) 5.10 (with
most upstream patches for rkisp1 from newer kernels applied) and 5.13.

Cc: Quentin Schulz <foss+libcamera at 0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz at theobroma-systems.com>
---

We probably need to triple check the other parameters right after (e.g.
the Cr/Cb references, the Y and Cb+Cr min/max values) too.

This is basically so people can check whether it works properly on the
same hardware they said it didn't work when initially adding support for
AWB on RkISP.

 src/ipa/rkisp1/algorithms/awb.cpp | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp
index df749b9b..5dea5c13 100644
--- a/src/ipa/rkisp1/algorithms/awb.cpp
+++ b/src/ipa/rkisp1/algorithms/awb.cpp
@@ -91,11 +91,8 @@ void Awb::prepare(IPAContext &context, rkisp1_params_cfg *params)
 
 	/* Configure the measure window for AWB. */
 	params->meas.awb_meas_config.awb_wnd = context.configuration.awb.measureWindow;
-	/*
-	 * Measure Y, Cr and Cb means.
-	 * \todo RGB is not working, the kernel seems to not configure it ?
-	 */
-	params->meas.awb_meas_config.awb_mode = RKISP1_CIF_ISP_AWB_MODE_YCBCR;
+	/* Measure RGB means. */
+	params->meas.awb_meas_config.awb_mode = RKISP1_CIF_ISP_AWB_MODE_RGB;
 	/* Reference Cr and Cb. */
 	params->meas.awb_meas_config.awb_ref_cb = 128;
 	params->meas.awb_meas_config.awb_ref_cr = 128;
-- 
2.35.3



More information about the libcamera-devel mailing list