code wiki / (root) / nx_pwg_rle.nx

nx_pwg_rle.nx

buildroot/runtime/nx_pwg_rle.nx

9546 B217 linesdepth 0pulls 0 transitivereach 9 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_pwg_rle.nx -- the PackBits-like run-length codec shared by PWG-Raster AND URF (Apple Raster). This is the pixel-data encoding of "driverless" printing -- the bytes a real IPP printer rasterizes. Verified against the AUTHORITATIVE CUPS/PWG raster spec (sovereign-fetched, cited: knowledge/fetched/cups_raster_spec.raw, lines 483-501): - Each LINE begins with a 1-byte line-repeat count = (repeats - 1): 0x00 = appears once, 0xFF = 256x. - Within a line, whole pixels ("colors") are PackBits-encoded: control 0x00..0x7F -> REPEATED run: (ctrl+1) copies of the ONE following pixel (count 1..128) control 0x80..0xFF -> LITERAL run: (257-ctrl) following pixels verbatim (count 2..128) - one pixel = bpp bytes (sgray_8 -> 1 byte; sRGB -> 3 bytes). Cross-checked on the spec's worked example line 00 FE FFFF00 0000FF FFFF00 02 FFFFFF 00 00FF00 00 FFFFFF = yellow,blue,yellow, white,white,white, green, white (proves the decoder matches the spec). NEVER-BRICK (#26): pure byte arithmetic; NO syscalls, no hardware access. Sovereign (no imports). no_silent_failure: the decoder bounds-checks every read/write and returns -1 on truncation/overrun. genealogy_id: project-printer-management-ipp-sclass-2026-06-20 ; license_tier: ORIGINAL

dependencies 0 imports · 9 importers

nx_pwg_rle.nx nx_doc_print.nx nx_doc_to_urf.nx nx_doc_to_urf_test.nx nx_img_print.nx nx_ipp_submit_test.nx nx_toner_track.nx nx_urf.nx nx_urf_make.nx nx_urf_test.nx

imports: none

imported by: nx_doc_print.nxnx_doc_to_urf.nxnx_doc_to_urf_test.nxnx_img_print.nxnx_ipp_submit_test.nxnx_toner_track.nxnx_urf.nxnx_urf_make.nxnx_urf_test.nx

structs

none

consts

none

functions

20func nx_rle_px_eq(line: *u8, i: i64, j: i64, bpp: i64) -> i64
called by 1: nx_rle_encode_line
31func nx_rle_line_eq(bitmap: *u8, width: i64, bpp: i64, ya: i64, yb: i64) -> i64
called by 1: nx_rle_encode_page
45func nx_rle_encode_line(line: *u8, width: i64, bpp: i64, out: *u8, off0: i64) -> i64
called by 1: nx_rle_encode_page calls 1: nx_rle_px_eq
107func nx_rle_encode_page(bitmap: *u8, width: i64, height: i64, bpp: i64, out: *u8) -> i64
134func nx_rle_decode(src: *u8, n: i64, width: i64, height: i64, bpp: i64, out: *u8, out_cap: i64) -> i64
called by 4: mainmainmainmain