{"id":27219,"url":"https://patchwork.libcamera.org/api/1.1/patches/27219/?format=json","web_url":"https://patchwork.libcamera.org/patch/27219/","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":"<20260706-libipa-algorithms-v3-19-968757b038bb@ideasonboard.com>","date":"2026-07-06T08:01:39","name":"[v3,19/35] 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/27219/mbox/","series":[{"id":6038,"url":"https://patchwork.libcamera.org/api/1.1/series/6038/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6038","date":"2026-07-06T08:01:20","name":"ipa: libipa: Introduce libipa algorithms","version":3,"mbox":"https://patchwork.libcamera.org/series/6038/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27219/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27219/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 10B9DC330F\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jul 2026 08:02:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C410C66046;\n\tMon,  6 Jul 2026 10:02:25 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id DE94F6600D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Jul 2026 10:02:09 +0200 (CEST)","from [192.168.125.177] (mob-109-113-60-81.net.vodafone.it\n\t[109.113.60.81])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 8F1F53FB7;\n\tMon,  6 Jul 2026 10:01:21 +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=\"KcbHoquo\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783324881;\n\tbh=8GlTgDyPd4f0znliQ0xwhTjrc5pCxzBor2pnK/OPgzY=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=KcbHoquoeGq2yEUVlcbqxBWA/FutsjHiFCxXwwOTxJ24cL/BXNJe2Iudcswzu/brU\n\tFhdBLMZPNU2rpkGD+5a9mpYMj063gBjEW+vhei40k4T9Sr7W4Kh9aV6n081x/XKZHq\n\tTQpij4UnMjel/0xmEVsySVViZO0ROTRjw8V2U9uo=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Date":"Mon, 06 Jul 2026 10:01:39 +0200","Subject":"[PATCH v3 19/35] 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":"<20260706-libipa-algorithms-v3-19-968757b038bb@ideasonboard.com>","References":"<20260706-libipa-algorithms-v3-0-968757b038bb@ideasonboard.com>","In-Reply-To":"<20260706-libipa-algorithms-v3-0-968757b038bb@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org, \n\tStefan Klug <stefan.klug@ideasonboard.com>","Cc":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","X-Mailer":"b4 0.14.3","X-Developer-Signature":"v=1; a=openpgp-sha256; l=3484;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=8GlTgDyPd4f0znliQ0xwhTjrc5pCxzBor2pnK/OPgzY=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqS2DxUR/+gGv6EvV5PtMpO9Ku6pOvk0a5tDprd\n\tWWui36wMFqJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaktg8QAKCRByNAaPFqFW\n\tPCnkEADCFrSNiVuCrWEyLGdzHdnkyPgvArRyyEw67VGz8tPFxnQIWVklI+R7QOsMR+rlMi9cJY5\n\tpopIlO8Vgf/EBsojLwFcDl39tM+MHj3lBjL7tSVQLrKw08g/hgDaFtfvdS6NcdZvv23rRgDlnq9\n\te7eRqp1Hv2fa5S/yCPsGnfjaxHnjz90dOKs6h7gDRyJAEMXXY7BRPXqtqy/j0TeALXW6FsqQmHh\n\tuACLrqBfI5IcTxjRUk9Qjm9te8BWCyACBRHP8Kne4yOESACTb2YW8wQuqQdaK1Pydea89IgRfbD\n\tuFJBJeTWICCo1w+O2Nc5D9oJZREqHwVeu+mTIJcGRQ4LbA+FpN6QtMEI4p5IXvn4btejSPx0sju\n\tEIm+26EDMWzSEW3Qt/wwDaE4Tn9QQNFWvfUJO4VhhwLp9c9fkMUuZmlgijaClZfZR7DB114MqSk\n\tYjVS5giEo0cCc8DJuTyNZnyxxaUUarNNWzRiOMsHYNt7SRyc8Ga9v2DiX7Uv0OU/M8rKPY7uFeC\n\t5Klf7fHs4NabdOuW7mShKK84Ivb8bh6kRLcYwM/DbYn8VgIQbtKjS6JCOpdOVLmSvF9ymGXnWH1\n\thwyE7PtQRgLoknRyNKXlnmE4gsKbX9sYUjkF9v6Dz7S0tbjG1ryM3bfmVhXFXfkgg+gXB4K/y4y\n\tceMskWh77X1Ohng==","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>\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 974534175e06..0312ce2f8bb1 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":["v3","19/35"]}