nx_tga_decode.nx
buildroot/runtime/nx_tga_decode.nx
about
nx_tga_decode.nx -- Truevision TGA reader (the DOS/Amiga-era workhorse).
Types handled: 1/9 colour-mapped (8-bit index), 2/10 truecolour (16/24/32),
3/11 grayscale (8) -- the 9/10/11 variants being the RLE forms of the same
pixel layouts, which is why the RLE unpack sits BEFORE the pixel decode and
both paths share it. Refused: types 32/33 (Huffman+delta), colour maps
whose entry size is not 15/16/24/32.
THE ORIGIN BIT IS NOT DECORATION. Bit 5 of the image descriptor selects
top-left vs bottom-left row order. A reader that ignores it returns a
vertically MIRRORED image that is otherwise perfectly valid-looking -- the
single most common TGA defect, and invisible to any check that only
compares dimensions or means.
16-bit is A1R5G5B5 with 5-bit channels replicated to 8 (v<<3|v>>2), NOT
shifted-and-zero-filled: the latter loses white (31 -> 248, never 255).
genealogy_id: tga_spec_2_0
lineage_id: nx_tga_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
| 24 | func tga_b(d: *u8, o: i64) -> i64 { return (d[o] as i64) & 255 } |
| 25 | func tga_u16(d: *u8, o: i64) -> i64 { return tga_b(d,o) | (tga_b(d,o+1) << 8) } |
| 28 | func tga_x5(v: i64) -> i64 { return (v << 3) | (v >> 2) } called by 1: tga_px |
| 32 | func tga_px(src: *u8, so: i64, bpp: i64, rgb: *u8, dof: i64) -> i64 |
| 55 | func tga_unrle(raw: *u8, n: i64, start: i64, npix: i64, bpp: i64, out: *u8) -> i64 |
| 86 | func tga_decode_rgb(raw: *u8, n: i64, out_wh: *i64) -> *u8 |