Repository navigation
test(color): measure what irregular dwell costs the dither (#4347) - #4393
Merged
Merged
Conversation
The contract sentence R8 is about asks for two tests: "with explicit tests for dropped submissions and irregular dwell." #4348 and #4361 did drops. This is dwell, and it is a separate defect on a separate axis -- dither correctness is a time-weighted mean, so a phase held twice as long counts twice, whether or not anything was dropped. Measured at 1/4 brightness, source code 9. Holding the phases that carry the low half of the bit-reversed offsets three times as long renders 2.19 against 2.57 for the opposite weighting, either side of the 2.38 that even dwell gives. Nothing is dropped; every phase still reaches the wire. 0.38 codes of swing against the drop case's 0.75, and that ratio is not coincidence: dropping a parity gives the survivors 100% of the weight while holding 3:1 gives them 75%, so the displacement is half as far. Dwell reaches the same place as dropping, by degrees. Which is why it wants its own test. An implementation that advanced the phase on presentation -- the fix R8 defers -- would close the drop half of that sentence and leave this half exactly as it is, because dwell is about how long a presented frame stays up, not whether it was presented. The control is dwell that is irregular against the frame clock but uniform against the phase: every frame twice as long, mean unmoved. Correlation is the fault, not jitter. The helper weights by the phase's own parity rather than by position in the loop. Indexing by position is what I wrote first, and it silently reversed the sign -- the cycle starts wherever the global counter is, so a fixed array lands on whichever parity it lands on. Recorded in the helper so the next reader does not repeat it. Verified by making the weighting uniform, which fails three assertions. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe test suite adds a time-weighted mean helper and covers irregular and uniform temporal dwell across dither phases. ChangesDither dwell tests
Estimated code review effort: 2 (Simple) | ~10 minutes Change: Other ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
6 of 7 tasks
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.
Completes the test half of R8's contract sentence. Part of #4034.
#4348 and #4361 did dropped submissions. This is dwell — and it is a separate defect on a separate axis, because dither correctness is a time-weighted mean: a phase held twice as long counts twice, whether or not anything was dropped.
Measured
1/4 brightness, source code 9:
Nothing is dropped; every phase still reaches the wire.
0.38 codes of swing against the drop case's 0.75, and that ratio is not coincidence — dropping a parity gives the survivors 100% of the weight, holding 3:1 gives them 75%, so the displacement from the even-dwell mean is half as far. Dwell reaches the same place as dropping, by degrees.
Why it needs its own test
An implementation that advanced the phase on presentation — the fix R8 defers — would close the drop half of that sentence and leave this half exactly as it is. Dwell is about how long a presented frame stays up, not whether it was presented.
Control
Dwell that is irregular against the frame clock but uniform against the phase: every frame twice as long, mean unmoved. Correlation is the fault, not jitter — the same distinction the drop test draws.
One thing I got wrong first
The helper weights by the phase's own parity, not by position in the loop. Indexing by position is what I wrote initially, and it silently reversed the sign of the whole measurement: the cycle starts wherever the global counter happens to be, so a fixed array lands on whichever parity it lands on. It is recorded in the helper so the next reader does not repeat it.
I also set the swing bound before measuring and had to correct it — 0.38, not the >0.5 I assumed by analogy with the drop case.
Verification
Making the weighting uniform fails three assertions.
bash lintclean; 305/305 unit, 84/84 examples.Test-only; no
src/change.🤖 Generated with Claude Code
https://claude.ai/code/session_01MLhWkMfzLjrnLTDMBE6Fj9
Summary by CodeRabbit