From patchwork Mon Aug 23 12:49:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 13442 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 312DFC3242 for ; Mon, 23 Aug 2021 12:49:52 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E5F6E68915; Mon, 23 Aug 2021 14:49:51 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="d71oWskJ"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 0369F6025B for ; Mon, 23 Aug 2021 14:49:44 +0200 (CEST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:b920:776:a08c:1d1f]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AD07B4A3; Mon, 23 Aug 2021 14:49:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1629722983; bh=bUvMTU7i9QQFkbbpFMujK4Q/ei2+xVpjZ1j7qSsqoh4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d71oWskJyVeg2jatLWdqzB+vnfQfrGHPB3hSJWZiI7HNk4wI7WIHj1OBjHYQG/55Y cWgOItkLqXytvs2QP09JqLwXTKtMlAdfzrg276XqDUeWLRl3XLSLsDqWLaQsZcywnE Eqn9pAyH29VR+FJQ8QxRZlTjQEefMAkQ6geeIs90= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Mon, 23 Aug 2021 14:49:37 +0200 Message-Id: <20210823124937.253539-8-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210823124937.253539-1-jeanmichel.hautbois@ideasonboard.com> References: <20210823124937.253539-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v1 7/7] ipa: ipu3: Introduce Black Level Correction X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 --- 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 */