{"id":24981,"url":"https://patchwork.libcamera.org/api/patches/24981/?format=json","web_url":"https://patchwork.libcamera.org/patch/24981/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20251106164239.460738-2-stefan.klug@ideasonboard.com>","date":"2025-11-06T16:42:25","name":"[v2,1/3] ipa: libipa: pwl: Allow to parse a plain yaml value as single point PWL","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"d66a365cc0228891965c4574cf5b4497fde75f2b","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/24981/mbox/","series":[{"id":5567,"url":"https://patchwork.libcamera.org/api/series/5567/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=5567","date":"2025-11-06T16:42:24","name":"libipa: agc: Fix constraints yTarget handling and add PWL support","version":2,"mbox":"https://patchwork.libcamera.org/series/5567/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/24981/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/24981/checks/","tags":{},"headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A284CBDE4C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Nov 2025 16:42:48 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 5472A60A85;\n\tThu,  6 Nov 2025 17:42:48 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DBF23609D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Nov 2025 17:42:46 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:1d00:3bae:f27:7601])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id C402E6AF;\n\tThu,  6 Nov 2025 17:40:51 +0100 (CET)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"Az8CKsTf\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762447251;\n\tbh=HgIyUHgF5AeBeG4nogNb3WSdDsAU/wcMRq0HHU9DWyg=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=Az8CKsTfPMnB7we49d+zomXVEZGzesCYBx5ePGigxJudrJWSLETV3mcnKWBzDxyjH\n\t/iju1RoyYVuQMkDdDMq0OI8971jGQcCEGaCm10XJHyZGj45GVnUbzrpdkd7ikhXC7W\n\t5Nu2Jq9WqEjO4YpGqD0m3WY0x/rqfdvu+GUZerXE=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH v2 1/3] ipa: libipa: pwl: Allow to parse a plain yaml value\n\tas 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","Content-Transfer-Encoding":"8bit","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"},"content":"In the tuning files, it is useful to specify some values as PWL that\nproduces a different output value depending on an input value. For\nexample it is useful to specify the relativeLuminanceTarget depending on\nthe lux level, so that the regulation regulates a bit darker in low\nlight scenes. For simple setups this is not necessary and a single value\nis sufficient.\n\nThis patch extends the yaml loading code, so that either case is\nsupported transparently without the need for additional external code.\nThis way the following yaml expressions are all valid:\n\nyTarget: [ 1000, 0.15, 2000, 0.17 ]  # Regular PWL\nyTarget: [ 0, 0.17 ]                 # Single point PWL\nyTarget: 0.17                        # Same as above\n\nFor cases (I'm not aware of any) where a single point Pwl is not allowed\nthere is no change as that must be checked externally anyways.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n\n---\n\nChanges in v2:\n- Added this patch\n---\n src/ipa/libipa/pwl.cpp | 9 +++++++++\n 1 file changed, 9 insertions(+)","diff":"diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp\nindex 69a9334112e8..78ba43e39b77 100644\n--- a/src/ipa/libipa/pwl.cpp\n+++ b/src/ipa/libipa/pwl.cpp\n@@ -437,6 +437,15 @@ template<>\n std::optional<ipa::Pwl>\n YamlObject::Getter<ipa::Pwl>::get(const YamlObject &obj) const\n {\n+\t/* Treat a single value as single point PWL */\n+\tif (obj.isValue()) {\n+\t\tauto v = obj.get<double>();\n+\t\tif (!v)\n+\t\t\treturn std::nullopt;\n+\n+\t\treturn ipa::Pwl({ { { 0.0, *v } } });\n+\t}\n+\n \tif (!obj.size() || obj.size() % 2)\n \t\treturn std::nullopt;\n \n","prefixes":["v2","1/3"]}