code wiki / _hdl_build / nx_v128_probe.nx

nx_v128_probe.nx

buildroot/runtime/_hdl_build/nx_v128_probe.nx

10915 B298 linesdepth 2pulls 3 transitivereach 1 importersview sourcekind probe
docsdependenciesstructsconstsfunctions

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

nx_syscalls.nx nx_vmotion.nx nx_v128_probe.nx nx_v128_gate.nx

imports: nx_syscalls.nxnx_vmotion.nx

imported by: nx_v128_gate.nx

structs

none

consts

18const K_MAGIC_2147483647: i64 = 2147483647
19const K_MAGIC_5381: i64 = 5381
20const K_MAGIC_1000003: i64 = 1000003
21const K_MAGIC_8192: i64 = 8192
22const K_MAGIC_4096: i64 = 4096

functions

25func 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
41func pvr_sad_capped(cur: *u8, prev: *u8, W: i64, cx: i64, cy: i64, px: i64, py: i64, T: i64, cap: i64) -> i64
65func 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
76func 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
113func pv_fill(base: i64, seed: i64, W: i64, H: i64) -> i64
called by 1: main
147func pv_sweep_scalar(base: i64, W: i64, H: i64, qp: i64) -> i64
192func pv_sweep_simd(base: i64, W: i64, H: i64, qp: i64) -> i64
called by 1: main calls 3: pv_search_kvm_sadvm_sad_capped
236func pv_time_scalar(base: i64, W: i64, H: i64, qp: i64) -> i64
calls 1: pv_search_k
258func pv_time_simd(base: i64, W: i64, H: i64, qp: i64) -> i64
calls 1: pv_search_k
282func pv_sad16(a: i64, b: i64) -> i64
called by 1: main calls 1: v128_sad16
287func pv_sad16_ref(a: i64, b: i64) -> i64