From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 29279C61DA4 for ; Fri, 27 Jan 2023 14:37:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233507AbjA0Ohp (ORCPT ); Fri, 27 Jan 2023 09:37:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231629AbjA0Ohn (ORCPT ); Fri, 27 Jan 2023 09:37:43 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0F9E10AAF; Fri, 27 Jan 2023 06:37:37 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 52C85B82126; Fri, 27 Jan 2023 14:37:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0AE2C433D2; Fri, 27 Jan 2023 14:37:32 +0000 (UTC) Message-ID: <93c8ae69-c765-f88e-23c3-9c6b8cf67b40@xs4all.nl> Date: Fri, 27 Jan 2023 15:37:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 03/10] media: Add Y212 video format Content-Language: en-US To: Ming Qian , mchehab@kernel.org, mirela.rabulea@oss.nxp.com Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <9aa51224d2c37cca5f1283532cb99f3c8251b120.1671071730.git.ming.qian@nxp.com> From: Hans Verkuil In-Reply-To: <9aa51224d2c37cca5f1283532cb99f3c8251b120.1671071730.git.ming.qian@nxp.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/12/2022 04:11, Ming Qian wrote: > Y212 is a YUV format with 12-bits per component like YUYV, > 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 > --- > .../media/v4l/pixfmt-packed-yuv.rst | 42 +++++++++++++++++++ > drivers/media/v4l2-core/v4l2-common.c | 1 + > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > include/uapi/linux/videodev2.h | 1 + > 4 files changed, 45 insertions(+) > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst > index bf283a1b5581..39ded0b1e65c 100644 > --- a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst > +++ b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst > @@ -341,6 +341,48 @@ components horizontally by 2, storing 2 pixels in 4 bytes. > > \normalsize > > +The next lists the packed YUV 4:2:2 formats with more than 8 bits per component. > +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, > +arranged in little endian order. storing 2 pixels in 8 bytes. > + > +.. raw:: latex > + > + \footnotesize > + > +.. tabularcolumns:: |p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}| > + > +.. flat-table:: Packed YUV 4:2:2 Formats (more than 8bpc) > + :header-rows: 1 > + :stub-columns: 0 > + > + * - Identifier > + - Code > + - Byte 1-0 > + - Byte 3-2 > + - Byte 5-4 > + - Byte 7-6 > + - Byte 9-8 > + - Byte 11-10 > + - Byte 13-12 > + - Byte 15-14 > + * .. _V4L2-PIX-FMT-Y212: > + > + - ``V4L2_PIX_FMT_Y212`` > + - 'Y212' > + > + - Y'\ :sub:`0` > + - Cb\ :sub:`0` > + - Y'\ :sub:`1` > + - Cr\ :sub:`0` > + - Y'\ :sub:`2` > + - Cb\ :sub:`2` > + - Y'\ :sub:`3` > + - Cr\ :sub:`2` > + > +.. raw:: latex > + > + \normalsize > + > **Color Sample Location:** > Chroma samples are :ref:`interstitially sited` > horizontally. > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c > index a5e8ba370d33..21ace56fac04 100644 > --- a/drivers/media/v4l2-core/v4l2-common.c > +++ b/drivers/media/v4l2-core/v4l2-common.c > @@ -258,6 +258,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) > { .format = V4L2_PIX_FMT_YVYU, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > { .format = V4L2_PIX_FMT_UYVY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > { .format = V4L2_PIX_FMT_VYUY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > + { .format = V4L2_PIX_FMT_Y212, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > > /* YUV planar formats */ > { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index 0ee730aa6cc7..4d5f722b674a 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1342,6 +1342,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > case V4L2_PIX_FMT_YUV420: descr = "Planar YUV 4:2:0"; break; > case V4L2_PIX_FMT_HI240: descr = "8-bit Dithered RGB (BTTV)"; break; > case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break; > + case V4L2_PIX_FMT_Y212: descr = "12-bit Depth YUYV 4:2:2"; break; > case V4L2_PIX_FMT_NV12: descr = "Y/UV 4:2:0"; break; > case V4L2_PIX_FMT_NV21: descr = "Y/VU 4:2:0"; break; > case V4L2_PIX_FMT_NV16: descr = "Y/UV 4:2:2"; break; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index 3d8f89bff33c..b8a501dccfa4 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -618,6 +618,7 @@ struct v4l2_pix_format { > #define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A') /* 32 YUVA-8-8-8-8 */ > #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X') /* 32 YUVX-8-8-8-8 */ > #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ > +#define V4L2_PIX_FMT_Y212 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 12-bit per component */ This definitely needs to be renamed to prevent repeating the 'P010' mistake. It's a YUYV format, so perhaps: _YUYV_12? You definitely need to have 'YUYV' in the name in order to deal with different YUV orders. Regards, Hans > > /* two planes -- one Y, one Cr + Cb interleaved */ > #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 507F3C54EAA for ; Fri, 27 Jan 2023 14:38:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EsWr82gW5MDO9W8I1JlWZQJYusfRuY8rHca1roKuNOk=; b=KncDuyv54C8fWS 6quABy9e5ZBiRHGGR22fSLIKPVJPiFyZwKM/nT8Vp3BhPejM8rVRlFxyeiRSm6pGD0MDlvH6o4EIP PGK5M3TKUKeLZnVgFUWuuuGlUKgGriJqzkO+fgExPTW4DOrWlf2g3eV6U1VXxvl5/liKj0qMdPmRW PfxCGLAzbKDQG+9YxKCz/MF3J+zZJcuT19OlBGePssgC5cExhsItpdDDCi/9nvQ4JkvMHeRrQxUCw UssWqKKaKihKz/TEvKwKWaEUJQU+0B/QpcDMI3rogxX0pshiKXJnT8gR4mUC8EK4mZC+Xj/+pQYY4 navneqND7D0l8euGl7pA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLPrK-00FK50-IE; Fri, 27 Jan 2023 14:37:42 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pLPrF-00FK3p-K2 for linux-arm-kernel@lists.infradead.org; Fri, 27 Jan 2023 14:37:40 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 47F6AB82114; Fri, 27 Jan 2023 14:37:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0AE2C433D2; Fri, 27 Jan 2023 14:37:32 +0000 (UTC) Message-ID: <93c8ae69-c765-f88e-23c3-9c6b8cf67b40@xs4all.nl> Date: Fri, 27 Jan 2023 15:37:31 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH 03/10] media: Add Y212 video format Content-Language: en-US To: Ming Qian , mchehab@kernel.org, mirela.rabulea@oss.nxp.com Cc: shawnguo@kernel.org, s.hauer@pengutronix.de, kernel@pengutronix.de, festevam@gmail.com, xiahong.bao@nxp.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <9aa51224d2c37cca5f1283532cb99f3c8251b120.1671071730.git.ming.qian@nxp.com> From: Hans Verkuil In-Reply-To: <9aa51224d2c37cca5f1283532cb99f3c8251b120.1671071730.git.ming.qian@nxp.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230127_063737_969655_5732DBA9 X-CRM114-Status: GOOD ( 18.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 20/12/2022 04:11, Ming Qian wrote: > Y212 is a YUV format with 12-bits per component like YUYV, > 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 > --- > .../media/v4l/pixfmt-packed-yuv.rst | 42 +++++++++++++++++++ > drivers/media/v4l2-core/v4l2-common.c | 1 + > drivers/media/v4l2-core/v4l2-ioctl.c | 1 + > include/uapi/linux/videodev2.h | 1 + > 4 files changed, 45 insertions(+) > > diff --git a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst > index bf283a1b5581..39ded0b1e65c 100644 > --- a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst > +++ b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst > @@ -341,6 +341,48 @@ components horizontally by 2, storing 2 pixels in 4 bytes. > > \normalsize > > +The next lists the packed YUV 4:2:2 formats with more than 8 bits per component. > +expand the bits per component to 16 bits, data in the high bits, zeros in the low bits, > +arranged in little endian order. storing 2 pixels in 8 bytes. > + > +.. raw:: latex > + > + \footnotesize > + > +.. tabularcolumns:: |p{3.4cm}|p{1.2cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}|p{0.8cm}| > + > +.. flat-table:: Packed YUV 4:2:2 Formats (more than 8bpc) > + :header-rows: 1 > + :stub-columns: 0 > + > + * - Identifier > + - Code > + - Byte 1-0 > + - Byte 3-2 > + - Byte 5-4 > + - Byte 7-6 > + - Byte 9-8 > + - Byte 11-10 > + - Byte 13-12 > + - Byte 15-14 > + * .. _V4L2-PIX-FMT-Y212: > + > + - ``V4L2_PIX_FMT_Y212`` > + - 'Y212' > + > + - Y'\ :sub:`0` > + - Cb\ :sub:`0` > + - Y'\ :sub:`1` > + - Cr\ :sub:`0` > + - Y'\ :sub:`2` > + - Cb\ :sub:`2` > + - Y'\ :sub:`3` > + - Cr\ :sub:`2` > + > +.. raw:: latex > + > + \normalsize > + > **Color Sample Location:** > Chroma samples are :ref:`interstitially sited` > horizontally. > diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c > index a5e8ba370d33..21ace56fac04 100644 > --- a/drivers/media/v4l2-core/v4l2-common.c > +++ b/drivers/media/v4l2-core/v4l2-common.c > @@ -258,6 +258,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) > { .format = V4L2_PIX_FMT_YVYU, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > { .format = V4L2_PIX_FMT_UYVY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > { .format = V4L2_PIX_FMT_VYUY, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 2, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > + { .format = V4L2_PIX_FMT_Y212, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 4, 0, 0, 0 }, .hdiv = 2, .vdiv = 1 }, > > /* YUV planar formats */ > { .format = V4L2_PIX_FMT_NV12, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 2, .bpp = { 1, 2, 0, 0 }, .hdiv = 2, .vdiv = 2 }, > diff --git a/drivers/media/v4l2-core/v4l2-ioctl.c b/drivers/media/v4l2-core/v4l2-ioctl.c > index 0ee730aa6cc7..4d5f722b674a 100644 > --- a/drivers/media/v4l2-core/v4l2-ioctl.c > +++ b/drivers/media/v4l2-core/v4l2-ioctl.c > @@ -1342,6 +1342,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) > case V4L2_PIX_FMT_YUV420: descr = "Planar YUV 4:2:0"; break; > case V4L2_PIX_FMT_HI240: descr = "8-bit Dithered RGB (BTTV)"; break; > case V4L2_PIX_FMT_M420: descr = "YUV 4:2:0 (M420)"; break; > + case V4L2_PIX_FMT_Y212: descr = "12-bit Depth YUYV 4:2:2"; break; > case V4L2_PIX_FMT_NV12: descr = "Y/UV 4:2:0"; break; > case V4L2_PIX_FMT_NV21: descr = "Y/VU 4:2:0"; break; > case V4L2_PIX_FMT_NV16: descr = "Y/UV 4:2:2"; break; > diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h > index 3d8f89bff33c..b8a501dccfa4 100644 > --- a/include/uapi/linux/videodev2.h > +++ b/include/uapi/linux/videodev2.h > @@ -618,6 +618,7 @@ struct v4l2_pix_format { > #define V4L2_PIX_FMT_YUVA32 v4l2_fourcc('Y', 'U', 'V', 'A') /* 32 YUVA-8-8-8-8 */ > #define V4L2_PIX_FMT_YUVX32 v4l2_fourcc('Y', 'U', 'V', 'X') /* 32 YUVX-8-8-8-8 */ > #define V4L2_PIX_FMT_M420 v4l2_fourcc('M', '4', '2', '0') /* 12 YUV 4:2:0 2 lines y, 1 line uv interleaved */ > +#define V4L2_PIX_FMT_Y212 v4l2_fourcc('Y', '2', '1', '2') /* 32 YUYV 12-bit per component */ This definitely needs to be renamed to prevent repeating the 'P010' mistake. It's a YUYV format, so perhaps: _YUYV_12? You definitely need to have 'YUYV' in the name in order to deal with different YUV orders. Regards, Hans > > /* two planes -- one Y, one Cr + Cb interleaved */ > #define V4L2_PIX_FMT_NV12 v4l2_fourcc('N', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 */ _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel