From 94cbaa381aa8b1b3f34ad8bf14989456ba79a9af Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Wed, 1 Sep 2021 23:22:40 +0300 Subject: libcamera: formats: Add planeSize() helpers to PixelFormatInfo Add two helpers functions to the PixelFormatInfo class to compute the byte size of a given plane, taking the frame size, the stride, the alignment constraints and the vertical subsampling into account. Use the new functions through the code base to replace manual implementations. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham Reviewed-by: Hirokazu Honda --- include/libcamera/internal/formats.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/libcamera') diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h index a07de6bc..b2869c93 100644 --- a/include/libcamera/internal/formats.h +++ b/include/libcamera/internal/formats.h @@ -41,6 +41,10 @@ public: unsigned int stride(unsigned int width, unsigned int plane, unsigned int align = 1) const; + unsigned int planeSize(const Size &size, unsigned int plane, + unsigned int align = 1) const; + unsigned int planeSize(unsigned int height, unsigned int plane, + unsigned int stride) const; unsigned int frameSize(const Size &size, unsigned int align = 1) const; unsigned int frameSize(const Size &size, const std::array &strides) const; -- cgit v1.2.1