code wiki / _hdl_build / nx_deflate_fixed.nx

nx_deflate_fixed.nx

buildroot/runtime/_hdl_build/nx_deflate_fixed.nx

6674 B137 linesdepth 3pulls 3 transitivereach 12 importersview sourcekind librarytopic deflate
docsdependenciesstructsconstsfunctions

about

nx_deflate_fixed.nx -- SOVEREIGN DEFLATE ENCODER (RFC1951 block type 1, fixed Huffman). rung 1: literals + EOB (bit-packing proven vs our inflate). rung 2 (THIS): LZ77 back-references = actual COMPRESSION. THE codec-exceed unlock (X-CDC-DEFLATE-ENC-001): the team owned inflate (decode) but no compressor; now a sovereign same-corpus PNG/gzip-class baseline is measurable. Self-validating: dfl_decode wraps our _inflate_lib inflate, so (dfl_encode,dfl_decode) is an inverse pair the EARNED pe16 GATE_HARNESS gates (3rd rider) -- no external tool, no fabrication. Bit conventions (match _inflate_lib ibr/ihd EXACTLY): bitstream LSB-first per byte; Huffman codes MSB-first; extra bits LSB-first. Fixed lit/len codes: sym 0-143->8b 0x30+s, 144-255->9b 0x190+, 256-279->7b s-256, 280-287->8b 0xC0+(s-280). Fixed distance: 5-bit code = dist-symbol. Match emission order (per icodes): length-code, length-extra, distance-code, distance-extra. Greedy longest-match over a back-window (brute-force; correctness-first -- hash-chain speed = rung3). LAWS: struct-free, integer-only, flat ifs, no &&/||, <=6 args. license_tier: ORIGINAL

dependencies 2 imports · 9 importers

_inflate_lib_authored.nx nx_syscalls.nx nx_deflate_fixed.nx _codec_bench.nx _codec_bench2.nx _codec_bench_med.nx _codec_real_med.nx _dfl_comp_test.nx _dfl_enc_gate.nx _dfl_rtgate.nx _dfl_rtgate_sa.nx _dfl_specgate.nx

imports: _inflate_lib_authored.nxnx_syscalls.nx

imported by: _codec_bench.nx_codec_bench2.nx_codec_bench_med.nx_codec_real_med.nx_dfl_comp_test.nx_dfl_enc_gate.nx_dfl_rtgate.nx_dfl_rtgate_sa.nx_dfl_specgate.nx

structs

none

consts

16const K_MAGIC_1025: i64 = 1025
17const K_MAGIC_1537: i64 = 1537
18const K_MAGIC_2049: i64 = 2049
19const K_MAGIC_3073: i64 = 3073
20const K_MAGIC_4097: i64 = 4097
21const K_MAGIC_6145: i64 = 6145
22const K_MAGIC_8193: i64 = 8193
23const K_MAGIC_12289: i64 = 12289
24const K_MAGIC_16385: i64 = 16385
25const K_MAGIC_24577: i64 = 24577
26const K_MAGIC_32768: i64 = 32768

functions

28func dfl_putbit(out: *u8, bp: *i64, b: i64) -> i64
38func dfl_putcode(out: *u8, bp: *i64, code: i64, len: i64) -> i64
called by 1: dfl_encode calls 1: dfl_putbit
44func dfl_putbits_lsb(out: *u8, bp: *i64, v: i64, k: i64) -> i64
called by 1: dfl_encode calls 1: dfl_putbit
50func dfl_lensym(L: i64, lens: *i64) -> i64
called by 1: dfl_encode
56func dfl_distsym(D: i64, dists: *i64) -> i64
called by 1: dfl_encode
62func dfl_matchlen(src: *u8, n: i64, a: i64, b: i64) -> i64
called by 1: dfl_match
72func dfl_match(src: *u8, n: i64, pos: i64, window: i64, res: *i64) -> i64
called by 1: dfl_encode calls 1: dfl_matchlen
90func dfl_encode(src: *u8, n: i64, out: *u8, outcap: i64) -> i64
135func dfl_decode(enc: *u8, m: i64, out: *u8, outcap: i64) -> i64