[{"id":36962,"web_url":"https://patchwork.libcamera.org/comment/36962/","msgid":"<20251121032131.GV10711@pendragon.ideasonboard.com>","date":"2025-11-21T03:21:31","subject":"Re: [PATCH v3 1/4] ipa: libipa: pwl: Allow to parse a plain yaml\n\tvalue as single point PWL","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Wed, Nov 19, 2025 at 02:22:10PM +0100, Stefan Klug wrote:\n> In the tuning files, it is useful to specify some values as PWL that\n> produces a different output value depending on an input value. For\n> example it is useful to specify the relativeLuminanceTarget depending on\n> the lux level, so that the regulation regulates a bit darker in low\n> light scenes. For simple setups this is not necessary and a single value\n> is sufficient.\n> \n> This patch extends the yaml loading code, so that either case is\n> supported transparently without the need for additional external code.\n\nI don't think this is quite correct. There was no need for external\ncode. What this patch does is support a shortcut syntax for single-point\nPWL. The code seems fine, but the commit message is confusing.\n\n> This way the following yaml expressions are all valid:\n> \n> yTarget: [ 1000, 0.15, 2000, 0.17 ]  # Regular PWL\n> yTarget: [ 0, 0.17 ]                 # Single point PWL\n> yTarget: 0.17                        # Same as above\n> \n> For cases (I'm not aware of any) where a single point Pwl is not allowed\n> there is no change as that must be checked externally anyways.\n> \n> Signed-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> Reviewed-by: Daniel Scally <dan.scally@ideasonboard.com>\n> \n> ---\n> \n> Changes in v3:\n> - Collected tags\n> \n> Changes in v2:\n> - Added this patch\n> ---\n>  src/ipa/libipa/pwl.cpp | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n> \n> diff --git a/src/ipa/libipa/pwl.cpp b/src/ipa/libipa/pwl.cpp\n> index 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\ns/PWL/PWL./\n\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>","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 45B22C3336\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 21 Nov 2025 03:21:59 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 8A3F360A86;\n\tFri, 21 Nov 2025 04:21:58 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 742A3609D8\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 21 Nov 2025 04:21:57 +0100 (CET)","from pendragon.ideasonboard.com (fs276ed015.tkyc509.ap.nuro.jp\n\t[39.110.208.21])\n\tby perceval.ideasonboard.com (Postfix) with UTF8SMTPSA id 55A2EE7C;\n\tFri, 21 Nov 2025 04:19:50 +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=\"EYyBXMUo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763695191;\n\tbh=QUyvxLmhaTaizSgqHVhdn7wzgcpUxm6TUTgfG1qiMUs=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=EYyBXMUoD29nzhzILyJn4udYHCy2jsI1LiHRydTI5H52qx3HoQr5rdDQCbhOtb8eO\n\tMfxrICzx11qdb/bWriKVXuEdqpxDxKzUGCYJ3yFJ2sSBodB2gW6ODZnxeWW28hwvvg\n\tdxqS04+Ovd9wQUkmSCbMyNKw07Jir1e79lStMUlo=","Date":"Fri, 21 Nov 2025 12:21:31 +0900","From":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>,\n\tDaniel Scally <dan.scally@ideasonboard.com>","Subject":"Re: [PATCH v3 1/4] ipa: libipa: pwl: Allow to parse a plain yaml\n\tvalue as single point PWL","Message-ID":"<20251121032131.GV10711@pendragon.ideasonboard.com>","References":"<20251119132221.2088013-1-stefan.klug@ideasonboard.com>\n\t<20251119132221.2088013-2-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251119132221.2088013-2-stefan.klug@ideasonboard.com>","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>"}}]