Skip to main content

Module preprocess

Module preprocess 

Source
Expand description

Fixed-buffer preprocess helpers (Phase 1/V1).

Hot path: no heap. Caller supplies workspace and output buffers.

Functions§

iou_u16
IoU of two axis-aligned boxes in normalized u16 coordinates.
letterbox_rgb8
Letterbox RGB into square/out buffer with grey pad (114). Returns scale and pad (x,y) as u32 pixels.
letterbox_workspace_bytes
Workspace bytes for letterbox RGB8 of size out_w × out_h.
nms_class_agnostic
Class-agnostic NMS into out (copies survivors). Returns count written. workspace must hold at least n bool flags as bytes (0/1).
normalize_rgb8_to_f32_chw
Normalize RGB8 to planar f32 CHW in out (len ≥ 3 * w * h). Mean/std per channel.
resize_nearest_rgb8
Nearest-neighbour resize RGB8 → RGB8 into caller buffer (out_w * out_h * 3 bytes).