Thread (20 messages) 20 messages, 2 authors, 2023-02-14

RE: [EXT] Re: [PATCH v2 02/10] media: Add Y012 video format

From: Ming Qian <ming.qian@nxp.com>
Date: 2023-02-13 09:22:53
Also in: linux-devicetree, linux-media, lkml

From: Nicolas Dufresne <redacted>
Sent: 2023年2月10日 23:18
To: Ming Qian <ming.qian@nxp.com>; mchehab@kernel.org; Mirela Rabulea
(OSS) [off-list ref]; hverkuil-cisco@xs4all.nl
Cc: shawnguo@kernel.org; s.hauer@pengutronix.de; kernel@pengutronix.de;
festevam@gmail.com; X.H. Bao [off-list ref]; dl-linux-imx <linux-
imx@nxp.com>; linux-media@vger.kernel.org; linux-kernel@vger.kernel.org;
devicetree@vger.kernel.org; linux-arm-kernel@lists.infradead.org
Subject: [EXT] Re: [PATCH v2 02/10] media: Add Y012 video format

Caution: EXT Email

Le mercredi 01 février 2023 à 14:02 +0800, Ming Qian a écrit :
quoted
Y012 is a luma-only formats with 12-bits per pixel, expanded to
16bits.
Data in the 12 high bits, zeros in the 4 low bits, arranged in little
endian order.

Signed-off-by: Ming Qian <ming.qian@nxp.com>
---
 .../userspace-api/media/v4l/pixfmt-yuv-luma.rst       | 11 +++++++++++
 drivers/media/v4l2-core/v4l2-ioctl.c                  |  1 +
 include/uapi/linux/videodev2.h                        |  1 +
 3 files changed, 13 insertions(+)
diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst
b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst
index 6a387f9df3ba..3ffa29000238 100644
--- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst
+++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-luma.rst
@@ -103,6 +103,17 @@ are often referred to as greyscale formats.
       - ...
       - ...

+    * .. _V4L2-PIX-FMT-Y012:
Why the 0, can't this be name Y12 (just like Y14) ?
Hi Nicolas,
    As the V4L2_PIX_FMT_Y12 is defined, but it's data is in the 12 low bits, zeros in the high bits.
    Here I want to place the 12 bits data in the high bits, with zeros in the 4 low bits.
    So I add 0 before 12, I want to say that the low bits are padding data 0.
   
    Or do you have a better suggestion?

Ming
quoted
+
+      - ``V4L2_PIX_FMT_Y012``
+      - 'Y012'
+
+      - Y'\ :sub:`0`\ [3:0] `0000`
+      - Y'\ :sub:`0`\ [11:4]
+      - ...
+      - ...
+      - ...
+
     * .. _V4L2-PIX-FMT-Y14:

       - ``V4L2_PIX_FMT_Y14``
diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c
b/drivers/media/v4l2-core/v4l2-ioctl.c
index 067dbdd0a9ef..0ee730aa6cc7 100644
--- a/drivers/media/v4l2-core/v4l2-ioctl.c
+++ b/drivers/media/v4l2-core/v4l2-ioctl.c
@@ -1303,6 +1303,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc
*fmt)
quoted
      case V4L2_PIX_FMT_Y6:           descr = "6-bit Greyscale"; break;
      case V4L2_PIX_FMT_Y10:          descr = "10-bit Greyscale"; break;
      case V4L2_PIX_FMT_Y12:          descr = "12-bit Greyscale"; break;
+     case V4L2_PIX_FMT_Y012:         descr = "12-bit Greyscale"; break;
      case V4L2_PIX_FMT_Y14:          descr = "14-bit Greyscale"; break;
      case V4L2_PIX_FMT_Y16:          descr = "16-bit Greyscale"; break;
      case V4L2_PIX_FMT_Y16_BE:       descr = "16-bit Greyscale BE"; break;
diff --git a/include/uapi/linux/videodev2.h
b/include/uapi/linux/videodev2.h index 5448aa3b7858..3d8f89bff33c
100644
--- a/include/uapi/linux/videodev2.h
+++ b/include/uapi/linux/videodev2.h
@@ -583,6 +583,7 @@ struct v4l2_pix_format {
 #define V4L2_PIX_FMT_Y6      v4l2_fourcc('Y', '0', '6', ' ') /*  6  Greyscale     */
 #define V4L2_PIX_FMT_Y10     v4l2_fourcc('Y', '1', '0', ' ') /* 10  Greyscale
*/
quoted
 #define V4L2_PIX_FMT_Y12     v4l2_fourcc('Y', '1', '2', ' ') /* 12  Greyscale
*/
quoted
+#define V4L2_PIX_FMT_Y012    v4l2_fourcc('Y', '0', '1', '2') /* 12  Greyscale
*/
quoted
 #define V4L2_PIX_FMT_Y14     v4l2_fourcc('Y', '1', '4', ' ') /* 14  Greyscale
*/
quoted
 #define V4L2_PIX_FMT_Y16     v4l2_fourcc('Y', '1', '6', ' ') /* 16  Greyscale
*/
quoted
 #define V4L2_PIX_FMT_Y16_BE  v4l2_fourcc_be('Y', '1', '6', ' ') /* 16
Greyscale BE  */
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help