code wiki / _hdl_build / nx_codec_real_rd.nx

nx_codec_real_rd.nx

buildroot/runtime/_hdl_build/nx_codec_real_rd.nx

7877 B147 linesdepth 3pulls 5 transitivereach 0 importersview sourcekind tooltopic codec
docsdependenciesstructsconstsfunctions

about

nx_codec_real_rd.nx -- HONEST rate-distortion sweep of our SOVEREIGN patent-free intra codec on a REAL frame's luma (ref_frame0.yuv Y plane, 576x1024). Mirrors nx_intra_image (the Phase-1 capstone): per 8x8 block [level-shift -> 2D DCT-II (nx_dct8, EXPIRED math) -> scalar quantize Q] -> 16-bit serialize -> ONE amortized rANS (nx_rans, PUBLIC DOMAIN) over the whole image. HONEST total = 512B table + 8B header + rANS payload (table NOT hidden). Sweeps Q to produce an RD curve; prints total bytes + SSE per Q so the harness can compute PSNR and compare vs x264. Entropy round-trip is asserted bit-exact each Q (liar-kill: compression numbers only count if the codec is provably correct -- we own both ends, so lossless entropy is the correctness oracle). Every tool EXPIRED or PUBLIC-DOMAIN; no CABAC; integer-only; nx_cc->nxasm, no gcc. license_tier: ORIGINAL

dependencies 4 imports · 0 importers

nx_syscalls.nx nx_itoa_lib.nx nx_dct8.nx nx_rans.nx nx_codec_real_rd.nx

imports: nx_syscalls.nxnx_itoa_lib.nxnx_dct8.nxnx_rans.nx

imported by: nobody (leaf or entry point)

call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown

main g_puts sys_write sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close g_num nxi_out nxi_fd sys_mmap ↻ ccz_cat_num sys_write ↻ sys_munmap sys_exit nx_dct8_init sys_openat_append nx_dct8_forward_2d nx_dct8_forward_1d qround rans_count rans_normalize rans_cum rans_build_slot2sym rans_encode sys_mmap ↻ rans_decode nx_dct8_inverse_2d nx_dct8_inverse_1d iabs g_w sys_write ↻ g_wn nxi_fd ↻ sys_close ↻

structs

none

consts

14const K_MAGIC_1024: i64 = 1024
15const K_MAGIC_589824: i64 = 589824
16const K_MAGIC_9216: i64 = 9216
17const K_MAGIC_32768: i64 = 32768
18const K_MAGIC_65536: i64 = 65536

functions

20func g_puts(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 1: main calls 1: sys_write
25func g_num(v: i64) -> i64 { nxi_out(v); return 0 }
called by 1: main calls 1: nxi_out
26func g_w(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 }
called by 1: main calls 1: sys_write
31func g_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 }
called by 1: main calls 1: nxi_fd
32func iabs(v: i64) -> i64 { if v<0 { return 0-v } return v }
called by 1: main
33func qround(v: i64, q: i64) -> i64 { if v>=0 { return (v + q/2)/q } return 0 - (((0-v) + q/2)/q) }
called by 1: main
35func main() -> i64