code wiki / _hdl_build / nx_vcodec_layout_gate.nx

nx_vcodec_layout_gate.nx

buildroot/runtime/_hdl_build/nx_vcodec_layout_gate.nx

11348 B197 linesdepth 6pulls 17 transitivereach 0 importersview sourcekind gate/prooftopic vcodec
docsdependenciesstructsconstsfunctions

about

nx_vcodec_layout_gate.nx -- PROVE the vcv-10 MV-plane placement is collision-free in the CLIENT's PACKED context slab at PRODUCTION geometry (F617/seq246). Context: nx_faithdiff proved rct9 lowers to wasm BIT-EXACTLY (VM==native, 0 unfaithful) => the field defect (probe835: rx flowing, dec=-1) is INTEGRATION. The ONE untested seam: every bench/probe gives the MV plane an ISOLATED mmap, but the browser DERIVES it as CX+VV_CTX_MVPLANE (0x32000) INSIDE the shared context slab that also holds the range-coder scratch (CX+0x1800). At 416x320 (the shipped tier) a KEYFRAME's rc section is far larger than any bench frame -- if it overruns 0x32000 it silently clobbers the plane => wrong MV predictors => undecodable P-frames => exactly the observed signature. This gate MEASURES instead of estimating (scale-law: declare the envelope, never assume it): T1 rc high-water: pattern-fill the slab, run key+P with the plane held ISOLATED (so nothing legitimately writes high in the slab), then scan for the HIGHEST byte the codec touched. PASS iff high_water < 0x32000 (the packed placement has real clearance). T2 A/B equivalence: the SAME key+P roundtrip with the plane PACKED (CX+0x32000) vs ISOLATED must produce an IDENTICAL recon checksum. PASS iff equal (packed placement changes nothing). A T1/T2 failure PROVES the collision and mandates the fix shape: give the MV plane its OWN dedicated region passed EXPLICITLY (the proven R_HEAT/heatp pattern), never a base+offset carve. license_tier: ORIGINAL No hw writes (Rule 26). expect_exit: 0

dependencies 2 imports · 0 importers

nx_video_codec_wasm.nx nx_gate_verdict.nx nx_vcodec_layout_gate.nx

imports: nx_video_codec_wasm.nxnx_gate_verdict.nx

imported by: nobody (leaf or entry point)

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

main gv_head gv_puts sys_write gv_ctr sys_mmap lg_round vc_t8_init nx_dct8_init vc_t8p vv_enc_rct8 vc_enc_frame_packed_rct8 rc_enc_init nx_bw_put vc_aq_level vc_mb_mad vc_mb_t8_ok vc_enc_block_packed_e vc_enc_block_packed_i vm_sad_zero vs_skip nx_bw_put ↻ vc_intra_dc_sad vm_search vc_enc_mb4r_intra vm_sad vc_rd_part_inter vc_t8p ↻ vc_enc_mb_part8_inter vm_search_q vc_mvpred vc_gput vc_mvplane_set ve_vput vc_satd16_cand vc_rd_t8_inter vc_enc_mb8_intra vc_enc_mb8_inter vc_pred_px vc_coeff_enc

structs

none

consts

21const LW: i64 = 416 // shipped production tier (resTier cls-9 mid rung)
22const LH: i64 = 320
23const CX_EST: i64 = 0x80 // the CLIENT's exact VV_CTX_* offsets (nx_video_client_wasm.nx)
24const CX_PROBS: i64 = 0x180
25const CX_T8C: i64 = 0x280
26const CX_RCSCR: i64 = 0x1800
27const CX_MVPLANE: i64 = 0x32000
28const SLAB: i64 = 0x40000 // context slab we scan (256KB, past the plane)
29const PAT: i64 = 165 // 0xA5 canary
30const EMODE: i64 = 673 // production RTC: rc(1)+sig(32)+part(128)+deblock(512)

functions

38func lg_round(fbase: i64, cxbase: i64, plane: i64, kmode: i64, em: i64, obox: *i64) -> i64
116func main() -> i64