code wiki / (root) / nx_skinsample_lib.nx

nx_skinsample_lib.nx

buildroot/runtime/nx_skinsample_lib.nx

10539 B226 linesdepth 9pulls 31 transitivereach 20 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_skinsample_lib.nx -- THE FIRST PHOTO RULER FOR THE TWIN CARD: skin colour MEASURED from a mirrored photograph (aesthetictwin AT23 rulers skin_L skin_a skin_b ita, 2026-09-16). Decodes the JPEG through the estate's own baseline and progressive decoder (nx_jpeg_ascii.nx composes nx_jpeg_decode and nx_jpeg_progressive), keeps the pixels a declared skin chroma rule admits, averages them in LINEAR light (never in gamma bytes), converts the mean to CIE L*a*b* with the transform constants nx_skin_ita already carries (one colour organ, never two), and takes the individual typology angle through the estate's fixed-point CORDIC arctangent (nx_fixq30_lib). Every number a card receives from this ruler is MEASURED: method measured, source the declared reference key, and the receipt prints the mask count beside the mean so a reader can see how much of the image the value rests on. WHAT IS CHOSEN, said plainly: the skin mask is the YCbCr chroma rule Cb in [77,127] and Cr in [133,173] (a published hand-tuned rule, not a model of this subject) with a luma gate that drops clipped shadows and highlights. It admits skin under most daylight and studio light and also admits skin-coloured backgrounds, sand and wood; the count and the coverage are therefore PRINTED and journaled with the value, and a region chart (a face or torso window) narrows the mask when the card names one. What is DERIVED: the sRGB transfer, the D65 matrix, the Lab transform and the ITA definition (Chardon 1991). LIB, no main. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 5 imports · 3 importers

nx_syscalls.nx nx_jpeg_ascii.nx nx_skin_ita.nx nx_fixq30_lib.nx nx_twincard_lib.nx nx_skinsample_lib.nx nx_photomark_lib.nx nx_skinsample.nx nx_skinsample_gate.nx

imports: nx_syscalls.nxnx_jpeg_ascii.nxnx_skin_ita.nxnx_fixq30_lib.nxnx_twincard_lib.nx

imported by: nx_photomark_lib.nxnx_skinsample.nxnx_skinsample_gate.nx

structs

none

consts

21const SKS_E5: i64 = 100000
22const SKS_E4: i64 = 10000
23const SKS_E3: i64 = 1000
24const SKS_PCT: i64 = 100
25const SKS_TEN: i64 = 10
27const SKS_M_XR: i64 = 4124
28const SKS_M_XG: i64 = 3576
29const SKS_M_XB: i64 = 1805
30const SKS_M_YR: i64 = 2126
31const SKS_M_YG: i64 = 7152
32const SKS_M_YB: i64 = 722
33const SKS_M_ZR: i64 = 193
34const SKS_M_ZG: i64 = 1192
35const SKS_M_ZB: i64 = 9505
37const SKS_F_KNEE: i64 = 886
40const SKS_F_OFF_E5: i64 = 13790
42const SKS_A_MUL: i64 = 5
43const SKS_B_MUL: i64 = 2
45const SKS_YCC_CB_R: i64 = 0 - 16874
46const SKS_YCC_CB_G: i64 = 0 - 33126
47const SKS_YCC_CB_B: i64 = 50000
48const SKS_YCC_CR_R: i64 = 50000
49const SKS_YCC_CR_G: i64 = 0 - 41869
50const SKS_YCC_CR_B: i64 = 0 - 8131
51const SKS_YCC_Y_R: i64 = 29900
52const SKS_YCC_Y_G: i64 = 58700
53const SKS_YCC_Y_B: i64 = 11400
54const SKS_YCC_MID: i64 = 128
55const SKS_CB_LO: i64 = 77
56const SKS_CB_HI: i64 = 127
57const SKS_CR_LO: i64 = 133
58const SKS_CR_HI: i64 = 173
59const SKS_Y_LO: i64 = 30
60const SKS_Y_HI: i64 = 235
61const SKS_BYTE: i64 = 255
63const SKS_L_PIVOT_E3: i64 = 50000
65const SKS_R_L: i64 = 0
66const SKS_R_A: i64 = 1
67const SKS_R_B: i64 = 2
68const SKS_R_COUNT: i64 = 3
69const SKS_R_TOTAL: i64 = 4
70const SKS_R_ITA: i64 = 5
71const SKS_R_N: i64 = 6
72const SKS_BPP: i64 = 3
73const SKS_OK: i64 = 0
74const SKS_E_UNMEASURED: i64 = 0 - 1
75const SKS_E_DECODE: i64 = 0 - 2
76const SKS_E_READ: i64 = 0 - 3
77const SKS_E_EXISTS: i64 = 0 - 4
78const SKS_SIDE_C: *u8 = "C"
79const SKS_METHOD: *u8 = "measured"

functions

82func sks_ruler_version() -> i64 { return 1 }
85func sks_f_e5(t_e5: i64) -> i64
called by 1: sks_lab_of_linear calls 1: si_cbrt_e5
90func sks_lab_of_linear(lr: i64, lg: i64, lb: i64, out3: *i64) -> i64
103func sks_lab_of_rgb(r: i64, g: i64, b: i64, out3: *i64) -> i64
107func sks_is_skin(r: i64, g: i64, b: i64) -> i64
120func sks_ita_deg10(l_e3: i64, b_e3: i64) -> i64
131func sks_measure_rgb(rgb: *u8, w: i64, h: i64, out: *i64) -> i64
165func sks_measure_file(path: *u8, out: *i64) -> i64
182func sks_row(out: *u8, id: *u8, value: i64, refkey: *u8, when: *u8) -> i64
called by 1: sks_card_write
202func sks_card_write(slug: *u8, refkey: *u8, when: *u8, res: *i64) -> i64