{"id":21958,"url":"https://patchwork.libcamera.org/api/patches/21958/?format=json","web_url":"https://patchwork.libcamera.org/patch/21958/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","name":"libcamera","link_name":"libcamera","list_id":"libcamera_core","list_email":"libcamera-devel@lists.libcamera.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20241118150528.1856797-4-stefan.klug@ideasonboard.com>","date":"2024-11-18T15:05:06","name":"[3/4] libcamera: matrix: Use Span instead of vector for construction","commit_ref":null,"pull_url":null,"state":"superseded","archived":false,"hash":"fcf6ad1073393a094e903a50abc45654f0f5f956","submitter":{"id":184,"url":"https://patchwork.libcamera.org/api/people/184/?format=json","name":"Stefan Klug","email":"stefan.klug@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/21958/mbox/","series":[{"id":4797,"url":"https://patchwork.libcamera.org/api/series/4797/?format=json","web_url":"https://patchwork.libcamera.org/project/libcamera/list/?series=4797","date":"2024-11-18T15:05:03","name":"Move Matrix class from libipa to libcamera","version":1,"mbox":"https://patchwork.libcamera.org/series/4797/mbox/"}],"comments":"https://patchwork.libcamera.org/api/patches/21958/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/21958/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 43185C32DD\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 18 Nov 2024 15:05:54 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id DF5D2658E1;\n\tMon, 18 Nov 2024 16:05:53 +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 98521658ED\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 18 Nov 2024 16:05:50 +0100 (CET)","from ideasonboard.com (unknown\n\t[IPv6:2a00:6020:448c:6c00:4424:4869:bb88:5c61])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B3F2F316;\n\tMon, 18 Nov 2024 16:05:33 +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=\"cp6ql5YZ\"; dkim-atps=neutral","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1731942333;\n\tbh=Pg/3Wxik2kWfhP+jATT+k/lGs0CFqo+AsWeTwNj2o/o=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=cp6ql5YZJgvcbmfTYmyAjyKhakBbvFdDuUNuQxpX8QOuTev3VtU5+64N+nIMULt3r\n\tTv73kwxWIlHJxTAlZm3CMmlTY0LUgXMjF45LF1HNoxbFUqSDK2GuTaOOlzTTbvjx3s\n\tFeqRBkvU0M9HelG02sf6zkPECTQA5NOsFD1yiUHc=","From":"Stefan Klug <stefan.klug@ideasonboard.com>","To":"libcamera-devel@lists.libcamera.org","Cc":"Stefan Klug <stefan.klug@ideasonboard.com>","Subject":"[PATCH 3/4] libcamera: matrix: Use Span instead of vector for\n\tconstruction","Date":"Mon, 18 Nov 2024 16:05:06 +0100","Message-ID":"<20241118150528.1856797-4-stefan.klug@ideasonboard.com>","X-Mailer":"git-send-email 2.43.0","In-Reply-To":"<20241118150528.1856797-1-stefan.klug@ideasonboard.com>","References":"<20241118150528.1856797-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":"Use a Span for construction to be more flexible. Additionally add an\nassert for the correct size of the span.\n\nSigned-off-by: Stefan Klug <stefan.klug@ideasonboard.com>\n---\n include/libcamera/internal/matrix.h |  3 ++-\n src/libcamera/matrix.cpp            | 10 ++++++++++\n 2 files changed, 12 insertions(+), 1 deletion(-)","diff":"diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h\nindex b82d33f98658..28ea68a55af9 100644\n--- a/include/libcamera/internal/matrix.h\n+++ b/include/libcamera/internal/matrix.h\n@@ -39,8 +39,9 @@ public:\n \t\tstd::copy(data.begin(), data.end(), data_.begin());\n \t}\n \n-\tMatrix(const std::vector<T> &data)\n+\tMatrix(const Span<T> &data)\n \t{\n+\t\tASSERT(data.size() == Rows * Cols);\n \t\tstd::copy(data.begin(), data.end(), data_.begin());\n \t}\n \ndiff --git a/src/libcamera/matrix.cpp b/src/libcamera/matrix.cpp\nindex c3ed54895b22..bb9fd3003996 100644\n--- a/src/libcamera/matrix.cpp\n+++ b/src/libcamera/matrix.cpp\n@@ -31,6 +31,16 @@ LOG_DEFINE_CATEGORY(Matrix)\n  * \\brief Construct a zero matrix\n  */\n \n+/**\n+ * \\fn Matrix::Matrix(std::initializer_list<T> data)\n+ * \\brief Construct a matrix from supplied data\n+ * \\param[in] data Data from which to construct a matrix\n+ *\n+ * \\a data is a one-dimensional vector and will be turned into a matrix in\n+ * row-major order. The size of \\a data must be equal to the product of the\n+ * number of rows and columns of the matrix (Rows x Cols).\n+ */\n+\n /**\n  * \\fn Matrix::Matrix(const Span<T> &data)\n  * \\brief Construct a matrix from supplied data\n","prefixes":["3/4"]}