Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
Source file repositories/reference/linux-study-clean/Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/userspace-api/media/v4l/pixfmt-yuv-planar.rst- Extension
.rst- Size
- 35631 bytes
- Lines
- 1457
- Domain
- Support Tooling And Documentation
- Bucket
- Documentation
- Inferred role
- Support Tooling And Documentation: documentation
- Status
- atlas-only
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
.. SPDX-License-Identifier: GFDL-1.1-no-invariants-or-later
.. c:namespace:: V4L
.. planar-yuv:
******************
Planar YUV formats
******************
Planar formats split luma and chroma data in separate memory regions. They
exist in two variants:
- Semi-planar formats use two planes. The first plane is the luma plane and
stores the Y components. The second plane is the chroma plane and stores the
Cb and Cr components interleaved.
- Fully planar formats use three planes to store the Y, Cb and Cr components
separately.
Within a plane, components are stored in pixel order, which may be linear or
tiled. Padding may be supported at the end of the lines, and the line stride of
the chroma planes may be constrained by the line stride of the luma plane.
Some planar formats allow planes to be placed in independent memory locations.
They are identified by an 'M' suffix in their name (such as in
``V4L2_PIX_FMT_NV12M``). Those formats are intended to be used only in drivers
and applications that support the multi-planar API, described in
:ref:`planar-apis`. Unless explicitly documented as supporting non-contiguous
planes, formats require the planes to follow each other immediately in memory.
Semi-Planar YUV Formats
=======================
These formats are commonly referred to as NV formats (NV12, NV16, ...). They
use two planes, and store the luma components in the first plane and the chroma
components in the second plane. The Cb and Cr components are interleaved in the
chroma plane, with Cb and Cr always stored in pairs. The chroma order is
exposed as different formats.
For memory contiguous formats, the number of padding pixels at the end of the
chroma lines is identical to the padding of the luma lines. Without horizontal
subsampling, the chroma line stride (in bytes) is thus equal to twice the luma
line stride. With horizontal subsampling by 2, the chroma line stride is equal
to the luma line stride. Vertical subsampling doesn't affect the line stride.
For non-contiguous formats, no constraints are enforced by the format on the
relationship between the luma and chroma line padding and stride.
All components are stored with the same number of bits per component.
.. raw:: latex
\footnotesize
.. tabularcolumns:: |p{5.2cm}|p{1.0cm}|p{1.5cm}|p{1.9cm}|p{1.2cm}|p{1.8cm}|p{2.7cm}|
.. flat-table:: Overview of Semi-Planar YUV Formats
:header-rows: 1
:stub-columns: 0
* - Identifier
- Code
- Bits per component
- Subsampling
- Chroma order [1]_
- Contiguous [2]_
- Tiling [3]_
* - V4L2_PIX_FMT_NV12
- 'NV12'
Annotation
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.