Repository navigation
test(power): pin the draw the estimate misses when dithering is on (#4342) - #4391
Merged
Merged
Conversation
…4342) #4342 measured that the power estimate reads pre-dither pixels while dither only ever adds, and nothing guarded the result. A regression widening the gap, or a fix closing it, would both move silently. Measured here at brightness 16 over a 200-LED strip, dither off against the worst frame of a full cycle, both sides through `calculate_unscaled_power_mW`: source dither off worst frame ratio 1 1000 1162 1.162 8 1000 1162 1.162 16 1162 1327 1.142 64 1655 1818 1.098 The 1000 mW floor is the idle term for 200 dark LEDs. The dither adds a near-constant ~162 mW on top, because what it does is lift channels off zero and how far barely depends on how dim the source is -- so the relative error is worst exactly where a limiter operates, and a limiter pushing brightness down walks toward that end rather than away. Two things worth stating about the method. Both sides go through the same estimator. Powering the source and calling `scale_power_for_brightness`, which is what the real limiter does, treats the per-LED idle term differently from powering an already-scaled pixel and reports 2.4x -- an artifact of the comparison, not of the dither. #4342 makes the same caveat about its own figures. And the phase has to advance between frames. Rebuilding the PixelController without `advanceDitherFrame()` renders one phase eight times; #4342 records measuring a milder gap that way before finding the worse frame. This does not reproduce that issue's +50% headline. Under a like-for-like comparison including the idle term the effect is +16% at its worst. Recorded as what this method measures rather than as agreement. Verified by making the dither contribute nothing, which fails both cases. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
This was referenced Sep 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pins the exposure #4342 measured. Does not close it — the fix (a quantization reserve in the estimate, which
docs/color-pipeline-contracts.mdnames directly) is still unimplemented.Measured
Brightness 16, 200-LED strip, dither off against the worst frame of a full cycle, both sides through
calculate_unscaled_power_mW:The 1000 mW floor is the idle term for 200 dark LEDs. The dither adds a near-constant ~162 mW on top — what it does is lift channels off zero, and how far barely depends on how dim the source is. So the relative error is worst exactly where a limiter operates, and a limiter pushing brightness down walks toward that end rather than away from it.
Method, and two things that change the answer
Both sides go through the same estimator. Powering the source and calling
scale_power_for_brightness— what the real limiter does — treats the per-LED idle term differently from powering an already-scaled pixel, and reports 2.4x where the dither accounts for a fraction of it. That is an artifact of the comparison, not of the dither. #4342 makes the same caveat about its own figures, which is what prompted me to check.The dither phase has to advance between frames. Rebuilding the
PixelControllerwithoutadvanceDitherFrame()renders one phase eight times and misses the worst one. #4342 records measuring a milder gap that way before finding it.It does not reproduce the +50% headline
Under a like-for-like comparison that includes the idle term, the worst case here is +16%, not +50%. I have recorded what this method measures rather than asserting agreement I cannot demonstrate — I do not know the strip length or source the original figure used, and the idle term alone is enough to explain a difference of that size.
Verification
Making the dither contribute nothing (
d[i] = 0) fails both cases.bash lintclean; 305/305 unit, 84/84 examples.Test-only; no
src/change.🤖 Generated with Claude Code
https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9