Skip to main content

Module convert

Module convert 

Source
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§

DeviceFormat
Target geometry: the device format the ring advertises.
I420Buffer
Owned, tightly packed I420 buffer used as the normalization scratch.
I420View
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.
RangeLut 🔒
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 sw x sh that fits into dw x dh preserving 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 o to src, producing a tightly packed upright copy in out. 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 h for odd turn counts), mirroring each destination row for hflip.
range_lut 🔒
range_luts 🔒
The LUTs that move src samples 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 packed dw x dh), halving first while the source is more than twice the destination in either dimension.
yuyv_scalar 🔒