diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2025-01-27 01:44:38 +0200 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2025-02-04 21:27:54 +0200 |
commit | 7e5d8118425304420abd4295844ffe15d858678b (patch) | |
tree | 2e6cf39268a323383615fb0a95af3abff8a75431 /include | |
parent | 7fdfe648a4de022adb9d57e6c29b0dc161fcc444 (diff) |
libcamera: matrix: Add read-only accessor to internal data
Add a data() function to the Matrix class to access the internal data.
This is useful for code that needs to use the matrix contents as a
linear array, as shown by the RkISP1::Ccm::process() function that needs
to copy the matrix data to a local variable. Simplify that function by
using the new accessor.
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Milan Zamazal <mzamazal@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/libcamera/internal/matrix.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/libcamera/internal/matrix.h b/include/libcamera/internal/matrix.h index 7a71028c..a055e692 100644 --- a/include/libcamera/internal/matrix.h +++ b/include/libcamera/internal/matrix.h @@ -66,6 +66,8 @@ public: return out.str(); } + Span<const T, Rows * Cols> data() const { return data_; } + Span<const T, Cols> operator[](size_t i) const { return Span<const T, Cols>{ &data_.data()[i * Cols], Cols }; |