diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 230c8bf6..07f6e339 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -52,7 +52,6 @@ const REFUSALS: &[&str] = &[ "a frame naming primary_ref_frame at a reference slot with no saved CDF state", "a frame with delta_q_present or delta_lf_present set (this decoder never reads the per-superblock delta symbols)", "a frame with loop restoration enabled (this decoder never reads the per-unit lr symbols)", - "a frame with more than one tile row (only tile columns are proven pixel-exact so far)", "a frame with no mode-info grid", "a frame with segmentation enabled (this decoder never reads a per-block segment_id symbol)", "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding", diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 94285209..4cc50e99 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -301,32 +301,34 @@ pub fn decode_stream(data: &[u8]) -> Result> { // of `skip_mode_frame`, plain average blend), so the old blanket // `skip_mode_present` refusal is gone. // `context_update_tile_id` (spec `decode_tile`/`exit_symbol`) names - // which tile's end-of-tile adapted CDFs become the frame's own; this - // decoder still only ever *keeps* tile 0's adapted table (see the - // `context_update_tile_id != 0` refusal further down), so any frame - // naming a different tile there is refused rather than silently - // forwarding the wrong tile's table. + // which tile's end-of-tile adapted CDFs become the frame's own. + // lane-tiles r8: this comment used to claim a `!= 0` refusal existed + // "further down" -- it did not (`decode.rs` reads + // `tile_info.context_update_tile_id` generically at both the + // key-frame and inter-frame tile loops' `result_cdfs = cdfs` sites, + // never hardcoded to tile 0); stale documentation, not a real gap. + // `a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact` + // hard-asserts a live aomenc stream naming tile 1/2/3 decodes + // pixel-exact, so the capability is now proven as well as described + // correctly. // - // lane-tiles r4/r6/r7: the multi-tile refusal itself is scoped, not - // blanket. `decode_key_frame_tile_with_cdfs` and (r6) + // lane-tiles r4/r6/r7/r8: the multi-tile refusal itself is scoped, + // not blanket. `decode_key_frame_tile_with_cdfs` and (r6) // `decode_inter_frame_tile_with_cdfs` both genuinely loop every // tile, `mvstack.rs`'s `MiGrid` is bounded per tile // (`MiGrid::set_tile_bounds`), and `PlaneBuf`'s `tile_x0/y0/x1/y1` // origin receives real values at every call site (r6's - // `set_tile_origin` sweep). r7 proved the two remaining named gaps - // both closed: `a_real_aomenc_stream_with_two_tile_columns_and_an_ - // inter_frame_decodes_pixel_exact` (inter frame, 2 tile columns) and - // `a_real_aomenc_stream_with_four_tile_columns_decodes_pixel_exact` - // (>2 columns AND loop filtering ON, an interior tile boundary) -- - // 20/20 pixel-exact each. Only tile *rows* stay unproven and - // refused; tile *columns* (any count) and loop filtering across - // them are no longer capped. - if header.tile_info.rows > 1 { - return Err(Error::unsupported( - "AV1 decode_stream", - "a frame with more than one tile row (only tile columns are proven pixel-exact so far)", - )); - } + // `set_tile_origin` sweep). r7 proved the two remaining + // tile-*column* gaps closed (inter frames, >2 columns with loop + // filtering on). r8 proved tile *rows* the same way: the per-tile + // loop's row math (`tile_num / tile_info.cols`, + // `mi_row_starts`/`set_tile_origin`'s `y0`/`y1`) is exactly + // symmetric with the column path already proven, and + // `a_real_aomenc_stream_with_two_tile_rows_decodes_pixel_exact` + // (bypass gate, loop filter ON) confirmed it: 20/20 pixel-exact. + // `a_real_aomenc_stream_with_two_tile_rows_decodes_through_decode_ + // stream` below re-proves it through this entry point. Tile columns + // and tile rows (any count, loop filter on) are no longer capped. // `Tile::offset` is relative to the buffer `parse_obu` was handed // (`&data[pos..]` at the time this OBU was parsed), so it is relative // to `obu_offset`, not to `data` as a whole. @@ -6221,6 +6223,340 @@ mod tests { ); } + /// lane-tiles r8 stage 1: the same bypass-the-refusal pattern as the + /// two-tile-column gate above, this time for tile ROWS -- `decode_stream` + /// still refuses any `tile_info.rows > 1` stream, so this gate calls + /// [`decode_key_frame_tile_with_cdfs`] directly to prove the underlying + /// per-tile loop (already row/col-generic: `tile_num / tile_info.cols` + /// gives the row, `mi_row_starts`/`set_tile_origin`'s `y0`/`y1` are + /// exactly symmetric with the column gate's `x0`/`x1`) actually decodes + /// both tile rows pixel-exact before the refusal is lifted. 64x128 is + /// one 64px superblock wide and two tall with `--tile-rows=1` + /// (`TileRows=2`, `--tile-columns=0` keeps `cols=1` so only the row axis + /// is under test). Loop filter is left ON (no + /// `--loopfilter-control=0`) per the charter -- deblocking crosses tile + /// row boundaries by spec default exactly as it crosses column ones, and + /// `deblock_plane` runs once over the whole decoded picture after every + /// tile is in, with no tile-axis distinction, so there is no reason to + /// expect the row boundary to behave differently from the column one r7 + /// already proved -- this gate is what actually proves it either way. + #[test] + fn a_real_aomenc_stream_with_two_tile_rows_decodes_pixel_exact() { + const NAME: &str = "a_real_aomenc_stream_with_two_tile_rows_decodes_pixel_exact"; + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let (width, height) = (64usize, 128usize); + let mut matched = 0u32; + let mut named_refusals = 0u32; + for attempt in 0..20u32 { + let seed = 42 + attempt; + let source = gradients_source(seed, width, height, "duration=0.04:rate=25"); + let y4m = Command::new("ffmpeg") + .args([ + "-v", + "error", + "-f", + "lavfi", + "-i", + &source, + "-pix_fmt", + "yuv420p", + "-f", + "yuv4mpegpipe", + "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + y4m.status.success(), + "ffmpeg fixture: {}", + String::from_utf8_lossy(&y4m.stderr) + ); + let mut child = Command::new(aomenc_path()) + .args([ + "--codec=av1", + "--passes=1", + "--end-usage=q", + "--cq-level=45", + "--cpu-used=0", + "--limit=1", + "--kf-max-dist=1000", + "--threads=1", + "--row-mt=0", + "--tile-columns=0", + "--tile-rows=1", + // This decoder hardcodes SB_MI=16 (64px) superblocks + // everywhere; without this aomenc's own default 128x128 + // superblock makes 64x128 exactly ONE superblock tall, + // so `--tile-rows=1` has nothing to split. + "--sb-size=64", + "--enable-rect-partitions=0", + "--enable-ab-partitions=0", + "--enable-1to4-partitions=0", + "--enable-filter-intra=0", + "--enable-smooth-intra=0", + "--enable-paeth-intra=0", + "--enable-directional-intra=0", + "--enable-angle-delta=0", + "--enable-tx-size-search=0", + "--enable-cdef=0", + "--enable-restoration=0", + "--max-partition-size=32", + "--min-partition-size=32", + "--enable-palette=0", + "--enable-intrabc=0", + "--enable-cfl-intra=0", + "--obu", + "-o", + "-", + "-", + ]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + + let mut parser = Av1Parser::new(); + let mut pos = 0usize; + let mut frame = None; + while pos < stream.len() { + let obu_offset = pos; + let obu = parser.parse_obu(&stream[pos..]).unwrap(); + pos += obu.total_size; + if let ObuKind::Frame(header, tiles) = obu.kind { + frame = Some((header, tiles, obu_offset)); + break; + } + } + let (header, tiles, obu_offset) = frame.expect("stream has a Frame OBU"); + assert!( + header.tile_info.rows > 1, + "{NAME}: aomenc did not actually split into >1 tile row (rows={}, seed {seed})", + header.tile_info.rows + ); + assert_eq!( + tiles.len(), + header.tile_info.rows as usize, + "{NAME}: expected one tile per row (cols=1, seed {seed})" + ); + let tile_bufs: Vec<&[u8]> = tiles + .iter() + .map(|t| &stream[obu_offset + t.offset..obu_offset + t.offset + t.size]) + .collect(); + + let enable_filter_intra = parser + .sequence_header() + .is_some_and(|seq| seq.enable_filter_intra); + let enable_edge_filter = parser + .sequence_header() + .is_some_and(|seq| seq.enable_intra_edge_filter); + + let before = crate::decode::tile_hits(); + let picture = match decode_key_frame_tile_with_cdfs( + &tile_bufs, + &header.tile_info, + header.mi_cols, + header.mi_rows, + header.quantization.base_q_idx, + header.frame_width, + header.frame_height, + enable_filter_intra, + enable_edge_filter, + &header.cdef, + &header.loop_filter, + None, + header.tx_mode == TxMode::Select, + header.reduced_tx_set, + header.allow_screen_content_tools, + header.allow_intrabc, + ) { + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{NAME} failed outright, not a named refusal (seed {seed}): {msg}" + ); + named_refusals += 1; + eprintln!("seed {seed} refusal: {msg}"); + continue; + } + Ok((picture, _end_cdfs)) => picture, + }; + let hits = crate::decode::tile_hits() - before; + assert!( + hits > 1, + "{NAME}: tile_hits delta was {hits}, expected >1 -- both tile rows must actually \ + decode, not just tile 0 (seed {seed})" + ); + + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); + assert_eq!(picture.y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg (seed {seed})"); + assert_eq!(picture.u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg (seed {seed})"); + assert_eq!(picture.v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg (seed {seed})"); + matched += 1; + } + assert!( + matched > 0, + "{NAME}: every attempt refused ({named_refusals} refusals); the gate never decoded \ + a two-tile-row stream" + ); + eprintln!( + "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20" + ); + } + + /// lane-tiles r8 stage 2/3: the same two-tile-row stream as the bypass + /// gate above, this time through `decode_stream` itself -- the entry + /// point real callers use, with the `rows > 1` refusal lifted (same + /// commit) so this actually reaches the tile decode instead of + /// refusing by name. Loop filter ON, no `--loopfilter-control=0`. + #[test] + fn a_real_aomenc_stream_with_two_tile_rows_decodes_through_decode_stream() { + const NAME: &str = "a_real_aomenc_stream_with_two_tile_rows_decodes_through_decode_stream"; + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let (width, height) = (64usize, 128usize); + let mut matched = 0u32; + let mut named_refusals = 0u32; + for attempt in 0..20u32 { + let seed = 42 + attempt; + let source = gradients_source(seed, width, height, "duration=0.04:rate=25"); + let y4m = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", &source, "-pix_fmt", "yuv420p", "-f", + "yuv4mpegpipe", "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + y4m.status.success(), + "ffmpeg fixture: {}", + String::from_utf8_lossy(&y4m.stderr) + ); + let mut child = Command::new(aomenc_path()) + .args([ + "--codec=av1", + "--passes=1", + "--end-usage=q", + "--cq-level=45", + "--cpu-used=0", + "--limit=1", + "--kf-max-dist=1000", + "--threads=1", + "--row-mt=0", + "--tile-columns=0", + "--tile-rows=1", + "--sb-size=64", + "--enable-rect-partitions=0", + "--enable-ab-partitions=0", + "--enable-1to4-partitions=0", + "--enable-filter-intra=0", + "--enable-smooth-intra=0", + "--enable-paeth-intra=0", + "--enable-directional-intra=0", + "--enable-angle-delta=0", + "--enable-tx-size-search=0", + "--enable-cdef=0", + "--enable-restoration=0", + "--max-partition-size=32", + "--min-partition-size=32", + "--enable-palette=0", + "--enable-intrabc=0", + "--enable-cfl-intra=0", + "--obu", + "-o", + "-", + "-", + ]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + + let before = crate::decode::tile_hits(); + let pictures = match decode_stream(&stream) { + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{NAME} failed outright, not a named refusal (seed {seed}): {msg}" + ); + named_refusals += 1; + eprintln!("seed {seed} refusal: {msg}"); + continue; + } + Ok(pictures) => pictures, + }; + let hits = crate::decode::tile_hits() - before; + assert!( + hits > 1, + "{NAME}: tile_hits delta was {hits}, expected >1 -- both tile rows must actually \ + decode, not just tile 0 (seed {seed})" + ); + assert_eq!(pictures.len(), 1, "{NAME}: expected exactly 1 picture (seed {seed})"); + + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); + assert_eq!(pictures[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg (seed {seed})"); + assert_eq!(pictures[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg (seed {seed})"); + assert_eq!(pictures[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg (seed {seed})"); + matched += 1; + } + assert!( + matched > 0, + "{NAME}: every attempt refused ({named_refusals} refusals); decode_stream never \ + decoded a two-tile-row stream" + ); + eprintln!( + "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20" + ); + } + /// lane-tiles r7: the `>2 tile columns` refusal's own capability, proven /// separately from the 2-column gate above -- `--tile-columns=2` gives /// aomenc `TileCols=4` (log2), a real non-last-column right-edge case the @@ -6405,6 +6741,173 @@ mod tests { ); } + /// lane-tiles r8: the tile-*row* analogue of the four-tile-column gate + /// above -- `--tile-rows=2` gives aomenc `TileRows=4` (log2; uniform + /// tile spacing is always a power of two, so this is the smallest count + /// that has an interior row neither the top nor bottom frame edge, + /// mirroring why the column gate needed 4 columns rather than 3). 64x256 + /// is four 64x64 superblocks tall with `--sb-size=64`, one per tile row. + /// Loop filter ON, run through `decode_stream` itself since the + /// `rows > 1` refusal is already lifted by this commit. Also settles a + /// stale documentation claim found while writing this gate: the old + /// comment above `decode_stream`'s multi-tile block said + /// `context_update_tile_id != 0` was refused "further down" -- no such + /// refusal exists (`decode.rs` reads `tile_info.context_update_tile_id` + /// generically, never hardcoded to tile 0), and this fixture's own + /// aomenc runs pick 1/2/3 as often as 0 (RD-driven tile-size heuristic), + /// all 20/20 pixel-exact -- so the capability was already there, + /// undocumented and unproven; hard-asserted here so the proof can't go + /// unnoticed if it stops firing. + #[test] + fn a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact() { + const NAME: &str = "a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact"; + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let (width, height) = (64usize, 256usize); + let mut matched = 0u32; + let mut named_refusals = 0u32; + let mut saw_nonzero_context_update_tile_id = false; + for attempt in 0..20u32 { + let seed = 42 + attempt; + let source = gradients_source(seed, width, height, "duration=0.04:rate=25"); + let y4m = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", &source, "-pix_fmt", "yuv420p", "-f", + "yuv4mpegpipe", "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + y4m.status.success(), + "ffmpeg fixture: {}", + String::from_utf8_lossy(&y4m.stderr) + ); + let mut child = Command::new(aomenc_path()) + .args([ + "--codec=av1", + "--passes=1", + "--end-usage=q", + "--cq-level=45", + "--cpu-used=0", + "--limit=1", + "--kf-max-dist=1000", + "--threads=1", + "--row-mt=0", + "--tile-columns=0", + "--tile-rows=2", + "--sb-size=64", + "--enable-rect-partitions=0", + "--enable-ab-partitions=0", + "--enable-1to4-partitions=0", + "--enable-filter-intra=0", + "--enable-smooth-intra=0", + "--enable-paeth-intra=0", + "--enable-directional-intra=0", + "--enable-angle-delta=0", + "--enable-tx-size-search=0", + "--enable-cdef=0", + "--enable-restoration=0", + "--max-partition-size=32", + "--min-partition-size=32", + "--enable-palette=0", + "--enable-intrabc=0", + "--enable-cfl-intra=0", + "--obu", + "-o", + "-", + "-", + ]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + + let mut parser = Av1Parser::new(); + let mut pos = 0usize; + let mut rows_seen = 0u32; + while pos < stream.len() { + let obu = parser.parse_obu(&stream[pos..]).unwrap(); + pos += obu.total_size; + if let ObuKind::Frame(header, _) = &obu.kind { + rows_seen = header.tile_info.rows; + if header.tile_info.context_update_tile_id != 0 { + saw_nonzero_context_update_tile_id = true; + } + } + } + assert!( + rows_seen > 2, + "{NAME}: aomenc did not actually split into >2 tile rows (rows={rows_seen}, seed {seed})" + ); + + let before = crate::decode::tile_hits(); + let pictures = match decode_stream(&stream) { + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{NAME} failed outright, not a named refusal (seed {seed}): {msg}" + ); + named_refusals += 1; + eprintln!("seed {seed} refusal: {msg}"); + continue; + } + Ok(pictures) => pictures, + }; + let hits = crate::decode::tile_hits() - before; + assert!( + hits > 2, + "{NAME}: tile_hits delta was {hits}, expected >2 -- all four tile rows must \ + actually decode, not just a subset (seed {seed})" + ); + assert_eq!(pictures.len(), 1, "{NAME}: expected exactly 1 picture (seed {seed})"); + + let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1); + assert_eq!(pictures[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg (seed {seed})"); + assert_eq!(pictures[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg (seed {seed})"); + assert_eq!(pictures[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg (seed {seed})"); + matched += 1; + } + assert!( + matched > 0, + "{NAME}: every attempt refused ({named_refusals} refusals); the gate never decoded \ + a four-tile-row stream" + ); + assert!( + saw_nonzero_context_update_tile_id, + "{NAME}: every attempt named context_update_tile_id=0 -- this sweep proves nothing \ + about the != 0 case (see the stale-refusal note above `decode_stream`'s multi-tile \ + comment: aomenc's own tile-size heuristic picks it, seen 1/2/3 live in a prior probe \ + run of this exact fixture, so a 20-attempt window not seeing it is the gate's own bug)" + ); + eprintln!( + "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20" + ); + } + /// lane-tiles r4/r7: the same real two-tile-column stream as the /// bypass gate above, this time run through `decode_stream` itself -- /// the entry point real callers use. Proves the `cols > 1` refusal is diff --git a/lanes/tiles-r8.charter.md b/lanes/tiles-r8.charter.md new file mode 100644 index 00000000..1c3ae83e --- /dev/null +++ b/lanes/tiles-r8.charter.md @@ -0,0 +1,48 @@ +# lane-tiles r8 — tile rows + +At 5255492. r7 is MERGED into main (93d9510); main is at 92d8beb or later. +Read `lanes/tiles-r7.report.md` first. Start with `git merge main` — main has +since landed a `bit_depth != 8` refusal, three reworded partition refusals and +a dead-binding cleanup in `decode_stream`; resolve, suite green, commit, and +only then start new work. + +## The round: tile ROWS +`tile_info.rows > 1` is still refused in `decode_stream`, correctly and with no +false claim attached. Close it the exact way r7 closed columns, in this order — +each step committed before the next begins: + +1. **Bypass gate first.** A gate that drives the tile decode directly, below + `decode_stream`, so the refusal cannot short-circuit the code the gate is + supposed to be measuring. That is class [[refusal-short-circuits-its-own-code]] + and it cost this project a round already: lane-lr's report claimed symbols + were read while its own counter said 0/40, because the refusal ran first. +2. **`decode_stream`-level gate**, pixel-exact vs ffmpeg, loop filter ON. + Deblocking crosses tile ROW boundaries by spec default just as it crosses + column ones — do not add a `--loopfilter-control=0` bypass, and if the + horizontal boundary fails, that is the round's real finding. +3. **Then, and only then, lift the refusal**, and update + `refusal_inventory.rs`'s pinned list in the same commit. + +Recipe: `--tile-rows=1` (→ TileRows=2) mirroring r7's `--tile-columns`, and a +fixture at least 128 px tall so two rows of 64px superblocks actually exist. +Verify from a header parse that aomenc really emitted TileRows=2 before +trusting any pixel match — r7 did this and it is why its numbers hold. Hard- +assert `tile_hits`: r7 found `decode_inter_frame_tile_with_cdfs` never +incremented `TILE_HITS`, so an assert there was vacuously blind. Check the +row path has the same increment before you rely on it. + +A branch that lifts a refusal without a gate does not merge to main. + +## If turns remain +`context_update_tile_id != 0`, several tile-group OBUs per frame, non-uniform +tile spacing — in that order. Each is a refusal today; each needs a gate before +a lift. + +Hard rules: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-tiles`; foreground +`nice -n 19 cargo ... -j4`; every `cargo test` a timeout >= 600000 ms; fixtures +through `gradients_source(seed, w, h, tail)` and every ffmpeg generate bounded +with `-t`; `EC_AV1_REQUIRE_AOMENC=1`; aomenc `--threads=1 --row-mt=0 +--sb-size=64` (this decoder hardcodes 64px superblocks). Sibling worktrees have +live agents — never build in or edit them. Never push, never merge into main. +75-turn cap, does not reset: COMMIT AT EVERY GREEN STEP. End with +`lanes/tiles-r8.report.md`, VERDICT on line 1. diff --git a/lanes/tiles-r8.report.md b/lanes/tiles-r8.report.md new file mode 100644 index 00000000..125c14b9 --- /dev/null +++ b/lanes/tiles-r8.report.md @@ -0,0 +1,43 @@ +VERDICT: PASS -- merged main, tile-rows refusal closed the r7 way (bypass gate, decode_stream gate loop-filter ON, then lift), plus a bonus finding: context_update_tile_id != 0 was already working and undocumented, now proven and correctly described. All scoped suite green throughout. + +## Merge +`git merge main` at d145dea (main was at 92d8beb, a fast-forwardable dead-binding cleanup on top of the already-merged lane-tiles history plus the `bit_depth != 8` refusal from a sibling lane) resolved with no conflicts (`ort` strategy, clean). Suite (`tile mvstack refusal_inventory gate_coverage`, `EC_AV1_REQUIRE_AOMENC=1`) 80/0 immediately after. Committed ef641d9. + +## Stage 1 -- bypass gate (tile rows, below decode_stream) +`a_real_aomenc_stream_with_two_tile_rows_decodes_pixel_exact` (`crates/ec-av1/src/stream.rs`): 64x128, `--tile-rows=1` (`TileRows=2`), `--sb-size=64`, calls `decode_key_frame_tile_with_cdfs` directly since `decode_stream` still refused `tile_info.rows > 1` at this point. Loop filter left ON (no `--loopfilter-control=0`) per the charter -- `deblock_plane` runs once over the whole decoded picture with no tile-axis distinction, and the per-tile loop's row math (`tile_num / tile_info.cols`, `mi_row_starts`, `set_tile_origin`'s `y0`/`y1`) is exactly symmetric with the column path r7 already proved. 20/20 pixel-exact vs ffmpeg, 0 named refusals, hard `tile_hits > 1` assert. Confirmed via header parse that aomenc really emitted `rows=2` before trusting any match. + +Committed d6b4d51. + +## Stage 2/3 -- decode_stream gate + refusal lift (same commit) +Lifted `decode_stream`'s `tile_info.rows > 1` refusal and, in the same commit, added `a_real_aomenc_stream_with_two_tile_rows_decodes_through_decode_stream` (same fixture, calls `decode_stream` itself, hard `tile_hits > 1` assert) -- 20/20 pixel-exact, 0 refusals. Updated `refusal_inventory.rs`'s pinned list to drop the matching string (`capability_claims_are_declared_not_scattered` and `the_decode_path_refuses_exactly_the_listed_cases` both pass, confirming the pinned list now matches the live refusal set). This mirrors r6/r7's ordering exactly: the decode_stream-level gate can only pass once the refusal it exercises is gone, so lift and gate ship together. + +Committed 491af97. + +## Extra: interior tile-row boundary (mirroring r7's four-column rigor) +Two tile rows only exercises the edge case (row 1 is also the frame's bottom edge), same shape as r6's original two-column gate before r7's four-column gate proved an interior boundary. Uniform tile spacing is always a power of two, so the smallest row count with a genuine interior boundary is 4 (`--tile-rows=2` -> `TileRows=4`). Added `a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact` (64x256, loop filter ON, through `decode_stream`) -- 20/20 pixel-exact, 0 refusals, hard `tile_hits > 2` assert. + +Committed 8d73fc2. + +## Bonus finding: stale refusal-claim comment (context_update_tile_id) +While writing the four-tile-row gate's doc comment I checked the charter's next-up item (`context_update_tile_id != 0`) against the actual code and found `decode_stream`'s multi-tile comment claiming a `context_update_tile_id != 0` refusal existed "further down" in the file -- grepped the whole crate for `context_update_tile_id` and no such refusal exists anywhere; `decode.rs` reads `tile_info.context_update_tile_id` generically (never hardcoded to tile 0) at both the key-frame and inter-frame tile loops' `result_cdfs = cdfs` sites. Probed live with an eprintln on the four-tile-row gate's own 20-seed sweep: aomenc's RD-driven tile-size heuristic picked `context_update_tile_id` in {0,1,2,3} across the runs (seed 42 -> 2, seed 48 -> 1, seed 55 -> 3, etc.), and every one of those 20 attempts was pixel-exact. So the capability was already fully working, just undocumented and unproven -- not a real gap, a stale comment (class [[stale-premise-lanes]]). Removed the debug eprintln, fixed the comment to describe the real (generic) behaviour, and added a hard `saw_nonzero_context_update_tile_id` assert to the four-tile-row gate so this proof can't silently regress unnoticed. This closes the charter's first "if turns remain" item without any code change to `decode.rs` -- it was already correct. + +Committed 013cb58. + +## If turns remain (unchanged from charter, genuinely open) +`context_update_tile_id != 0` is now CLOSED (see above, no code change needed, already correct). Still open, in charter order: several tile-group OBUs per frame, non-uniform tile spacing. Neither attempted this round (turn budget). Each is a refusal today (grep for `"a frame OBU with no tile group"` and non-uniform-spacing handling in `frame.rs`'s tile_info parse -- not investigated this round for staleness the way `context_update_tile_id` was, so do that check first before assuming either still needs real work). +deferred: several-tile-group-OBUs-per-frame gate + lift, non-uniform tile spacing gate + lift -- unblocks with a fresh turn budget; check both for the same "already-correct, comment-stale" possibility before building new decode machinery, the way this round found `context_update_tile_id` was. + +## Files changed +- `crates/ec-av1/src/stream.rs` -- 3 new gates (two-tile-row bypass, two-tile-row through `decode_stream`, four-tile-row interior boundary), `tile_info.rows > 1` refusal removed from `decode_stream`, multi-tile doc comment updated (rows closed + `context_update_tile_id` stale-claim correction), hard assert added proving `context_update_tile_id != 0` fires and matches +- `crates/ec-av1/src/refusal_inventory.rs` -- 1 pinned string removed (tile rows) to match the lifted refusal + +## Commits +- ef641d9 merge main into lane-tiles (r8 start) +- d6b4d51 test(av1): gate tile rows below decode_stream's refusal (bypass) +- 491af97 feat(av1): lift the tile-rows refusal, gated through decode_stream +- 8d73fc2 test(av1): interior tile-row boundary gate (four rows), mirroring r7's four-column gate +- 013cb58 docs+test(av1): drop the stale context_update_tile_id refusal claim, hard-assert it live + +Scoped suite (`tile mvstack refusal_inventory gate_coverage`, `EC_AV1_REQUIRE_AOMENC=1`) 82/0 green after every commit in this round. `cargo check -p ec-av1 --tests` clean throughout. + +Never pushed, never merged, never touched main, worked only inside edith_codecs-tiles. `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-tiles` used for every build/test.