From patchwork Tue Dec 20 03:11:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13077475 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 42183C4332F for ; Tue, 20 Dec 2022 03:15:08 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ZQOIXWlyJWhVqDlOqtDnaFlX4Eo8o9b8kKJYRQVgMjA=; b=mL2H5V+RcJU3Tw YqwmeQgBmhL2UiI+oikYwILcoJaR+PT2MkGY3mUh/LcXvdf06k44BccpaauCV/9VjciwrqAJ5AWH8 gCwurlXpo3warwgnR89Z59WokzRN/FwEW5Qt6a9N6H2Zbztu00R9YY/VrKHa7du8OJdDY5kOW6oov sszXl+uOmvrN2D5EuYJacui4injhmgEPsOF31kRgqbwEI1v6EhU9f/TOxxT0Ro/tv/1nXthZETd2C alDCToH7S/9oys4O0oX0vDRwS97zqz72Lam4RzZ+4pwMZriN0I8cQSamz4F1yYRcf1J3cDyMBxaO2 v6unLSC1eOb1iv4fYiLQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7T4S-008Q1m-VO; Tue, 20 Dec 2022 03:13:37 +0000 Received: from mail-db5eur01on2078.outbound.protection.outlook.com ([40.107.15.78] helo=EUR01-DB5-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7T3V-008P2p-HZ for linux-arm-kernel@lists.infradead.org; Tue, 20 Dec 2022 03:12:39 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DXAnC2+WATAJH7gsaijFxSFj3wLC9XZqoABq2GlNmy3bgONJbJ+EjRdPjif9WkvtiPOyYIkLRi9jj+5PES0+mOPC6tCBAhe0VXAo99pSIuTTYOy90dgxyyW1oqeL9oapEeidT5rfGDNVkKDM1P8njs8gj2X+o3VQU6nDaY3W6ZKNEXpX+l/eWlSZkTjXIBCGJsgMHsQhtClOhrBb+G0xLExk5RwpjoipUHYzdbxI7/Zctfg/1qALa838j77OkRxIEobS1EVokPzPROdKDfX/6r0dyOLForroljumWjs1xPtjX12PzeTzdv7brnvfU75UXgJy/gFWzJTwuN3WpWBEIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=j1u/CtgyVahT0gjIMbS8n7n0jcnPnAKWt2rMh7vAtAE=; b=d5b20DGZVdW686Vmnozqm7C5ZqwE1xwhGswXKKyGH+XCqejTgGF6QoiD0bGrmilMsaSczlelAnMAUknlNaDhrJTH5hy1YwDfleA3GU+++sCy4mvsyf9ZwQp3noD/PfL6Ug+TMJRjoKNRhY7SRIyP2WaKAZZMCj6GnPwzw7Nfe6YRpmBI6Rdse/y9x12dJN5jZ1DnVwCSjOZWygPymXb0Cj411XQ3OIMGaz2QZT2hJ2ZunOEfUo6tStmJ8SlFt80bh+qnYD79TZa6nQ80OGxQ79uICrOheFHGzrDFgqmiFp5sJ6iB0jqSwgj1b9T8jZeFOBv2vRPR/WtNN+deJiyzwg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=j1u/CtgyVahT0gjIMbS8n7n0jcnPnAKWt2rMh7vAtAE=; b=lFRsbhUFrDnbHVUkcjAK4mZQd6pklywak7f8GXWfDtH+XaFT5VEL95P2QVFtF9ROgVzkRxP/htrJD+5Whqmh8GDpIrM4bilrEVd3UFkzhL61AzH5LP4xv4Z0RQ/fF36b1mpxAGIVTYucotFpmgK9dqCzgvOxwBDO75yRLZE99Hs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AS1PR04MB9405.eurprd04.prod.outlook.com (2603:10a6:20b:4db::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5924.16; Tue, 20 Dec 2022 03:12:28 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::3a82:42b3:f1ed:5c3d%7]) with mapi id 15.20.5924.016; Tue, 20 Dec 2022 03:12:28 +0000 From: Ming Qian To: mchehab@kernel.org, mirela.rabulea@oss.nxp.com, hverkuil-cisco@xs4all.nl 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 Subject: [PATCH 03/10] media: Add Y212 video format Date: Tue, 20 Dec 2022 11:11:33 +0800 Message-Id: <9aa51224d2c37cca5f1283532cb99f3c8251b120.1671071730.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: X-ClientProxiedBy: SI2PR04CA0014.apcprd04.prod.outlook.com (2603:1096:4:197::18) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM6PR04MB6341:EE_|AS1PR04MB9405:EE_ X-MS-Office365-Filtering-Correlation-Id: 7711a01d-6501-417f-ff79-08dae2380648 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yU8bR/rgoZVSltYs3FlavW4Ug83177D7SaWxuNFHBbtNFdrJ+z9c7f5M8tOfd5dc7p+1NDQInfY23IEygHiCJP0DU7bE+DpAYjeeHY/WYImZaJpSfBABJyTtuo3KsMI8tTPNkCQk/WVhqnuh/YivIec9eICBAHBk7DpEuvMbe3Teeg5lqPZYX5AdAVgBbiLlmlzXcfL3VF4pvOFqLDQ20hKWlA11G7EQKRTNcGXWFvgFyZLF0ZX3nKKMzH88XiK2RI1m8CAfsS0AzGwISUZMNohwxI3LOtwHs9HktgvSfYexqeMq9m6Anqxx3Pff0s9XnwExzLuociJaOMVBqfQLvf1FA9SXL/5D8w7jDFBX8W1PP5+s7W0VvM1dRkbmu0nkA4GBHxWnmyaazHaPPCpWQqmckkFC0YSJxyakiWtYESGVUcItSrUIsSqhg9fgK0NFXyV/41qXY94pPiHR3XQ/gNaBryOkXSrgW8xA2WzW7HC6GgJ4+zAVRMmvptCnIumEzdTWs/Pqq4PzJmXh5nDtWbNLd4CBhn8I4INPj58UBr4T5fUDA/TV9qzIFkHqCnYEJtEuFQDc9dd8KRMUAhdXmEz8oJxzLTjNrqur/WTkuyTUmmV49xv+tAa7nAabpE7lC453EWhMv/DGCoU3DgnKRTw9d9nMl3McNHP8tSO9743vkuglUtx/235risNmeIgp X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM6PR04MB6341.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(4636009)(136003)(376002)(396003)(366004)(39860400002)(346002)(451199015)(36756003)(86362001)(478600001)(316002)(6486002)(66476007)(8676002)(52116002)(7416002)(2906002)(6666004)(5660300002)(44832011)(66946007)(41300700001)(8936002)(66556008)(4326008)(6506007)(38100700002)(26005)(38350700002)(6512007)(186003)(83380400001)(2616005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: L3j/hr7XY15z/NcD4DC5i5T5voRGIrlZVAr5ix/gJx7p6c14AeAoDrK3l1k7X4zIBWMHVRZB0P/il00Ec8Kg2E33pJ8AglVnRV2EzX36C5ztX33L7sk14PcEqUxOnSE4I9ePu131x+Kr5EEYui5Z90xktSs3iNbKfjsG9wgRrIEB4yvFDaMpIz/xVaYzz7fNdMjeJAoaArgYb5RELD69eI8xbn21qlzkdlYRXYPRrZ9cpzEy9mcROoEOThdvK7Mu3jn/w0RJfIxUuo9uGgTAHnJ7c0EI+EVd46Juqy8mit/3Egm93zHqro6z8lNFDK200g3VQreWv7jYpayyx49Dmm5v56DZwPRotTeiQQPpSaCqDxwVztFi0lHWKzeoAsp54p4WEeFGITzezC/uo9OGrXi636W+6zFLjg0Nm4S2rwwezq2sZtODkf8UOIzBSCRvNKcres/I/7vqeKx2OIGEzQbSSv3f9m4365dTLlxW/Oi4uWMSJTR3ws3zkaeEbJNFJP7QEVXsg8ZomiB0ID82jVJ2ioR8/XD9xoPi3OuN5AIYL6AJ/V379UNKvzGkQXqhL2kJc+DkmfWVGd4gAiAMgYtvKyLkso4cyojlRufxxcIYXyH4wMoVxTJfiUBxWsPEiD4u9Xwc0eV5vVSArFL2WotI9CH0lF6R/kTcM/gybRWIaLIqftfxa3QaVx+jya17N2fAwiCXEQtwCopmwqjkv3wUO3PijSQw26PzsoJ9QJw441enSDCH48KSXxboyrGHncfH4Fn3GThKIl0eDvWBqUNKpbFU34/LezLvA9m8h9YzPbrNUzS557br3TZjv+0xZWrAz/F3w6JLpRa6jX4m8jESvdBk9Budrx8zRFJkcqUUPWf91HJ1uwh40yWH1sZMqLDYzzhHFHulvi+HxzHVTAqKyxUbPGw7ByS3TgOWXp9JHNVp3WfUIxS9SSvoOhEN8aKmzva0N4/LniOSpK4jLao9K0pqQr4KDXn8iZAofCS+jO/8V4s/igPd0NoMnLZ1z+oQPj+QVcIYjRRQ+YfRjUSq2rClRW5pRbx7ZYImW193dwACWHuDYtgwmM2nSrfsLJC+Jnt+TvqTEDBE/ejcsgB1d6chbHkgPhDOXBfqrXe1jRIWCH21Xhh1vBZn8oyUxgKRgZfxvidSNezlSxp/0Z0A6k2+8EI7OUea4Nczgh4VMAcrnbEenpRSH64wU+55vrd6QrlSyaOiUv46RUPjB7wEA/jH5hHSDH8HcRmJ2Jw0s/hCgagzuC9OTzsAU8KC1h/6K32glVNBGzLDFY1xGnNIzHEIt4N0vZWrH1lE3FNNdVriBN1uGPLAo+PEkXclodWYUdYu/P0Wqd6D/bpbhRTVQjaoHHXMimCAHxiRwhsTtL6A2hFoIJ5Hc+PQ9TPyQoLineP869L3H5gvQ3U+Dzch0qwp1NlcDeLmOnlG/QLxtPSRYQZqgi9223u5oPMshTOC3iBLndvGrOtLM3T20dYYNhnANAhpLALuR0D1F9FErUBN31hCW+zLtFqtStZkl/JPyc/som4dEZLyE9hLUEsdqcXByUbYnSLjUISsUfTxeRdNdleruVdRf2zZ9Pil X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7711a01d-6501-417f-ff79-08dae2380648 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:27.9870 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: DDQ2cUueE98FKIn8KXj4MC8B7BgIqty21EpftyF8/erZyZCAlCf/f5dmYnuFHcjG3n1ZIpkEh+2xUNxtPTnJeA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221219_191237_703476_19D1C0CC X-CRM114-Status: GOOD ( 11.38 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 */ /* 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 */