[libcamera-devel,2/5] libcamera: formats: Add YUV444 and YVU444 pixel formats
diff mbox series

Message ID 20220504131558.9498-3-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: Support additional pixel formats and media bus codes
Related show

Commit Message

Laurent Pinchart May 4, 2022, 1:15 p.m. UTC
Extend planar YUV format support with 4:4:4 formats. Those formats are
used by the i.MX8 ISI driver that will be supported by the simple
pipeline handler.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/formats.cpp          | 26 ++++++++++++++++++++++++++
 src/libcamera/formats.yaml         |  4 ++++
 src/libcamera/v4l2_pixelformat.cpp |  4 ++++
 3 files changed, 34 insertions(+)

Comments

Jacopo Mondi May 6, 2022, 12:08 p.m. UTC | #1
Hi Laurent

On Wed, May 04, 2022 at 04:15:55PM +0300, Laurent Pinchart via libcamera-devel wrote:
> Extend planar YUV format support with 4:4:4 formats. Those formats are
> used by the i.MX8 ISI driver that will be supported by the simple
> pipeline handler.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
  j

> ---
>  src/libcamera/formats.cpp          | 26 ++++++++++++++++++++++++++
>  src/libcamera/formats.yaml         |  4 ++++
>  src/libcamera/v4l2_pixelformat.cpp |  4 ++++
>  3 files changed, 34 insertions(+)
>
> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> index c5cca37b02c2..e205df0529ba 100644
> --- a/src/libcamera/formats.cpp
> +++ b/src/libcamera/formats.cpp
> @@ -482,6 +482,32 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
>  		.pixelsPerGroup = 2,
>  		.planes = {{ { 2, 1 }, { 1, 1 }, { 1, 1 } }},
>  	} },
> +	{ formats::YUV444, {
> +		.name = "YUV444",
> +		.format = formats::YUV444,
> +		.v4l2Formats = {
> +			.single = V4L2PixelFormat(),
> +			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YUV444M),
> +		},
> +		.bitsPerPixel = 24,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> +		.packed = false,
> +		.pixelsPerGroup = 1,
> +		.planes = {{ { 1, 1 }, { 1, 1 }, { 1, 1 } }},
> +	} },
> +	{ formats::YVU444, {
> +		.name = "YVU444",
> +		.format = formats::YVU444,
> +		.v4l2Formats = {
> +			.single = V4L2PixelFormat(),
> +			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YVU444M),
> +		},
> +		.bitsPerPixel = 24,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> +		.packed = false,
> +		.pixelsPerGroup = 1,
> +		.planes = {{ { 1, 1 }, { 1, 1 }, { 1, 1 } }},
> +	} },
>
>  	/* Greyscale formats. */
>  	{ formats::R8, {
> diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml
> index 0b527dbefe32..7dda01325f33 100644
> --- a/src/libcamera/formats.yaml
> +++ b/src/libcamera/formats.yaml
> @@ -71,6 +71,10 @@ formats:
>        fourcc: DRM_FORMAT_YUV422
>    - YVU422:
>        fourcc: DRM_FORMAT_YVU422
> +  - YUV444:
> +      fourcc: DRM_FORMAT_YUV444
> +  - YVU444:
> +      fourcc: DRM_FORMAT_YVU444
>
>    - MJPEG:
>        fourcc: DRM_FORMAT_MJPEG
> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
> index 818bd1037e14..8d409943e2d3 100644
> --- a/src/libcamera/v4l2_pixelformat.cpp
> +++ b/src/libcamera/v4l2_pixelformat.cpp
> @@ -115,6 +115,10 @@ const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{
>  		{ formats::YUV422, "Planar YUV 4:2:2 (N-C)" } },
>  	{ V4L2PixelFormat(V4L2_PIX_FMT_YUV422M),
>  		{ formats::YVU422, "Planar YVU 4:2:2 (N-C)" } },
> +	{ V4L2PixelFormat(V4L2_PIX_FMT_YUV444M),
> +		{ formats::YUV444, "Planar YUV 4:4:4 (N-C)" } },
> +	{ V4L2PixelFormat(V4L2_PIX_FMT_YUV444M),
> +		{ formats::YVU444, "Planar YVU 4:4:4 (N-C)" } },
>
>  	/* Greyscale formats. */
>  	{ V4L2PixelFormat(V4L2_PIX_FMT_GREY),
> --
> Regards,
>
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index c5cca37b02c2..e205df0529ba 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -482,6 +482,32 @@  const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.pixelsPerGroup = 2,
 		.planes = {{ { 2, 1 }, { 1, 1 }, { 1, 1 } }},
 	} },
+	{ formats::YUV444, {
+		.name = "YUV444",
+		.format = formats::YUV444,
+		.v4l2Formats = {
+			.single = V4L2PixelFormat(),
+			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YUV444M),
+		},
+		.bitsPerPixel = 24,
+		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
+		.packed = false,
+		.pixelsPerGroup = 1,
+		.planes = {{ { 1, 1 }, { 1, 1 }, { 1, 1 } }},
+	} },
+	{ formats::YVU444, {
+		.name = "YVU444",
+		.format = formats::YVU444,
+		.v4l2Formats = {
+			.single = V4L2PixelFormat(),
+			.multi = V4L2PixelFormat(V4L2_PIX_FMT_YVU444M),
+		},
+		.bitsPerPixel = 24,
+		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
+		.packed = false,
+		.pixelsPerGroup = 1,
+		.planes = {{ { 1, 1 }, { 1, 1 }, { 1, 1 } }},
+	} },
 
 	/* Greyscale formats. */
 	{ formats::R8, {
diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml
index 0b527dbefe32..7dda01325f33 100644
--- a/src/libcamera/formats.yaml
+++ b/src/libcamera/formats.yaml
@@ -71,6 +71,10 @@  formats:
       fourcc: DRM_FORMAT_YUV422
   - YVU422:
       fourcc: DRM_FORMAT_YVU422
+  - YUV444:
+      fourcc: DRM_FORMAT_YUV444
+  - YVU444:
+      fourcc: DRM_FORMAT_YVU444
 
   - MJPEG:
       fourcc: DRM_FORMAT_MJPEG
diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
index 818bd1037e14..8d409943e2d3 100644
--- a/src/libcamera/v4l2_pixelformat.cpp
+++ b/src/libcamera/v4l2_pixelformat.cpp
@@ -115,6 +115,10 @@  const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{
 		{ formats::YUV422, "Planar YUV 4:2:2 (N-C)" } },
 	{ V4L2PixelFormat(V4L2_PIX_FMT_YUV422M),
 		{ formats::YVU422, "Planar YVU 4:2:2 (N-C)" } },
+	{ V4L2PixelFormat(V4L2_PIX_FMT_YUV444M),
+		{ formats::YUV444, "Planar YUV 4:4:4 (N-C)" } },
+	{ V4L2PixelFormat(V4L2_PIX_FMT_YUV444M),
+		{ formats::YVU444, "Planar YVU 4:4:4 (N-C)" } },
 
 	/* Greyscale formats. */
 	{ V4L2PixelFormat(V4L2_PIX_FMT_GREY),