Repository navigation
Conversation
nv12.k and nv12buf.k rounded every sample with a fixed +128 (+512 for the 2x2 chroma sums), so slow dark gradients quantised into steps before the encoder saw them. A 4x4 Bayer offset (mean unchanged, fixed per pixel so a render stays a function of its frame) replaces it in both kernels and in nv12_cpu, kept bit-equal: a new test runs both kernels through the interpreter against nv12_cpu, and one checks a dark ramp keeps its mean. Measured on a 1080p60 dark radial gradient (2D): raea check's blotching goes from 3% of dark blocks on 2/2 sampled frames to 1% on 1/2 (still P1), and the H.264 grows from 0.64 to 4.0 MB for 4 s, the encoder now keeping the gradient instead of flattening it. 10-bit HEVC remains the full fix. Fixes shinyobjectz#87 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
hshalab
pushed a commit
to hshalab/raea
that referenced
this pull request
Nov 18, 2026
…jectz#171, shinyobjectz#172) on main for 0.1.8 raea export layers and layers.json, CapCut drafts written from layers.json with a captions track, raea export xml (FCP7 XML for Premiere Pro and DaVinci Resolve), footage that moves, is cut or fades keyed in every export, and the delivery and words guides teaching them (raea-skills shinyobjectz#99, merged onto raea-skills main). Conflict: engine/cli/src/cli.rs's help, where main added raea wear and raea setup motion beside Zach's raea export layers and raea export xml; both kept. The skills pin is raea-skills main with shinyobjectz#99 merged (f37e5e3). Co-Authored-By: Claude Opus 5.5 <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.
Requested by Mattias
Fixes #87.
nv12.kandnv12buf.krounded RGB to BT.709 limited range with no dither, so slow dark gradients banded in the default 8-bit H.264. This adds a 4x4 ordered (Bayer) dither in place of the fixed +128 / +512 rounding. It's on by default, with no flag.What changes
nv12.k,nv12buf.kand the CPU fallbacknv12_cpu(core/k/src/native.rs) apply the same dither and stay bit-equal.nv12_cpu, and another checks that a slow dark ramp keeps its mean and loses its steps.One correction to the issue's wording: the pattern is fixed per pixel position (x, y mod 4) and not seeded by frame. Play and render stay identical, and there's no temporal shimmer.
Measured on main 5b2c773
Dark page: the issue's 1920x1080, 60 fps, 4 s radial gradient.
raea checkblotching60 s 3D film (fog, bloom, dark background):
raea checkblotchingThe dark page grows because the encoder now keeps the gradient detail it was throwing away. The film already sits near the bitrate ceiling. It still gets a warning, and 10-bit HEVC remains the clean master. Constant quality is yours, as you said.
cargo test -p raea-core-kpasses.Also merged onto main 0ea4eab together with the other open PRs from this review: their crates' tests pass (118, 0 failed).
🤖 Generated with Claude Code