code wiki / _hdl_build / nx_poseest2.nx
nx_poseest2.nx
buildroot/runtime/_hdl_build/nx_poseest2.nx
about
nx_poseest2.nx -- R2 v0 with the pose-estimate funcs INLINED (importing nx_pose_estimate TOGETHER WITH
nx_figure_render tripped an nx_cc empty-.s codegen bug; each alone compiles -> module-combination bug, routed
to the compiler workstream). Learned hand-region-from-silhouette, held-out generalization. expect_exit:0 ORIGINAL
dependencies 2 imports · 0 importers
imports: nx_syscalls.nxnx_figure_render.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
| 6 | const K_MAGIC_1900000000: i64 = 1900000000 |
| 7 | const K_MAGIC_12868: i64 = 12868 |
| 12 | const PW: i64 = 64 |
| 13 | const PH: i64 = 48 |
| 14 | const GW: i64 = 8 |
| 15 | const GH: i64 = 6 |
| 16 | const NCELL: i64 = 48 |
| 17 | const NFEAT: i64 = 49 |
| 18 | const NR: i64 = 3 // hand HEIGHT bands (low/mid/high) -- the signal shoulder pitch most strongly drives |
| 19 | const NTR: i64 = 30 |
| 20 | const NHO: i64 = 9 |
| 21 | const NALL: i64 = 39 |
functions
| 9 | func hw(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 10 | func pn(v: i64) -> i64 { let b: *u8=sys_mmap(32) as *u8; var x: i64=v; var ng: i64=0; if x<0{ng=1;x=0-x} var i: i64=31; if x==0{b[i]=48 as u8;i=i-1} while x>0{b[i]=(48+x%10) as u8;x=x/10;i=i-1} if ng==1{b[i]=45 as u8;i=i-1} sys_write(1,(b as i64+i+1) as *u8,31-i); return 0 } |
| 24 | func pe_occ(zb: *i64, w: i64, h: i64, gw: i64, gh: i64, occ: *i64) -> i64 called by 1: pe_sample |
| 42 | func pe_score(W: *i64, r: i64, occ: *i64, nf: i64) -> i64 { var s: i64=0; var c: i64=0; while c<nf { s=s+W[r*nf+c]*occ[c]; c=c+1 } return s } called by 1: pe_predict |
| 43 | func pe_predict(W: *i64, occ: *i64, nf: i64, nr: i64) -> i64 { var best: i64=0; var bs: i64=pe_score(W,0,occ,nf); var r: i64=1; while r<nr { let s: i64=pe_score(W,r,occ,nf); if s>bs { bs=s; best=r } r=r+1 } return best } |
| 44 | func pe_train(W: *i64, occs: *i64, labels: *i64, ns: i64, nf: i64, nr: i64, ep: i64) -> i64 |
| 59 | func clamp3(v: i64) -> i64 { if v < 0 { return 0 } if v > 2 { return 2 } return v } called by 1: main |
| 60 | func pdg(d: i64) -> i64 { return d * K_MAGIC_12868 / 180 } // degrees -> rig angle unit (md_deg lives in nx_movelib, not imported here) called by 1: pe_sample |
| 61 | func pe_sample(sk: i64, fb: *i64, zb: *i64, pitch: i64, elbow: i64, occ: *i64, wxy: *i64) -> i64 |
| 71 | func main() -> i64 |