Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[sfrench/cifs-2.6.git] / Documentation / media / uapi / v4l / pixfmt-nv12mt.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-NV12MT:
11
12 ****************************
13 V4L2_PIX_FMT_NV12MT ('TM12')
14 ****************************
15
16 Formats with ½ horizontal and vertical chroma resolution. This format
17 has two planes - one for luminance and one for chrominance. Chroma
18 samples are interleaved. The difference to ``V4L2_PIX_FMT_NV12`` is the
19 memory layout. Pixels are grouped in macroblocks of 64x32 size. The
20 order of macroblocks in memory is also not standard.
21
22
23 Description
24 ===========
25
26 This is the two-plane versions of the YUV 4:2:0 format where data is
27 grouped into 64x32 macroblocks. The three components are separated into
28 two sub-images or planes. The Y plane has one byte per pixel and pixels
29 are grouped into 64x32 macroblocks. The CbCr plane has the same width,
30 in bytes, as the Y plane (and the image), but is half as tall in pixels.
31 The chroma plane is also grouped into 64x32 macroblocks.
32
33 Width of the buffer has to be aligned to the multiple of 128, and height
34 alignment is 32. Every four adjacent buffers - two horizontally and two
35 vertically are grouped together and are located in memory in Z or
36 flipped Z order.
37
38 Layout of macroblocks in memory is presented in the following figure.
39
40
41 .. _nv12mt:
42
43 .. kernel-figure:: nv12mt.svg
44     :alt:    nv12mt.svg
45     :align:  center
46
47     V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout
48
49 The requirement that width is multiple of 128 is implemented because,
50 the Z shape cannot be cut in half horizontally. In case the vertical
51 resolution of macroblocks is odd then the last row of macroblocks is
52 arranged in a linear order.
53
54 In case of chroma the layout is identical. Cb and Cr samples are
55 interleaved. Height of the buffer is aligned to 32.
56
57
58 .. _nv12mt_ex:
59
60 .. kernel-figure:: nv12mt_example.svg
61     :alt:    nv12mt_example.svg
62     :align:  center
63
64     Example V4L2_PIX_FMT_NV12MT memory layout of macroblocks
65
66 Memory layout of macroblocks of ``V4L2_PIX_FMT_NV12MT`` format in most
67 extreme case.