nx_mediajudge_lib.nx
buildroot/runtime/nx_mediajudge_lib.nx
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
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
| 22 | const MJ_I64: i64 = 8 |
| 23 | const MJ_RGB_BPP: i64 = 3 |
| 24 | const MJ_BYTE: i64 = 255 |
| 25 | const MJ_SHIFT_G: i64 = 8 |
| 26 | const MJ_SHIFT_B: i64 = 16 |
| 27 | const MJ_C_FACE: i64 = 65280 // green: the face box |
| 28 | const MJ_C_EYE: i64 = 16776960 // cyan: the eye bands |
| 29 | const MJ_C_CANTHUS: i64 = 255 // red: the four canthi |
| 30 | const MJ_C_MOUTH: i64 = 16711935 // magenta: the mouth box |
| 31 | const MJ_C_STOMION: i64 = 65535 // yellow: the stomion row |
| 32 | const MJ_CROSS_R: i64 = 4 |
| 33 | const MJ_E_READ: i64 = 0 - 1 |
| 34 | const MJ_E_DECODE: i64 = 0 - 2 |
| 35 | const MJ_E_WRITE: i64 = 0 - 3 |
| 36 | const MJ_MODE644: i64 = 420 |
| 37 | const MJ_PATH_CAP: i64 = 1024 |
| 38 | const MJ_MANIFEST_CAP: i64 = 16384 // a named reserve for the manifest and judge text; exceeding it is a refusal, never a truncation |
| 39 | const 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 |
| 40 | const MJ_TAB: i64 = 9 |
| 41 | const MJ_NL: i64 = 10 |
| 42 | const MJ_DOT: i64 = 46 |
| 43 | const MJ_SLASH: i64 = 47 |
| 44 | const MJ_PNG_SIG0: i64 = 137 |
| 45 | const MJ_APNG_ACTL_A: i64 = 97 // "acTL" chunk letters, the APNG marker |
| 46 | const MJ_APNG_ACTL_C: i64 = 99 |
| 47 | const MJ_APNG_ACTL_T: i64 = 84 |
| 48 | const MJ_APNG_ACTL_L: i64 = 76 |
| 49 | const MJ_APNG_SCAN: i64 = 4096 // the acTL chunk sits in the first chunks; scanning this far names an APNG |
| 50 | const MJ_CODEC_STILL: i64 = 1 |
| 51 | const MJ_CODEC_APNG: i64 = 2 |
| 53 | const MJ_R_W: i64 = 0 |
| 54 | const MJ_R_H: i64 = 1 |
| 55 | const MJ_R_CODEC: i64 = 2 |
| 56 | const MJ_R_FRAMES: i64 = 3 |
| 57 | const MJ_R_FRAMES_CAPPED: i64 = 4 |
| 58 | const MJ_R_SYMMETRY: i64 = 5 |
| 59 | const MJ_R_OVERLAY_BYTES: i64 = 6 |
| 60 | const MJ_R_MANIFEST_BYTES: i64 = 7 |
| 61 | const MJ_R_JUDGE_ROWS: i64 = 8 |
| 62 | const MJ_R_RULER_RC: i64 = 9 |
| 63 | const MJ_R_ORIGINAL_BYTES: i64 = 10 |
| 64 | const MJ_R_REFEREE_FOUND: i64 = 11 |
| 65 | const MJ_R_REFEREE_NME_MAX: i64 = 12 |
| 66 | const MJ_R_REFEREE_JUDGED: i64 = 13 |
| 67 | const MJ_R_PLANE_BYTES: i64 = 14 |
| 68 | const MJ_R_GAP_ROWS: i64 = 15 |
| 69 | const MJ_R_N: i64 = 16 |
| 70 | const MJ_ROWS_FIXED: i64 = 8 // meta 1 + tasset 2 + tier 3 + lic 2: the manifest rows that are neither judge nor gap rows |
| 71 | const MJ_OF_LIP: i64 = 25 // the oracle row's own upper-over-lower lip ratio in permil (column 26 is exo_px) |
| 72 | const MJ_HASH: i64 = 35 |
| 73 | const MJ_GAP_HOLDER: *u8 = "outside oracle: MediaPipe FaceLandmarker landmarks through the ruler's own axis arithmetic" |
| 74 | const MJ_GAP_HOLDER_LIP: *u8 = "outside oracle: the oracle row's own lip ratio" |
| 75 | const MJ_LIC_STATUS: *u8 = "no licence row was submitted with this media: beta review only, production publish is gated on a licence row" |
functions
| 77 | func mj_pack(rgb: *u8, n: i64, fb: *i64) -> i64 |
| 85 | func mj_unpack(fb: *i64, n: i64, rgb: *u8) -> i64 |
| 96 | func mj_px(fb: *i64, w: i64, h: i64, x: i64, y: i64, c: i64) -> i64 |
| 104 | func mj_hline(fb: *i64, w: i64, h: i64, x0: i64, x1: i64, y: i64, c: i64) -> i64 |
| 109 | func mj_vline(fb: *i64, w: i64, h: i64, x: i64, y0: i64, y1: i64, c: i64) -> i64 |
| 114 | func mj_rect(fb: *i64, w: i64, h: i64, x0: i64, y0: i64, x1: i64, y1: i64, c: i64) -> i64 |
| 119 | func mj_cross(fb: *i64, w: i64, h: i64, x: i64, y: i64, c: i64) -> i64 |
| 125 | func mj_draw(fb: *i64, w: i64, h: i64, res: *i64) -> i64 |
| 142 | func mj_overlay(rgb: *u8, w: i64, h: i64, res: *i64, path: *u8) -> i64 |
| 150 | func mj_symmetry(rgb: *u8, w: i64, h: i64) -> i64 |
| 161 | func mj_write(path: *u8, buf: *u8, n: i64) -> i64 |
| 177 | func mj_ext(path: *u8) -> *u8 called by 1: mj_judge_file_at |
| 188 | func mj_join3(out: *u8, a: *u8, b: *u8, c: *u8) -> i64 called by 1: mj_judge_file_at |
| 196 | func mj_is_apng(raw: *u8, n: i64) -> i64 called by 1: mj_judge_file_at |
| 207 | func mj_judge_row(out: *u8, o: i64, organ: *u8, axis: *u8, value: i64, unit: *u8, evidence: *u8) -> i64 called by 1: mj_manifest |
| 217 | func mj_gap_row(out: *u8, o: i64, axis: *u8, ours: i64, best: i64, holder: *u8) -> i64 called by 1: mj_manifest |
| 228 | func mj_oracle_axes(oracle_path: *u8, oref: *i64) -> i64 called by 2: mainmj_judge_file_at calls 6: sys_mmapsys_read_filepm_fieldpm_field_intpm_field_xypm_axes |
| 273 | func 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 |
| 331 | func 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 called by 3: mainmainmj_judge_file calls 15: sys_mmapsys_read_filenx_img_bytes_to_rgbmj_is_apngapng_decodepm_landmarks_auto+9 |
| 451 | func 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 |
| 454 | func mj_load_cascades(out: *i64) -> i64 |