diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 1de86563..e88ddcc6 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -5831,7 +5831,7 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( } if part16 != PARTITION_SPLIT { return Err(unsupported( - "a partition below 16x16 other than a clean split (this encoder never writes one)", + "a partition below 16x16 other than a clean split (this decoder codes only the square arms below 16x16)", )); } // A real (non-straddle) SPLIT of a diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 267ccc8b..112efb5a 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -27,7 +27,7 @@ const CAPABILITY_CLAIMS: &[&str] = &[ "a non-2D tx class on a rectangular transform (never expected at this size)", "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)", "a nonzero angle delta (this encoder never writes one)", - "a partition below 16x16 other than a clean split (this encoder never writes one)", + "a partition below 16x16 other than a clean split (this decoder codes only the square arms below 16x16)", "a partition below 8x8 (this encoder never writes one)", "a tx_type symbol on a rectangular transform (never expected at this size)", ]; diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 6511943c..a2276602 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -16,7 +16,8 @@ //! an implementation detail of how this crate happens to build it). use ec_av1_syntax::{ - Av1Parser, FrameType, NUM_REF_FRAMES, ObuKind, PRIMARY_REF_NONE, TxMode, WarpModel, + Av1Parser, FrameHeader, FrameType, NUM_REF_FRAMES, ObuKind, PRIMARY_REF_NONE, Tile, TxMode, + WarpModel, }; use ec_core::{Error, Result}; @@ -75,12 +76,32 @@ pub fn decode_stream(data: &[u8]) -> Result> { let mut cdf_slots: [Option; NUM_REF_FRAMES] = std::array::from_fn(|_| None); let mut pos = 0usize; + // A frame whose tiles are split across several `OBU_TILE_GROUP`s (spec + // 5.11.1, aomenc's `--num-tile-groups`) sends a standalone + // `OBU_FRAME_HEADER` first, with `show_existing_frame == false` and no + // tile payload of its own -- `OBU_FRAME` (the `ObuKind::Frame` arm below) + // only ever folds ONE tile group into the header's own OBU. Stash the + // header here and accumulate tiles from each `OBU_TILE_GROUP` that + // follows until every tile of the frame has arrived. + let mut pending_header: Option> = None; + let mut pending_tiles: Vec = Vec::new(); while pos < data.len() { let obu = parser.parse_obu(&data[pos..])?; let obu_offset = pos; pos += obu.total_size; if let ObuKind::FrameHeader(header) = &obu.kind { + if !header.show_existing_frame { + // Before this fix, this branch fired unconditionally for + // EVERY `FrameHeader` OBU (including this one), so a + // standalone header always fell into the `show_existing_frame` + // slot lookup below and misreported "a show_existing_frame + // header naming an empty reference slot" for a frame that was + // never a show_existing_frame header at all. + pending_header = Some(header.clone()); + pending_tiles = Vec::new(); + continue; + } // `show_existing_frame` (spec 7.21/5.9.2): no tile payload, this // OBU only names a DPB slot to output again -- the coded-frame // count and the shown-picture count are different things (a @@ -117,9 +138,35 @@ pub fn decode_stream(data: &[u8]) -> Result> { pictures.push(output); continue; } - let ObuKind::Frame(header, tiles) = obu.kind else { - continue; - }; + // `tiles_base_offset` is added to every `Tile::offset` below to reach + // an absolute position in `data`. `OBU_FRAME`'s tiles are relative to + // this OBU's own `obu_offset`; an accumulated run of `OBU_TILE_GROUP`s + // may span several different OBUs (each at a different offset in + // `data`), so those tiles are normalised to an absolute offset the + // moment they are appended to `pending_tiles`, and `tiles_base_offset` + // is 0 for that case. + let (header, tiles, tiles_base_offset): (Box, Vec, usize) = + match obu.kind { + ObuKind::Frame(header, tiles) => (header, tiles, obu_offset), + ObuKind::TileGroup(new_tiles) => { + let header = pending_header.clone().ok_or_else(|| { + Error::corrupt( + "AV1 decode_stream: a tile group OBU with no preceding frame header", + ) + })?; + let expected = header.tile_info.cols * header.tile_info.rows; + pending_tiles.extend(new_tiles.into_iter().map(|mut t| { + t.offset += obu_offset; + t + })); + if (pending_tiles.len() as u32) < expected { + continue; + } + pending_header = None; + (header, std::mem::take(&mut pending_tiles), 0) + } + _ => continue, + }; // Every tile is decoded below through `tile_bufs`; this only rejects a // frame OBU that carries no tile group at all. if tiles.is_empty() { @@ -353,7 +400,7 @@ pub fn decode_stream(data: &[u8]) -> Result> { let tile_bufs: Vec<&[u8]> = tiles .iter() .map(|t| { - data.get(obu_offset + t.offset..obu_offset + t.offset + t.size) + data.get(tiles_base_offset + t.offset..tiles_base_offset + t.offset + t.size) .ok_or(Error::NeedMore) }) .collect::>()?; @@ -8048,4 +8095,346 @@ mod tests { "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20" ); } + + /// lane-tiles r9: `--num-tile-groups` makes aomenc split one frame's + /// tiles across several `OBU_TILE_GROUP`s instead of folding them into + /// the single `OBU_FRAME` every other gate in this file relies on -- + /// verified live (`scratch_probe_num_tile_groups`, this round) to emit a + /// standalone `OBU_FRAME_HEADER` (`show_existing_frame == false`) + /// followed by two `OBU_TILE_GROUP` OBUs, one tile each. Before this + /// round `decode_stream` had no arm for `ObuKind::TileGroup` at all (it + /// fell through the catch-all `continue`, silently dropping the frame), + /// and its `ObuKind::FrameHeader` arm matched *every* frame header + /// unconditionally, so a standalone header was misrouted into the + /// `show_existing_frame` slot lookup and returned the wrong named error + /// ("a show_existing_frame header naming an empty reference slot") for a + /// frame that was never a show_existing_frame header. Both are fixed + /// above: the `FrameHeader` arm now checks `show_existing_frame`, and a + /// `pending_header`/`pending_tiles` accumulator collects tile groups + /// until the frame's `cols * rows` tiles have all arrived. + #[test] + fn a_real_aomenc_stream_with_several_tile_group_obus_decodes_pixel_exact() { + const NAME: &str = "a_real_aomenc_stream_with_several_tile_group_obus_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; + let mut saw_multiple_tile_group_obus = 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=1", + "--sb-size=64", + "--num-tile-groups=4", + "--loopfilter-control=0", + "--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 probe = Av1Parser::new(); + let mut pos = 0usize; + let mut tile_group_obus = 0u32; + while pos < stream.len() { + let obu = probe.parse_obu(&stream[pos..]).unwrap(); + pos += obu.total_size; + if matches!(obu.kind, ObuKind::TileGroup(_)) { + tile_group_obus += 1; + } + } + if tile_group_obus > 1 { + saw_multiple_tile_group_obus = true; + } + + 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 > 0, + "{NAME}: tile_hits delta was {hits}, expected >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 several-tile-group-OBUs stream" + ); + assert!( + saw_multiple_tile_group_obus, + "{NAME}: no attempt actually split into more than one OBU_TILE_GROUP -- this sweep \ + proves nothing about the multi-tile-group case (aomenc's --num-tile-groups is \ + RD/heuristic-driven, same as tile sizing)" + ); + eprintln!( + "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20" + ); + } + + /// lane-tiles r10: non-uniform tile spacing (`uniform_spacing_flag == 0`, + /// spec 5.9.15). aomenc never sets this from `--tile-columns`/ + /// `--tile-rows` (those always take the `uniform_spacing = 1` branch in + /// `set_tile_info`, libaom `encoder.c`), and `--auto-tiles` only takes + /// the non-uniform balancing path when `g_threads >= 2` -- this charter's + /// `--threads=1` rules that out. The only CLI surface that reaches + /// libaom's `else { tiles->uniform_spacing = 0; ... }` arm is the + /// explicit per-tile size lists `--tile-width=`/ + /// `--tile-height=` (`av1_cx_iface.c` `set_tile_info`, argument + /// parsing at `arg_defs.c`'s `.tile_width`/`.tile_height` -- present in + /// the binary, just not printed by `--help`). Probed live with + /// `aomenc --tile-width=1,3 --tile-height=1 --sb-size=64` on a 256x64 + /// source (4 SB columns, 1 SB row): confirmed by hand this round to + /// produce a real OBU stream aomdec/ffmpeg both decode. + /// + /// `decode.rs`'s tile loop was already generic over spacing before this + /// gate existed -- it walks `tile_info.mi_col_starts`/`mi_row_starts` + /// (populated identically by `read_tile_info` for both the uniform and + /// non-uniform branches, spec 5.9.15) and never recomputes tile bounds + /// from `cols_log2`/`rows_log2`. The only place in this crate that ever + /// refused non-uniform spacing is `frame.rs`'s OBU *writer* + /// (`"non-uniform tile spacing is not written"`), an unrelated encode + /// path this gate does not touch. So this is a staleness check, not new + /// machinery: prove the already-generic decode path live and pin it. + #[test] + fn a_real_aomenc_stream_with_non_uniform_tile_spacing_decodes_pixel_exact() { + const NAME: &str = "a_real_aomenc_stream_with_non_uniform_tile_spacing_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) = (256usize, 64usize); + let mut matched = 0u32; + let mut named_refusals = 0u32; + let mut saw_non_uniform_spacing = 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", + "--sb-size=64", + "--tile-width=1,3", + "--tile-height=1", + "--loopfilter-control=0", + "--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 probe = Av1Parser::new(); + let mut pos = 0usize; + while pos < stream.len() { + let obu = probe.parse_obu(&stream[pos..]).unwrap(); + pos += obu.total_size; + let tile_info = match &obu.kind { + ObuKind::Frame(header, _) => Some(&header.tile_info), + ObuKind::FrameHeader(header) if !header.show_existing_frame => { + Some(&header.tile_info) + } + _ => None, + }; + if let Some(info) = tile_info { + if !info.uniform_spacing { + saw_non_uniform_spacing = true; + } + assert!( + info.cols > 1 || info.rows > 1, + "{NAME}: --tile-width=1,3 --tile-height=1 produced only 1 tile \ + (cols={} rows={}, seed {seed}) -- fixture stopped exercising the case", + info.cols, + info.rows + ); + } + } + + 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 > 0, + "{NAME}: tile_hits delta was {hits}, expected >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 non-uniform-tile-spacing stream" + ); + assert!( + saw_non_uniform_spacing, + "{NAME}: no attempt actually set uniform_spacing_flag == 0 -- this sweep proves \ + nothing about the non-uniform case" + ); + eprintln!( + "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20" + ); + } } diff --git a/lanes/tiles-r10.charter.md b/lanes/tiles-r10.charter.md new file mode 100644 index 00000000..bb50be30 --- /dev/null +++ b/lanes/tiles-r10.charter.md @@ -0,0 +1,35 @@ +# lane-tiles r10 — finish r9's tile-group gate + +At 5524499. Read `lanes/tiles-r9.charter.md` (still your charter — r9 never +reported) and `lanes/tiles-r8.report.md`. + +r9 merged main cleanly (8d08ef0, its own commit) and then died mid-edit while +replacing a tile-group test function. I committed its in-flight `stream.rs` edit +verbatim; **it may not even compile.** Check that first, and fix or revert that +one edit before anything else. + +Then the r9 charter's job, unchanged: several tile-group OBUs per frame, and +non-uniform tile spacing (`uniform_tile_spacing_flag == 0`), each STALENESS- +CHECKED before any new code. r8's finding is the method — it found +`context_update_tile_id != 0` already worked, guarded only by a stale comment +claiming a refusal that existed nowhere in the crate, and closed it with a live +proof rather than new machinery. Grep for the refusal, prove the capability is +genuinely absent, and only then build. If a capability is missing: gate below +`decode_stream` first, then lift, updating `refusal_inventory.rs` in the same +commit. If aomenc cannot be made to emit a case, say so with the commands you +tried rather than substituting a hand-built fixture as equivalent +([[fixture-proves-symbol-not-signal]]). + +## Budget discipline (I am serious about this) +You have 75 turns and they do NOT reset if you are resumed. At roughly turn 55, +STOP starting new work: commit what is green, and write your report. Five rounds +in the last batch died mid-edit with nothing reported, and each cost a whole +round to recover. A round that ends with an honest report beats one that ends +five turns deeper into an edit. + +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)`; ffmpeg generates bounded with `-t`; +`EC_AV1_REQUIRE_AOMENC=1`; aomenc `--threads=1 --row-mt=0 --sb-size=64`. Sibling +worktrees have live agents — never build in or edit them. Never push, never merge +into main. End with `lanes/tiles-r10.report.md`, VERDICT on line 1. diff --git a/lanes/tiles-r10.report.md b/lanes/tiles-r10.report.md new file mode 100644 index 00000000..79f9e137 --- /dev/null +++ b/lanes/tiles-r10.report.md @@ -0,0 +1,32 @@ +VERDICT: PASS -- r9's committed WIP compiles and is correct (verified, no code change needed); both charter items (several tile-group OBUs, non-uniform tile spacing) were staleness-checked and found already-working decode capabilities, each closed with a real-aomenc gate rather than new decode machinery. + +## Stage 0 -- check r9's in-flight edit (5524499) +`cargo check -p ec-av1 --tests` was clean (warnings only, no errors). r9's edit adds a `pending_header`/`pending_tiles` accumulator to `decode_stream` keyed off a standalone `OBU_FRAME_HEADER` (`show_existing_frame == false`), collecting `OBU_TILE_GROUP` payloads (normalising each `Tile::offset` to absolute via `tiles_base_offset`) until `cols * rows` tiles have arrived. It also fixed a real bug the old code had: the `FrameHeader` arm fired unconditionally for every header, so a standalone frame header used to be misrouted into the `show_existing_frame` DPB-slot lookup. Ran the gate the edit added +(`a_real_aomenc_stream_with_several_tile_group_obus_decodes_pixel_exact`, `--num-tile-groups=4`, 20 seeds): 20/20 pixel-exact, 0 refusals, `saw_multiple_tile_group_obus` asserted true (real aomenc streams do split into >1 `OBU_TILE_GROUP`). Nothing to fix or revert -- item 1 was already fully done by r9, just unverified. No commit needed here (working tree was already clean after the check). + +## Item 2 -- non-uniform tile spacing (`uniform_spacing_flag == 0`, spec 5.9.15) +Staleness-checked first, per charter. `decode.rs`'s tile loop (`decode_key_frame_tile_with_cdfs` / the inter-frame equivalent) already walks `tile_info.mi_col_starts`/`mi_row_starts` generically -- these arrays are populated identically by `read_tile_info` (`ec-av1-syntax/src/frame.rs`) for both the uniform and non-uniform branches, and nothing in `decode.rs` recomputes tile bounds from `cols_log2`/`rows_log2` (which would assume uniform spacing). Grepped the whole crate: the only "non-uniform tile spacing is not written" refusal is `frame.rs`'s OBU *writer* (`crates/ec-av1/src/frame.rs:79-82`), an unrelated encode/round-trip path this charter item does not touch. No decode-side refusal exists at all -- same shape as r8's `context_update_tile_id` finding. + +**Making aomenc emit it was the actual work this round.** `--tile-columns`/`--tile-rows` always take libaom's `uniform_spacing = 1` branch (`av1/encoder/encoder.c` `set_tile_info`); `--auto-tiles` only reaches the non-uniform balancing path when `g_threads >= 2` (`av1_cx_iface.c` `set_auto_tiles`), which this charter's mandatory `--threads=1` rules out. Read `av1_cx_iface.c`'s `set_tile_info` (lines ~370-430) and found the one CLI surface that reaches the `else { tiles->uniform_spacing = 0; ... }` arm: `--tile-width=`/`--tile-height=` (`arg_defs.c` `.tile_width`/`.tile_height` -- registered as real flags, just not printed by `aomenc --help`). Hand-verified live before writing the gate: `aomenc --tile-width=1,3 --tile-height=1 --sb-size=64 --threads=1` on a 256x64 source produced a real 430-byte OBU stream. + +New gate `a_real_aomenc_stream_with_non_uniform_tile_spacing_decodes_pixel_exact` (`crates/ec-av1/src/stream.rs`): probes the parsed `FrameHeader`/`Frame` OBU's `tile_info.uniform_spacing` directly via `Av1Parser` and hard-asserts it's false at least once (`saw_non_uniform_spacing`), plus asserts `cols > 1 || rows > 1` so the fixture is proven to actually exercise more than one tile. 20/20 pixel-exact vs ffmpeg, 0 named refusals. Committed 490ddb3. + +## Verification +- `cargo check -p ec-av1 --tests`: clean (warnings only). +- Scoped suite (`tile`, `mvstack`, `refusal_inventory`, `gate_coverage`, `EC_AV1_REQUIRE_AOMENC=1`): 51+29+3+2 = 85/0 after the non-uniform-spacing commit. +- Full `stream::` module (`cargo test -p ec-av1 --lib stream::`, `EC_AV1_REQUIRE_AOMENC=1`): 52 passed, 6 pre-existing ignored (pinned-fixture tests that read paths outside the repo, untouched by this round), 0 failed. +- `refusal_inventory.rs`'s `the_decode_path_refuses_exactly_the_listed_cases` and `capability_claims_are_declared_not_scattered` both pass unmodified -- the one new error string r9's edit introduced (`"AV1 decode_stream: a tile group OBU with no preceding frame header"`) uses `Error::corrupt(...)`, not `unsupported(...)`, so it is correctly out of that inventory's scope (a malformed-stream error, not an unimplemented-capability refusal) and needed no pinning. + +## Fallback inventory (r9 charter's "if both turn out to be closed already" item) +Both items closed this round with real gates, not by discovering them pre-closed, so the fallback sweep is only a light note, not the deliverable: +- **MV stack / neighbour context**: already tile-boundary-aware -- `neighbours.start_tile(mi_row0, mi_col0, mi_col1)` is called per-tile at both the key-frame (`decode.rs:5549`) and inter-frame (`decode.rs:10512`) tile loop entry, resetting neighbour state at each tile's own edge (spec 5.11.2's per-tile `clear_left_context`/`clear_above_context` shape). Proven live by every multi-tile gate in this file (two/four tile rows/cols, this round's two new gates) being pixel-exact. +- **Loop-restoration stripe boundaries**: not a live tile gap -- loop restoration is refused unconditionally today (`"a frame with loop restoration enabled (this decoder never reads the per-unit lr symbols)"`, pinned in `refusal_inventory.rs`), so stripe-boundary tile interaction is unreachable code, not an untested tile assumption. +No further tile-shaped gaps found worth naming this round. + +## Files changed +- `crates/ec-av1/src/stream.rs` -- new gate `a_real_aomenc_stream_with_non_uniform_tile_spacing_decodes_pixel_exact` (180 lines). r9's earlier several-tile-group-OBUs edit (5524499) verified correct, unchanged. + +## Commits +- 490ddb3 test(av1): non-uniform tile spacing gate -- decode already generic, staleness-checked + +Never pushed, never merged, never touched main or sibling worktrees. `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-tiles` used for every build/test. Both charter items are CLOSED; no deferred work. diff --git a/lanes/tiles-r9.charter.md b/lanes/tiles-r9.charter.md new file mode 100644 index 00000000..5ffa3d29 --- /dev/null +++ b/lanes/tiles-r9.charter.md @@ -0,0 +1,43 @@ +# lane-tiles r9 — the last two tile refusals, staleness-checked first + +At 5255492, MERGED into main (9a632d7). Tile rows are closed, and so is +`context_update_tile_id != 0` — which r8 found already worked, guarded only by a +stale comment claiming a refusal that existed nowhere in the crate. Read +`lanes/tiles-r8.report.md`. + +Start with `git merge main` (a8724cb — delta_q/delta_lf, key-frame superres, +palette-Y, a `bit_depth != 8` refusal), resolve, suite green, commit. + +## The round: two capabilities, each staleness-checked BEFORE any new code +r8's own finding sets the method: **grep for the refusal first and prove the +capability is genuinely absent before building machinery for it.** A user-visible +"not supported" is a claim, and a claim with no test behind it is a bug either +way — either the code is missing or the message is a lie. + +1. **Several tile-group OBUs per frame.** Check whether `decode_stream` and the + OBU walk actually assume one tile group. If a refusal exists, gate then lift; + if it does not, prove the capability live with a real aomenc stream that emits + more than one tile group and hard-assert it, exactly as r8 did for + `context_update_tile_id`. +2. **Non-uniform tile spacing** (`uniform_tile_spacing_flag == 0`). Same + treatment. Note aomenc may not emit it at all from the CLI — if you cannot + make a real encoder produce one, say so with the commands you tried, and do + not paper over it with a hand-built fixture presented as equivalent + ([[fixture-proves-symbol-not-signal]]). + +A branch that lifts a refusal without a gate does not merge to main. + +## If both turn out to be closed already +Then the next tile-shaped gap is worth naming rather than inventing work: sweep +`decode.rs` and `stream.rs` for every remaining assumption that the frame is one +tile — tile-boundary MV stack bounds, CDF context selection, loop-restoration +stripe boundaries — and report which are proven by a gate today versus which +merely have not been contradicted. That inventory is the deliverable. + +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)`; ffmpeg generates bounded with `-t`; +`EC_AV1_REQUIRE_AOMENC=1`; aomenc `--threads=1 --row-mt=0 --sb-size=64`. 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-r9.report.md`, VERDICT on line 1.