From patchwork Thu Nov 6 16:42:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Klug X-Patchwork-Id: 24981 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 A284CBDE4C for ; Thu, 6 Nov 2025 16:42:48 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 5472A60A85; Thu, 6 Nov 2025 17:42:48 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="Az8CKsTf"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id DBF23609D8 for ; Thu, 6 Nov 2025 17:42:46 +0100 (CET) Received: from ideasonboard.com (unknown [IPv6:2a00:6020:448c:6c00:1d00:3bae:f27:7601]) by perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id C402E6AF; Thu, 6 Nov 2025 17:40:51 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1762447251; bh=HgIyUHgF5AeBeG4nogNb3WSdDsAU/wcMRq0HHU9DWyg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Az8CKsTfPMnB7we49d+zomXVEZGzesCYBx5ePGigxJudrJWSLETV3mcnKWBzDxyjH /iju1RoyYVuQMkDdDMq0OI8971jGQcCEGaCm10XJHyZGj45GVnUbzrpdkd7ikhXC7W 5Nu2Jq9WqEjO4YpGqD0m3WY0x/rqfdvu+GUZerXE= From: Stefan Klug To: libcamera-devel@lists.libcamera.org Cc: Stefan Klug Subject: [PATCH v2 1/3] ipa: libipa: pwl: Allow to parse a plain yaml value as single point PWL Date: Thu, 6 Nov 2025 17:42:25 +0100 Message-ID: <20251106164239.460738-2-stefan.klug@ideasonboard.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20251106164239.460738-1-stefan.klug@ideasonboard.com> References: <20251106164239.460738-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 --- 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;