Show a patch.

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

{
    "id": 22653,
    "url": "https://patchwork.libcamera.org/api/patches/22653/?format=api",
    "web_url": "https://patchwork.libcamera.org/patch/22653/",
    "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": "<20250127064745.5740-1-laurent.pinchart@ideasonboard.com>",
    "date": "2025-01-27T06:47:45",
    "name": "libcamera: matrix: Add read-only accessor to internal data",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": false,
    "hash": "8d2fc34c22e3032649a016af104cce6f07532dc6",
    "submitter": {
        "id": 2,
        "url": "https://patchwork.libcamera.org/api/people/2/?format=api",
        "name": "Laurent Pinchart",
        "email": "laurent.pinchart@ideasonboard.com"
    },
    "delegate": null,
    "mbox": "https://patchwork.libcamera.org/patch/22653/mbox/",
    "series": [
        {
            "id": 4971,
            "url": "https://patchwork.libcamera.org/api/series/4971/?format=api",
            "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=4971",
            "date": "2025-01-27T06:47:45",
            "name": "libcamera: matrix: Add read-only accessor to internal data",
            "version": 1,
            "mbox": "https://patchwork.libcamera.org/series/4971/mbox/"
        }
    ],
    "comments": "https://patchwork.libcamera.org/api/patches/22653/comments/",
    "check": "pending",
    "checks": "https://patchwork.libcamera.org/api/patches/22653/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 B5194BEFBE\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 27 Jan 2025 06:47:58 +0000 (UTC)",
            "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id AF4E66855D;\n\tMon, 27 Jan 2025 07:47:57 +0100 (CET)",
            "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id BE1B561875\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jan 2025 07:47:56 +0100 (CET)",
            "from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi\n\t[81.175.209.231])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 4FEB7496\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 27 Jan 2025 07:46:50 +0100 (CET)"
        ],
        "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key;\n\tunprotected) header.d=ideasonboard.com header.i=@ideasonboard.com\n\theader.b=\"acZ1SRgl\"; dkim-atps=neutral",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1737960410;\n\tbh=aoKpxmkgUfy9nL0MbrUHz/gerjTa8dtZe6K1Eq7Eb68=;\n\th=From:To:Subject:Date:From;\n\tb=acZ1SRgl69tC/9tzyDC3aO9KeF0tfazz+36VACA+v/xs4JgXA9lrKSn176NRu9g8b\n\tlYwl45wLM04apwgG2JgYEApWS5cyrXeXcVDKaylrhn9985jmd8yzGr5hCb7BOHoYM1\n\t7U4eO35zN6HOhPU4ka8aLqlDf+lT3pw6uqKtfs/I=",
        "From": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>",
        "To": "libcamera-devel@lists.libcamera.org",
        "Subject": "[PATCH] libcamera: matrix: Add read-only accessor to internal data",
        "Date": "Mon, 27 Jan 2025 08:47:45 +0200",
        "Message-ID": "<20250127064745.5740-1-laurent.pinchart@ideasonboard.com>",
        "X-Mailer": "git-send-email 2.45.3",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "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": "Add a data() function to the Matrix class to access the internal data.\nThis is useful for code that needs to use the matrix contents as a\nlinear array, as shows by the RkISP1::Ccm::process() function that needs\nto copy the matrix data to a local variable. Simplify that function by\nusing the new accessor.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n include/libcamera/internal/matrix.h | 2 ++\n src/ipa/rkisp1/algorithms/ccm.cpp   | 7 +------\n src/libcamera/matrix.cpp            | 6 ++++++\n 3 files changed, 9 insertions(+), 6 deletions(-)\n\n\nbase-commit: 8aef7b4dfb12f2f9bf0513625231b85a5b8f5440",
    "diff": "diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h\nindex 7a71028c473a..a055e6926c94 100644\n--- a/include/libcamera/internal/matrix.h\n+++ b/include/libcamera/internal/matrix.h\n@@ -66,6 +66,8 @@ public:\n \t\treturn out.str();\n \t}\n \n+\tSpan<const T, Rows * Cols> data() const { return data_; }\n+\n \tSpan<const T, Cols> operator[](size_t i) const\n \t{\n \t\treturn Span<const T, Cols>{ &data_.data()[i * Cols], Cols };\ndiff --git a/src/ipa/rkisp1/algorithms/ccm.cpp b/src/ipa/rkisp1/algorithms/ccm.cpp\nindex e2b5cf4d313e..eb8ca39e56a8 100644\n--- a/src/ipa/rkisp1/algorithms/ccm.cpp\n+++ b/src/ipa/rkisp1/algorithms/ccm.cpp\n@@ -120,12 +120,7 @@ void Ccm::process([[maybe_unused]] IPAContext &context,\n \t\t  [[maybe_unused]] const rkisp1_stat_buffer *stats,\n \t\t  ControlList &metadata)\n {\n-\tfloat m[9];\n-\tfor (unsigned int i = 0; i < 3; i++) {\n-\t\tfor (unsigned int j = 0; j < 3; j++)\n-\t\t\tm[i * 3 + j] = frameContext.ccm.ccm[i][j];\n-\t}\n-\tmetadata.set(controls::ColourCorrectionMatrix, m);\n+\tmetadata.set(controls::ColourCorrectionMatrix, frameContext.ccm.ccm.data());\n }\n \n REGISTER_IPA_ALGORITHM(Ccm, \"Ccm\")\ndiff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp\nindex 4d95a19bfbb9..d9d34867b0a3 100644\n--- a/src/libcamera/matrix.cpp\n+++ b/src/libcamera/matrix.cpp\n@@ -52,6 +52,12 @@ LOG_DEFINE_CATEGORY(Matrix)\n  * \\return A string describing the matrix\n  */\n \n+/**\n+ * \\fn Matrix::data()\n+ * \\brief Access the internal data as a linear array\n+ * \\return A span referencing the internal data as a linear array\n+ */\n+\n /**\n  * \\fn Span<const T, Cols> Matrix::operator[](size_t i) const\n  * \\brief Index to a row in the matrix\n",
    "prefixes": []
}