code wiki / _hdl_build / nx_codec_real_rd3.nx
nx_codec_real_rd3.nx
buildroot/runtime/_hdl_build/nx_codec_real_rd3.nx
about
nx_codec_real_rd3.nx -- the INTRA-PREDICTED patent-free intra codec on a REAL frame (576x1024 luma).
The efficiency rung above nx_codec_real_rd2 (modeled entropy): adds sovereign 8x8 directional INTRA
PREDICTION (DC/V/H/DDR, generalizing nx_intra_pred's 4x4 modes), so each block is predicted from its
already-RECONSTRUCTED neighbors and only the small residual is transform-coded. Pipeline per 8x8 block:
pick mode by SAD vs reconstructed-neighbor prediction -> residual = orig - pred -> 2D DCT (nx_dct8,
EXPIRED) -> perceptual quant (nx_qt_luma) -> zigzag -> [recon: dequant -> IDCT -> +pred -> clamp ->
feed forward]. Entropy: per-block mode byte + DC-diff/run-size symbols (nx_jsym) -> rANS (nx_rans,
PD); magnitude bits raw. HONEST total = 512B table + 64B quant + 8B hdr + rANS(symbols incl modes) +
magbits. The decoder REPLAYS prediction from its own reconstructed neighbors; rec(enc)==rec(dec)
pixel-exact is the liar-kill. Bordered recon buffer (1px 128 border) makes all 4 modes always
available with no edge special-casing. Every tool EXPIRED/PD; no CABAC; integer-only; no gcc. license_tier: ORIGINAL
dependencies 9 imports · 0 importers
imports: nx_syscalls.nxnx_itoa_lib.nxnx_h264_bitwriter.nxnx_dct8.nxnx_quant_table.nxnx_zigzag.nxnx_jpeg_huff_enc.nxnx_jpeg_sym.nxnx_rans.nx
imported by: nobody (leaf or entry point)
call flow from main pre-order; caps 40 nodes / depth 6 declared; ↻ = already shown
structs
| none |
consts
| 21 | const K_MAGIC_1024: i64 = 1024 |
| 22 | const K_MAGIC_4096: i64 = 4096 |
functions
| 24 | func 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 } |
| 29 | func g_num(v: i64) -> i64 { nxi_out(v); return 0 } |
| 30 | func 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 } |
| 35 | func g_wn(fd: i64, v: i64) -> i64 { nxi_fd(fd, v); return 0 } |
| 36 | func iabs(v: i64) -> i64 { if v<0 { return 0-v } return v } |
| 37 | func qrnd(v: i64, q: i64) -> i64 { if v>=0 { return (v + q/2)/q } return 0 - (((0-v) + q/2)/q) } called by 1: main |
| 41 | func pred8(rec: *u8, RW: i64, px: i64, py: i64, mode: i64, pred: *i64) -> i64 called by 1: main |
| 72 | func sad8(fb: *u8, W: i64, px: i64, py: i64, pred: *i64) -> i64 |
| 78 | func main() -> i64 |