[2/2] gstreamer: Map 10/12/14/16 bayer formats supports
diff mbox series

Message ID 20240202085819.119320-2-nicolas@ndufresne.ca
State Accepted
Commit 38d28cc5fc73aaa25cf897ea59003fe23281f6ed
Headers show
Series
  • [1/2] gstreamer: Map R8/R16 pixel format
Related show

Commit Message

Nicolas Dufresne Feb. 2, 2024, 8:58 a.m. UTC
From: Nicolas Dufresne <nicolas.dufresne@collabora.com>

These formats are now defined in upstream GStreamer main branch, so it is now
safe to use their names. Note that libcamera only supports little endian
variants of these formats.

Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
---
 src/gstreamer/gstlibcamera-utils.cpp | 48 ++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

Comments

Laurent Pinchart Feb. 2, 2024, 9:32 a.m. UTC | #1
Hi Nicolas,

Thank you for the patch.

On Fri, Feb 02, 2024 at 09:58:19AM +0100, Nicolas Dufresne wrote:
> From: Nicolas Dufresne <nicolas.dufresne@collabora.com>
> 
> These formats are now defined in upstream GStreamer main branch, so it is now
> safe to use their names. Note that libcamera only supports little endian
> variants of these formats.
> 
> Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  src/gstreamer/gstlibcamera-utils.cpp | 48 ++++++++++++++++++++++++++++
>  1 file changed, 48 insertions(+)
> 
> diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
> index 2a0b77f4..469ac810 100644
> --- a/src/gstreamer/gstlibcamera-utils.cpp
> +++ b/src/gstreamer/gstlibcamera-utils.cpp
> @@ -25,6 +25,22 @@ static struct {
>  	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG8 },
>  	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG8 },
>  	{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB8 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SBGGR10 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG10 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG10 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB10 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SBGGR12 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG12 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG12 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB12 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SBGGR14 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG14 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG14 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB14 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SBGGR16 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG16 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG16 },
> +	{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB16 },
>  
>  	/* Monochrome */
>  	{ GST_VIDEO_FORMAT_GRAY8, formats::R8 },
> @@ -250,6 +266,38 @@ bayer_format_to_string(int format)
>  		return "grbg";
>  	case formats::SRGGB8:
>  		return "rggb";
> +	case formats::SBGGR10:
> +		return "bggr10le";
> +	case formats::SGBRG10:
> +		return "gbrg10le";
> +	case formats::SGRBG10:
> +		return "grbg10le";
> +	case formats::SRGGB10:
> +		return "rggb10le";
> +	case formats::SBGGR12:
> +		return "bggr12le";
> +	case formats::SGBRG12:
> +		return "gbrg12le";
> +	case formats::SGRBG12:
> +		return "grbg12le";
> +	case formats::SRGGB12:
> +		return "rggb12le";
> +	case formats::SBGGR14:
> +		return "bggr14le";
> +	case formats::SGBRG14:
> +		return "gbrg14le";
> +	case formats::SGRBG14:
> +		return "grbg14le";
> +	case formats::SRGGB14:
> +		return "rggb14le";
> +	case formats::SBGGR16:
> +		return "bggr16le";
> +	case formats::SGBRG16:
> +		return "gbrg16le";
> +	case formats::SGRBG16:
> +		return "grbg16le";
> +	case formats::SRGGB16:
> +		return "rggb16le";
>  	}
>  	return NULL;
>  }

Patch
diff mbox series

diff --git a/src/gstreamer/gstlibcamera-utils.cpp b/src/gstreamer/gstlibcamera-utils.cpp
index 2a0b77f4..469ac810 100644
--- a/src/gstreamer/gstlibcamera-utils.cpp
+++ b/src/gstreamer/gstlibcamera-utils.cpp
@@ -25,6 +25,22 @@  static struct {
 	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG8 },
 	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG8 },
 	{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB8 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SBGGR10 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG10 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG10 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB10 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SBGGR12 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG12 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG12 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB12 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SBGGR14 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG14 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG14 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB14 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SBGGR16 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SGBRG16 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SGRBG16 },
+	{ GST_VIDEO_FORMAT_ENCODED, formats::SRGGB16 },
 
 	/* Monochrome */
 	{ GST_VIDEO_FORMAT_GRAY8, formats::R8 },
@@ -250,6 +266,38 @@  bayer_format_to_string(int format)
 		return "grbg";
 	case formats::SRGGB8:
 		return "rggb";
+	case formats::SBGGR10:
+		return "bggr10le";
+	case formats::SGBRG10:
+		return "gbrg10le";
+	case formats::SGRBG10:
+		return "grbg10le";
+	case formats::SRGGB10:
+		return "rggb10le";
+	case formats::SBGGR12:
+		return "bggr12le";
+	case formats::SGBRG12:
+		return "gbrg12le";
+	case formats::SGRBG12:
+		return "grbg12le";
+	case formats::SRGGB12:
+		return "rggb12le";
+	case formats::SBGGR14:
+		return "bggr14le";
+	case formats::SGBRG14:
+		return "gbrg14le";
+	case formats::SGRBG14:
+		return "grbg14le";
+	case formats::SRGGB14:
+		return "rggb14le";
+	case formats::SBGGR16:
+		return "bggr16le";
+	case formats::SGBRG16:
+		return "gbrg16le";
+	case formats::SGRBG16:
+		return "grbg16le";
+	case formats::SRGGB16:
+		return "rggb16le";
 	}
 	return NULL;
 }