code wiki / _hdl_build / nx_ng_avatar.nx

nx_ng_avatar.nx

buildroot/runtime/_hdl_build/nx_ng_avatar.nx

9194 B157 linesdepth 3pulls 3 transitivereach 0 importersview sourcekind tooltopic ng
docsdependenciesstructsconstsfunctions

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

nx_nofloat_autograd.nx nx_syscalls.nx nx_ng_avatar.nx

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

main ap sys_write sys_mmap render_pose aqm nfa_fxexp fit_db sys_mmap ↻ aqm ↻ render_pose ↻ ap ↻ apn sys_mmap ↻ sys_write ↻ a_abs sse aqm ↻ aqm ↻ apn ↻ sys_openat_append al_ws sys_write ↻ al_wn sys_mmap ↻ sys_write ↻ sys_close sys_exit

structs

none

consts

20const K_MAGIC_1500: i64 = 1500
21const K_MAGIC_32768: i64 = 32768
22const K_MAGIC_19661: i64 = 19661
23const K_MAGIC_4096: i64 = 4096
24const K_MAGIC_2000: i64 = 2000
26const ALOG: *u8 = "knowledge/status/ng_avatar.log"
27const Q16: i64 = 65536
28const NP: i64 = 16 // image pixels (1D)
29const INV2S2: i64 = 2275555 // 1/(2 sigma^2) Q16, sigma=0.12 (splat footprint width)
30const EPOCHS: i64 = 6000
31const LRQ: i64 = 48 // small: the gaussian-derivative chain inflates the gradient ~69x (2*INV2S2) -> tiny lr

functions

33func ap(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
called by 2: fit_dbmain calls 1: sys_write
34func apn(v: i64) -> i64
called by 2: fit_dbmain calls 2: sys_mmapsys_write
42func a_abs(v: i64) -> i64 { if v<0 { return 0-v } return v }
called by 1: main
43func aqm(a: i64, b: i64) -> i64 { return (a*b)>>16 }
44func 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 }
called by 1: main calls 1: sys_write
45func 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 }
called by 1: main calls 2: sys_mmapsys_write
48func render_pose(mu0: i64, db: i64, theta: i64, out: *i64) -> i64
called by 2: fit_dbmain calls 2: aqmnfa_fxexp
60func 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 }
called by 1: main calls 1: aqm
64func fit_db(mu0: i64, thetas: *i64, frames: *i64, K: i64, db_out: *i64, lf: *i64, ll: *i64) -> i64
called by 1: main calls 5: sys_mmapaqmrender_poseapapn
101func main() -> i64