forge
Explore
Log in

Don't you dare go Hollow

The 32x32-level 1:4 gate fires and is pixel-exact -- 8-pixel bands, not gradients

Browse files at this commit

3e19c893d07858ec38b53bb60cce2f1ce9c0459bAhmet Kaan GümüşParent: 56a2fac
  • test
    • the 32x32-level 1:4 gate fires and is pixel-exact -- 8-pixel bands, not gradients
Show full message
test(av1): the 32x32-level 1:4 gate fires and is pixel-exact -- 8-pixel bands, not gradients

r3 lifted the "a 32x32 partition type this decoder does not code (value=8)"
refusal with its gate #[ignore]d because no gradients-derived fixture ever made
aomenc's RD pick a 32-level HORZ_4/VERT_4 (class refusal-lifted-without-a-gate).
The content those shapes win on is 8-pixel BANDS: a 32x8 strip is flat, a 32x16
one straddles two bands, so HORZ_4 beats HORZ and SPLIT; a noise layer with an
explicit seed keeps the flat bands out of screen-content mode. Measured 16
HORZ_4 / 24 VERT_4 strips per frame at both bit depths.

Gate un-ignored unchanged in its asserts: 8-bit 7/8 attempts pixel-exact
(64 HORZ_4 + 72 VERT_4 + 136 coded strips), 10-bit 5/8 (48 + 48 + 96), zero
attempts out of scope, zero mismatches, refusals all named. gate_coverage:
enable-1to4-partitions leaves NEVER_EXERCISED_10BIT.

decode_probe now prints the rect4_32 counters (via stream::rect4_32_counters),
which is how the fixture search was measured rather than reasoned about.
crates/ec-av1/examples/decode_probe.rsmodified+5 -0
@@ -28,6 +28,10 @@ fn main() {
2828 std::process::exit(2);
2929 }
3030 };
31+ let report = || {
32+ let (h, v, c) = ec_av1::stream::rect4_32_counters();
33+ println!("rect4_32: horz={h} vert={v} coded={c}");
34+ };
3135 match ec_av1::stream::decode_stream(&data) {
3236 Ok(frames) if frames.is_empty() => {
3337 println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?");
@@ -52,4 +56,5 @@ fn main() {
5256 }
5357 Err(e) => println!("REFUSED: {e}"),
5458 }
59+ report();
5560 }
crates/ec-av1/src/gate_coverage.rsmodified+3 -5
@@ -154,11 +154,9 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[
154154 // sums never brought back to the 8-bit scale, Wiener clamp at the wrong
155155 // bound). `enable-dist-wtd-comp` and `enable-global-motion` left it the
156156 // same day for the same reason: lane-cwarp's 10-bit compound global-warp
157- // gate passes `=1` for both.
158- (
159- "enable-1to4-partitions",
160- "10-bit hole only: lane-tx64x16's 8-bit SB-level 1:4 gate passes `=1` and asserts both arms, but no 10-bit gate does",
161- ),
157+ // gate passes `=1` for both. `enable-1to4-partitions` left it on 2026-09-02:
158+ // lane-tx64x16 r4's 32-level 1:4 gate has a 10-bit arm that asserts both
159+ // orientations and coded strips inside pixel-exact attempts.
162160 (
163161 "enable-angle-delta",
164162 "hole at both depths, see the 8-bit list",
crates/ec-av1/src/stream.rsmodified+34 -30
@@ -69,6 +69,16 @@ fn final_dump_prefix() -> Option<String> {
6969 /// [`Av1Parser`] reports it), when a frame header names anything this
7070 /// crate's tile decoders do not reconstruct (see their own docs), or when an
7171 /// inter frame appears before any key frame has supplied a reference.
72+/// 32x32-level 1:4 strip counters, for `decode_probe`'s fixture search:
73+/// (HORZ_4 strips, VERT_4 strips, strips that read coefficients).
74+pub fn rect4_32_counters() -> (usize, usize, usize) {
75+ (
76+ crate::decode::rect4_32_horz_hits(),
77+ crate::decode::rect4_32_vert_hits(),
78+ crate::decode::rect4_coeff_hits(),
79+ )
80+}
81+
7282 pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
7383 let final_dump = final_dump_prefix();
7484 let mut parser = Av1Parser::new();
@@ -13149,18 +13159,11 @@ mod tests {
1314913159 /// gate-skips-on-its-own-failure); the 10-bit arm is what retires
1315013160 /// `enable-1to4-partitions` from `NEVER_EXERCISED_10BIT`.
1315113161 #[test]
13152- // lane-tx64x16 r3, MEASURED, not a hunch: no recipe tried this round makes
13153- // aomenc's RD emit a 32x32-level 1:4 partition on synthetic fixtures --
13154- // 20/20 attempts of the recipe below (min-partition-size=8,
13155- // max-partition-size=32) carried ZERO 32-level 1:4 blocks, as did a
13156- // vertically-squeezed variant and a horizontally-blurred one (the latter
13157- // additionally tripped the screen-content refusal). The wiring IS
13158- // exercised by real content -- see this round's report for the film probe
13159- // -- but until a fixture recipe is found this gate can prove nothing, and
13160- // a gate that passes by never seeing its feature is worse than an ignored
13161- // one (class gate-blind-to-feature). Un-ignore with the recipe, never with
13162- // a weakened assert.
13163- #[ignore = "no fixture recipe yet emits a 32-level 1:4 partition (lanes/tx64x16-r3.report.md)"]
13162+ // lane-tx64x16 r4: the fixture r3 could not find. `gradients` never wins
13163+ // a 32-level 1:4 shape; 8-pixel BANDS do -- each 32x8 strip is flat, so
13164+ // HORZ_4 beats both HORZ (two bands per 32x16) and SPLIT, while the noise
13165+ // layer keeps aomenc out of screen-content mode. Measured 16 HORZ_4 / 24
13166+ // VERT_4 strips per frame, both bit depths (lanes/tx64x16-r4.report.md).
1316413167 fn a_real_aomenc_stream_with_a_32x32_level_1to4_partition_decodes_pixel_exact() {
1316513168 const NAME: &str =
1316613169 "a_real_aomenc_stream_with_a_32x32_level_1to4_partition_decodes_pixel_exact";
@@ -13177,7 +13180,7 @@ mod tests {
1317713180 let n_attempts: u32 = std::env::var("EC_TX64X16_GATE32_ATTEMPTS")
1317813181 .ok()
1317913182 .and_then(|s| s.parse().ok())
13180- .unwrap_or(20);
13183+ .unwrap_or(8);
1318113184 for bit_depth in [8u32, 10u32] {
1318213185 let mut named_refusals = 0u32;
1318313186 let mut matched = 0u32;
@@ -13186,22 +13189,23 @@ mod tests {
1318613189 for attempt in 0..n_attempts {
1318713190 let seed = 42 + attempt;
1318813191 let duration = frame_count as f64 / 25.0;
13189- // Odd attempts render the SAME generator rotated 90 degrees,
13190- // the transposed-pair discipline the superblock-level 1:4
13191- // gate above documents.
13192- let source = if attempt % 2 == 0 {
13193- gradients_source(seed, width, height, &format!("duration={duration}:rate=25"))
13194- } else {
13195- format!(
13196- "{},transpose=1",
13197- gradients_source(
13198- seed,
13199- height,
13200- width,
13201- &format!("duration={duration}:rate=25")
13202- )
13203- )
13204- };
13192+ // 8-pixel bands: a 32x8 strip is flat, a 32x16 one is not, so
13193+ // aomenc's RD picks HORZ_4 (bands across Y) / VERT_4 (bands
13194+ // across X). Odd attempts are the transposed source -- the
13195+ // transposed-pair discipline the superblock-level 1:4 gate
13196+ // above documents, and the only way a transposed scan table is
13197+ // caught (class scan-weights-cross-axis). The noise layer is
13198+ // what keeps the flat bands out of screen-content mode; its
13199+ // seed is explicit, never lavfi's ignored default.
13200+ let axis = if attempt % 2 == 0 { "Y" } else { "X" };
13201+ let step = 67 + (attempt / 2) * 12;
13202+ let noise = 6 + (attempt % 4) * 3;
13203+ let source = format!(
13204+ "color=c=gray:s={width}x{height}:d={duration}:r=25,format=gray,\
13205+ geq=lum='mod(floor({axis}/8)*{step},256)',\
13206+ noise=alls={noise}:all_seed={seed},format=yuv420p"
13207+ );
13208+ let cq_level = format!("--cq-level={}", if attempt % 4 < 2 { 32 } else { 45 });
1320513209 let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" };
1320613210 let y4m = Command::new("ffmpeg")
1320713211 .args([
@@ -13224,7 +13228,7 @@ mod tests {
1322413228 "--codec=av1",
1322513229 "--passes=1",
1322613230 "--end-usage=q",
13227- "--cq-level=45",
13231+ &cq_level,
1322813232 "--cpu-used=0",
1322913233 "--threads=1",
1323013234 "--row-mt=0",
lanes/COMMON-20260901.mdadded+81 -0
@@ -0,0 +1,81 @@
1+# COMMON CHARTER PREAMBLE — batch 2026-09-01 (ec-av1 decode, his real films)
2+
3+GOAL (why): ec-av1 must decode the user's two real AV1 films bit-exact
4+(`/home/user/Videos/Films/reelc.mkv`,
5+`/home/user/Downloads/reelb.mkv`,
6+both yuv420p10le). 47 refusal strings remain in crates/ec-av1/src/refusal_inventory.rs.
7+Each lane lifts its cluster of refusals WITH a real-aomenc gate proving it.
8+
9+WORKING RULES (binding):
10+- Work ONLY in your worktree; branch named in your charter. Never touch main, never
11+ merge into main, never `git checkout <file>` to revert (copy to scratch first).
12+- `export CARGO_TARGET_DIR=$HOME/.cache/cargo-target-<lane>` (named in charter) for EVERY cargo
13+ command. sccache is the global rustc wrapper. Use `nice -n 10 cargo ... -j3` — 10 lanes
14+ run concurrently on 12 cores / 30G RAM. Long/lavfi runs under
15+ `systemd-run --user --scope -p MemoryMax=8G` and bound ffmpeg with `-t`.
16+- Test scope: `cargo test -p ec-av1 --lib` only (plus `cargo check -p ec-av1`). Never the
17+ workspace suite. Set `EC_AV1_REQUIRE_AOMENC=1` so an absent oracle FAILS, never SKIPs.
18+- Oracle: `~/.cache/aom-oracle/build/aomenc` and instrumented `aomdec` (scripts/build-aom-oracle.sh,
19+ scripts/instrument-aom-oracle.sh; rungs EC_TRACE=1 / EC_TRACE_COEFF=1 / EC_TRACE_MODE=1 /
20+ EC_AV1_PREFILT_DUMP). Ours: EC_TRACE_COEFF / EC_TRACE_MODE / EC_TRACE_MODE_STEP in decode.rs.
21+ Cross-decoder bisection compares msac RANGE element by element, never tell().
22+ The reference is at the oracle source tree (find via scripts/build-aom-oracle.sh).
23+- FIRST STEP, always: `git log --oneline -8 main` and rebase your branch onto main
24+ (`git rebase main`; resolve conflicts, keeping main's fixes). Then RE-MEASURE your lane's
25+ premise before building — charters may carry stale premises. Cite the command that
26+ produced every premise you act on.
27+- Fixtures: `fixtures` is a symlink to main's fixtures dir (shared). Pin any new stream
28+ fixture under crates/ec-av1/fixtures/ or fixtures/ with a hash; hash an aomenc output
29+ TWICE before trusting a seed (lavfi gradients ignores its seed).
30+- A refusal is lifted ONLY together with a gate: a real-aomenc stream (tool explicitly
31+ enabled on the aomenc command line) decoded pixel-exact vs ffmpeg/aomdec, that
32+ HARD-ASSERTS a hit counter proving the feature fired, and never turns a decode error or
33+ pixel mismatch into SKIP. Update refusal_inventory.rs + gate_coverage.rs in the same
34+ commit. `refusal_inventory` and `gate_coverage` tests must stay green.
35+- Defect classes to check first (memory-proven, each cost rounds): CDF row indexed by a
36+ field that moves; table indexed by RAW vs adjusted tx_size; scan/ctx tables transposed
37+ vs spec (libaom layout is not the spec's — gate on asymmetric behaviour); neighbour ctx
38+ read from one cell instead of gathered over the span; a symbol we read that the
39+ reference never wrote (reference range unchanged = unread); a header field parsed then
40+ never consumed; counter-reset list missing a table; call-site arg order; a probe loop
41+ reusing last run's output file (rm -f first, check exit status).
42+- Tool-call ceiling ~70. If you hit it: commit everything on your branch, write
43+ `lanes/<lane>-r<N>.handoff.md` with exact facts (ranges, stream, element) so a fresh
44+ agent continues without re-reading.
45+- DONE = commit(s) on your branch + `lanes/<lane>-r<N>.report.md` in your worktree with:
46+ what changed (path:line), gate name + command + result, refusals lifted, test totals
47+ (`cargo test -p ec-av1 --lib` passed/failed/ignored), and EVIDENCE lines of the form
48+ `EVIDENCE: <artifact> | <steps> | <measurement>`. State open residue with
49+ fix-now | deferred(<what unblocks>) | accepted. Never claim "done" beyond what you ran.
50+- Film check, when your lane targets a film blocker: extract 0.4s with
51+ `ffmpeg -t 0.4 -i <film> -c:v copy -f obu <out>.obu` (bounded), run
52+ `cargo run -p ec-av1 --example decode_probe -- <out>.obu` before and after; report
53+ the refusal string each film now stops at.
54+
55+VERIFIERS (added 2026-09-01 22:40 after a verifier left a lane worktree on a detached HEAD
56+while its builder was mid-round): a verifier NEVER runs `git checkout`, `git switch`,
57+`git stash` or any tree-changing git command inside a lane worktree. To test a specific
58+commit, `git worktree add --detach /tmp/claude-1000/.../scratchpad/verify-<lane> <sha>` with its
59+own CARGO_TARGET_DIR, and remove it when done.
60+
61+NEIGHBOUR MAPS (added 2026-09-02 00:50, class new-map-ignores-tile-edge): any per-mi side band
62+you add or inherit (mode, uv_mode, skip, ref, filter, txfm ctx, palette) MUST (1) guard
63+availability with `mi_r > tile_row0_mi` / `mi_c > tile_col0_mi`, never `> 0`; (2) be reset in
64+start_tile AND start_row; (3) have a `--tile-columns=1` arm in the lane's gate. Gate Err arms
65+tolerate ONLY messages containing "unsupported"; lavfi sources carry an explicit seed
66+(noise=all_seed=N) and the report shows two identical hashes.
67+
68+SIBLING GATES (added 2026-09-02 03:00, rectsplit r3): a root-cause fix that turns YOUR gate green
69+is not done until every gate that exercises the same tables/paths (grep the table name and the
70+function in stream.rs) is re-run — rectsplit r2 shipped a transposition that fixed its gate and
71+broke the merged SB HORZ/VERT gate at seed 43. Run the siblings before writing "root cause".
72+
73+FORMAT + LOGS (added 2026-09-02 03:30): never run a repo-wide `cargo fmt` in a lane (txselect
74+carried 5000 lines of churn that the merge had to strip; format only files you touched, or
75+not at all). Suite logs go to a PRIVATE path (`$CARGO_TARGET_DIR/../<lane>-suite.log`), never
76+a shared scratchpad name — another session overwrote a verifier's log mid-run.
77+
78+## AOMENC FLAG PRECEDENCE (measured 2026-09-02 08:45, md5 of 4 orderings)
79+aomenc keeps the LAST occurrence of a repeated `--enable-*` flag. Per-arm overrides go AFTER the
80+base recipe. Every gate proves its flag arrived through a decoder-side counter or a header field;
81+a counter at 0 means the flag did not arrive or the encoder declined — never weaken the assert.