libcamera: Add support for planar YUV422 and YUV420 formats

These formats can be helpful when downstream applications or libraries
support them natively (avoiding a costly conversion).

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: David Plowman <david.plowman@raspberrypi.com>
Tested-by: David Plowman <david.plowman@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
David Plowman
2020-06-23 01:39:28 +03:00
committed by Laurent Pinchart
parent 405ba5fd4a
commit c3ed943c99
4 changed files with 24 additions and 1 deletions
+14
View File
@@ -270,6 +270,20 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
.packed = false,
} },
{ formats::YUV420, {
.format = PixelFormat(formats::YUV420),
.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YUV420),
.bitsPerPixel = 12,
.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
.packed = false,
} },
{ formats::YUV422, {
.format = PixelFormat(formats::YUV422),
.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_YUV422P),
.bitsPerPixel = 16,
.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
.packed = false,
} },
/* Greyscale formats. */
{ formats::R8, {
+5
View File
@@ -53,6 +53,11 @@ formats:
- NV42:
fourcc: DRM_FORMAT_NV42
- YUV420:
fourcc: DRM_FORMAT_YUV420
- YUV422:
fourcc: DRM_FORMAT_YUV422
- MJPEG:
fourcc: DRM_FORMAT_MJPEG
+2
View File
@@ -63,6 +63,8 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{
{ V4L2PixelFormat(V4L2_PIX_FMT_NV61), formats::NV61 },
{ V4L2PixelFormat(V4L2_PIX_FMT_NV12), formats::NV12 },
{ V4L2PixelFormat(V4L2_PIX_FMT_NV21), formats::NV21 },
{ V4L2PixelFormat(V4L2_PIX_FMT_YUV420), formats::YUV420 },
{ V4L2PixelFormat(V4L2_PIX_FMT_YUV422P), formats::YUV422 },
/* Greyscale formats. */
{ V4L2PixelFormat(V4L2_PIX_FMT_GREY), formats::R8 },