Skip to content

Color pipeline decision record: resolutions for #4032 open questions and audit findings #4033

Open

Description

@zackees

Purpose

This is the decision record that closes the open items on #4032 (universal profile-driven color pipeline). It resolves, with concrete commitments rather than option surveys:

Each resolution is a spec amendment to #4032. Implementation phases build against the amended spec; anything here that proves wrong under measurement gets revised by a follow-up decision, not silently diverged from.


A. Resolutions to the original open questions

A1. Accuracy target

Two separate budgets, because they gate different things:

  • Implementation fidelity (embedded vs float64 reference): max ΔE2000 ≤ 0.5 and luminance error ≤ 0.5% across the dense in-gamut corpus at identity brightness; ≤ 1.0 ΔE2000 at 1/32 brightness. The budget is inclusive of the brightness/power stage (per audit item 3 — dark-end u16 headroom is consumed by linear brightness scaling).
  • Profile accuracy (prediction vs measured light): datasheet-derived profiles must reach median ΔE2000 ≤ 3.0 / p95 ≤ 6.0 against instrument measurements; measured profiles must reach median ≤ 1.5 / max ≤ 4.0 on the in-gamut test set (primaries, secondaries, neutral ramp, low codes) at the profile's reference temperature.

Metric normalization per audit item 12: relative colorimetry with the profile's white point at full drive as the adaptive white, Y normalized to that white (emissive, dark-surround). This definition goes in the report template so every phase's numbers compare.

A2. Calibration instrument and artifact home

Ratify audit item 9: primary/secondary chromaticity measurements require a spectroradiometer (or a tristimulus colorimeter with a spectral correction matrix derived from a spectroradiometer for that exact device class); a plain colorimeter is acceptable only for neutral-ramp/luminance tracking. Reference-instrument bar: spectral measurement with ≤ ±0.002 CIE xy uncertainty on narrowband sources; fixture = fixed measurement geometry (distance, aperture, dark surround) with logged strip temperature and drive current.

Measured profile artifacts live in the FastLED/datasheets repo (already the published data corpus, keeps bulk data out of the main repo) under a measured-profiles/ tree; the main repo checks in only the JSON profiles consumed as golden test fixtures. Per the round-2 sharpening: artifacts use a versioned JSON profile schema with provenance fields (instrument model/serial, date, fixture geometry, operating temperature, sample bin/lot, raw-data pointer) so host tooling and firmware share one parser.

A3. Gamut-mapping space

Ratify audit items 11 and 12: the reference gamut-mapping objective is hue-preserving chroma compression in OKLCh (avoids CIELAB's blue-hue bend exactly where narrowband LED blue stresses the mapper), computed by a host-side optimizer; the embedded per-pixel path is matrix + clamp/compress, optionally LUT-backed with measured error bounds. Iterative optimization (including the existing nnls3) is restricted to profile/cache build time on host or at setup — never per-pixel.

A4. New pixel_format for high-precision payloads

Adopt rgb16_linear: 16-bit-per-channel little-endian RGB, linear-light, full-range. Validation rules: transfer MUST be linear (any other value rejected); primaries follows the same named/custom rules as rgb8; matrix MUST be rgb; range MUST be full. rgb8 keeps its display-encoded meaning and absent-metadata default unchanged. Other high-precision formats (float, log/HDR) are deferred until the working-domain question they imply is solved (see B2); their names are reserved, not specified.


B. Disposition of audit items 1–12

All twelve are adopted; amendments below where the audit left a choice open.

  1. APA102 5-bit semantics — adopted. The spec drops "global current" as a generic term; the emitter/chipset model carries per-chip 5-bit semantics: APA102 = secondary slow-PWM stage (joint solve gets an explicit flicker constraint: configurable minimum 5-bit floor, default conservative), SK9822 = current gain (joint solve below the documented current threshold requires the profile to carry current-vs-chromaticity data; otherwise the solver holds the 5-bit field fixed). Chips with unknown semantics get the SK9822-conservative treatment.
  2. Working-format signedness / HDR — adopted. The normative working domain is: unsigned u16 linear immediately after decode; signed 32-bit accumulators (s16.16-class) through the XYZ / primary-conversion / gamut-mapping stages with defined clamping; bounded RGB16 exists only after gamut mapping. PQ/HLG are removed from the v1 schema roadmap: their names are reserved and rejected by the validator until a wide/float payload format and working domain exist.
  3. "Quantize once" restated — adopted. The acceptance criterion becomes: (a) the embedded path stays within the A1 fidelity budget vs the float64 reference, inclusive of the brightness/power stage; (b) a structural test proves no intermediate buffer in the managed path is 8-bit.
  4. rgb8 + transfer: linear — adopted. The validator rejects transfer ∈ {linear, PQ, HLG} when pixel_format == rgb8, using the unknown-profile diagnostic contract.
  5. Missing-key inheritance scoped — adopted. Tuple inheritance applies only to pixel formats with a defined default tuple (today: rgb8, and rgb16_linear per A4). Non-RGB pixel formats must declare matrix and range explicitly or be rejected. range: "limited" with rgb8 is rejected in v1 (no producer exists; expansion is not implemented).
  6. Absent-metadata behavior change — adopted. Spec states explicitly: legacy .fled files change appearance when color management is enabled, intentionally; the byte-identical guarantee applies only with color management disabled; and the rationale for opposite defaults is recorded — .fled video is authored display-referred on sRGB displays, ordinary FastLED buffers are authored against linear-in-code PWM, so srgb and linear defaults respectively preserve each medium's authored appearance.
  7. Chromatic adaptation — adopted. Bradford is the normative CAT, applied between source white and profile white; it is part of the interchange contract and the golden-vector set.
  8. Effects/palette contract — adopted. Effect and palette arithmetic is defined in the buffer's declared space; v1 does not support compositing across differently-tagged sources (a .fled sRGB frame is decoded into the linear working domain before any overlay/blend with generated content); palettes carry no profile of their own.
  9. Instrumentation — adopted, folded into A2.
  10. Temperature — adopted, option (a). Accuracy claims are valid at the profile's reference temperature; measured thermal drift is recorded in the report as documentation. An optional scalar temperature knob on EmitterProfile is deferred to a follow-up (the schema's provenance/conditions fields already leave room for it).
  11. Per-pixel solve cost — adopted, folded into A3. Additionally the phase list gains an explicit named phase: fixed-point re-implementation of colorimetric cache build and solve for float-free tiers, rather than inheriting it implicitly from the TINY-tier criterion.
  12. ΔE normalization / OKLab — adopted, folded into A1 and A3.

Smaller notes: all adopted — the .fled sync task starts by re-reading the canonical ledmapper spec; the UCS7604 sentence gains the "16-bit modes only" qualifier; the stale "lands in PR 3" comment is cleaned up by the first phase touching colorimetric_response.h. Headless rejection is specified: the playback API returns a defined error code and logs over serial where available; the channel renders nothing (dark) rather than garbage; supported-primaries-but-unsupported-transfer does not silently fall back — best-effort playback requires an explicit opt-in flag on the player.


C. Resolutions to round-2 questions Q1–Q7

C1 (Q1). API attach point and legacy setters

Source profile, emitter profile, and gamut policy are per-channel, carried on ChannelOptions alongside the existing correction/temperature/dither/RGBW fields, bound via FastLED.add<>() / Channel::create<>(). CFastLED gains only global defaults (e.g. a default source profile applied to channels that declare none) per the Public Settings Pattern; no bare fl::set_* free functions. Profile mode and legacy correction are mutually exclusive per channel: setting an emitter profile clears legacy correction/temperature and vice versa, each transition emitting a one-time warning — nothing stacks silently. setTemperature() is a legacy-mode-only control; in profile mode the white point comes from the profile plus Bradford adaptation, and a "warmer/cooler" user intent is expressed as a target-white override in the profile API.

C2 (Q2). Execution model

Streaming is normative. The managed transform runs per-pixel inside the existing PixelController iteration in show(); no full RGB16 framebuffer is required or specified. Dithering that needs neighbor state may use a small bounded per-channel line buffer (tens of pixels, tier-gated); platforms with RAM to spare may cache LUTs, not frames. This keeps memory flat in LED count, works unchanged with parallel multi-lane encoders, and makes the throughput budgets in the acceptance criteria measurable on the real path. If measured throughput on high-lane-count targets fails budget, a buffered mode may be added later as an explicit opt-in — not as the default.

C3 (Q3). RGBW/RGBWW W-allocation policy

The device solve for ≥4 emitters uses a declared, deterministic allocation policy, configurable per emitter profile. Default: white-preferred — maximize the W (then WW/CW mix) contribution within the target chromaticity's constraint, with RGB carrying the remainder; this matches typical strip efficiency and the existing RGBW colorimetric work. An RGB-preferred policy is available for spectral/saturation-critical fixtures. The gamut volume presented to the mapper includes the white channel's contribution (the mapper targets what the fixture can actually produce). The policy must be continuous in the input to satisfy §4's no-animation-discontinuity requirement.

C4 (Q4). Brightness and power-limiter semantics

setBrightness(b) is defined as a linear-light flux scalar b/255. This is photometrically compatible with legacy behavior: legacy scale8 on channel codes feeding linear-in-code PWM already scales flux linearly, so existing sketches keep their meaning. The power limiter computes its own linear scalar from the separate electrical model and composes multiplicatively with brightness at the single brightness/power stage, which preserves solved chromaticity by construction. That stage is the only insertion point; nothing downstream of the device solve rescales channels independently.

C5 (Q5). Dither ownership

Mutually exclusive per channel: a profile-managed channel uses pipeline-owned dithering (designed against the linear-domain error budget); BINARY_DITHER continues to serve legacy channels unchanged. Pipeline dithering on TINY tier is limited to stateless/temporal forms consistent with the "no per-controller state" criterion; error-diffusion variants are tier-gated to platforms that can afford the line buffer from C2.

C6 (Q6). .fled forward compatibility

No container version bump. video.color is advisory for rgb8: an old parser ignoring it plays the file with the legacy interpretation, which is exactly the absent-metadata default tuple — degraded fidelity, never wrong data. Payloads for which color metadata is semantically required (starting with rgb16_linear) gate on the new pixel_format value, which old parsers already reject as unknown. This makes "mandatory" a property of the payload format, not a version flag.

C7 (Q7). Closing and reopening the measurement gate

The hardware-measurement acceptance criterion is closed by a checked-in measurement report (A2 schema: instrument, date, fixture, temperature, raw data pointer) in FastLED/datasheets, referenced from the main repo. CI validates only the profile-schema and golden vectors — it never gates on live instruments. Re-measurement is triggered by: a new supported part, evidence of a new production bin diverging beyond the A1 profile budget, or any validation result outside budget. Reports are append-only; profiles carry the report ID they were derived from.


Acceptance criteria for this decision record

  • feat(color): design a profiled high-precision color-accurate output pipeline #4032's body is edited (or annotated) to incorporate amendments A1–A4, B1–B12, and C1–C7, and its Open-questions section is replaced with a pointer here.
  • The first implementation phase's contract cites this record's IDs (e.g. "B2 working domain", "C2 streaming") rather than re-deriving them.
  • Any deviation discovered during implementation is filed as a follow-up decision referencing the ID it revises.

Related


C8. Identity and naming (round-3 resolutions, 2026-08-25)

Resolved interactively with the maintainer; these pin the naming/ID layer left open by C1/A2.

  1. Hybrid ID scheme. The canonical profile ID is a string living in the JSON artifact (e.g. ws2812b/measured/report-42) in FastLED/datasheets; a generator emits C++ symbols (fl::profiles::...) that embed it. Firmware links symbols only; strings exist for tooling and provenance.
  2. Canonical identity = part + package variant + W-channel CCT variant + provenance/report ID. Production bin is metadata, not identity. Profiles are append-only: new measurement data mints a new ID and never revises an existing one in place.
  3. Aliases float, pins exist. The bare enum a sketch types resolves to the best-available profile for that part and may improve across library upgrades; the generator also emits versioned symbols (e.g. WS2812B_R42) for installations that need frozen output.
  4. Binding is enum-keyed compile-time sugar over one runtime slot. The profile template parameter on FastLED.add<>() / Channel::create<>() resolves to a constexpr EmitterProfile and stores its pointer in ChannelOptions; the same field accepts a user-built inline struct, so per-fixture measured profiles are first-class in v1 with no parser. Only referenced profiles link — an unused profile library costs zero flash. No JSON parsing ever ships in firmware.
  5. Missing profile on a driver-only chipset → legacy fallback, fully observable. The channel runs the legacy correction path with: a one-time bind-time warning naming the chipset and reason; queryable per-channel state (isColorManaged() / bound profile); the fallback bit exposed through channel events/telemetry for headless rigs; and an opt-in global strict mode that upgrades fallback to a hard error. Nothing falls back silently.
  6. Two name registries, two owners. Source-color names (bt709, srgb, display-p3, …) stay owned by the canonical ledmapper .fled spec (already authoritative per feat(color): design a profiled high-precision color-accurate output pipeline #4032); emitter-profile IDs are owned by the FastLED/datasheets generator. FastLED consumes both and invents neither.

C9. Profile ingestion and freshness (round-3 resolutions, 2026-08-25)

  1. Ingest is a manual, reviewed event. One tool, two modes: check (read-only) and ingest (writes). Ingest fetches the FastLED/datasheets registry, regenerates the checked-in constexpr C++, and lands as an ordinary reviewable PR. It never runs automatically.
  2. Provenance headers are the staleness oracle. Every generated file records artifact ID, artifact content hash, datasheets-repo commit, and generation date. Freshness checking is a pure comparison of embedded hashes against the upstream index.
  3. Historic compiles are safe by construction. Because identity is append-only (C8.2) and the floating alias only advances at ingest time (i.e. under human review), a stale generated profile is still a valid profile. Staleness is advisory by definition — there is nothing for tooling to enforce.
  4. The freshness check is a standalone informational tool, deliberately outside bash lint. bash lint is hermetic, fast, and its findings are things agents must fix; this check needs network and its findings must not be auto-fixed. It always exits 0, emits a human report plus --json, and lists: profiles with a newer report ID upstream, new parts with no generated profile, deprecated artifacts, and schema-version drift. Offline it degrades to "could not check," never to failure.
  5. Periodic = a scheduled workflow, not a commit gate. A scheduled CI job runs check and updates one standing tracking issue with the report. Humans decide when drift warrants an ingest PR.
  6. Agent-docs carve-out (required). The agents doc entry for this tool must state explicitly: check is read-only and safe to invoke for information at any time; its findings are status, not errors — exempt from the repo's "fix all encountered errors immediately" policy; ingest runs only on explicit maintainer request and always lands as a PR. Without this carve-out, agents would helpfully auto-regenerate profiles and defeat the manual-event rule.

Activity

  1. zackees commented on Aug 25, 2026

    @zackees
    MemberAuthor

    All decisions here (A1–A4, B1–B12, C1–C9) are digested into the final implementation tracker #4034, which carries the phase plan as sub-issues #4035–#4044. This record is now a frozen reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions