From patchwork Wed Nov 19 13:22:10 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 25081 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 DBBF7BD80A for ; Wed, 19 Nov 2025 13:22:30 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 997BE60A85; Wed, 19 Nov 2025 14:22:30 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ShQSPrJ4"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 9E5C4609E0 for ; Wed, 19 Nov 2025 14:22:28 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:5419:7bb:83a3:3d7a]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 19CB0E7C; Wed, 19 Nov 2025 14:20:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1763558424; bh=CdWXJ5t7eaOtaT/R2RO/4FKGUFV2VxnNYGIYdhgd6gk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ShQSPrJ4/F5T2qfzerkyRUWfqMWJytfYULLYzBIJKcmxRfDGYsvCk1GYBPY102Iti dcoUMucrOxahJbuk/iZ5SKpPsjC8XjN1bUxaNuCiX3oOtfF4BbhrCbSUEztDvAjLD8 nWkKEzFqd7VR/h8t6hqKWuBV215m2Vt09gwBxkV0= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug , Kieran Bingham , Daniel Scally Subject: [PATCH v3 1/4] ipa: libipa: pwl: Allow to parse a plain yaml value as single point PWL Date: Wed, 19 Nov 2025 14:22:10 +0100 Message-ID: <20251119132221.2088013-2-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251119132221.2088013-1-stefan.klug@ideasonboard.com> References: <20251119132221.2088013-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" In the tuning files, it is useful to specify some values as PWL that produces a different output value depending on an input value. For example it is useful to specify the relativeLuminanceTarget depending on the lux level, so that the regulation regulates a bit darker in low light scenes. For simple setups this is not necessary and a single value is sufficient. This patch extends the yaml loading code, so that either case is supported transparently without the need for additional external code. This way the following yaml expressions are all valid: yTarget: [ 1000, 0.15, 2000, 0.17 ] # Regular PWL yTarget: [ 0, 0.17 ] # Single point PWL yTarget: 0.17 # Same as above For cases (I'm not aware of any) where a single point Pwl is not allowed there is no change as that must be checked externally anyways. Signed-off-by: Stefan Klug Reviewed-by: Kieran Bingham Reviewed-by: Daniel Scally --- Changes in v3: - Collected tags Changes in v2: - Added this patch --- src/ipa/libipa/pwl.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp index 69a9334112e8..78ba43e39b77 100644 --- a/src/ipa/libipa/pwl.cpp +++ b/src/ipa/libipa/pwl.cpp @@ -437,6 +437,15 @@ template<> std::optional YamlObject::Getter::get(const YamlObject &obj) const { + /* Treat a single value as single point PWL */ + if (obj.isValue()) { + auto v = obj.get(); + if (!v) + return std::nullopt; + + return ipa::Pwl({ { { 0.0, *v } } }); + } + if (!obj.size() || obj.size() % 2) return std::nullopt;