18c2ecf20Sopenharmony_ci.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later 28c2ecf20Sopenharmony_ci 38c2ecf20Sopenharmony_ci.. _V4L2-PIX-FMT-NV12MT: 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci**************************** 68c2ecf20Sopenharmony_ciV4L2_PIX_FMT_NV12MT ('TM12') 78c2ecf20Sopenharmony_ci**************************** 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciFormats with ½ horizontal and vertical chroma resolution. This format 108c2ecf20Sopenharmony_cihas two planes - one for luminance and one for chrominance. Chroma 118c2ecf20Sopenharmony_cisamples are interleaved. The difference to ``V4L2_PIX_FMT_NV12`` is the 128c2ecf20Sopenharmony_cimemory layout. Pixels are grouped in macroblocks of 64x32 size. The 138c2ecf20Sopenharmony_ciorder of macroblocks in memory is also not standard. 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_ciDescription 178c2ecf20Sopenharmony_ci=========== 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciThis is the two-plane versions of the YUV 4:2:0 format where data is 208c2ecf20Sopenharmony_cigrouped into 64x32 macroblocks. The three components are separated into 218c2ecf20Sopenharmony_citwo sub-images or planes. The Y plane has one byte per pixel and pixels 228c2ecf20Sopenharmony_ciare grouped into 64x32 macroblocks. The CbCr plane has the same width, 238c2ecf20Sopenharmony_ciin bytes, as the Y plane (and the image), but is half as tall in pixels. 248c2ecf20Sopenharmony_ciThe chroma plane is also grouped into 64x32 macroblocks. 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ciWidth of the buffer has to be aligned to the multiple of 128, and height 278c2ecf20Sopenharmony_cialignment is 32. Every four adjacent buffers - two horizontally and two 288c2ecf20Sopenharmony_civertically are grouped together and are located in memory in Z or 298c2ecf20Sopenharmony_ciflipped Z order. 308c2ecf20Sopenharmony_ci 318c2ecf20Sopenharmony_ciLayout of macroblocks in memory is presented in the following figure. 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_ci 348c2ecf20Sopenharmony_ci.. _nv12mt: 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ci.. kernel-figure:: nv12mt.svg 378c2ecf20Sopenharmony_ci :alt: nv12mt.svg 388c2ecf20Sopenharmony_ci :align: center 398c2ecf20Sopenharmony_ci 408c2ecf20Sopenharmony_ci V4L2_PIX_FMT_NV12MT macroblock Z shape memory layout 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ciThe requirement that width is multiple of 128 is implemented because, 438c2ecf20Sopenharmony_cithe Z shape cannot be cut in half horizontally. In case the vertical 448c2ecf20Sopenharmony_ciresolution of macroblocks is odd then the last row of macroblocks is 458c2ecf20Sopenharmony_ciarranged in a linear order. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciIn case of chroma the layout is identical. Cb and Cr samples are 488c2ecf20Sopenharmony_ciinterleaved. Height of the buffer is aligned to 32. 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_ci.. _nv12mt_ex: 528c2ecf20Sopenharmony_ci 538c2ecf20Sopenharmony_ci.. kernel-figure:: nv12mt_example.svg 548c2ecf20Sopenharmony_ci :alt: nv12mt_example.svg 558c2ecf20Sopenharmony_ci :align: center 568c2ecf20Sopenharmony_ci 578c2ecf20Sopenharmony_ci Example V4L2_PIX_FMT_NV12MT memory layout of macroblocks 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ciMemory layout of macroblocks of ``V4L2_PIX_FMT_NV12MT`` format in most 608c2ecf20Sopenharmony_ciextreme case. 61