code wiki / _hdl_build / nx_vcodec_mvbits_probe.nx
nx_vcodec_mvbits_probe.nx
buildroot/runtime/_hdl_build/nx_vcodec_mvbits_probe.nx
about
nx_vcodec_mvbits_probe.nx -- MEASURE the MV-coding overhead (handoff doctrine: sensor before build). Our MV
syntax is ve_vput = flat [5-bit length][payload] per component + 4 qpel bits, coded ABSOLUTE (no prediction).
x264 codes MV DELTAS vs the median of {left, top, top-right} neighbours -- near-zero deltas on smooth motion
fields. This probe runs the REAL encoder (emode 4005, recon-chained, key+11P like arm_p) and, per coded MB,
re-derives the same skip gate + integer/qpel-free MV the coder finds, tallying: (a) actual ve_vput bits,
(b) bits if coded as delta-vs-median with the SAME VLC, (c) delta-vs-median with an exp-golomb VLC (the
H.264-class mvd code). Against the frame's REAL total bytes -> MV share % and the measured prize of median
prediction. Approximation: 16x16-level only (partition sub-MVs ignored -> UNDER-counts, conservative). license_tier: ORIGINAL
dependencies 3 imports · 0 importers
imports: nx_syscalls.nxnx_video_codec_wasm.nxnx_quality_metric.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
| 13 | const NW: i64 = 576 |
| 14 | const NH: i64 = 1024 |
| 15 | const EMODE: i64 = 4005 |
functions
| 17 | func gw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 18 | func gn(v: i64) -> i64 |
| 23 | func seedctxe(rctx: *i64, emode: i64, est: *i64, probs: *i64, rcbuf: *u8, t8c: *i64) -> i64 |
| 26 | func zero(p: *u8, n: i64) -> i64 { var i: i64=0; while i<n { p[i]=0 as u8; i=i+1 } return 0 } called by 1: main |
| 27 | func zze(v: i64) -> i64 { if v < 0 { return ((0 - v) << 1) - 1 } return v << 1 } |
| 28 | func blen(z: i64) -> i64 { var n: i64 = 0; var x: i64 = z; while x > 0 { n = n + 1; x = x >> 1 } return n } |
| 30 | func vbits(v: i64) -> i64 { return 5 + blen(zze(v)) } |
| 32 | func gbits(v: i64) -> i64 { return 2*blen(zze(v)+1) - 1 } |
| 33 | func med3(a: i64, b: i64, c: i64) -> i64 called by 1: main |
| 38 | func main() -> i64 |