code wiki / (root) / nx_de_referee_lib.nx

nx_de_referee_lib.nx

buildroot/runtime/nx_de_referee_lib.nx

5255 B128 linesdepth 4pulls 6 transitivereach 1 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_de_referee_lib.nx -- THE PER-REGION CIEDE2000 REFEREE: rung ST1 of /compare/skintwin (2026-09-03) WHY THIS IS THE HIGHEST-VALUE RUNG ON THAT BOARD. nx_colorsci_lib has carried cs_de2000 -- the colour difference the whole field states its errors in -- since 2026-08-24, and MEASURED with corpus_complete=1 it has ZERO adopters outside the garment-print lane. Until something in the render lane calls it, every quality claim about a rendered human is an assertion about MECHANISM, not about appearance. The chromophore stack can be perfectly derived and still look wrong, and nothing in the estate could say so in a number. This file is the thing that can say so. IT COMPOSES, IT DOES NOT RE-RULE. The colour difference itself is cs_de2000, untouched: this file adds only the AGGREGATION -- per region, worst region, mean, and a verdict against a declared tolerance. There is exactly one CIEDE2000 in this estate and it is not here. THE THREE LAWS THIS FILE EXISTS TO ENFORCE, each of which the estate has been bitten by before: 1. ABSTAIN, NEVER ACQUIT. A region with no samples is UNOBSERVED. It is not a pass. A referee that silently counts an unmeasured region as agreement is worse than no referee, because its green is indistinguishable from a real one. 2. A TOOTH THAT PASSES ON THE EMPTY SET IS NOT A TOOTH. If nothing was measured, the verdict is ABSTAIN. Zero regions must never return PASS, however tight the tolerance. 3. THE DENOMINATOR TRAVELS WITH THE VERDICT. measured + unobserved always equals the declared region count, and both halves are written to the output so a caller can reconcile them rather than trust a bare number. The TOLERANCE is an ARGUMENT, not a constant. A bar for a print proof and a bar for a screen render are different numbers with the same units, and a lib that picks one has decided something it has no standing to decide. The caller declares it and the gate prints it. license_tier: ORIGINAL No hw writes (Rule 26). LIB (no main).

dependencies 3 imports · 1 importers

nx_syscalls.nx nx_fixq30_lib.nx nx_colorsci_lib.nx nx_de_referee_lib.nx nx_de_referee_gate.nx

imports: nx_syscalls.nxnx_fixq30_lib.nxnx_colorsci_lib.nx

imported by: nx_de_referee_gate.nx

structs

none

consts

32const DR_REFUSED: i64 = 0 - 1
34const DR_PASS: i64 = 0
35const DR_FAIL: i64 = 1
36const DR_ABSTAIN: i64 = 2
38const DR_UNOBSERVED: i64 = 0 - 1
41const DR_O_VERDICT: i64 = 0
42const DR_O_WORST_IDX: i64 = 1
43const DR_O_WORST_DE: i64 = 2
44const DR_O_MEAN_DE: i64 = 3
45const DR_O_MEASURED: i64 = 4
46const DR_O_UNOBSERVED: i64 = 5
47const DR_O_DECLARED: i64 = 6
48const DR_O_SLOTS: i64 = 7
49const DR_SLOT: i64 = 8
50const DR_LAB: i64 = 3

functions

54func dr_region_de(cs: *i64, ref3: *i64, rnd3: *i64) -> i64
called by 2: maindr_run calls 1: cs_de2000
63func dr_run(cs: *i64, refs: *i64, rnds: *i64, counts: *i64, n: i64, tol: i64, out: *i64) -> i64
called by 1: main calls 1: dr_region_de
123func dr_verdict_name(v: i64) -> *u8
called by 1: main