Skip to main content

Module ops

Module ops 

Source
Expand description

Pixel operations — scalar, bounds-checked, and the oracle for every faster twin.

The conversions and downscales a camera pipeline needs moved to rusty_esp_dsp::pixel (D0, 2026-09-02) and are re-exported here at the paths this crate always had, so a caller sees no change; the crop and rotate helpers, which only this crate uses, stay. Colour conversion is BT.601 full-range (the JFIF convention), fixed-point with an 8-bit fraction — the same arithmetic on every platform.

Functions§

crop
Crop a packed frame to the rectangle at (x, y) of size w×h.
downscale2x_gray8
2× box downscale of a Gray8 image; odd trailing rows/columns are dropped. Returns the output geometry.
downscale2x_rgb565
2× box downscale of an RGB565 (LE) image, per channel.
pack_rgb565
Pack an RGB888 pixel as little-endian RGB565.
rgb565_to_rgb888
RGB565 (LE) → RGB888. src holds pixels × 2 bytes, dst pixels × 3.
rgb888_to_rgb565
RGB888 → RGB565 (LE).
rotate90_gray8
Rotate a Gray8 image 90° clockwise. Output is height×width.
rotate180
Rotate a packed image 180° in place-compatible fashion (into dst).
unpack_rgb565
Unpack a little-endian RGB565 pixel to RGB888, replicating the top bits into the low bits so white stays white.
yuv_to_rgb
BT.601 full-range YCbCr → RGB888, fixed-point.
yuyv_to_gray8
YUYV → Gray8: the luma bytes.
yuyv_to_rgb565
YUYV → RGB565 (LE).
yuyv_to_rgb888
YUYV (Y0 U Y1 V) → RGB888. src holds pixels × 2 bytes (pixels even).