Skip to content

docs(bench): profile the grain ladder against 86 real titles - #51

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

docs(bench): profile the grain ladder against 86 real titles#51
lusoris merged 1 commit into
masterfrom
bench/grain-ladder

Conversation

@lusoris

@lusoris lusoris commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

--grain N was an ffmpeg noise=alls= value with no physical meaning and no stated safe range. This profiles it against a real library so a value can be read as "about the grain of X", and marks where the measurement stops being trustworthy.

Method. 86 titles — 56 films + 30 TV series (one episode each) — stratified across the 1960s–2020s, 24 frames each at a fixed seek, measured two ways: a native centre crop=640:360 (true per-pixel grain) and scale=640:360 (what the corpus feeds the filters). Only aggregate statistics recorded; no content redistributed.

What real content measures (native crop, n=84)

percentile grain_sigma
p10 0.00173
p25 0.00381
median 0.00666
p75 0.01020
p90 0.01352

Median by decade:

decade film TV
1960s 0.00823
1980s 0.00788 0.00700
1990s 0.00644 0.01045
2000s 0.00408 0.00997
2010s 0.00649 0.00822
2020s 0.00215 0.00275

Grain collapses in the 2020s — 0.0022 film, with median grain_flat of 1.000: the estimator finds the frame essentially entirely flat. That is consistent with the repeated honest negatives on clean content, and it's why the grain axis has to be injected rather than selected.

TV is grainier than film from the 1990s on (1990s TV 0.0105 vs film 0.0064) — film-sourced series keep grain that feature Blu-rays often have remastered out. Thanks for the nudge; folding TV in materially changed the picture.

Downscaling hides grain differences

median p25 p75
native crop 0.00666 0.00381 0.01020
scaled to 640x360 0.00698 0.00568 0.00945

Medians barely move but the interquartile range halves (0.0064 → 0.0038): downscaling lifts the floor with resampling residual and lowers the ceiling by averaging real grain away. Benchmarking at the corpus resolution therefore under-detects grain differences — a caveat on any BD-rate delta attributed to grain.

The actionable output

Use netflix-bar as the grain base, stay at or below --grain 16:

--grain grain_sigma Δ grain_flat trust
0 0.01243 0.600 yes
8 0.01380 +0.00137 0.572 yes
12 0.01510 +0.00267 0.535 yes
16 0.01745 +0.00502 0.438 marginal
20 0.01824 +0.00581 0.171 no

Do not use bbb — it starts at only 33% flat coverage and goes non-monotonic past 16: sigma peaks at 0.0244 then falls to 0.0181 by grain 24. A non-monotonic axis is not an axis.

Honest caveat

Both corpus clips read higher than nearly all real content (0.0124–0.0131 vs a 0.0067 median) despite being the clean sources — they're compressed low-resolution distribution encodes, and codec artifacts put high-frequency residual exactly where the estimator looks. So grain_sigma is high-frequency residual in flat areas, with grain one contributor and codec noise another. Fine for deciding whether removable impairment exists; not safe for cross-source absolute comparison unless encodes are comparable.

🤖 Generated with Claude Code

--grain N was an ffmpeg noise value with no physical meaning and no stated safe
range. Profiled it against a real library: 86 titles (56 films + 30 TV series,
one episode each) stratified across the 1960s-2020s, 24 frames each at a fixed
seek, measured both as a native centre crop (true per-pixel grain) and scaled to
640x360 (what the corpus actually feeds the filters).

Findings:

- Real-content grain_sigma spans 0.0011-0.0265, median 0.0067.
- Grain COLLAPSES in the 2020s: film 0.0022, TV 0.0028, against ~0.008 for the
  1960s-80s. Median grain_flat for 2020s film is 1.000 -- the estimator finds the
  frame essentially entirely flat. This is consistent with the repeated honest
  negatives on clean content and is why the grain axis must be injected.
- TV is grainier than film from the 1990s on (1990s TV 0.0105 vs film 0.0064).
  Film-sourced series retain grain that feature Blu-rays often have remastered
  out, so TV is the better hunting ground -- thanks to the user for the prompt.
- Downscaling to 640x360 HALVES the interquartile range (0.0064 -> 0.0038): it
  lifts the floor with resampling residual and lowers the ceiling by averaging
  real grain away. Benchmarking at the corpus resolution therefore under-detects
  grain differences, which is a caveat on any BD-rate delta attributed to grain.

Actionable output: use netflix-bar as the grain base and stay at or below
--grain 16 (flat >= 0.44). Do NOT use bbb -- it starts at only 33% flat coverage
and its axis goes non-monotonic past 16, sigma peaking at 0.0244 then falling to
0.0181 by grain 24. A non-monotonic axis is not an axis.

Also records honestly that grain_sigma measures high-frequency residual in flat
areas, of which codec noise is a contributor alongside film grain: both corpus
clips read ABOVE nearly all real content (0.0124-0.0131 vs a 0.0067 median)
despite being the clean sources, because they are compressed low-resolution
distribution encodes. Cross-source absolute comparison is only safe between
comparably-encoded sources.

Only aggregate statistics are recorded; no content is redistributed.

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