code wiki / _hdl_build / nx_recolor.nx
nx_recolor.nx
buildroot/runtime/_hdl_build/nx_recolor.nx
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
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
structs
| none |
consts
| none |
functions
| 22 | func 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 |
| 23 | func rnum(v: i64) -> i64 called by 1: main |
| 36 | func r_streq(a: *u8, b: *u8) -> i64 called by 1: main |
| 42 | func r_atoi(s: *u8) -> i64 called by 1: main |
| 51 | func r_paint(out: *u8, o: i64, target_hue: i64, vmax: i64, delta: i64) -> i64 called by 1: main |
| 75 | func main(argc: i64, argv: *i64) -> i64 |