{"id":27328,"url":"https://patchwork.libcamera.org/api/1.1/patches/27328/?format=json","web_url":"https://patchwork.libcamera.org/patch/27328/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/1.1/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":"<20260708-libipa-algorithms-v5-20-0759d0359f52@ideasonboard.com>","date":"2026-07-08T15:51:02","name":"[v5,20/36] ipa: rksip1: lsc: Make parseSizes() a class function","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"be7e2bc5d11bed9f404dc847d51ef26db337bf03","submitter":{"id":143,"url":"https://patchwork.libcamera.org/api/1.1/people/143/?format=json","name":"Jacopo Mondi","email":"jacopo.mondi@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/27328/mbox/","series":[{"id":6048,"url":"https://patchwork.libcamera.org/api/1.1/series/6048/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6048","date":"2026-07-08T15:50:42","name":"ipa: libipa: Introduce libipa algorithms","version":5,"mbox":"https://patchwork.libcamera.org/series/6048/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27328/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27328/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 8D930C331D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Jul 2026 15:51:46 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E920166119;\n\tWed,  8 Jul 2026 17:51:45 +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 71583660BC\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Jul 2026 17:51:18 +0200 (CEST)","from [192.168.1.182] (93-46-82-201.ip106.fastwebnet.it\n\t[93.46.82.201])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 931FC3FB9;\n\tWed,  8 Jul 2026 17:50:28 +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=\"FZYcuV6B\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783525828;\n\tbh=pxt5DHoOyWUjji1QJzKfDgjBXNlzEGrF4ewNXFDC9v4=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=FZYcuV6BTdesC+wQWxFwslmFId7pMPNe4j3uv9VSmrhq4007ry9mx5AKDmNj5V8PM\n\tJ0bOvxvig2OkKRcUJ7Nyzigv9/Qq59/fc+kuIZf8lDFuf7ORPPfmPqQsZx+2IxVB4h\n\tm2+hSxR1sZCXdADD5MclMLwjV1uJ6EF7t2cHZiLk=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Date":"Wed, 08 Jul 2026 17:51:02 +0200","Subject":"[PATCH v5 20/36] ipa: rksip1: lsc: Make parseSizes() a class\n\tfunction","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20260708-libipa-algorithms-v5-20-0759d0359f52@ideasonboard.com>","References":"<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>","In-Reply-To":"<20260708-libipa-algorithms-v5-0-0759d0359f52@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org, \n\tStefan Klug <stefan.klug@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>, \n\tKieran Bingham <kieran.bingham@ideasonboard.com>","X-Mailer":"b4 0.14.3","X-Developer-Signature":"v=1; a=openpgp-sha256; l=3547;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=pxt5DHoOyWUjji1QJzKfDgjBXNlzEGrF4ewNXFDC9v4=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqTnHo7ErOyP0ef+58CuJFn7xZxom9baUDpV+8D\n\tazvfNxZ0z6JAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak5x6AAKCRByNAaPFqFW\n\tPGSTD/9RAcCaEnpMxNEl8CAOS0uGmFWjeqVsUQuvJ1P49Jcmi6t8k3HJ0fe/cJGBvwnBCmS5g2V\n\tJDBWJE8DPrTVOteqTT78ZnnIEMiNN1QV8q93jWb91+ViQJLQxiQgSsFVsMEHXv1u/43S4AXwa9K\n\tiWESj7Xj/JjTVJp5JVu1MFW7tXSe57zJBFTE3qUjM8/U5cVc1m8Jv3E6olVeGWZN3lY+lJ6r7YC\n\t5RCTlu7CN8iwKZLp7EX0E2Sm6znvo9rPLqtF0jTNLFpsVWZE/l/VJibv6At2PUybwpW9DYeaV6j\n\ta5j9xpOJWDOX0mk9cQm4wM8O75b2I0KFSE63qdgDLyJuAMvmYmqqMw8oV6v/cA7rSRzLFfH9iIz\n\tEprLQMmt1yc8K6evItV+K4jMY6xv97+bARsJ2kMVsIfopJQzwk7cXoSyrQFEp++nrRhs5NR3zrt\n\tPKsxmxoOTpTWhUJrLAM+Ne9H2MyduDpv7GsYjTiNv4hTA83hlIDYxvzo4EraSnzPdkC+O/00RjW\n\tYHtZnEQivYestQS4wcN/L1PY3rtGvnJqvaRjAQUjn1NlrC/orRdteVD3Ur1tXE+zZEpsVADcQ/L\n\t8xrCsMyiiWZx5gFRblhpIs3mA1Sp+57WSTNmdyx9IKQuZsJVwvAmRQIy/K4zrbAxs1/a08Fyz7c\n\t68gpyz5Ael0adqQ==","X-Developer-Key":"i=jacopo.mondi@ideasonboard.com; a=openpgp;\n\tfpr=72392EDC88144A65C701EA9BA5826A2587AD026B","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":"There are no reasons to have it as a static helper.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-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(-)","diff":"diff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\nindex 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-\t\t\t       const char *prop)\n-{\n-\tstd::vector<double> sizes =\n-\t\ttuningData[prop].get<std::vector<double>>().value_or(utils::defopt);\n-\tif (sizes.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n-\t\tLOG(RkISP1Lsc, Error)\n-\t\t\t<< \"Invalid '\" << prop << \"' values: expected \"\n-\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n-\t\t\t<< \" elements, got \" << sizes.size();\n-\t\treturn {};\n-\t}\n-\n-\t/*\n-\t * The sum of all elements must be 0.5 to satisfy hardware constraints.\n-\t * Validate it here, allowing a 1% tolerance as rounding errors may\n-\t * prevent an exact match (further adjustments will be performed in\n-\t * LensShadingCorrection::prepare()).\n-\t */\n-\tdouble sum = std::accumulate(sizes.begin(), sizes.end(), 0.0);\n-\tif (sum < 0.495 || sum > 0.505) {\n-\t\tLOG(RkISP1Lsc, Error)\n-\t\t\t<< \"Invalid '\" << prop << \"' values: sum of the elements\"\n-\t\t\t<< \" should be 0.5, got \" << sum;\n-\t\treturn {};\n-\t}\n-\n-\treturn sizes;\n-}\n-\n unsigned int quantize(unsigned int value, unsigned int step)\n {\n \treturn std::lround(value / static_cast<double>(step)) * step;\n@@ -138,6 +108,36 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n \treturn 0;\n }\n \n+std::vector<double> LensShadingCorrection::parseSizes(const ValueNode &tuningData,\n+\t\t\t\t\t\t      const char *prop)\n+{\n+\tstd::vector<double> sizes =\n+\t\ttuningData[prop].get<std::vector<double>>().value_or(utils::defopt);\n+\tif (sizes.size() != RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE) {\n+\t\tLOG(RkISP1Lsc, Error)\n+\t\t\t<< \"Invalid '\" << prop << \"' values: expected \"\n+\t\t\t<< RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE\n+\t\t\t<< \" elements, got \" << sizes.size();\n+\t\treturn {};\n+\t}\n+\n+\t/*\n+\t * The sum of all elements must be 0.5 to satisfy hardware constraints.\n+\t * Validate it here, allowing a 1% tolerance as rounding errors may\n+\t * prevent an exact match (further adjustments will be performed in\n+\t * LensShadingCorrection::prepare()).\n+\t */\n+\tdouble sum = std::accumulate(sizes.begin(), sizes.end(), 0.0);\n+\tif (sum < 0.495 || sum > 0.505) {\n+\t\tLOG(RkISP1Lsc, Error)\n+\t\t\t<< \"Invalid '\" << prop << \"' values: sum of the elements\"\n+\t\t\t<< \" should be 0.5, got \" << sum;\n+\t\treturn {};\n+\t}\n+\n+\treturn sizes;\n+}\n+\n /**\n  * \\copydoc libcamera::ipa::Algorithm::configure\n  */\ndiff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\nindex 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 \tvoid setParameters(rkisp1_cif_isp_lsc_config &config);\n \tvoid copyTable(rkisp1_cif_isp_lsc_config &config, const lsc::Components &set0);\n+\tstd::vector<double> parseSizes(const ValueNode &tuningData,\n+\t\t\t\t       const char *prop);\n \n \tstd::vector<double> xSize_;\n \tstd::vector<double> ySize_;\n","prefixes":["v5","20/36"]}