1.. -*- coding: utf-8; mode: rst -*-
2
3.. _V4L2-PIX-FMT-NV12M:
4.. _v4l2-pix-fmt-nv12mt-16x16:
5.. _V4L2-PIX-FMT-NV21M:
6
7***********************************************************************************
8V4L2_PIX_FMT_NV12M ('NM12'), V4L2_PIX_FMT_NV21M ('NM21'), V4L2_PIX_FMT_NV12MT_16X16
9***********************************************************************************
10
11
12V4L2_PIX_FMT_NV21M
13V4L2_PIX_FMT_NV12MT_16X16
14Variation of ``V4L2_PIX_FMT_NV12`` and ``V4L2_PIX_FMT_NV21`` with planes
15non contiguous in memory.
16
17
18Description
19===========
20
21This is a multi-planar, two-plane version of the YUV 4:2:0 format. The
22three components are separated into two sub-images or planes.
23``V4L2_PIX_FMT_NV12M`` differs from ``V4L2_PIX_FMT_NV12`` in that the
24two planes are non-contiguous in memory, i.e. the chroma plane do not
25necessarily immediately follows the luma plane. The luminance data
26occupies the first plane. The Y plane has one byte per pixel. In the
27second plane there is a chrominance data with alternating chroma
28samples. The CbCr plane is the same width, in bytes, as the Y plane (and
29of the image), but is half as tall in pixels. Each CbCr pair belongs to
30four pixels. For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to
31Y'\ :sub:`00`, Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
32``V4L2_PIX_FMT_NV12MT_16X16`` is the tiled version of
33``V4L2_PIX_FMT_NV12M`` with 16x16 macroblock tiles. Here pixels are
34arranged in 16x16 2D tiles and tiles are arranged in linear order in
35memory. ``V4L2_PIX_FMT_NV21M`` is the same as ``V4L2_PIX_FMT_NV12M``
36except the Cb and Cr bytes are swapped, the CrCb plane starts with a Cr
37byte.
38
39``V4L2_PIX_FMT_NV12M`` is intended to be used only in drivers and
40applications that support the multi-planar API, described in
41:ref:`planar-apis`.
42
43If the Y plane has pad bytes after each row, then the CbCr plane has as
44many pad bytes after its rows.
45
46**Byte Order.**
47Each cell is one byte.
48
49.. flat-table::
50    :header-rows:  0
51    :stub-columns: 0
52
53    * - start0 + 0:
54      - Y'\ :sub:`00`
55      - Y'\ :sub:`01`
56      - Y'\ :sub:`02`
57      - Y'\ :sub:`03`
58    * - start0 + 4:
59      - Y'\ :sub:`10`
60      - Y'\ :sub:`11`
61      - Y'\ :sub:`12`
62      - Y'\ :sub:`13`
63    * - start0 + 8:
64      - Y'\ :sub:`20`
65      - Y'\ :sub:`21`
66      - Y'\ :sub:`22`
67      - Y'\ :sub:`23`
68    * - start0 + 12:
69      - Y'\ :sub:`30`
70      - Y'\ :sub:`31`
71      - Y'\ :sub:`32`
72      - Y'\ :sub:`33`
73    * -
74    * - start1 + 0:
75      - Cb\ :sub:`00`
76      - Cr\ :sub:`00`
77      - Cb\ :sub:`01`
78      - Cr\ :sub:`01`
79    * - start1 + 4:
80      - Cb\ :sub:`10`
81      - Cr\ :sub:`10`
82      - Cb\ :sub:`11`
83      - Cr\ :sub:`11`
84
85
86**Color Sample Location:**
87
88
89
90.. flat-table::
91    :header-rows:  0
92    :stub-columns: 0
93
94    * -
95      - 0
96      -
97      - 1
98      - 2
99      -
100      - 3
101    * - 0
102      - Y
103      -
104      - Y
105      - Y
106      -
107      - Y
108    * -
109      -
110      - C
111      -
112      -
113      - C
114      -
115    * - 1
116      - Y
117      -
118      - Y
119      - Y
120      -
121      - Y
122    * -
123    * - 2
124      - Y
125      -
126      - Y
127      - Y
128      -
129      - Y
130    * -
131      -
132      - C
133      -
134      -
135      -
136      - C
137      -
138    * - 3
139      - Y
140      -
141      - Y
142      - Y
143      -
144      - Y
145