18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci.. _V4L2-PIX-FMT-NV12M:
48c2ecf20Sopenharmony_ci.. _v4l2-pix-fmt-nv12mt-16x16:
58c2ecf20Sopenharmony_ci.. _V4L2-PIX-FMT-NV21M:
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci***********************************************************************************
88c2ecf20Sopenharmony_ciV4L2_PIX_FMT_NV12M ('NM12'), V4L2_PIX_FMT_NV21M ('NM21'), V4L2_PIX_FMT_NV12MT_16X16
98c2ecf20Sopenharmony_ci***********************************************************************************
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_ciV4L2_PIX_FMT_NV21M
138c2ecf20Sopenharmony_ciV4L2_PIX_FMT_NV12MT_16X16
148c2ecf20Sopenharmony_ciVariation of ``V4L2_PIX_FMT_NV12`` and ``V4L2_PIX_FMT_NV21`` with planes
158c2ecf20Sopenharmony_cinon contiguous in memory.
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci
188c2ecf20Sopenharmony_ciDescription
198c2ecf20Sopenharmony_ci===========
208c2ecf20Sopenharmony_ci
218c2ecf20Sopenharmony_ciThis is a multi-planar, two-plane version of the YUV 4:2:0 format. The
228c2ecf20Sopenharmony_cithree components are separated into two sub-images or planes.
238c2ecf20Sopenharmony_ci``V4L2_PIX_FMT_NV12M`` differs from ``V4L2_PIX_FMT_NV12`` in that the
248c2ecf20Sopenharmony_citwo planes are non-contiguous in memory, i.e. the chroma plane do not
258c2ecf20Sopenharmony_cinecessarily immediately follows the luma plane. The luminance data
268c2ecf20Sopenharmony_cioccupies the first plane. The Y plane has one byte per pixel. In the
278c2ecf20Sopenharmony_cisecond plane there is a chrominance data with alternating chroma
288c2ecf20Sopenharmony_cisamples. The CbCr plane is the same width, in bytes, as the Y plane (and
298c2ecf20Sopenharmony_ciof the image), but is half as tall in pixels. Each CbCr pair belongs to
308c2ecf20Sopenharmony_cifour pixels. For example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to
318c2ecf20Sopenharmony_ciY'\ :sub:`00`, Y'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`.
328c2ecf20Sopenharmony_ci``V4L2_PIX_FMT_NV12MT_16X16`` is the tiled version of
338c2ecf20Sopenharmony_ci``V4L2_PIX_FMT_NV12M`` with 16x16 macroblock tiles. Here pixels are
348c2ecf20Sopenharmony_ciarranged in 16x16 2D tiles and tiles are arranged in linear order in
358c2ecf20Sopenharmony_cimemory. ``V4L2_PIX_FMT_NV21M`` is the same as ``V4L2_PIX_FMT_NV12M``
368c2ecf20Sopenharmony_ciexcept the Cb and Cr bytes are swapped, the CrCb plane starts with a Cr
378c2ecf20Sopenharmony_cibyte.
388c2ecf20Sopenharmony_ci
398c2ecf20Sopenharmony_ci``V4L2_PIX_FMT_NV12M`` is intended to be used only in drivers and
408c2ecf20Sopenharmony_ciapplications that support the multi-planar API, described in
418c2ecf20Sopenharmony_ci:ref:`planar-apis`.
428c2ecf20Sopenharmony_ci
438c2ecf20Sopenharmony_ciIf the Y plane has pad bytes after each row, then the CbCr plane has as
448c2ecf20Sopenharmony_cimany pad bytes after its rows.
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci**Byte Order.**
478c2ecf20Sopenharmony_ciEach cell is one byte.
488c2ecf20Sopenharmony_ci
498c2ecf20Sopenharmony_ci.. flat-table::
508c2ecf20Sopenharmony_ci    :header-rows:  0
518c2ecf20Sopenharmony_ci    :stub-columns: 0
528c2ecf20Sopenharmony_ci
538c2ecf20Sopenharmony_ci    * - start0 + 0:
548c2ecf20Sopenharmony_ci      - Y'\ :sub:`00`
558c2ecf20Sopenharmony_ci      - Y'\ :sub:`01`
568c2ecf20Sopenharmony_ci      - Y'\ :sub:`02`
578c2ecf20Sopenharmony_ci      - Y'\ :sub:`03`
588c2ecf20Sopenharmony_ci    * - start0 + 4:
598c2ecf20Sopenharmony_ci      - Y'\ :sub:`10`
608c2ecf20Sopenharmony_ci      - Y'\ :sub:`11`
618c2ecf20Sopenharmony_ci      - Y'\ :sub:`12`
628c2ecf20Sopenharmony_ci      - Y'\ :sub:`13`
638c2ecf20Sopenharmony_ci    * - start0 + 8:
648c2ecf20Sopenharmony_ci      - Y'\ :sub:`20`
658c2ecf20Sopenharmony_ci      - Y'\ :sub:`21`
668c2ecf20Sopenharmony_ci      - Y'\ :sub:`22`
678c2ecf20Sopenharmony_ci      - Y'\ :sub:`23`
688c2ecf20Sopenharmony_ci    * - start0 + 12:
698c2ecf20Sopenharmony_ci      - Y'\ :sub:`30`
708c2ecf20Sopenharmony_ci      - Y'\ :sub:`31`
718c2ecf20Sopenharmony_ci      - Y'\ :sub:`32`
728c2ecf20Sopenharmony_ci      - Y'\ :sub:`33`
738c2ecf20Sopenharmony_ci    * -
748c2ecf20Sopenharmony_ci    * - start1 + 0:
758c2ecf20Sopenharmony_ci      - Cb\ :sub:`00`
768c2ecf20Sopenharmony_ci      - Cr\ :sub:`00`
778c2ecf20Sopenharmony_ci      - Cb\ :sub:`01`
788c2ecf20Sopenharmony_ci      - Cr\ :sub:`01`
798c2ecf20Sopenharmony_ci    * - start1 + 4:
808c2ecf20Sopenharmony_ci      - Cb\ :sub:`10`
818c2ecf20Sopenharmony_ci      - Cr\ :sub:`10`
828c2ecf20Sopenharmony_ci      - Cb\ :sub:`11`
838c2ecf20Sopenharmony_ci      - Cr\ :sub:`11`
848c2ecf20Sopenharmony_ci
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci**Color Sample Location:**
878c2ecf20Sopenharmony_ci
888c2ecf20Sopenharmony_ci
898c2ecf20Sopenharmony_ci
908c2ecf20Sopenharmony_ci.. flat-table::
918c2ecf20Sopenharmony_ci    :header-rows:  0
928c2ecf20Sopenharmony_ci    :stub-columns: 0
938c2ecf20Sopenharmony_ci
948c2ecf20Sopenharmony_ci    * -
958c2ecf20Sopenharmony_ci      - 0
968c2ecf20Sopenharmony_ci      -
978c2ecf20Sopenharmony_ci      - 1
988c2ecf20Sopenharmony_ci      - 2
998c2ecf20Sopenharmony_ci      -
1008c2ecf20Sopenharmony_ci      - 3
1018c2ecf20Sopenharmony_ci    * - 0
1028c2ecf20Sopenharmony_ci      - Y
1038c2ecf20Sopenharmony_ci      -
1048c2ecf20Sopenharmony_ci      - Y
1058c2ecf20Sopenharmony_ci      - Y
1068c2ecf20Sopenharmony_ci      -
1078c2ecf20Sopenharmony_ci      - Y
1088c2ecf20Sopenharmony_ci    * -
1098c2ecf20Sopenharmony_ci      -
1108c2ecf20Sopenharmony_ci      - C
1118c2ecf20Sopenharmony_ci      -
1128c2ecf20Sopenharmony_ci      -
1138c2ecf20Sopenharmony_ci      - C
1148c2ecf20Sopenharmony_ci      -
1158c2ecf20Sopenharmony_ci    * - 1
1168c2ecf20Sopenharmony_ci      - Y
1178c2ecf20Sopenharmony_ci      -
1188c2ecf20Sopenharmony_ci      - Y
1198c2ecf20Sopenharmony_ci      - Y
1208c2ecf20Sopenharmony_ci      -
1218c2ecf20Sopenharmony_ci      - Y
1228c2ecf20Sopenharmony_ci    * -
1238c2ecf20Sopenharmony_ci    * - 2
1248c2ecf20Sopenharmony_ci      - Y
1258c2ecf20Sopenharmony_ci      -
1268c2ecf20Sopenharmony_ci      - Y
1278c2ecf20Sopenharmony_ci      - Y
1288c2ecf20Sopenharmony_ci      -
1298c2ecf20Sopenharmony_ci      - Y
1308c2ecf20Sopenharmony_ci    * -
1318c2ecf20Sopenharmony_ci      -
1328c2ecf20Sopenharmony_ci      - C
1338c2ecf20Sopenharmony_ci      -
1348c2ecf20Sopenharmony_ci      -
1358c2ecf20Sopenharmony_ci      -
1368c2ecf20Sopenharmony_ci      - C
1378c2ecf20Sopenharmony_ci      -
1388c2ecf20Sopenharmony_ci    * - 3
1398c2ecf20Sopenharmony_ci      - Y
1408c2ecf20Sopenharmony_ci      -
1418c2ecf20Sopenharmony_ci      - Y
1428c2ecf20Sopenharmony_ci      - Y
1438c2ecf20Sopenharmony_ci      -
1448c2ecf20Sopenharmony_ci      - Y
145