code wiki / _hdl_build / nx_deflate_fixed.nx
nx_deflate_fixed.nx
buildroot/runtime/_hdl_build/nx_deflate_fixed.nx
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
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
| 16 | const K_MAGIC_1025: i64 = 1025 |
| 17 | const K_MAGIC_1537: i64 = 1537 |
| 18 | const K_MAGIC_2049: i64 = 2049 |
| 19 | const K_MAGIC_3073: i64 = 3073 |
| 20 | const K_MAGIC_4097: i64 = 4097 |
| 21 | const K_MAGIC_6145: i64 = 6145 |
| 22 | const K_MAGIC_8193: i64 = 8193 |
| 23 | const K_MAGIC_12289: i64 = 12289 |
| 24 | const K_MAGIC_16385: i64 = 16385 |
| 25 | const K_MAGIC_24577: i64 = 24577 |
| 26 | const K_MAGIC_32768: i64 = 32768 |
functions
| 28 | func dfl_putbit(out: *u8, bp: *i64, b: i64) -> i64 |
| 38 | func dfl_putcode(out: *u8, bp: *i64, code: i64, len: i64) -> i64 |
| 44 | func dfl_putbits_lsb(out: *u8, bp: *i64, v: i64, k: i64) -> i64 |
| 50 | func dfl_lensym(L: i64, lens: *i64) -> i64 called by 1: dfl_encode |
| 56 | func dfl_distsym(D: i64, dists: *i64) -> i64 called by 1: dfl_encode |
| 62 | func dfl_matchlen(src: *u8, n: i64, a: i64, b: i64) -> i64 called by 1: dfl_match |
| 72 | func dfl_match(src: *u8, n: i64, pos: i64, window: i64, res: *i64) -> i64 |
| 90 | func dfl_encode(src: *u8, n: i64, out: *u8, outcap: i64) -> i64 called by 11: bench_bufbench_framebench_bufmainbench_planemain+5 calls 7: sys_mmapdfl_putbitdfl_matchdfl_lensymdfl_putcodedfl_putbits_lsb+1 |
| 135 | func dfl_decode(enc: *u8, m: i64, out: *u8, outcap: i64) -> i64 |