diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index e94489a1..04905fb5 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -171,6 +171,26 @@ pub(crate) fn intra_in_inter_angle_delta_uv_hits() -> usize { INTRA_IN_INTER_ANGLE_DELTA_UV_HITS.with(|c| c.get()) } +// lane-uv8 r1: the three non-DC chroma mode classes an INTRA 8x8 leaf inside +// an INTER frame ([`decode_inter_block8`]'s intra arm) can carry -- the arm +// read `uv_mode` and then refused everything but `DC_PRED`. Counted here and +// nowhere else so the gate's assert cannot be satisfied by a >=16x16 block. +thread_local! { + static INTRA_IN_INTER8_UV_DIR_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; + static INTRA_IN_INTER8_UV_SMOOTH_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; + static INTRA_IN_INTER8_UV_CFL_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// `(directional, smooth/paeth, CfL)` chroma modes coded by an intra 8x8 leaf +/// inside an inter frame -- see [`INTRA_IN_INTER8_UV_DIR_HITS`]. +pub(crate) fn intra_in_inter8_uv_hits() -> (usize, usize, usize) { + ( + INTRA_IN_INTER8_UV_DIR_HITS.with(|c| c.get()), + INTRA_IN_INTER8_UV_SMOOTH_HITS.with(|c| c.get()), + INTRA_IN_INTER8_UV_CFL_HITS.with(|c| c.get()), + ) +} + // lane-realworld r1: this frame's `cdef.bits` (spec 5.9.19), threaded into // [`maybe_read_cdef_idx`] the same way [`ENABLE_EDGE_FILTER`] threads a // frame-level flag through the recursive block decode -- `0` (the default) @@ -19241,7 +19261,6 @@ fn decode_inter_block8( const CHROMA_SIDE: usize = 4; let (r, c) = outer_at; - let _ = (r, c); // lane-inter8 r2: this leaf's OWN mi cell, not the enclosing 16x16's -- // leaf (mi_r, mi_c + 2)'s left neighbour is leaf (mi_r, mi_c), and the // left column of a 16x16's second leaf ROW is the previous 16x16 block's @@ -19296,6 +19315,10 @@ fn decode_inter_block8( } let mode_for_tx; + // lane-uv8 r1: this leaf's chroma prediction mode (`get_uv_mode` of the + // coded `uv_mode`), for the neighbour bands at the tail. An INTER leaf + // stores `UV_DC_PRED`, exactly as [`decode_inter_block`] one level up. + let mut uv_predict_mode = DC_PRED; let (luma_grid, u_grid, v_grid); let mut compound_ctx8: Option<(i8, i8, u8, u8)> = None; // lane-inter8 r1: this leaf's own resolved references, handed back so the @@ -20375,12 +20398,53 @@ fn decode_inter_block8( this leaf with one; the >=16x16 arm decodes deltas)", )); } + // lane-uv8 r1: the delta'd angle decides the intra edge filter, and a + // directional luma mode is already legal on this leaf -- the arm + // passed a hardcoded `false` where [`decode_leaf8`] reads the + // mi-exact neighbour modes (`get_intra_edge_filter_type`, spec + // 7.11.2). + let (above_mode, left_mode) = + neighbours.modes_above_left_mi(leaf_mi.0, leaf_mi.1, neighbours.modes_above_left(r, c)); + let smooth_neighbor = is_smooth_mode(above_mode) || is_smooth_mode(left_mode); + // lane-uv8 r1: libaom `read_intra_block_mode_info` (decodemv.c:1198-1207) + // -- `uv_mode` over the CFL-allowed alphabet (`is_cfl_allowed`: a + // BLOCK_8X8 leaf is inside the 32x32 bound), then `read_cfl_alphas` + // for `UV_CFL_PRED`, then `angle_delta_uv` off the MAPPED uv mode's + // row (`get_uv_mode`, identity over `V_PRED..=D67_PRED`). Every value + // but `DC_PRED` was refused here, which is what blocked the low-cq + // CDEF arms and the 10-bit gates. let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]); - if uv_mode != DC_PRED { - return Err(unsupported( - "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)", - )); + if (9..=12).contains(&uv_mode) { + SMOOTH_UV_HITS.with(|c| c.set(c.get() + 1)); + INTRA_IN_INTER8_UV_SMOOTH_HITS.with(|c| c.set(c.get() + 1)); } + let alpha = if uv_mode == UV_CFL_PRED { + INTRA_IN_INTER8_UV_CFL_HITS.with(|c| c.set(c.get() + 1)); + Some(read_cfl_alphas(dec, cdfs)) + } else { + None + }; + let angle_delta_uv = if (V_PRED..=D67_PRED).contains(&uv_mode) { + DIRECTIONAL_UV_HITS.with(|c| c.set(c.get() + 1)); + INTRA_IN_INTER8_UV_DIR_HITS.with(|c| c.set(c.get() + 1)); + read_angle_delta(dec, &mut cdfs.angle_delta[uv_mode - V_PRED]) + } else { + 0 + }; + if angle_delta_uv != 0 { + UV_ANGLE_DELTA_HITS.with(|c| c.set(c.get() + 1)); + INTRA_IN_INTER_ANGLE_DELTA_UV_HITS.with(|c| c.set(c.get() + 1)); + } + // `get_uv_mode` (spec 9.3): `UV_CFL_PRED` predicts as `DC_PRED`. + uv_predict_mode = if uv_mode == UV_CFL_PRED { + DC_PRED + } else { + uv_mode + }; + // The CHROMA neighbour's own `uv_mode` decides the chroma edge filter + // strength (`get_intra_edge_filter_type`, reconintra.c:974), never the + // luma one -- same read [`decode_leaf8`] does. + let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(leaf_mi.0, leaf_mi.1, r, c); // lane-screen r2: see [`decode_inter_block`]'s own copy -- `mode`/ // `uv_mode` are both effectively `DC_PRED`-gated already on this // leaf (a nonzero `mode` still passes, but `uv_mode` is forced @@ -20392,7 +20456,10 @@ fn decode_inter_block8( "a block that actually uses a palette (Y) -- reconstruction is out of scope", )); } - if dec.symbol(&mut cdfs.palette_uv_mode[0]) != 0 { + // lane-uv8 r1: `read_palette_mode_info` reads the UV symbol only + // when `uv_mode == UV_DC_PRED` (decodemv.c) -- unconditional here + // while every non-DC uv_mode was refused a few lines above. + if uv_mode == DC_PRED && dec.symbol(&mut cdfs.palette_uv_mode[0]) != 0 { return Err(unsupported( "a block that actually uses a palette (UV) -- reconstruction is out of scope", )); @@ -20473,31 +20540,34 @@ fn decode_inter_block8( &vec![0i32; SIDE * SIDE], None, filter_intra, - false, + smooth_neighbor, ); + // CfL's AC contribution is the luma this leaf just reconstructed, + // averaged over the 4x4 chroma block (`cfl_ac_q3`, spec 7.11.5). + let ac = alpha.map(|_| cfl_ac_q3(y, px, py, SIDE)); u.reconstruct( cpx, cpy, CHROMA_SIDE, - DC_PRED, - 0, + uv_predict_mode, + angle_delta_uv, reach, &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], + alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), None, - None, - false, + smooth_neighbor_uv, ); v.reconstruct( cpx, cpy, CHROMA_SIDE, - DC_PRED, - 0, + uv_predict_mode, + angle_delta_uv, reach, &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], + alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), None, - None, - false, + smooth_neighbor_uv, ); luma_grid = vec![0i32; SIDE * SIDE]; u_grid = vec![0i32; CHROMA_SIDE * CHROMA_SIDE]; @@ -20524,8 +20594,9 @@ fn decode_inter_block8( None, filter_intra, None, - false, + smooth_neighbor, )?; + let ac = alpha.map(|_| cfl_ac_q3(y, px, py, SIDE)); u_grid = read_plane( dec, cdfs, @@ -20534,8 +20605,8 @@ fn decode_inter_block8( 1, around[1], mode, - DC_PRED, - 0, + uv_predict_mode, + angle_delta_uv, reach, u, cpx, @@ -20543,10 +20614,10 @@ fn decode_inter_block8( CHROMA_SIDE, TX4, base_q_idx, + alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), None, None, - None, - false, + smooth_neighbor_uv, )?; v_grid = read_plane( dec, @@ -20556,8 +20627,8 @@ fn decode_inter_block8( 2, around[2], mode, - DC_PRED, - 0, + uv_predict_mode, + angle_delta_uv, reach, v, cpx, @@ -20565,10 +20636,10 @@ fn decode_inter_block8( CHROMA_SIDE, TX4, base_q_idx, + alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), None, None, - None, - false, + smooth_neighbor_uv, )?; } } @@ -20590,6 +20661,16 @@ fn decode_inter_block8( ) }); neighbours.record_mi(leaf_mi, 8, &[luma_grid, u_grid, v_grid]); + // lane-uv8 r1: this leaf never stamped a mode band at all, so the block + // below/right of it read whatever block last wrote the coarse [`SUB`] + // slot -- now that an intra leaf here can code a smooth/directional + // `uv_mode`, its chroma neighbours must see it (and an inter leaf must + // stamp `DC_PRED`, what libaom stores for a non-intra block). Same pair + // [`decode_leaf8`] writes, plus the coarse fallback slots. + neighbours.above_uv_mode[c] = uv_predict_mode; + neighbours.left_uv_mode[r] = uv_predict_mode; + neighbours.record_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, mode_for_tx); + neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); if let Some((left, above)) = saved_luma_ctx { for (cell, state) in left.into_iter().enumerate() { neighbours.left[leaf_mi.0 + cell][0] = state; diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index bd4793af..3a975b6a 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -25,7 +25,6 @@ #[cfg(test)] const CAPABILITY_CLAIMS: &[&str] = &[ "filter intra on a superblock-level HORZ/VERT strip (never expected -- av1_filter_intra_allowed_bsize caps at 32x32)", - "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)", ]; #[cfg(test)] diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index f93f98e2..dff4b750 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -5685,6 +5685,279 @@ mod tests { ); } + /// lane-uv8 r1 (classes [[refusal-strings-are-claims]] + + /// [[tool-disabled-in-every-gate]]): a real aomenc inter sequence with + /// 8x8 partitions and full chroma intra tooling + /// (`--enable-cfl-intra=1 --enable-smooth-intra=1 --enable-paeth-intra=1 + /// --enable-directional-intra=1`), in which the RD gives an INTRA 8x8 + /// leaf inside an inter frame a NON-DC `uv_mode`. That leaf + /// ([`decode::decode_inter_block8`]'s intra arm) read the `uv_mode` + /// symbol and refused every value but `DC_PRED` -- "this encoder never + /// writes one" was a claim, and this gate is what contradicts it. Hard- + /// asserts `decode::intra_in_inter8_uv_hits` (directional, smooth/paeth, + /// CfL, counted on THIS leaf only); an attempt that never produced one + /// proves nothing, and exhausting every attempt is a FAILURE, not a SKIP. + #[test] + fn a_real_aomenc_inter_sequence_with_a_non_dc_chroma_8x8_intra_leaf_decodes_pixel_exact() { + uv_mode_in_inter8_gate(8, 1); + } + + /// The 10-bit arm (both of the user's films are `yuv420p10le`). + #[test] + fn a_real_aomenc_10bit_inter_sequence_with_a_non_dc_chroma_8x8_intra_leaf_decodes_pixel_exact() { + uv_mode_in_inter8_gate(10, 1); + } + + /// The multi-tile arm (class [[new-map-ignores-tile-edge]]): this round + /// stamps a new `uv_mode` band from the 8x8 leaf, whose availability must + /// be tile-relative. + #[test] + fn a_real_aomenc_two_tile_inter_sequence_with_a_non_dc_chroma_8x8_intra_leaf_decodes_pixel_exact() + { + uv_mode_in_inter8_gate(8, 2); + } + + fn uv_mode_in_inter8_gate(bit_depth: u32, tile_columns: u32) { + let name = format!("uv_mode_in_inter8_gate({bit_depth}, tiles={tile_columns})"); + 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, frame_count) = (192usize, 128usize, 8usize); + let mut refusals = Vec::new(); + let mut uncounted_exact = 0u32; + let mut totals = (0usize, 0usize, 0usize); + for attempt in 0..30u32 { + let seed = 42 + attempt; + // A zooming fractal with a hard CUT at frame 4 (`overlay` + // switching a second, unrelated fractal on): after the cut a block + // is unpredictable from the reference, which is what makes aomenc + // code INTRA blocks inside an inter frame. Chroma is NOT + // desaturated here (every sibling inter gate passes `hue=s=0`) -- + // real chroma detail is exactly what pushes the chroma RD off + // DC_PRED. `noise` carries its own explicit seed (lavfi + // `gradients` ignores its seed; class [[seeded-fixture-not-reproducible]]). + let source = format!( + "mandelbrot=size={width}x{height}:start_scale={}:rate=25[a];\ + mandelbrot=size={width}x{height}:start_scale={}:rate=25[b];\ + [a][b]overlay=enable='gte(n,4)',noise=alls=12:allf=t+u:all_seed={seed}", + 5.0 - f64::from(attempt) * 0.06, + 0.9 + f64::from(attempt) * 0.11 + ); + let y4m = Command::new("ffmpeg") + .args([ + "-v", + "error", + "-f", + "lavfi", + "-i", + &source, + "-pix_fmt", + if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }, + "-strict", + "-1", + "-t", + "0.32", + "-f", + "yuv4mpegpipe", + "-strict", + "-1", + "-", + ]) + .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) + ); + // A coarser quantiser is what pushes the chroma RD to a cheap + // non-DC mode on a small block; sweep 12..40 (the low end is what + // lane-cdef's cq12 arm needs). + let cq = format!("--cq-level={}", 12 + (attempt % 5) * 7); + let depth_args: &[&str] = if bit_depth == 10 { + &["-b", "10", "--input-bit-depth=10"] + } else { + &[] + }; + let tiles = format!("--tile-columns={}", tile_columns - 1); + // The y4m goes through a FILE, not aomenc's stdin: this gate's + // stream is ~100 KB, bigger than a pipe buffer, so an aomenc that + // is still being fed on stdin blocks writing its stdout and the + // test blocks writing its stdin -- a hard deadlock (measured + // here, 3 min into attempt 0, class [[gate-loader-slurps-whole-file]]). + // The path is PID-keyed (class [[pid-keyed-temp-path]]). + let y4m_path = std::env::temp_dir().join(format!( + "ec-av1-uv8-{}-{bit_depth}-{tile_columns}-{seed}.y4m", + std::process::id() + )); + std::fs::write(&y4m_path, &y4m.stdout).expect("writing the y4m fixture"); + let child = Command::new(aomenc_path()) + .args(depth_args) + .args([ + "--codec=av1", + "--passes=1", + "--end-usage=q", + &cq, + "--cpu-used=0", + "--lag-in-frames=0", + "--auto-alt-ref=0", + "--kf-max-dist=9999", + "--kf-min-dist=9999", + "--threads=1", + "--row-mt=0", + &tiles, + "--enable-order-hint=0", + "--enable-warped-motion=0", + "--enable-obmc=0", + "--enable-masked-comp=0", + "--enable-interintra-comp=0", + "--enable-dist-wtd-comp=0", + "--enable-diff-wtd-comp=0", + "--enable-onesided-comp=0", + "--enable-interintra-wedge=0", + "--enable-smooth-interintra=0", + "--enable-ab-partitions=0", + "--enable-1to4-partitions=0", + "--enable-cdef=0", + "--enable-restoration=0", + "--enable-palette=0", + "--enable-intrabc=0", + "--enable-ref-frame-mvs=0", + // Per-arm overrides go LAST (aomenc keeps the LAST + // occurrence of a repeated --enable-* flag). The three + // chroma intra tools this gate is about, plus the fences + // that keep the leaf's SIBLING refusals (its TX_4X4 + // split, a nonzero angle delta, sub-16 rect inter leaves) + // out of the way. + "--enable-cfl-intra=1", + "--enable-smooth-intra=1", + "--enable-paeth-intra=1", + "--enable-directional-intra=1", + "--enable-angle-delta=0", + "--enable-tx-size-search=0", + "--enable-rect-partitions=0", + "--min-partition-size=8", + "--max-partition-size=32", + "--obu", + "-o", + "-", + ]) + .arg(&y4m_path) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + let out = child.wait_with_output().expect("aomenc failed to run"); + let _ = std::fs::remove_file(&y4m_path); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + let before = decode::intra_in_inter8_uv_hits(); + let frames = match decode_stream(&stream) { + Ok(frames) => frames, + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "{name} decode failed outright (seed {seed}): {msg}" + ); + refusals.push(format!("seed {seed}: {msg}")); + continue; + } + }; + let now = decode::intra_in_inter8_uv_hits(); + // class [[counter-from-refused-stream]]: per-attempt deltas, and + // only for an attempt that decoded to the end and is pixel- + // compared below. + let fired = (now.0 - before.0, now.1 - before.1, now.2 - before.2); + totals = ( + totals.0 + fired.0, + totals.1 + fired.1, + totals.2 + fired.2, + ); + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded + // is ALWAYS pixel-compared; the counter only decides whether the + // attempt counts as firing. + let counted = fired.0 + fired.1 + fired.2 != 0; + if !counted { + uncounted_exact += 1; + refusals.push(format!( + "seed {seed}: decoded and pixel-compared, but no 8x8 intra leaf in an inter \ + frame carried a non-DC uv_mode" + )); + } + let ffmpeg_frames = if bit_depth == 10 { + ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) + } else { + ffmpeg_decode_sequence(&stream, width, height, frame_count) + }; + assert_eq!(frames.len(), frame_count); + eprintln!( + "{name} seed={seed} {cq}: 8x8 intra-in-inter leaves with a non-DC uv_mode -- \ + directional {}, smooth/paeth {}, CfL {}", + fired.0, fired.1, fired.2 + ); + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { + for (plane, (g, w)) in [ + ("Y", (&got.y, &want.y)), + ("U", (&got.u, &want.u)), + ("V", (&got.v, &want.v)), + ] { + let stride = if plane == "Y" { width } else { width / 2 }; + if let Some(at) = g.iter().zip(w.iter()).position(|(a, b)| a != b) { + eprintln!( + "{name} seed={seed}: frame {i} {plane} first diff at ({}, {}) got {} \ + want {} ({} samples differ)", + at % stride, + at / stride, + g[at], + w[at], + g.iter().zip(w.iter()).filter(|(a, b)| a != b).count(), + ); + } + } + } + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { + assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg (seed {seed})"); + assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})"); + assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); + } + if counted { + gate_buckets( + &name, + 1, + uncounted_exact, + refusals.len() - uncounted_exact as usize, + ); + return; + } + } + gate_buckets( + &name, + 0, + uncounted_exact, + refusals.len() - uncounted_exact as usize, + ); + panic!( + "{name} never observed a non-DC uv_mode on an 8x8 intra leaf in an inter frame \ + (totals dir/smooth/cfl {totals:?}):\n{}", + refusals.join("\n") + ); + } + + /// lane-chroma r2 stage 1: a real aomenc key frame with /// `--enable-smooth-intra=1` (opposite of every sibling recipe's `=0`) /// and `--enable-paeth-intra=0` -- paeth chroma stays off so the still- diff --git a/lanes/uv8-r1.handoff.md b/lanes/uv8-r1.handoff.md new file mode 100644 index 00000000..62b181fc --- /dev/null +++ b/lanes/uv8-r1.handoff.md @@ -0,0 +1,64 @@ +# lane-uv8 r1 — HANDOFF (RED: implemented, NOT gated) + +## What is implemented (`crates/ec-av1/src/decode.rs`, `decode_inter_block8`'s intra arm) +Mirrors libaom `read_intra_block_mode_info` (`av1/decoder/decodemv.c:1178-1220`, read from +`~/.cache/aom-oracle/src`) for an INTRA 8x8 leaf inside an INTER frame: + +- `uv_mode` over the CFL-allowed alphabet (`cdfs.uv_mode_cfl[mode]`; BLOCK_8X8 is inside + `is_cfl_allowed`'s 32x32 bound), then `read_cfl_alphas` when `UV_CFL_PRED`, then + `angle_delta_uv` off `angle_delta[uv_mode - V_PRED]` (`get_uv_mode` is the identity over + `V_PRED..=D67_PRED`) — the exact order libaom reads them in. +- `uv_predict_mode = get_uv_mode(uv_mode)`; chroma prediction, chroma `default_tx_type` + (`read_plane`'s `predict_mode` arg → `default_intra_tx_type`, DCT for CfL) and the CfL AC + (`cfl_ac_q3(y, px, py, 8)` over the leaf's 4x4 chroma) all take it. +- `smooth_neighbor_uv` from `Neighbours::smooth_uv_neighbour(leaf_mi.0, leaf_mi.1, r, c)` + (chroma edge filter reads the CHROMA neighbour's uv_mode — reconintra.c:974), and the leaf's + LUMA `smooth_neighbor` from `modes_above_left_mi` (it passed a hardcoded `false` before). +- `palette_uv_mode` is now read only when `uv_mode == DC_PRED` (`read_palette_mode_info`); + it was read unconditionally, harmless only because every non-DC uv_mode was refused. +- Tail: the leaf now stamps its mode bands (`above_uv_mode[c]`/`left_uv_mode[r]`, + `record_mode_mi`, `record_uv_mode_mi`, 2x2 mi) — it stamped none at all, so a neighbour read + a stale coarse SUB slot. An inter leaf stamps `DC_PRED`, what libaom stores. +- New per-leaf counters `decode::intra_in_inter8_uv_hits() -> (dir, smooth/paeth, cfl)`. + +## Refusal state +`"a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)"` is REMOVED +from decode.rs and from `refusal_inventory.rs::CAPABILITY_CLAIMS`. **This lift is NOT gated** — +see below. If the next round cannot gate it, restoring both lines is the honest move. + +## Gate (written, never observed a firing attempt) +`stream.rs::uv_mode_in_inter8_gate(bit_depth, tile_columns)` + 3 tests (8-bit, 10-bit, 2-tile): +192x128, 8 frames, mandelbrot zoom + hard cut at frame 4 + seeded `noise`, chroma NOT +desaturated, 30 attempts, cq 12..40, `--min-partition-size=8 --max-partition-size=32 +--sb-size=64 --enable-cfl-intra=1 --enable-smooth-intra=1 --enable-paeth-intra=1 +--enable-directional-intra=1`, per-attempt counter deltas, every decode-order frame compared, +no SKIP on decode error. The y4m goes through a temp FILE: feeding aomenc on stdin while its +~100 KB OBU fills the stdout pipe DEADLOCKS (measured, 3 min into attempt 0). + +RESULT: 8-bit arm ran, 30/30 attempts REFUSED, 0 compared → the gate fails as designed. + +## The blocker (pre-existing, NOT this round's change) +Every `--min-partition-size=8` inter stream refuses. `--min-partition-size=16` on the same +recipe decodes 8/8 frames. The refusals name tools the encoder was explicitly told to disable: +`--enable-rect-partitions=0 --enable-ab-partitions=0 --enable-1to4-partitions=0` yet we refuse +"an inter 16x16-level AB or 1:4 partition" / "a non-skip rectangular strip"; and +`--enable-angle-delta=0` yet we refuse "a nonzero angle delta on an 8x8 intra leaf". Class +[[refusal-from-own-desync]]: those are our own desync, not encoder output. +Ablation: the same refusals appear with `--enable-cfl-intra=0 --enable-smooth-intra=0 +--enable-paeth-intra=0 --enable-directional-intra=0`, where this round's code is inert → +the desync is INDEPENDENT of this round. +The KEY frame of the same recipe (`--limit=1`, min8) decodes PIXEL-EXACT vs aomdec +(md5 860b50e830271fa57fb60e4a76eb83ec both) — so the 8x8 leaf's key-frame path is fine and the +divergence is in an INTER frame. + +## Exact next step +Bisect the first inter-frame divergence with the oracle mode ladder. Note the trace semantics +(cost this round an hour): oracle `EC_IMODE` = KEY-frame blocks only, oracle `EC_MODE` = +INTER blocks only (an intra block inside an inter frame prints NEITHER), while ours prints +`EC_MODE` for EVERY block of an inter frame. So the oracle's `EC_MODE` (mi_row, mi_col) +sequence must be an ordered SUBSEQUENCE of ours; the first ref entry that ours never produces +is the first structurally divergent block. On `~/.cache/uv8-tmp/o.obu` (recipe above, cq 26, +cpu-used 0) that subsequence match stops after 79 of the ref's frame-1 entries, with ref next +at mi (12,8) — start there with a range ladder (compare RANGE, never tell()). +Scripts: `~/.cache/uv8-tmp/{in.y4m,sweep.sh,sweep2.sh,sweep3.sh}`; probe +`$HOME/.cache/cargo-target-uv8/debug/examples/decode_probe [out.yuv]`.