Expand description
Normalization of decoded frames into the virtual device’s fixed format.
The device is a fixed-function camera: one raw pixel format at one size. Whatever the client camera delivers (any size, full- or limited-range luma) is fitted into that: the frame is scaled to fit with black bars when its size differs, full-range (JPEG) samples are compressed into the limited range every V4L2 consumer assumes, and the planes are emitted as I420, NV12, or YUYV. The common path — a frame already at the device size, limited range, I420 device — is a plain plane copy straight into the ring slot.
Structs§
- Device
Format - Target geometry: the device format the ring advertises.
- I420
Buffer - Owned, tightly packed I420 buffer used as the normalization scratch.
- I420
View - Borrowed I420 planes with arbitrary strides.
- Normalizer
- Scratch state kept across frames so normalization allocates only on geometry changes.
- Orientation
- One upright transform: clockwise quarter turns, then a horizontal mirror.
- Range
Lut 🔒 - Full-range to limited-range lookup tables (BT.601/709 quantization; the matrix is unchanged).
Constants§
- ORIENT_
TILE 🔒 - Destination square a quarter turn is taken in, so the source rows it gathers from stay in the innermost cache across the whole square.
Functions§
- bilinear_
plane 🔒 - Separable bilinear resample of one plane (fixed point 16.16).
- copy_
plane 🔒 - Copy a plane row by row, optionally through a range LUT.
- emit 🔒
- Emit
src(already at the device size) as the device fourcc. - fit
- Largest even-aligned size of
swxshthat fits intodwxdhpreserving aspect, and the even-aligned offsets that center it. - halve_
plane 🔒 - Average 2x2 blocks: exact halving, used before bilinear when the ratio exceeds 2 so strong downscales do not alias.
- orient_
i420 - Apply
otosrc, producing a tightly packed upright copy inout. The chroma planes of the rotated picture are exactly the rotated chroma planes (odd-turn chroma dimensions transpose with them), so each plane is oriented independently. - orient_
plane 🔒 - Rotate one plane clockwise into a tightly packed destination (whose width is
hfor odd turn counts), mirroring each destination row forhflip. - range_
lut 🔒 - range_
luts 🔒 - The LUTs that move
srcsamples into the device’s range: full-range JPEG into a limited-range raw device, limited-range video into the full-range MJPEG device, or nothing when the two agree. - scale_
plane 🔒 - Resample a plane into
dst(tightly packeddwxdh), halving first while the source is more than twice the destination in either dimension. - yuyv_
scalar 🔒