Merge tag 'vfio-v4.21-rc1' of git://github.com/awilliam/linux-vfio
[sfrench/cifs-2.6.git] / Documentation / media / uapi / v4l / pixfmt-nv12.rst
1 .. Permission is granted to copy, distribute and/or modify this
2 .. document under the terms of the GNU Free Documentation License,
3 .. Version 1.1 or any later version published by the Free Software
4 .. Foundation, with no Invariant Sections, no Front-Cover Texts
5 .. and no Back-Cover Texts. A copy of the license is included at
6 .. Documentation/media/uapi/fdl-appendix.rst.
7 ..
8 .. TODO: replace it to GFDL-1.1-or-later WITH no-invariant-sections
9
10 .. _V4L2-PIX-FMT-NV12:
11 .. _V4L2-PIX-FMT-NV21:
12
13 ******************************************************
14 V4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21')
15 ******************************************************
16
17
18 V4L2_PIX_FMT_NV21
19 Formats with ½ horizontal and vertical chroma resolution, also known as
20 YUV 4:2:0. One luminance and one chrominance plane with alternating
21 chroma samples as opposed to ``V4L2_PIX_FMT_YVU420``
22
23
24 Description
25 ===========
26
27 These are two-plane versions of the YUV 4:2:0 format. The three
28 components are separated into two sub-images or planes. The Y plane is
29 first. The Y plane has one byte per pixel. For ``V4L2_PIX_FMT_NV12``, a
30 combined CbCr plane immediately follows the Y plane in memory. The CbCr
31 plane is the same width, in bytes, as the Y plane (and of the image),
32 but is half as tall in pixels. Each CbCr pair belongs to four pixels.
33 For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
34 Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`. ``V4L2_PIX_FMT_NV21`` is
35 the same except the Cb and Cr bytes are swapped, the CrCb plane starts
36 with a Cr byte.
37
38 If the Y plane has pad bytes after each row, then the CbCr plane has as
39 many pad bytes after its rows.
40
41 **Byte Order.**
42 Each cell is one byte.
43
44
45 .. flat-table::
46     :header-rows:  0
47     :stub-columns: 0
48
49     * - start + 0:
50       - Y'\ :sub:`00`
51       - Y'\ :sub:`01`
52       - Y'\ :sub:`02`
53       - Y'\ :sub:`03`
54     * - start + 4:
55       - Y'\ :sub:`10`
56       - Y'\ :sub:`11`
57       - Y'\ :sub:`12`
58       - Y'\ :sub:`13`
59     * - start + 8:
60       - Y'\ :sub:`20`
61       - Y'\ :sub:`21`
62       - Y'\ :sub:`22`
63       - Y'\ :sub:`23`
64     * - start + 12:
65       - Y'\ :sub:`30`
66       - Y'\ :sub:`31`
67       - Y'\ :sub:`32`
68       - Y'\ :sub:`33`
69     * - start + 16:
70       - Cb\ :sub:`00`
71       - Cr\ :sub:`00`
72       - Cb\ :sub:`01`
73       - Cr\ :sub:`01`
74     * - start + 20:
75       - Cb\ :sub:`10`
76       - Cr\ :sub:`10`
77       - Cb\ :sub:`11`
78       - Cr\ :sub:`11`
79
80
81 **Color Sample Location:**
82
83 .. flat-table::
84     :header-rows:  0
85     :stub-columns: 0
86
87     * -
88       - 0
89       -
90       - 1
91       - 2
92       -
93       - 3
94     * - 0
95       - Y
96       -
97       - Y
98       - Y
99       -
100       - Y
101     * -
102       -
103       - C
104       -
105       -
106       - C
107       -
108     * - 1
109       - Y
110       -
111       - Y
112       - Y
113       -
114       - Y
115     * -
116     * - 2
117       - Y
118       -
119       - Y
120       - Y
121       -
122       - Y
123     * -
124       -
125       - C
126       -
127       -
128       - C
129       -
130     * - 3
131       - Y
132       -
133       - Y
134       - Y
135       -
136       - Y