[2/8] media: Add a pixel format for MIPI packed 14bit luma only
Commit Message
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
This is the format used by monochrome 14bit image sensors.
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
---
.../userspace-api/media/v4l/pixfmt-y14p.rst | 47 +++++++++++++++++++
.../userspace-api/media/v4l/yuv-formats.rst | 1 +
drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
include/uapi/linux/videodev2.h | 1 +
4 files changed, 50 insertions(+)
create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
Comments
Le vendredi 09 février 2024 à 17:48 +0100, Jacopo Mondi a écrit :
> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
>
> This is the format used by monochrome 14bit image sensors.
>
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> ---
> .../userspace-api/media/v4l/pixfmt-y14p.rst | 47 +++++++++++++++++++
> .../userspace-api/media/v4l/yuv-formats.rst | 1 +
> drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
> include/uapi/linux/videodev2.h | 1 +
> 4 files changed, 50 insertions(+)
> create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
>
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y14p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
> new file mode 100644
> index 000000000000..8e986bc6904f
> --- /dev/null
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
> @@ -0,0 +1,47 @@
> +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
> +
> +.. _V4L2-PIX-FMT-Y14P:
> +
> +**************************
> +V4L2_PIX_FMT_Y14P ('Y14P')
> +**************************
> +
> +Grey-scale image as a MIPI RAW14 packed array
Same suggestion applies, could be called Y14_MIPI due to the specific
arrangement.
> +
> +
> +Description
> +===========
> +
> +This is a packed grey-scale image format with a depth of 14 bits per
> +pixel. Every four consecutive samples are packed into seven bytes. Each
> +of the first four bytes contain the eight high order bits of the pixels,
> +and the three following bytes contains the six least significants bits of
> +each pixel, in the same order.
> +
> +**Byte Order.**
> +Each cell is one byte.
> +
> +.. tabularcolumns:: |p{1.8cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.1cm}|p{3.3cm}|p{3.3cm}|p{3.3cm}|
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> + :widths: 2 1 1 1 1 3 3 3
> +
> +
> + - - start + 0:
> + - Y'\ :sub:`00high`
> + - Y'\ :sub:`01high`
> + - Y'\ :sub:`02high`
> + - Y'\ :sub:`03high`
> + - Y'\ :sub:`01low bits 1--0`\ (bits 7--6)
> +
> + Y'\ :sub:`00low bits 5--0`\ (bits 5--0)
> +
> + - Y'\ :sub:`02low bits 3--0`\ (bits 7--4)
> +
> + Y'\ :sub:`01low bits 5--2`\ (bits 3--0)
> +
> + - Y'\ :sub:`03low bits 5--0`\ (bits 7--2)
> +
> + Y'\ :sub:`02low bits 5--4`\ (bits 1--0)
> diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst
> index 7c9ccfdd94cd..6104747d17d4 100644
> --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst
> +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst
> @@ -268,6 +268,7 @@ image.
> pixfmt-yuv-planar
> pixfmt-yuv-luma
> pixfmt-y12p
> + pixfmt-y14p
> pixfmt-y8i
> pixfmt-y12i
> pixfmt-uv8
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 483498c55899..24f52485e59c 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1312,6 +1312,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break;
> case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break;
> case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break;
> + case V4L2_PIX_FMT_Y14P: descr = "14-bit Greyscale (MIPI Packed)"; break;
> case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break;
> case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break;
> case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break;
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 11ebf9b22ccb..94a0373e8234 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -599,6 +599,7 @@ struct v4l2_pix_format {
> #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */
> #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */
> #define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */
> +#define V4L2_PIX_FMT_Y14P v4l2_fourcc('Y', '1', '4', 'P') /* 14 Greyscale, MIPI RAW12 packed */
> #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */
>
> /* Palette formats */
Hi Jacopo,
Thanks for the patch.
On Feb 09, 2024 at 17:48:17 +0100, Jacopo Mondi wrote:
> From: Dave Stevenson <dave.stevenson@raspberrypi.com>
>
> This is the format used by monochrome 14bit image sensors.
>
> Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> ---
> .../userspace-api/media/v4l/pixfmt-y14p.rst | 47 +++++++++++++++++++
> .../userspace-api/media/v4l/yuv-formats.rst | 1 +
> drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
> include/uapi/linux/videodev2.h | 1 +
> 4 files changed, 50 insertions(+)
> create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
>
> diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y14p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
> new file mode 100644
> index 000000000000..8e986bc6904f
> --- /dev/null
> +++ b/Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
> @@ -0,0 +1,47 @@
> +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
> +
> +.. _V4L2-PIX-FMT-Y14P:
> +
> +**************************
> +V4L2_PIX_FMT_Y14P ('Y14P')
> +**************************
> +
> +Grey-scale image as a MIPI RAW14 packed array
> +
> +
> +Description
> +===========
> +
> +This is a packed grey-scale image format with a depth of 14 bits per
> +pixel. Every four consecutive samples are packed into seven bytes. Each
> +of the first four bytes contain the eight high order bits of the pixels,
> +and the three following bytes contains the six least significants bits of
> +each pixel, in the same order.
> +
> +**Byte Order.**
> +Each cell is one byte.
> +
> +.. tabularcolumns:: |p{1.8cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.1cm}|p{3.3cm}|p{3.3cm}|p{3.3cm}|
> +
> +.. flat-table::
> + :header-rows: 0
> + :stub-columns: 0
> + :widths: 2 1 1 1 1 3 3 3
> +
> +
> + - - start + 0:
> + - Y'\ :sub:`00high`
> + - Y'\ :sub:`01high`
> + - Y'\ :sub:`02high`
> + - Y'\ :sub:`03high`
> + - Y'\ :sub:`01low bits 1--0`\ (bits 7--6)
> +
> + Y'\ :sub:`00low bits 5--0`\ (bits 5--0)
> +
> + - Y'\ :sub:`02low bits 3--0`\ (bits 7--4)
> +
> + Y'\ :sub:`01low bits 5--2`\ (bits 3--0)
> +
> + - Y'\ :sub:`03low bits 5--0`\ (bits 7--2)
> +
> + Y'\ :sub:`02low bits 5--4`\ (bits 1--0)
> diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst
> index 7c9ccfdd94cd..6104747d17d4 100644
> --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst
> +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst
> @@ -268,6 +268,7 @@ image.
> pixfmt-yuv-planar
> pixfmt-yuv-luma
> pixfmt-y12p
> + pixfmt-y14p
> pixfmt-y8i
> pixfmt-y12i
> pixfmt-uv8
> diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> index 483498c55899..24f52485e59c 100644
> --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> @@ -1312,6 +1312,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break;
> case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break;
> case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break;
> + case V4L2_PIX_FMT_Y14P: descr = "14-bit Greyscale (MIPI Packed)"; break;
> case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break;
> case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break;
> case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break;
> diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> index 11ebf9b22ccb..94a0373e8234 100644
> --- a/include/uapi/linux/videodev2.h
> +++ b/include/uapi/linux/videodev2.h
> @@ -599,6 +599,7 @@ struct v4l2_pix_format {
> #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */
> #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */
> #define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */
> +#define V4L2_PIX_FMT_Y14P v4l2_fourcc('Y', '1', '4', 'P') /* 14 Greyscale, MIPI RAW12 packed */
I guess comment should have RAW14 instead of RAW12?
> #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */
>
> /* Palette formats */
> --
> 2.43.0
>
>
Hi Jai
On Sat, Feb 10, 2024 at 10:47:43AM +0530, Jai Luthra wrote:
> Hi Jacopo,
>
> Thanks for the patch.
>
> On Feb 09, 2024 at 17:48:17 +0100, Jacopo Mondi wrote:
> > From: Dave Stevenson <dave.stevenson@raspberrypi.com>
> >
> > This is the format used by monochrome 14bit image sensors.
> >
> > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> > Signed-off-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
> > ---
> > .../userspace-api/media/v4l/pixfmt-y14p.rst | 47 +++++++++++++++++++
> > .../userspace-api/media/v4l/yuv-formats.rst | 1 +
> > drivers/media/v4l2-core/v4l2-ioctl.c | 1 +
> > include/uapi/linux/videodev2.h | 1 +
> > 4 files changed, 50 insertions(+)
> > create mode 100644 Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
> >
> > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-y14p.rst b/Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
> > new file mode 100644
> > index 000000000000..8e986bc6904f
> > --- /dev/null
> > +++ b/Documentation/userspace-api/media/v4l/pixfmt-y14p.rst
> > @@ -0,0 +1,47 @@
> > +.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
> > +
> > +.. _V4L2-PIX-FMT-Y14P:
> > +
> > +**************************
> > +V4L2_PIX_FMT_Y14P ('Y14P')
> > +**************************
> > +
> > +Grey-scale image as a MIPI RAW14 packed array
> > +
> > +
> > +Description
> > +===========
> > +
> > +This is a packed grey-scale image format with a depth of 14 bits per
> > +pixel. Every four consecutive samples are packed into seven bytes. Each
> > +of the first four bytes contain the eight high order bits of the pixels,
> > +and the three following bytes contains the six least significants bits of
> > +each pixel, in the same order.
> > +
> > +**Byte Order.**
> > +Each cell is one byte.
> > +
> > +.. tabularcolumns:: |p{1.8cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.1cm}|p{3.3cm}|p{3.3cm}|p{3.3cm}|
> > +
> > +.. flat-table::
> > + :header-rows: 0
> > + :stub-columns: 0
> > + :widths: 2 1 1 1 1 3 3 3
> > +
> > +
> > + - - start + 0:
> > + - Y'\ :sub:`00high`
> > + - Y'\ :sub:`01high`
> > + - Y'\ :sub:`02high`
> > + - Y'\ :sub:`03high`
> > + - Y'\ :sub:`01low bits 1--0`\ (bits 7--6)
> > +
> > + Y'\ :sub:`00low bits 5--0`\ (bits 5--0)
> > +
> > + - Y'\ :sub:`02low bits 3--0`\ (bits 7--4)
> > +
> > + Y'\ :sub:`01low bits 5--2`\ (bits 3--0)
> > +
> > + - Y'\ :sub:`03low bits 5--0`\ (bits 7--2)
> > +
> > + Y'\ :sub:`02low bits 5--4`\ (bits 1--0)
> > diff --git a/Documentation/userspace-api/media/v4l/yuv-formats.rst b/Documentation/userspace-api/media/v4l/yuv-formats.rst
> > index 7c9ccfdd94cd..6104747d17d4 100644
> > --- a/Documentation/userspace-api/media/v4l/yuv-formats.rst
> > +++ b/Documentation/userspace-api/media/v4l/yuv-formats.rst
> > @@ -268,6 +268,7 @@ image.
> > pixfmt-yuv-planar
> > pixfmt-yuv-luma
> > pixfmt-y12p
> > + pixfmt-y14p
> > pixfmt-y8i
> > pixfmt-y12i
> > pixfmt-uv8
> > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c
> > index 483498c55899..24f52485e59c 100644
> > --- a/drivers/media/v4l2-core/v4l2-ioctl.c
> > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c
> > @@ -1312,6 +1312,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
> > case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break;
> > case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break;
> > case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break;
> > + case V4L2_PIX_FMT_Y14P: descr = "14-bit Greyscale (MIPI Packed)"; break;
> > case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break;
> > case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break;
> > case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break;
> > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h
> > index 11ebf9b22ccb..94a0373e8234 100644
> > --- a/include/uapi/linux/videodev2.h
> > +++ b/include/uapi/linux/videodev2.h
> > @@ -599,6 +599,7 @@ struct v4l2_pix_format {
> > #define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */
> > #define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */
> > #define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */
> > +#define V4L2_PIX_FMT_Y14P v4l2_fourcc('Y', '1', '4', 'P') /* 14 Greyscale, MIPI RAW12 packed */
>
> I guess comment should have RAW14 instead of RAW12?
>
Indeed, thanks for spotting!
Cheers
> > #define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */
> >
> > /* Palette formats */
> > --
> > 2.43.0
> >
> >
>
> --
> Thanks,
> Jai
>
> GPG Fingerprint: 4DE0 D818 E5D5 75E8 D45A AFC5 43DE 91F9 249A 7145
new file mode 100644
@@ -0,0 +1,47 @@
+.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
+
+.. _V4L2-PIX-FMT-Y14P:
+
+**************************
+V4L2_PIX_FMT_Y14P ('Y14P')
+**************************
+
+Grey-scale image as a MIPI RAW14 packed array
+
+
+Description
+===========
+
+This is a packed grey-scale image format with a depth of 14 bits per
+pixel. Every four consecutive samples are packed into seven bytes. Each
+of the first four bytes contain the eight high order bits of the pixels,
+and the three following bytes contains the six least significants bits of
+each pixel, in the same order.
+
+**Byte Order.**
+Each cell is one byte.
+
+.. tabularcolumns:: |p{1.8cm}|p{1.0cm}|p{1.0cm}|p{1.0cm}|p{1.1cm}|p{3.3cm}|p{3.3cm}|p{3.3cm}|
+
+.. flat-table::
+ :header-rows: 0
+ :stub-columns: 0
+ :widths: 2 1 1 1 1 3 3 3
+
+
+ - - start + 0:
+ - Y'\ :sub:`00high`
+ - Y'\ :sub:`01high`
+ - Y'\ :sub:`02high`
+ - Y'\ :sub:`03high`
+ - Y'\ :sub:`01low bits 1--0`\ (bits 7--6)
+
+ Y'\ :sub:`00low bits 5--0`\ (bits 5--0)
+
+ - Y'\ :sub:`02low bits 3--0`\ (bits 7--4)
+
+ Y'\ :sub:`01low bits 5--2`\ (bits 3--0)
+
+ - Y'\ :sub:`03low bits 5--0`\ (bits 7--2)
+
+ Y'\ :sub:`02low bits 5--4`\ (bits 1--0)
@@ -268,6 +268,7 @@ image.
pixfmt-yuv-planar
pixfmt-yuv-luma
pixfmt-y12p
+ pixfmt-y14p
pixfmt-y8i
pixfmt-y12i
pixfmt-uv8
@@ -1312,6 +1312,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)
case V4L2_PIX_FMT_Y10BPACK: descr = "10-bit Greyscale (Packed)"; break;
case V4L2_PIX_FMT_Y10P: descr = "10-bit Greyscale (MIPI Packed)"; break;
case V4L2_PIX_FMT_Y12P: descr = "12-bit Greyscale (MIPI Packed)"; break;
+ case V4L2_PIX_FMT_Y14P: descr = "14-bit Greyscale (MIPI Packed)"; break;
case V4L2_PIX_FMT_IPU3_Y10: descr = "10-bit greyscale (IPU3 Packed)"; break;
case V4L2_PIX_FMT_Y8I: descr = "Interleaved 8-bit Greyscale"; break;
case V4L2_PIX_FMT_Y12I: descr = "Interleaved 12-bit Greyscale"; break;
@@ -599,6 +599,7 @@ struct v4l2_pix_format {
#define V4L2_PIX_FMT_Y10BPACK v4l2_fourcc('Y', '1', '0', 'B') /* 10 Greyscale bit-packed */
#define V4L2_PIX_FMT_Y10P v4l2_fourcc('Y', '1', '0', 'P') /* 10 Greyscale, MIPI RAW10 packed */
#define V4L2_PIX_FMT_Y12P v4l2_fourcc('Y', '1', '2', 'P') /* 12 Greyscale, MIPI RAW12 packed */
+#define V4L2_PIX_FMT_Y14P v4l2_fourcc('Y', '1', '4', 'P') /* 14 Greyscale, MIPI RAW12 packed */
#define V4L2_PIX_FMT_IPU3_Y10 v4l2_fourcc('i', 'p', '3', 'y') /* IPU3 packed 10-bit greyscale */
/* Palette formats */