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.

Functions§

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.
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.