code wiki / (root) / nx_vitpose_prep.nx

nx_vitpose_prep.nx

buildroot/runtime/nx_vitpose_prep.nx

3764 B59 linesdepth 9pulls 26 transitivereach 0 importersview sourcekind orphan librarytopic vitpose
docsdependenciesstructsconstsfunctions

about

nx_vitpose_prep.nx -- decode the fetched JPEG + preprocess into the ViTPose input tensor, written to a file the forward reads. Reads the image path from data/mp_img_dest.txt: nx_jpeg_decode_rgb -> u8 RGB [h,w,3] -> i64 -> nx_vitpose_preprocess(resize 256x192 + ImageNet normalize) -> [1,3,256,192] f32 -> models/vitpose_input.bin (f32 as u32le). expect_exit: 0

dependencies 6 imports · 0 importers

nx_syscalls.nx nx_f32.nx nx_f32_cvt.nx nx_f32_div.nx nx_jpeg_ascii.nx nx_vitpose_preprocess.nx nx_vitpose_prep.nx

imports: nx_syscalls.nxnx_f32.nxnx_f32_cvt.nxnx_f32_div.nxnx_jpeg_ascii.nxnx_vitpose_preprocess.nx

imported by: nobody (leaf or entry point)

structs

none

consts

11const K_MAGIC_4096: i64 = 4096
12const K_MAGIC_4194304: i64 = 4194304

functions

14func w(s: *u8) -> i64 { var n: i64=0; while s[n]!=(0 as u8){n=n+1} sys_write(1,s,n); return 0 }
15func wn(v: i64) -> i64 { var m: i64=v; if m<0{w("-" as *u8);m=0-m} let t:*u8=sys_mmap(24); var k:i64=0; if m==0{t[0]=48 as u8;k=1} while m>0{t[k]=(48+(m%10)) as u8;m=m/10;k=k+1} var i:i64=0; let o:*u8=sys_mmap(24); while i<k{o[i]=t[k-1-i];i=i+1} sys_write(1,o,k); return 0 }
16func rdcfg(path: *u8, buf: *u8, cap: i64) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0{return 0-1} var n: i64=sys_read(fd,buf,cap-1); sys_close(fd); if n<0{return 0-1} var go: i64=1; while go==1{go=0; if n>0{ let c: i64=buf[n-1] as i64; if c==10{n=n-1;go=1} if c==13{n=n-1;go=1} if c==32{n=n-1;go=1} }} buf[n]=0 as u8; return n }
17func mk(n: i64, d: i64) -> i64 { return nx_f32_div(nx_i32_to_f32(n), nx_i32_to_f32(d)) }
19func main() -> i64