forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-tiles': tile ROWS decode pixel-exact (bypass + decode_stream gates, edge and interior row boundaries, loop filter ON; rows>1 refusal lifted)

Browse files at this commit

e89401fbc7dd39fd32363c5053995f1e9b24a5b4Ahmet Kaan GümüşParent: 547a1faa8f1aed
Also closes context_update_tile_id != 0 with no code change: decode.rs already
read it generically at both tile loops, and stream.rs carried a stale comment
claiming a refusal that never existed anywhere in the crate. Proven live
instead of shipped forward -- aomenc picks 1/2/3 across the four-tile-row
gate's seed sweep, all pixel-exact, hard-asserted.

Suite 248 passed / 0 failed.
crates/ec-av1/src/refusal_inventory.rsmodified+0 -1
@@ -52,7 +52,6 @@ const REFUSALS: &[&str] = &[
52 "a frame naming primary_ref_frame at a reference slot with no saved CDF state",52 "a frame naming primary_ref_frame at a reference slot with no saved CDF state",
53 "a frame with delta_q_present or delta_lf_present set (this decoder never reads the per-superblock delta symbols)",53 "a frame with delta_q_present or delta_lf_present set (this decoder never reads the per-superblock delta symbols)",
54 "a frame with loop restoration enabled (this decoder never reads the per-unit lr symbols)",54 "a frame with loop restoration enabled (this decoder never reads the per-unit lr symbols)",
55- "a frame with more than one tile row (only tile columns are proven pixel-exact so far)",
56 "a frame with no mode-info grid",55 "a frame with no mode-info grid",
57 "a frame with segmentation enabled (this decoder never reads a per-block segment_id symbol)",56 "a frame with segmentation enabled (this decoder never reads a per-block segment_id symbol)",
58 "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding",57 "a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding",
crates/ec-av1/src/stream.rsmodified+524 -21
@@ -301,32 +301,34 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
301 // of `skip_mode_frame`, plain average blend), so the old blanket301 // of `skip_mode_frame`, plain average blend), so the old blanket
302 // `skip_mode_present` refusal is gone.302 // `skip_mode_present` refusal is gone.
303 // `context_update_tile_id` (spec `decode_tile`/`exit_symbol`) names303 // `context_update_tile_id` (spec `decode_tile`/`exit_symbol`) names
304- // which tile's end-of-tile adapted CDFs become the frame's own; this304+ // which tile's end-of-tile adapted CDFs become the frame's own.
305- // decoder still only ever *keeps* tile 0's adapted table (see the305+ // lane-tiles r8: this comment used to claim a `!= 0` refusal existed
306- // `context_update_tile_id != 0` refusal further down), so any frame306+ // "further down" -- it did not (`decode.rs` reads
307- // naming a different tile there is refused rather than silently307+ // `tile_info.context_update_tile_id` generically at both the
308- // forwarding the wrong tile's table.308+ // key-frame and inter-frame tile loops' `result_cdfs = cdfs` sites,
309+ // never hardcoded to tile 0); stale documentation, not a real gap.
310+ // `a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact`
311+ // hard-asserts a live aomenc stream naming tile 1/2/3 decodes
312+ // pixel-exact, so the capability is now proven as well as described
313+ // correctly.
309 //314 //
310- // lane-tiles r4/r6/r7: the multi-tile refusal itself is scoped, not315+ // lane-tiles r4/r6/r7/r8: the multi-tile refusal itself is scoped,
311- // blanket. `decode_key_frame_tile_with_cdfs` and (r6)316+ // not blanket. `decode_key_frame_tile_with_cdfs` and (r6)
312 // `decode_inter_frame_tile_with_cdfs` both genuinely loop every317 // `decode_inter_frame_tile_with_cdfs` both genuinely loop every
313 // tile, `mvstack.rs`'s `MiGrid` is bounded per tile318 // tile, `mvstack.rs`'s `MiGrid` is bounded per tile
314 // (`MiGrid::set_tile_bounds`), and `PlaneBuf`'s `tile_x0/y0/x1/y1`319 // (`MiGrid::set_tile_bounds`), and `PlaneBuf`'s `tile_x0/y0/x1/y1`
315 // origin receives real values at every call site (r6's320 // origin receives real values at every call site (r6's
316- // `set_tile_origin` sweep). r7 proved the two remaining named gaps321+ // `set_tile_origin` sweep). r7 proved the two remaining
317- // both closed: `a_real_aomenc_stream_with_two_tile_columns_and_an_322+ // tile-*column* gaps closed (inter frames, >2 columns with loop
318- // inter_frame_decodes_pixel_exact` (inter frame, 2 tile columns) and323+ // filtering on). r8 proved tile *rows* the same way: the per-tile
319- // `a_real_aomenc_stream_with_four_tile_columns_decodes_pixel_exact`324+ // loop's row math (`tile_num / tile_info.cols`,
320- // (>2 columns AND loop filtering ON, an interior tile boundary) --325+ // `mi_row_starts`/`set_tile_origin`'s `y0`/`y1`) is exactly
321- // 20/20 pixel-exact each. Only tile *rows* stay unproven and326+ // symmetric with the column path already proven, and
322- // refused; tile *columns* (any count) and loop filtering across327+ // `a_real_aomenc_stream_with_two_tile_rows_decodes_pixel_exact`
323- // them are no longer capped.328+ // (bypass gate, loop filter ON) confirmed it: 20/20 pixel-exact.
324- if header.tile_info.rows > 1 {329+ // `a_real_aomenc_stream_with_two_tile_rows_decodes_through_decode_
325- return Err(Error::unsupported(330+ // stream` below re-proves it through this entry point. Tile columns
326- "AV1 decode_stream",331+ // and tile rows (any count, loop filter on) are no longer capped.
327- "a frame with more than one tile row (only tile columns are proven pixel-exact so far)",
328- ));
329- }
330 // `Tile::offset` is relative to the buffer `parse_obu` was handed332 // `Tile::offset` is relative to the buffer `parse_obu` was handed
331 // (`&data[pos..]` at the time this OBU was parsed), so it is relative333 // (`&data[pos..]` at the time this OBU was parsed), so it is relative
332 // to `obu_offset`, not to `data` as a whole.334 // to `obu_offset`, not to `data` as a whole.
@@ -6221,6 +6223,340 @@ mod tests {
6221 );6223 );
6222 }6224 }
6223 6225
6226+ /// lane-tiles r8 stage 1: the same bypass-the-refusal pattern as the
6227+ /// two-tile-column gate above, this time for tile ROWS -- `decode_stream`
6228+ /// still refuses any `tile_info.rows > 1` stream, so this gate calls
6229+ /// [`decode_key_frame_tile_with_cdfs`] directly to prove the underlying
6230+ /// per-tile loop (already row/col-generic: `tile_num / tile_info.cols`
6231+ /// gives the row, `mi_row_starts`/`set_tile_origin`'s `y0`/`y1` are
6232+ /// exactly symmetric with the column gate's `x0`/`x1`) actually decodes
6233+ /// both tile rows pixel-exact before the refusal is lifted. 64x128 is
6234+ /// one 64px superblock wide and two tall with `--tile-rows=1`
6235+ /// (`TileRows=2`, `--tile-columns=0` keeps `cols=1` so only the row axis
6236+ /// is under test). Loop filter is left ON (no
6237+ /// `--loopfilter-control=0`) per the charter -- deblocking crosses tile
6238+ /// row boundaries by spec default exactly as it crosses column ones, and
6239+ /// `deblock_plane` runs once over the whole decoded picture after every
6240+ /// tile is in, with no tile-axis distinction, so there is no reason to
6241+ /// expect the row boundary to behave differently from the column one r7
6242+ /// already proved -- this gate is what actually proves it either way.
6243+ #[test]
6244+ fn a_real_aomenc_stream_with_two_tile_rows_decodes_pixel_exact() {
6245+ const NAME: &str = "a_real_aomenc_stream_with_two_tile_rows_decodes_pixel_exact";
6246+ if !have_ffmpeg() {
6247+ eprintln!("SKIP {NAME}: no ffmpeg");
6248+ return;
6249+ }
6250+ if !have_aomenc() {
6251+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
6252+ return;
6253+ }
6254+ let (width, height) = (64usize, 128usize);
6255+ let mut matched = 0u32;
6256+ let mut named_refusals = 0u32;
6257+ for attempt in 0..20u32 {
6258+ let seed = 42 + attempt;
6259+ let source = gradients_source(seed, width, height, "duration=0.04:rate=25");
6260+ let y4m = Command::new("ffmpeg")
6261+ .args([
6262+ "-v",
6263+ "error",
6264+ "-f",
6265+ "lavfi",
6266+ "-i",
6267+ &source,
6268+ "-pix_fmt",
6269+ "yuv420p",
6270+ "-f",
6271+ "yuv4mpegpipe",
6272+ "-",
6273+ ])
6274+ .stdin(Stdio::null())
6275+ .stdout(Stdio::piped())
6276+ .stderr(Stdio::piped())
6277+ .output()
6278+ .expect("ffmpeg failed to run");
6279+ assert!(
6280+ y4m.status.success(),
6281+ "ffmpeg fixture: {}",
6282+ String::from_utf8_lossy(&y4m.stderr)
6283+ );
6284+ let mut child = Command::new(aomenc_path())
6285+ .args([
6286+ "--codec=av1",
6287+ "--passes=1",
6288+ "--end-usage=q",
6289+ "--cq-level=45",
6290+ "--cpu-used=0",
6291+ "--limit=1",
6292+ "--kf-max-dist=1000",
6293+ "--threads=1",
6294+ "--row-mt=0",
6295+ "--tile-columns=0",
6296+ "--tile-rows=1",
6297+ // This decoder hardcodes SB_MI=16 (64px) superblocks
6298+ // everywhere; without this aomenc's own default 128x128
6299+ // superblock makes 64x128 exactly ONE superblock tall,
6300+ // so `--tile-rows=1` has nothing to split.
6301+ "--sb-size=64",
6302+ "--enable-rect-partitions=0",
6303+ "--enable-ab-partitions=0",
6304+ "--enable-1to4-partitions=0",
6305+ "--enable-filter-intra=0",
6306+ "--enable-smooth-intra=0",
6307+ "--enable-paeth-intra=0",
6308+ "--enable-directional-intra=0",
6309+ "--enable-angle-delta=0",
6310+ "--enable-tx-size-search=0",
6311+ "--enable-cdef=0",
6312+ "--enable-restoration=0",
6313+ "--max-partition-size=32",
6314+ "--min-partition-size=32",
6315+ "--enable-palette=0",
6316+ "--enable-intrabc=0",
6317+ "--enable-cfl-intra=0",
6318+ "--obu",
6319+ "-o",
6320+ "-",
6321+ "-",
6322+ ])
6323+ .stdin(Stdio::piped())
6324+ .stdout(Stdio::piped())
6325+ .stderr(Stdio::piped())
6326+ .spawn()
6327+ .expect("aomenc failed to start");
6328+ child
6329+ .stdin
6330+ .take()
6331+ .expect("aomenc stdin")
6332+ .write_all(&y4m.stdout)
6333+ .expect("writing y4m to aomenc");
6334+ let out = child.wait_with_output().expect("aomenc failed to run");
6335+ assert!(
6336+ out.status.success(),
6337+ "aomenc refused the fixture: {}",
6338+ String::from_utf8_lossy(&out.stderr)
6339+ );
6340+ let stream = out.stdout;
6341+
6342+ let mut parser = Av1Parser::new();
6343+ let mut pos = 0usize;
6344+ let mut frame = None;
6345+ while pos < stream.len() {
6346+ let obu_offset = pos;
6347+ let obu = parser.parse_obu(&stream[pos..]).unwrap();
6348+ pos += obu.total_size;
6349+ if let ObuKind::Frame(header, tiles) = obu.kind {
6350+ frame = Some((header, tiles, obu_offset));
6351+ break;
6352+ }
6353+ }
6354+ let (header, tiles, obu_offset) = frame.expect("stream has a Frame OBU");
6355+ assert!(
6356+ header.tile_info.rows > 1,
6357+ "{NAME}: aomenc did not actually split into >1 tile row (rows={}, seed {seed})",
6358+ header.tile_info.rows
6359+ );
6360+ assert_eq!(
6361+ tiles.len(),
6362+ header.tile_info.rows as usize,
6363+ "{NAME}: expected one tile per row (cols=1, seed {seed})"
6364+ );
6365+ let tile_bufs: Vec<&[u8]> = tiles
6366+ .iter()
6367+ .map(|t| &stream[obu_offset + t.offset..obu_offset + t.offset + t.size])
6368+ .collect();
6369+
6370+ let enable_filter_intra = parser
6371+ .sequence_header()
6372+ .is_some_and(|seq| seq.enable_filter_intra);
6373+ let enable_edge_filter = parser
6374+ .sequence_header()
6375+ .is_some_and(|seq| seq.enable_intra_edge_filter);
6376+
6377+ let before = crate::decode::tile_hits();
6378+ let picture = match decode_key_frame_tile_with_cdfs(
6379+ &tile_bufs,
6380+ &header.tile_info,
6381+ header.mi_cols,
6382+ header.mi_rows,
6383+ header.quantization.base_q_idx,
6384+ header.frame_width,
6385+ header.frame_height,
6386+ enable_filter_intra,
6387+ enable_edge_filter,
6388+ &header.cdef,
6389+ &header.loop_filter,
6390+ None,
6391+ header.tx_mode == TxMode::Select,
6392+ header.reduced_tx_set,
6393+ header.allow_screen_content_tools,
6394+ header.allow_intrabc,
6395+ ) {
6396+ Err(e) => {
6397+ let msg = e.to_string();
6398+ assert!(
6399+ msg.contains("unsupported"),
6400+ "{NAME} failed outright, not a named refusal (seed {seed}): {msg}"
6401+ );
6402+ named_refusals += 1;
6403+ eprintln!("seed {seed} refusal: {msg}");
6404+ continue;
6405+ }
6406+ Ok((picture, _end_cdfs)) => picture,
6407+ };
6408+ let hits = crate::decode::tile_hits() - before;
6409+ assert!(
6410+ hits > 1,
6411+ "{NAME}: tile_hits delta was {hits}, expected >1 -- both tile rows must actually \
6412+ decode, not just tile 0 (seed {seed})"
6413+ );
6414+
6415+ let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1);
6416+ assert_eq!(picture.y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg (seed {seed})");
6417+ assert_eq!(picture.u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg (seed {seed})");
6418+ assert_eq!(picture.v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg (seed {seed})");
6419+ matched += 1;
6420+ }
6421+ assert!(
6422+ matched > 0,
6423+ "{NAME}: every attempt refused ({named_refusals} refusals); the gate never decoded \
6424+ a two-tile-row stream"
6425+ );
6426+ eprintln!(
6427+ "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20"
6428+ );
6429+ }
6430+
6431+ /// lane-tiles r8 stage 2/3: the same two-tile-row stream as the bypass
6432+ /// gate above, this time through `decode_stream` itself -- the entry
6433+ /// point real callers use, with the `rows > 1` refusal lifted (same
6434+ /// commit) so this actually reaches the tile decode instead of
6435+ /// refusing by name. Loop filter ON, no `--loopfilter-control=0`.
6436+ #[test]
6437+ fn a_real_aomenc_stream_with_two_tile_rows_decodes_through_decode_stream() {
6438+ const NAME: &str = "a_real_aomenc_stream_with_two_tile_rows_decodes_through_decode_stream";
6439+ if !have_ffmpeg() {
6440+ eprintln!("SKIP {NAME}: no ffmpeg");
6441+ return;
6442+ }
6443+ if !have_aomenc() {
6444+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
6445+ return;
6446+ }
6447+ let (width, height) = (64usize, 128usize);
6448+ let mut matched = 0u32;
6449+ let mut named_refusals = 0u32;
6450+ for attempt in 0..20u32 {
6451+ let seed = 42 + attempt;
6452+ let source = gradients_source(seed, width, height, "duration=0.04:rate=25");
6453+ let y4m = Command::new("ffmpeg")
6454+ .args([
6455+ "-v", "error", "-f", "lavfi", "-i", &source, "-pix_fmt", "yuv420p", "-f",
6456+ "yuv4mpegpipe", "-",
6457+ ])
6458+ .stdin(Stdio::null())
6459+ .stdout(Stdio::piped())
6460+ .stderr(Stdio::piped())
6461+ .output()
6462+ .expect("ffmpeg failed to run");
6463+ assert!(
6464+ y4m.status.success(),
6465+ "ffmpeg fixture: {}",
6466+ String::from_utf8_lossy(&y4m.stderr)
6467+ );
6468+ let mut child = Command::new(aomenc_path())
6469+ .args([
6470+ "--codec=av1",
6471+ "--passes=1",
6472+ "--end-usage=q",
6473+ "--cq-level=45",
6474+ "--cpu-used=0",
6475+ "--limit=1",
6476+ "--kf-max-dist=1000",
6477+ "--threads=1",
6478+ "--row-mt=0",
6479+ "--tile-columns=0",
6480+ "--tile-rows=1",
6481+ "--sb-size=64",
6482+ "--enable-rect-partitions=0",
6483+ "--enable-ab-partitions=0",
6484+ "--enable-1to4-partitions=0",
6485+ "--enable-filter-intra=0",
6486+ "--enable-smooth-intra=0",
6487+ "--enable-paeth-intra=0",
6488+ "--enable-directional-intra=0",
6489+ "--enable-angle-delta=0",
6490+ "--enable-tx-size-search=0",
6491+ "--enable-cdef=0",
6492+ "--enable-restoration=0",
6493+ "--max-partition-size=32",
6494+ "--min-partition-size=32",
6495+ "--enable-palette=0",
6496+ "--enable-intrabc=0",
6497+ "--enable-cfl-intra=0",
6498+ "--obu",
6499+ "-o",
6500+ "-",
6501+ "-",
6502+ ])
6503+ .stdin(Stdio::piped())
6504+ .stdout(Stdio::piped())
6505+ .stderr(Stdio::piped())
6506+ .spawn()
6507+ .expect("aomenc failed to start");
6508+ child
6509+ .stdin
6510+ .take()
6511+ .expect("aomenc stdin")
6512+ .write_all(&y4m.stdout)
6513+ .expect("writing y4m to aomenc");
6514+ let out = child.wait_with_output().expect("aomenc failed to run");
6515+ assert!(
6516+ out.status.success(),
6517+ "aomenc refused the fixture: {}",
6518+ String::from_utf8_lossy(&out.stderr)
6519+ );
6520+ let stream = out.stdout;
6521+
6522+ let before = crate::decode::tile_hits();
6523+ let pictures = match decode_stream(&stream) {
6524+ Err(e) => {
6525+ let msg = e.to_string();
6526+ assert!(
6527+ msg.contains("unsupported"),
6528+ "{NAME} failed outright, not a named refusal (seed {seed}): {msg}"
6529+ );
6530+ named_refusals += 1;
6531+ eprintln!("seed {seed} refusal: {msg}");
6532+ continue;
6533+ }
6534+ Ok(pictures) => pictures,
6535+ };
6536+ let hits = crate::decode::tile_hits() - before;
6537+ assert!(
6538+ hits > 1,
6539+ "{NAME}: tile_hits delta was {hits}, expected >1 -- both tile rows must actually \
6540+ decode, not just tile 0 (seed {seed})"
6541+ );
6542+ assert_eq!(pictures.len(), 1, "{NAME}: expected exactly 1 picture (seed {seed})");
6543+
6544+ let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1);
6545+ assert_eq!(pictures[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg (seed {seed})");
6546+ assert_eq!(pictures[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg (seed {seed})");
6547+ assert_eq!(pictures[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg (seed {seed})");
6548+ matched += 1;
6549+ }
6550+ assert!(
6551+ matched > 0,
6552+ "{NAME}: every attempt refused ({named_refusals} refusals); decode_stream never \
6553+ decoded a two-tile-row stream"
6554+ );
6555+ eprintln!(
6556+ "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20"
6557+ );
6558+ }
6559+
6224 /// lane-tiles r7: the `>2 tile columns` refusal's own capability, proven6560 /// lane-tiles r7: the `>2 tile columns` refusal's own capability, proven
6225 /// separately from the 2-column gate above -- `--tile-columns=2` gives6561 /// separately from the 2-column gate above -- `--tile-columns=2` gives
6226 /// aomenc `TileCols=4` (log2), a real non-last-column right-edge case the6562 /// aomenc `TileCols=4` (log2), a real non-last-column right-edge case the
@@ -6405,6 +6741,173 @@ mod tests {
6405 );6741 );
6406 }6742 }
6407 6743
6744+ /// lane-tiles r8: the tile-*row* analogue of the four-tile-column gate
6745+ /// above -- `--tile-rows=2` gives aomenc `TileRows=4` (log2; uniform
6746+ /// tile spacing is always a power of two, so this is the smallest count
6747+ /// that has an interior row neither the top nor bottom frame edge,
6748+ /// mirroring why the column gate needed 4 columns rather than 3). 64x256
6749+ /// is four 64x64 superblocks tall with `--sb-size=64`, one per tile row.
6750+ /// Loop filter ON, run through `decode_stream` itself since the
6751+ /// `rows > 1` refusal is already lifted by this commit. Also settles a
6752+ /// stale documentation claim found while writing this gate: the old
6753+ /// comment above `decode_stream`'s multi-tile block said
6754+ /// `context_update_tile_id != 0` was refused "further down" -- no such
6755+ /// refusal exists (`decode.rs` reads `tile_info.context_update_tile_id`
6756+ /// generically, never hardcoded to tile 0), and this fixture's own
6757+ /// aomenc runs pick 1/2/3 as often as 0 (RD-driven tile-size heuristic),
6758+ /// all 20/20 pixel-exact -- so the capability was already there,
6759+ /// undocumented and unproven; hard-asserted here so the proof can't go
6760+ /// unnoticed if it stops firing.
6761+ #[test]
6762+ fn a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact() {
6763+ const NAME: &str = "a_real_aomenc_stream_with_four_tile_rows_decodes_pixel_exact";
6764+ if !have_ffmpeg() {
6765+ eprintln!("SKIP {NAME}: no ffmpeg");
6766+ return;
6767+ }
6768+ if !have_aomenc() {
6769+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
6770+ return;
6771+ }
6772+ let (width, height) = (64usize, 256usize);
6773+ let mut matched = 0u32;
6774+ let mut named_refusals = 0u32;
6775+ let mut saw_nonzero_context_update_tile_id = false;
6776+ for attempt in 0..20u32 {
6777+ let seed = 42 + attempt;
6778+ let source = gradients_source(seed, width, height, "duration=0.04:rate=25");
6779+ let y4m = Command::new("ffmpeg")
6780+ .args([
6781+ "-v", "error", "-f", "lavfi", "-i", &source, "-pix_fmt", "yuv420p", "-f",
6782+ "yuv4mpegpipe", "-",
6783+ ])
6784+ .stdin(Stdio::null())
6785+ .stdout(Stdio::piped())
6786+ .stderr(Stdio::piped())
6787+ .output()
6788+ .expect("ffmpeg failed to run");
6789+ assert!(
6790+ y4m.status.success(),
6791+ "ffmpeg fixture: {}",
6792+ String::from_utf8_lossy(&y4m.stderr)
6793+ );
6794+ let mut child = Command::new(aomenc_path())
6795+ .args([
6796+ "--codec=av1",
6797+ "--passes=1",
6798+ "--end-usage=q",
6799+ "--cq-level=45",
6800+ "--cpu-used=0",
6801+ "--limit=1",
6802+ "--kf-max-dist=1000",
6803+ "--threads=1",
6804+ "--row-mt=0",
6805+ "--tile-columns=0",
6806+ "--tile-rows=2",
6807+ "--sb-size=64",
6808+ "--enable-rect-partitions=0",
6809+ "--enable-ab-partitions=0",
6810+ "--enable-1to4-partitions=0",
6811+ "--enable-filter-intra=0",
6812+ "--enable-smooth-intra=0",
6813+ "--enable-paeth-intra=0",
6814+ "--enable-directional-intra=0",
6815+ "--enable-angle-delta=0",
6816+ "--enable-tx-size-search=0",
6817+ "--enable-cdef=0",
6818+ "--enable-restoration=0",
6819+ "--max-partition-size=32",
6820+ "--min-partition-size=32",
6821+ "--enable-palette=0",
6822+ "--enable-intrabc=0",
6823+ "--enable-cfl-intra=0",
6824+ "--obu",
6825+ "-o",
6826+ "-",
6827+ "-",
6828+ ])
6829+ .stdin(Stdio::piped())
6830+ .stdout(Stdio::piped())
6831+ .stderr(Stdio::piped())
6832+ .spawn()
6833+ .expect("aomenc failed to start");
6834+ child
6835+ .stdin
6836+ .take()
6837+ .expect("aomenc stdin")
6838+ .write_all(&y4m.stdout)
6839+ .expect("writing y4m to aomenc");
6840+ let out = child.wait_with_output().expect("aomenc failed to run");
6841+ assert!(
6842+ out.status.success(),
6843+ "aomenc refused the fixture: {}",
6844+ String::from_utf8_lossy(&out.stderr)
6845+ );
6846+ let stream = out.stdout;
6847+
6848+ let mut parser = Av1Parser::new();
6849+ let mut pos = 0usize;
6850+ let mut rows_seen = 0u32;
6851+ while pos < stream.len() {
6852+ let obu = parser.parse_obu(&stream[pos..]).unwrap();
6853+ pos += obu.total_size;
6854+ if let ObuKind::Frame(header, _) = &obu.kind {
6855+ rows_seen = header.tile_info.rows;
6856+ if header.tile_info.context_update_tile_id != 0 {
6857+ saw_nonzero_context_update_tile_id = true;
6858+ }
6859+ }
6860+ }
6861+ assert!(
6862+ rows_seen > 2,
6863+ "{NAME}: aomenc did not actually split into >2 tile rows (rows={rows_seen}, seed {seed})"
6864+ );
6865+
6866+ let before = crate::decode::tile_hits();
6867+ let pictures = match decode_stream(&stream) {
6868+ Err(e) => {
6869+ let msg = e.to_string();
6870+ assert!(
6871+ msg.contains("unsupported"),
6872+ "{NAME} failed outright, not a named refusal (seed {seed}): {msg}"
6873+ );
6874+ named_refusals += 1;
6875+ eprintln!("seed {seed} refusal: {msg}");
6876+ continue;
6877+ }
6878+ Ok(pictures) => pictures,
6879+ };
6880+ let hits = crate::decode::tile_hits() - before;
6881+ assert!(
6882+ hits > 2,
6883+ "{NAME}: tile_hits delta was {hits}, expected >2 -- all four tile rows must \
6884+ actually decode, not just a subset (seed {seed})"
6885+ );
6886+ assert_eq!(pictures.len(), 1, "{NAME}: expected exactly 1 picture (seed {seed})");
6887+
6888+ let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, 1);
6889+ assert_eq!(pictures[0].y, ffmpeg_frames[0].y, "{NAME}: luma vs ffmpeg (seed {seed})");
6890+ assert_eq!(pictures[0].u, ffmpeg_frames[0].u, "{NAME}: U vs ffmpeg (seed {seed})");
6891+ assert_eq!(pictures[0].v, ffmpeg_frames[0].v, "{NAME}: V vs ffmpeg (seed {seed})");
6892+ matched += 1;
6893+ }
6894+ assert!(
6895+ matched > 0,
6896+ "{NAME}: every attempt refused ({named_refusals} refusals); the gate never decoded \
6897+ a four-tile-row stream"
6898+ );
6899+ assert!(
6900+ saw_nonzero_context_update_tile_id,
6901+ "{NAME}: every attempt named context_update_tile_id=0 -- this sweep proves nothing \
6902+ about the != 0 case (see the stale-refusal note above `decode_stream`'s multi-tile \
6903+ comment: aomenc's own tile-size heuristic picks it, seen 1/2/3 live in a prior probe \
6904+ run of this exact fixture, so a 20-attempt window not seeing it is the gate's own bug)"
6905+ );
6906+ eprintln!(
6907+ "{NAME}: {matched} pixel-exact matches, {named_refusals} named refusals out of 20"
6908+ );
6909+ }
6910+
6408 /// lane-tiles r4/r7: the same real two-tile-column stream as the6911 /// lane-tiles r4/r7: the same real two-tile-column stream as the
6409 /// bypass gate above, this time run through `decode_stream` itself --6912 /// bypass gate above, this time run through `decode_stream` itself --
6410 /// the entry point real callers use. Proves the `cols > 1` refusal is6913 /// the entry point real callers use. Proves the `cols > 1` refusal is
lanes/tiles-r8.charter.mdadded+48 -0
@@ -0,0 +1,48 @@
1+# lane-tiles r8 — tile rows
2+
3+At 5255492. r7 is MERGED into main (93d9510); main is at 92d8beb or later.
4+Read `lanes/tiles-r7.report.md` first. Start with `git merge main` — main has
5+since landed a `bit_depth != 8` refusal, three reworded partition refusals and
6+a dead-binding cleanup in `decode_stream`; resolve, suite green, commit, and
7+only then start new work.
8+
9+## The round: tile ROWS
10+`tile_info.rows > 1` is still refused in `decode_stream`, correctly and with no
11+false claim attached. Close it the exact way r7 closed columns, in this order —
12+each step committed before the next begins:
13+
14+1. **Bypass gate first.** A gate that drives the tile decode directly, below
15+ `decode_stream`, so the refusal cannot short-circuit the code the gate is
16+ supposed to be measuring. That is class [[refusal-short-circuits-its-own-code]]
17+ and it cost this project a round already: lane-lr's report claimed symbols
18+ were read while its own counter said 0/40, because the refusal ran first.
19+2. **`decode_stream`-level gate**, pixel-exact vs ffmpeg, loop filter ON.
20+ Deblocking crosses tile ROW boundaries by spec default just as it crosses
21+ column ones — do not add a `--loopfilter-control=0` bypass, and if the
22+ horizontal boundary fails, that is the round's real finding.
23+3. **Then, and only then, lift the refusal**, and update
24+ `refusal_inventory.rs`'s pinned list in the same commit.
25+
26+Recipe: `--tile-rows=1` (→ TileRows=2) mirroring r7's `--tile-columns`, and a
27+fixture at least 128 px tall so two rows of 64px superblocks actually exist.
28+Verify from a header parse that aomenc really emitted TileRows=2 before
29+trusting any pixel match — r7 did this and it is why its numbers hold. Hard-
30+assert `tile_hits`: r7 found `decode_inter_frame_tile_with_cdfs` never
31+incremented `TILE_HITS`, so an assert there was vacuously blind. Check the
32+row path has the same increment before you rely on it.
33+
34+A branch that lifts a refusal without a gate does not merge to main.
35+
36+## If turns remain
37+`context_update_tile_id != 0`, several tile-group OBUs per frame, non-uniform
38+tile spacing — in that order. Each is a refusal today; each needs a gate before
39+a lift.
40+
41+Hard rules: `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-tiles`; foreground
42+`nice -n 19 cargo ... -j4`; every `cargo test` a timeout >= 600000 ms; fixtures
43+through `gradients_source(seed, w, h, tail)` and every ffmpeg generate bounded
44+with `-t`; `EC_AV1_REQUIRE_AOMENC=1`; aomenc `--threads=1 --row-mt=0
45+--sb-size=64` (this decoder hardcodes 64px superblocks). Sibling worktrees have
46+live agents — never build in or edit them. Never push, never merge into main.
47+75-turn cap, does not reset: COMMIT AT EVERY GREEN STEP. End with
48+`lanes/tiles-r8.report.md`, VERDICT on line 1.
lanes/tiles-r8.report.mdadded+43 -0
@@ -0,0 +1,43 @@
1+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.
2+
3+## Merge
4+`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.
5+
6+## Stage 1 -- bypass gate (tile rows, below decode_stream)
7+`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.
8+
9+Committed d6b4d51.
10+
11+## Stage 2/3 -- decode_stream gate + refusal lift (same commit)
12+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.
13+
14+Committed 491af97.
15+
16+## Extra: interior tile-row boundary (mirroring r7's four-column rigor)
17+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.
18+
19+Committed 8d73fc2.
20+
21+## Bonus finding: stale refusal-claim comment (context_update_tile_id)
22+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.
23+
24+Committed 013cb58.
25+
26+## If turns remain (unchanged from charter, genuinely open)
27+`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).
28+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.
29+
30+## Files changed
31+- `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
32+- `crates/ec-av1/src/refusal_inventory.rs` -- 1 pinned string removed (tile rows) to match the lifted refusal
33+
34+## Commits
35+- ef641d9 merge main into lane-tiles (r8 start)
36+- d6b4d51 test(av1): gate tile rows below decode_stream's refusal (bypass)
37+- 491af97 feat(av1): lift the tile-rows refusal, gated through decode_stream
38+- 8d73fc2 test(av1): interior tile-row boundary gate (four rows), mirroring r7's four-column gate
39+- 013cb58 docs+test(av1): drop the stale context_update_tile_id refusal claim, hard-assert it live
40+
41+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.
42+
43+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.