From patchwork Mon Feb 17 10:01:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22792 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 4B046C327D for ; Mon, 17 Feb 2025 10:02:29 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 9393C68676; Mon, 17 Feb 2025 11:02:28 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="RxL8wcNA"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id BFC7B68669 for ; Mon, 17 Feb 2025 11:02:24 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b47f:e20a:c4c7:ece1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 7FC201047; Mon, 17 Feb 2025 11:01:03 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1739786463; bh=jG0g7FmqHVXYAk5uPpol5L1i8FG8s83Bz552qvCsgrs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RxL8wcNAZAfuSelds4WlSGNziGJDtMdgibDYYZLFTs4XIUVHYzW9Jt30M7TWdoOS1 /Jnhdgyx2TwlwpgF1O7kfplCFs34K1TshOyvf8UKEs+S198EnO+8bPWWmwa5tp7JrL Ko+LMNha8nbmSLZE0BqWNM61lVZBSWkQfmlS1KFo= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH 06/10] ipa: rkisp1: awb: Use gains from color temperature curve Date: Mon, 17 Feb 2025 11:01:47 +0100 Message-ID: <20250217100203.297894-7-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250217100203.297894-1-stefan.klug@ideasonboard.com> References: <20250217100203.297894-1-stefan.klug@ideasonboard.com> MIME-Version: 1.0 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" Use the color gains for white balance if calibrated light sources are contained in the tuning file. The results are generally better especially when large uniformly colored objects are in the scene. Pure grey world model is still available by removing the color gains from the tuning file. Signed-off-by: Stefan Klug --- src/ipa/rkisp1/algorithms/awb.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index 683a08c943fa..9244a1e64f41 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -159,6 +159,15 @@ void Awb::prepare(IPAContext &context, const uint32_t frame, auto &awb = context.activeState.awb; frameContext.awb.gains = awb.automatic.gains; frameContext.awb.temperatureK = awb.automatic.temperatureK; + if (colourGainCurve_) { + const auto &gains = colourGainCurve_->getInterpolated( + awb.automatic.temperatureK); + frameContext.awb.gains.r() = gains[0]; + frameContext.awb.gains.g() = 1.0; + frameContext.awb.gains.b() = gains[1]; + } else { + frameContext.awb.gains = awb.automatic.gains; + } } auto gainConfig = params->block();