media: v4l2: Add NV15 and NV20 pixel formats

Add NV15 and NV20 pixel formats used by the Rockchip Video Decoder for
10-bit buffers.

NV15 and NV20 is 10-bit 4:2:0/4:2:2 semi-planar YUV formats similar to
NV12 and NV16, using 10-bit components with no padding between each
component. Instead, a group of 4 luminance/chrominance samples are
stored over 5 bytes in little endian order:

YYYY = UVUV = 4 * 10 bits = 40 bits = 5 bytes

The '15' and '20' suffix refers to the optimum effective bits per pixel
which is achieved when the total number of luminance samples is a
multiple of 8 for NV15 and 4 for NV20.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Tested-by: Christopher Obbard <chris.obbard@collabora.com>
Signed-off-by: Nicolas Dufresne <nicolas.dufresne@collabora.com>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
Jonas Karlman
2025-02-25 10:40:23 +01:00
committed by Hans Verkuil
parent 22f572ce4e
commit dcbe2aeda2
4 changed files with 134 additions and 0 deletions

View File

@@ -137,6 +137,13 @@ All components are stored with the same number of bits per component.
- Cb, Cr
- No
- Linear
* - V4L2_PIX_FMT_NV15
- 'NV15'
- 10
- 4:2:0
- Cb, Cr
- Yes
- Linear
* - V4L2_PIX_FMT_NV15_4L4
- 'VT15'
- 15
@@ -186,6 +193,13 @@ All components are stored with the same number of bits per component.
- Cr, Cb
- No
- Linear
* - V4L2_PIX_FMT_NV20
- 'NV20'
- 10
- 4:2:2
- Cb, Cr
- Yes
- Linear
* - V4L2_PIX_FMT_NV24
- 'NV24'
- 8
@@ -302,6 +316,57 @@ of the luma plane.
- Cr\ :sub:`11`
.. _V4L2-PIX-FMT-NV15:
NV15
----
Semi-planar 10-bit YUV 4:2:0 format similar to NV12, using 10-bit components
with no padding between each component. A group of 4 components are stored over
5 bytes in little endian order.
.. flat-table:: Sample 4x4 NV15 Image (1 byte per cell)
:header-rows: 0
:stub-columns: 0
* - start + 0:
- Y'\ :sub:`00[7:0]`
- Y'\ :sub:`01[5:0]`\ Y'\ :sub:`00[9:8]`
- Y'\ :sub:`02[3:0]`\ Y'\ :sub:`01[9:6]`
- Y'\ :sub:`03[1:0]`\ Y'\ :sub:`02[9:4]`
- Y'\ :sub:`03[9:2]`
* - start + 5:
- Y'\ :sub:`10[7:0]`
- Y'\ :sub:`11[5:0]`\ Y'\ :sub:`10[9:8]`
- Y'\ :sub:`12[3:0]`\ Y'\ :sub:`11[9:6]`
- Y'\ :sub:`13[1:0]`\ Y'\ :sub:`12[9:4]`
- Y'\ :sub:`13[9:2]`
* - start + 10:
- Y'\ :sub:`20[7:0]`
- Y'\ :sub:`21[5:0]`\ Y'\ :sub:`20[9:8]`
- Y'\ :sub:`22[3:0]`\ Y'\ :sub:`21[9:6]`
- Y'\ :sub:`23[1:0]`\ Y'\ :sub:`22[9:4]`
- Y'\ :sub:`23[9:2]`
* - start + 15:
- Y'\ :sub:`30[7:0]`
- Y'\ :sub:`31[5:0]`\ Y'\ :sub:`30[9:8]`
- Y'\ :sub:`32[3:0]`\ Y'\ :sub:`31[9:6]`
- Y'\ :sub:`33[1:0]`\ Y'\ :sub:`32[9:4]`
- Y'\ :sub:`33[9:2]`
* - start + 20:
- Cb\ :sub:`00[7:0]`
- Cr\ :sub:`00[5:0]`\ Cb\ :sub:`00[9:8]`
- Cb\ :sub:`01[3:0]`\ Cr\ :sub:`00[9:6]`
- Cr\ :sub:`01[1:0]`\ Cb\ :sub:`01[9:4]`
- Cr\ :sub:`01[9:2]`
* - start + 25:
- Cb\ :sub:`10[7:0]`
- Cr\ :sub:`10[5:0]`\ Cb\ :sub:`10[9:8]`
- Cb\ :sub:`11[3:0]`\ Cr\ :sub:`10[9:6]`
- Cr\ :sub:`11[1:0]`\ Cb\ :sub:`11[9:4]`
- Cr\ :sub:`11[9:2]`
.. _V4L2-PIX-FMT-NV12MT:
.. _V4L2-PIX-FMT-NV12MT-16X16:
.. _V4L2-PIX-FMT-NV12-4L4:
@@ -631,6 +696,69 @@ number of lines as the luma plane.
- Cr\ :sub:`32`
.. _V4L2-PIX-FMT-NV20:
NV20
----
Semi-planar 10-bit YUV 4:2:2 format similar to NV16, using 10-bit components
with no padding between each component. A group of 4 components are stored over
5 bytes in little endian order.
.. flat-table:: Sample 4x4 NV20 Image (1 byte per cell)
:header-rows: 0
:stub-columns: 0
* - start + 0:
- Y'\ :sub:`00[7:0]`
- Y'\ :sub:`01[5:0]`\ Y'\ :sub:`00[9:8]`
- Y'\ :sub:`02[3:0]`\ Y'\ :sub:`01[9:6]`
- Y'\ :sub:`03[1:0]`\ Y'\ :sub:`02[9:4]`
- Y'\ :sub:`03[9:2]`
* - start + 5:
- Y'\ :sub:`10[7:0]`
- Y'\ :sub:`11[5:0]`\ Y'\ :sub:`10[9:8]`
- Y'\ :sub:`12[3:0]`\ Y'\ :sub:`11[9:6]`
- Y'\ :sub:`13[1:0]`\ Y'\ :sub:`12[9:4]`
- Y'\ :sub:`13[9:2]`
* - start + 10:
- Y'\ :sub:`20[7:0]`
- Y'\ :sub:`21[5:0]`\ Y'\ :sub:`20[9:8]`
- Y'\ :sub:`22[3:0]`\ Y'\ :sub:`21[9:6]`
- Y'\ :sub:`23[1:0]`\ Y'\ :sub:`22[9:4]`
- Y'\ :sub:`23[9:2]`
* - start + 15:
- Y'\ :sub:`30[7:0]`
- Y'\ :sub:`31[5:0]`\ Y'\ :sub:`30[9:8]`
- Y'\ :sub:`32[3:0]`\ Y'\ :sub:`31[9:6]`
- Y'\ :sub:`33[1:0]`\ Y'\ :sub:`32[9:4]`
- Y'\ :sub:`33[9:2]`
* - start + 20:
- Cb\ :sub:`00[7:0]`
- Cr\ :sub:`00[5:0]`\ Cb\ :sub:`00[9:8]`
- Cb\ :sub:`01[3:0]`\ Cr\ :sub:`00[9:6]`
- Cr\ :sub:`01[1:0]`\ Cb\ :sub:`01[9:4]`
- Cr\ :sub:`01[9:2]`
* - start + 25:
- Cb\ :sub:`10[7:0]`
- Cr\ :sub:`10[5:0]`\ Cb\ :sub:`10[9:8]`
- Cb\ :sub:`11[3:0]`\ Cr\ :sub:`10[9:6]`
- Cr\ :sub:`11[1:0]`\ Cb\ :sub:`11[9:4]`
- Cr\ :sub:`11[9:2]`
* - start + 30:
- Cb\ :sub:`20[7:0]`
- Cr\ :sub:`20[5:0]`\ Cb\ :sub:`20[9:8]`
- Cb\ :sub:`21[3:0]`\ Cr\ :sub:`20[9:6]`
- Cr\ :sub:`21[1:0]`\ Cb\ :sub:`21[9:4]`
- Cr\ :sub:`21[9:2]`
* - start + 35:
- Cb\ :sub:`30[7:0]`
- Cr\ :sub:`30[5:0]`\ Cb\ :sub:`30[9:8]`
- Cb\ :sub:`31[3:0]`\ Cr\ :sub:`30[9:6]`
- Cr\ :sub:`31[1:0]`\ Cb\ :sub:`31[9:4]`
- Cr\ :sub:`31[9:2]`
.. _V4L2-PIX-FMT-NV24:
.. _V4L2-PIX-FMT-NV42: