Skip to content

Stop the loupe magnifying the wrong colours - #4

Merged
davidtorcivia merged 2 commits into
masterfrom
fix-loupe-colour-upload
Aug 3, 2026
Merged

davidtorcivia merged 2 commits into
masterfrom
fix-loupe-colour-upload

Conversation

@davidtorcivia

Copy link
Copy Markdown
Owner

Found while closing the watermarking colour gate. Predates that work.

LoupeOverlay.svelte uploaded the video element straight into WebGL, which makes the engine do its own YUV to RGB conversion. It gets it wrong by up to 39/255 on Safari with a VP8 screen share, 4/255 on Chromium H.264. A colour inspection instrument was lying about the footage.

Uploading an ImageBitmap through the identical pipeline is 0/255 on every engine. Only the upload source changes. UNPACK_COLORSPACE_CONVERSION_WEBGL = NONE does not help at all.

Measured against a live WebRTC stream on Chromium, real Firefox (WebDriver BiDi) and real Safari 26.5.2 (safaridriver), with the codec pinned to what the SFU negotiates. Numbers and method in docs/COLOR_PARITY.md.

Not changed: videoGlass's video-element fallback is off by the same amount, but it is frosted and decorative. Scopes already sample through an ImageBitmap and measure exact.

Gate: svelte-check, vitest, npm run build pass. iOS unmeasured.

davidtorcivia and others added 2 commits August 2, 2026 21:55
texImage2D on a video element makes the engine do its own YUV to RGB
conversion, and it gets it wrong: 39/255 on Safari with a VP8 screen
share, 4/255 on Chromium H.264. Measured against a live WebRTC stream on
Chromium, real Firefox and real Safari. The loupe is a colour inspection
instrument, so it was quietly lying about the footage.

An ImageBitmap through the identical pipeline is exact on every engine.
Same shader, same format, same readback, only the source changes.
UNPACK_COLORSPACE_CONVERSION_WEBGL does not move the number at all.

createImageBitmap is async, which suits a texture already throttled to
CONTENT_MS: freshness lags a refresh, tracking does not. The first
upload stays synchronous so the lens is never blank.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@davidtorcivia
davidtorcivia merged commit 985598e into master Aug 3, 2026
7 checks passed
@davidtorcivia
davidtorcivia deleted the fix-loupe-colour-upload branch August 3, 2026 02:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant