{"id":27284,"url":"https://patchwork.libcamera.org/api/1.1/patches/27284/?format=json","web_url":"https://patchwork.libcamera.org/patch/27284/","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-v4-19-f0e99f035294@ideasonboard.com>","date":"2026-07-08T09:25:06","name":"[v4,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/27284/mbox/","series":[{"id":6046,"url":"https://patchwork.libcamera.org/api/1.1/series/6046/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=6046","date":"2026-07-08T09:24:47","name":"ipa: libipa: Introduce libipa algorithms","version":4,"mbox":"https://patchwork.libcamera.org/series/6046/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/27284/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27284/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 51FA2C3333\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Jul 2026 09:25:36 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 4E48366098;\n\tWed,  8 Jul 2026 11:25:30 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 19C4B66081\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Jul 2026 11:25:11 +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 6C6163FB2;\n\tWed,  8 Jul 2026 11:24: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=\"Ee1BF5ww\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783502661;\n\tbh=pxt5DHoOyWUjji1QJzKfDgjBXNlzEGrF4ewNXFDC9v4=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=Ee1BF5wwIHsDSYx7DknK/GuOaLXz6WSe4ZadLYtmJTaRavcD96zsE907W6qIyz2bV\n\tSveEzplIIOBqQE9cfLvboQ9A8IB1BtANzu4/v+u/bdmiQAo9qf3NxHLmqVp7tQHNYJ\n\tc+g2OQZASsPoNMIqvygJK+y5ZMFsFdPnQSwIk3cg=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Date":"Wed, 08 Jul 2026 11:25:06 +0200","Subject":"[PATCH v4 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":"<20260708-libipa-algorithms-v4-19-f0e99f035294@ideasonboard.com>","References":"<20260708-libipa-algorithms-v4-0-f0e99f035294@ideasonboard.com>","In-Reply-To":"<20260708-libipa-algorithms-v4-0-f0e99f035294@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/ZANAwAKAXI0Bo8WoVY8AcsmYgBqThduUjtdsaA+F11YAnEw1FcaUgCSjoxja8ZEs\n\t5TNvl6w0fiJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak4XbgAKCRByNAaPFqFW\n\tPIj9D/948/X3yjENqLFvkOTExxhET4pDm8LX2WkFr4aqZJAbsWWHBW7k9vgi9DT/btqt3Kud60l\n\ttzbFkBAhb78aq8TwuSgZ/4ycxlK3QGzsdw32JiD4/o2mJeG+oqMVb+AyjC/0VaSHQHm8l/CjcT7\n\tTrsPRXVWQ3wBRxyLCZ2cPBi3tnVxWjbZMNf5Rpznkp6Js3Bf/uz5v2xHZ+2JUEjA1Tk3zMftNnq\n\tKBc5TsgpCwlHM1oXOzZGqAEorJzeC8RQGPCcFm9pg96W1Evp8naxIrbq3fyDvbFuKt8g0Fmmei6\n\txWOwmzJ7QVmHSJ+q+DEDpga378a3NOC8d5b6/ZcR/yDK7trf2OFhG0EDKD4eJRoSBhNPTOuW9Wg\n\taP8Vt2T0Mupc4FcxERCzodZo8/WTgu6kuARBz6e4NzIOOF5pMXaecytq1JxP7EkOH/K9kHkYzOB\n\tL2Q2uw/0kJWTCqnLKr0XlZcePqh2idfnZXYTtsm1AEieRv5DZJbtyydPUTX4/ucc18Y7bsgSNnN\n\t4gpdWCmeof7qRGLzdt3h62Ljmp9A3HzUSefHvD+fiPE0bwQVnzT+mLRgTsB9fvt44uUKPa7yBcA\n\tZSNt0IIH9hZyoizuxCLucGjdj7nIYPtbtMFv1wWM8LT6fM6rGyvUuMxy4O4kq+h8/SpfEEmMI0y\n\tTSQZfN5ZzLEaKOA==","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":["v4","19/35"]}