Le lundi 13 février 2023 à 09:22 +0000, Ming Qian a écrit : > > From: Nicolas Dufresne <nicolas@xxxxxxxxxxxx> > > Sent: 2023年2月10日 23:18 > > To: Ming Qian <ming.qian@xxxxxxx>; mchehab@xxxxxxxxxx; Mirela Rabulea > > (OSS) <mirela.rabulea@xxxxxxxxxxx>; hverkuil-cisco@xxxxxxxxx > > Cc: shawnguo@xxxxxxxxxx; s.hauer@xxxxxxxxxxxxxx; kernel@xxxxxxxxxxxxxx; > > festevam@xxxxxxxxx; X.H. Bao <xiahong.bao@xxxxxxx>; dl-linux-imx <linux- > > imx@xxxxxxx>; linux-media@xxxxxxxxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx; > > devicetree@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx > > 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 : > > > 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@xxxxxxx> > > > --- > > > .../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? I see, I had missed this aspect. I think in this context, it would be fair naming. Maybe drop a note in the doc saying just that: "In contrast to V4L2_PIX_FMT_Y12 format, which have its padding located in the most significant bits of the 16 bit word". Or something similar., Nicolas > > Ming > > > > + > > > + - ``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) > > > 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 > > */ > > > #define V4L2_PIX_FMT_Y12 v4l2_fourcc('Y', '1', '2', ' ') /* 12 > > > Greyscale > > */ > > > +#define V4L2_PIX_FMT_Y012 v4l2_fourcc('Y', '0', '1', '2') /* 12 > > > Greyscale > > */ > > > #define V4L2_PIX_FMT_Y14 v4l2_fourcc('Y', '1', '4', ' ') /* 14 > > > Greyscale > > */ > > > #define V4L2_PIX_FMT_Y16 v4l2_fourcc('Y', '1', '6', ' ') /* 16 > > > Greyscale > > */ > > > #define V4L2_PIX_FMT_Y16_BE v4l2_fourcc_be('Y', '1', '6', ' ') /* 16 > > > Greyscale BE */ >