Skip to content

test(power): pin the draw the estimate misses when dithering is on (#4342) - #4391

Merged
zackees merged 1 commit into
masterfrom
test/4342-dither-power-underreport
Sep 12, 2026
Merged

zackees merged 1 commit into
masterfrom
test/4342-dither-power-underreport

Conversation

@zackees

@zackees zackees commented Sep 12, 2026

Copy link
Copy Markdown
Member

Pins the exposure #4342 measured. Does not close it — the fix (a quantization reserve in the estimate, which docs/color-pipeline-contracts.md names 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:

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 — 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 PixelController without advanceDitherFrame() 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 lint clean; 305/305 unit, 84/84 examples.

Test-only; no src/ change.

🤖 Generated with Claude Code

https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9

…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
@zackees
zackees merged commit ac55814 into master Sep 12, 2026
4 checks passed
@fastled-project-sync fastled-project-sync Bot moved this to Triage in FastLED Tracker Sep 12, 2026
@fastled-project-sync fastled-project-sync Bot moved this from Triage to Done in FastLED Tracker Sep 12, 2026
@zackees
zackees deleted the test/4342-dither-power-underreport branch November 5, 2026 05:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant