Patch Detail
Show a patch.
GET /api/1.1/patches/27216/?format=api
{ "id": 27216, "url": "https://patchwork.libcamera.org/api/1.1/patches/27216/?format=api", "web_url": "https://patchwork.libcamera.org/patch/27216/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/1.1/projects/1/?format=api", "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-16-968757b038bb@ideasonboard.com>", "date": "2026-07-06T08:01:36", "name": "[v3,16/35] ipa: libipa: lsc_polynomial: Move LscPolynomial from RkISP1", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "89d78e06ce8e4071863158ce8aeae71e596f9903", "submitter": { "id": 143, "url": "https://patchwork.libcamera.org/api/1.1/people/143/?format=api", "name": "Jacopo Mondi", "email": "jacopo.mondi@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/27216/mbox/", "series": [ { "id": 6038, "url": "https://patchwork.libcamera.org/api/1.1/series/6038/?format=api", "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/27216/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/27216/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 8F812C3308\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 6 Jul 2026 08:02:22 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 3617466030;\n\tMon, 6 Jul 2026 10:02: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 2B1C76601F\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 6 Jul 2026 10:02:08 +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 D4DD63F8B;\n\tMon, 6 Jul 2026 10:01:19 +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=\"AEt4VwSL\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783324880;\n\tbh=G6B9NHf9Mbk6aw4/wLFkZw2N4cVuZsUD7Jc9FKcDTqo=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=AEt4VwSLCIhpU+1NzvWlMcw+da6XnJ+uEJ7hRNcueELJKUMaY/7q8BiHVwCwnbq7b\n\tQD0PM/yx8TLqOkmu0LHvITXAMP6j8e+egoBaKhQV+E7uqR8gZYZojRP7VbP7a461LO\n\t7we/zKtga+ea+ZHLjrPmV/l3XYzZS1LamXSbzmeE=", "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>", "Date": "Mon, 06 Jul 2026 10:01:36 +0200", "Subject": "[PATCH v3 16/35] ipa: libipa: lsc_polynomial: Move LscPolynomial\n\tfrom RkISP1", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=\"utf-8\"", "Content-Transfer-Encoding": "7bit", "Message-Id": "<20260706-libipa-algorithms-v3-16-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=14417;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=G6B9NHf9Mbk6aw4/wLFkZw2N4cVuZsUD7Jc9FKcDTqo=;\n\tb=owEBbQKS/ZANAwAKAXI0Bo8WoVY8AcsmYgBqS2DxROsbwisYvoi0ZwCPFeDWnJQJrq9Nq8sHk\n\t/N5Xqr2X9SJAjMEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaktg8QAKCRByNAaPFqFW\n\tPJaAD/9ODXTU+5orMSCr1R0LnNTUVUqmUCifTP9PNGmPDu6EpZuv3iHicR8F7apFxm5p96zjHi+\n\tPJdq+lEQXK3MOLeLhupaPcrLwsZ1Ech7MgOYUQ/qzwglNoMdffiL0pVPuAxHGS3E2nmVVPDKKar\n\txJl7+m2TOLSaYsVS7r8UQEd9jwkd6nBNZLBvtEq9hS4MSLfZ7TnRWGUXoTTNZkOedFGJhN8lVme\n\tQNfwZHrdUctfMdu3rpU5Nzz8wwgGN2aHtHxyfoT92JUyrPWmYfT7pFKNI/HVbDAOMw0Jt+Vx8iM\n\tOKspJjDG5tTzWKZYrE9FdUxBeTC8+Zv7icTavfHNvNpAIyWvLvxmLwELz333sJtOWpBaV0QMAE9\n\t9QU7G8WPzHjeFQBesbGOAqTtkst//May3YnVXdly4S7ufvAJUT5HBTFKKwpitPILQzl37jTrZoV\n\tH457lOvFfahfY+RCDqGcUab+3p8C7mP6mBDYqjSJGdMZDRVORmLF/oGCWv0N1QNUarnjLMgaaIL\n\t+RxcJy1yjdyAEdP05SCBh84LF/KmwxXTHfUPJNj/xMXZeSIa993xOYrNUuq1Tuh2j8WcEcmSAL6\n\txUHkqO7GnbRK0rXOpf0Wcstal397CAtQ09R8sdvGCimhifpzkbDh4zlELKJKUwZ7WWW8sFJtB+n\n\t+tw4hZvLwqigtXw==", "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": "Move the LscPolynomial class to libipa from RkISP1.\n\nRename the class from LscPolynomialImpl to a simpler LscPolynomial.\nThe class is copied verbatim, only documntation has been added.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/libipa/lsc_polynomial.cpp | 179 +++++++++++++++++++++++++++++++++++++-\n src/ipa/libipa/lsc_polynomial.h | 46 ++++++++--\n src/ipa/rkisp1/algorithms/lsc.cpp | 162 +---------------------------------\n src/ipa/rkisp1/algorithms/lsc.h | 1 -\n 4 files changed, 218 insertions(+), 170 deletions(-)", "diff": "diff --git a/src/ipa/libipa/lsc_polynomial.cpp b/src/ipa/libipa/lsc_polynomial.cpp\nindex a845d8b1783b..5c4ffc98797e 100644\n--- a/src/ipa/libipa/lsc_polynomial.cpp\n+++ b/src/ipa/libipa/lsc_polynomial.cpp\n@@ -2,11 +2,14 @@\n /*\n * Copyright (C) 2024, Ideas On Board\n *\n- * Polynomial class to represent lens shading correction\n+ * Polynomial based lens shading correction\n */\n \n #include \"lsc_polynomial.h\"\n \n+#include <assert.h>\n+#include <cmath>\n+\n #include <libcamera/base/log.h>\n \n /**\n@@ -109,6 +112,180 @@ void Polynomial::setReferenceImageSize(const Size &size)\n \n } /* namespace lsc */\n \n+/**\n+ * \\class LscPolynomial\n+ * \\brief Radial Polynomial lsc algorithm implementation\n+ *\n+ * Polynomial-based lsc algorithm implementation. The LscPolynomial class\n+ * implements lsc support using Polynomial to represent the shading artifacts\n+ * map.\n+ *\n+ * \\sa LscImplementation\n+ */\n+\n+/**\n+ * \\fn LscPolynomial::LscPolynomial\n+ * \\param[in] sensorSize The physical sensor size\n+ *\n+ * Construct an LscPolynomial\n+ */\n+\n+/**\n+ * \\brief Parse polynomial lsc data\n+ * \\param[in] sets The tuning file content\n+ *\n+ * Parse the lsc data in polyomial form from the \\a sets tuning data.\n+ *\n+ * \\return 0 on success or a negative error number otherwise\n+ */\n+int LscPolynomial::parseLscData(const ValueNode &sets)\n+{\n+\tfor (const auto &set : sets.asList()) {\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+\t\t\tLOG(LscPolynomial, Error)\n+\t\t\t\t<< \"Multiple sets found for \"\n+\t\t\t\t<< \"color temperature \" << ct;\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\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(LscPolynomial, Error)\n+\t\t\t\t<< \"Failed to parse polynomial for \"\n+\t\t\t\t<< \"colour temperature \" << ct;\n+\t\t\treturn -EINVAL;\n+\t\t}\n+\n+\t\tpr->setReferenceImageSize(sensorSize_);\n+\t\tpgr->setReferenceImageSize(sensorSize_);\n+\t\tpgb->setReferenceImageSize(sensorSize_);\n+\t\tpb->setReferenceImageSize(sensorSize_);\n+\n+\t\tlscData_.emplace(std::piecewise_construct,\n+\t\t\t\t std::forward_as_tuple(ct),\n+\t\t\t\t std::forward_as_tuple(PolynomialComponents{ *pr, *pgr, *pgb, *pb }));\n+\t}\n+\n+\tif (lscData_.empty()) {\n+\t\tLOG(LscPolynomial, Error) << \"Failed to load any sets\";\n+\t\treturn -EINVAL;\n+\t}\n+\n+\treturn 0;\n+}\n+\n+/**\n+ * \\brief Re-sample the lsc components for \\a cropRectangle\n+ * \\param[in] cropRectangle The sensor analogue crop rectangle\n+ * \\param[in] xSizes List of horizontal positions of the lsc grid nodes\n+ * \\param[in] ySizes List of vertical positions of the lsc grid nodes\n+ *\n+ * Lsc tables have to be re-sampled every time a new sensor configuration is\n+ * used, as each streaming session might use a different sensor crop rectangle.\n+ *\n+ * Polynomial Lsc tables can be re-sampled for a given sensor frame resolution\n+ * using a list of horizontal and vertical nodes that define the lsc grid on\n+ * which the polynomial is re-sampled on.\n+ *\n+ * \\a cropRectangle represents the size of the frame on which the Lsc tables\n+ * have to be re-sampled on.\n+ *\n+ * \\a xSizes and \\a ySizes represent the position of the grid nodes vertexes in\n+ * the [0, 1] interval. In example an equally spaced grid of 16 nodes will have\n+ * each segment of size 0.0625 and the list of nodes position will be\n+ * [0, 0.0625, 0.125, 0.1875, ... , 1]. It is expected that the first position\n+ * is 0 and the last position is 1.\n+ */\n+lsc::ComponentsMap\n+LscPolynomial::sampleForCrop(const Rectangle &cropRectangle,\n+\t\t\t Span<const double> xSizes,\n+\t\t\t Span<const double> ySizes)\n+{\n+\tstd::vector<double> xPos = sizesListToPositions(xSizes);\n+\tstd::vector<double> yPos = sizesListToPositions(ySizes);\n+\n+\tlsc::ComponentsMap components;\n+\n+\tfor (const auto &[k, p] : lscData_) {\n+\t\tcomponents[k] = {\n+\t\t\tsamplePolynomial(p.pr, xPos, yPos, cropRectangle),\n+\t\t\tsamplePolynomial(p.pgr, xPos, yPos, cropRectangle),\n+\t\t\tsamplePolynomial(p.pgb, xPos, yPos, cropRectangle),\n+\t\t\tsamplePolynomial(p.pb, xPos, yPos, cropRectangle)\n+\t\t};\n+\t}\n+\n+\treturn components;\n+}\n+\n+std::vector<uint16_t>\n+LscPolynomial::samplePolynomial(const lsc::Polynomial &poly,\n+\t\t\t\tSpan<const double> xPositions,\n+\t\t\t\tSpan<const double> yPositions,\n+\t\t\t\tconst Rectangle &cropRectangle)\n+{\n+\tdouble m = poly.getM();\n+\tdouble x0 = cropRectangle.x / m;\n+\tdouble y0 = cropRectangle.y / m;\n+\tdouble w = cropRectangle.width / m;\n+\tdouble h = cropRectangle.height / m;\n+\tstd::vector<uint16_t> samples;\n+\n+\tsamples.reserve(xPositions.size() * yPositions.size());\n+\n+\tfor (double y : yPositions) {\n+\t\tfor (double x : xPositions) {\n+\t\t\tdouble xp = x0 + x * w;\n+\t\t\tdouble yp = y0 + y * h;\n+\t\t\t/*\n+\t\t\t * The hardware uses 2.10 fixed point format and limits\n+\t\t\t * the legal values to [1..3.999]. Scale and clamp the\n+\t\t\t * sampled value accordingly.\n+\t\t\t */\n+\t\t\tint v = static_cast<int>(\n+\t\t\t\tpoly.sampleAtNormalizedPixelPos(xp, yp) *\n+\t\t\t\t1024);\n+\t\t\tv = std::clamp(v, 1024, 4095);\n+\t\t\tsamples.push_back(v);\n+\t\t}\n+\t}\n+\treturn samples;\n+}\n+\n+/*\n+ * The rkisp1 LSC grid spacing is defined by the cell sizes on the top-left\n+ * quadrant of the grid. This is then mirrored in hardware to the other\n+ * quadrants. See parseSizes() for further details. For easier handling, this\n+ * function converts the cell sizes of half the grid to a list of position of\n+ * the whole grid (on one axis). Example:\n+ *\n+ * input: | 0.2 | 0.3 |\n+ * output: 0.0 0.2 0.5 0.8 1.0\n+ */\n+std::vector<double>\n+LscPolynomial::sizesListToPositions(Span<const double> sizes)\n+{\n+\tconst int half = sizes.size();\n+\tstd::vector<double> positions(half * 2 + 1);\n+\tdouble x = 0.0;\n+\n+\tpositions[half] = 0.5;\n+\tfor (int i = 1; i <= half; i++) {\n+\t\tx += sizes[half - i];\n+\t\tpositions[half - i] = 0.5 - x;\n+\t\tpositions[half + i] = 0.5 + x;\n+\t}\n+\n+\treturn positions;\n+}\n+\n } /* namespace ipa */\n \n #ifndef __DOXYGEN__\ndiff --git a/src/ipa/libipa/lsc_polynomial.h b/src/ipa/libipa/lsc_polynomial.h\nindex 2caf46d2d759..17c2c34499f0 100644\n--- a/src/ipa/libipa/lsc_polynomial.h\n+++ b/src/ipa/libipa/lsc_polynomial.h\n@@ -2,25 +2,23 @@\n /*\n * Copyright (C) 2024, Ideas On Board\n *\n- * Helper for radial polynomial used in lens shading correction.\n+ * Polynomial based lens shading correction\n */\n #pragma once\n \n-#include <algorithm>\n #include <array>\n-#include <assert.h>\n-#include <cmath>\n+#include <map>\n+#include <vector>\n \n-#include <libcamera/base/log.h>\n #include <libcamera/base/span.h>\n \n #include <libcamera/geometry.h>\n \n #include \"libcamera/internal/value_node.h\"\n \n-namespace libcamera {\n+#include \"lsc_base.h\"\n \n-LOG_DECLARE_CATEGORY(LscPolynomial)\n+namespace libcamera {\n \n namespace ipa {\n \n@@ -52,6 +50,40 @@ private:\n \n } /* namespace lsc */\n \n+class LscPolynomial : public LscImplementation\n+{\n+private:\n+\tstruct PolynomialComponents {\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+public:\n+\tLscPolynomial(const Size &sensorSize)\n+\t\t: sensorSize_(sensorSize)\n+\t{\n+\t}\n+\n+\tint parseLscData(const ValueNode &sets) override;\n+\n+\tlsc::ComponentsMap\n+\tsampleForCrop(const Rectangle &cropRectangle,\n+\t\t Span<const double> xSizes,\n+\t\t Span<const double> ySizes) override;\n+\n+private:\n+\tstd::vector<double> sizesListToPositions(Span<const double> sizes);\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+\tPolynomialComponentsMap lscData_;\n+\tSize sensorSize_;\n+};\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 910b2ced292e..a4ea879aaa83 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.cpp\n+++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n@@ -33,166 +33,6 @@ namespace {\n \n constexpr int kColourTemperatureQuantization = 10;\n \n-class LscPolynomialImpl : public LscImplementation\n-{\n-private:\n-\tstruct PolynomialComponents {\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-public:\n-\tLscPolynomialImpl(const Size &sensorSize)\n-\t\t: sensorSize_(sensorSize)\n-\t{\n-\t}\n-\n-\tint parseLscData(const ValueNode &sets) override;\n-\n-\tlsc::ComponentsMap\n-\tsampleForCrop(const Rectangle &cropRectangle,\n-\t\t Span<const double> xSizes,\n-\t\t Span<const double> ySizes) override;\n-\n-private:\n-\tstd::vector<double> sizesListToPositions(Span<const double> sizes);\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-\tPolynomialComponentsMap lscData_;\n-\tSize sensorSize_;\n-};\n-\n-int LscPolynomialImpl::parseLscData(const ValueNode &sets)\n-{\n-\tfor (const auto &set : sets.asList()) {\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-\t\t\tLOG(RkISP1Lsc, Error)\n-\t\t\t\t<< \"Multiple sets found for \"\n-\t\t\t\t<< \"color temperature \" << ct;\n-\t\t\treturn -EINVAL;\n-\t\t}\n-\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-\t\t\t\t<< \"Failed to parse polynomial for \"\n-\t\t\t\t<< \"colour temperature \" << ct;\n-\t\t\treturn -EINVAL;\n-\t\t}\n-\n-\t\tpr->setReferenceImageSize(sensorSize_);\n-\t\tpgr->setReferenceImageSize(sensorSize_);\n-\t\tpgb->setReferenceImageSize(sensorSize_);\n-\t\tpb->setReferenceImageSize(sensorSize_);\n-\n-\t\tlscData_.emplace(std::piecewise_construct,\n-\t\t\t\t std::forward_as_tuple(ct),\n-\t\t\t\t std::forward_as_tuple(PolynomialComponents{ *pr, *pgr, *pgb, *pb }));\n-\t}\n-\n-\tif (lscData_.empty()) {\n-\t\tLOG(RkISP1Lsc, Error) << \"Failed to load any sets\";\n-\t\treturn -EINVAL;\n-\t}\n-\n-\treturn 0;\n-}\n-\n-lsc::ComponentsMap\n-LscPolynomialImpl::sampleForCrop(const Rectangle &cropRectangle,\n-\t\t\t\t Span<const double> xSizes,\n-\t\t\t\t Span<const double> ySizes)\n-{\n-\tstd::vector<double> xPos = sizesListToPositions(xSizes);\n-\tstd::vector<double> yPos = sizesListToPositions(ySizes);\n-\n-\tlsc::ComponentsMap components;\n-\n-\tfor (const auto &[k, p] : lscData_) {\n-\t\tcomponents[k] = {\n-\t\t\tsamplePolynomial(p.pr, xPos, yPos, cropRectangle),\n-\t\t\tsamplePolynomial(p.pgr, xPos, yPos, cropRectangle),\n-\t\t\tsamplePolynomial(p.pgb, xPos, yPos, cropRectangle),\n-\t\t\tsamplePolynomial(p.pb, xPos, yPos, cropRectangle)\n-\t\t};\n-\t}\n-\n-\treturn components;\n-}\n-\n-std::vector<uint16_t>\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-{\n-\tdouble m = poly.getM();\n-\tdouble x0 = cropRectangle.x / m;\n-\tdouble y0 = cropRectangle.y / m;\n-\tdouble w = cropRectangle.width / m;\n-\tdouble h = cropRectangle.height / m;\n-\tstd::vector<uint16_t> samples;\n-\n-\tsamples.reserve(xPositions.size() * yPositions.size());\n-\n-\tfor (double y : yPositions) {\n-\t\tfor (double x : xPositions) {\n-\t\t\tdouble xp = x0 + x * w;\n-\t\t\tdouble yp = y0 + y * h;\n-\t\t\t/*\n-\t\t\t * The hardware uses 2.10 fixed point format and limits\n-\t\t\t * the legal values to [1..3.999]. Scale and clamp the\n-\t\t\t * sampled value accordingly.\n-\t\t\t */\n-\t\t\tint v = static_cast<int>(\n-\t\t\t\tpoly.sampleAtNormalizedPixelPos(xp, yp) *\n-\t\t\t\t1024);\n-\t\t\tv = std::clamp(v, 1024, 4095);\n-\t\t\tsamples.push_back(v);\n-\t\t}\n-\t}\n-\treturn samples;\n-}\n-\n-/*\n- * The rkisp1 LSC grid spacing is defined by the cell sizes on the top-left\n- * quadrant of the grid. This is then mirrored in hardware to the other\n- * quadrants. See parseSizes() for further details. For easier handling, this\n- * function converts the cell sizes of half the grid to a list of position of\n- * the whole grid (on one axis). Example:\n- *\n- * input: | 0.2 | 0.3 |\n- * output: 0.0 0.2 0.5 0.8 1.0\n- */\n-std::vector<double>\n-LscPolynomialImpl::sizesListToPositions(Span<const double> sizes)\n-{\n-\tconst int half = sizes.size();\n-\tstd::vector<double> positions(half * 2 + 1);\n-\tdouble x = 0.0;\n-\n-\tpositions[half] = 0.5;\n-\tfor (int i = 1; i <= half; i++) {\n-\t\tx += sizes[half - i];\n-\t\tpositions[half - i] = 0.5 - x;\n-\t\tpositions[half + i] = 0.5 + x;\n-\t}\n-\n-\treturn positions;\n-}\n-\n class LscTableImpl : public LscImplementation\n {\n public:\n@@ -358,7 +198,7 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n \t\t * \\todo: Most likely the reference frame should be native_size.\n \t\t * Let's wait how the internal discussions progress.\n \t\t */\n-\t\talgo_ = std::make_unique<LscPolynomialImpl>(context.sensorInfo.activeAreaSize);\n+\t\talgo_ = std::make_unique<LscPolynomial>(context.sensorInfo.activeAreaSize);\n \t\tret = algo_->parseLscData(sets);\n \t} else {\n \t\tLOG(RkISP1Lsc, Error) << \"Unsupported LSC data type '\"\ndiff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\nindex b21c91c0d81f..2a428293cb2e 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.h\n+++ b/src/ipa/rkisp1/algorithms/lsc.h\n@@ -7,7 +7,6 @@\n \n #pragma once\n \n-#include <map>\n #include <memory>\n \n #include \"libipa/interpolator.h\"\n", "prefixes": [ "v3", "16/35" ] }