code wiki / _hdl_build / _imgscramble.nx

_imgscramble.nx

buildroot/runtime/_hdl_build/_imgscramble.nx

3576 B89 linesdepth 8pulls 13 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

_imgscramble.nx -- RED-TEAM INSTRUMENT for the image graders (operator 2026-08-04: "is this eval doing the work or is it junk"): shuffle an image's PxP patches with a seeded deterministic permutation. Scrambling DESTROYS all aesthetic/structural content (the face, the figure, the composition) while approximately preserving LOCAL statistics -- so any judge that scores an image ~equal to its scramble is measuring texture, not beauty, and cannot rank a styled character above a blob. license_tier: ORIGINAL _imgscramble <in.png> <out.png> <patch_px>

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_png_decoder.nx nx_png.nx _imgscramble.nx

imports: nx_syscalls.nxnx_png_decoder.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 sc_atoi sc_w sys_write sys_mmap sys_read_file sys_openat_rd sys_lseek sys_mmap ↻ sys_read sys_close 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 _png_a7_coli _png_a7_row0 _png_a7_rowi nx_zlib_inflate sys_mmap ↻ nx_deflate_inflate sys_mmap ↻ nx_bitstream_alloc sys_mmap ↻ _deflate_inflate_block nx_bitstream_read_lsb nx_bitstream_bits_remainin _bs_peek_byte nx_bitstream_byte_align nx_bitstream_read_byte_ali nx_bitstream_byte_align ↻

structs

none

consts

10const SCR_MAGIC_65536: i64 = 65536
11const SCR_LCG_A: i64 = 1103515245
12const SCR_LCG_C: i64 = 12345
13const SCR_LCG_M: i64 = 2147483647
14const SCR_SEED: i64 = 80404

functions

16func sc_w(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
17func sc_n(v: i64) -> i64
called by 1: main calls 2: sys_mmapsys_write
25func sc_atoi(s: *u8) -> i64 { var v: i64=0; var i: i64=0; while s[i]!=(0 as u8) { let c: i64 = s[i] as i64; if c>=48 { if c<=57 { v=v*10+(c-48) } } i=i+1 } return v }
called by 1: main
27func main(argc: i64, argv: *i64) -> i64