[libcamera-devel] [PATCH v2 1/6] libcamera: formats: Add NV24 and NV42, and reorder NV formats

Paul Elder paul.elder at ideasonboard.com
Tue Jun 30 16:58:03 CEST 2020


Add formats for NV24 and NV42. While at it, reorder the NV formats so
that NV12 and NV21 come first, followed by NV16, NV61, NV24, and NV42.

Signed-off-by: Paul Elder <paul.elder at ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
---
No change in v2

 src/libcamera/formats.cpp | 36 ++++++++++++++++++++++++++----------
 1 file changed, 26 insertions(+), 10 deletions(-)

diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index 436672e..d3b722c 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -256,6 +256,22 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 	} },
 
 	/* YUV planar formats. */
+	{ formats::NV12, {
+		.name = "NV12",
+		.format = formats::NV12,
+		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV12),
+		.bitsPerPixel = 12,
+		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
+		.packed = false,
+	} },
+	{ formats::NV21, {
+		.name = "NV21",
+		.format = formats::NV21,
+		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV21),
+		.bitsPerPixel = 12,
+		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
+		.packed = false,
+	} },
 	{ formats::NV16, {
 		.name = "NV16",
 		.format = formats::NV16,
@@ -272,19 +288,19 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
 		.packed = false,
 	} },
-	{ formats::NV12, {
-		.name = "NV12",
-		.format = formats::NV12,
-		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV12),
-		.bitsPerPixel = 12,
+	{ formats::NV24, {
+		.name = "NV24",
+		.format = formats::NV24,
+		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV24),
+		.bitsPerPixel = 24,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
 		.packed = false,
 	} },
-	{ formats::NV21, {
-		.name = "NV21",
-		.format = formats::NV21,
-		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV21),
-		.bitsPerPixel = 12,
+	{ formats::NV42, {
+		.name = "NV42",
+		.format = formats::NV42,
+		.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_NV42),
+		.bitsPerPixel = 24,
 		.colourEncoding = PixelFormatInfo::ColourEncodingYUV,
 		.packed = false,
 	} },
-- 
2.27.0



More information about the libcamera-devel mailing list