{"id":27321,"url":"https://patchwork.libcamera.org/api/1.1/patches/27321/?format=json","web_url":"https://patchwork.libcamera.org/patch/27321/","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-13-0759d0359f52@ideasonboard.com>","date":"2026-07-08T15:50:55","name":"[v5,13/36] ipa: libipa: lsc_polynomial: Rename LscPolynomial","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"40cc57212224c36455e76f5095be54fef41cb8c9","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/27321/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/27321/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/27321/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 08BA3C3318\n\tfor <parsemail@patchwork.libcamera.org>;\n\tWed,  8 Jul 2026 15:51:37 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 812E3660BE;\n\tWed,  8 Jul 2026 17:51:37 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 31C17660BB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tWed,  8 Jul 2026 17:51:16 +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 5C8CB28CB;\n\tWed,  8 Jul 2026 17:50:26 +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=\"KQHTQgkq\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783525826;\n\tbh=7uJ7nJvYLEGDo9t0CiFQTeXU/IuOD74DEL7USRhD4Kw=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=KQHTQgkqS9NEmRRWpeJCPV9Hfzx0tYNlb5tHOJTPe28wJsMv8xE7pW1/tA+DClEOT\n\tOVMMMYsVI9WBdRv99pZ5L4f+AV//n9UObcRTRCoP2fiOIt+anWHKGX000iY7LTnotw\n\tmTnhLkGwOrnzokTZAxngDAolTcX6CMwZexQxzLfg=","From":"Jacopo Mondi <jacopo.mondi@ideasonboard.com>","Date":"Wed, 08 Jul 2026 17:50:55 +0200","Subject":"[PATCH v5 13/36] ipa: libipa: lsc_polynomial: Rename LscPolynomial","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","Message-Id":"<20260708-libipa-algorithms-v5-13-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=6248;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=7uJ7nJvYLEGDo9t0CiFQTeXU/IuOD74DEL7USRhD4Kw=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqTnHkePoWB9EgY6pVDiaL8VGbvtso88nLYEey1\n\tcsIp7Cf0SiJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCak5x5AAKCRByNAaPFqFW\n\tPEl6D/9Nuezq+5UJ5OwpRYp+s1fnOUc3vQK5xiI7UXh9ijur4RvxGaANCBjjTEqtWgjUK5POGsm\n\tRCugB6HbCW0dX51eMOShHXR3Z6nKJvn5kam/BSVR9WATTNgto6LbG+AYZBj0AqnuarmV8Pf1rTX\n\tMHRmu8iSOSCKN7MSw/ItDHwOpFREotMdwt0BumnUAylZOOnBQuE2wx0yFD6G2d4nbDPqhdRYiIT\n\t5SyQl1+mnU78TIjAbXnDHXWymizTpXeTL9fUoIYIxYuOmXkSOiVAvr0laJ9g7CPkJ5doyUCRpd5\n\tYDWb+V1jkPdqdNKJY+qP0NWA4iD7nGahs4j2YlGFhyb0RSHxh0FcKqdg5mzAc9IhoLRSjZXo3ai\n\td75qVhSd/de6sFzOImNc2uZpGQrBu+9w/aVIBG3nMvkQ43nr87tWIVmQGoT6y7d1nkqlKDhUW7d\n\tJjUYv8eLtDfhoeLVMnrKgj1UxllQwf+lZqtX662tDwuOSmNqHgZPMN0nDNdGkDkGzNtAftFzRto\n\tYtjv3Fesspv9oMngWa7Y7HQXOpUyigz5xlr8q2BijjVfVzWX3tIGx82M1xIUdyzD69jhaPPK6s5\n\tkuptV6HmiICjqn9eYJfrNlbLxg4cleGqefTO8+z9pCF6N5lV+EoGOMuFhZlGOrWguHtDHQhyW8l\n\tImYieOh1dkt5GYg==","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":"In order to prepare to introduce the LscPolynomial class move the\nexisting implementation of the polynomial representation LscPolynomial\nto lsc::Polynomial.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\nReviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>\n---\n src/ipa/libipa/lsc_polynomial.cpp | 20 ++++++++++++--------\n src/ipa/libipa/lsc_polynomial.h   | 12 ++++++++----\n src/ipa/rkisp1/algorithms/lsc.cpp | 22 +++++++++++-----------\n 3 files changed, 31 insertions(+), 23 deletions(-)","diff":"diff --git a/src/ipa/libipa/lsc_polynomial.cpp b/src/ipa/libipa/lsc_polynomial.cpp\nindex 921af0b0bd13..b93063bf8bc7 100644\n--- a/src/ipa/libipa/lsc_polynomial.cpp\n+++ b/src/ipa/libipa/lsc_polynomial.cpp\n@@ -20,8 +20,10 @@ LOG_DEFINE_CATEGORY(LscPolynomial)\n \n namespace ipa {\n \n+namespace lsc {\n+\n /**\n- * \\class LscPolynomial\n+ * \\class Polynomial\n  * \\brief Class for handling even polynomials used in lens shading correction\n  *\n  * Shading artifacts of camera lenses can be modeled using even radial\n@@ -31,7 +33,7 @@ namespace ipa {\n  */\n \n /**\n- * \\fn LscPolynomial::LscPolynomial(double cx = 0.0, double cy = 0.0, double k0 = 0.0,\n+ * \\fn Polynomial::Polynomial(double cx = 0.0, double cy = 0.0, double k0 = 0.0,\n \t\t      double k1 = 0.0, double k2 = 0.0, double k3 = 0.0,\n \t\t      double k4 = 0.0)\n  * \\brief Construct a polynomial using the given coefficients\n@@ -45,7 +47,7 @@ namespace ipa {\n  */\n \n /**\n- * \\fn LscPolynomial::sampleAtNormalizedPixelPos(double x, double y)\n+ * \\fn Polynomial::sampleAtNormalizedPixelPos(double x, double y)\n  * \\brief Sample the polynomial at the given normalized pixel position\n  *\n  * This functions samples the polynomial at the given pixel position divided by\n@@ -57,7 +59,7 @@ namespace ipa {\n  */\n \n /**\n- * \\fn LscPolynomial::getM()\n+ * \\fn Polynomial::getM()\n  * \\brief Get the value m as described in the dng specification\n  *\n  * Returns m according to dng spec. m represents the Euclidean distance\n@@ -68,7 +70,7 @@ namespace ipa {\n  */\n \n /**\n- * \\fn LscPolynomial::setReferenceImageSize(const Size &size)\n+ * \\fn Polynomial::setReferenceImageSize(const Size &size)\n  * \\brief Set the reference image size\n  *\n  * Set the reference image size that is used for subsequent calls to getM() and\n@@ -77,12 +79,14 @@ namespace ipa {\n  * \\param size The size of the reference image\n  */\n \n+} /* namespace lsc */\n+\n } /* namespace ipa */\n \n #ifndef __DOXYGEN__\n template<>\n-std::optional<ipa::LscPolynomial>\n-ValueNode::Accessor<ipa::LscPolynomial>::get(const ValueNode &obj) const\n+std::optional<ipa::lsc::Polynomial>\n+ValueNode::Accessor<ipa::lsc::Polynomial>::get(const ValueNode &obj) const\n {\n \tstd::optional<double> cx = obj[\"cx\"].get<double>();\n \tstd::optional<double> cy = obj[\"cy\"].get<double>();\n@@ -98,7 +102,7 @@ ValueNode::Accessor<ipa::LscPolynomial>::get(const ValueNode &obj) const\n \t\treturn std::nullopt;\n \t}\n \n-\treturn ipa::LscPolynomial(*cx, *cy, *k0, *k1, *k2, *k3, *k4);\n+\treturn ipa::lsc::Polynomial(*cx, *cy, *k0, *k1, *k2, *k3, *k4);\n }\n #endif /* __DOXYGEN__ */\n \ndiff --git a/src/ipa/libipa/lsc_polynomial.h b/src/ipa/libipa/lsc_polynomial.h\nindex d52ec86946b1..3be33edfe7d8 100644\n--- a/src/ipa/libipa/lsc_polynomial.h\n+++ b/src/ipa/libipa/lsc_polynomial.h\n@@ -24,12 +24,14 @@ LOG_DECLARE_CATEGORY(LscPolynomial)\n \n namespace ipa {\n \n-class LscPolynomial\n+namespace lsc {\n+\n+class Polynomial\n {\n public:\n-\tLscPolynomial(double cx = 0.0, double cy = 0.0, double k0 = 0.0,\n-\t\t      double k1 = 0.0, double k2 = 0.0, double k3 = 0.0,\n-\t\t      double k4 = 0.0)\n+\tPolynomial(double cx = 0.0, double cy = 0.0, double k0 = 0.0,\n+\t\t   double k1 = 0.0, double k2 = 0.0, double k3 = 0.0,\n+\t\t   double k4 = 0.0)\n \t\t: cx_(cx), cy_(cy), cnx_(0), cny_(0),\n \t\t  coefficients_({ k0, k1, k2, k3, k4 })\n \t{\n@@ -78,6 +80,8 @@ private:\n \tSize imageSize_;\n };\n \n+} /* namespace lsc */\n+\n } /* namespace ipa */\n \n } /* namespace libcamera */\ndiff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\nindex af919f7429af..84d2b1d3bdac 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.cpp\n+++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n@@ -65,10 +65,10 @@ class LscPolynomialImpl : public LscImplementation\n {\n private:\n \tstruct PolynomialComponents {\n-\t\tLscPolynomial pr;\n-\t\tLscPolynomial pgr;\n-\t\tLscPolynomial pgb;\n-\t\tLscPolynomial pb;\n+\t\tlsc::Polynomial pr;\n+\t\tlsc::Polynomial pgr;\n+\t\tlsc::Polynomial pgb;\n+\t\tlsc::Polynomial pb;\n \t};\n \tusing PolynomialComponentsMap = std::map<unsigned int, PolynomialComponents>;\n \n@@ -87,7 +87,7 @@ public:\n \n private:\n \tstd::vector<double> sizesListToPositions(Span<const double> sizes);\n-\tstd::vector<uint16_t> samplePolynomial(const LscPolynomial &poly,\n+\tstd::vector<uint16_t> samplePolynomial(const lsc::Polynomial &poly,\n \t\t\t\t\t       Span<const double> xPositions,\n \t\t\t\t\t       Span<const double> yPositions,\n \t\t\t\t\t       const Rectangle &cropRectangle);\n@@ -98,7 +98,7 @@ private:\n int LscPolynomialImpl::parseLscData(const ValueNode &sets)\n {\n \tfor (const auto &set : sets.asList()) {\n-\t\tstd::optional<LscPolynomial> pr, pgr, pgb, pb;\n+\t\tstd::optional<lsc::Polynomial> pr, pgr, pgb, pb;\n \t\tuint32_t ct = set[\"ct\"].get<uint32_t>(0);\n \n \t\tif (lscData_.count(ct)) {\n@@ -108,10 +108,10 @@ int LscPolynomialImpl::parseLscData(const ValueNode &sets)\n \t\t\treturn -EINVAL;\n \t\t}\n \n-\t\tpr = set[\"r\"].get<LscPolynomial>();\n-\t\tpgr = set[\"gr\"].get<LscPolynomial>();\n-\t\tpgb = set[\"gb\"].get<LscPolynomial>();\n-\t\tpb = set[\"b\"].get<LscPolynomial>();\n+\t\tpr = set[\"r\"].get<lsc::Polynomial>();\n+\t\tpgr = set[\"gr\"].get<lsc::Polynomial>();\n+\t\tpgb = set[\"gb\"].get<lsc::Polynomial>();\n+\t\tpb = set[\"b\"].get<lsc::Polynomial>();\n \n \t\tif (!(pr || pgr || pgb || pb)) {\n \t\t\tLOG(RkISP1Lsc, Error)\n@@ -161,7 +161,7 @@ LscPolynomialImpl::sampleForCrop(const Rectangle &cropRectangle,\n }\n \n std::vector<uint16_t>\n-LscPolynomialImpl::samplePolynomial(const LscPolynomial &poly,\n+LscPolynomialImpl::samplePolynomial(const lsc::Polynomial &poly,\n \t\t\t\t    Span<const double> xPositions,\n \t\t\t\t    Span<const double> yPositions,\n \t\t\t\t    const Rectangle &cropRectangle)\n","prefixes":["v5","13/36"]}