nx_pnm_decode.nx
buildroot/runtime/nx_pnm_decode.nx
about
nx_pnm_decode.nx -- Netpbm reader: P1/P2/P3 (ASCII) and P4/P5/P6 (binary),
the Unix lingua franca that every 90s toolchain could emit.
EXACTLY ONE WHITESPACE BYTE FOLLOWS THE HEADER of a binary variant, and the
payload starts immediately after it. Skipping "whitespace" greedily eats the
first pixel row whenever that row happens to begin with 0x20 or 0x0A -- a
corruption that appears only on some images, which is the worst kind.
COMMENTS MAY APPEAR BETWEEN ANY TWO HEADER FIELDS, including in the middle
of the dimensions, so comment skipping belongs in the token reader rather
than in a one-shot header pre-pass.
P1/P4 bitmaps invert the usual convention: 1 means BLACK.
genealogy_id: netpbm_pnm
lineage_id: nx_pnm_v1
license_tier: ORIGINAL
dependencies 1 imports · 2 importers
imports: nx_syscalls.nx
imported by: nx_img_bytes_to_rgb.nxnx_legacy_codec_gate.nx
structs
| none |
consts
| none |
functions
| 21 | func pnm_b(d: *u8, o: i64) -> i64 { return (d[o] as i64) & 255 } |
| 23 | func pnm_is_ws(c: i64) -> i64 |
| 35 | func pnm_tok(raw: *u8, n: i64, pos: *i64) -> i64 |
| 78 | func pnm_decode_rgb(raw: *u8, n: i64, out_wh: *i64) -> *u8 |