From patchwork Wed Oct 20 15:45:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jean-Michel Hautbois X-Patchwork-Id: 14211 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 96B81C324E for ; Wed, 20 Oct 2021 15:46:22 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 24C8668F67; Wed, 20 Oct 2021 17:46:20 +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="HqnMqL/V"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id EE8DE6023A for ; Wed, 20 Oct 2021 17:46:13 +0200 (CEST) Received: from tatooine.ideasonboard.com (unknown [IPv6:2a01:e0a:169:7140:ce4b:1c5f:7302:b899]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id AB3D83F6; Wed, 20 Oct 2021 17:46:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1634744773; bh=Pz0NTXrbv9zGzkgSSvnGR/+tUESSHcG6lnJnrkgMAv0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HqnMqL/VeJ10/dsds5FvYKPaz3n/MhqdSNcUMZl9zjjm2nPP5RmlT1oPiojVcJMK/ vbW94bb6ymMmpPp9cVtnip4sHv5vftEdo/RQhSumYYd2JzppKBumps4bqRwxQjnqVo Bd9G4UqSQxek2BlQLoq7OR0StIl/tj8naohA9nVo= From: Jean-Michel Hautbois To: libcamera-devel@lists.libcamera.org Date: Wed, 20 Oct 2021 17:45:58 +0200 Message-Id: <20211020154607.180161-5-jeanmichel.hautbois@ideasonboard.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20211020154607.180161-1-jeanmichel.hautbois@ideasonboard.com> References: <20211020154607.180161-1-jeanmichel.hautbois@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 04/13] ipa: ipu3: awb: Change minimal green threshold value 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" When zones are used for the grey world algorithm, they are only considered if their average green value is at least 32/255 to exclude zones that are too dark and don't provide relevant colour information (on the opposite side of the spectrum, saturated regions are excluded by the ImgU statistics engine). The algorithm requires a minimal number of zones that meet this criteria in order to run. Now that we correct the black level, the 32/255 minimal value is a bit high and prevents the algorithm for running in low-light conditions. Lower the value to 16/255 to fix it. Signed-off-by: Jean-Michel Hautbois Acked-by: Kieran Bingham Reviewed-by: Laurent Pinchart --- src/ipa/ipu3/algorithms/awb.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ipa/ipu3/algorithms/awb.cpp b/src/ipa/ipu3/algorithms/awb.cpp index 62c72cce..1ffb431b 100644 --- a/src/ipa/ipu3/algorithms/awb.cpp +++ b/src/ipa/ipu3/algorithms/awb.cpp @@ -17,7 +17,13 @@ namespace ipa::ipu3::algorithms { LOG_DEFINE_CATEGORY(IPU3Awb) -static constexpr uint32_t kMinGreenLevelInZone = 32; +/* + * When zones are used for the grey world algorithm, they are only considered if + * their average green value is at least 16/255 to exclude zones that are too + * dark and don't provide relevant colour information (on the opposite side of + * the spectrum, saturated regions are excluded by the ImgU statistics engine). + */ +static constexpr uint32_t kMinGreenLevelInZone = 16; /* Minimum proportion of cells counted within a zone for it to be relevant */ static constexpr double kMinRelevantCellsRatio = 0.8;