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