summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-02-05 13:46:33 +0200
committerTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2025-03-26 15:44:00 +0200
commit89635213956d8791b30d40b948d47f2a210bcd0f (patch)
tree0b41740282a21bd27815b74171724db8c83394d1
parentd08ecb56e9779d5190bc6423a1cad596756881ef (diff)
PixelFormats: Pull in formats from pixutils
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
-rw-r--r--kms++/inc/kms++/pixelformats.h112
-rw-r--r--kms++/src/pixelformats.cpp750
2 files changed, 809 insertions, 53 deletions
diff --git a/kms++/inc/kms++/pixelformats.h b/kms++/inc/kms++/pixelformats.h
index 89d8d7e..e866d84 100644
--- a/kms++/inc/kms++/pixelformats.h
+++ b/kms++/inc/kms++/pixelformats.h
@@ -28,61 +28,85 @@ constexpr std::string fourcc_to_str(uint32_t fourcc)
enum class PixelFormat {
Undefined = 0,
-
- NV12,
- NV21,
- NV16,
- NV61,
-
- YUV420,
- YVU420,
- YUV422,
- YVU422,
- YUV444,
- YVU444,
-
- UYVY,
- YUYV,
- YVYU,
- VYUY,
-
- Y210,
- Y212,
- Y216,
-
- XRGB8888,
- XBGR8888,
- RGBX8888,
- BGRX8888,
-
- ARGB8888,
- ABGR8888,
- RGBA8888,
- BGRA8888,
-
- RGB888,
- BGR888,
-
+ R8,
RGB332,
-
RGB565,
BGR565,
-
- XRGB4444,
XRGB1555,
-
- ARGB4444,
+ RGBX4444,
+ XRGB4444,
ARGB1555,
-
- XRGB2101010,
+ RGBA4444,
+ ARGB4444,
+ RGB888,
+ BGR888,
+ XRGB8888,
+ XBGR8888,
+ RGBX8888,
+ BGRX8888,
XBGR2101010,
+ XRGB2101010,
RGBX1010102,
BGRX1010102,
-
- ARGB2101010,
+ ARGB8888,
+ ABGR8888,
+ RGBA8888,
+ BGRA8888,
ABGR2101010,
+ ARGB2101010,
RGBA1010102,
BGRA1010102,
+ YUYV,
+ UYVY,
+ YVYU,
+ VYUY,
+ VUY888,
+ XVUY8888,
+ Y210,
+ Y212,
+ Y216,
+ NV12,
+ NV21,
+ NV16,
+ NV61,
+ XV15,
+ XV20,
+ XVUY2101010,
+ YUV420,
+ YVU420,
+ YUV422,
+ YVU422,
+ YUV444,
+ YVU444,
+ X403,
+ Y8,
+ Y10,
+ Y10P,
+ Y12,
+ Y12P,
+ Y10_P32,
+ SBGGR8,
+ SGBRG8,
+ SGRBG8,
+ SRGGB8,
+ SBGGR10,
+ SGBRG10,
+ SGRBG10,
+ SRGGB10,
+ SBGGR10P,
+ SGBRG10P,
+ SGRBG10P,
+ SRGGB10P,
+ SBGGR12,
+ SGBRG12,
+ SGRBG12,
+ SRGGB12,
+ SBGGR12P,
+ SGBRG12P,
+ SGRBG12P,
+ SRGGB12P,
+ SRGGB16,
+ MJPEG,
};
PixelFormat fourcc_to_pixel_format(uint32_t fourcc);
diff --git a/kms++/src/pixelformats.cpp b/kms++/src/pixelformats.cpp
index cdd742c..559aa38 100644
--- a/kms++/src/pixelformats.cpp
+++ b/kms++/src/pixelformats.cpp
@@ -10,6 +10,30 @@ namespace kms
{
static map<PixelFormat, PixelFormatInfo> format_info_array = {
{
+ PixelFormat::R8, {
+ PixelFormatInfo {
+ "R8",
+ "R8 ",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 1, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::RGB332, {
+ PixelFormatInfo {
+ "RGB332",
+ "RGB8",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 1, 1, 1, 1 } },
+ }
+ }
+ },
+ {
PixelFormat::RGB565, {
PixelFormatInfo {
"RGB565",
@@ -22,6 +46,18 @@ static map<PixelFormat, PixelFormatInfo> format_info_array = {
}
},
{
+ PixelFormat::BGR565, {
+ PixelFormatInfo {
+ "BGR565",
+ "BG16",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 2, 1, 1, 1 } },
+ }
+ }
+ },
+ {
PixelFormat::XRGB1555, {
PixelFormatInfo {
"XRGB1555",
@@ -34,6 +70,18 @@ static map<PixelFormat, PixelFormatInfo> format_info_array = {
}
},
{
+ PixelFormat::RGBX4444, {
+ PixelFormatInfo {
+ "RGBX4444",
+ "RX12",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 2, 1, 1, 1 } },
+ }
+ }
+ },
+ {
PixelFormat::XRGB4444, {
PixelFormatInfo {
"XRGB4444",
@@ -58,6 +106,18 @@ static map<PixelFormat, PixelFormatInfo> format_info_array = {
}
},
{
+ PixelFormat::RGBA4444, {
+ PixelFormatInfo {
+ "RGBA4444",
+ "RA12",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 2, 1, 1, 1 } },
+ }
+ }
+ },
+ {
PixelFormat::ARGB4444, {
PixelFormatInfo {
"ARGB4444",
@@ -130,6 +190,18 @@ static map<PixelFormat, PixelFormatInfo> format_info_array = {
}
},
{
+ PixelFormat::BGRX8888, {
+ PixelFormatInfo {
+ "BGRX8888",
+ "BX24",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
PixelFormat::XBGR2101010, {
PixelFormatInfo {
"XBGR2101010",
@@ -142,6 +214,42 @@ static map<PixelFormat, PixelFormatInfo> format_info_array = {
}
},
{
+ PixelFormat::XRGB2101010, {
+ PixelFormatInfo {
+ "XRGB2101010",
+ "XR30",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::RGBX1010102, {
+ PixelFormatInfo {
+ "RGBX1010102",
+ "RX30",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::BGRX1010102, {
+ PixelFormatInfo {
+ "BGRX1010102",
+ "BX30",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
PixelFormat::ARGB8888, {
PixelFormatInfo {
"ARGB8888",
@@ -178,6 +286,174 @@ static map<PixelFormat, PixelFormatInfo> format_info_array = {
}
},
{
+ PixelFormat::BGRA8888, {
+ PixelFormatInfo {
+ "BGRA8888",
+ "BA24",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::ABGR2101010, {
+ PixelFormatInfo {
+ "ABGR2101010",
+ "AB30",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::ARGB2101010, {
+ PixelFormatInfo {
+ "ARGB2101010",
+ "AR30",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::RGBA1010102, {
+ PixelFormatInfo {
+ "RGBA1010102",
+ "RA30",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::BGRA1010102, {
+ PixelFormatInfo {
+ "BGRA1010102",
+ "BA30",
+ "",
+ PixelColorType::RGB,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::YUYV, {
+ PixelFormatInfo {
+ "YUYV",
+ "YUYV",
+ "YUYV",
+ PixelColorType::YUV,
+ { 2, 1 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::UYVY, {
+ PixelFormatInfo {
+ "UYVY",
+ "UYVY",
+ "UYVY",
+ PixelColorType::YUV,
+ { 2, 1 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::YVYU, {
+ PixelFormatInfo {
+ "YVYU",
+ "YVYU",
+ "YVYU",
+ PixelColorType::YUV,
+ { 2, 1 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::VYUY, {
+ PixelFormatInfo {
+ "VYUY",
+ "VYUY",
+ "VYUY",
+ PixelColorType::YUV,
+ { 2, 1 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::VUY888, {
+ PixelFormatInfo {
+ "VUY888",
+ "VU24",
+ "YUV3",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 3, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::XVUY8888, {
+ PixelFormatInfo {
+ "XVUY8888",
+ "XVUY",
+ "YUVX",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::Y210, {
+ PixelFormatInfo {
+ "Y210",
+ "Y210",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 8, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::Y212, {
+ PixelFormatInfo {
+ "Y212",
+ "Y212",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 8, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::Y216, {
+ PixelFormatInfo {
+ "Y216",
+ "Y216",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 8, 2, 1, 1 } },
+ }
+ }
+ },
+ {
PixelFormat::NV12, {
PixelFormatInfo {
"NV12",
@@ -190,6 +466,18 @@ static map<PixelFormat, PixelFormatInfo> format_info_array = {
}
},
{
+ PixelFormat::NV21, {
+ PixelFormatInfo {
+ "NV21",
+ "NV21",
+ "NM21",
+ PixelColorType::YUV,
+ { 2, 2 },
+ { { 1, 1, 1, 1 }, { 2, 1, 2, 2 } },
+ }
+ }
+ },
+ {
PixelFormat::NV16, {
PixelFormatInfo {
"NV16",
@@ -202,29 +490,473 @@ static map<PixelFormat, PixelFormatInfo> format_info_array = {
}
},
{
- PixelFormat::YUYV, {
+ PixelFormat::NV61, {
PixelFormatInfo {
- "YUYV",
- "YUYV",
- "YUYV",
+ "NV61",
+ "NV61",
+ "NM61",
PixelColorType::YUV,
{ 2, 1 },
- { { 4, 2, 1, 1 } },
+ { { 1, 1, 1, 1 }, { 2, 1, 2, 1 } },
}
}
},
{
- PixelFormat::UYVY, {
+ PixelFormat::XV15, {
PixelFormatInfo {
- "UYVY",
- "UYVY",
- "UYVY",
+ "XV15",
+ "XV15",
+ "",
+ PixelColorType::YUV,
+ { 6, 2 },
+ { { 4, 3, 1, 1 }, { 8, 3, 2, 2 } },
+ }
+ }
+ },
+ {
+ PixelFormat::XV20, {
+ PixelFormatInfo {
+ "XV20",
+ "XV20",
+ "",
+ PixelColorType::YUV,
+ { 6, 2 },
+ { { 4, 3, 1, 1 }, { 8, 3, 2, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::XVUY2101010, {
+ PixelFormatInfo {
+ "XVUY2101010",
+ "XY30",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::YUV420, {
+ PixelFormatInfo {
+ "YUV420",
+ "YU12",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 1, 1, 1, 1 }, { 1, 1, 2, 2 }, { 1, 1, 2, 2 } },
+ }
+ }
+ },
+ {
+ PixelFormat::YVU420, {
+ PixelFormatInfo {
+ "YVU420",
+ "YV12",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 1, 1, 1, 1 }, { 1, 1, 2, 2 }, { 1, 1, 2, 2 } },
+ }
+ }
+ },
+ {
+ PixelFormat::YUV422, {
+ PixelFormatInfo {
+ "YUV422",
+ "YU16",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 1, 1, 1, 1 }, { 1, 1, 2, 1 }, { 1, 1, 2, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::YVU422, {
+ PixelFormatInfo {
+ "YVU422",
+ "YV16",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 1, 1, 1, 1 }, { 1, 1, 2, 1 }, { 1, 1, 2, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::YUV444, {
+ PixelFormatInfo {
+ "YUV444",
+ "YU24",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::YVU444, {
+ PixelFormatInfo {
+ "YVU444",
+ "YV24",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 1, 1, 1, 1 }, { 1, 1, 1, 1 }, { 1, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::X403, {
+ PixelFormatInfo {
+ "X403",
+ "X403",
+ "",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 4, 1, 1, 1 }, { 4, 1, 1, 1 }, { 4, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::Y8, {
+ PixelFormatInfo {
+ "Y8",
+ "GREY",
+ "GREY",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 1, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::Y10, {
+ PixelFormatInfo {
+ "Y10",
+ "",
+ "Y10 ",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 2, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::Y10P, {
+ PixelFormatInfo {
+ "Y10P",
+ "",
+ "Y10P",
+ PixelColorType::YUV,
+ { 4, 1 },
+ { { 5, 4, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::Y12, {
+ PixelFormatInfo {
+ "Y12",
+ "",
+ "Y12 ",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 2, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::Y12P, {
+ PixelFormatInfo {
+ "Y12P",
+ "",
+ "Y12P",
PixelColorType::YUV,
{ 2, 1 },
+ { { 3, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::Y10_P32, {
+ PixelFormatInfo {
+ "Y10_P32",
+ "YPA4",
+ "",
+ PixelColorType::YUV,
+ { 3, 1 },
+ { { 4, 3, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SBGGR8, {
+ PixelFormatInfo {
+ "SBGGR8",
+ "",
+ "BA81",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 1, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SGBRG8, {
+ PixelFormatInfo {
+ "SGBRG8",
+ "",
+ "GBRG",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 1, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SGRBG8, {
+ PixelFormatInfo {
+ "SGRBG8",
+ "",
+ "GRBG",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 1, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SRGGB8, {
+ PixelFormatInfo {
+ "SRGGB8",
+ "",
+ "RGGB",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 1, 1, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SBGGR10, {
+ PixelFormatInfo {
+ "SBGGR10",
+ "",
+ "BG10",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SGBRG10, {
+ PixelFormatInfo {
+ "SGBRG10",
+ "",
+ "GB10",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SGRBG10, {
+ PixelFormatInfo {
+ "SGRBG10",
+ "",
+ "BA10",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SRGGB10, {
+ PixelFormatInfo {
+ "SRGGB10",
+ "",
+ "RG10",
+ PixelColorType::RAW,
+ { 2, 2 },
{ { 4, 2, 1, 1 } },
}
}
},
+ {
+ PixelFormat::SBGGR10P, {
+ PixelFormatInfo {
+ "SBGGR10P",
+ "",
+ "pBAA",
+ PixelColorType::RAW,
+ { 4, 2 },
+ { { 5, 4, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SGBRG10P, {
+ PixelFormatInfo {
+ "SGBRG10P",
+ "",
+ "pGAA",
+ PixelColorType::RAW,
+ { 4, 2 },
+ { { 5, 4, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SGRBG10P, {
+ PixelFormatInfo {
+ "SGRBG10P",
+ "",
+ "pgAA",
+ PixelColorType::RAW,
+ { 4, 2 },
+ { { 5, 4, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SRGGB10P, {
+ PixelFormatInfo {
+ "SRGGB10P",
+ "",
+ "pRAA",
+ PixelColorType::RAW,
+ { 4, 2 },
+ { { 5, 4, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SBGGR12, {
+ PixelFormatInfo {
+ "SBGGR12",
+ "",
+ "BG12",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SGBRG12, {
+ PixelFormatInfo {
+ "SGBRG12",
+ "",
+ "GB12",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SGRBG12, {
+ PixelFormatInfo {
+ "SGRBG12",
+ "",
+ "BA12",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SRGGB12, {
+ PixelFormatInfo {
+ "SRGGB12",
+ "",
+ "RG12",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SBGGR12P, {
+ PixelFormatInfo {
+ "SBGGR12P",
+ "",
+ "pBCC",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 3, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SGBRG12P, {
+ PixelFormatInfo {
+ "SGBRG12P",
+ "",
+ "pGCC",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 3, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SGRBG12P, {
+ PixelFormatInfo {
+ "SGRBG12P",
+ "",
+ "pgCC",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 3, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SRGGB12P, {
+ PixelFormatInfo {
+ "SRGGB12P",
+ "",
+ "pRCC",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 3, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::SRGGB16, {
+ PixelFormatInfo {
+ "SRGGB16",
+ "",
+ "RG16",
+ PixelColorType::RAW,
+ { 2, 2 },
+ { { 4, 2, 1, 1 } },
+ }
+ }
+ },
+ {
+ PixelFormat::MJPEG, {
+ PixelFormatInfo {
+ "MJPEG",
+ "MJPG",
+ "MJPG",
+ PixelColorType::YUV,
+ { 1, 1 },
+ { { 1, 1, 1, 1 } },
+ }
+ }
+ },
};
const struct PixelFormatInfo& get_pixel_format_info(PixelFormat format)