summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-04-30 03:20:50 +0300
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-04-30 16:37:17 +0300
commit00d639d951e7051c27286b9e8f59a36b9f30f771 (patch)
treeeb889f73b59f445d73b01e30eb64157616ba4c6d
parent37332ad50b4f55481b1dc4390fa436ce1ea3712d (diff)
libcamera: formats: Add support for 8-, 10- and 12-bit Bayer formats
Add the 8-, 10- and 12-but Bayer formats, in both unpacked and MIPI-packed variants, to the format tables in PixelFormatInfo and V4L2PixelFormat. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
-rw-r--r--src/libcamera/formats.cpp82
-rw-r--r--src/libcamera/v4l2_pixelformat.cpp30
2 files changed, 112 insertions, 0 deletions
diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
index 4a351020..f6f8bc12 100644
--- a/src/libcamera/formats.cpp
+++ b/src/libcamera/formats.cpp
@@ -194,6 +194,88 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
.v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_GREY),
} },
+ /* Bayer formats. */
+ { PixelFormat(DRM_FORMAT_SBGGR8), {
+ .format = PixelFormat(DRM_FORMAT_SBGGR8),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8),
+ } },
+ { PixelFormat(DRM_FORMAT_SGBRG8), {
+ .format = PixelFormat(DRM_FORMAT_SGBRG8),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8),
+ } },
+ { PixelFormat(DRM_FORMAT_SGRBG8), {
+ .format = PixelFormat(DRM_FORMAT_SGRBG8),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8),
+ } },
+ { PixelFormat(DRM_FORMAT_SRGGB8), {
+ .format = PixelFormat(DRM_FORMAT_SRGGB8),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8),
+ } },
+ { PixelFormat(DRM_FORMAT_SBGGR10), {
+ .format = PixelFormat(DRM_FORMAT_SBGGR10),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10),
+ } },
+ { PixelFormat(DRM_FORMAT_SGBRG10), {
+ .format = PixelFormat(DRM_FORMAT_SGBRG10),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10),
+ } },
+ { PixelFormat(DRM_FORMAT_SGRBG10), {
+ .format = PixelFormat(DRM_FORMAT_SGRBG10),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10),
+ } },
+ { PixelFormat(DRM_FORMAT_SRGGB10), {
+ .format = PixelFormat(DRM_FORMAT_SRGGB10),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10),
+ } },
+ { PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED), {
+ .format = PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10P),
+ } },
+ { PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED), {
+ .format = PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P),
+ } },
+ { PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED), {
+ .format = PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P),
+ } },
+ { PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED), {
+ .format = PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P),
+ } },
+ { PixelFormat(DRM_FORMAT_SBGGR12), {
+ .format = PixelFormat(DRM_FORMAT_SBGGR12),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12),
+ } },
+ { PixelFormat(DRM_FORMAT_SGBRG12), {
+ .format = PixelFormat(DRM_FORMAT_SGBRG12),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12),
+ } },
+ { PixelFormat(DRM_FORMAT_SGRBG12), {
+ .format = PixelFormat(DRM_FORMAT_SGRBG12),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12),
+ } },
+ { PixelFormat(DRM_FORMAT_SRGGB12), {
+ .format = PixelFormat(DRM_FORMAT_SRGGB12),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12),
+ } },
+ { PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED), {
+ .format = PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P),
+ } },
+ { PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED), {
+ .format = PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P),
+ } },
+ { PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED), {
+ .format = PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P),
+ } },
+ { PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED), {
+ .format = PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED),
+ .v4l2Format = V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P),
+ } },
+
/* Compressed formats. */
{ PixelFormat(DRM_FORMAT_MJPEG), {
.format = PixelFormat(DRM_FORMAT_MJPEG),
diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
index 580c0fc9..fd7e2d28 100644
--- a/src/libcamera/v4l2_pixelformat.cpp
+++ b/src/libcamera/v4l2_pixelformat.cpp
@@ -68,6 +68,36 @@ const std::map<V4L2PixelFormat, PixelFormat> vpf2pf{
/* Greyscale formats. */
{ V4L2PixelFormat(V4L2_PIX_FMT_GREY), PixelFormat(DRM_FORMAT_R8) },
+ /* Bayer formats. */
+ { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8), PixelFormat(DRM_FORMAT_SBGGR8) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG8), PixelFormat(DRM_FORMAT_SGBRG8) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG8), PixelFormat(DRM_FORMAT_SGRBG8) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB8), PixelFormat(DRM_FORMAT_SRGGB8) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10), PixelFormat(DRM_FORMAT_SBGGR10) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10), PixelFormat(DRM_FORMAT_SGBRG10) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10), PixelFormat(DRM_FORMAT_SGRBG10) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10), PixelFormat(DRM_FORMAT_SRGGB10) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR10),
+ PixelFormat(DRM_FORMAT_SBGGR10, MIPI_FORMAT_MOD_CSI2_PACKED) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG10P),
+ PixelFormat(DRM_FORMAT_SGBRG10, MIPI_FORMAT_MOD_CSI2_PACKED) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG10P),
+ PixelFormat(DRM_FORMAT_SGRBG10, MIPI_FORMAT_MOD_CSI2_PACKED) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB10P),
+ PixelFormat(DRM_FORMAT_SRGGB10, MIPI_FORMAT_MOD_CSI2_PACKED) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12), PixelFormat(DRM_FORMAT_SBGGR12) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12), PixelFormat(DRM_FORMAT_SGBRG12) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12), PixelFormat(DRM_FORMAT_SGRBG12) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12), PixelFormat(DRM_FORMAT_SRGGB12) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR12P),
+ PixelFormat(DRM_FORMAT_SBGGR12, MIPI_FORMAT_MOD_CSI2_PACKED) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SGBRG12P),
+ PixelFormat(DRM_FORMAT_SGBRG12, MIPI_FORMAT_MOD_CSI2_PACKED) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SGRBG12P),
+ PixelFormat(DRM_FORMAT_SGRBG12, MIPI_FORMAT_MOD_CSI2_PACKED) },
+ { V4L2PixelFormat(V4L2_PIX_FMT_SRGGB12P),
+ PixelFormat(DRM_FORMAT_SRGGB12, MIPI_FORMAT_MOD_CSI2_PACKED) },
+
/* Compressed formats. */
{ V4L2PixelFormat(V4L2_PIX_FMT_MJPEG), PixelFormat(DRM_FORMAT_MJPEG) },
};