Repository navigation
Closed
Description
Phase P6 of the color pipeline implementation (see parent issue). Independently mergeable.
Scope
The embedded wide-precision core, on the normative working domain, executing as a streaming transform.
- Decode:
RGB8 + source profile -> u16 linearas one semantic conversion (normalize + inverse transfer); no intermediate RGB8 linear buffer, no RGB8→RGB8 correction (B3 structural test). - Working domain (B2): signed s16.16-class accumulators through primaries→XYZ (Bradford), conversion, and (once P7 lands) gamut stages; defined clamping/overflow rules; bounded RGB16 only after gamut mapping.
- Streaming execution (C2): per-pixel inside
show()via the existingPixelControlleriteration; no RGB16 framebuffer; optional small bounded per-channel line buffer reserved for P8 dithering, tier-gated. - Brightness/power stage (C4):
setBrightness(b)applied as linear flux scalarb/255; power limiter contributes a second linear scalar composed multiplicatively at the same single stage; chromaticity preserved by construction; electrical power uses the profile's separate per-channel model. This is the only insertion point — nothing downstream rescales channels independently. - Effects contract (B8): buffer math stays in the declared space;
.fledsRGB frames decode into the working domain before any blend with generated content; cross-space compositing rejected in v1. - Error budget vs P5 reference, inclusive of the brightness stage (A1): max ΔE2000 ≤ 0.5 / luminance ≤ 0.5% at identity brightness; ≤ 1.0 ΔE2000 at 1/32 brightness.
Decisions implemented
B2, B3, B6 (behavior half: CM-enabled .fled playback goes through sRGB decode), B8, C2, C4.
Acceptance criteria owned
- Embedded implementation within documented ΔE/luminance budget vs reference.
- Normative path: no intermediate RGB8 buffer, single final quantization (B3 restatement).
- Brightness/power limiting chromaticity-preserving; separate electrical model.
Dependencies
P2 (types/binding), P5 (golden vectors gate every PR in this phase).
Deliverables
Streaming pipeline core wired from ChannelOptions through show(), with a pass-through final encoder stub until P8; budget-conformance test suite.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
- StatusShow more project fieldsDone
Activity
test(color): pin the P2/P6 boundary for isColorManaged()
feat(color): add profile configuration API (#4161)
feat(color): source RGB -> XYZ in the s16.16 working domain
feat(color): brightness x power as one linear amplitude stage
feat(color): decode stage for the streaming pipeline (#4170)
feat(color): Bradford chromatic adaptation in the working domain (#4174)
feat(gfx): compose the streaming pipeline core (P6, #4040)
feat(gfx): compose the streaming pipeline core (P6, #4040) (#4195)
zackees commentedon Sep 7, 2026
The streaming core (#4195) and the binding adapter (#4199) are in. What remains in this phase is the
show()wiring, and having gone looking for the seam I want to record what it actually requires, because it is more constrained than "call the pipeline fromshowPixels".The transform cannot go where the existing rewrite goes
Channel::showPixelsalready has a place where pixels get rewritten:ReorderingPixelIteratorAnymaterializes a thread-localfl::vector<CRGB>for XYMap addressing and builds a freshPixelControllerover it.That is the wrong home for this. C2 asks for per-pixel work inside the existing iteration with no framebuffer, and writing the pipeline's output into a
CRGBbuffer is both a frame-sized buffer and an 8-bit intermediate — the shape B3 rules out and thatci/tests/test_no_rgb8_intermediate.pyalready guards the gfx stages against.The seam that does fit
PixelIteratoris a hand-built vtable over a duck-typed source, and its constructor is templated on that type. So a source that pulls a raw pixel, runsprocessPixelQ16, and yields the quantized result satisfies it with no buffer at all — genuinely streaming, which is what C2 asks for.The interface such a source has to provide is the whole vtable:
loadAndScaleRGB(u8*, u8*, u8*)loadAndScaleRGBW(const Rgbw&, u8*, u8*, u8*, u8*)loadAndScaleRGBWW(Rgbww, u8*, u8*, u8*, u8*, u8*)stepDithering(),advanceData(),size(),has(int)FASTLED_HD_COLOR_MIXING:loadRGBScaleAndBrightness(u8*, u8*, u8*, u8* brightness)and the deprecatedgetHdScaleTwo things that need deciding, not guessing
Brightness must not apply twice.
loadAndScale0/1/2fold inmColorAdjustment, whosepremixedcarries brightness. The pipeline carries brightness too, as C4's flux scalar. So the managed source has to read rawmDataand never callloadAndScale*, with the frame's brightness pushed into the flux scalar instead. That part is clear; it just has to be tested explicitly, because getting it wrong is a visible regression for every channel with a profile bound.The legacy correction and temperature are already handled — binding a profile clears them, which is what the
LegacyClearedByProfilewarning is about — so brightness is the only overlap.The HD path is genuinely open.
loadRGBScaleAndBrightnesshands the encoder a colour triple and a separate 5-bit brightness for APA102-HD. What that should mean once a colour pipeline owns the amplitude stage is a P8 question (chipset-aware quantization and 5-bit semantics), not something to decide by whatever makes the wiring compile. Options are to leave HD chipsets on the legacy path until P8, or to derive the brightness field from the flux scalar — the second needs the 5-bit semantics settled first.Suggested shape
ColorManagedPixelSourceimplementing the vtable interface overPixelController<RGB>plus aStreamingPipelineQ16, reading raw and quantizing once at the end — the "pass-through final encoder stub" this phase's deliverables call for.showPixelsselecting it whenbuildPipelineForBindingsucceeds, leaving every channel without a bound profile bit-identical.Deliberately not started as a partial: a half-wired hot path that double-applies brightness on some chipsets is worse than an unwired one, and the HD question is not mine to answer by default.
feat(channels): make the colour-profile binding drive a pipeline (P6, #…
feat(channels): run the colour pipeline in show() (P6, #4040)
feat(channels): run the colour pipeline in show() (P6, #4040)
feat(channels): run the colour pipeline in show() (P6, #4040)
feat(channels): run the colour pipeline in show() (P6, #4040) (#4200)
zackees commentedon Sep 10, 2026
The budget deliverable is in #4287 — and A1 needs a black floor
The three implementation PRs are in (#4195 streaming core, #4199 binding adapter, #4200
show()wiring). What was left is this phase's other deliverable, the budget-conformance suite. #4287 is that.It also found that the criterion cannot be met as literally written, for a reason worth recording here.
What was standing in for it
The conformance case bounded drive error and converted to A1's units in a comment —
"A1's luminance budget is 0.5%; this is 0.13%"— a conversion it never computed. There was no dE2000 in C++ at all. And it read 48 hand-typed literals out of the corpus's 285, withci/golden/color-reference-v1.jsonnamed only in a comment, so the two could diverge silently.Both are fixed: the vectors are generated from the corpus (all 57 for this device), a guard fails on a stale or subset header, and the case now computes dE2000 and luminance.
The measurements
The dim half had never been measured against the reference at all.
A1 has no black floor, and it needs one
Unfloored the worst is 1.3055 dE2000, at
bt2020-rgb-03— code (0,0,1) in BT.2020. The mechanism is not darkness as such:(0, 5.242e-05, 1.447e-05);1.5259e-05;A luminance threshold does not separate these —
bt2020-rgb-02misses at Y = 5.4e-04 whilesrgb_bt709-rgb-00passes at Y = 3.0e-04. What distinguishes them is a sub-ULP drive. Eight of 57 have one; excluding those, nothing exceeds 0.3951.So this is not an implementation defect. No fixed-point implementation of this width can meet 0.5 dE2000 on a target it cannot represent. What A1 is missing is the floor #4156 R8 already asked for — "define the luminance-error denominator and black floor … and unsupported low-light region" — and this puts a number on it: the s16.16 resolution itself,
1/65536in drive.#4287 asserts both figures, so the floored result and the unfloored miss are each pinned and neither can drift while the other passes.
What remains in P6
The other acceptance criteria — no intermediate RGB8 buffer, single final quantization, chromaticity-preserving brightness with a separate electrical model — have their own cases already. If you want P6 closed on the A1 criterion, the open question is whether to amend A1 with the floor above or to record the two vectors as a known and bounded exception. That is a decision, not a measurement, so I have left it to you rather than editing the criterion.
One coverage note, stated rather than hidden: the corpus has five device profiles and #4287 covers
rgbonly.rgbw,rgbww,rgbww_two_whiteandnon_d65_whiteneed emitter profiles on the C++ side that do not exist there yet, and the generator refuses to emit vectors nothing can run rather than emitting them silently.test(color): state P6's budget in dE2000, against the corpus not a co…
zackees commentedon Sep 10, 2026
P6's criteria are all met now — proposing closure, with the evidence
The last thing I left open here was whether A1 needed amending with a black floor. #4296 answered it by stating the floor in
docs/color-pipeline-contracts.md, which is where the implementation contract lives. With that in, every criterion this phase owns has an artifact behind it. Checked against master rather than carried forward from the PRs:tests/fl/gfx/pipeline.cpp— 0.3951 dE2000 and 3.66e-04 in Y against A1's 0.5 and 0.5%, over all 57 corpus vectors for thergbdevice, generated from the golden rather than transcribed (#4287)docs/color-pipeline-contracts.md→ "The black floor, stated": the floor is one s16.16 unit, with both the floored (0.3951) and unfloored (1.3055) figures published (#4296)ci/tests/test_no_rgb8_intermediate.py— 6 cases, 20 subtests, including a self-check that the check can fail and a false-positive guardtests/fl/gfx/flux_scalar.cpp— ratios preserved, composition multiplicative and order-independent, full brightness bit-exact identitypower_mgthonours a declaredPowerModelRGBWrather than droppingwhite_mW, and charges the emitters the strip actually lights (#4284)ChannelOptionsthroughshow()fl::Channel::mPipeline, built inreconcileColorProfileand used inshowPixels(#4200)One thing I tried and threw away, because it would have been misleading
Before finding
test_no_rgb8_intermediate.pyI started writing a numeric B3 test — checking that the drives land off the 8-bit grid (134 of 171 do, worst 127 against a 257 step) and that adjacent source codes never collide (0 collisions over 256).Both properties hold. I discarded it anyway, because the existing checker's docstring is right and my framing was not:
The grid check only catches an 8-bit stage that is last; a mid-pipeline round would be scrambled by the matrices that follow and pass. Landing it would have added a case that looks like it guards B3 and does not. Recording the measurement here since it is a real property, and it is a fact about the pipeline worth having — just not a guard.
What is not P6's
The remaining pipeline work that touches this phase belongs elsewhere and should not hold it open:
draw()refuses an rgb16 frame rather than losing its low bits;Unless one of those is meant to gate P6, I think this closes.
zackees commentedon Sep 10, 2026
One line in the closure evidence needs narrowing (#4330)
Re-reading my own closure case above rather than adding to it. This row:
The checks are sound and the self-check is real. The scope is narrower than the row implies. The file scans eight stage files under
src/fl/gfx— the pipeline's interior. B3's claim covers the normative path and includes "single final quantization", and the handoff from the pipeline to a chipset encoder is outside what the file looks at.That handoff is where a round trip survives:
writeWS2816makeScaledPixelRangeRGB16writeHD108makeScaledPixelRangeRGBmakeScaledPixelRangeRGBGamma8LUTOn those two the wide output is quantized to 8 bits and then expanded — an intermediate quantization, which is the thing B3 names. Tracked separately as #4326.
#4330 narrows the docstring so a green run stops being quotable for more than it inspected. It changes no check: 6 passed, 20 subtests, unchanged.
What this does and does not do to the closure case
It does not move the ΔE/luminance rows, the brightness-stage row, or the electrical-model row — those stand on measurements, not on this file.
It does mean the B3 row should read as "the pipeline's interior does not round-trip through RGB8", with the encoder boundary open under #4326. Whether that gates P6 or belongs to P8 with the rest of the encoder integration ("Encoder integrations replacing P6's pass-through stub" is P8's deliverable) is a call for whoever closes this — I lean P8, but I would rather say so than quietly bank the narrower claim as though it were the whole one.
The rule that would catch it is "a 16-bit encoder is fed the 16-bit adapter", which is not a property of the stage files. It is not in #4330 because it fails today on two of the three, and it belongs with the fix.
docs(ci): say what the B3 guard actually covers, which is the interior (
fix(channels): isColorManaged() reports the transform, not a constant (…
zackees commentedon Sep 11, 2026
Two of P6's power criteria are documented but not implemented (#4342, #4344)
The closure case above lists:
Both rows are true and I am not withdrawing them. What they do not cover is whether the limiter's input is the right quantity, and on the contracts addendum's own wording it is not, twice over.
#4344 — the limiter never sees the solve.
docs/color-pipeline-contracts.mdsays "the managed implementation uses two-pass streaming"; there is no prepass.CFastLED::show()calls the power function on the rawCRGBarray before any traversal, and the managed transform runs later insideshowPixels. Measured on one LED, same estimator both sides:(40,40,40)(40,40,40)(20,20,20)The direction is set by emitter luminance relative to the rendering white — a property of the bound profile the limiter never reads.
#4342 — the estimate is pre-dither.
dither()isqadd8(b, d)applied before scaling and only ever raises. Worst frame over the 8-frame cycle, 64 LEDs: +1.25% at brightness 255, +5% at 64, +50% at 16. The limiter's job is to lower brightness until demand fits, so it walks toward its own worst case.Both under-estimate, and they compose.
What this means for closure
Neither is a regression in what P6 built; both are P6 criteria the addendum describes in the present tense and the code does not do. Whether that gates this phase or belongs to P8 alongside the encoder-width work (#4326) is the same judgement I flagged on the B3 row in #4330 — and my lean is the same: P8, because the prepass is an architecture change and the dither reserve wants the pipeline-dither decision settled first.
What should not survive either way is the doc's present tense. That part is cheap and does not need the architecture to be decided.
zackees commentedon Sep 11, 2026
Correcting my own comment above
I wrote that the addendum "describes in the present tense" things the code does not do, and that "what should not survive either way is the doc's present tense". That is wrong.
docs/color-pipeline-contracts.mdopens by saying it is a list of implementation requirements, not a description, and that "unimplemented requirements remain open". Requirements are normally written in the present tense; an unmet one is what the preamble tells you to expect.So there is no documentation defect in #4342 or #4344, and nothing to change in the addendum. Corrected on both issues.
The measurements stand, and they are what I should have led with:
qadd8only adds (#4342)Read as "two P6 requirements are unmet, and here is the current exposure" rather than "the doc is wrong". That does not change my lean on sequencing — the prepass is an architecture change and the dither reserve wants the pipeline-dither decision first, so both sit with P8 alongside #4326 — but it does change what needs doing: implementation, not editing.
Nothing here alters the closure rows in my earlier comment; the ΔE, brightness-stage and electrical-model rows stand on their measurements.
feat(power): charge a managed channel's solved drives, not its source (…
zackees commentedon Sep 19, 2026
P6 closed: the last two requirements have landed
The closure case above (2026-09-10) listed every criterion with its artifact. What held the phase open afterwards were two unmet power requirements from the contracts addendum. Both are now implemented, tested, and merged:
[#4344]cases intests/fl/power_estimation.cpp. Before the fix, a red-heavy frame was charged 7561 mW against about 18230 mW of drive.[#4342]cases. The reserve bounds the worst frame of a full dither cycle over a 7×7 source × brightness grid. A token reserve fails at the issue's own figure: 1001 mW charged vs 1162 mW latched.Along the way, #4440 (a pipeline could be freed under a reader; it is now held by
shared_ptrand compiled out on small tiers) merged in #4438.Unchanged from the earlier closure case:
ChannelOptionsthroughshow().The encoder-boundary quantization noted in #4330 was resolved under P8 (#4368, #4387).
zackees commentedon Sep 19, 2026
Correcting my closure comment above: I did not check B6, and its behaviour half ("CM-enabled
.fledplayback goes through sRGB decode") is not implemented.video.coloris resolved (P4), but it never reaches a channel's source profile, and the default source is linear sRGB. The workaround is documented, and the implementation is tracked in #4460, linked under #4034. The rest of the closure evidence stands.