From patchwork Mon Dec 15 20:06:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 25566 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 F22D0BD7D8 for ; Mon, 15 Dec 2025 20:06:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 05617619D0; Mon, 15 Dec 2025 21:06:23 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="BjOy1QJb"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id C8B15615B2 for ; Mon, 15 Dec 2025 21:06:21 +0100 (CET) Received: from charm.hippo-penny.ts.net (cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 48C644F1; Mon, 15 Dec 2025 21:06:16 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1765829176; bh=GLfRIK+ZLs0vAO3S4yDdm6MKTBj7VlruDi2GmoT/oPM=; h=From:To:Cc:Subject:Date:From; b=BjOy1QJbK+Ri/krpwKB3hECVbsnuBIDMcUnvsnNXR+ksXUxjZP1REhw+Qor0eQxHI GeLdTuKnQvHOu9hBCtk1UVmbGjNesCWsh8Z9En2/xX8Kv3YbpvY07a4/Pinkj93s8+ yJvqBfjUT81DUPdJAMvJ50EZnvu9283vi1bFoPN8= From: Kieran Bingham To: libcamera devel Cc: Kieran Bingham Subject: [PATCH] ipa: simple: awb: Fix ColourGains reported Date: Mon, 15 Dec 2025 20:06:14 +0000 Message-ID: <20251215200614.41329-1-kieran.bingham@ideasonboard.com> X-Mailer: git-send-email 2.52.0 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" The AWB gains reported in the metadata are currently scaled against the maximum gain, but in fact the gain itself is already stored as a floating point gain value. Remove the incorrect scaling and report the gains directly. Fixes: a0b97475b1c0 ("ipa: simple: Report the ColourGains in metadata") Signed-off-by: Kieran Bingham Reviewed-by: Milan Zamazal Reviewed-by: Barnabás Pőcze --- src/ipa/simple/algorithms/awb.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ipa/simple/algorithms/awb.cpp b/src/ipa/simple/algorithms/awb.cpp index cf78e980098b..0080865aa34d 100644 --- a/src/ipa/simple/algorithms/awb.cpp +++ b/src/ipa/simple/algorithms/awb.cpp @@ -55,10 +55,9 @@ void Awb::process(IPAContext &context, const SwIspStats::Histogram &histogram = stats->yHistogram; const uint8_t blackLevel = context.activeState.blc.level; - const float maxGain = 1024.0; const float mdGains[] = { - static_cast(frameContext.gains.red / maxGain), - static_cast(frameContext.gains.blue / maxGain) + static_cast(frameContext.gains.red), + static_cast(frameContext.gains.blue) }; metadata.set(controls::ColourGains, mdGains);