code wiki / _hdl_build / nx_v128_probe.nx
nx_v128_probe.nx
buildroot/runtime/_hdl_build/nx_v128_probe.nx
about
nx_v128_probe.nx -- F618 DIFFERENTIAL PROBE, POST-FLIP FORM (2026-07-21; no main; every fn exported
by the wat backend, imported natively by nx_v128_gate). Since the FLIP, the SHIPPING vm_* kernels
(nx_vmotion.nx) route T==16 rows through v128_sad16 -- scalar natively, INTERCEPTED to wasm-SIMD by
the shared emitter. The scalar REFERENCE therefore lives HERE as pvr_* copies of the pre-flip vm_*
bodies (pure per-pixel loops, no v128_sad16 call, so the intercept can never touch them).
pv_sweep_scalar / pv_time_scalar -> pvr_* (reference, scalar in EVERY lane)
pv_sweep_simd / pv_time_simd -> vm_* (shipping path: scalar native, SIMD in wasm)
The sweeps compute an ORDER-SENSITIVE rolling checksum over best-SAD + MV per macroblock (full
center-first search, cap-aborts live) plus an UNALIGNED raw-SAD pass and a capped-SAD pass.
scalar-chk == simd-chk == native-chk is the bit-exactness claim, mechanically. i64 multiply wraps
mod 2^64 identically in native x86, the sovereign VM, and V8 -- the checksum is portable-exact.
NOTE (inherited, both arms identically): sys_mmap is a 0-stub in the wasm lane, so the searchers'
32-byte b scratch sits at linear address 0 (the shipped codec's own behavior; sequential calls
re-init it). Frames must live well above -- callers use base >= 0x20000.
license_tier: ORIGINAL
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_vmotion.nx
imported by: nx_v128_gate.nx
structs
| none |
consts
| 18 | const K_MAGIC_2147483647: i64 = 2147483647 |
| 19 | const K_MAGIC_5381: i64 = 5381 |
| 20 | const K_MAGIC_1000003: i64 = 1000003 |
| 21 | const K_MAGIC_8192: i64 = 8192 |
| 22 | const K_MAGIC_4096: i64 = 4096 |
functions
| 25 | func pvr_sad(cur: *u8, prev: *u8, W: i64, cx: i64, cy: i64, px: i64, py: i64, T: i64) -> i64 called by 1: pv_sweep_scalar |
| 41 | func pvr_sad_capped(cur: *u8, prev: *u8, W: i64, cx: i64, cy: i64, px: i64, py: i64, T: i64, cap: i64) -> i64 |
| 65 | func pv_try_k(cur: *u8, prev: *u8, W: i64, H: i64, cx: i64, cy: i64, T: i64, dx: i64, dy: i64, b: *i64, k: i64) -> i64 |
| 76 | func pv_search_k(cur: *u8, prev: *u8, W: i64, H: i64, bx: i64, by: i64, T: i64, R: i64, mv: *i64, qp: i64, k: i64) -> i64 |
| 113 | func pv_fill(base: i64, seed: i64, W: i64, H: i64) -> i64 called by 1: main |
| 147 | func pv_sweep_scalar(base: i64, W: i64, H: i64, qp: i64) -> i64 |
| 192 | func pv_sweep_simd(base: i64, W: i64, H: i64, qp: i64) -> i64 |
| 236 | func pv_time_scalar(base: i64, W: i64, H: i64, qp: i64) -> i64 calls 1: pv_search_k |
| 258 | func pv_time_simd(base: i64, W: i64, H: i64, qp: i64) -> i64 calls 1: pv_search_k |
| 282 | func pv_sad16(a: i64, b: i64) -> i64 |
| 287 | func pv_sad16_ref(a: i64, b: i64) -> i64 |