nx_haar_xml.nx
buildroot/runtime/nx_haar_xml.nx
about
nx_haar_xml.nx -- LOADER for a boosted Haar cascade published in the OpenCV 3+ XML schema (aesthetictwin AT30, 2026-09-16).
The trained data the field publishes (haarcascade_*.xml: 24x24 or 20x20 windows, stumps or depth-2 trees, rect features
with integer weights) enters the estate as a DATA asset mirrored beside its licence (knowledge/fetched/
cmp_aesthetictwin_haar_*.xml + cmp_aesthetictwin_haar_LICENSE.txt, Intel/OpenCV BSD-style and Apache-2.0). It is a
BETA-ONLY BOOTSTRAP ARM: the evaluator engine (nx_haar_cascade) is sovereign and stays; the data is replaced by a cascade the
estate trains itself (the R-FACE training rung) before any product path carries it, because NishiOS and the browser ship
no third-party bytes and no third-party licence. Every real number is fixed-point Q24 (one arithmetic for thresholds,
leaf values and weights); a tilted feature, a tree deeper than the shipped data uses, or a file without the <cascade>
root is REFUSED BY NAME, never evaluated wrong.
Layout of the loaded cascade (flat i64 arrays, see HC_* in nx_haar_cascade):
hdr [win_w, win_h, n_stages, n_weak, n_nodes, n_leaves, n_feats, max_rects]
stage [first_weak, n_weak, threshold_q24]
weak [first_node, n_nodes, first_leaf, n_leaves]
node [left, right, feature_idx, threshold_q24] (left/right > 0: node index within the tree; <= 0: leaf index = -value)
leaf [value_q24]
feat [n_rects, (x, y, w, h, weight_q24) x 3]
license_tier: ORIGINAL No hw writes (Rule 26).
dependencies 2 imports · 1 importers
imports: nx_syscalls.nxnx_haar_cascade.nx
imported by: nx_facefind_lib.nx
structs
| none |
consts
| 21 | const HX_SP: i64 = 32 |
| 22 | const HX_TAB: i64 = 9 |
| 23 | const HX_NL: i64 = 10 |
| 24 | const HX_CR: i64 = 13 |
| 25 | const HX_MINUS: i64 = 45 |
| 26 | const HX_PLUS: i64 = 43 |
| 27 | const HX_DOT: i64 = 46 |
| 28 | const HX_D0: i64 = 48 |
| 29 | const HX_D9: i64 = 57 |
| 30 | const HX_LC_E: i64 = 101 |
| 31 | const HX_UC_E: i64 = 69 |
| 32 | const HX_ONE: i64 = 49 |
| 33 | const HX_BYTE: i64 = 255 |
| 34 | const HX_TEN: i64 = 10 |
| 35 | const HX_Q24: i64 = 16777216 |
| 36 | const HX_MANT_DIGITS: i64 = 11 |
| 37 | const HX_I64: i64 = 8 |
| 38 | const HX_OUT_N: i64 = 2 |
| 39 | const HX_NUMS_B: i64 = 64 |
| 40 | const HX_MAX_TREE_NODES: i64 = 8 |
| 41 | const HX_OK: i64 = 0 |
| 42 | const HX_E_READ: i64 = 0 - 1 |
| 43 | const HX_E_NOT_CASCADE: i64 = 0 - 2 |
| 44 | const HX_E_TILTED: i64 = 0 - 3 |
| 45 | const HX_E_SHAPE: i64 = 0 - 4 |
| 46 | const HX_E_TREE: i64 = 0 - 5 |
| 47 | const HX_E_FEATURE: i64 = 0 - 6 |
| 48 | const HX_E_EMPTY: i64 = 0 - 7 |
| 49 | const HX_T_CASCADE: *u8 = "<cascade" // the root carries an attribute (type_id) in the published files, so the prefix is the key |
| 50 | const HX_T_HEIGHT: *u8 = "<height>" |
| 51 | const HX_T_WIDTH: *u8 = "<width>" |
| 52 | const HX_T_STAGE_THR: *u8 = "<stageThreshold>" |
| 53 | const HX_T_STAGE_END: *u8 = "</stageThreshold>" |
| 54 | const HX_T_WEAKS: *u8 = "<weakClassifiers>" |
| 55 | const HX_T_WEAKS_END: *u8 = "</weakClassifiers>" |
| 56 | const HX_T_NODES: *u8 = "<internalNodes>" |
| 57 | const HX_T_NODES_END: *u8 = "</internalNodes>" |
| 58 | const HX_T_LEAVES: *u8 = "<leafValues>" |
| 59 | const HX_T_LEAVES_END: *u8 = "</leafValues>" |
| 60 | const HX_T_FEATURES: *u8 = "<features>" |
| 61 | const HX_T_RECTS: *u8 = "<rects>" |
| 62 | const HX_T_RECTS_END: *u8 = "</rects>" |
| 63 | const HX_T_ENTRY: *u8 = "<_>" |
| 64 | const HX_T_ENTRY_END: *u8 = "</_>" |
| 65 | const HX_T_TILTED: *u8 = "<tilted>" |
functions
| 67 | func hx_is_ws(c: i64) -> i64 { if c == HX_SP { return 1 } if c == HX_NL { return 1 } if c == HX_CR { return 1 } if c == HX_TAB { return 1 } return 0 } called by 1: hx_skip_ws |
| 68 | func hx_is_digit(c: i64) -> i64 { if c < HX_D0 { return 0 } if c > HX_D9 { return 0 } return 1 } |
| 69 | func hx_slen(s: *u8) -> i64 { var n: i64 = 0; while s[n] != (0 as u8) { n = n + 1 } return n } |
| 70 | func hx_skip_ws(b: *u8, n: i64, pos: i64) -> i64 |
| 77 | func hx_find(b: *u8, n: i64, pos: i64, tag: *u8) -> i64 |
| 90 | func hx_num_q24(b: *u8, n: i64, pos: i64, out: *i64) -> i64 |
| 150 | func hx_int(b: *u8, n: i64, pos: i64, out: *i64) -> i64 |
| 167 | func hx_count(b: *u8, n: i64, pos: i64, tag: *u8) -> i64 |
| 174 | func hx_tag_int(b: *u8, n: i64, pos: i64, tag: *u8, out: *i64) -> i64 |
| 181 | func hx_load(path: *u8, rc_out: *i64) -> *HaarCascade |
| 191 | func hx_parse(b: *u8, n: i64, rc_out: *i64) -> *HaarCascade |