code wiki / (root) / nx_mediajudge_lib.nx

nx_mediajudge_lib.nx

buildroot/runtime/nx_mediajudge_lib.nx

25714 B463 linesdepth 11pulls 68 transitivereach 2 importersview sourcekind library
docsdependenciesstructsconstsfunctions

about

nx_mediajudge_lib.nx -- aesthetictwin AT36 (2026-09-17): SUBMITTED MEDIA THROUGH THE BEAUTY RULERS WITH A REPORT THE OPERATOR CAN CHECK. Operator: "submit media to be stored in the vault and reaccessible to go through the beauty evaluator and have output so i can confirm and triangulate the correct analysis is happening ... and not just photos but gif and video". One library, every leg an incumbent: the bytes-to-RGB chokepoint decodes the still (JPEG, PNG, GIF first frame, WebP lossless, BMP, TIFF, TGA, PCX, ICO, PNM), the APNG decoder yields frames, the photo ruler (nx_photomark_lib) places the face, canthi and mouth and derives the card axes, the skin ruler (nx_skinsample_lib) reads tone, the symmetry judge (nx_image_symmetry_lib) scores bilateral symmetry on the ORIGINAL pixels, the estate's PNG writer draws the OVERLAY of what the rulers saw (face box, eye bands, canthus crosses, mouth box, stomion row), and the referee (pm_referee_sum) scores the placement against an outside oracle row when one exists. The output is DATA: a judge file (pipe rows), a manifest in nx_asset_page's row shape, and the same rows keyed by slug as a plane staging file (<slug>.plane.tsv) for nx_store_seed, so nx_asset_page emit publishes the original beside the overlay and the numbers from the asset plane. Consumers: nx_mediajudge (CLI), nx_mediajudge_gate (planted controls). Video (MP4/H.264, VP8) is the next rung: the decoders exist (nx_mp4_demux, nx_h264_decode_frame, nx_vp8_kf) and this library's frame path takes their frames as data. license_tier: ORIGINAL No hw writes (Rule 26).

dependencies 6 imports · 2 importers

nx_syscalls.nx nx_photomark_lib.nx nx_img_bytes_to_rgb.nx nx_apng_decode.nx nx_png.nx nx_image_symmetry_lib.nx nx_mediajudge_lib.nx nx_mediajudge.nx nx_mediajudge_gate.nx

imports: nx_syscalls.nxnx_photomark_lib.nxnx_img_bytes_to_rgb.nxnx_apng_decode.nxnx_png.nxnx_image_symmetry_lib.nx

imported by: nx_mediajudge.nxnx_mediajudge_gate.nx

structs

none

consts

22const MJ_I64: i64 = 8
23const MJ_RGB_BPP: i64 = 3
24const MJ_BYTE: i64 = 255
25const MJ_SHIFT_G: i64 = 8
26const MJ_SHIFT_B: i64 = 16
27const MJ_C_FACE: i64 = 65280 // green: the face box
28const MJ_C_EYE: i64 = 16776960 // cyan: the eye bands
29const MJ_C_CANTHUS: i64 = 255 // red: the four canthi
30const MJ_C_MOUTH: i64 = 16711935 // magenta: the mouth box
31const MJ_C_STOMION: i64 = 65535 // yellow: the stomion row
32const MJ_CROSS_R: i64 = 4
33const MJ_E_READ: i64 = 0 - 1
34const MJ_E_DECODE: i64 = 0 - 2
35const MJ_E_WRITE: i64 = 0 - 3
36const MJ_MODE644: i64 = 420
37const MJ_PATH_CAP: i64 = 1024
38const MJ_MANIFEST_CAP: i64 = 16384 // a named reserve for the manifest and judge text; exceeding it is a refusal, never a truncation
39const MJ_MAX_FRAMES: i64 = 16 // the APNG frame budget (frames of the decoded size are reserved for the count), announced in the receipt when hit
40const MJ_TAB: i64 = 9
41const MJ_NL: i64 = 10
42const MJ_DOT: i64 = 46
43const MJ_SLASH: i64 = 47
44const MJ_PNG_SIG0: i64 = 137
45const MJ_APNG_ACTL_A: i64 = 97 // "acTL" chunk letters, the APNG marker
46const MJ_APNG_ACTL_C: i64 = 99
47const MJ_APNG_ACTL_T: i64 = 84
48const MJ_APNG_ACTL_L: i64 = 76
49const MJ_APNG_SCAN: i64 = 4096 // the acTL chunk sits in the first chunks; scanning this far names an APNG
50const MJ_CODEC_STILL: i64 = 1
51const MJ_CODEC_APNG: i64 = 2
53const MJ_R_W: i64 = 0
54const MJ_R_H: i64 = 1
55const MJ_R_CODEC: i64 = 2
56const MJ_R_FRAMES: i64 = 3
57const MJ_R_FRAMES_CAPPED: i64 = 4
58const MJ_R_SYMMETRY: i64 = 5
59const MJ_R_OVERLAY_BYTES: i64 = 6
60const MJ_R_MANIFEST_BYTES: i64 = 7
61const MJ_R_JUDGE_ROWS: i64 = 8
62const MJ_R_RULER_RC: i64 = 9
63const MJ_R_ORIGINAL_BYTES: i64 = 10
64const MJ_R_REFEREE_FOUND: i64 = 11
65const MJ_R_REFEREE_NME_MAX: i64 = 12
66const MJ_R_REFEREE_JUDGED: i64 = 13
67const MJ_R_PLANE_BYTES: i64 = 14
68const MJ_R_GAP_ROWS: i64 = 15
69const MJ_R_N: i64 = 16
70const MJ_ROWS_FIXED: i64 = 8 // meta 1 + tasset 2 + tier 3 + lic 2: the manifest rows that are neither judge nor gap rows
71const MJ_OF_LIP: i64 = 25 // the oracle row's own upper-over-lower lip ratio in permil (column 26 is exo_px)
72const MJ_HASH: i64 = 35
73const MJ_GAP_HOLDER: *u8 = "outside oracle: MediaPipe FaceLandmarker landmarks through the ruler's own axis arithmetic"
74const MJ_GAP_HOLDER_LIP: *u8 = "outside oracle: the oracle row's own lip ratio"
75const MJ_LIC_STATUS: *u8 = "no licence row was submitted with this media: beta review only, production publish is gated on a licence row"

functions

77func mj_pack(rgb: *u8, n: i64, fb: *i64) -> i64
85func mj_unpack(fb: *i64, n: i64, rgb: *u8) -> i64
96func mj_px(fb: *i64, w: i64, h: i64, x: i64, y: i64, c: i64) -> i64
called by 2: mj_hlinemj_vline
104func mj_hline(fb: *i64, w: i64, h: i64, x0: i64, x1: i64, y: i64, c: i64) -> i64
called by 3: mj_rectmj_crossmj_draw calls 1: mj_px
109func mj_vline(fb: *i64, w: i64, h: i64, x: i64, y0: i64, y1: i64, c: i64) -> i64
called by 2: mj_rectmj_cross calls 1: mj_px
114func mj_rect(fb: *i64, w: i64, h: i64, x0: i64, y0: i64, x1: i64, y1: i64, c: i64) -> i64
called by 1: mj_draw calls 2: mj_hlinemj_vline
119func mj_cross(fb: *i64, w: i64, h: i64, x: i64, y: i64, c: i64) -> i64
called by 1: mj_draw calls 2: mj_hlinemj_vline
125func mj_draw(fb: *i64, w: i64, h: i64, res: *i64) -> i64
called by 1: mj_overlay calls 3: mj_rectmj_crossmj_hline
142func mj_overlay(rgb: *u8, w: i64, h: i64, res: *i64, path: *u8) -> i64
150func mj_symmetry(rgb: *u8, w: i64, h: i64) -> i64
161func mj_write(path: *u8, buf: *u8, n: i64) -> i64
177func mj_ext(path: *u8) -> *u8
called by 1: mj_judge_file_at
188func mj_join3(out: *u8, a: *u8, b: *u8, c: *u8) -> i64
called by 1: mj_judge_file_at
196func mj_is_apng(raw: *u8, n: i64) -> i64
called by 1: mj_judge_file_at
207func mj_judge_row(out: *u8, o: i64, organ: *u8, axis: *u8, value: i64, unit: *u8, evidence: *u8) -> i64
called by 1: mj_manifest
217func mj_gap_row(out: *u8, o: i64, axis: *u8, ours: i64, best: i64, holder: *u8) -> i64
called by 1: mj_manifest
228func mj_oracle_axes(oracle_path: *u8, oref: *i64) -> i64
273func mj_manifest(buf: *u8, slug: *u8, src_path: *u8, orig_href: *u8, overlay_href: *u8, res: *i64, sres: *i64, oref: *i64, have_oracle: i64, out: *i64) -> i64
331func mj_judge_file_at(path: *u8, slug: *u8, outdir: *u8, oracle_path: *u8, hrefpfx: *u8, face_c: *HaarCascade, eye_c: *HaarCascade, res: *i64, sres: *i64, out: *i64) -> i64
451func mj_judge_file(path: *u8, slug: *u8, outdir: *u8, oracle_path: *u8, face_c: *HaarCascade, eye_c: *HaarCascade, res: *i64, sres: *i64, out: *i64) -> i64
called by 1: main calls 1: mj_judge_file_at
454func mj_load_cascades(out: *i64) -> i64