nx_fb_perceptual.nx
buildroot/runtime/nx_fb_perceptual.nx
about
nx_fb_perceptual.nx -- per-perceptual-profile gamut packer.
Additive overlay on the existing nx_framebuffer.nx (2026-05-17,
preserved per Cardinal 13). Adds the per-species color packers
that close the gap [[feedback-multi-species-perceptual-substrate-not-anthropocentric]]
names: the substrate must never bake in human-trichromat sRGB
as the default. Same input RGBA produces DIFFERENT packed bytes
per perceptual profile, and the KAT in nx_fb_perceptual_test.nx
asserts that parametricism is real (not cosmetic).
Composes:
[[NISHI_GRAPHICS_ROADMAP]] G1 (this is one of the first stones)
[[feedback-multi-species-perceptual-substrate-not-anthropocentric]]
(the cardinal that drives non-human profiles)
[[feedback-bits-up-exceed-never-match]] (no libm, integer-only;
refuses sRGB-as-default that DirectX/Vulkan/Metal carry)
[[feedback-no-false-ok-substrate-honesty-audit]] (unknown profile
returns HUMAN_NORMAL packed bytes deterministically; never
silently corrupts; KAT asserts cross-profile differentiation)
existing nx_framebuffer.nx (2026-05-17 nx_fb_pack_rgba lineage --
this is its multi-species overlay; HUMAN_NORMAL packer here
intentionally returns the same bytes as nx_fb_pack_rgba so the
compose surface is congruent)
Scope (honest, G1):
- Per-profile PACKERS for HUMAN / DOG (dichromat) / HONEYBEE /
AVIAN-TETRACHROMAT / PRESERVE_ALL.
- Storage is still RGBA8888 i64 cells per the existing framebuffer.
G2 will introduce per-profile storage formats; G1 demonstrates
the packer API parametricism without storage-format churn.
- UV channel synthesis for honeybee + avian is PLACEHOLDER (255-R)
called out honestly here; G2+ real UV scene sampling replaces it.
Reference (absorbed clean-room, no code copied):
IEC 61966-2-1 (sRGB) for HUMAN_NORMAL byte order baseline.
Rec. 601 luminance coefficients (77/150/29 over 256) for dog
dichromat Y' channel synthesis.
Jacobs 1993 "The Distribution and Nature of Colour Vision Among
Mammals" -- per-species photoreceptor count source.
Goldsmith 1990 "Optimization, constraint, and history in the
dependencies 2 imports · 2 importers
imports: nx_syscalls.nxnx_perceptual_profile.nx
imported by: nx_fb_perceptual_test.nxnx_perceptual_render_test.nx
structs
| none |
consts
| 65 | const K_MAGIC_65536: i64 = 65536 |
| 66 | const K_MAGIC_16777216: i64 = 16777216 |
| 67 | const K_MAGIC_4294967296: i64 = 4294967296 |
| 68 | const K_MAGIC_281474976710656: i64 = 281474976710656 |
functions
| 77 | func nx_fb_pack_human_normal(r: i64, g: i64, b: i64, a: i64) -> i64 |
| 102 | func nx_fb_pack_dog_dichromat(r: i64, g: i64, b: i64, a: i64) -> i64 called by 1: nx_fb_pack_for_profile |
| 128 | func nx_fb_pack_honeybee(r: i64, g: i64, b: i64, a: i64) -> i64 called by 1: nx_fb_pack_for_profile |
| 153 | func nx_fb_pack_avian_tetrachromat(r: i64, g: i64, b: i64, a: i64) -> i64 called by 1: nx_fb_pack_for_profile |
| 176 | func nx_fb_pack_preserve_all(r: i64, g: i64, b: i64, a: i64) -> i64 called by 1: nx_fb_pack_for_profile |
| 201 | func nx_fb_pack_for_profile(profile: i64, r: i64, g: i64, b: i64, a: i64) -> i64 |