[PATCH/RFC,12/32] libcamera: v4l2_subdevice: Add new metadata formats
diff mbox series

Message ID 20240301212121.9072-13-laurent.pinchart@ideasonboard.com
State RFC
Headers show
Series
  • libcamera: Support the upstream Unicam driver
Related show

Commit Message

Laurent Pinchart March 1, 2024, 9:21 p.m. UTC
Support the newly introduced V4L2 media bus formats for metadata. This
includes generic metadata formats, and two sensor-specific embedded data
formats.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 src/libcamera/v4l2_subdevice.cpp | 63 ++++++++++++++++++++++++++++++++
 1 file changed, 63 insertions(+)

Comments

Jacopo Mondi March 4, 2024, 5:28 p.m. UTC | #1
Hi laurent

On Fri, Mar 01, 2024 at 11:21:01PM +0200, Laurent Pinchart wrote:
> Support the newly introduced V4L2 media bus formats for metadata. This
> includes generic metadata formats, and two sensor-specific embedded data
> formats.
>
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  src/libcamera/v4l2_subdevice.cpp | 63 ++++++++++++++++++++++++++++++++
>  1 file changed, 63 insertions(+)
>
> diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
> index d5d400cdfd58..c2c9577cba9c 100644
> --- a/src/libcamera/v4l2_subdevice.cpp
> +++ b/src/libcamera/v4l2_subdevice.cpp
> @@ -645,6 +645,69 @@ const std::map<uint32_t, MediaBusFormatInfo> mediaBusFormatInfo{
>  		.bitsPerPixel = 0,
>  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
>  	} },
> +	{ MEDIA_BUS_FMT_META_8, {
> +		.name = "META_8",
> +		.code = MEDIA_BUS_FMT_META_8,
> +		.type = MediaBusFormatInfo::Type::Metadata,
> +		.bitsPerPixel = 8,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> +	} },
> +	{ MEDIA_BUS_FMT_META_10, {
> +		.name = "META_10",
> +		.code = MEDIA_BUS_FMT_META_10,
> +		.type = MediaBusFormatInfo::Type::Metadata,
> +		.bitsPerPixel = 10,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> +	} },
> +	{ MEDIA_BUS_FMT_META_12, {
> +		.name = "META_12",
> +		.code = MEDIA_BUS_FMT_META_12,
> +		.type = MediaBusFormatInfo::Type::Metadata,
> +		.bitsPerPixel = 12,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> +	} },
> +	{ MEDIA_BUS_FMT_META_14, {
> +		.name = "META_14",
> +		.code = MEDIA_BUS_FMT_META_14,
> +		.type = MediaBusFormatInfo::Type::Metadata,
> +		.bitsPerPixel = 14,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> +	} },
> +	{ MEDIA_BUS_FMT_META_16, {
> +		.name = "META_16",
> +		.code = MEDIA_BUS_FMT_META_16,
> +		.type = MediaBusFormatInfo::Type::Metadata,
> +		.bitsPerPixel = 16,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> +	} },
> +	{ MEDIA_BUS_FMT_META_20, {
> +		.name = "META_20",
> +		.code = MEDIA_BUS_FMT_META_20,
> +		.type = MediaBusFormatInfo::Type::Metadata,
> +		.bitsPerPixel = 20,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> +	} },
> +	{ MEDIA_BUS_FMT_META_24, {
> +		.name = "META_24",
> +		.code = MEDIA_BUS_FMT_META_24,
> +		.type = MediaBusFormatInfo::Type::Metadata,
> +		.bitsPerPixel = 24,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> +	} },
> +	{ MEDIA_BUS_FMT_CCS_EMBEDDED, {
> +		.name = "CCS_EMBEDDED",
> +		.code = MEDIA_BUS_FMT_CCS_EMBEDDED,
> +		.type = MediaBusFormatInfo::Type::EmbeddedData,
> +		.bitsPerPixel = 0,

Are these 0s safe ?

> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> +	} },
> +	{ MEDIA_BUS_FMT_OV2740_EMBEDDED, {
> +		.name = "OV2740_EMBEDDED",
> +		.code = MEDIA_BUS_FMT_CCS_EMBEDDED,
> +		.type = MediaBusFormatInfo::Type::EmbeddedData,
> +		.bitsPerPixel = 0,
> +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> +	} },
>  };
>
>  } /* namespace */
> --
> Regards,
>
> Laurent Pinchart
>
Laurent Pinchart March 4, 2024, 10:47 p.m. UTC | #2
On Mon, Mar 04, 2024 at 06:28:31PM +0100, Jacopo Mondi wrote:
> On Fri, Mar 01, 2024 at 11:21:01PM +0200, Laurent Pinchart wrote:
> > Support the newly introduced V4L2 media bus formats for metadata. This
> > includes generic metadata formats, and two sensor-specific embedded data
> > formats.
> >
> > Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > ---
> >  src/libcamera/v4l2_subdevice.cpp | 63 ++++++++++++++++++++++++++++++++
> >  1 file changed, 63 insertions(+)
> >
> > diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
> > index d5d400cdfd58..c2c9577cba9c 100644
> > --- a/src/libcamera/v4l2_subdevice.cpp
> > +++ b/src/libcamera/v4l2_subdevice.cpp
> > @@ -645,6 +645,69 @@ const std::map<uint32_t, MediaBusFormatInfo> mediaBusFormatInfo{
> >  		.bitsPerPixel = 0,
> >  		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> >  	} },
> > +	{ MEDIA_BUS_FMT_META_8, {
> > +		.name = "META_8",
> > +		.code = MEDIA_BUS_FMT_META_8,
> > +		.type = MediaBusFormatInfo::Type::Metadata,
> > +		.bitsPerPixel = 8,
> > +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> > +	} },
> > +	{ MEDIA_BUS_FMT_META_10, {
> > +		.name = "META_10",
> > +		.code = MEDIA_BUS_FMT_META_10,
> > +		.type = MediaBusFormatInfo::Type::Metadata,
> > +		.bitsPerPixel = 10,
> > +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> > +	} },
> > +	{ MEDIA_BUS_FMT_META_12, {
> > +		.name = "META_12",
> > +		.code = MEDIA_BUS_FMT_META_12,
> > +		.type = MediaBusFormatInfo::Type::Metadata,
> > +		.bitsPerPixel = 12,
> > +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> > +	} },
> > +	{ MEDIA_BUS_FMT_META_14, {
> > +		.name = "META_14",
> > +		.code = MEDIA_BUS_FMT_META_14,
> > +		.type = MediaBusFormatInfo::Type::Metadata,
> > +		.bitsPerPixel = 14,
> > +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> > +	} },
> > +	{ MEDIA_BUS_FMT_META_16, {
> > +		.name = "META_16",
> > +		.code = MEDIA_BUS_FMT_META_16,
> > +		.type = MediaBusFormatInfo::Type::Metadata,
> > +		.bitsPerPixel = 16,
> > +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> > +	} },
> > +	{ MEDIA_BUS_FMT_META_20, {
> > +		.name = "META_20",
> > +		.code = MEDIA_BUS_FMT_META_20,
> > +		.type = MediaBusFormatInfo::Type::Metadata,
> > +		.bitsPerPixel = 20,
> > +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> > +	} },
> > +	{ MEDIA_BUS_FMT_META_24, {
> > +		.name = "META_24",
> > +		.code = MEDIA_BUS_FMT_META_24,
> > +		.type = MediaBusFormatInfo::Type::Metadata,
> > +		.bitsPerPixel = 24,
> > +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> > +	} },
> > +	{ MEDIA_BUS_FMT_CCS_EMBEDDED, {
> > +		.name = "CCS_EMBEDDED",
> > +		.code = MEDIA_BUS_FMT_CCS_EMBEDDED,
> > +		.type = MediaBusFormatInfo::Type::EmbeddedData,
> > +		.bitsPerPixel = 0,
> 
> Are these 0s safe ?

As safe as it gets :-) The value is unused for now, the CameraSensorRaw
class doesn't need to know the bpp for the media bus format on the
internal embedded data pad. I don't see what it would be useful for, but
if that were to change in the future, we'll figure something out.

> > +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> > +	} },
> > +	{ MEDIA_BUS_FMT_OV2740_EMBEDDED, {
> > +		.name = "OV2740_EMBEDDED",
> > +		.code = MEDIA_BUS_FMT_CCS_EMBEDDED,
> > +		.type = MediaBusFormatInfo::Type::EmbeddedData,
> > +		.bitsPerPixel = 0,
> > +		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
> > +	} },
> >  };
> >
> >  } /* namespace */

Patch
diff mbox series

diff --git a/src/libcamera/v4l2_subdevice.cpp b/src/libcamera/v4l2_subdevice.cpp
index d5d400cdfd58..c2c9577cba9c 100644
--- a/src/libcamera/v4l2_subdevice.cpp
+++ b/src/libcamera/v4l2_subdevice.cpp
@@ -645,6 +645,69 @@  const std::map<uint32_t, MediaBusFormatInfo> mediaBusFormatInfo{
 		.bitsPerPixel = 0,
 		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
 	} },
+	{ MEDIA_BUS_FMT_META_8, {
+		.name = "META_8",
+		.code = MEDIA_BUS_FMT_META_8,
+		.type = MediaBusFormatInfo::Type::Metadata,
+		.bitsPerPixel = 8,
+		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
+	} },
+	{ MEDIA_BUS_FMT_META_10, {
+		.name = "META_10",
+		.code = MEDIA_BUS_FMT_META_10,
+		.type = MediaBusFormatInfo::Type::Metadata,
+		.bitsPerPixel = 10,
+		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
+	} },
+	{ MEDIA_BUS_FMT_META_12, {
+		.name = "META_12",
+		.code = MEDIA_BUS_FMT_META_12,
+		.type = MediaBusFormatInfo::Type::Metadata,
+		.bitsPerPixel = 12,
+		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
+	} },
+	{ MEDIA_BUS_FMT_META_14, {
+		.name = "META_14",
+		.code = MEDIA_BUS_FMT_META_14,
+		.type = MediaBusFormatInfo::Type::Metadata,
+		.bitsPerPixel = 14,
+		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
+	} },
+	{ MEDIA_BUS_FMT_META_16, {
+		.name = "META_16",
+		.code = MEDIA_BUS_FMT_META_16,
+		.type = MediaBusFormatInfo::Type::Metadata,
+		.bitsPerPixel = 16,
+		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
+	} },
+	{ MEDIA_BUS_FMT_META_20, {
+		.name = "META_20",
+		.code = MEDIA_BUS_FMT_META_20,
+		.type = MediaBusFormatInfo::Type::Metadata,
+		.bitsPerPixel = 20,
+		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
+	} },
+	{ MEDIA_BUS_FMT_META_24, {
+		.name = "META_24",
+		.code = MEDIA_BUS_FMT_META_24,
+		.type = MediaBusFormatInfo::Type::Metadata,
+		.bitsPerPixel = 24,
+		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
+	} },
+	{ MEDIA_BUS_FMT_CCS_EMBEDDED, {
+		.name = "CCS_EMBEDDED",
+		.code = MEDIA_BUS_FMT_CCS_EMBEDDED,
+		.type = MediaBusFormatInfo::Type::EmbeddedData,
+		.bitsPerPixel = 0,
+		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
+	} },
+	{ MEDIA_BUS_FMT_OV2740_EMBEDDED, {
+		.name = "OV2740_EMBEDDED",
+		.code = MEDIA_BUS_FMT_CCS_EMBEDDED,
+		.type = MediaBusFormatInfo::Type::EmbeddedData,
+		.bitsPerPixel = 0,
+		.colourEncoding = PixelFormatInfo::ColourEncodingRAW,
+	} },
 };
 
 } /* namespace */