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>
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user