code wiki / (root) / nx_lbp_batch.nx

nx_lbp_batch.nx

buildroot/runtime/nx_lbp_batch.nx

4562 B85 linesdepth 9pulls 13 transitivereach 0 importersview sourcekind tooltopic lbp
docsdependenciesstructsconstsfunctions

about

nx_lbp_batch.nx -- SOVEREIGN face-descriptor RUNG 5: batch descriptor builder over the corpus. Walks the gallery sidecar (galx_cid_paths.tsv: cid\tpath per line), FORKS ONE CHILD PER IMAGE (nx_png_decode mmaps 64MiB/call with no munmap, so each decode must die to reclaim memory), each child: PNG -> luma gray -> resize 128x128 -> 8x8 grid LBP descriptor, appends a fixed-size record {cid(72) + 16384 i64} to a store. Times ITSELF natively (sys_clock_now_us) and reports us/img so we MEASURE sovereign decode+descriptor speed against the insightface benchmark (244 ms/img CPU) instead of guessing. Targets N EXISTING images (skips cleaned-up originals). arg1 = target count (default 60). Build/run: ./_offc/nx_sov_build_run.elf nx_lbp_batch license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_lbp_core.nx nx_lbp_imgio.nx nx_lbp_batch.nx

imports: nx_syscalls.nxnx_lbp_core.nxnx_lbp_imgio.nx

imported by: nobody (leaf or entry point)

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

main bt_atoi sys_openat_wr lp sys_write sys_exit sys_close sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close ↻ sys_clock_now_us sys_now_us sys_mmap ↻ sys_clock_gettime_mono bt_exists sys_openat_rd ↻ sys_close ↻ sys_fork load_gray_fixed sys_mmap ↻ load_gray sys_mmap ↻ sys_read_file ↻ nx_png_decode sys_mmap ↻ _png_check_signature _png_read_u32_be nx_crc32 nx_crc32_update nx_crc32_init nx_crc32_table_at _png_n_channels _png_bytes_per_pixel _png_n_channels ↻ _png_a7_expected _png_a7_col0

structs

none

consts

12const K_MAGIC_2048: i64 = 2048
13const K_MAGIC_131144: i64 = 131144
14const K_MAGIC_16384: i64 = 16384

functions

16func bt_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8) { if s[i]>=(48 as u8) { if s[i]<=(57 as u8) { v=v*10+((s[i] as i64)-48) } } i=i+1 } return v }
called by 1: main
17func bt_exists(path: *u8) -> i64 { let fd: i64=sys_openat_rd(path); if fd<0 {return 0} sys_close(fd); return 1 }
called by 1: main calls 2: sys_openat_rdsys_close
19func main(argc: i64, argv: *i64) -> i64