Show a patch.

GET /api/patches/27223/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 27223,
    "url": "https://patchwork.libcamera.org/api/patches/27223/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/27223/",
    "project": {
        "id": 1,
        "url": "https://patchwork.libcamera.org/api/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-23-968757b038bb@ideasonboard.com>",
    "date": "2026-07-06T08:01:43",
    "name": "[v3,23/35] ipa: libipa: lsc: Move sizesListToPositions() back to rkisp1",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "cbcc57f2c115878d9309fe73a5a70fe98d2b5480",
    "submitter": {
        "id": 143,
        "url": "https://patchwork.libcamera.org/api/people/143/?format=api",
        "name": "Jacopo Mondi",
        "email": "jacopo.mondi@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/27223/mbox/",
    "series": [
        {
            "id": 6038,
            "url": "https://patchwork.libcamera.org/api/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/27223/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/27223/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 54070C330A\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon,  6 Jul 2026 08:02:31 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id C6AA566063;\n\tMon,  6 Jul 2026 10:02:30 +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 7F6D56602D\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon,  6 Jul 2026 10:02:12 +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 EA2D73FC2;\n\tMon,  6 Jul 2026 10:01:23 +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=\"ovdmCUrc\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1783324884;\n\tbh=gU7UoVQjDoxjMvS0BE4xv1ojYvnjxU9I7ZQIqWCiBUY=;\n\th=From:Date:Subject:References:In-Reply-To:To:Cc:From;\n\tb=ovdmCUrcccbkaaf2ZfMEPE7mbK3Ah4smWggu44dJHo5coa/tQJKQsuAoEgfS+I+Dw\n\tIJn+VB9TfJr/IB+MKRpqAnNrtpd3nkRZJXyfv62acujnKkKKjP+CMSa752MKhZWeSF\n\t6XA5tX3tky7i1m3MrtMFBRZSVJzJ51Crj5KKBmuQ=",
        "From": "Jacopo Mondi <jacopo.mondi@ideasonboard.com>",
        "Date": "Mon, 06 Jul 2026 10:01:43 +0200",
        "Subject": "[PATCH v3 23/35] ipa: libipa: lsc: Move sizesListToPositions()\n\tback to rkisp1",
        "MIME-Version": "1.0",
        "Content-Type": "text/plain; charset=\"utf-8\"",
        "Content-Transfer-Encoding": "7bit",
        "Message-Id": "<20260706-libipa-algorithms-v3-23-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=9808;\n\ti=jacopo.mondi@ideasonboard.com; h=from:subject:message-id;\n\tbh=gU7UoVQjDoxjMvS0BE4xv1ojYvnjxU9I7ZQIqWCiBUY=;\n\tb=owEBbAKT/ZANAwAKAXI0Bo8WoVY8AcsmYgBqS2Dx6AsDYWVTbQexLPVjWZDH5248IuMXw2nrC\n\tq6sgtermP2JAjIEAAEKAB0WIQS1xD1IgJogio9YOMByNAaPFqFWPAUCaktg8QAKCRByNAaPFqFW\n\tPGmLD/imCuPIfH6JVeojG7QO2zVjLe532Fyxpceb5UKj5QfEAs3VQ3KEpGA6UWER2nnmioLHfZw\n\trWgc6NiVo1cDAI1Ur2EEN+Pe8DonTrbvCDpQQzzrpgtmpUphw+06Y+IbmPOAnvLhJSjRTRslmKG\n\tDPsifetT7EdZH1bgWVvuJy7BlZGWe8dWd2859mSgGSB+M4+UQU1ceF4wZ9jxKkHBwmPhC9qtS7H\n\t5PsyvXYGIyYr+aDcOaFppTlb1Ol4RRrZW86bAFjkWDCNNZ9iREoipzjkc0eWP4ImEwbu0T534TV\n\txF+HnywwGyQ12kb9UkUKWp2OSj00qRuAYvQkj306PQYiuiBS2Nhi5aZxlXStwNU0FFXvUtszqad\n\tjCD7TXjpdqc+xG+oxBrOQP4+AymQrDPAUDgzdjUHHGFELn8b4i7DtavEg3crnQViLZmepXTGTxK\n\txZoFvQ79ewRfdPcbyfh8SD4aZ711rLFrn2h0yVNp728NkDu4IZGw9+ZGaa9CF58vUpKCLktWlEu\n\tGuN1Wm+IKJ73+cXCYDcwwWwt2BK6+04wCFzjmWGEWPH1n8xoCh22/fr+ZVgHq11Hdt4K4Dgs3LK\n\t5gIV5qyWST0KpCZhTeDeXLluQ1v9kEGUcKKaYpiBc9q5p+vOB3GmI1GdsSAm/nbDGPb7BCRmOwg\n\tVFyVXs+PUqrLV",
        "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": "The LscPolynomial::sampleForCrop() function is designed to receive a\nlist of segment sizes and translates it to a list of grid vertexes\ninternally with the sizesListToPositions() function.\n\nAs the sizesListToPositions() implementation is RkISP1-specific, move it\nback to the RkISP1 IPA and change the prototype of the sampleForCrop()\nfunction to accept a vector of grid vertexes instead of a span of\nsegment sizes.\n\nSigned-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>\n---\n src/ipa/libipa/lsc_base.cpp       |  6 +++---\n src/ipa/libipa/lsc_base.h         |  3 +--\n src/ipa/libipa/lsc_polynomial.cpp | 38 ++++----------------------------------\n src/ipa/libipa/lsc_polynomial.h   |  4 +---\n src/ipa/libipa/lsc_table.h        |  4 ++--\n src/ipa/rkisp1/algorithms/lsc.cpp | 32 +++++++++++++++++++++++++++++++-\n src/ipa/rkisp1/algorithms/lsc.h   |  3 +++\n 7 files changed, 45 insertions(+), 45 deletions(-)",
    "diff": "diff --git a/src/ipa/libipa/lsc_base.cpp b/src/ipa/libipa/lsc_base.cpp\nindex b055249c066a..7b0216b689c4 100644\n--- a/src/ipa/libipa/lsc_base.cpp\n+++ b/src/ipa/libipa/lsc_base.cpp\n@@ -88,8 +88,8 @@ void Interpolator<lsc::Components>::\n  * \\fn LscImplementation::sampleForCrop\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+ * \\param[in] xPos List of horizontal positions of the lsc grid nodes\n+ * \\param[in] yPos 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@@ -98,7 +98,7 @@ void Interpolator<lsc::Components>::\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+ * \\a xPos and \\a yPos 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\ndiff --git a/src/ipa/libipa/lsc_base.h b/src/ipa/libipa/lsc_base.h\nindex 51cc35888209..8d1843a5d4fd 100644\n--- a/src/ipa/libipa/lsc_base.h\n+++ b/src/ipa/libipa/lsc_base.h\n@@ -65,8 +65,7 @@ public:\n \n \tvirtual lsc::ComponentsMap\n \tsampleForCrop(const Rectangle &cropRectangle,\n-\t\t      Span<const double> xSizes,\n-\t\t      Span<const double> ySizes) = 0;\n+\t\t      std::vector<double> xPos, std::vector<double> yPos);\n };\n \n } /* namespace ipa */\ndiff --git a/src/ipa/libipa/lsc_polynomial.cpp b/src/ipa/libipa/lsc_polynomial.cpp\nindex 5c4ffc98797e..f39122963019 100644\n--- a/src/ipa/libipa/lsc_polynomial.cpp\n+++ b/src/ipa/libipa/lsc_polynomial.cpp\n@@ -184,8 +184,8 @@ int LscPolynomial::parseLscData(const ValueNode &sets)\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+ * \\param[in] xPos List of horizontal positions of the lsc grid nodes\n+ * \\param[in] yPos 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@@ -197,7 +197,7 @@ int LscPolynomial::parseLscData(const ValueNode &sets)\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+ * \\a xPos and \\a yPos 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@@ -205,11 +205,8 @@ int LscPolynomial::parseLscData(const ValueNode &sets)\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+\t\t\t     std::vector<double> xPos, std::vector<double> yPos)\n {\n-\tstd::vector<double> xPos = sizesListToPositions(xSizes);\n-\tstd::vector<double> yPos = sizesListToPositions(ySizes);\n \n \tlsc::ComponentsMap components;\n \n@@ -259,33 +256,6 @@ LscPolynomial::samplePolynomial(const lsc::Polynomial &poly,\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 17c2c34499f0..d2276ecc6f6b 100644\n--- a/src/ipa/libipa/lsc_polynomial.h\n+++ b/src/ipa/libipa/lsc_polynomial.h\n@@ -71,11 +71,9 @@ public:\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+\t\t      std::vector<double> xPos, std::vector<double> yPos) 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,\ndiff --git a/src/ipa/libipa/lsc_table.h b/src/ipa/libipa/lsc_table.h\nindex 0983b78c3f6b..67c7464ea5b6 100644\n--- a/src/ipa/libipa/lsc_table.h\n+++ b/src/ipa/libipa/lsc_table.h\n@@ -30,8 +30,8 @@ public:\n \n \tlsc::ComponentsMap\n \tsampleForCrop([[maybe_unused]] const Rectangle &cropRectangle,\n-\t\t      [[maybe_unused]] Span<const double> xSizes,\n-\t\t      [[maybe_unused]] Span<const double> ySizes) override\n+\t\t      [[maybe_unused]] std::vector<double> xPos,\n+\t\t      [[maybe_unused]] std::vector<double> yPos) override\n \t{\n \t\tLOG(LscTable, Warning)\n \t\t\t<< \"Tabular LSC data doesn't support resampling\";\ndiff --git a/src/ipa/rkisp1/algorithms/lsc.cpp b/src/ipa/rkisp1/algorithms/lsc.cpp\nindex 0312ce2f8bb1..f393f101b740 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.cpp\n+++ b/src/ipa/rkisp1/algorithms/lsc.cpp\n@@ -70,6 +70,9 @@ int LensShadingCorrection::init([[maybe_unused]] IPAContext &context,\n \tif (xSize_.empty() || ySize_.empty())\n \t\treturn -EINVAL;\n \n+\txPos_ = sizesListToPositions(xSize_);\n+\tyPos_ = sizesListToPositions(ySize_);\n+\n \t/* Get all defined sets to apply. */\n \tconst ValueNode &sets = tuningData[\"sets\"];\n \tif (!sets.isList()) {\n@@ -138,6 +141,33 @@ std::vector<double> LensShadingCorrection::parseSizes(const ValueNode &tuningDat\n \treturn sizes;\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+LensShadingCorrection::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 /**\n  * \\copydoc libcamera::ipa::Algorithm::configure\n  */\n@@ -171,7 +201,7 @@ int LensShadingCorrection::configure(IPAContext &context,\n \n \tLOG(RkISP1Lsc, Debug) << \"Sample LSC data for \" << configInfo.analogCrop;\n \tlsc::ComponentsMap shadingData = algo_->sampleForCrop(configInfo.analogCrop,\n-\t\t\t\t\t\t\t      xSize_, ySize_);\n+\t\t\t\t\t\t\t      xPos_, yPos_);\n \tsets_.setData(std::move(shadingData));\n \n \tcontext.activeState.lsc.enabled = true;\ndiff --git a/src/ipa/rkisp1/algorithms/lsc.h b/src/ipa/rkisp1/algorithms/lsc.h\nindex ee037353bbe4..06aa7a5f133c 100644\n--- a/src/ipa/rkisp1/algorithms/lsc.h\n+++ b/src/ipa/rkisp1/algorithms/lsc.h\n@@ -41,9 +41,12 @@ private:\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+\tstd::vector<double> sizesListToPositions(Span<const double> sizes);\n \n \tstd::vector<double> xSize_;\n \tstd::vector<double> ySize_;\n+\tstd::vector<double> xPos_;\n+\tstd::vector<double> yPos_;\n \tuint16_t xGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n \tuint16_t yGrad_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n \tuint16_t xSizes_[RKISP1_CIF_ISP_LSC_SECTORS_TBL_SIZE];\n",
    "prefixes": [
        "v3",
        "23/35"
    ]
}