Skip to content

bench: add --grain, a controlled grain axis on real content - #50

Merged
lusoris merged 1 commit into
masterfrom
bench/grain-axis
Aug 30, 2026
Merged

bench: add --grain, a controlled grain axis on real content#50
lusoris merged 1 commit into
masterfrom
bench/grain-axis

Conversation

@lusoris

@lusoris lusoris commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Why the corpus couldn't supply one

The central claim is that reductive pre-encode filtering wins in proportion to removable impairment (ADR-0142). Testing that needs a controlled grain axis. I went looking for a grainy clip to pin and measured instead, at the 640x360/48-frame corpus workload:

source grain_sigma grain_flat
real Blu-ray scan, 1994 remux 0.0047–0.0101 0.96–0.98
real Blu-ray scan, 2000 0.0079 0.94
real film scan, 1971 0.0079 0.73
netflix-bar (Chimera, VP9 webm) 0.0124 0.60
bbb (clean animation) 0.0131 0.33

Real film scans measure lower grain than the public clips, not higher. Modern Blu-ray masters are frequently denoised; the public 4K sets are distribution re-encodes with the grain compressed out; and any downscale to the corpus resolution attenuates what survives, because grain is a per-pixel high-frequency signal and averaging 3–6 pixels into one removes it.

So there is no grainy clip to pin. The honest axis is injection, not selection.

What

--grain N overlays seeded noise on a real source and scores both arms against the clean original (implying --clean-reference), so a denoiser isn't penalised for removing the impairment under test — the same rationale as the deband 'wash' bug.

Verified on netflix-bar, monotonic in both directions and byte-reproducible under a fixed seed:

--grain grain_sigma grain_flat
0 0.0124 0.600
8 0.0138 0.572
20 0.0182 0.171

Why not the existing --synth noise

It noises a flat grey plate — the degenerate case. There's no content to preserve, and it starves the grain estimator: no 3x3 neighbourhood stays under edge_thr, so grain_flat collapses to ~0 and the sigma reading becomes meaningless. --grain keeps the estimate in the supported regime (flat 0.60→0.17).

Worth noting the historical −88.94% BD-rate figure in bench-results came from a 'locked-off scene + seeded grain' setup; denoising a near-flat plate is trivially easy and inflates results. --grain on real content is the honest version of that experiment.

Gates

21/21 fast suite, changelog in sync. Calibration used real film scans from the local media box; only aggregate statistics are recorded, no content.

🤖 Generated with Claude Code

The central claim is that reductive pre-encode filtering wins in proportion to
removable impairment (ADR-0142). Testing that needs a controlled grain axis, and
the corpus could not supply one.

Measured, at the 640x360/48-frame corpus workload:

  real Blu-ray scan 1994 remux   grain_sigma 0.0047-0.0101  flat 0.96-0.98
  real Blu-ray scan 2000         grain_sigma 0.0079         flat 0.94
  real film scan 1971            grain_sigma 0.0079         flat 0.73
  netflix-bar (Chimera webm)     grain_sigma 0.0124         flat 0.60
  bbb (clean animation)          grain_sigma 0.0131         flat 0.33

Real film scans measure LOWER grain than the public clips, not higher. Modern
Blu-ray masters are frequently denoised, the public 4K sets are distribution
re-encodes with the grain compressed out, and any downscale to the corpus
resolution attenuates what survives -- grain is a per-pixel high-frequency signal
and averaging 3-6 pixels into one removes it. So there is no grainy clip to pin;
the honest axis is injection, not selection.

--grain N overlays seeded noise on a REAL source and scores both arms against the
clean original (implying --clean-reference), so a denoiser is not penalised for
removing the impairment under test -- the same rationale as the deband 'wash' bug.

Verified on netflix-bar: monotonic in both directions (sigma 0.0124 -> 0.0182,
flat 0.600 -> 0.171 as grain goes 0 -> 20) and byte-reproducible under a fixed
seed. It also stays in the estimator's supported regime, unlike the pre-existing
--synth noise, which noises a flat grey plate and starves the estimator (no 3x3
neighbourhood stays under edge_thr, so flat collapses to ~0 and sigma is
meaningless).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@lusoris
lusoris merged commit 9fa23ad into master Aug 30, 2026
2 of 4 checks passed
@lusoris
lusoris deleted the bench/grain-axis branch August 30, 2026 19:17
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