[libcamera-devel,RFC,2/2] ipa: rkisp1: awb: switch to RGB means mode
diff mbox series

Message ID 20220512084244.1833554-2-foss+libcamera@0leil.net
State Superseded
Headers show
Series
  • [libcamera-devel,RFC,1/2] ipa: rkisp1: awb: add support for RGB means
Related show

Commit Message

Quentin Schulz May 12, 2022, 8:42 a.m. UTC
From: Quentin Schulz <quentin.schulz@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@0leil.net>
Signed-off-by: Quentin Schulz <quentin.schulz@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(-)

Patch
diff mbox series

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;