code wiki / _hdl_build / nx_recolor.nx

nx_recolor.nx

buildroot/runtime/_hdl_build/nx_recolor.nx

13058 B275 linesdepth 10pulls 21 transitivereach 0 importersview sourcekind tool
docsdependenciesstructsconstsfunctions

about

nx_recolor.nx -- DETERMINISTIC MASKED RECOLOUR: a real colour-edit channel, no GPU, no re-roll. WHY. The GPU img2img loop could not perform a colour edit at all -- denoise strength preserves or destroys, it does not steer an attribute (MEASURED: the dress stayed yellow at every denoise, edit compliance 2 permil). For the specific, common case "make the garment a different colour", a diffusion re-roll is the wrong tool: it is slow, non-deterministic, and it moves identity/pose/lighting you did NOT ask to touch. A masked hue rotation is the right tool -- it changes ONLY the hue of the pixels that were the target colour, keeps their saturation and value, and leaves every other pixel byte-identical. So it preserves identity/pose/lighting BY CONSTRUCTION and scores maximally on BOTH judges at once, which the diffusion loop provably could not. This is the honest scope line: it recolours, it does not add structure (no sequins, no new folds). For pure colour edits it is exact and free; for structural edits the inpaint/ControlNet channels remain. Integer HSV throughout (never-brick #26). Reuses the judge's hue/sat/decoder so one definition of "this pixel is that colour" governs both the edit and the judgement of the edit. license_tier: ORIGINAL

dependencies 3 imports · 0 importers

nx_editjudge_lib.nx nx_garment_lib.nx nx_png_write.nx nx_recolor.nx

imports: nx_editjudge_lib.nxnx_garment_lib.nxnx_png_write.nx

imported by: nobody (leaf or entry point)

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

main rw r_streq r_atoi ej_load_rgb 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_byte_align nx_bitstream_read_byte_ali _deflate_build_static_litl _deflate_build_static_dist _deflate_decode_huffman_bl

structs

none

consts

none

functions

22func rw(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
23func rnum(v: i64) -> i64
called by 1: main
36func r_streq(a: *u8, b: *u8) -> i64
called by 1: main
42func r_atoi(s: *u8) -> i64
called by 1: main
51func r_paint(out: *u8, o: i64, target_hue: i64, vmax: i64, delta: i64) -> i64
called by 1: main
75func main(argc: i64, argv: *i64) -> i64