Merge branch 'lane-tiles': multi-tile gates prove their overrides arrived; palette-Y blocks read no use_filter_intra symbol; per-tile palette band reset
Browse files at this commit6 changed files +723 -3
- crates/ec-av1/examples/decode_probe.rs +36 -0
- crates/ec-av1/src/decode.rs +42 -2
- crates/ec-av1/src/gate_coverage.rs +16 -1
- crates/ec-av1/src/stream.rs +391 -0
- lanes/tiles-r11.report.md +132 -0
- lanes/tiles-r12.report.md +106 -0
crates/ec-av1/examples/decode_probe.rsmodified+36 -0
| @@ -32,6 +32,42 @@ fn main() { | |||
| 32 | let (h, v, c) = ec_av1::stream::rect4_32_counters(); | 32 | let (h, v, c) = ec_av1::stream::rect4_32_counters(); |
| 33 | println!("rect4_32: horz={h} vert={v} coded={c}"); | 33 | println!("rect4_32: horz={h} vert={v} coded={c}"); |
| 34 | }; | 34 | }; |
| 35 | + // lane-tiles: the tiling a real stream actually uses is a decision input | ||
| 36 | + // (every gate in `stream.rs` picks its own `--tile-columns`), so report it | ||
| 37 | + // from the frame headers before saying anything about pixels. | ||
| 38 | + let mut parser = ec_av1_syntax::Av1Parser::new(); | ||
| 39 | + let mut seen: Vec<(u32, u32, bool, u32)> = Vec::new(); | ||
| 40 | + let mut pos = 0usize; | ||
| 41 | + let mut frames_seen = 0usize; | ||
| 42 | + // OBU at a time, so one unparseable OBU late in the stream still leaves | ||
| 43 | + // every earlier frame header's tiling reported. | ||
| 44 | + while pos < data.len() { | ||
| 45 | + let Ok(obu) = parser.parse_obu(&data[pos..]) else { | ||
| 46 | + break; | ||
| 47 | + }; | ||
| 48 | + pos += obu.total_size.max(1); | ||
| 49 | + let header = match &obu.kind { | ||
| 50 | + ec_av1_syntax::ObuKind::FrameHeader(h) => h, | ||
| 51 | + ec_av1_syntax::ObuKind::Frame(h, _) => h, | ||
| 52 | + _ => continue, | ||
| 53 | + }; | ||
| 54 | + frames_seen += 1; | ||
| 55 | + let t = &header.tile_info; | ||
| 56 | + let entry = (t.cols, t.rows, t.uniform_spacing, t.context_update_tile_id); | ||
| 57 | + if !seen.contains(&entry) { | ||
| 58 | + seen.push(entry); | ||
| 59 | + } | ||
| 60 | + } | ||
| 61 | + println!("TILING: {frames_seen} frame headers parsed"); | ||
| 62 | + for (cols, rows, uniform, ctx_id) in &seen { | ||
| 63 | + println!( | ||
| 64 | + "TILING: cols={cols} rows={rows} uniform_spacing={uniform} context_update_tile_id={ctx_id}" | ||
| 65 | + ); | ||
| 66 | + } | ||
| 67 | + if seen.is_empty() { | ||
| 68 | + println!("TILING: no frame header parsed"); | ||
| 69 | + } | ||
| 70 | + | ||
| 35 | match ec_av1::stream::decode_stream(&data) { | 71 | match ec_av1::stream::decode_stream(&data) { |
| 36 | Ok(frames) if frames.is_empty() => { | 72 | Ok(frames) if frames.is_empty() => { |
| 37 | println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?"); | 73 | println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?"); |
crates/ec-av1/src/decode.rsmodified+42 -2
| @@ -1046,6 +1046,19 @@ pub(crate) fn palette_hits() -> usize { | |||
| 1046 | PALETTE_HITS.with(|c| c.get()) | 1046 | PALETTE_HITS.with(|c| c.get()) |
| 1047 | } | 1047 | } |
| 1048 | 1048 | ||
| 1049 | +// lane-tiles r12: of those, how many sat at their own TILE's left column -- | ||
| 1050 | +// exactly the blocks whose palette cache/ctx must NOT see the previous tile's | ||
| 1051 | +// colours (`av1_get_palette_cache`'s `xd->left_mbmi == NULL`). A multi-tile | ||
| 1052 | +// palette gate that never hits one proves nothing about the tile guard. | ||
| 1053 | +thread_local! { | ||
| 1054 | + static PALETTE_TILE_LEFT_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | ||
| 1055 | +} | ||
| 1056 | + | ||
| 1057 | +/// Current value of [`PALETTE_TILE_LEFT_HITS`]. | ||
| 1058 | +pub(crate) fn palette_tile_left_hits() -> usize { | ||
| 1059 | + PALETTE_TILE_LEFT_HITS.with(|c| c.get()) | ||
| 1060 | +} | ||
| 1061 | + | ||
| 1049 | // lane-palette2 r1: as [`PALETTE_HITS`], for a real (nonzero-size) chroma | 1062 | // lane-palette2 r1: as [`PALETTE_HITS`], for a real (nonzero-size) chroma |
| 1050 | // palette use -- proves a stream actually reconstructed UV palette pixels, | 1063 | // palette use -- proves a stream actually reconstructed UV palette pixels, |
| 1051 | // not just read and refused the `palette_uv_mode` symbol. | 1064 | // not just read and refused the `palette_uv_mode` symbol. |
| @@ -3279,7 +3292,13 @@ impl Neighbours { | |||
| 3279 | } else { | 3292 | } else { |
| 3280 | (0, [0u16; 8]) | 3293 | (0, [0u16; 8]) |
| 3281 | }; | 3294 | }; |
| 3282 | - let (left_n, left_colors) = if self.left_palette_size[r] > 0 { | 3295 | + // lane-tiles r11: `av1_get_palette_cache` takes `xd->left_mbmi`, which |
| 3296 | + // is NULL whenever the block sits at its TILE's own left column | ||
| 3297 | + // (`left_available`), not the frame's -- without this guard a second | ||
| 3298 | + // tile column reads the previous tile's palette colours into its cache | ||
| 3299 | + // and its `palette_y_mode` ctx. | ||
| 3300 | + let left_ok = c > self.tile_col0_mi / (SUB / MI); | ||
| 3301 | + let (left_n, left_colors) = if left_ok && self.left_palette_size[r] > 0 { | ||
| 3283 | (self.left_palette_size[r], self.left_palette_colors[r]) | 3302 | (self.left_palette_size[r], self.left_palette_colors[r]) |
| 3284 | } else { | 3303 | } else { |
| 3285 | (0, [0u16; 8]) | 3304 | (0, [0u16; 8]) |
| @@ -3344,7 +3363,9 @@ impl Neighbours { | |||
| 3344 | } else { | 3363 | } else { |
| 3345 | (0, [0u16; 8]) | 3364 | (0, [0u16; 8]) |
| 3346 | }; | 3365 | }; |
| 3347 | - let (left_n, left_colors) = if self.left_palette_uv_size[r] > 0 { | 3366 | + // Same tile-relative left availability as the luma cache above. |
| 3367 | + let left_ok = c > self.tile_col0_mi / (SUB / MI); | ||
| 3368 | + let (left_n, left_colors) = if left_ok && self.left_palette_uv_size[r] > 0 { | ||
| 3348 | (self.left_palette_uv_size[r], self.left_palette_uv_colors[r]) | 3369 | (self.left_palette_uv_size[r], self.left_palette_uv_colors[r]) |
| 3349 | } else { | 3370 | } else { |
| 3350 | (0, [0u16; 8]) | 3371 | (0, [0u16; 8]) |
| @@ -3518,6 +3539,14 @@ impl Neighbours { | |||
| 3518 | // context (a tile/SB-row boundary has no left neighbour). | 3539 | // context (a tile/SB-row boundary has no left neighbour). |
| 3519 | self.sub8_mode_row.iter_mut().for_each(|s| *s = (usize::MAX, 0)); | 3540 | self.sub8_mode_row.iter_mut().for_each(|s| *s = (usize::MAX, 0)); |
| 3520 | self.uv_mode_row.iter_mut().for_each(|s| *s = (usize::MAX, 0)); | 3541 | self.uv_mode_row.iter_mut().for_each(|s| *s = (usize::MAX, 0)); |
| 3542 | + // lane-tiles r11 (COMMON's NEIGHBOUR MAPS rule): the palette side bands | ||
| 3543 | + // are per-mi maps like every other one here, so they reset with the | ||
| 3544 | + // row too -- the left guard above is what actually stops a cross-tile | ||
| 3545 | + // read, this keeps a stale colour out of the arrays at all. | ||
| 3546 | + self.left_palette_size.iter_mut().for_each(|s| *s = 0); | ||
| 3547 | + self.left_palette_colors.iter_mut().for_each(|c| *c = [0u16; 8]); | ||
| 3548 | + self.left_palette_uv_size.iter_mut().for_each(|s| *s = 0); | ||
| 3549 | + self.left_palette_uv_colors.iter_mut().for_each(|c| *c = [0u16; 8]); | ||
| 3521 | } | 3550 | } |
| 3522 | 3551 | ||
| 3523 | /// Records a block's `skip`/`is_inter`/`interp_filter` state for the next | 3552 | /// Records a block's `skip`/`is_inter`/`interp_filter` state for the next |
| @@ -6439,8 +6468,15 @@ fn read_intra_mode( | |||
| 6439 | // matched bit-exact, then `eob_pt` read 5 instead of 6, because this | 6468 | // matched bit-exact, then `eob_pt` read 5 instead of 6, because this |
| 6440 | // symbol's bits were never consumed). | 6469 | // symbol's bits were never consumed). |
| 6441 | let mut filter_intra = None; | 6470 | let mut filter_intra = None; |
| 6471 | + // lane-tiles r12: `av1_filter_intra_allowed` (blockd.h) also requires | ||
| 6472 | + // `mbmi->palette_mode_info.palette_size[0] == 0` -- libaom writes NO | ||
| 6473 | + // `use_filter_intra` symbol for a Y-palette block, and reading one here | ||
| 6474 | + // desynced every screen-content stream from the first palette block on | ||
| 6475 | + // (it surfaced as a bogus "partition below 8x8" refusal further down the | ||
| 6476 | + // tile). | ||
| 6442 | if mode == DC_PRED | 6477 | if mode == DC_PRED |
| 6443 | && enable_filter_intra | 6478 | && enable_filter_intra |
| 6479 | + && palette_y_pending.is_none() | ||
| 6444 | && let Some(class) = filter_intra_size_class(side) | 6480 | && let Some(class) = filter_intra_size_class(side) |
| 6445 | { | 6481 | { |
| 6446 | let use_filter_intra = dec.symbol(&mut cdfs.filter_intra[class]) != 0; | 6482 | let use_filter_intra = dec.symbol(&mut cdfs.filter_intra[class]) != 0; |
| @@ -7032,6 +7068,7 @@ fn decode_block( | |||
| 7032 | let (palette_ctx, palette_cache) = neighbours.palette_ctx_and_cache(at); | 7068 | let (palette_ctx, palette_cache) = neighbours.palette_ctx_and_cache(at); |
| 7033 | let palette_uv_cache = neighbours.palette_uv_cache(at); | 7069 | let palette_uv_cache = neighbours.palette_uv_cache(at); |
| 7034 | let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left(r, c); | 7070 | let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left(r, c); |
| 7071 | + let at_tile_left = c == neighbours.tile_col0_mi / (SUB / MI); | ||
| 7035 | let (skip, mode, angle_delta_y, uv_mode, angle_delta_uv, alpha, filter_intra, palette_y, palette_uv) = | 7072 | let (skip, mode, angle_delta_y, uv_mode, angle_delta_uv, alpha, filter_intra, palette_y, palette_uv) = |
| 7036 | read_intra_mode( | 7073 | read_intra_mode( |
| 7037 | dec, | 7074 | dec, |
| @@ -7049,6 +7086,9 @@ fn decode_block( | |||
| 7049 | r * (SUB / MI), | 7086 | r * (SUB / MI), |
| 7050 | c * (SUB / MI), | 7087 | c * (SUB / MI), |
| 7051 | )?; | 7088 | )?; |
| 7089 | + if at_tile_left && palette_y.is_some() { | ||
| 7090 | + PALETTE_TILE_LEFT_HITS.with(|c| c.set(c.get() + 1)); | ||
| 7091 | + } | ||
| 7052 | let intrabc_dv = INTRABC_DV.with(|c| c.take()); | 7092 | let intrabc_dv = INTRABC_DV.with(|c| c.take()); |
| 7053 | // libaom `parse_decode_block`: an intrabc block is `inter_block_tx`, so | 7093 | // libaom `parse_decode_block`: an intrabc block is `inter_block_tx`, so |
| 7054 | // under `TX_MODE_SELECT` its transform size comes from the inter var-tx | 7094 | // under `TX_MODE_SELECT` its transform size comes from the inter var-tx |
crates/ec-av1/src/gate_coverage.rsmodified+16 -1
| @@ -18,6 +18,15 @@ | |||
| 18 | //! feature's gate, which shrinks the derived set and fails this test until the | 18 | //! feature's gate, which shrinks the derived set and fails this test until the |
| 19 | //! list is updated -- the point being that the shrink is noticed. | 19 | //! list is updated -- the point being that the shrink is noticed. |
| 20 | 20 | ||
| 21 | +// TILING is deliberately NOT in this derivation (lane-tiles r11): the check | ||
| 22 | +// keys on `--enable-<tool>=0/1`, and `--tile-columns=<log2>` has no such | ||
| 23 | +// shape -- a `--tile-columns=` presence check would also read `=0` (one tile) | ||
| 24 | +// as coverage, which is the opposite of what it would claim. It needs no | ||
| 25 | +// entry either: 13 gates spell `--tile-columns`/`--tile-rows` with a nonzero | ||
| 26 | +// log2 and assert the parsed `tile_info` really carries the grid, and | ||
| 27 | +// `run_multi_tile_gate` covers a 2D grid with the coding tools ON at both | ||
| 28 | +// bit depths. | ||
| 29 | + | ||
| 21 | /// aomenc coding tools that no real-`aomenc` gate is proven to exercise: | 30 | /// aomenc coding tools that no real-`aomenc` gate is proven to exercise: |
| 22 | /// switched off in every gate that names them, and on in none. | 31 | /// switched off in every gate that names them, and on in none. |
| 23 | /// | 32 | /// |
| @@ -182,7 +191,13 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[ | |||
| 182 | ]; | 191 | ]; |
| 183 | 192 | ||
| 184 | #[cfg(test)] | 193 | #[cfg(test)] |
| 185 | -const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ | 194 | +const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // lane-cwarp's 10-bit compound-global-warp gate closed `enable-global-motion` |
| 195 | + // and `enable-dist-wtd-comp` at 10 bits without deleting their entries here, | ||
| 196 | + // so this list was already stale (and this test already red) at main 9c35ecc; | ||
| 197 | + // lane-tiles r11's multi-tile 10-bit gates then closed `enable-ab-partitions`, | ||
| 198 | + // `enable-rect-partitions` and `enable-restoration` at 10 bits. All five | ||
| 199 | + // deleted together. | ||
| 200 | + | ||
| 186 | // Only 4 of the 45 real-aomenc gates encode at 10 bits, and they pin the | 201 | // Only 4 of the 45 real-aomenc gates encode at 10 bits, and they pin the |
| 187 | // pixel filters and the intra tool set off. Every entry the 8-bit list | 202 | // pixel filters and the intra tool set off. Every entry the 8-bit list |
| 188 | // carries is a hole here too. lane-hbdgates r1 closed six of the seven | 203 | // carries is a hole here too. lane-hbdgates r1 closed six of the seven |
crates/ec-av1/src/stream.rsmodified+391 -0
| @@ -16369,4 +16369,395 @@ mod tests { | |||
| 16369 | ); | 16369 | ); |
| 16370 | } | 16370 | } |
| 16371 | } | 16371 | } |
| 16372 | + | ||
| 16373 | + /// lane-tiles r11: every tile gate before this one turns the coding tools | ||
| 16374 | + /// OFF (rect/ab partitions, tx-size search, cdef, restoration all `=0`) | ||
| 16375 | + /// to isolate the per-tile loop, which is exactly the | ||
| 16376 | + /// [[tool-disabled-in-every-gate]] shape -- a tile-edge defect in any of | ||
| 16377 | + /// those tools is invisible to all of them. This one runs the BROAD tool | ||
| 16378 | + /// set (rect + ab partitions, default tx search, cdef and loop | ||
| 16379 | + /// restoration both on, deblocking left at its default so it filters | ||
| 16380 | + /// across tile boundaries as the spec requires) over a real 2D tile grid, | ||
| 16381 | + /// through `decode_stream` rather than the tile entry point, so it is the | ||
| 16382 | + /// same path a caller decoding a file takes. | ||
| 16383 | + /// | ||
| 16384 | + /// 256x128 is four 64x64 superblocks wide and two tall, so | ||
| 16385 | + /// `--tile-columns=1 --tile-rows=1` really yields a 2x2 grid and | ||
| 16386 | + /// `--tile-columns=2` really yields 4 columns; both are asserted from the | ||
| 16387 | + /// parsed `tile_info` rather than assumed, and the decoded-tile counter | ||
| 16388 | + /// (`tile_hits`) is asserted at >= 4 per decoded frame so a stream whose | ||
| 16389 | + /// header claims 4 tiles but whose decode only walked one cannot pass. | ||
| 16390 | + // `#[track_caller]` so a failing assert names the calling arm's line, and | ||
| 16391 | + // so `gate_coverage`'s body split (on `\n #[`) treats this helper's | ||
| 16392 | + // recipe as its own gate rather than gluing it onto the preceding one. | ||
| 16393 | + #[track_caller] | ||
| 16394 | + fn run_multi_tile_gate( | ||
| 16395 | + name: &str, | ||
| 16396 | + tile_cols_log2: u32, | ||
| 16397 | + tile_rows_log2: u32, | ||
| 16398 | + bit_depth: usize, | ||
| 16399 | + frame_count: usize, | ||
| 16400 | + extra: &[&str], | ||
| 16401 | + // lane-tiles r12: the palette arm's own override proof. `true` asserts, | ||
| 16402 | + // per attempt, that the arm's `--tune-content=screen --enable-palette=1` | ||
| 16403 | + // really reached the encoder (frame header `allow_screen_content_tools`) | ||
| 16404 | + // AND that a palette block fired at a TILE's left column -- the exact | ||
| 16405 | + // block whose colour cache must not see the previous tile's colours. | ||
| 16406 | + require_tile_left_palette: bool, | ||
| 16407 | + // `None` = the shared `gradients_source`. The palette arm overrides it | ||
| 16408 | + // with `smptebars`, the flat few-colour source the existing palette | ||
| 16409 | + // gates use -- gradients never make aomenc pick a palette block. | ||
| 16410 | + source_override: Option<&str>, | ||
| 16411 | + ) { | ||
| 16412 | + let _gate_lock = lock_gate_counters(); | ||
| 16413 | + if !have_ffmpeg() { | ||
| 16414 | + eprintln!("SKIP {name}: no ffmpeg"); | ||
| 16415 | + return; | ||
| 16416 | + } | ||
| 16417 | + if !have_aomenc() { | ||
| 16418 | + eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display()); | ||
| 16419 | + return; | ||
| 16420 | + } | ||
| 16421 | + let (width, height) = (256usize, 128usize); | ||
| 16422 | + let expected_tiles = (1usize << tile_cols_log2) * (1usize << tile_rows_log2); | ||
| 16423 | + let mut matched = 0u32; | ||
| 16424 | + let mut named_refusals = 0u32; | ||
| 16425 | + let n_attempts: u32 = std::env::var("EC_TILES_GATE_ATTEMPTS") | ||
| 16426 | + .ok() | ||
| 16427 | + .and_then(|s| s.parse().ok()) | ||
| 16428 | + .unwrap_or(6); | ||
| 16429 | + for attempt in 0..n_attempts { | ||
| 16430 | + let seed = 42 + attempt; | ||
| 16431 | + let duration = frame_count as f64 / 25.0; | ||
| 16432 | + let source = match source_override { | ||
| 16433 | + Some(src) => format!("{src}=size={width}x{height}:duration={duration}:rate=25"), | ||
| 16434 | + None => gradients_source(seed, width, height, &format!("duration={duration}:rate=25")), | ||
| 16435 | + }; | ||
| 16436 | + let pix_fmt = if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }; | ||
| 16437 | + let y4m = Command::new("ffmpeg") | ||
| 16438 | + .args([ | ||
| 16439 | + "-v", "error", "-f", "lavfi", "-i", &source, "-pix_fmt", pix_fmt, "-strict", | ||
| 16440 | + "-1", "-f", "yuv4mpegpipe", "-", | ||
| 16441 | + ]) | ||
| 16442 | + .stdin(Stdio::null()) | ||
| 16443 | + .stdout(Stdio::piped()) | ||
| 16444 | + .stderr(Stdio::piped()) | ||
| 16445 | + .output() | ||
| 16446 | + .expect("ffmpeg failed to run"); | ||
| 16447 | + assert!( | ||
| 16448 | + y4m.status.success(), | ||
| 16449 | + "ffmpeg fixture: {}", | ||
| 16450 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 16451 | + ); | ||
| 16452 | + let cols = format!("--tile-columns={tile_cols_log2}"); | ||
| 16453 | + let rows = format!("--tile-rows={tile_rows_log2}"); | ||
| 16454 | + let limit = format!("--limit={frame_count}"); | ||
| 16455 | + let depth_args: Vec<String> = if bit_depth == 10 { | ||
| 16456 | + vec!["--input-bit-depth=10".to_owned(), "--bit-depth=10".to_owned()] | ||
| 16457 | + } else { | ||
| 16458 | + Vec::new() | ||
| 16459 | + }; | ||
| 16460 | + let mut args: Vec<&str> = vec![ | ||
| 16461 | + "--codec=av1", | ||
| 16462 | + "--passes=1", | ||
| 16463 | + "--end-usage=q", | ||
| 16464 | + "--cq-level=40", | ||
| 16465 | + "--cpu-used=4", | ||
| 16466 | + &limit, | ||
| 16467 | + "--kf-max-dist=1000", | ||
| 16468 | + "--threads=1", | ||
| 16469 | + "--row-mt=0", | ||
| 16470 | + // This decoder is 64x64-superblock only, and `--tile-columns` | ||
| 16471 | + // splits on superblock boundaries, so 128x128 superblocks | ||
| 16472 | + // would leave 256px only two tiles' worth of columns. | ||
| 16473 | + "--sb-size=64", | ||
| 16474 | + &cols, | ||
| 16475 | + &rows, | ||
| 16476 | + // The point of this gate: tools ON across tile edges. | ||
| 16477 | + "--enable-rect-partitions=1", | ||
| 16478 | + "--enable-ab-partitions=1", | ||
| 16479 | + "--enable-cdef=1", | ||
| 16480 | + "--enable-restoration=1", | ||
| 16481 | + // Still off: capabilities this decoder refuses outright, which | ||
| 16482 | + // would turn every attempt into a refusal and make the gate | ||
| 16483 | + // vacuous rather than proving anything about tiles. | ||
| 16484 | + "--enable-1to4-partitions=0", | ||
| 16485 | + "--min-partition-size=16", | ||
| 16486 | + // Overridable by `extra` (aomenc takes the last occurrence of | ||
| 16487 | + // a repeated flag), which the palette arm below relies on. | ||
| 16488 | + "--enable-palette=0", | ||
| 16489 | + "--enable-intrabc=0", | ||
| 16490 | + "--enable-ref-frame-mvs=0", | ||
| 16491 | + "--enable-global-motion=0", | ||
| 16492 | + ]; | ||
| 16493 | + args.extend(extra.iter().copied()); | ||
| 16494 | + args.extend(depth_args.iter().map(String::as_str)); | ||
| 16495 | + args.extend(["--obu", "-o", "-", "-"]); | ||
| 16496 | + let mut child = Command::new(aomenc_path()) | ||
| 16497 | + .args(&args) | ||
| 16498 | + .stdin(Stdio::piped()) | ||
| 16499 | + .stdout(Stdio::piped()) | ||
| 16500 | + .stderr(Stdio::piped()) | ||
| 16501 | + .spawn() | ||
| 16502 | + .expect("aomenc failed to start"); | ||
| 16503 | + child | ||
| 16504 | + .stdin | ||
| 16505 | + .take() | ||
| 16506 | + .expect("aomenc stdin") | ||
| 16507 | + .write_all(&y4m.stdout) | ||
| 16508 | + .expect("writing y4m to aomenc"); | ||
| 16509 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 16510 | + assert!( | ||
| 16511 | + out.status.success(), | ||
| 16512 | + "aomenc refused the fixture: {}", | ||
| 16513 | + String::from_utf8_lossy(&out.stderr) | ||
| 16514 | + ); | ||
| 16515 | + let stream = out.stdout; | ||
| 16516 | + | ||
| 16517 | + // The stream must really carry the tile grid asked for, or the | ||
| 16518 | + // gate proves nothing (aomenc silently clamps tile counts that do | ||
| 16519 | + // not fit the frame's superblock grid). | ||
| 16520 | + { | ||
| 16521 | + let mut probe = Av1Parser::new(); | ||
| 16522 | + let mut pos = 0usize; | ||
| 16523 | + let mut checked = false; | ||
| 16524 | + while pos < stream.len() { | ||
| 16525 | + let obu = probe.parse_obu(&stream[pos..]).expect("parsing the gate stream"); | ||
| 16526 | + pos += obu.total_size; | ||
| 16527 | + let header = match &obu.kind { | ||
| 16528 | + ObuKind::Frame(h, _) => h, | ||
| 16529 | + ObuKind::FrameHeader(h) => h, | ||
| 16530 | + // lane-tiles r12: prove the base recipe's tools-on | ||
| 16531 | + // flags arrived (a repeated aomenc `--enable-*` keeps | ||
| 16532 | + // the LAST occurrence -- measured, see the report -- | ||
| 16533 | + // so a per-arm override must not silently vanish). | ||
| 16534 | + ObuKind::SequenceHeader(seq) => { | ||
| 16535 | + assert!( | ||
| 16536 | + seq.enable_cdef && seq.enable_restoration, | ||
| 16537 | + "{name}: --enable-cdef=1 --enable-restoration=1 did not reach \ | ||
| 16538 | + aomenc (seq enable_cdef={} enable_restoration={}, seed {seed})", | ||
| 16539 | + seq.enable_cdef, | ||
| 16540 | + seq.enable_restoration | ||
| 16541 | + ); | ||
| 16542 | + continue; | ||
| 16543 | + } | ||
| 16544 | + _ => continue, | ||
| 16545 | + }; | ||
| 16546 | + // A `show_existing_frame` header codes no tile info at all | ||
| 16547 | + // (spec 5.9.2 returns before `tile_info()`), so its | ||
| 16548 | + // `TileInfo` is the parser's 1x1 default -- checking it | ||
| 16549 | + // here would fail every inter stream for a header that | ||
| 16550 | + // carries no tiling. | ||
| 16551 | + if header.show_existing_frame { | ||
| 16552 | + continue; | ||
| 16553 | + } | ||
| 16554 | + if require_tile_left_palette { | ||
| 16555 | + assert!( | ||
| 16556 | + header.allow_screen_content_tools, | ||
| 16557 | + "{name}: --tune-content=screen/--enable-palette=1 did not reach \ | ||
| 16558 | + aomenc -- allow_screen_content_tools is 0 (seed {seed})" | ||
| 16559 | + ); | ||
| 16560 | + } | ||
| 16561 | + assert_eq!( | ||
| 16562 | + (header.tile_info.cols * header.tile_info.rows) as usize, | ||
| 16563 | + expected_tiles, | ||
| 16564 | + "{name}: aomenc wrote {}x{} tiles, not the {expected_tiles} asked for \ | ||
| 16565 | + (seed {seed})", | ||
| 16566 | + header.tile_info.cols, | ||
| 16567 | + header.tile_info.rows | ||
| 16568 | + ); | ||
| 16569 | + checked = true; | ||
| 16570 | + } | ||
| 16571 | + assert!(checked, "{name}: no frame header in the stream (seed {seed})"); | ||
| 16572 | + } | ||
| 16573 | + | ||
| 16574 | + let before = crate::decode::tile_hits(); | ||
| 16575 | + let pal_before = crate::decode::palette_tile_left_hits(); | ||
| 16576 | + let frames = match decode_stream(&stream) { | ||
| 16577 | + Err(e) => { | ||
| 16578 | + let msg = e.to_string(); | ||
| 16579 | + assert!( | ||
| 16580 | + msg.contains("unsupported"), | ||
| 16581 | + "{name} failed outright, not a named refusal (seed {seed}): {msg}" | ||
| 16582 | + ); | ||
| 16583 | + named_refusals += 1; | ||
| 16584 | + eprintln!("seed {seed} refusal: {msg}"); | ||
| 16585 | + continue; | ||
| 16586 | + } | ||
| 16587 | + Ok(frames) => frames, | ||
| 16588 | + }; | ||
| 16589 | + let hits = crate::decode::tile_hits() - before; | ||
| 16590 | + assert!( | ||
| 16591 | + hits >= expected_tiles * frames.len(), | ||
| 16592 | + "{name}: tile_hits delta was {hits}, expected >= {} -- every tile of every \ | ||
| 16593 | + frame must actually decode (seed {seed})", | ||
| 16594 | + expected_tiles * frames.len() | ||
| 16595 | + ); | ||
| 16596 | + let ffmpeg_frames = if bit_depth == 10 { | ||
| 16597 | + ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()) | ||
| 16598 | + } else { | ||
| 16599 | + ffmpeg_decode_sequence(&stream, width, height, frames.len()) | ||
| 16600 | + }; | ||
| 16601 | + let mismatched = frames | ||
| 16602 | + .iter() | ||
| 16603 | + .zip(&ffmpeg_frames) | ||
| 16604 | + .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v); | ||
| 16605 | + if mismatched && let Ok(path) = std::env::var("EC_AV1_GATE_DUMP") { | ||
| 16606 | + std::fs::write(&path, &stream).expect("writing pinned stream"); | ||
| 16607 | + eprintln!("EC_AV1_GATE_DUMP: wrote mismatching stream (seed {seed}) to {path}"); | ||
| 16608 | + } | ||
| 16609 | + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | ||
| 16610 | + assert_eq!(got.y, want.y, "{name} frame {i} luma vs ffmpeg (seed {seed})"); | ||
| 16611 | + assert_eq!(got.u, want.u, "{name} frame {i} U vs ffmpeg (seed {seed})"); | ||
| 16612 | + assert_eq!(got.v, want.v, "{name} frame {i} V vs ffmpeg (seed {seed})"); | ||
| 16613 | + } | ||
| 16614 | + if require_tile_left_palette { | ||
| 16615 | + let pal = crate::decode::palette_tile_left_hits() - pal_before; | ||
| 16616 | + assert!( | ||
| 16617 | + pal >= 1, | ||
| 16618 | + "{name}: this attempt decoded and matched but fired {pal} palette blocks at \ | ||
| 16619 | + a tile's left column -- the tile-relative palette cache guard is untested \ | ||
| 16620 | + (seed {seed})" | ||
| 16621 | + ); | ||
| 16622 | + } | ||
| 16623 | + matched += 1; | ||
| 16624 | + } | ||
| 16625 | + assert!( | ||
| 16626 | + matched > 0, | ||
| 16627 | + "{name}: every attempt refused ({named_refusals}); the gate never decoded a \ | ||
| 16628 | + multi-tile stream with the coding tools on" | ||
| 16629 | + ); | ||
| 16630 | + eprintln!("{name}: {matched} pixel-exact matches, {named_refusals} named refusals"); | ||
| 16631 | + } | ||
| 16632 | + | ||
| 16633 | + #[test] | ||
| 16634 | + fn a_real_aomenc_multi_tile_intra_stream_decodes_pixel_exact() { | ||
| 16635 | + run_multi_tile_gate( | ||
| 16636 | + "a_real_aomenc_multi_tile_intra_stream_decodes_pixel_exact", | ||
| 16637 | + 1, | ||
| 16638 | + 1, | ||
| 16639 | + 8, | ||
| 16640 | + 1, | ||
| 16641 | + &[], | ||
| 16642 | + false, | ||
| 16643 | + None, | ||
| 16644 | + ); | ||
| 16645 | + } | ||
| 16646 | + | ||
| 16647 | + #[test] | ||
| 16648 | + fn a_real_aomenc_multi_tile_intra_10bit_stream_decodes_pixel_exact() { | ||
| 16649 | + run_multi_tile_gate( | ||
| 16650 | + "a_real_aomenc_multi_tile_intra_10bit_stream_decodes_pixel_exact", | ||
| 16651 | + 2, | ||
| 16652 | + 0, | ||
| 16653 | + 10, | ||
| 16654 | + 1, | ||
| 16655 | + &[], | ||
| 16656 | + false, | ||
| 16657 | + None, | ||
| 16658 | + ); | ||
| 16659 | + } | ||
| 16660 | + | ||
| 16661 | + /// OPEN DEFECT (lane-tiles r11), which is why this arm is `#[ignore]`d | ||
| 16662 | + /// rather than deleted or quietly reseeded: at seed 42 this recipe | ||
| 16663 | + /// mismatches ffmpeg from frame 4 on, in one 32x32 block at | ||
| 16664 | + /// x[224..255] y[32..63] (measured with `--loopfilter-control=0`, which | ||
| 16665 | + /// removes the deblock spreading; with deblocking on the region grows to | ||
| 16666 | + /// x[221..255] y[30..69] and crosses the tile row boundary at y=64), and | ||
| 16667 | + /// the error then propagates through inter prediction to 12 of 16 frames. | ||
| 16668 | + /// Ablations that did NOT remove it: `--enable-restoration=0`, | ||
| 16669 | + /// `--enable-cdef=0`, `--loopfilter-control=0`. It is seed-specific | ||
| 16670 | + /// (seeds 47 and 48 decode 16/16 exact with two tile rows) and its | ||
| 16671 | + /// tile attribution is UNPROVEN: the single-tile control at seed 42 | ||
| 16672 | + /// re-encodes to different partitions and refuses on | ||
| 16673 | + /// "an inter SB-level partition type other than SPLIT", so no | ||
| 16674 | + /// same-content one-tile comparison exists. Reproducer: | ||
| 16675 | + /// `EC_AV1_GATE_DUMP=<path> cargo test -p ec-av1 --lib | ||
| 16676 | + /// a_real_aomenc_multi_tile_inter_stream -- --ignored`. | ||
| 16677 | + #[test] | ||
| 16678 | + #[ignore = "open defect: seed-42 32x32 block at x[224..255] y[32..63] mismatches; tile attribution unproven"] | ||
| 16679 | + fn a_real_aomenc_multi_tile_inter_stream_decodes_pixel_exact() { | ||
| 16680 | + run_multi_tile_gate( | ||
| 16681 | + "a_real_aomenc_multi_tile_inter_stream_decodes_pixel_exact", | ||
| 16682 | + 1, | ||
| 16683 | + 1, | ||
| 16684 | + 8, | ||
| 16685 | + 16, | ||
| 16686 | + // Pre-existing, non-tile decoder limits this lane does not own: | ||
| 16687 | + // the inter path only recurses a superblock as SPLIT (so the SB | ||
| 16688 | + // level must be forced to split) and never reads a `tx_depth` | ||
| 16689 | + // symbol under `TxMode::Select`. Both are named refusals in | ||
| 16690 | + // `refusal_inventory.rs`; without these two flags every inter | ||
| 16691 | + // attempt refuses before a single tile edge is compared. | ||
| 16692 | + &["--max-partition-size=32", "--enable-tx-size-search=0"], | ||
| 16693 | + false, | ||
| 16694 | + None, | ||
| 16695 | + ); | ||
| 16696 | + } | ||
| 16697 | + | ||
| 16698 | + /// lane-tiles r11, the defect this arm exists for: `palette_ctx_and_cache` | ||
| 16699 | + /// / `palette_uv_cache` (`decode.rs`) read the LEFT palette neighbour with | ||
| 16700 | + /// no availability guard at all, where libaom's `av1_get_palette_cache` | ||
| 16701 | + /// takes `xd->left_mbmi`, which is NULL at the block's own TILE left | ||
| 16702 | + /// column. A second tile column therefore inherited the previous tile's | ||
| 16703 | + /// palette colours and `palette_y_mode` ctx. Screen content is what makes | ||
| 16704 | + /// aomenc pick palette at all, so this arm drives `--tune-content=screen | ||
| 16705 | + /// --enable-palette=1` over a 2-column grid and asserts a real palette | ||
| 16706 | + /// block actually fired. | ||
| 16707 | + /// `#[ignore]`d at r11 and NOT yet proof of the fix: with the broad tool | ||
| 16708 | + /// set every seed refuses before a palette block reconstructs | ||
| 16709 | + /// ("a HORZ_A/HORZ_B/VERT_A partition below 16x16"), and the per-arm | ||
| 16710 | + /// `extra` overrides do not switch the base recipe's tools off -- aomenc | ||
| 16711 | + /// keeps the FIRST occurrence of a repeated `--enable-*` flag (measured: | ||
| 16712 | + /// appending `--enable-rect-partitions=0` after the base `=1` changed the | ||
| 16713 | + /// refusal not at all). Next round: put `extra` BEFORE the base list in | ||
| 16714 | + /// `run_multi_tile_gate`'s args, then this arm should reach a palette | ||
| 16715 | + /// block on smptebars with rect/ab off. | ||
| 16716 | + #[test] | ||
| 16717 | + fn a_real_aomenc_multi_tile_palette_stream_decodes_pixel_exact() { | ||
| 16718 | + const NAME: &str = "a_real_aomenc_multi_tile_palette_stream_decodes_pixel_exact"; | ||
| 16719 | + let before = crate::decode::palette_hits(); | ||
| 16720 | + run_multi_tile_gate( | ||
| 16721 | + NAME, | ||
| 16722 | + 1, | ||
| 16723 | + 0, | ||
| 16724 | + 8, | ||
| 16725 | + 1, | ||
| 16726 | + &["--enable-palette=1", "--tune-content=screen", "--cq-level=30", "--enable-tx-size-search=0", "--max-partition-size=32", | ||
| 16727 | + // Screen content + rect strips is a separate, pre-existing | ||
| 16728 | + // refusal ("palette syntax is consumed for square blocks | ||
| 16729 | + // only"); this arm owns the palette CACHE at a tile edge, so | ||
| 16730 | + // it takes the square-only path the other palette gates take. | ||
| 16731 | + "--enable-rect-partitions=0", "--enable-ab-partitions=0"], | ||
| 16732 | + true, | ||
| 16733 | + Some("smptebars"), | ||
| 16734 | + ); | ||
| 16735 | + if have_ffmpeg() && have_aomenc() { | ||
| 16736 | + assert!( | ||
| 16737 | + crate::decode::palette_hits() > before, | ||
| 16738 | + "{NAME}: no palette block fired -- the gate proves nothing about the palette \ | ||
| 16739 | + cache at a tile edge" | ||
| 16740 | + ); | ||
| 16741 | + } | ||
| 16742 | + } | ||
| 16743 | + | ||
| 16744 | + #[test] | ||
| 16745 | + fn a_real_aomenc_multi_tile_inter_10bit_stream_decodes_pixel_exact() { | ||
| 16746 | + run_multi_tile_gate( | ||
| 16747 | + "a_real_aomenc_multi_tile_inter_10bit_stream_decodes_pixel_exact", | ||
| 16748 | + 2, | ||
| 16749 | + 0, | ||
| 16750 | + 10, | ||
| 16751 | + 16, | ||
| 16752 | + // Pre-existing, non-tile decoder limits this lane does not own: | ||
| 16753 | + // the inter path only recurses a superblock as SPLIT (so the SB | ||
| 16754 | + // level must be forced to split) and never reads a `tx_depth` | ||
| 16755 | + // symbol under `TxMode::Select`. Both are named refusals in | ||
| 16756 | + // `refusal_inventory.rs`; without these two flags every inter | ||
| 16757 | + // attempt refuses before a single tile edge is compared. | ||
| 16758 | + &["--max-partition-size=32", "--enable-tx-size-search=0"], | ||
| 16759 | + false, | ||
| 16760 | + None, | ||
| 16761 | + ); | ||
| 16762 | + } | ||
| 16372 | } | 16763 | } |
lanes/tiles-r11.report.mdadded+132 -0
| @@ -0,0 +1,132 @@ | |||
| 1 | +# lane-tiles r11 — multi-tile gates with the tools ON; the films are single-tile | ||
| 2 | + | ||
| 3 | +## Charter premises, re-measured first (both stale) | ||
| 4 | +1. **"all 45 real-aomenc gates are single-tile"** — false at main 9c35ecc. This lane | ||
| 5 | + already ran 10 rounds, all merged; `crates/ec-av1/src/stream.rs` carries 9 multi-tile | ||
| 6 | + gates (2/4 tile columns, 2/4 tile rows, an inter one, several tile-group OBUs, | ||
| 7 | + non-uniform spacing). The branch was already identical to main at start | ||
| 8 | + (`git log main..HEAD` empty). | ||
| 9 | +2. **"round 1"** — this is r11. | ||
| 10 | + | ||
| 11 | +What was genuinely missing: every one of those 9 gates turns the coding tools OFF | ||
| 12 | +(`--enable-rect-partitions=0 --enable-ab-partitions=0 --enable-cdef=0 | ||
| 13 | +--enable-restoration=0`, some `--loopfilter-control=0`, `--min/--max-partition-size=32`). | ||
| 14 | +That is the [[tool-disabled-in-every-gate]] shape: a tile-edge defect inside any of those | ||
| 15 | +tools was invisible to all nine. | ||
| 16 | + | ||
| 17 | +## HIS FILMS' REAL TILING (the charter's decision input) | ||
| 18 | +Both films are **one tile**: `cols=1 rows=1 uniform_spacing=1 context_update_tile_id=0`, | ||
| 19 | +constant over 181 parsed frame headers each. Cross-checked with a foreign parser | ||
| 20 | +(ffmpeg `trace_headers` bsf): `tile_cols_log2 = 0`, `tile_rows_log2 = 0`, | ||
| 21 | +`uniform_tile_spacing_flag = 1` on every frame. **Multi-tile is not on the critical path | ||
| 22 | +for his library**; it stays a conformance obligation, not a film blocker. | ||
| 23 | + | ||
| 24 | +EVIDENCE: /tmp/.../scratchpad/reelcB.obu, reelbB.obu (120 frames each, `-ss 300 -c:v copy -f obu`) | `cargo run -p ec-av1 --example decode_probe -- <obu>` + `ffmpeg -v trace -bsf:v trace_headers` | ours: 181 headers, one distinct tiling (1x1); ffmpeg: tile_cols_log2=0 tile_rows_log2=0 on every frame; ReelC 1920x792, ReelB 3840x1608 | ||
| 25 | + | ||
| 26 | +## New gate family (`crates/ec-av1/src/stream.rs`, `run_multi_tile_gate` + 4 arms) | ||
| 27 | +256x128 (four 64x64 SBs wide, two tall), through `decode_stream` — the same entry point a | ||
| 28 | +caller decoding a file uses, not the tile function the older gates call directly. | ||
| 29 | +Recipe: `--enable-rect-partitions=1 --enable-ab-partitions=1 --enable-cdef=1 | ||
| 30 | +--enable-restoration=1`, deblocking left at its default so it filters across tile | ||
| 31 | +boundaries, `--sb-size=64`, `--threads=1 --row-mt=0`, 6 seeds. | ||
| 32 | +Hard asserts: parsed `tile_info.cols*rows == expected` on every non-`show_existing_frame` | ||
| 33 | +header, and `tile_hits` delta `>= tiles * frames` (a header claiming 4 tiles cannot pass on | ||
| 34 | +one decoded tile). | ||
| 35 | + | ||
| 36 | +| arm | grid | depth | frames | result | | ||
| 37 | +|---|---|---|---|---| | ||
| 38 | +| `a_real_aomenc_multi_tile_intra_stream_decodes_pixel_exact` | 2x2 | 8 | 1 | 5/6 exact, 1 named refusal | | ||
| 39 | +| `a_real_aomenc_multi_tile_intra_10bit_stream_decodes_pixel_exact` | 4 cols | 10 | 1 | 5/6 exact, 1 named refusal | | ||
| 40 | +| `a_real_aomenc_multi_tile_inter_10bit_stream_decodes_pixel_exact` | 4 cols | 10 | 16 | 3/6 exact, 3 named refusals | | ||
| 41 | +| `a_real_aomenc_multi_tile_inter_stream_decodes_pixel_exact` | 2x2 | 8 | 16 | **`#[ignore]`d — open defect, below** | | ||
| 42 | + | ||
| 43 | +The two inter arms additionally pass `--max-partition-size=32 --enable-tx-size-search=0`: | ||
| 44 | +without them every attempt refuses on two *pre-existing, non-tile* limits (the inter path | ||
| 45 | +only recurses a superblock as SPLIT; it reads no `tx_depth` under `TxMode::Select`), so the | ||
| 46 | +gate would compare no tile edge at all. Stated here rather than silently folded in. | ||
| 47 | + | ||
| 48 | +EVIDENCE: cargo test output | `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib multi_tile -- --nocapture --test-threads=1` | 3 arms pass with tools on, 4th ignored | ||
| 49 | + | ||
| 50 | +## OPEN DEFECT (fix-now was not reached; deferred) | ||
| 51 | +Seed 42, 2 tile rows: one 32x32 luma block at **x[224..255] y[32..63]** (tile row 0, frame | ||
| 52 | +right edge) mismatches ffmpeg from **frame 4**, propagating through inter prediction to | ||
| 53 | +12 of 16 frames. Localisation and ablations: | ||
| 54 | +- bbox with deblocking on: x[221..255] y[30..69] — crosses the tile row boundary (y=64), so | ||
| 55 | + deblock only *spreads* it; with `--loopfilter-control=0` it collapses to the single 32x32 | ||
| 56 | + block above. | ||
| 57 | +- NOT removed by `--enable-restoration=0`, `--enable-cdef=0`, `--loopfilter-control=0`. | ||
| 58 | +- Reproduces with 2 tile rows *and* with the 2x2 grid; seeds 47 and 48 decode 16/16 exact | ||
| 59 | + with two tile rows, so it is content-dependent, not a systematic tile-row defect. | ||
| 60 | +- **Tile attribution is UNPROVEN**: the same-content single-tile control re-encodes to | ||
| 61 | + different partitions and refuses ("an inter SB-level partition type other than SPLIT"), so | ||
| 62 | + no one-tile comparison of this content exists ([[gate-recipe-confound]]). Calling it a | ||
| 63 | + tile-edge defect would be a guess. | ||
| 64 | +Reproducer: `EC_AV1_GATE_DUMP=/tmp/mt.obu cargo test -p ec-av1 --lib a_real_aomenc_multi_tile_inter_stream -- --ignored`. | ||
| 65 | +Disposition: **deferred(a decodable single-tile control of the same content — unblocked by | ||
| 66 | +either the inter SB-level non-SPLIT partition capability or an aomenc recipe that keeps | ||
| 67 | +partitions identical across tile settings)**. | ||
| 68 | + | ||
| 69 | +EVIDENCE: /tmp/.../scratchpad/{c11,c01,norest,nocdef,nolf}.obu + cmp.py bboxes | encode seeds 42..48 x tile-rows 0/1 x {restoration,cdef,deblock} off, decode via decode_probe, per-pixel diff vs `ffmpeg -f rawvideo` | seed42 rows=1: 12/16 frames mismatch, nolf bbox x[224..255] y[32..63]; seed47 rows=1 and seed48 rows=0/1: 0/16 mismatch | ||
| 70 | + | ||
| 71 | +## Neighbour-map sweep (COMMON's NEIGHBOUR MAPS paragraph) | ||
| 72 | +`grep -n "> 0" `-swept the per-mi availability guards: `decode.rs` uses | ||
| 73 | +`tile_row0_mi`/`tile_col0_mi` (fields at decode.rs:2420-2421, reset in | ||
| 74 | +`Neighbours::start_tile`, called per tile at decode.rs:5549 and 10512) and `PlaneBuf`'s | ||
| 75 | +reach clamps use `tile_x0/tile_y0`; no `> 0` availability guard remained on a per-mi side | ||
| 76 | +band. Nothing to fix — recorded so the next lane does not re-sweep it. | ||
| 77 | + | ||
| 78 | +## gate_coverage (charter item 3) | ||
| 79 | +- Tiling **cannot** join the derivation and needs no entry: the check keys on | ||
| 80 | + `--enable-<tool>=0/1`, and a `--tile-columns=` presence check would read `=0` (one tile) | ||
| 81 | + as coverage. Noted in `gate_coverage.rs` with the gates that do spell it. | ||
| 82 | +- Deleted 5 stale `NEVER_EXERCISED_10BIT` entries. Two of them | ||
| 83 | + (`enable-global-motion`, `enable-dist-wtd-comp`) were closed by lane-cwarp's 10-bit | ||
| 84 | + compound-warp gate without updating this list, **so `never_exercised_10bit_matches_the_gate_recipes` | ||
| 85 | + was already failing at main 9c35ecc** — a pre-existing red, fixed here. The other three | ||
| 86 | + (`enable-ab-partitions`, `enable-rect-partitions`, `enable-restoration`) are closed by the | ||
| 87 | + new 10-bit arms. | ||
| 88 | +- Also fixed the same body-split shape in my own helper: `gate_coverage` splits gate bodies | ||
| 89 | + on `\n #[`, so a bare helper `fn` is glued onto the preceding gate's recipe. | ||
| 90 | + `run_multi_tile_gate` carries `#[track_caller]` so it owns its body. | ||
| 91 | + | ||
| 92 | +## Test totals | ||
| 93 | +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --test-threads=2`: | ||
| 94 | +**282 passed, 0 failed, 26 ignored** (1211 s). `cargo check -p ec-av1 --tests`: clean. | ||
| 95 | +(A first run at default test-threads was SIGTERMed by `scripts/memguard-runner.sh` under | ||
| 96 | +10 concurrent lanes; `--test-threads=2` is the working setting, not a result.) | ||
| 97 | + | ||
| 98 | +## Files changed | ||
| 99 | +- `crates/ec-av1/src/stream.rs` — `run_multi_tile_gate` + 4 arms. | ||
| 100 | +- `crates/ec-av1/src/gate_coverage.rs` — 5 stale 10-bit entries deleted, tiling note. | ||
| 101 | +- `crates/ec-av1/examples/decode_probe.rs` — prints every frame header's tiling. | ||
| 102 | + | ||
| 103 | +## Commit | ||
| 104 | +- 2e73186 on `lane-tiles`. Never pushed, never merged, main untouched. | ||
| 105 | + | ||
| 106 | +## Coordinator items received mid-round (after the r11 commit) | ||
| 107 | +1. **Palette left neighbour has no tile guard — CONFIRMED and FIXED.** | ||
| 108 | + `decode.rs` `palette_ctx_and_cache` and `palette_uv_cache` read | ||
| 109 | + `left_palette_size[r]` / `left_palette_uv_size[r]` with **no availability guard at | ||
| 110 | + all**, where libaom's `av1_get_palette_cache` takes `xd->left_mbmi`, NULL at the | ||
| 111 | + block's own tile left column. Fixed with `let left_ok = c > self.tile_col0_mi / (SUB / MI);` | ||
| 112 | + on both (`at` is in SUB units, so the mi-unit tile origin is divided the same way | ||
| 113 | + `start_tile` divides `col0_mi` for `above_mode`). `start_row` also never cleared | ||
| 114 | + `left_palette_*`/`left_palette_uv_*`; it does now (COMMON's NEIGHBOUR MAPS rule 2). | ||
| 115 | + Status: **code-verified** — 54 tile tests + gate_coverage green, no gate yet proves it. | ||
| 116 | +2. **Palette + screen-content multi-tile arm — written, `#[ignore]`d, NOT yet proof.** | ||
| 117 | + `a_real_aomenc_multi_tile_palette_stream_decodes_pixel_exact` (smptebars, 2 tile | ||
| 118 | + columns, `--tune-content=screen --enable-palette=1`, asserts `palette_hits` rose). | ||
| 119 | + It currently refuses on every seed before a palette block reconstructs, because the | ||
| 120 | + per-arm `extra` flags do NOT override the base recipe: **aomenc keeps the FIRST | ||
| 121 | + occurrence of a repeated `--enable-*` flag** (measured — appending | ||
| 122 | + `--enable-rect-partitions=0` after the base `=1` changed the refusal not at all). | ||
| 123 | + Fix next round: move `args.extend(extra)` to precede the base list in | ||
| 124 | + `run_multi_tile_gate`. Disposition: **deferred(one edit — extra before base)**. | ||
| 125 | +3. **lane-ab16's `--tile-columns=1` mismatch (mandelbrot 96x96, x=32..63 y=80..95)** — | ||
| 126 | + NOT reproduced this round. Disposition: **deferred(tool-call cap)**. | ||
| 127 | +4. **Frame-relative `mi_row > 0` / `mi_col > 0` guards at decode.rs ~8547-8548 and | ||
| 128 | + mvstack.rs ~727,733,742,756,1486,1492,1501,1515** — NOT swept. mvstack has no tile | ||
| 129 | + origin plumbed in at all, so this is a signature change plus a call-site sweep, and | ||
| 130 | + it needs a multi-tile INTER gate to show — the arm that is `#[ignore]`d above for an | ||
| 131 | + unrelated open defect. Disposition: **deferred(next round; needs tile bounds threaded | ||
| 132 | + into mvstack, then the inter multi-tile arm re-enabled to measure)**. | ||
lanes/tiles-r12.report.mdadded+106 -0
| @@ -0,0 +1,106 @@ | |||
| 1 | +# lane-tiles r12 — the palette gate is live; the refusal it hit was a filter-intra desync | ||
| 2 | + | ||
| 3 | +## Charter item 1: REJECTED, with the measurement (do NOT move `extend(extra)`) | ||
| 4 | +The charter (and r11, and a ledger `constraint|` line) states "aomenc keeps the FIRST | ||
| 5 | +occurrence of a repeated flag". **Measured false.** Same input, one frame, 2 tile columns: | ||
| 6 | + | ||
| 7 | +| args | md5 | size | | ||
| 8 | +|---|---|---| | ||
| 9 | +| `--enable-palette=0 --enable-palette=1` | 34b7fe63… | 299 | | ||
| 10 | +| `--enable-palette=1` alone | 34b7fe63… | 299 | | ||
| 11 | +| `--enable-palette=1 --enable-palette=0` | f8339ae1… | 334 | | ||
| 12 | +| `--enable-palette=0` alone | f8339ae1… | 334 | | ||
| 13 | + | ||
| 14 | +The LAST occurrence wins (libaom `aomenc.c` updates the existing entry in | ||
| 15 | +`config->arg_ctrls` in place). The current order — base list, then `extra` — is already | ||
| 16 | +correct; moving `extra` first would silently disable every per-arm override. Not done, and | ||
| 17 | +the ledger line is corrected below. | ||
| 18 | + | ||
| 19 | +EVIDENCE: /tmp/.../scratchpad/p01.obu,p10.obu,p0.obu,p1.obu | aomenc same y4m, 4 flag orders | md5(p01)==md5(p1), md5(p10)==md5(p0) | ||
| 20 | + | ||
| 21 | +## Root cause of the palette arm's refusal: `use_filter_intra` read after a palette block | ||
| 22 | +With the overrides proven to arrive, the palette arm still refused — and the refusal was a | ||
| 23 | +**correlate, not the defect** ("a HORZ_A/… partition below 16x16" with rect/ab OFF is | ||
| 24 | +impossible; the stream had desynced). Isolation, single tile, identical recipe: | ||
| 25 | +`--enable-palette=0` → `OK: 1 frames decoded`; `--enable-palette=1` → refusal. | ||
| 26 | + | ||
| 27 | +Range ladder (instrumented aomdec `EC_TRACE_MODE_STEP` vs ours) diverges inside the first | ||
| 28 | +16x16 palette block, mi(0,8): both sides agree through `angle_uv` (rng=38738); ours then | ||
| 29 | +reads `use_filter_intra=1` (rng→61700) while libaom reads no such symbol. | ||
| 30 | +`av1_filter_intra_allowed` (blockd.h) requires | ||
| 31 | +`mbmi->palette_mode_info.palette_size[0] == 0` — **libaom writes no `use_filter_intra` | ||
| 32 | +symbol for a Y-palette block**, and we consumed one, desyncing the rest of every | ||
| 33 | +screen-content tile from its first palette block on. | ||
| 34 | + | ||
| 35 | +Fix: `crates/ec-av1/src/decode.rs:5120` — `&& palette_y_pending.is_none()` on the | ||
| 36 | +`use_filter_intra` read. | ||
| 37 | + | ||
| 38 | +Class sweep (`filter_intra_size_class*` call sites): the only other reader is | ||
| 39 | +`read_intra_mode_rect` (decode.rs:3661), which refuses screen content wholesale before any | ||
| 40 | +palette syntax, so no palette block can reach it; the two inter-frame intra sites | ||
| 41 | +(decode.rs:12009, 13109) return `unsupported` the moment palette fires. One site, fixed. | ||
| 42 | + | ||
| 43 | +EVIDENCE: /tmp/.../scratchpad/{w0,w1}.obu + ref2.txt/our2.txt | aomenc palette=0/1, same recipe; EC_TRACE_MODE_STEP ladder both decoders | w0 OK / w1 refused before; both OK after; first divergence mi(0,8) rng 38738: oracle no symbol, ours use_filter_intra=1 | ||
| 44 | + | ||
| 45 | +## Charter item 2: `a_real_aomenc_multi_tile_palette_stream…` un-ignored and GREEN | ||
| 46 | +- `#[ignore]` removed; **6/6 attempts pixel-exact vs ffmpeg, 0 refusals**. | ||
| 47 | +- Per-attempt proof added: new counter `palette_tile_left_hits()` (decode.rs:916, bumped at | ||
| 48 | + decode.rs:5715) counts palette-Y blocks at their own tile's left column; the gate asserts | ||
| 49 | + the delta `>= 1` on every attempt that decoded **and** compared. All 6 attempts pass it. | ||
| 50 | +- Override proof (charter item 1's real intent): every arm now asserts the sequence header's | ||
| 51 | + `enable_cdef && enable_restoration` (the base tools-on recipe arrived), and the palette arm | ||
| 52 | + additionally asserts `allow_screen_content_tools` on every frame header (its own | ||
| 53 | + `--tune-content=screen --enable-palette=1` arrived). | ||
| 54 | + | ||
| 55 | +Mutation test on a scratch copy of decode.rs (restored after each run): | ||
| 56 | +- revert **`left_ok`** alone (`c > 0`) → gate still passes: the tile-left guard is | ||
| 57 | + belt-and-braces, because `start_row` wipes the left palette bands before a tile's first row. | ||
| 58 | +- revert **`left_ok` + `start_row`'s palette clear** → gate FAILS (panic at stream.rs:11465). | ||
| 59 | + So the gate does bind the r11 palette-band fix, and the load-bearing half is the | ||
| 60 | + `start_row` clear, not the `left_ok` guard. Stated rather than claimed the other way. | ||
| 61 | + | ||
| 62 | +EVIDENCE: cargo test output | `EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib multi_tile -- --test-threads=1`; two mutations of decode.rs re-run | palette arm 6/6 exact; mutation(left_ok) passes, mutation(left_ok+start_row) fails | ||
| 63 | + | ||
| 64 | +## Charter item 3: override-shape sweep of stream.rs | ||
| 65 | +`grep -n "extend(\|\.chain("` near aomenc/ffmpeg arg vectors → 3 sites: | ||
| 66 | +- stream.rs:11234 `run_multi_tile_gate` — extras after base: **correct** (last wins). | ||
| 67 | +- stream.rs:9266 — appends `rate_args`/`depth_args`, no flag repeated with the base list. | ||
| 68 | +- stream.rs:1323 — ffmpeg (`libaom-av1` private options), where a repeated option also takes | ||
| 69 | + the last value (`av_dict_set` overwrite). | ||
| 70 | +Nothing to fix; the shape is safe under last-wins, which is the measured behaviour. | ||
| 71 | + | ||
| 72 | +## Charter item 4: the `#[ignore]`d multi-tile inter arm | ||
| 73 | +Left ignored, with its reproducer. It already carries `--max-partition-size=32 | ||
| 74 | +--enable-tx-size-search=0` (r11), so the charter's suggested flags are the ones it runs with; | ||
| 75 | +the open defect is the seed-42 32x32 block at x[224..255] y[32..63], tile attribution still | ||
| 76 | +unproven. Disposition: **deferred(a decodable single-tile control of the same content)** — | ||
| 77 | +unchanged from r11, no budget spent on it this round. | ||
| 78 | + | ||
| 79 | +## Test totals | ||
| 80 | +`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -- --test-threads=2`: | ||
| 81 | +**283 passed, 0 failed, 26 ignored** (1860.6 s), log `$HOME/.cache/tiles-suite.log`. | ||
| 82 | +Includes `refusal_inventory` (3 tests) and `gate_coverage` (5 tests) green, and all four | ||
| 83 | +live multi-tile arms (`intra`, `intra_10bit`, `inter_10bit`, `palette`) ok; the 8-bit | ||
| 84 | +`multi_tile_inter` arm stays `ignored` with its open-defect reason in the ignore string. | ||
| 85 | + | ||
| 86 | +EVIDENCE: $HOME/.cache/tiles-suite.log | `EC_AV1_REQUIRE_AOMENC=1 nice -n 10 cargo test -p ec-av1 --lib -j3 -- --test-threads=2` | `test result: ok. 283 passed; 0 failed; 26 ignored ... 1860.64s` | ||
| 87 | + | ||
| 88 | +## Charter premise re-measured: main does NOT already carry this fix | ||
| 89 | +The charter said lane-palette2 had fixed "no `use_filter_intra` read on palette-Y blocks" | ||
| 90 | +on main since 3808cf8. **False at main df5d630**: `git show main:crates/ec-av1/src/decode.rs` | ||
| 91 | +has no palette condition on EITHER `use_filter_intra` read (square site ~5367, rect site | ||
| 92 | +~3903) — the branch's `&& palette_y_pending.is_none()` is not a duplicate and main still | ||
| 93 | +needs it. The rect site is unreachable for palette content (it refuses | ||
| 94 | +`allow_screen_content_tools` wholesale at decode.rs:3596), so one guarded site is the whole | ||
| 95 | +class, as the r12 sweep said. | ||
| 96 | + | ||
| 97 | +## r12 restart (the first r12 agent was killed mid-report) | ||
| 98 | +Its commit 99f0091 was complete and the tree was clean; this round finished the suite run, | ||
| 99 | +the main-duplication check above, and one cosmetic fix: the two new override asserts had a | ||
| 100 | +missing `\` line continuation, so their panic messages carried 30 spaces mid-sentence | ||
| 101 | +(`stream.rs:11284`, `stream.rs:11304`). | ||
| 102 | + | ||
| 103 | +## Files changed | ||
| 104 | +- `crates/ec-av1/src/decode.rs` — filter-intra/palette gating fix; `PALETTE_TILE_LEFT_HITS`. | ||
| 105 | +- `crates/ec-av1/src/stream.rs` — palette arm un-ignored; per-attempt tile-left palette | ||
| 106 | + assert; sequence-header + screen-tools override proofs on every arm. | ||