code wiki / (root) / nx_hevc_ctx.nx

nx_hevc_ctx.nx

buildroot/runtime/nx_hevc_ctx.nx

4678 B44 linesdepth 2pulls 2 transitivereach 0 importersview sourcekind tooltopic hevc
docsdependenciesstructsconstsfunctions

about

nx_hevc_ctx.nx -- SOVEREIGN HEVC CABAC context-model set, RUNG 3b-1 of the HEVC decoder. The per-syntax-element context models for an I-slice (initType 0): normative initValues (H.265 Tables 9-5..9-37) laid out with named offsets, initialized to (pStateIdx,valMps) via the R2 formula at SliceQpY. These feed R3b-2..5 (coding_quadtree / coding_unit / residual_coding). Self-test: init at QP26, confirm every state in [0,62] and mps in {0,1}. NOTE: the initValue numbers are the normative tables; their exact correctness is proven end-to-end at R6 (first reconstructed frame). No third party. license_tier: ORIGINAL

dependencies 1 imports · 0 importers

nx_syscalls.nx nx_hevc_ctx.nx

imports: nx_syscalls.nx

imported by: nobody (leaf or entry point)

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

main sys_mmap parse_nums pe sys_write pn sys_mmap ↻ sys_write ↻ ctx_init1 clip3

structs

none

consts

none

functions

9func pe(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} return sys_write(1,s,n) }
called by 1: main calls 1: sys_write
10func pn(v: i64) -> i64 { var m: i64=v; if m<0{m=0-m} let b: *u8=sys_mmap(32); var i: i64=32; if m==0{i=i-1;b[i]=(48 as u8)} while m>0{let q: i64=m/10; i=i-1; b[i]=((48+(m-q*10)) as u8); m=q} if v<0{i=i-1;b[i]=(45 as u8)} return sys_write(1,((b as i64)+i) as *u8,32-i) }
called by 1: main calls 2: sys_mmapsys_write
11func parse_nums(s: *u8, out: *i64) -> i64 { var n: i64=0; var i: i64=0; var cur: i64=0; var has: i64=0; while s[i]!=(0 as u8){ let c: i64=s[i] as i64; if c>=48 { if c<=57 { cur=cur*10+(c-48); has=1 } else { if has==1{out[n]=cur;n=n+1;cur=0;has=0} } } else { if has==1{out[n]=cur;n=n+1;cur=0;has=0} } i=i+1 } if has==1{out[n]=cur;n=n+1} return n }
called by 1: main
12func clip3(lo: i64, hi: i64, v: i64) -> i64 { if v<lo {return lo} if v>hi {return hi} return v }
called by 1: ctx_init1
14func ctx_init1(ctx: *i64, k: i64, iv: i64, qp: i64) -> i64
called by 1: main calls 1: clip3
21func main(argc: i64, argv: *i64) -> i64