[libcamera-devel] [PATCH v1 7/7] ipa: ipu3: Introduce Black Level Correction

Jean-Michel Hautbois jeanmichel.hautbois at ideasonboard.com
Mon Aug 23 14:49:37 CEST 2021


The pixels output by the camera normally include a black level, because
sensors do not always report a signal level of '0' for black. Pixels at
or below this level should be considered black. This can be taken into
account by reading the lowest value of a special region on sensors which
is not exposed to the lens. This provides a scaling factor to be able to
adjust the expected black levels in the resultant images.

For a camera outputting 10-bit pixel values (in the range 0 to 1023) a
typical black level might be 64, but the correct value would be found in
the sensor manaufacturer’s datasheet.

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

diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp
index 294871b1..ad3784d3 100644
--- a/src/ipa/ipu3/algorithms/awb.cpp
+++ b/src/ipa/ipu3/algorithms/awb.cpp
@@ -366,9 +366,17 @@ void Awb::prepare(IPAContext &context, ipu3_uapi_params *params)
 	/* The CCM matrix may change when color temperature will be used */
 	params->acc_param.ccm = imguCssCcmDefault;
 
+	/* The Optical Black Level correction values */
+	params->obgrid_param.gr = 64;
+	params->obgrid_param.r = 63;
+	params->obgrid_param.b = 63;
+	params->obgrid_param.gb = 64;
+
 	params->use.acc_awb = 1;
 	params->use.acc_bnr = 1;
 	params->use.acc_ccm = 1;
+	params->use.obgrid = 1;
+	params->use.obgrid_param = 1;
 }
 
 } /* namespace ipa::ipu3::algorithms */
-- 
2.30.2



More information about the libcamera-devel mailing list