Patch Detail
Show a patch.
GET /api/patches/22788/?format=api
{ "id": 22788, "url": "https://patchwork.libcamera.org/api/patches/22788/?format=api", "web_url": "https://patchwork.libcamera.org/patch/22788/", "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": "<20250217100203.297894-3-stefan.klug@ideasonboard.com>", "date": "2025-02-17T10:01:43", "name": "[02/10] libcamera: vector: Add cast function", "commit_ref": null, "pull_url": null, "state": "superseded", "archived": false, "hash": "39bd7ca7c946332da8b914776ba5a79e3a783763", "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/22788/mbox/", "series": [ { "id": 5005, "url": "https://patchwork.libcamera.org/api/series/5005/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=5005", "date": "2025-02-17T10:01:41", "name": "Some rkisp1 awb improvements", "version": 1, "mbox": "https://patchwork.libcamera.org/series/5005/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/22788/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/22788/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 EEEE6C327D\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 17 Feb 2025 10:02:19 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 7D3736866D;\n\tMon, 17 Feb 2025 11:02:19 +0100 (CET)", "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 9A84668665\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 17 Feb 2025 11:02:13 +0100 (CET)", "from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:b47f:e20a:c4c7:ece1])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 3DD24E29;\n\tMon, 17 Feb 2025 11:00:52 +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=\"P0SYrnt/\"; dkim-atps=neutral", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1739786452;\n\tbh=918sfwA7Mb+3uVAMU/CSzykUjmZSib/6jaJgceZLH1c=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=P0SYrnt/sAQ+eoMPsIDcf5VFZFKJPJdfieToHktL+peZ72ZM7mdUc+IG7J4rw90Tc\n\tUwXOQUDVTt7m2IbuKfCkNmdImua00ja4jrMwx/1oxvPDfYcqcXRWXaHl9LqeBNEjK6\n\tZor6f7m0heF77ifL0ANUEStW9pSgetPhQKMtxfk4=", "From": "Stefan Klug <stefan.klug@ideasonboard.com>", "To": "libcamera-devel@lists.libcamera.org", "Cc": "Stefan Klug <stefan.klug@ideasonboard.com>", "Subject": "[PATCH 02/10] libcamera: vector: Add cast function", "Date": "Mon, 17 Feb 2025 11:01:43 +0100", "Message-ID": "<20250217100203.297894-3-stefan.klug@ideasonboard.com>", "X-Mailer": "git-send-email 2.43.0", "In-Reply-To": "<20250217100203.297894-1-stefan.klug@ideasonboard.com>", "References": "<20250217100203.297894-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": "The libcamera code base uses matrices and vectors of type float and\ndouble. Add a cast function to easily convert between different\nunderlying types.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/libcamera/internal/vector.h | 9 +++++++++\n src/libcamera/vector.cpp | 10 ++++++++++\n 2 files changed, 19 insertions(+)", "diff": "diff --git a/include/libcamera/internal/vector.h b/include/libcamera/internal/vector.h\nindex a67a09474204..c8f9a8c412f2 100644\n--- a/include/libcamera/internal/vector.h\n+++ b/include/libcamera/internal/vector.h\n@@ -243,6 +243,15 @@ public:\n \t\treturn std::accumulate(data_.begin(), data_.end(), R{});\n \t}\n \n+\ttemplate<typename T2>\n+\tVector<T2, Rows> cast() 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 private:\n \ttemplate<class BinaryOp>\n \tstatic constexpr Vector apply(const Vector &lhs, const Vector &rhs, BinaryOp op)\ndiff --git a/src/libcamera/vector.cpp b/src/libcamera/vector.cpp\nindex 85ca2208245a..57dcef8bf3d8 100644\n--- a/src/libcamera/vector.cpp\n+++ b/src/libcamera/vector.cpp\n@@ -202,6 +202,16 @@ LOG_DEFINE_CATEGORY(Vector)\n * \\return The element-wise maximum of this vector and \\a scalar\n */\n \n+/**\n+ * \\fn template<typename T2> Vector<T2, Rows> Vector::cast() const\n+ * \\brief Cast the vector to a different type\n+ *\n+ * This function returns a new vector with the same size and values but a\n+ * different type.\n+ *\n+ * \\return The new vector\n+ */\n+\n /**\n * \\fn Vector::dot(const Vector<T, Rows> &other) const\n * \\brief Compute the dot product\n", "prefixes": [ "02/10" ] }