Skip to main content

mediaframe/source/
p210.rs

1//! P210 — semi‑planar 4:2:2, 10‑bit, high‑bit‑packed
2//! (`AV_PIX_FMT_P210LE`).
3//!
4//! 4:2:2 twin of [`super::P010`]: same Y + interleaved-UV plane shape
5//! and same high-bit-packed `u16` convention (10 active bits in the
6//! high 10 positions, low 6 zero), but chroma is **full-height** —
7//! one chroma row per Y row instead of one per two. NVDEC / CUDA HDR
8//! 4:2:2 download target and some QSV configurations.
9//!
10//! Per-row kernel reuses the 4:2:0 `p_n_to_rgb_*<10>` family verbatim
11//! (the per-row UV layout is identical to P010 — half-width
12//! interleaved); only the walker reads chroma row `r` instead of
13//! `r / 2`.
14
15use crate::frame::PnFrame422;
16
17walker! {
18  semi_planar_be {
19    /// Zero‑sized marker for the P210 source format.
20    #[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Hash)]
21    marker: P210,
22    frame: PnFrame422<'_, 10, BE>,
23    frame_le: PnFrame422<'_, 10, false>,
24    row: P210Row,
25    sink: P210Sink,
26    walker: p210_to,
27    walker_endian: p210_to_endian,
28    elem_type: u16,
29    chroma_field: uv_half,
30    chroma_plane: uv,
31    chroma_stride: uv_stride,
32    chroma_elems_per_row: |w| w,
33    chroma_v: full,
34    row_doc: "One output row of a P210 source handed to a [`P210Sink`].\n\n\
35              Carries borrows to the source slices (full-width Y, half-width interleaved\n\
36              UV — full-height, one UV row per Y row) plus the row index and\n\
37              matrix/range carry-throughs. Each `u16` element is high-bit-packed.",
38    walker_doc: "Walks a [`P210Frame`](crate::frame::P210Frame) row by row into the sink. Each Y row has its\n\
39                 own corresponding UV row (4:2:2 — full-height chroma).",
40  }
41}