code wiki / (root) / nx_deflate_enc.nx

nx_deflate_enc.nx

buildroot/runtime/nx_deflate_enc.nx

7603 B155 linesdepth 2pulls 2 transitivereach 191 importersview sourcekind librarytopic deflate
docsdependenciesstructsconstsfunctions

about

nx_deflate_enc.nx -- SOVEREIGN DEFLATE (RFC 1951) COMPRESSOR: LZ77 + FIXED Huffman (BTYPE=01). Pure integer, no zlib. The COUNTERPART to nx_deflate.nx (which only inflates). Turns our uncompressed PNGs (590KB/frame raw) into real compressed ones so renders ship full-resolution. LZ77 hashes 3 bytes -> most-recent position (single candidate, extends fully -> zero/near-repeat runs after PNG filtering compress well = RLE-class + literal-repeat). Bit packing per spec: data elements LSB-first, Huffman codes MSB-first (bit-reversed). Verified round-trip against nx_deflate's inflate. license_tier: ORIGINAL

dependencies 1 imports · 4 importers

nx_syscalls.nx nx_deflate_enc.nx nx_apng.nx nx_deflate_enc_gate.nx nx_png.nx nx_sovgit_obj.nx

imports: nx_syscalls.nx

imported by: nx_apng.nxnx_deflate_enc_gate.nxnx_png.nxnx_sovgit_obj.nx

structs

none

consts

8const DFE_MAGIC_1025: i64 = 1025
9const DFE_MAGIC_1537: i64 = 1537
10const DFE_MAGIC_2049: i64 = 2049
11const DFE_MAGIC_3073: i64 = 3073
12const DFE_MAGIC_4097: i64 = 4097
13const DFE_MAGIC_6145: i64 = 6145
14const DFE_MAGIC_8193: i64 = 8193
15const DFE_MAGIC_12289: i64 = 12289
16const DFE_MAGIC_16385: i64 = 16385
17const DFE_MAGIC_24577: i64 = 24577
19const DFE_HSIZE: i64 = 32768
20const DFE_WINDOW: i64 = 32768
21const DFE_MINMATCH: i64 = 3
22const DFE_MAXMATCH: i64 = 258

functions

25func dfe_bits(out: *u8, st: *i64, val: i64, n: i64) -> i64
called by 2: dfe_symdfe_deflate
37func dfe_rev(code: i64, n: i64) -> i64
called by 2: dfe_symdfe_deflate
44func dfe_sym(out: *u8, st: *i64, s: i64) -> i64
called by 1: dfe_deflate calls 2: dfe_bitsdfe_rev
51func dfe_hash(src: *u8, p: i64) -> i64
called by 1: dfe_deflate
54func dfe_matchlen(src: *u8, a: i64, b: i64, slen: i64) -> i64
called by 1: dfe_deflate
68func dfe_deflate(src: *u8, slen: i64, out: *u8, head: *i64, lbase: *i64, lext: *i64, dbase: *i64, dext: *i64) -> i64
116func dfe_fill_tables(lbase: *i64, lext: *i64, dbase: *i64, dext: *i64) -> i64
called by 1: dfe_compress
141func dfe_compress(src: *u8, slen: i64, out: *u8) -> i64