Repository navigation
Description
docs/color-pipeline-contracts.md states, in the present tense:
The managed implementation uses two-pass streaming over stable frame inputs:
- Evaluate solved demand across every channel participating in a supply budget; include response inversion, current-field policy, and quantization reserve. Compute a wide shared power scalar without advancing dither state.
- Encode the same source/profile snapshot with that scalar and submit output.
There is no prepass. CFastLED::show() calls the power function once, on the raw CRGB array, before any controller traversal:
if(mPPowerFunc) {
scale = (*mPPowerFunc)(scale, mNPowerData);
}The managed transform runs later, inside showPixels. So the limiter charges for the source values and the strip draws the solved drives, which are a different number. This is #4156 R3, stated there as "Accurate demand depends on profile conversion, RGBW allocation, response inversion, and native current settings across all channels."
Measured
One LED, colour-managed channel, calculate_unscaled_power_mW() applied to the source on one side and to the drives the channel actually emitted on the other:
| source | emitter luminances | charged | drawn | ratio |
|---|---|---|---|---|
(40,40,40) |
1.00 each | 36 mW | 13 mW | 0.36x |
(40,40,40) |
0.25 each | 36 mW | 42 mW | 1.17x |
(40,40,40) |
0.10 each | 36 mW | 89 mW | 2.47x |
(20,20,20) |
0.05 each | 20 mW | 89 mW | 4.45x |
Both columns use the same estimator, so this is a like-for-like comparison of what the limiter believes against what it would believe if it could see the drives.
What decides the direction
Emitter luminance relative to the rendering white. A device whose emitters are brighter than the white being targeted needs drives below the source, and the limiter over-charges — safe, wasteful. A device whose emitters are dimmer needs drives above the source, and the limiter under-charges.
So the honest framing is not "the model is wrong by 4x" but: the sign and magnitude of the error are set by a property of the bound profile that the limiter never reads. The synthetic luminances above make it visible; what makes it a defect is that nothing bounds it.
At full-scale white the mapper clamps and drives cannot exceed 255, so the error is bounded there. It is the modest-source, dim-emitter region where it opens up — and that is the region a power limiter pushes you into.
Relationship to #4342
Same contract section, same shape: the doc describes an electrical model the code does not implement. #4342 is the dither half — the estimate reads pre-dither pixels and dither only adds, up to +50% at low brightness. This is the profile half. Both under-estimate, and they compose.
Fix direction
The contract's own step 1 is the answer and is a real piece of work — a prepass over solved demand, which is P6/P8 territory and gated on the same throughput budget the doc mentions. The cheaper alternative is to narrow the doc: say the limiter models source demand and is not profile-aware, and that a managed channel's actual draw may differ in either direction by a factor set by its emitter luminances.
What should not persist is the present tense. Filed rather than patched because choosing between those two is a scope decision.
🤖 Generated with Claude Code
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Sep 11, 2026
Correction: the contracts doc is normative, so there is no doc defect here
I framed this as the document claiming something the code does not do, and said the present tense should not persist. That was wrong, and it is wrong for a reason I could have checked in one line —
docs/color-pipeline-contracts.mdopens with:So "the managed implementation uses two-pass streaming" and "the electrical contract bounds modeled demand ... including upward quantization/dither choices" are requirements, stated the way requirements normally are. An unimplemented one is exactly what the preamble says to expect. There is nothing to narrow and no present tense to remove.
What survives, and it is the part worth having
The measurements. They are unchanged and they were the point:
qadd8only adds — worst frame +50% at brightness 16 (R4: the power model reads pre-dither pixels, and dither only ever adds — 50% under-report at low brightness #4342)Those quantify what it costs to ship managed output before the prepass exists, which is useful for ordering the remaining work. They do not describe a defect in the document.
So read this as "requirement not yet met, here is the current exposure", not "doc and code disagree". Retitling is not needed — the titles describe the behaviour, which is accurate — but the framing in the body above is not, and I would rather say so than leave it.
This is the third time this session I have reported a defect from the wrong layer: #4326 (looked for a guard in the wrong file), #4333 (looked for a log capture hook in
log.hwhen it is incstdio.h), and now reading a requirements doc as a description. The common failure is concluding from where I looked instead of checking what the thing is for.zackees commentedon Sep 11, 2026
Correcting my own framing here, because it makes this issue look like a decision when it is not.
I wrote that the doc "describes an electrical model the code does not implement" and that "what should not persist is the present tense", then offered a choice between implementing the prepass and narrowing the doc.
The present tense is the document's normative voice, and its preamble says so explicitly:
Every requirement in the file is written this way — "Bradford adapts source-relative XYZ to the selected rendering white", "Managed playback is strict by default", "Readers must document how non-seekable input is probed". None of those are claims about today's code either. So "the managed implementation uses two-pass streaming" is a requirement that is currently unmet, which the preamble already accounts for, not a false statement in need of narrowing.
That removes option (b). There is no text to fix, so this is not a scope decision between two defensible answers — it is one open requirement with a measured exposure attached.
What stands unchanged is the measurement: the limiter charges for source values while the strip draws solved drives, and the sign and magnitude of the gap are set by emitter luminance relative to the rendering white — a property of the bound profile the limiter never reads. Up to 4.45x under-charge on the dim-emitter, modest-source combination, which is exactly the region a power limiter pushes you into.
This is the third time I have read that document as a description rather than a requirements list. Recording it here so the issue does not carry the error forward.
test(power): pin that the limiter charges the source, not the solved …
chore(bloat): claim +23 B for the managed power estimate (#4344)
feat(power): charge a managed channel's solved drives, not its source (…
chore(bloat): claim +23 B for the managed power estimate (#4344)
feat(power): charge a managed channel's solved drives; hold the pipel…