From patchwork Wed Mar 19 16:11:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22991 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 17412C32FE for ; Wed, 19 Mar 2025 16:12:37 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id CD5C66896A; Wed, 19 Mar 2025 17:12:36 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HfdBn6p9"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 6933668954 for ; Wed, 19 Mar 2025 17:12:35 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:760:e5ca:4814:99c7]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 833708FA; Wed, 19 Mar 2025 17:10:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1742400652; bh=d8mMAhwL3xlqhrLmdBVsg08EjU9FZJx2JwYHYc8fttI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HfdBn6p9RW/Mvk7FzoYqzH687g3iuWz9kC557RYYFChpeUnsYMzm05kUEJatGDVSx jIT95CgLHZQvb0eibGHgC52/zbBXNtEja3qyzr8YSSjTs9G5bzV2TXIjHwDxnBoMt8 W4vTdZKrPu7MnhIewnZRte+p4wZpXPcA1SGLV56g= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v2 13/17] ipa: rkisp1: awb: Use gains from color temperature curve Date: Wed, 19 Mar 2025 17:11:18 +0100 Message-ID: <20250319161152.63625-14-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250319161152.63625-1-stefan.klug@ideasonboard.com> References: <20250319161152.63625-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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index 58b8370d2c61..286d9e3e2018 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -218,6 +218,16 @@ 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; + + const auto &gains = awbAlgo_->gainsFromColourTemperature( + awb.automatic.temperatureK); + if (gains) { + frameContext.awb.gains.r() = gains->r(); + frameContext.awb.gains.g() = 1.0; + frameContext.awb.gains.b() = gains->b(); + } else { + frameContext.awb.gains = awb.automatic.gains; + } } auto gainConfig = params->block();