Patch Detail
Show a patch.
GET /api/patches/23174/?format=api
{ "id": 23174, "url": "https://patchwork.libcamera.org/api/patches/23174/?format=api", "web_url": "https://patchwork.libcamera.org/patch/23174/", "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": "<20250411130423.2164577-8-stefan.klug@ideasonboard.com>", "date": "2025-04-11T13:04:14", "name": "[7/8] libcamera: vector: Add explicit cast and data accessor", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "95587f90f403d46741bc5b8d604ce4500e81d3be", "submitter": { "id": 184, "url": "https://patchwork.libcamera.org/api/people/184/?format=api", "name": "Stefan Klug", "email": "stefan.klug@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/23174/mbox/", "series": [ { "id": 5122, "url": "https://patchwork.libcamera.org/api/series/5122/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5122", "date": "2025-04-11T13:04:07", "name": "Implement WDR algorithm", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5122/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/23174/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/23174/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 74799C3213\n\tfor <parsemail@patchwork.libcamera.org>;\n\tFri, 11 Apr 2025 13:04:48 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 27B3868AB7;\n\tFri, 11 Apr 2025 15:04:48 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 07A6D68AB7\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tFri, 11 Apr 2025 15:04:47 +0200 (CEST)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:5b21:2ad5:1023:7179])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id A3FFF735;\n\tFri, 11 Apr 2025 15:02:47 +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=\"q6CmMme1\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1744376567;\n\tbh=QRn+OoNJ58tmeeS9trxG0Oy1XFt/JcK3eLm7mqaQQn0=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=q6CmMme1ltj1It/O3HWqQPRcBP5YB14wPKKIW+AlA3C7COri/p5bShhN8ZimJdvlv\n\t/uOgirQoBYv1kePIwNim3Q04/kPjRigJlCXMrTiHqxdKZpxaCXeh+8eInT1JimkE/1\n\thpg9L31ODKTD/MPIZbsRdWN4t+kivi6LQ0sEvNZA=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>", "Subject": "[PATCH 7/8] libcamera: vector: Add explicit cast and data accessor", "Date": "Fri, 11 Apr 2025 15:04:14 +0200", "Message-ID": "<20250411130423.2164577-8-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250411130423.2164577-1-stefan.klug@ideasonboard.com>", "References": "<20250411130423.2164577-1-stefan.klug@ideasonboard.com>", "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": "When dealing with Vectors it is useful to be able to cast the to a\ndifferent underlying type or to access the underlying data.\n\nAdd functions for that.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/libcamera/internal/vector.h | 11 +++++++++++\n src/libcamera/vector.cpp | 18 ++++++++++++++++++\n 2 files changed, 29 insertions(+)", "diff": "diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h\nindex 16b6aef0b38f..63da55019aef 100644\n--- a/include/libcamera/internal/vector.h\n+++ b/include/libcamera/internal/vector.h\n@@ -63,6 +63,17 @@ public:\n \t\treturn data_[i];\n \t}\n \n+\ttemplate<typename T2>\n+\texplicit operator Vector<T2, Rows>() const\n+\t{\n+\t\tVector<T2, Rows> ret;\n+\t\tfor (unsigned int i = 0; i < Rows; i++)\n+\t\t\tret[i] = static_cast<T2>(data_[i]);\n+\t\treturn ret;\n+\t}\n+\n+\tconstexpr Span<const T, Rows> data() const { return data_; }\n+\n \tconstexpr Vector<T, Rows> operator-() const\n \t{\n \t\tVector<T, Rows> ret;\ndiff --git a/src/libcamera/vector.cpp b/src/libcamera/vector.cpp\nindex 4dad1b9001c5..bb89f0de7c4f 100644\n--- a/src/libcamera/vector.cpp\n+++ b/src/libcamera/vector.cpp\n@@ -64,6 +64,24 @@ LOG_DEFINE_CATEGORY(Vector)\n * \\copydoc Vector::operator[](size_t i) const\n */\n \n+/**\n+ * \\fn Vector::data()\n+ * \\brief Access the vector data\n+ *\n+ * Access the contents of the vector as linear array of values.\n+ *\n+ * \\return A span referencing the vector data as a linear array\n+ */\n+\n+/**\n+ * \\fn Vector::operator Vector<T2, Rows>()\n+ * \\brief Cast to a different underlying type\n+ *\n+ * Cast the vector to a different underlying type using static_cast().\n+ *\n+ * \\return A vector of type T2\n+ */\n+\n /**\n * \\fn Vector::operator-() const\n * \\brief Negate a Vector by negating both all of its coordinates\n", "prefixes": [ "7/8" ] }