code wiki / _hdl_build / nx_ng_avatar.nx
nx_ng_avatar.nx
buildroot/runtime/_hdl_build/nx_ng_avatar.nx
about
nx_ng_avatar.nx -- CAP-NEURAL-AVATAR, generation 13: animatable neural humans / gaussian avatars (the
Samsung-Moscow neural-avatar lineage, src ng_region_ru_neuralavatars + gaussian-avatar work). The defining
property past a STATIC 3D scene (3DGS/NeRF): one CANONICAL set of primitives is DEFORMED by a pose/expression
parameter (a deformation field maps canonical -> posed) so a SINGLE learned model renders MANY poses -- and a
NOVEL pose (not trained) is produced by INTERPOLATING the same deformation = generalization, not memorization.
Reuses the splat machinery: a canonical gaussian has center mu0; pose theta moves it mu(theta)=mu0 + theta*db
(a learnable per-gaussian deform basis db). Render = splat at the posed center (CAP-GS-REALTIME footprint) into
a 1D image; fit the deform basis from a few posed target frames. Q16, no float.
Honest gated proof: T1 ANIMATABLE -- after fitting db from training poses, the model REPRODUCES those poses
(loss->~0). T2 NOVEL-POSE GENERALIZATION -- a pose theta NOT in training renders correctly (the gaussian lands
at the right place) because the deform is linear in theta = interpolation, not a stored frame (the load-bearing
avatar property). T3 NEG-CONTROL -- a STATIC model (no deform, db=0) CANNOT match the posed frames (high loss):
the deformation is what's doing the work. T4 BIT-EXACT. HONEST: 1D, 1-DOF linear deform, fixed footprint
(full avatar = 3D + skeleton/blendshape rig + learned non-linear deform = follow-on). Sovereign: nx_nofloat_autograd
(tape + nfa_fxexp footprint) + syscalls. license_tier: ORIGINAL expect_exit: 0
dependencies 2 imports · 0 importers
imports: nx_nofloat_autograd.nxnx_syscalls.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
| 20 | const K_MAGIC_1500: i64 = 1500 |
| 21 | const K_MAGIC_32768: i64 = 32768 |
| 22 | const K_MAGIC_19661: i64 = 19661 |
| 23 | const K_MAGIC_4096: i64 = 4096 |
| 24 | const K_MAGIC_2000: i64 = 2000 |
| 26 | const ALOG: *u8 = "knowledge/status/ng_avatar.log" |
| 27 | const Q16: i64 = 65536 |
| 28 | const NP: i64 = 16 // image pixels (1D) |
| 29 | const INV2S2: i64 = 2275555 // 1/(2 sigma^2) Q16, sigma=0.12 (splat footprint width) |
| 30 | const EPOCHS: i64 = 6000 |
| 31 | const LRQ: i64 = 48 // small: the gaussian-derivative chain inflates the gradient ~69x (2*INV2S2) -> tiny lr |
functions
| 33 | func ap(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 } |
| 34 | func apn(v: i64) -> i64 |
| 42 | func a_abs(v: i64) -> i64 { if v<0 { return 0-v } return v } called by 1: main |
| 43 | func aqm(a: i64, b: i64) -> i64 { return (a*b)>>16 } |
| 44 | func al_ws(fd: i64, s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(fd,s,n); return 0 } |
| 45 | func al_wn(fd: i64, v: i64) -> i64 { let b: *u8=sys_mmap(28); var m: i64=v; if m<0 {sys_write(fd,"-" as *u8,1); m=0-m} let t: *u8=sys_mmap(28); var k: i64=0; if m==0 {t[0]=48;k=1} while m>0 {t[k]=(48+(m%10)) as u8; m=m/10; k=k+1} var i: i64=0; while i<k {b[i]=t[k-1-i]; i=i+1} sys_write(fd,b,k); return 0 } |
| 48 | func render_pose(mu0: i64, db: i64, theta: i64, out: *i64) -> i64 |
| 60 | func sse(a: *i64, b: *i64) -> i64 { var s: i64=0; var p: i64=0; while p<NP { let d: i64=a[p]-b[p]; s=s+aqm(d,d); p=p+1 } return s } |
| 64 | func fit_db(mu0: i64, thetas: *i64, frames: *i64, K: i64, db_out: *i64, lf: *i64, ll: *i64) -> i64 |
| 101 | func main() -> i64 |