From e83727a194b5cf2e40331989bf8f762da74217fd Mon Sep 17 00:00:00 2001 From: Paul Elder Date: Mon, 29 Jun 2020 22:28:38 +0900 Subject: libcamera: PixelFormatInfo: Add functions stride and frameSize Add member functions to PixelFormatInfo for calculating stride and frame size. This will simplify existing code that calculates these things. Signed-off-by: Paul Elder Reviewed-by: Laurent Pinchart --- include/libcamera/internal/formats.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include/libcamera/internal/formats.h') diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h index 211da4a3..cad41ad8 100644 --- a/include/libcamera/internal/formats.h +++ b/include/libcamera/internal/formats.h @@ -53,6 +53,12 @@ public: static const PixelFormatInfo &info(const PixelFormat &format); static const PixelFormatInfo &info(const V4L2PixelFormat &format); + unsigned int stride(unsigned int width, unsigned int plane, + unsigned int align = 1) const; + unsigned int frameSize(const Size &size, unsigned int align = 1) const; + unsigned int frameSize(const Size &size, + const std::array &strides) const; + /* \todo Add support for non-contiguous memory planes */ const char *name; PixelFormat format; -- cgit v1.2.1