[libcamera-devel] [PATCH v3 2/9] libcamera: formats: Add R10 and R12 formats
Kieran Bingham
kieran.bingham at ideasonboard.com
Wed Oct 27 12:30:54 CEST 2021
Quoting Naushir Patuck (2021-10-27 10:27:56)
> From: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>
> These new formats corresponds to the V4L2 V4L2_PIX_FMT_Y10 and
> V4L2_PIX_FMT_Y12 formats, and are the little-endian version of the
> DRM_FORMAT_R10 and DRM_FORMAT_R12 formats.
>
Assuming the DRM format names aren't going to be likely to change:
Reviewed-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> Signed-off-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> Signed-off-by: Naushir Patuck <naush at raspberrypi.com>
> ---
> src/libcamera/formats.cpp | 26 ++++++++++++++++++++++++++
> src/libcamera/formats.yaml | 4 ++++
> src/libcamera/v4l2_pixelformat.cpp | 4 ++++
> 3 files changed, 34 insertions(+)
>
> diff --git a/src/libcamera/formats.cpp b/src/libcamera/formats.cpp
> index 1c29e1f2c5ab..9f96e9dc4e41 100644
> --- a/src/libcamera/formats.cpp
> +++ b/src/libcamera/formats.cpp
> @@ -484,6 +484,32 @@ const std::map<PixelFormat, PixelFormatInfo> pixelFormatInfo{
> .pixelsPerGroup = 1,
> .planes = {{ { 1, 1 }, { 0, 0 }, { 0, 0 } }},
> } },
> + { formats::R10, {
> + .name = "R10",
> + .format = formats::R10,
> + .v4l2Formats = {
> + .single = V4L2PixelFormat(V4L2_PIX_FMT_Y10),
> + .multi = V4L2PixelFormat(),
> + },
> + .bitsPerPixel = 10,
> + .colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> + .packed = false,
> + .pixelsPerGroup = 1,
> + .planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},
> + } },
> + { formats::R12, {
> + .name = "R12",
> + .format = formats::R12,
> + .v4l2Formats = {
> + .single = V4L2PixelFormat(V4L2_PIX_FMT_Y12),
> + .multi = V4L2PixelFormat(),
> + },
> + .bitsPerPixel = 10,
> + .colourEncoding = PixelFormatInfo::ColourEncodingYUV,
> + .packed = false,
> + .pixelsPerGroup = 1,
> + .planes = {{ { 2, 1 }, { 0, 0 }, { 0, 0 } }},
> + } },
>
> /* Bayer formats. */
> { formats::SBGGR8, {
> diff --git a/src/libcamera/formats.yaml b/src/libcamera/formats.yaml
> index 43b5877e08f2..22a8e473a183 100644
> --- a/src/libcamera/formats.yaml
> +++ b/src/libcamera/formats.yaml
> @@ -7,6 +7,10 @@
> formats:
> - R8:
> fourcc: DRM_FORMAT_R8
> + - R10:
> + fourcc: DRM_FORMAT_R10
> + - R12:
> + fourcc: DRM_FORMAT_R12
>
> - RGB565:
> fourcc: DRM_FORMAT_RGB565
> diff --git a/src/libcamera/v4l2_pixelformat.cpp b/src/libcamera/v4l2_pixelformat.cpp
> index 3649c6002620..0e0da3f0df07 100644
> --- a/src/libcamera/v4l2_pixelformat.cpp
> +++ b/src/libcamera/v4l2_pixelformat.cpp
> @@ -117,6 +117,10 @@ const std::map<V4L2PixelFormat, V4L2PixelFormat::Info> vpf2pf{
> /* Greyscale formats. */
> { V4L2PixelFormat(V4L2_PIX_FMT_GREY),
> { formats::R8, "8-bit Greyscale" } },
> + { V4L2PixelFormat(V4L2_PIX_FMT_Y10),
> + { formats::R10, "10-bit Greyscale" } },
> + { V4L2PixelFormat(V4L2_PIX_FMT_Y12),
> + { formats::R12, "12-bit Greyscale" } },
>
> /* Bayer formats. */
> { V4L2PixelFormat(V4L2_PIX_FMT_SBGGR8),
> --
> 2.25.1
>
More information about the libcamera-devel
mailing list