From patchwork Mon Sep 28 11:14:00 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 28390 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 650EDC32D4 for ; Mon, 28 Sep 2026 11:14:26 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 66D3B68A6B; Mon, 28 Sep 2026 13:14:22 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Ll0Sj26E"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 7E34868A50 for ; Mon, 28 Sep 2026 13:14:15 +0200 (CEST) Received: from [127.0.1.1] (chfd-03-b2-v4wan-176392-cust229.vm15.cable.virginm.net [82.19.20.230]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 34F74B07; Mon, 28 Sep 2026 13:12:25 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1790593945; bh=wROGbeJx7zGkWhpfT5mI4iS3iBybvaOX4VhvlhlCN/U=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Ll0Sj26EZzROqpt0CgiBnXgRXuVEttMwkksg66A/d1sek3+8vpH7HNiZfa0m0wq9l zdY++WQykCZNefd/LGKYzs7nMBeUy8UFgMKC9kZHWKrBfC3xX7M8y4gcisQsDodI+/ UHzNfz4ZcTBAsiyVvdJN3BHEEgjftjwLBT4HVp8E= From: Daniel Scally Date: Mon, 28 Sep 2026 12:14:00 +0100 Subject: [PATCH 4/5] ipa: libipa: awb: Update manual gains with automatic MIME-Version: 1.0 Message-Id: <20260928-awb-state-v1-4-9b1bb8b9e51b@ideasonboard.com> References: <20260928-awb-state-v1-0-9b1bb8b9e51b@ideasonboard.com> In-Reply-To: <20260928-awb-state-v1-0-9b1bb8b9e51b@ideasonboard.com> To: libcamera-devel@lists.libcamera.org Cc: Daniel Scally X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2475; i=dan.scally@ideasonboard.com; h=from:subject:message-id; bh=wROGbeJx7zGkWhpfT5mI4iS3iBybvaOX4VhvlhlCN/U=; b=owEBbQKS/ZANAwAKAchJV3psRXUyAcsmYgBqukwFv7bX7eE8O2gIlazQR3vRuHz31oegLW5uK HAt3jIpU9mJAjMEAAEKAB0WIQQqyuwyDnZdb+mxmm/ISVd6bEV1MgUCarpMBQAKCRDISVd6bEV1 MhthD/9U5F3YkE71+bEhzNdjovyHVdvqavb9XhGNq3lTI9jlUt7XWq7OQbQOJn7oihn+y4aMTNE Vw+H6xeVtI8eWA3ACdMxCqnmyW5khkqvXSxfpY2k+wjIZYuQtKEDIIlpsdo0Yf0XX4dQu2ERkZo rYGmxHhn10WjDzE1X8GfQmEYW5nJtbSilkVZ+MYMNy9QN5VJwhx5IK052mQMpr3zaFLvWWZby/K XWJJDQYRYV5PKnM7uidLaITWTrA4vt3JDgbGxAlU4ppmPus2Mu3dGeXzCZRPMTbvU2+K+/Z1wr9 h+CJkRSC5xm56hvxaJrI30ADHfHVn0/F7hawIE9rn/cs0K+llMF8RIZK++Bbql9e124veWHyF28 fQZ2z8YQ9rjUd7aYZTHhl5lT7onhl13oH7uP6pccJ0EUaAhKbpK/MrowYhZn/ksZope6mENS+Tb ydvDd2qazzCwpUFoBiGkydj6NaOgv7uanWCAtCXTc3xhgxkvBDpTyDxxW/suuS+wsfIzrZ/mh7L Dh6Wwc408gnJK4BMjQgT5hbjktFGJ2Q6HW8Aye+nS4y1AuxVMxEQL/WPPwn+HDVAPrO+zdaVPdd wARmjGtGZVGj4LwxWbE8ABEnWbJilQ9MBnN6SUrm/TTyEv/PE8GN7X9yFkWaQaW6elt3umpsgZ6 TZdVnZcg/9J7WKw== X-Developer-Key: i=dan.scally@ideasonboard.com; a=openpgp; fpr=EEC699ACA1B7CB5D31330C0BBD501C2A3546CCF6 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 present behaviour of the AWB algorithm is to decouple manual and automatic gains completely. If AwbEnable is set to false, this leads to a jarring transition to the (possibly default 1.0) manual gains. Instead update the manual gains with the automatic ones if we're in automatic mode so that when AwbEnable is set to false the gains are seen to "freeze" at their current values rather than revert to the last configured manual value. As this is the exact behaviour of the AwbStateLocked value of the AwbState metadata item, set that when AwbEnable == false is passed. Signed-off-by: Daniel Scally --- src/ipa/libipa/awb.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/ipa/libipa/awb.cpp b/src/ipa/libipa/awb.cpp index d1a75020843a03b3530dce4b6bd82f228ec6bed9..0c6a01bd780ce00d21c1f7fdd8ba2ed468c4f4a1 100644 --- a/src/ipa/libipa/awb.cpp +++ b/src/ipa/libipa/awb.cpp @@ -246,12 +246,14 @@ int AwbAlgorithmBase::init(const ValueNode &tuningData) */ int AwbAlgorithmBase::configure(awb::ActiveState &state) { - state.manual.gains = RGB{ 1.0 }; auto gains = impl_->gainsFromColourTemperature(kDefaultColourTemperature); - if (gains) + if (gains) { + state.manual.gains = *gains; state.automatic.gains = *gains; - else + } else { + state.manual.gains = RGB{ 1.0 }; state.automatic.gains = RGB{ 1.0 }; + } state.autoEnabled = true; state.manual.colourTemperature = kDefaultColourTemperature; @@ -286,6 +288,10 @@ void AwbAlgorithmBase::queueRequest(awb::ActiveState &state, const auto &awbEnable = controls.get(controls::AwbEnable); if (awbEnable && *awbEnable != state.autoEnabled) { state.autoEnabled = *awbEnable; + if (state.autoEnabled) + convergedState_ = controls::AwbStateEnum::AwbStateSearching; + else + convergedState_ = controls::AwbStateEnum::AwbStateLocked; LOG(Awb, Debug) << (*awbEnable ? "Enabling" : "Disabling") << " Awb"; @@ -445,6 +451,9 @@ void AwbAlgorithmBase::process(awb::ActiveState &state, state.automatic.colourTemperature = awbResult.colourTemperature; state.automatic.gains = newGains; + if (state.autoEnabled) + state.manual.gains = newGains; + /* Populate metadata. */ metadata.set(controls::AwbEnable, frameContext.autoEnabled); metadata.set(controls::ColourGains, { static_cast(frameContext.gains.r()),