From patchwork Tue Dec 20 03:11:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 13077477 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 A1427C4332F for ; Tue, 20 Dec 2022 03:16:02 +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=oo3IxMkV2A2O0mBlsokk/8ofACMUkgsMpwRMShzeHZk=; b=DZYPG7NRbY1lqh nXbpZmbn2VzzL0K4Kl8oh94weaqtGYtTCw5BveDW5Ub0yRyI7S8wEFqd8bYD00B9hxjvFRwRdhk5E 6f7rqJURMs0lftDIr6K8kIi08cViknSNFDVmyxF/ugPFXCB4I04bRvU2X8Td3ByoC8F7dDeDSkDoc wW25XY6FDG7GeOFItCIoxU8hcdkuwdeweJl7Qvaw/4gvFiUgLhuYEDlr0KlCZOGtaRzv0pYjTPZlv IBiEfS8d9vOj80LU+8rg5z49RIWZqAe8418YsCF8XVm+t4OVq5uwmcIoXb6n4OvYrrAW279MPXUVs wtEOYPht1aTHCfPU8MAw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p7T5U-008Qik-PN; Tue, 20 Dec 2022 03:14:41 +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 1p7T3Y-008P2p-AK for linux-arm-kernel@lists.infradead.org; Tue, 20 Dec 2022 03:12:42 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=U5YKTnaijjJHvzQbKtAKmfL1aqMD5xNLPVozRD6bKSDDzzgbf555hyZj5niqjtbjza1/EuM/wVF55Arh4HmhjyTcuUhkzbMuIoMMV26NnTryYPa3qPhFGysVTr1p3Q7cZPN2VyRuvQPfgy5XITnPH0h4VUmnadZxHJs9JDaec4XgXvaFfH++wok5A6cu5hog5ewdBdiFGVmcZGXcKJZnpAZT4qHx/79O8KFwoMq6oQZ8smiaxL/URXqAUpWoYIflLa0lX0fH2ZSmL0sVEoaQNQCqPxtEeCSuvrRddZRpcXMVbwX7s2kbtb4FpFXyeqpzOoxiBAiwoaaxMdiNdwFVEA== 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=/UIH+RRI67kjol9AqivPlGAMCEzoyQR92GRQaOICDhQ=; b=QGuUiew8JVvW+W9TGBMwH0s3w9kS3p0SLD5R9lG8nc5hAmwl2ZudyjUW3uWxHZCmJ8wxJioauJXEzbHq+xGUNHSzCIRrVuQSYCPdof8wC2vK3QvwbXyQAE9u+rD5g8/vcVgA0GhSZFN2BQmswvxuN1Q7XiFkh2yEClA7XndUoomICvJC7cl09Q4wKiU/XyH+WwPHLy50+7OmFXKK13ghUE0p71pbcGXSwIRNZ/np4dg/LOyT2E8u/dGlznzCzUmGUlZzZ1inojhMdR9mm141ojfib4VsB4fL8WN29WcGVBrGZQfGMI5wwehjppjwXQ1pBdPE4jEl1YMrf4xAxjpw7A== 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=/UIH+RRI67kjol9AqivPlGAMCEzoyQR92GRQaOICDhQ=; b=QCDncQ+a2+MML84yv0HJFfaBT6bitEZXvb9gRTKZfq/qszqigMhrFYs3QMLw4iMeExZZEF75X1M8VeWEfEmE55l0yOcQ0lNl72Eil2YW70uG7SzUIivZoYgef80HuuKjv+tCBnTKnkTxtAfk1IWz+o/FSEPeu9E9j5YOYHfcbjA= 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:32 +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:32 +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 04/10] media: Add Y312 video format Date: Tue, 20 Dec 2022 11:11:34 +0800 Message-Id: <4eb46df4bb84da00560c6c757cd661a1d00e76fb.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: 8b521f06-af78-47ba-77ef-08dae23808b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qkEaV+rhwwFMmhbvZ/uYURT/O7mZ0qzpq1E1tYWCxZy7HVPRUNY+h5sEqp9nwNuPzkpoOHX42pU1KCEiBDOF+3PGFxQIORbNf9m/6FWQx0NhWDVdaotlluSQA8uchI2NMpTkwpicmsIMYGC92xMYctZiA7kGzfVBCWZCc6wdqwQBv1TxIYsq9dWp/FwwAA0XtFFVdtcilWa3GHFA+WTRMOhiw8rmCralDgd3b3XUCW5KrTCLevPaGQSqFK2qcnyxh9J2KHhPAXgdYPsBVPHWFIW53b9b7uZmUKdOPgIHFSRgLYZFXrZeqsKnXdKzkVuvcRs7uzL/oNpoiBRCeDyj1jIOqF9nf9WyglYKE2/BSoe7MgNZCVL9UNtpq1bpGxzNcoGXfs4W0gJVY433qo3BMfgIvmcfumPnNKHoVPf+2kjv/qBqYc8lQ1EKq62B0wJDeQbQ+gNqu8hyudx3KOnn9VNq3qh98MOgxQ0oDJncNfBmAaMdyxbgnLa7/tUrxh3y0kUPp19x0tuQib3WPYUTP1tHdSnyNSRJrLzyGccjY/q0iopR5s6ZHaImsQ/3/4LFGq0bFXZRJgxgVERFGYLqwW2fI9sQdfO9qvBFrDRWFoc5+VHW4RdD68siC9bwjxij2KbZqFDLtqT7E2VFF/3pEJ9Fko2DoGcPCEFXl1MdDY5rG+VK9pkyoog6r7dpixoB 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)(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: KnAuoOLLSJmw/2un7rTK0SNhz90LZnauOCZQEZGzp/qFIWzoga2ypUJGMpqtZh535Vk6c7JEm3T4xrEIxeKvAjZ1MwQyWAwd9XzLCQAUXio6OicslZFnmmB0wrU99UXcuPvmp4w9kb2yqs6hfSdelZ2xeETlDDGz0bmCATrHivfDFC5gkUnsoJ4Xd1iB6tv5I20R391N/OvXaoU2ypuA0bZe6AVJ/due6A6fICKgPXEo9z2rCplH6joD+R/1nniHaY4CDLcTABkQwdQfk1W8/Ng8Wr7az5UNOxRMrVThNPEpmBza2SDp7KgydJaIsXFuJ7Nzz76Gv0zpLTOcnTubfwWpvRcRCXTfzW689RcW0SD1oad0qqikRSGndcdIhX8frlWntunaqOhQUGZ2KJTQE5nrBmHoVd7xPGus68wjDEE1fHpNP+rlXlbXYjsPSW7FqqFIvl3hf6U255AsmaaFC8ZQGp05bJL+4416ghBCHZNx75wNCxdZNJXc8NVxsMb6zLS9Sq8EaIZXo6YDi/I18I20EvyVMv9WMoEANnZvaneuBUMde2g2m5NLRNLy+Vz3xksvy/XDvU1CS3bPVBvkb7ZUeSoFUFP0COg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change-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Dec 2022 03:12:31.9868 (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: IoCDAY/i5fvN+Rc7D9Gr0NqY1xZyVoMyNhzG4l4KzpslG9Iypa20O2fUckDItmjy9oxyXwLOS95GcYB1QN5YcQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS1PR04MB9405 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221219_191240_411158_D33A552F X-CRM114-Status: GOOD ( 12.85 ) 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 Y312 is a YUV format with 12-bits per component like YUV24, 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 | 28 +++++++++++++++++++ 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, 31 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst index 39ded0b1e65c..a91c30ba6b73 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-packed-yuv.rst @@ -257,6 +257,34 @@ the second byte and Y'\ :sub:`7-0` in the third byte. - The padding bits contain undefined values that must be ignored by all applications and drivers. +The next lists the packed YUV 4:4:4 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 1 pixels in 6 bytes. + +.. flat-table:: Packed YUV 4:4:4 Image 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 + + * .. _V4L2-PIX-FMT-Y312: + + - ``V4L2_PIX_FMT_Y312`` + - 'Y312' + + - Y'\ :sub:`0` + - Cb\ :sub:`0` + - Cr\ :sub:`0` + - Y'\ :sub:`1` + - Cb\ :sub:`1` + - Cr\ :sub:`1` 4:2:2 Subsampling ================= diff --git a/drivers/media/v4l2-core/v4l2-common.c b/drivers/media/v4l2-core/v4l2-common.c index 21ace56fac04..332d4b11bc1b 100644 --- a/drivers/media/v4l2-core/v4l2-common.c +++ b/drivers/media/v4l2-core/v4l2-common.c @@ -259,6 +259,7 @@ const struct v4l2_format_info *v4l2_format_info(u32 format) { .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 }, + { .format = V4L2_PIX_FMT_Y312, .pixel_enc = V4L2_PIXEL_ENC_YUV, .mem_planes = 1, .comp_planes = 1, .bpp = { 6, 0, 0, 0 }, .hdiv = 1, .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 4d5f722b674a..5b97d7e5dbbf 100644 --- a/drivers/media/v4l2-core/v4l2-ioctl.c +++ b/drivers/media/v4l2-core/v4l2-ioctl.c @@ -1343,6 +1343,7 @@ static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt) 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_Y312: descr = "12-bit Depth YUV 4:4:4"; 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 b8a501dccfa4..3475331737af 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -619,6 +619,7 @@ struct v4l2_pix_format { #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 */ +#define V4L2_PIX_FMT_Y312 v4l2_fourcc('Y', '3', '1', '2') /* 48 YUV 4:4:4 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 */