From patchwork Fri Jan 27 15:34:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cox X-Patchwork-Id: 648445 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 1EDBBC61DA3 for ; Fri, 27 Jan 2023 15:34:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232525AbjA0Pez (ORCPT ); Fri, 27 Jan 2023 10:34:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32836 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234616AbjA0Pey (ORCPT ); Fri, 27 Jan 2023 10:34:54 -0500 Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0FCF68000A for ; Fri, 27 Jan 2023 07:34:53 -0800 (PST) Received: by mail-wr1-x432.google.com with SMTP id y1so5331428wru.2 for ; Fri, 27 Jan 2023 07:34:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kynesim-co-uk.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fUcnfXGHq8wlQsbMjwF+ih7GicQCSKVDP7TPdHU7uoc=; b=iKyoXCAyEXSEz3N4u0taPPHPbNxdlms57CIJlJ5yHAkBgU9QGbgaq8tNCwle7Di3uQ /pQ6UXSujtvSuTDHdmDKrU1cQUbH59bKEg/+MvOVmmFq7g4fIHiCobG3FfbvmHshV9CS IiBymksAzhM/ge6cu24oOl1PclIC2PaDNlhNDVi7Dt3kkd68qFpVpMw7JGXhjixXZFo5 JsKCXm8cguZv8QLgTHMqw2BSH9ExQAgHOqgRlsL30wqiqNJi3oCCvdqnfWacoAZofXpL +IcJMPMjaT+JQzr3BGhJOJRcck35gXRutkFKt5b3/BShH5qrUC19oB8tAq/sZNS7iT8D MpZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fUcnfXGHq8wlQsbMjwF+ih7GicQCSKVDP7TPdHU7uoc=; b=t9mAfP+ngwQOq4Jfdc/8g1CWxqBwc7RkJLnYFgoDv7ECsEwKz1h9DmHnawiYJVv/gP HGmhON+rfFY+bj2AL6HBG45sb3+SYFeKyq4MTv30pQKpkdZ7qmY2fenPjiM39EGXEG1v 4ps4wa+d1wuaiiFjIiuGnjgZKFVIcW4CTcPfK1RqpAUOcmJZvuyrozDGWNS106DEeKgu xA7VGEmDtUwgT6r+THOrw34doB/REXhGZ3B8KSQSpyNRnwgSYoH38xN5m1DwgobQAnjA KO9AgjSVgIqBJg+75DlQIrzGpHvqWABvYZGDfV6t7yEUzvUikIHPpFe2A005vVgcgpRX o6Ng== X-Gm-Message-State: AFqh2kqneT2BIyp3UwFZmH3ozNUjWsa+LaWRQo8LYeQiqOnJ4yTu6VyE yItdydgnuC10Bf2JOKS5e3S5PSgBMW9q8Y9Hkyg= X-Google-Smtp-Source: AMrXdXvkZR+zykfgLNGFLg/eYbbNFMxGo0PO9BrLskzPFzsgzfV0ky8d5ri4LXRu7EtFklrlvpjmKA== X-Received: by 2002:a5d:5b21:0:b0:2bf:9628:b21f with SMTP id bx33-20020a5d5b21000000b002bf9628b21fmr25581735wrb.59.1674833691295; Fri, 27 Jan 2023 07:34:51 -0800 (PST) Received: from sucnaath.outer.uphall.net (cpc1-cmbg20-2-0-cust759.5-4.cable.virginm.net. [86.21.218.248]) by smtp.gmail.com with ESMTPSA id z14-20020a5d4d0e000000b002bde537721dsm4231826wrt.20.2023.01.27.07.34.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 07:34:50 -0800 (PST) From: John Cox To: linux-media@vger.kernel.org Cc: hverkuil-cisco@xs4all.nl, John Cox Subject: [PATCH 1/2] media: v4l: Add Broadcom sand formats to videodev2.h Date: Fri, 27 Jan 2023 15:34:14 +0000 Message-Id: <20230127153415.83126-2-jc@kynesim.co.uk> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230127153415.83126-1-jc@kynesim.co.uk> References: <20230127153415.83126-1-jc@kynesim.co.uk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add fourccs for Broadcom 8 and 10-bit packed 128 byte column formats to videodev2.h Signed-off-by: John Cox --- include/uapi/linux/videodev2.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/uapi/linux/videodev2.h b/include/uapi/linux/videodev2.h index 1befd181a4cc..a836322ae5d8 100644 --- a/include/uapi/linux/videodev2.h +++ b/include/uapi/linux/videodev2.h @@ -656,6 +656,8 @@ struct v4l2_pix_format { #define V4L2_PIX_FMT_P010_4L4 v4l2_fourcc('T', '0', '1', '0') /* 12 Y/CbCr 4:2:0 10-bit 4x4 macroblocks */ #define V4L2_PIX_FMT_NV12_8L128 v4l2_fourcc('A', 'T', '1', '2') /* Y/CbCr 4:2:0 8x128 tiles */ #define V4L2_PIX_FMT_NV12_10BE_8L128 v4l2_fourcc_be('A', 'X', '1', '2') /* Y/CbCr 4:2:0 10-bit 8x128 tiles */ +#define V4L2_PIX_FMT_NV12_C128 v4l2_fourcc('C', 'N', '1', '2') /* Y/CbCr 4:2:0 128 byte columns */ +#define V4L2_PIX_FMT_P030_C128 v4l2_fourcc('C', 'N', '3', '0') /* Y/CbCr 4:2:0 10-bit packed 128 byte columns */ /* Tiled YUV formats, non contiguous planes */ #define V4L2_PIX_FMT_NV12MT v4l2_fourcc('T', 'M', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 tiles */ From patchwork Fri Jan 27 15:34:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Cox X-Patchwork-Id: 648444 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 B80EEC61DB3 for ; Fri, 27 Jan 2023 15:34:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234130AbjA0Pe5 (ORCPT ); Fri, 27 Jan 2023 10:34:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32842 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232364AbjA0Pez (ORCPT ); Fri, 27 Jan 2023 10:34:55 -0500 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4C0F7FA3C for ; Fri, 27 Jan 2023 07:34:53 -0800 (PST) Received: by mail-wr1-x434.google.com with SMTP id m14so4849267wrg.13 for ; Fri, 27 Jan 2023 07:34:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kynesim-co-uk.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fM6XpDLHZ2dNg83duhBIk1CD6AVxANzisyiUMXm/+bs=; b=Xe7PcHDRv7LUSLIHHwuRnTXw5KY1RYHRvX2GDGb2YhyJ9K98IouQWUZd6ERzlzMdNl aQCl6QRVJRCaT9cqsovNcfY1WL8aF0sIlsZa6Y+cvxLQsnsmySWd9y9QoyyQXxfdsSS8 dAymtS4LrOxIvMc+iPvxyRRJ1dHWioKVa7WpiqmXfq7TsRM96ESZ9CMqSuf5zetavWC6 lB/XfpbJF6rbYKuEIOLA8bk7oGobommt6fXPfypS7fQeKOT9iDCB5HGCMBY4R0+J4sKO LKydy5TZkSELdr/bN2LVkQpPjejXfxYOlWqPeFjQLIaCzjsl4WA1zK3YRrepss/6rH8k VIpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fM6XpDLHZ2dNg83duhBIk1CD6AVxANzisyiUMXm/+bs=; b=k0VDI5jx3qUisIccZ2C9v6L/HHYyVnOz+zTyOrkkNeQ3pNM4dvssTvEYaWyD1aau8I IOlxnHFySYburAEGVMNRvezaf88M+kwXv0FCohgjHQt35cMIQb5ByeyIa+pnHB7ZGcwC mKZxg+EPnXU+pEfpouIM58zhY7aaZbdEdBW2F29xE99NApQNy39c9S5VqeiF+UR5Pg4i 4lv4Spl77j7RDP9iBeSQo0oUXYExXr+zKPJZfRIp8jWVZtp01U1dZiQL9zTmSy83tM8F LcC/YQwopIi2zb4RFyA0Kiesvy0n8pRlzS3HkNOAuWsXGY11LJcS88vBIe39E2PAKiiY MWQg== X-Gm-Message-State: AFqh2kop7VgqEaHIDlV43tPY0I40qp7AriaV+shu83c1nFqrK0NWTlJn uWWd+ZldCETvtPI9CwgJuxbQsNBE2q6VoxkkWFA= X-Google-Smtp-Source: AMrXdXus5KHW0y8tDyWnC/1Jhfbzbc5xXxiEvDBSyuxdC5SddQ8wLQ4z8Pw3W0YsOQu1wN4FSOM6kQ== X-Received: by 2002:adf:f950:0:b0:2bd:fb81:6317 with SMTP id q16-20020adff950000000b002bdfb816317mr31134623wrr.33.1674833692111; Fri, 27 Jan 2023 07:34:52 -0800 (PST) Received: from sucnaath.outer.uphall.net (cpc1-cmbg20-2-0-cust759.5-4.cable.virginm.net. [86.21.218.248]) by smtp.gmail.com with ESMTPSA id z14-20020a5d4d0e000000b002bde537721dsm4231826wrt.20.2023.01.27.07.34.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Jan 2023 07:34:51 -0800 (PST) From: John Cox To: linux-media@vger.kernel.org Cc: hverkuil-cisco@xs4all.nl, John Cox Subject: [PATCH 2/2] media: v4l: Add documentation for Broadcom sand formats Date: Fri, 27 Jan 2023 15:34:15 +0000 Message-Id: <20230127153415.83126-3-jc@kynesim.co.uk> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230127153415.83126-1-jc@kynesim.co.uk> References: <20230127153415.83126-1-jc@kynesim.co.uk> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org Add documentation for for the Broadcom sand formats to pixfmt-yuv-planar. Signed-off-by: John Cox --- .../media/v4l/pixfmt-yuv-planar.rst | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) diff --git a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst index f1d5bb7b806d..c1dd0856f497 100644 --- a/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst +++ b/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst @@ -123,6 +123,20 @@ All components are stored with the same number of bits per component. - Cb, Cr - Yes - 4x4 tiles + * - V4L2_PIX_FMT_NV12_C128 + - 'CN12' + - 8 + - 4:2:0 + - Cb, Cr + - Yes + - 128 byte columns + * - V4L2_PIX_FMT_P030_C128 + - 'CN30' + - 10 + - 4:2:0 + - Cb, Cr + - Yes + - 128 byte columns * - V4L2_PIX_FMT_NV16 - 'NV16' - 8 @@ -277,6 +291,8 @@ of the luma plane. .. _V4L2-PIX-FMT-NV12M-10BE-8L128: .. _V4L2-PIX-FMT-NV12-10BE-8L128: .. _V4L2-PIX-FMT-MM21: +.. _V4L2-PIX-FMT-NV12-C128: +.. _V4L2-PIX-FMT-P030-C128: Tiled NV12 ---------- @@ -364,6 +380,182 @@ two non-contiguous planes. Example V4L2_PIX_FMT_NV12MT memory layout of tiles +``V4L2_PIX_FMT_NV21_C128`` store 8 bit luma and chroma data in 128 byte +columns. Chroma data follows luma in each column. Height, which must be +a multiple of 2 (h in the table below) determines the offset to the start +of chroma data. Overall (luma + chroma) +column height (ch in the table below) is also required and this is obtained +by dividing the sizeimage by bytesperline. bytesperline is width rounded up +to the next multiple of the column width (128). + +.. flat-table:: + :header-rows: 0 + :stub-columns: 0 + :widths: 15 10 10 10 10 4 10 10 10 10 + + * - start + 0: + - Y'\ :sub:`0,0` + - Y'\ :sub:`0,1` + - Y'\ :sub:`0,2` + - Y'\ :sub:`0,3` + - ... + - Y'\ :sub:`0,124` + - Y'\ :sub:`0,125` + - Y'\ :sub:`0,126` + - Y'\ :sub:`0,127` + * - start + 128: + - Y'\ :sub:`1,0` + - Y'\ :sub:`1,1` + - Y'\ :sub:`1,2` + - Y'\ :sub:`1,3` + - ... + - Y'\ :sub:`1,124` + - Y'\ :sub:`1,125` + - Y'\ :sub:`1,126` + - Y'\ :sub:`1,127` + * - start + 256: + - Y'\ :sub:`2,0` + - Y'\ :sub:`2,1` + - Y'\ :sub:`2,2` + - Y'\ :sub:`2,3` + - ... + - Y'\ :sub:`2,124` + - Y'\ :sub:`2,125` + - Y'\ :sub:`2,126` + - Y'\ :sub:`2,127` + * - ... + - ... + - ... + - ... + - ... + - ... + - ... + - ... + * - start + ((h-1) * 128): + - Y'\ :sub:`h-1,0` + - Y'\ :sub:`h-1,1` + - Y'\ :sub:`h-1,2` + - Y'\ :sub:`h-1,3` + - ... + - Y'\ :sub:`h-1,124` + - Y'\ :sub:`h-1,125` + - Y'\ :sub:`h-1,126` + - Y'\ :sub:`h-1,127` + * - start + ((h) * 128): + - Cb\ :sub:`0,0` + - Cr\ :sub:`0,0` + - Cb\ :sub:`0,1` + - Cr\ :sub:`0,1` + - ... + - Cb\ :sub:`0,62` + - Cr\ :sub:`0,62` + - Cb\ :sub:`0,63` + - Cr\ :sub:`0,63` + * - start + ((h+1) * 128): + - Cb\ :sub:`1,0` + - Cr\ :sub:`1,0` + - Cb\ :sub:`1,1` + - Cr\ :sub:`1,1` + - ... + - Cb\ :sub:`1,62` + - Cr\ :sub:`1,62` + - Cb\ :sub:`1,63` + - Cr\ :sub:`1,63` + * - ... + - ... + - ... + - ... + - ... + - ... + - ... + - ... + * - start + ((h+(h/2)-1) * 128): + - Cb\ :sub:`(h/2)-1,0` + - Cr\ :sub:`(h/2)-1,0` + - Cb\ :sub:`(h/2)-1,1` + - Cr\ :sub:`(h/2)-1,1` + - ... + - Cb\ :sub:`(h/2)-1,62` + - Cr\ :sub:`(h/2)-1,62` + - Cb\ :sub:`(h/2)-1,63` + - Cr\ :sub:`(h/2)-1,63` + * - start + (ch * 128): + - Y'\ :sub:`0,128` + - Y'\ :sub:`0,129` + - Y'\ :sub:`0,130` + - Y'\ :sub:`0,131` + - ... + - Y'\ :sub:`0,252` + - Y'\ :sub:`0,253` + - Y'\ :sub:`0,254` + - Y'\ :sub:`0,255` + * - ... + - ... + - ... + - ... + - ... + - ... + - ... + - ... + +``V4L2_PIX_FMT_P030_C128`` uses the same 128 byte column structure as +``V4L2_PIX_FMT_NV12_C128``, but encodes 10-bit YUV. +3 10-bit values are packed into 4 bytes as bits 9:0, 19:10, and 29:20, with +bits 30 & 31 unused. For the luma plane, bits 9:0 are Y0, 19:10 are Y1, and +29:20 are Y2. For the chroma plane the samples always come in pairs of Cr +and Cb, so it needs to be considered 6 values packed in 8 bytes. bytesperline +is ((width + 95)/96)*128 + +Bit-packed representation - Luma: + +.. flat-table:: + :header-rows: 1 + :stub-columns: 0 + + * - byte + - value(s) + * - 0 + - Y'\ :sub:`00[7:0]` + * - 1 + - Y'\ :sub:`01[5:0]`\ (bits 7--2) + - Y'\ :sub:`00[9:8]`\ (bits 1--0) + * - 2 + - Y'\ :sub:`02[3:0]`\ (bits 7--4) + - Y'\ :sub:`01[9:6]`\ (bits 3--0) + * - 3 + - unused (bits 7--6) + - Y'\ :sub:`02[9:4]`\ (bits 5--0) + +Bit-packed representation - Chroma: + +.. flat-table:: + :header-rows: 1 + :stub-columns: 0 + + * - byte + - value(s) + * - 0 + - Cb\ :sub:`00[7:0]` + * - 1 + - Cr\ :sub:`00[5:0]`\ (bits 7--2) + - Cb\ :sub:`00[9:8]`\ (bits 1--0) + * - 2 + - Cb\ :sub:`01[3:0]`\ (bits 7--4) + - Cr\ :sub:`00[9:6]`\ (bits 3--0) + * - 3 + - unused (bits 7--6) + - Cb\ :sub:`02[9:4]`\ (bits 5--0) + * - 4 + - Cr\ :sub:`01[7:0]` + * - 5 + - Cb\ :sub:`02[5:0]`\ (bits 7--2) + - Cr\ :sub:`01[9:8]`\ (bits 1--0) + * - 6 + - Cr\ :sub:`02[3:0]`\ (bits 7--4) + - Cb\ :sub:`02[9:6]`\ (bits 3--0) + * - 7 + - unused (bits 7--6) + - Cr\ :sub:`02[9:4]`\ (bits 5--0) .. _V4L2-PIX-FMT-NV16: .. _V4L2-PIX-FMT-NV61: