code wiki / _hdl_build / nx_gsplat_photofit_gate.nx

nx_gsplat_photofit_gate.nx

buildroot/runtime/_hdl_build/nx_gsplat_photofit_gate.nx

8892 B166 linesdepth 9pulls 36 transitivereach 0 importersview sourcekind gate/prooftopic gsplat
docsdependenciesstructsconstsfunctions

about

nx_gsplat_photofit_gate.nx -- ★FIT THE SPLAT FACE TO THE PHOTO (the optimizer on the real goal). TARGET = the reference photo mapped onto our geometry, rendered SHARP by the SDF projection (nx_sdfrender). The splat face (Gaussians on the mesh) starts FLAT-SKIN-coloured (unlearned) and the differentiable-splatting optimizer fits its colours to the photo target -> the splat LEARNS the face appearance (deconvolving the splat-overlap blur). Same camera (yaw/camz/FOCAL 586) so SDF-projected + splat align in-frame. T1 the optimizer LEARNS the photo: L1(splat, photo-target) drops hard from the flat-skin start T2 the fitted splat matches the photo target markedly better than the naive flat start (measured improvement) T3 PNG knowledge/nx_gsplat_photofit.png (photo-target | flat-start | fitted) + determinism license_tier: ORIGINAL expect_exit: 0

dependencies 7 imports · 0 importers

nx_syscalls.nx nx_jpeg_ascii.nx nx_sdfrender_mt.nx nx_faceanat.nx nx_meshgen.nx nx_gsplat.nx nx_png.nx nx_gsplat_photofit_gate.nx

imports: nx_syscalls.nxnx_jpeg_ascii.nxnx_sdfrender_mt.nxnx_faceanat.nxnx_meshgen.nxnx_gsplat.nxnx_png.nx

imported by: nobody (leaf or entry point)

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

main hw sys_write gs_w gs_h sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close nx_jpeg_decode_rgb sys_mmap ↻ nx_jpeg_dec_ctx_init sys_mmap ↻ _jpeg_ascii_probe_sof sys_mmap ↻ nx_jpeg_seg_init nx_jpeg_seg_next nx_jpeg_classify_marker nx_jpeg_marker_is_lengthle nx_jpeg_sof_parse nx_jpeg_is_progressive prog_be16 nx_jpeg_prog_decode sys_mmap ↻ prog_be16 ↻ nx_jpeg_dqt_parse nx_jpeg_dht_parse nx_jpeg_dht_build_decode_t nx_jpeg_sos_parse prog_next_marker prog_scan sys_mmap ↻ nx_jpeg_huff_decode_symbol nx_jpeg_ent_extend nx_jpeg_ent_receive prog_refine_nz nx_jpeg_mcu_scratch_init

structs

none

consts

38const P_UC: i64 = 256
39const P_VC: i64 = 329
40const P_SU: i64 = 333
41const P_SV: i64 = 350
42const P_VLO: i64 = 240
43const P_VHI: i64 = 440
44const YAW: i64 = 200

functions

18func hw(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 1: main calls 1: sys_write
19func 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 }
called by 1: main calls 2: sys_mmapsys_write
20func l1(a: *i64, b: *i64, n: i64) -> i64 { var s: i64=0; var i: i64=0; while i<n { var dr: i64=(a[i]&255)-(b[i]&255); if dr<0{dr=0-dr} var dg: i64=((a[i]>>8)&255)-((b[i]>>8)&255); if dg<0{dg=0-dg} var db: i64=((a[i]>>16)&255)-((b[i]>>16)&255); if db<0{db=0-db} s=s+dr+dg+db; i=i+1 } return s }
called by 1: main
23func l1_masked(a: *i64, target: *i64, masksrc: *i64, n: i64) -> i64
called by 1: main
46func main() -> i64