From patchwork Mon Feb 17 10:01:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 22795 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 2A890C327D for ; Mon, 17 Feb 2025 10:02:39 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id D58F368680; Mon, 17 Feb 2025 11:02:38 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="HvfqKpPk"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 14BBB6867E for ; Mon, 17 Feb 2025 11:02:33 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:b47f:e20a:c4c7:ece1]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id A96F4842; Mon, 17 Feb 2025 11:01:12 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1739786472; bh=2TV5LHpoYSbm2dW3u7AWZzvpdbmHFAFImM/UHfEq1GU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HvfqKpPkA/8cxepltPlqByrM4oIBSajRPGkisauGe791BvZ9GsTx9nzU0Wgw4XC5X H+AFWe76TdYFnHXlFNagOhrA9vPRTZv0eKKxfEHFentHwaLlEv4uBS+O47vFCQvwu2 Y/UF57hP9DtfgW/gor2KwBsF5Ltm4hrUxvU8RWNs= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH 09/10] ipa: rkisp1: awb: Take the CCM into account for the AWB gains calculation Date: Mon, 17 Feb 2025 11:01:50 +0100 Message-ID: <20250217100203.297894-10-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" Apparently AWB measurements are taken after the CCM. So the estimated colour temperature and the corresponding CCM also lead to changed rgbMeans. This is another source of oscillations. Fix that by applying the inverse transform on the rgbMeans. Signed-off-by: Stefan Klug --- src/ipa/rkisp1/algorithms/awb.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/ipa/rkisp1/algorithms/awb.cpp b/src/ipa/rkisp1/algorithms/awb.cpp index 12934771c69c..66e6aecedc4c 100644 --- a/src/ipa/rkisp1/algorithms/awb.cpp +++ b/src/ipa/rkisp1/algorithms/awb.cpp @@ -305,6 +305,8 @@ void Awb::process(IPAContext &context, rgbMeans = rgbMeans.max(0.0); } + rgbMeans = frameContext.ccm.ccm.cast().inverse() * rgbMeans; + /* * The ISP computes the AWB means after applying the colour gains, * divide by the gains that were used to get the raw means from the