18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
28c2ecf20Sopenharmony_ci
38c2ecf20Sopenharmony_ci.. _V4L2-PIX-FMT-NV12:
48c2ecf20Sopenharmony_ci.. _V4L2-PIX-FMT-NV21:
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ci******************************************************
78c2ecf20Sopenharmony_ciV4L2_PIX_FMT_NV12 ('NV12'), V4L2_PIX_FMT_NV21 ('NV21')
88c2ecf20Sopenharmony_ci******************************************************
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ciV4L2_PIX_FMT_NV21
128c2ecf20Sopenharmony_ciFormats with ½ horizontal and vertical chroma resolution, also known as
138c2ecf20Sopenharmony_ciYUV 4:2:0. One luminance and one chrominance plane with alternating
148c2ecf20Sopenharmony_cichroma samples as opposed to ``V4L2_PIX_FMT_YVU420``
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ciDescription
188c2ecf20Sopenharmony_ci===========
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ciThese are two-plane versions of the YUV 4:2:0 format. The three
218c2ecf20Sopenharmony_cicomponents are separated into two sub-images or planes. The Y plane is
228c2ecf20Sopenharmony_cifirst. The Y plane has one byte per pixel. For ``V4L2_PIX_FMT_NV12``, a
238c2ecf20Sopenharmony_cicombined CbCr plane immediately follows the Y plane in memory. The CbCr
248c2ecf20Sopenharmony_ciplane is the same width, in bytes, as the Y plane (and of the image),
258c2ecf20Sopenharmony_cibut is half as tall in pixels. Each CbCr pair belongs to four pixels.
268c2ecf20Sopenharmony_ciFor example, Cb\ :sub:`0`/Cr\ :sub:`0` belongs to Y'\ :sub:`00`,
278c2ecf20Sopenharmony_ciY'\ :sub:`01`, Y'\ :sub:`10`, Y'\ :sub:`11`. ``V4L2_PIX_FMT_NV21`` is
288c2ecf20Sopenharmony_cithe same except the Cb and Cr bytes are swapped, the CrCb plane starts
298c2ecf20Sopenharmony_ciwith a Cr byte.
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciIf the Y plane has pad bytes after each row, then the CbCr plane has as
328c2ecf20Sopenharmony_cimany pad bytes after its rows.
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci**Byte Order.**
358c2ecf20Sopenharmony_ciEach cell is one byte.
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_ci
388c2ecf20Sopenharmony_ci.. flat-table::
398c2ecf20Sopenharmony_ci    :header-rows:  0
408c2ecf20Sopenharmony_ci    :stub-columns: 0
418c2ecf20Sopenharmony_ci
428c2ecf20Sopenharmony_ci    * - start + 0:
438c2ecf20Sopenharmony_ci      - Y'\ :sub:`00`
448c2ecf20Sopenharmony_ci      - Y'\ :sub:`01`
458c2ecf20Sopenharmony_ci      - Y'\ :sub:`02`
468c2ecf20Sopenharmony_ci      - Y'\ :sub:`03`
478c2ecf20Sopenharmony_ci    * - start + 4:
488c2ecf20Sopenharmony_ci      - Y'\ :sub:`10`
498c2ecf20Sopenharmony_ci      - Y'\ :sub:`11`
508c2ecf20Sopenharmony_ci      - Y'\ :sub:`12`
518c2ecf20Sopenharmony_ci      - Y'\ :sub:`13`
528c2ecf20Sopenharmony_ci    * - start + 8:
538c2ecf20Sopenharmony_ci      - Y'\ :sub:`20`
548c2ecf20Sopenharmony_ci      - Y'\ :sub:`21`
558c2ecf20Sopenharmony_ci      - Y'\ :sub:`22`
568c2ecf20Sopenharmony_ci      - Y'\ :sub:`23`
578c2ecf20Sopenharmony_ci    * - start + 12:
588c2ecf20Sopenharmony_ci      - Y'\ :sub:`30`
598c2ecf20Sopenharmony_ci      - Y'\ :sub:`31`
608c2ecf20Sopenharmony_ci      - Y'\ :sub:`32`
618c2ecf20Sopenharmony_ci      - Y'\ :sub:`33`
628c2ecf20Sopenharmony_ci    * - start + 16:
638c2ecf20Sopenharmony_ci      - Cb\ :sub:`00`
648c2ecf20Sopenharmony_ci      - Cr\ :sub:`00`
658c2ecf20Sopenharmony_ci      - Cb\ :sub:`01`
668c2ecf20Sopenharmony_ci      - Cr\ :sub:`01`
678c2ecf20Sopenharmony_ci    * - start + 20:
688c2ecf20Sopenharmony_ci      - Cb\ :sub:`10`
698c2ecf20Sopenharmony_ci      - Cr\ :sub:`10`
708c2ecf20Sopenharmony_ci      - Cb\ :sub:`11`
718c2ecf20Sopenharmony_ci      - Cr\ :sub:`11`
728c2ecf20Sopenharmony_ci
738c2ecf20Sopenharmony_ci
748c2ecf20Sopenharmony_ci**Color Sample Location:**
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci.. flat-table::
778c2ecf20Sopenharmony_ci    :header-rows:  0
788c2ecf20Sopenharmony_ci    :stub-columns: 0
798c2ecf20Sopenharmony_ci
808c2ecf20Sopenharmony_ci    * -
818c2ecf20Sopenharmony_ci      - 0
828c2ecf20Sopenharmony_ci      -
838c2ecf20Sopenharmony_ci      - 1
848c2ecf20Sopenharmony_ci      - 2
858c2ecf20Sopenharmony_ci      -
868c2ecf20Sopenharmony_ci      - 3
878c2ecf20Sopenharmony_ci    * - 0
888c2ecf20Sopenharmony_ci      - Y
898c2ecf20Sopenharmony_ci      -
908c2ecf20Sopenharmony_ci      - Y
918c2ecf20Sopenharmony_ci      - Y
928c2ecf20Sopenharmony_ci      -
938c2ecf20Sopenharmony_ci      - Y
948c2ecf20Sopenharmony_ci    * -
958c2ecf20Sopenharmony_ci      -
968c2ecf20Sopenharmony_ci      - C
978c2ecf20Sopenharmony_ci      -
988c2ecf20Sopenharmony_ci      -
998c2ecf20Sopenharmony_ci      - C
1008c2ecf20Sopenharmony_ci      -
1018c2ecf20Sopenharmony_ci    * - 1
1028c2ecf20Sopenharmony_ci      - Y
1038c2ecf20Sopenharmony_ci      -
1048c2ecf20Sopenharmony_ci      - Y
1058c2ecf20Sopenharmony_ci      - Y
1068c2ecf20Sopenharmony_ci      -
1078c2ecf20Sopenharmony_ci      - Y
1088c2ecf20Sopenharmony_ci    * -
1098c2ecf20Sopenharmony_ci    * - 2
1108c2ecf20Sopenharmony_ci      - Y
1118c2ecf20Sopenharmony_ci      -
1128c2ecf20Sopenharmony_ci      - Y
1138c2ecf20Sopenharmony_ci      - Y
1148c2ecf20Sopenharmony_ci      -
1158c2ecf20Sopenharmony_ci      - Y
1168c2ecf20Sopenharmony_ci    * -
1178c2ecf20Sopenharmony_ci      -
1188c2ecf20Sopenharmony_ci      - C
1198c2ecf20Sopenharmony_ci      -
1208c2ecf20Sopenharmony_ci      -
1218c2ecf20Sopenharmony_ci      - C
1228c2ecf20Sopenharmony_ci      -
1238c2ecf20Sopenharmony_ci    * - 3
1248c2ecf20Sopenharmony_ci      - Y
1258c2ecf20Sopenharmony_ci      -
1268c2ecf20Sopenharmony_ci      - Y
1278c2ecf20Sopenharmony_ci      - Y
1288c2ecf20Sopenharmony_ci      -
1298c2ecf20Sopenharmony_ci      - Y
130