[{"id":39682,"web_url":"https://patchwork.libcamera.org/comment/39682/","msgid":"<178395275439.3603632.13183522545029145717@localhost>","date":"2026-07-13T14:25:54","subject":"Re: [PATCH v5 20/36] ipa: rksip1: lsc: Make parseSizes() a class\n\tfunction","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"content":"Hi Jacopo,\n\nQuoting Jacopo Mondi (2026-07-08 17:51:02)\n> There are no reasons to have it as a static helper.\n\nOut of curiosity, what is the reason to make it a class member? Isn't it\ngenerally preferable to have functions that do not touch class members\nexternal to the class?\n\nBest regards\nStefan\n\n> \n> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> ---\n>  src/ipa/rkisp1/algorithms/lsc.cpp | 60 +++++++++++++++++++--------------------\n>  src/ipa/rkisp1/algorithms/lsc.h   |  2 ++\n>  2 files changed, 32 insertions(+), 30 deletions(-)\n> \n> diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\n> index f32c46084dd1..e03bf361c4b9 100644\n> --- a/src/ipa/rkisp1/algorithms/lsc.cpp\n> +++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n> @@ -34,36 +34,6 @@ namespace {\n>  \n>  constexpr int kColourTemperatureQuantization = 10;\n>  \n> -std::vector<double> parseSizes(const ValueNode &tuningData,\n> -                              const char *prop)\n> -{\n> -       std::vector<double> sizes =\n> -               tuningData[prop].get<std::vector<double>>().value_or(utils::defopt);\n> -       if (sizes.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> -               LOG(RkISP1Lsc, Error)\n> -                       << \"Invalid '\" << prop << \"' values: expected \"\n> -                       << RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n> -                       << \" elements, got \" << sizes.size();\n> -               return {};\n> -       }\n> -\n> -       /*\n> -        * The sum of all elements must be 0.5 to satisfy hardware constraints.\n> -        * Validate it here, allowing a 1% tolerance as rounding errors may\n> -        * prevent an exact match (further adjustments will be performed in\n> -        * LensShadingCorrection::prepare()).\n> -        */\n> -       double sum = std::accumulate(sizes.begin(), sizes.end(), 0.0);\n> -       if (sum < 0.495 || sum > 0.505) {\n> -               LOG(RkISP1Lsc, Error)\n> -                       << \"Invalid '\" << prop << \"' values: sum of the elements\"\n> -                       << \" should be 0.5, got \" << sum;\n> -               return {};\n> -       }\n> -\n> -       return sizes;\n> -}\n> -\n>  unsigned int quantize(unsigned int value, unsigned int step)\n>  {\n>         return std::lround(value / static_cast<double>(step)) * step;\n> @@ -138,6 +108,36 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n>         return 0;\n>  }\n>  \n> +std::vector<double> LensShadingCorrection::parseSizes(const ValueNode &tuningData,\n> +                                                     const char *prop)\n> +{\n> +       std::vector<double> sizes =\n> +               tuningData[prop].get<std::vector<double>>().value_or(utils::defopt);\n> +       if (sizes.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> +               LOG(RkISP1Lsc, Error)\n> +                       << \"Invalid '\" << prop << \"' values: expected \"\n> +                       << RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n> +                       << \" elements, got \" << sizes.size();\n> +               return {};\n> +       }\n> +\n> +       /*\n> +        * The sum of all elements must be 0.5 to satisfy hardware constraints.\n> +        * Validate it here, allowing a 1% tolerance as rounding errors may\n> +        * prevent an exact match (further adjustments will be performed in\n> +        * LensShadingCorrection::prepare()).\n> +        */\n> +       double sum = std::accumulate(sizes.begin(), sizes.end(), 0.0);\n> +       if (sum < 0.495 || sum > 0.505) {\n> +               LOG(RkISP1Lsc, Error)\n> +                       << \"Invalid '\" << prop << \"' values: sum of the elements\"\n> +                       << \" should be 0.5, got \" << sum;\n> +               return {};\n> +       }\n> +\n> +       return sizes;\n> +}\n> +\n>  /**\n>   * \\copydoc libcamera::ipa::Algorithm::configure\n>   */\n> diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\n> index 2a428293cb2e..ee037353bbe4 100644\n> --- a/src/ipa/rkisp1/algorithms/lsc.h\n> +++ b/src/ipa/rkisp1/algorithms/lsc.h\n> @@ -39,6 +39,8 @@ public:\n>  private:\n>         void setParameters(rkisp1_cif_isp_lsc_config &config);\n>         void copyTable(rkisp1_cif_isp_lsc_config &config, const lsc::Components &set0);\n> +       std::vector<double> parseSizes(const ValueNode &tuningData,\n> +                                      const char *prop);\n>  \n>         std::vector<double> xSize_;\n>         std::vector<double> ySize_;\n> \n> -- \n> 2.54.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 DF967C3264\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 13 Jul 2026 14:26:00 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EEDD566118;\n\tMon, 13 Jul 2026 16:25:59 +0200 (CEST)","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 B2F6F6604D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 13 Jul 2026 16:25:57 +0200 (CEST)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:6c1f:355d:1c19:aba6])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 0A09B1049;\n\tMon, 13 Jul 2026 16:25:04 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"pAdc+lqe\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783952704;\n\tbh=YMxuxX5d/ReuBhRkk9vn4BF7+0gtv+Q3DQjfpe19Unw=;\n\th=In-Reply-To:References:Subject:From:Cc:To:Date:From;\n\tb=pAdc+lqeGOfnFv5ry88wREaG5PkUH6YHZZP1PKrLY4B9t2ntBwqQqbncBRYaJtzyi\n\tBcO8xSrYHPRM/9BMUtkNW4ENGlKye53k4Fom3ioPxRr1odhjchRGa79rOTA9hvZZOT\n\t0SWGjxqNfK5MzwtIBQ01/mKAVDrXQ+XUZM+sU4Zs=","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"quoted-printable","In-Reply-To":"<20260708-libipa-algorithms-v5-20-0759d0359f52@ideasonboard.com>","References":"<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>\n\t<20260708-libipa-algorithms-v5-20-0759d0359f52@ideasonboard.com>","Subject":"Re: [PATCH v5 20/36] ipa: rksip1: lsc: Make parseSizes() a class\n\tfunction","From":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tlibcamera-devel@lists.libcamera.org","Date":"Mon, 13 Jul 2026 16:25:54 +0200","Message-ID":"<178395275439.3603632.13183522545029145717@localhost>","User-Agent":"alot/0.12.dev43+g2cacc0d03","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":39690,"web_url":"https://patchwork.libcamera.org/comment/39690/","msgid":"<alXkOFsmmdGlB2bq@zed>","date":"2026-07-14T07:30:42","subject":"Re: [PATCH v5 20/36] ipa: rksip1: lsc: Make parseSizes() a class\n\tfunction","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/people/143/","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"content":"On Mon, Jul 13, 2026 at 04:25:54PM +0200, Stefan Klug wrote:\n> Hi Jacopo,\n>\n> Quoting Jacopo Mondi (2026-07-08 17:51:02)\n> > There are no reasons to have it as a static helper.\n>\n> Out of curiosity, what is the reason to make it a class member? Isn't it\n> generally preferable to have functions that do not touch class members\n> external to the class?\n\nI haven't found any indication in\nhttps://google.github.io/styleguide/cppguide.html\nwether functions like this should be given internal linkage or made\nclass members.\n\nTo me, this function it's an helper that serves the tuning file\nparsing logic. It doesn't touch class members, that's true, but I\ndon't see any advantage in having it external to the class.\n\n>\n> Best regards\n> Stefan\n>\n> >\n> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n> > Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n> > ---\n> >  src/ipa/rkisp1/algorithms/lsc.cpp | 60 +++++++++++++++++++--------------------\n> >  src/ipa/rkisp1/algorithms/lsc.h   |  2 ++\n> >  2 files changed, 32 insertions(+), 30 deletions(-)\n> >\n> > diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\n> > index f32c46084dd1..e03bf361c4b9 100644\n> > --- a/src/ipa/rkisp1/algorithms/lsc.cpp\n> > +++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n> > @@ -34,36 +34,6 @@ namespace {\n> >\n> >  constexpr int kColourTemperatureQuantization = 10;\n> >\n> > -std::vector<double> parseSizes(const ValueNode &tuningData,\n> > -                              const char *prop)\n> > -{\n> > -       std::vector<double> sizes =\n> > -               tuningData[prop].get<std::vector<double>>().value_or(utils::defopt);\n> > -       if (sizes.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> > -               LOG(RkISP1Lsc, Error)\n> > -                       << \"Invalid '\" << prop << \"' values: expected \"\n> > -                       << RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n> > -                       << \" elements, got \" << sizes.size();\n> > -               return {};\n> > -       }\n> > -\n> > -       /*\n> > -        * The sum of all elements must be 0.5 to satisfy hardware constraints.\n> > -        * Validate it here, allowing a 1% tolerance as rounding errors may\n> > -        * prevent an exact match (further adjustments will be performed in\n> > -        * LensShadingCorrection::prepare()).\n> > -        */\n> > -       double sum = std::accumulate(sizes.begin(), sizes.end(), 0.0);\n> > -       if (sum < 0.495 || sum > 0.505) {\n> > -               LOG(RkISP1Lsc, Error)\n> > -                       << \"Invalid '\" << prop << \"' values: sum of the elements\"\n> > -                       << \" should be 0.5, got \" << sum;\n> > -               return {};\n> > -       }\n> > -\n> > -       return sizes;\n> > -}\n> > -\n> >  unsigned int quantize(unsigned int value, unsigned int step)\n> >  {\n> >         return std::lround(value / static_cast<double>(step)) * step;\n> > @@ -138,6 +108,36 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n> >         return 0;\n> >  }\n> >\n> > +std::vector<double> LensShadingCorrection::parseSizes(const ValueNode &tuningData,\n> > +                                                     const char *prop)\n> > +{\n> > +       std::vector<double> sizes =\n> > +               tuningData[prop].get<std::vector<double>>().value_or(utils::defopt);\n> > +       if (sizes.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n> > +               LOG(RkISP1Lsc, Error)\n> > +                       << \"Invalid '\" << prop << \"' values: expected \"\n> > +                       << RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n> > +                       << \" elements, got \" << sizes.size();\n> > +               return {};\n> > +       }\n> > +\n> > +       /*\n> > +        * The sum of all elements must be 0.5 to satisfy hardware constraints.\n> > +        * Validate it here, allowing a 1% tolerance as rounding errors may\n> > +        * prevent an exact match (further adjustments will be performed in\n> > +        * LensShadingCorrection::prepare()).\n> > +        */\n> > +       double sum = std::accumulate(sizes.begin(), sizes.end(), 0.0);\n> > +       if (sum < 0.495 || sum > 0.505) {\n> > +               LOG(RkISP1Lsc, Error)\n> > +                       << \"Invalid '\" << prop << \"' values: sum of the elements\"\n> > +                       << \" should be 0.5, got \" << sum;\n> > +               return {};\n> > +       }\n> > +\n> > +       return sizes;\n> > +}\n> > +\n> >  /**\n> >   * \\copydoc libcamera::ipa::Algorithm::configure\n> >   */\n> > diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\n> > index 2a428293cb2e..ee037353bbe4 100644\n> > --- a/src/ipa/rkisp1/algorithms/lsc.h\n> > +++ b/src/ipa/rkisp1/algorithms/lsc.h\n> > @@ -39,6 +39,8 @@ public:\n> >  private:\n> >         void setParameters(rkisp1_cif_isp_lsc_config &config);\n> >         void copyTable(rkisp1_cif_isp_lsc_config &config, const lsc::Components &set0);\n> > +       std::vector<double> parseSizes(const ValueNode &tuningData,\n> > +                                      const char *prop);\n> >\n> >         std::vector<double> xSize_;\n> >         std::vector<double> ySize_;\n> >\n> > --\n> > 2.54.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 C0D4DC328C\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 14 Jul 2026 07:30:47 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id CA9356612C;\n\tTue, 14 Jul 2026 09:30:46 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id E32FF660AE\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 14 Jul 2026 09:30:45 +0200 (CEST)","from ideasonboard.com (93-46-82-201.ip106.fastwebnet.it\n\t[93.46.82.201])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BC96C103F;\n\tTue, 14 Jul 2026 09:29:51 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"AXzQj/6g\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784014191;\n\tbh=6V+buyo2tdS0dLWJifvHEBuZKOp/R2NebUwUlu0IvuM=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=AXzQj/6gP/ONfuSYawDQMpkalM7Klxm2eWG4SdjaVDdcKklh27zBJ2G4o5ARjiruS\n\t1N8dqZ9ND5c91IZdp9tNDnLma0mtE4kTDSb71v3HuxdJGDQax086gAriLfQhOXmLhl\n\ttpQC3g7lc+2QYPvipd5/zly4yOKXe2JlVtvNHSv8=","Date":"Tue, 14 Jul 2026 09:30:42 +0200","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","To":"Stefan Klug <stefan.klug@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tlibcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","Subject":"Re: [PATCH v5 20/36] ipa: rksip1: lsc: Make parseSizes() a class\n\tfunction","Message-ID":"<alXkOFsmmdGlB2bq@zed>","References":"<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>\n\t<20260708-libipa-algorithms-v5-20-0759d0359f52@ideasonboard.com>\n\t<178395275439.3603632.13183522545029145717@localhost>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<178395275439.3603632.13183522545029145717@localhost>","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":39722,"web_url":"https://patchwork.libcamera.org/comment/39722/","msgid":"<851b1f4e-a8bf-4e96-965f-f2d33bcb339e@ideasonboard.com>","date":"2026-07-15T12:53:17","subject":"Re: [PATCH v5 20/36] ipa: rksip1: lsc: Make parseSizes() a class\n\tfunction","submitter":{"id":216,"url":"https://patchwork.libcamera.org/api/people/216/","name":"Barnabás Pőcze","email":"barnabas.pocze@ideasonboard.com"},"content":"2026. 07. 14. 9:30 keltezéssel, Jacopo Mondi írta:\n> On Mon, Jul 13, 2026 at 04:25:54PM +0200, Stefan Klug wrote:\n>> Hi Jacopo,\n>>\n>> Quoting Jacopo Mondi (2026-07-08 17:51:02)\n>>> There are no reasons to have it as a static helper.\n>>\n>> Out of curiosity, what is the reason to make it a class member? Isn't it\n>> generally preferable to have functions that do not touch class members\n>> external to the class?\n> \n> I haven't found any indication in\n> https://google.github.io/styleguide/cppguide.html\n> wether functions like this should be given internal linkage or made\n> class members.\n> \n> To me, this function it's an helper that serves the tuning file\n> parsing logic. It doesn't touch class members, that's true, but I\n> don't see any advantage in having it external to the class.\n\nIf it is moved into the class, I would suggest marking it `static`,\nmaking it clear that it touches no non-static members.\n\n\n> \n>>\n>> Best regards\n>> Stefan\n>>\n>>>\n>>> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n>>> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n>>> ---\n>>>   src/ipa/rkisp1/algorithms/lsc.cpp | 60 +++++++++++++++++++--------------------\n>>>   src/ipa/rkisp1/algorithms/lsc.h   |  2 ++\n>>>   2 files changed, 32 insertions(+), 30 deletions(-)\n>>>\n>>> diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\n>>> index f32c46084dd1..e03bf361c4b9 100644\n>>> --- a/src/ipa/rkisp1/algorithms/lsc.cpp\n>>> +++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n>>> @@ -34,36 +34,6 @@ namespace {\n>>>\n>>>   constexpr int kColourTemperatureQuantization = 10;\n>>>\n>>> -std::vector<double> parseSizes(const ValueNode &tuningData,\n>>> -                              const char *prop)\n>>> -{\n>>> -       std::vector<double> sizes =\n>>> -               tuningData[prop].get<std::vector<double>>().value_or(utils::defopt);\n>>> -       if (sizes.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n>>> -               LOG(RkISP1Lsc, Error)\n>>> -                       << \"Invalid '\" << prop << \"' values: expected \"\n>>> -                       << RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n>>> -                       << \" elements, got \" << sizes.size();\n>>> -               return {};\n>>> -       }\n>>> -\n>>> -       /*\n>>> -        * The sum of all elements must be 0.5 to satisfy hardware constraints.\n>>> -        * Validate it here, allowing a 1% tolerance as rounding errors may\n>>> -        * prevent an exact match (further adjustments will be performed in\n>>> -        * LensShadingCorrection::prepare()).\n>>> -        */\n>>> -       double sum = std::accumulate(sizes.begin(), sizes.end(), 0.0);\n>>> -       if (sum < 0.495 || sum > 0.505) {\n>>> -               LOG(RkISP1Lsc, Error)\n>>> -                       << \"Invalid '\" << prop << \"' values: sum of the elements\"\n>>> -                       << \" should be 0.5, got \" << sum;\n>>> -               return {};\n>>> -       }\n>>> -\n>>> -       return sizes;\n>>> -}\n>>> -\n>>>   unsigned int quantize(unsigned int value, unsigned int step)\n>>>   {\n>>>          return std::lround(value / static_cast<double>(step)) * step;\n>>> @@ -138,6 +108,36 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n>>>          return 0;\n>>>   }\n>>>\n>>> +std::vector<double> LensShadingCorrection::parseSizes(const ValueNode &tuningData,\n>>> +                                                     const char *prop)\n>>> +{\n>>> +       std::vector<double> sizes =\n>>> +               tuningData[prop].get<std::vector<double>>().value_or(utils::defopt);\n>>> +       if (sizes.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n>>> +               LOG(RkISP1Lsc, Error)\n>>> +                       << \"Invalid '\" << prop << \"' values: expected \"\n>>> +                       << RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n>>> +                       << \" elements, got \" << sizes.size();\n>>> +               return {};\n>>> +       }\n>>> +\n>>> +       /*\n>>> +        * The sum of all elements must be 0.5 to satisfy hardware constraints.\n>>> +        * Validate it here, allowing a 1% tolerance as rounding errors may\n>>> +        * prevent an exact match (further adjustments will be performed in\n>>> +        * LensShadingCorrection::prepare()).\n>>> +        */\n>>> +       double sum = std::accumulate(sizes.begin(), sizes.end(), 0.0);\n>>> +       if (sum < 0.495 || sum > 0.505) {\n>>> +               LOG(RkISP1Lsc, Error)\n>>> +                       << \"Invalid '\" << prop << \"' values: sum of the elements\"\n>>> +                       << \" should be 0.5, got \" << sum;\n>>> +               return {};\n>>> +       }\n>>> +\n>>> +       return sizes;\n>>> +}\n>>> +\n>>>   /**\n>>>    * \\copydoc libcamera::ipa::Algorithm::configure\n>>>    */\n>>> diff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\n>>> index 2a428293cb2e..ee037353bbe4 100644\n>>> --- a/src/ipa/rkisp1/algorithms/lsc.h\n>>> +++ b/src/ipa/rkisp1/algorithms/lsc.h\n>>> @@ -39,6 +39,8 @@ public:\n>>>   private:\n>>>          void setParameters(rkisp1_cif_isp_lsc_config &config);\n>>>          void copyTable(rkisp1_cif_isp_lsc_config &config, const lsc::Components &set0);\n>>> +       std::vector<double> parseSizes(const ValueNode &tuningData,\n>>> +                                      const char *prop);\n>>>\n>>>          std::vector<double> xSize_;\n>>>          std::vector<double> ySize_;\n>>>\n>>> --\n>>> 2.54.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 882F0C3304\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed, 15 Jul 2026 12:53:23 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 6EFD466178;\n\tWed, 15 Jul 2026 14:53:22 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id D2D5166105\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed, 15 Jul 2026 14:53:20 +0200 (CEST)","from [192.168.33.27] (185.221.140.128.nat.pool.zt.hu\n\t[185.221.140.128])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 95CAB12D6;\n\tWed, 15 Jul 2026 14:52:25 +0200 (CEST)"],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"rBhGS3a+\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1784119945;\n\tbh=pt4oUENphN73RS9OdEmjHiqqlffVL6xx7szPj4ls8Ws=;\n\th=Date:Subject:To:Cc:References:From:In-Reply-To:From;\n\tb=rBhGS3a+NMVW/1oPuHGD6fZdDFvj+fLUMLHuUkXfuEki1WlsF6QvlEug1YQqXY4xc\n\tEbm4XRJjSlxPaFVzzlWI+r4Z7MzI5SD/gLMGPhX1zEg+uXLt6MUzFe9Z2xfKmbdcWl\n\tFV9Vho5ko5TMoWwo2VNRjwZol2b1gAJt2z/LJGJs=","Message-ID":"<851b1f4e-a8bf-4e96-965f-f2d33bcb339e@ideasonboard.com>","Date":"Wed, 15 Jul 2026 14:53:17 +0200","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v5 20/36] ipa: rksip1: lsc: Make parseSizes() a class\n\tfunction","To":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>,\n\tStefan Klug <stefan.klug@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org,\n\tKieran Bingham <kieran.bingham@ideasonboard.com>","References":"<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>\n\t<20260708-libipa-algorithms-v5-20-0759d0359f52@ideasonboard.com>\n\t<178395275439.3603632.13183522545029145717@localhost>\n\t<gP5i3sj-OMm6eiEqt2E-1hAIixlqb8m4A7Tix5YeXMg4kQY13GOTzJcAK7c2PEpfgz9mUx0H2PD166gDXhb_1g==@protonmail.internalid>\n\t<alXkOFsmmdGlB2bq@zed>","From":"=?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= <barnabas.pocze@ideasonboard.com>","Content-Language":"en-US, hu-HU","In-Reply-To":"<alXkOFsmmdGlB2bq@zed>","Content-Type":"text/plain; charset=UTF-8; format=flowed","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>"}}]