fix(core): range-tolerant calibration-flash detection (#46) - #47
Merged
Merged
Conversation
Flash detection thresholded chroma at uavg>180 && vavg>170, tuned to a full-range magenta frame (~201/221). The same frame decoded as limited range (16-235) — common in CI and some ffmpeg builds — scales toward center (~177/195) and straddled the cutoff, so detection intermittently missed and fell back to clock-zero (degrading audio sync). This also made the e2e flash assertion flaky. Lower both thresholds to a single FLASH_CHROMA_MIN=150: still far above neutral (128) and above any single-channel UI colour (magenta needs BOTH channels elevated), but with wide margin for range/compression drift. Add regression tests for a limited-range magenta frame and for magenta-specificity (a single elevated channel is not a flash). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Closes #46.
Root cause
Flash detection thresholded chroma at
uavg > 180 && vavg > 170, tuned to a full-range magenta frame (≈201/221). The same frame decoded as limited range (16–235) — which CI's webm pipeline and some ffmpeg builds do — scales toward center to ≈177/195, straddling the old cutoff. So detection intermittently missed the flash and fell back to clock-zero (degrading audio sync), and the e2evideoClockOffsetMs > 0assertion flaked (failed once on the 0.11.0 release PR, passed on re-run).Fix
Lower both thresholds to a single
FLASH_CHROMA_MIN = 150:Internal-only; no API change.
Tests
parseFlashFromMetadatacases: a limited-range/dimmed magenta frame (177/195) is now detected; a single elevated channel (saturated blue or red UI) is still rejected.offset 200ms).pnpm -r typecheckclean; 158 unit tests pass; e2e exit 0.🤖 Generated with Claude Code