Merge tag 'amd-drm-fixes-5.11-2020-12-23' of git://people.freedesktop.org/~agd5f...
[linux-2.6-microblaze.git] / Documentation / userspace-api / media / v4l / pixfmt-nv12.rst
1 .. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
2
3 .. _V4L2-PIX-FMT-NV12:
4 .. _V4L2-PIX-FMT-NV21:
5
6 ******************************************************
7 V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21')
8 ******************************************************
9
10
11 V4L2_PIX_FMT_NV21
12 Formats with ½ horizontal and vertical chroma resolution, also known as
13 YUV 4:2:0. One luminance and one chrominance plane with alternating
14 chroma samples as opposed to ``V4L2_PIX_FMT_YVU420``
15
16
17 Description
18 ===========
19
20 These are two-plane versions of the YUV 4:2:0 format. The three
21 components are separated into two sub-images or planes. The Y plane is
22 first. The Y plane has one byte per pixel. For ``V4L2_PIX_FMT_NV12``, a
23 combined CbCr plane immediately follows the Y plane in memory. The CbCr
24 plane is the same width, in bytes, as the Y plane (and of the image),
25 but is half as tall in pixels. Each CbCr pair belongs to four pixels.
26 For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
27 Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`. ``V4L2_PIX_FMT_NV21`` is
28 the same except the Cb and Cr bytes are swapped, the CrCb plane starts
29 with a Cr byte.
30
31 If the Y plane has pad bytes after each row, then the CbCr plane has as
32 many pad bytes after its rows.
33
34 **Byte Order.**
35 Each cell is one byte.
36
37
38 .. flat-table::
39     :header-rows:  0
40     :stub-columns: 0
41
42     * - start + 0:
43       - Y'\ :sub:`00`
44       - Y'\ :sub:`01`
45       - Y'\ :sub:`02`
46       - Y'\ :sub:`03`
47     * - start + 4:
48       - Y'\ :sub:`10`
49       - Y'\ :sub:`11`
50       - Y'\ :sub:`12`
51       - Y'\ :sub:`13`
52     * - start + 8:
53       - Y'\ :sub:`20`
54       - Y'\ :sub:`21`
55       - Y'\ :sub:`22`
56       - Y'\ :sub:`23`
57     * - start + 12:
58       - Y'\ :sub:`30`
59       - Y'\ :sub:`31`
60       - Y'\ :sub:`32`
61       - Y'\ :sub:`33`
62     * - start + 16:
63       - Cb\ :sub:`00`
64       - Cr\ :sub:`00`
65       - Cb\ :sub:`01`
66       - Cr\ :sub:`01`
67     * - start + 20:
68       - Cb\ :sub:`10`
69       - Cr\ :sub:`10`
70       - Cb\ :sub:`11`
71       - Cr\ :sub:`11`
72
73
74 **Color Sample Location:**
75
76 .. flat-table::
77     :header-rows:  0
78     :stub-columns: 0
79
80     * -
81       - 0
82       -
83       - 1
84       - 2
85       -
86       - 3
87     * - 0
88       - Y
89       -
90       - Y
91       - Y
92       -
93       - Y
94     * -
95       -
96       - C
97       -
98       -
99       - C
100       -
101     * - 1
102       - Y
103       -
104       - Y
105       - Y
106       -
107       - Y
108     * -
109     * - 2
110       - Y
111       -
112       - Y
113       - Y
114       -
115       - Y
116     * -
117       -
118       - C
119       -
120       -
121       - C
122       -
123     * - 3
124       - Y
125       -
126       - Y
127       - Y
128       -
129       - Y