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>
This commit is contained in:
Laurent Pinchart 2025-01-27 01:44:38 +02:00
parent 7fdfe648a4
commit 7e5d811842
3 changed files with 14 additions and 6 deletions

View file

@ -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 };