diff options
author | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-09-01 23:22:40 +0300 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2021-09-07 19:17:54 +0300 |
commit | 94cbaa381aa8b1b3f34ad8bf14989456ba79a9af (patch) | |
tree | 9a8a02a636d969481cf085dc39c0d8b9dd22fe07 /src/libcamera/v4l2_videodevice.cpp | |
parent | e85978ef5f813866178e809529db0602d00acde8 (diff) |
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 <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Diffstat (limited to 'src/libcamera/v4l2_videodevice.cpp')
-rw-r--r-- | src/libcamera/v4l2_videodevice.cpp | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/libcamera/v4l2_videodevice.cpp b/src/libcamera/v4l2_videodevice.cpp index 84ccb974..1c4e6fbf 100644 --- a/src/libcamera/v4l2_videodevice.cpp +++ b/src/libcamera/v4l2_videodevice.cpp @@ -1337,11 +1337,7 @@ std::unique_ptr<FrameBuffer> V4L2VideoDevice::createBuffer(unsigned int index) planes[i].offset = offset; /* \todo Take the V4L2 stride into account */ - const unsigned int vertSubSample = - info.planes[i].verticalSubSampling; - planes[i].length = - info.stride(format_.size.width, i, 1u) * - ((format_.size.height + vertSubSample - 1) / vertSubSample); + planes[i].length = info.planeSize(format_.size, i); offset += planes[i].length; } } |