From patchwork Mon Sep 14 14:02:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 28264 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 A8FD4C335A for ; Mon, 14 Sep 2026 14:04:23 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id E9F83686DF; Mon, 14 Sep 2026 16:04:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="iQk1OIO7"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id D475A6869A for ; Mon, 14 Sep 2026 16:04:21 +0200 (CEST) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:a279:75fa:1f6c:7f40]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DDBB4512; Mon, 14 Sep 2026 16:02:41 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1789394562; bh=bIpiT8bCnAABkkMf6Kxg4is1UDEnWbYRVOroeChEYJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iQk1OIO7uap43O9GBwfo/A1BaSnAqfCZClqmQUTiZYv4ZLZMsOtS+eHFH+qDtNq9L jDScEcaDDFPfMx6vKwEatoUfVjFnawTus1W3tROFI1INIaKQAfDOZOaCRkTkKBFPY4 PPfmOCshO6xIgbk4msZ5yozq8c17IsW/uztelpIU= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v3 20/41] libipa: awb: Populate metadata when stats are invalid Date: Mon, 14 Sep 2026 16:02:33 +0200 Message-ID: <20260914140309.3354666-21-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260914140309.3354666-1-stefan.klug@ideasonboard.com> References: <20260914140309.3354666-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" A pipeline handler can call processStats() on the IPA even in the case that no valid stats are available, just to populate the metadata with the values from the frame context. Add support for that to the AWB algorithm by populating the metadata before checking if stats are valid. Signed-off-by: Stefan Klug --- src/ipa/libipa/awb.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/ipa/libipa/awb.cpp b/src/ipa/libipa/awb.cpp index da835bec018d..81d616c3a646 100644 --- a/src/ipa/libipa/awb.cpp +++ b/src/ipa/libipa/awb.cpp @@ -372,6 +372,12 @@ void AwbAlgorithmBase::process(awb::ActiveState &state, const AwbStats &stats, unsigned int lux, ControlList &metadata) { + /* Populate metadata. */ + metadata.set(controls::AwbEnable, frameContext.autoEnabled); + metadata.set(controls::ColourGains, { static_cast(frameContext.gains.r()), + static_cast(frameContext.gains.b()) }); + metadata.set(controls::ColourTemperature, frameContext.colourTemperature); + if (!stats.valid()) return; @@ -393,12 +399,6 @@ void AwbAlgorithmBase::process(awb::ActiveState &state, state.automatic.gains = awbResult.gains * speed + state.automatic.gains * (1 - speed); - /* Populate metadata. */ - metadata.set(controls::AwbEnable, frameContext.autoEnabled); - metadata.set(controls::ColourGains, { static_cast(frameContext.gains.r()), - static_cast(frameContext.gains.b()) }); - metadata.set(controls::ColourTemperature, frameContext.colourTemperature); - LOG(Awb, Debug) << std::showpoint << "Means " << stats.rgbMeans() << ", gains " << state.automatic.gains << ", temp " << state.automatic.colourTemperature << "K";