[{"id":36739,"web_url":"https://patchwork.libcamera.org/comment/36739/","msgid":"<176245088873.2421127.6963395506046675115@ping.linuxembedded.co.uk>","date":"2025-11-06T17:41:28","subject":"Re: [PATCH v2 1/3] ipa: libipa: pwl: Allow to parse a plain yaml\n\tvalue as single point PWL","submitter":{"id":4,"url":"https://patchwork.libcamera.org/api/people/4/","name":"Kieran Bingham","email":"kieran.bingham@ideasonboard.com"},"content":"Quoting Stefan Klug (2025-11-06 16:42:25)\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> 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> \n> ---\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> +       /* Treat a single value as single point PWL */\n> +       if (obj.isValue()) {\n> +               auto v = obj.get<double>();\n> +               if (!v)\n> +                       return std::nullopt;\n> +\n> +               return ipa::Pwl({ { { 0.0, *v } } });\n\nSounds reasonable to me.\n\n\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n\n> +       }\n> +\n>         if (!obj.size() || obj.size() % 2)\n>                 return std::nullopt;\n>  \n> -- \n> 2.51.0\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 84C03C3241\n\tfor <parsemail@patchwork.libcamera.org>;\n\tThu,  6 Nov 2025 17:41:33 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id D557760A80;\n\tThu,  6 Nov 2025 18:41:32 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 05AB5606E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tThu,  6 Nov 2025 18:41:32 +0100 (CET)","from pendragon.ideasonboard.com\n\t(cpc89244-aztw30-2-0-cust6594.18-1.cable.virginm.net [86.31.185.195])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id AEC386F3;\n\tThu,  6 Nov 2025 18:39:36 +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=\"SlC6T6pT\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762450776;\n\tbh=DtcBsSfwafqj7OWmm2EgJ/NbxEsgEET348FNOvHv9oE=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=SlC6T6pT3wX3u/MHbF48uwGvdYoqrb0m0euifNeAaFF4fS7sXXAz1WZWvjzf/oaW3\n\t8a3dY92UojvFCv2aAOiGOIJ/g4Y7knqOK3SmDS11GmT774O3/cxMUhwXB/u4+thYCx\n\thyoNiOmG6zCYoUkDPuOyOzWB3cJl0GCwArFAEENQ=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20251106164239.460738-2-stefan.klug@ideasonboard.com>","References":"<20251106164239.460738-1-stefan.klug@ideasonboard.com>\n\t<20251106164239.460738-2-stefan.klug@ideasonboard.com>","Subject":"Re: [PATCH v2 1/3] ipa: libipa: pwl: Allow to parse a plain yaml\n\tvalue as single point PWL","From":"Kieran Bingham <kieran.bingham@ideasonboard.com>","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Thu, 06 Nov 2025 17:41:28 +0000","Message-ID":"<176245088873.2421127.6963395506046675115@ping.linuxembedded.co.uk>","User-Agent":"alot/0.9.1","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>"}},{"id":36764,"web_url":"https://patchwork.libcamera.org/comment/36764/","msgid":"<c416d2e3-cf97-4c9b-a21d-2ef6c474c061@ideasonboard.com>","date":"2025-11-11T10:49:15","subject":"Re: [PATCH v2 1/3] ipa: libipa: pwl: Allow to parse a plain yaml\n\tvalue as single point PWL","submitter":{"id":156,"url":"https://patchwork.libcamera.org/api/people/156/","name":"Dan Scally","email":"dan.scally@ideasonboard.com"},"content":"Hi Stefan\n\nOn 06/11/2025 16:42, 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> 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> \n\nReviewed-by: Daniel Scally <dan.scally@ideasonboard.com>> ---\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> +\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 AF88EC3263\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 11 Nov 2025 10:49:20 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id A35BA60A8B;\n\tTue, 11 Nov 2025 11:49:19 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 191D060805\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 11 Nov 2025 11:49:18 +0100 (CET)","from [192.168.0.43]\n\t(cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 69A8D22B;\n\tTue, 11 Nov 2025 11:47:19 +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=\"M18N2N47\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1762858039;\n\tbh=vF785gH1TOGGS9gz8YAz9sw9lis21cdOMO7Y3OLtf/0=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=M18N2N47K7WRrQbuG0Bshy5yBVBkGkKp9DZtNGcXZUfx362vcUBJ4QwMmgdvu0vL9\n\t/sYWhLydH80RqH5nRykichJrAQxKglvsFAYZd+8ggPSg2gxZtSF+A27c/7UQRkiux1\n\teCd5/kJdJtID9NEFMAgqZN6i0DFG3NtqRZy9T508=","Message-ID":"<c416d2e3-cf97-4c9b-a21d-2ef6c474c061@ideasonboard.com>","Date":"Tue, 11 Nov 2025 10:49:15 +0000","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v2 1/3] ipa: libipa: pwl: Allow to parse a plain yaml\n\tvalue as single point PWL","To":"Stefan Klug <stefan.klug@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20251106164239.460738-1-stefan.klug@ideasonboard.com>\n\t<20251106164239.460738-2-stefan.klug@ideasonboard.com>","Content-Language":"en-US","From":"Dan Scally <dan.scally@ideasonboard.com>","In-Reply-To":"<20251106164239.460738-2-stefan.klug@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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>"}},{"id":36823,"web_url":"https://patchwork.libcamera.org/comment/36823/","msgid":"<vjc3fh3oyn5gq2m2cs7oee3sgnkr44som54rcm5kgi73ry7yiv@wohpk2hkofes>","date":"2025-11-14T16:36:23","subject":"Re: [PATCH v2 1/3] ipa: libipa: pwl: Allow to parse a plain yaml\n\tvalue as single point PWL","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"Hi Stefan\n\nOn Thu, Nov 06, 2025 at 05:42:25PM +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> 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>\n> ---\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> +\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> --\n> 2.51.0\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 30DE9C3263\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 14 Nov 2025 16:36:29 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 75ECB609D8;\n\tFri, 14 Nov 2025 17:36:28 +0100 (CET)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 29657606E6\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 14 Nov 2025 17:36:27 +0100 (CET)","from ideasonboard.com (93-61-96-190.ip145.fastwebnet.it\n\t[93.61.96.190])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id C2E16664;\n\tFri, 14 Nov 2025 17:34:25 +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=\"DHZaeMhO\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1763138065;\n\tbh=W7qDx32rtpJKQw5r/M8Gk1JcO5qxMxQy2+hjctZrcfA=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=DHZaeMhOjgqullrw8nFwvdSfJO8xYfpCrFOBoQAZjODmNLPn46dguEtY8SKe/BLNF\n\tMBsRSsm3ZbUzvqDf0VYwl/WDKRtW0mekvA/Pn17+kyw+nXj2WrYPYnEuye/Cr9lu2d\n\tSJtwl1LAJpCUuyLK3pjXfUB82Rn3SIunpRhhdQRo=","Date":"Fri, 14 Nov 2025 17:36:23 +0100","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Subject":"Re: [PATCH v2 1/3] ipa: libipa: pwl: Allow to parse a plain yaml\n\tvalue as single point PWL","Message-ID":"<vjc3fh3oyn5gq2m2cs7oee3sgnkr44som54rcm5kgi73ry7yiv@wohpk2hkofes>","References":"<20251106164239.460738-1-stefan.klug@ideasonboard.com>\n\t<20251106164239.460738-2-stefan.klug@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<20251106164239.460738-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>"}}]