Expand description
MNF5 (v0.5 format): atlas codec, zlib container.
Structs§
- Atlas
- Atlas: previously decoded patches, ranked lookup by signature.
- Decode
Limits - Configurable decoder resource ceilings (review fix 3). Defaults are the format-derived maxima; callers decoding untrusted input can tighten any of them independently.
- Decode
Result - Decoded image: dims + RGB8 pixels.
- Dims
- Image dimensions in pixels.
- Geom
Stats - Encode statistics (per-tile choices/savings; feeds vis maps).
- Sig
- Tile signature: RGB means used for nearest-neighbor ranking.
- Tile
- A tile: raw RGB data plus its (possibly partial) edge dims.
Enums§
- Mode
- Per-tile record kinds: literal or reference (v0.5 mode grammar).
Constants§
- ATLAS_
CAPACITY - Atlas cap: max distinct previously-decoded patches tracked.
- HEADER_
SIZE - Magic + header size (bytes):
MNF5+ 5×u32LE. - NUM_
TRANSFORMS - D8 geometric transforms considered (identity + rotation/reflection).
- RANK_
CANDIDATES - Best-N references evaluated per tile after signature ranking.
- TILE_
SIZE - Tile edge in pixels (both axes).
Functions§
- apply_
transform - Pixel bytes after D8 transform
t(deterministic integer perm). - build_
header - Build the 24-byte
MNF5header. - compress_
payload - zlib-compress the assembled record stream (level 9).
- decode
- Decode an MNF5 file (header + zlib payload) back to RGB8 pixels.
- decode_
with_ limits - Decode MNF5 with configurable ceilings.
- div_
ceil - Ceiling division.
- encode_
mnf5 - One-call MNF5 encode (the CLI’s pipeline exposed as API): split, encode the tile stream, compress, and assemble header + payload.
- encode_
stats - Encode + utilization counters (v0.6 exit metric: reference utilization).
- encode_
tiles - Encode a tile stream (row-major, tile_dims shapes) with optional atlas matching.
Raw bytes per tile: mode, optional idx, optional transform, body; mode 2 (geometric atlas,
v0.6) writes both index (u32 LE) and transform id (u8) after the mode byte.
use_geomextends matching to the D8 group; withuse_atlasonly, exact prior-patch references (v0.5 behavior) are used. - split_
tiles - Split an RGB8 pixel buffer into row-major Tiles (public: CLI uses the same tiling as encoder/decoder/tests — one definition of truth).
- tile_
dims - (w,h) of tile
t, respecting partial edge tiles. - tile_
grid - (tiles_per_row, tile_rows) for the row-major tile scan.
- tile_
proxy_ cost - Cost proxy for one tile’s contribution to the compressed stream. ponytail: per-tile zlib call is O(128) small compressions per tile — fine at benchmark scale; if profiling shows it hot, cache or use a rolling window.
- tile_
sig - Compute a tile’s signature for atlas ranking.
- transform_
dims - Dims of a tile after D8 transform
t(swapped for rotations). - transform_
is_ valid_ for - Which transforms keep the tile shape (a reference must reproduce tw x th): all 8 on square patches, only the identity/hflip/vflip/rot180 subgroup on non-square partial tiles.