diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index eac88c71..b23caf97 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -71,6 +71,20 @@ pub(crate) fn filter_intra_hits() -> usize { FILTER_INTRA_HITS.with(|c| c.get()) } +// lane-fiinter r1: how many of those `use_filter_intra == 1` symbols belonged +// to an INTRA block inside an INTER frame (`read_intra_block_mode_info`'s own +// `read_filter_intra_mode_info` call), which no gate exercised before this +// round -- every inter gate recipe passed `--enable-filter-intra=0`. +thread_local! { + static INTRA_IN_INTER_FILTER_INTRA_HITS: std::cell::Cell = + const { std::cell::Cell::new(0) }; +} + +/// Current value of [`INTRA_IN_INTER_FILTER_INTRA_HITS`]. +pub(crate) fn intra_in_inter_filter_intra_hits() -> usize { + INTRA_IN_INTER_FILTER_INTRA_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) @@ -882,6 +896,11 @@ thread_local! { // frame-constant. static TX_SELECT_INTER: std::cell::Cell = const { std::cell::Cell::new(false) }; static REDUCED_TX_SET_INTER: std::cell::Cell = const { std::cell::Cell::new(true) }; + // lane-fiinter r1: this sequence header's own `enable_filter_intra` bit, + // frame-constant like the two above and stashed the same way -- an intra + // block inside an inter frame reads `use_filter_intra` under it. + static ENABLE_FILTER_INTRA_INTER: std::cell::Cell = + const { std::cell::Cell::new(false) }; } /// Current value of [`TXFM_SPLIT_READS`]. @@ -894,10 +913,16 @@ pub(crate) fn txfm_split_hits() -> usize { TXFM_SPLIT_HITS.with(|c| c.get()) } -/// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`]. -pub(crate) fn set_inter_tx_mode(tx_select: bool, reduced_tx_set: bool) { +/// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`]/ +/// [`ENABLE_FILTER_INTRA_INTER`]. +pub(crate) fn set_inter_tx_mode( + tx_select: bool, + reduced_tx_set: bool, + enable_filter_intra: bool, +) { TX_SELECT_INTER.with(|c| c.set(tx_select)); REDUCED_TX_SET_INTER.with(|c| c.set(reduced_tx_set)); + ENABLE_FILTER_INTRA_INTER.with(|c| c.set(enable_filter_intra)); } // How many `partition_w16` reads (a 16x16 block's own partition symbol, key @@ -1262,6 +1287,19 @@ pub(crate) fn palette_split_tx_hits() -> usize { PALETTE_SPLIT_TX_HITS.with(|c| c.get()) } +// lane-intrainter r1: intra blocks inside an INTER frame whose `tx_depth` +// symbol split their luma transform, bucketed by block side (8, 16, 32, 64) -- +// the gate's proof that the lifted path actually ran, per size. +thread_local! { + static INTRA_IN_INTER_SPLIT_TX_HITS: std::cell::Cell<[usize; 4]> = + const { std::cell::Cell::new([0; 4]) }; +} + +/// Current value of [`INTRA_IN_INTER_SPLIT_TX_HITS`], indexed 8/16/32/64. +pub(crate) fn intra_in_inter_split_tx_hits() -> [usize; 4] { + INTRA_IN_INTER_SPLIT_TX_HITS.with(std::cell::Cell::get) +} + thread_local! { /// A just-decoded palette-Y block's own predicted pixels /// (`side*side`, row-major, `colors[map[i]]`), consumed by @@ -10036,27 +10074,40 @@ fn read_block_tx_size( let tx = if is_inter { side.min(64) } else { - let resolved = read_tx_size( + read_tx_size( dec, cdfs, n, at_mi, side, Some(tx_size_context_txfm(n, at_mi, side)), - ); - if resolved != side { - // An intra block inside an inter frame whose `tx_depth` splits its - // luma transform needs the per-transform-unit intra prediction - // loop `decode_block` runs for a key frame; this path predicts the - // whole block at once, so refuse rather than mis-reconstruct. - return Err(unsupported( - "an intra block in an inter frame whose tx_depth splits its luma transform \ - (round 1)", - )); - } - resolved + ) }; set_txfm_ctxs(n, at_mi, tx, side_mi, side_mi, skip && is_inter); + if !is_inter && tx != side { + // lane-intrainter r1: an intra block inside an inter frame whose + // `tx_depth` split its luma transform codes exactly the key-frame + // split path's transform units (`decode_block`'s multi-TU loop), + // raster order over the block. Handed back in the same leaf shape the + // inter var-tx tree uses, so the caller's per-TU luma loop, the + // `record_split_luma` neighbour write-back and the per-TU deblock + // edges are the ones it already runs for a var-tx inter block. A + // caller that has no per-TU intra loop (the 8x8 leaf) refuses on + // seeing `Some` here. + let step = tx / MI; + let mut leaves = Vec::new(); + for row in (0..side_mi).step_by(step) { + for col in (0..side_mi).step_by(step) { + leaves.push((row, col, tx)); + } + } + INTRA_IN_INTER_SPLIT_TX_HITS.with(|c| { + let mut h = c.get(); + h[(side.trailing_zeros() as usize).saturating_sub(3).min(3)] += 1; + c.set(h); + }); + return Ok((tx, Some(leaves))); + } Ok((tx, None)) } @@ -16020,6 +16071,24 @@ fn decode_inter_block( )); } } + // lane-fiinter r1: `read_filter_intra_mode_info` (libaom `decodemv.c`, + // the tail of `read_intra_block_mode_info`) -- an intra block inside + // an INTER frame reads `use_filter_intra` in exactly the same place a + // key-frame block does, right after the palette syntax. Nothing read + // it here before this round, and aomenc enables filter intra by + // default, so every inter frame carrying one desynced at this symbol. + // `av1_filter_intra_allowed`'s `palette_size[0] == 0` term is implied: + // a real palette-Y block already returned above. + let mut filter_intra = None; + if mode == DC_PRED + && ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get) + && let Some(class) = filter_intra_size_class(side) + && dec.symbol(&mut cdfs.filter_intra[class]) != 0 + { + FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1)); + INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1)); + filter_intra = Some(dec.symbol(&mut cdfs.filter_intra_mode)); + } mode_for_tx = mode; block_filter = [3, 3]; ref_frame_for_lf = 0; @@ -16046,7 +16115,14 @@ fn decode_inter_block( } } - read_block_tx_size( + // lane-intrainter r1: an intra block in an inter frame reads the same + // `tx_depth` symbol a key-frame block does, and when it splits, the + // block codes one intra prediction + one coefficient set PER + // transform unit (`decode_block`'s multi-TU branch), not one for the + // whole block. The leaf list rides the existing `vartx_leaves` slot, + // whose tail already does the split-block neighbour write-back + // (`record_split_luma`) and the per-TU deblock edges. + vartx_leaves = read_block_tx_size( dec, cdfs, neighbours, @@ -16055,21 +16131,80 @@ fn decode_inter_block( (mi_cols as usize, mi_rows as usize), false, skip, - )?; + )? + .1; let reach = Reach::of(side, px, py, y.width, y.height); + let split_luma = vartx_leaves.is_some(); + if let Some(leaves) = vartx_leaves.clone() { + let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get); + for &(row, col, tx_px) in &leaves { + let tu_mi = (at_mi.0 + row, at_mi.1 + col); + let (tu_px, tu_py) = (px + col * MI, py + row * MI); + // A transform unit inside a block is not a block at that + // position (class from lane-palette2 r12): top-right / + // bottom-left availability is the block's, narrowed by the + // unit's own offset inside it. + let tu_reach = Reach::of_tu(side, side, col * MI, row * MI, tx_px, tx_px, reach); + let tu_grid = if skip { + y.reconstruct( + tu_px, + tu_py, + tx_px, + mode, + 0, + tu_reach, + &vec![0i32; tx_px * tx_px], + None, + filter_intra, + false, + ); + vec![0i32; tx_px * tx_px] + } else { + // The unit's bsize is smaller than the block it sits in, + // so `txb_skip_ctx` is the neighbour-magnitude table, not + // the lone-TU 0 (`get_txb_ctx_general`). + let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI); + read_plane( + dec, + cdfs, + txbset_for(tx_px, reduced), + &default_scan(tx_px), + 0, + neighbours.around_mi(tu_mi, tx_px)[0], + mode, + mode, + 0, + tu_reach, + y, + tu_px, + tu_py, + tx_px, + tx_px, + base_q_idx, + None, + filter_intra, + Some(tu_skip_ctx), + false, + )? + }; + neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid); + } + } if skip { - y.reconstruct( - px, - py, - side, - mode, - 0, - reach, - &vec![0i32; side * side], - None, - None, - false, - ); + if !split_luma { + y.reconstruct( + px, + py, + side, + mode, + 0, + reach, + &vec![0i32; side * side], + None, + filter_intra, + false, + ); + } let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); u.reconstruct( cpx, @@ -16100,28 +16235,35 @@ fn decode_inter_block( v_grid = vec![0i32; chroma_side * chroma_side]; } else { let around = neighbours.around(at, side); - luma_grid = read_plane( - dec, - cdfs, - luma_set_intra, - scan_luma, - 0, - around[0], - mode, - mode, - 0, - reach, - y, - px, - py, - side, - luma_tx, - base_q_idx, - None, - None, - None, - false, - )?; + luma_grid = if split_luma { + // Already coded and reconstructed unit by unit above; the + // block-level grid is only the neighbour write-back's input, + // which `record_split_luma` ignores for plane 0. + vec![0i32; side * side] + } else { + read_plane( + dec, + cdfs, + luma_set_intra, + scan_luma, + 0, + around[0], + mode, + mode, + 0, + reach, + y, + px, + py, + side, + luma_tx, + base_q_idx, + None, + filter_intra, + None, + false, + )? + }; let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); u_grid = read_plane( dec, @@ -17539,6 +17681,24 @@ fn decode_inter_block8( )); } } + // lane-fiinter r1: `read_filter_intra_mode_info` (libaom `decodemv.c`, + // the tail of `read_intra_block_mode_info`) -- an intra block inside + // an INTER frame reads `use_filter_intra` in exactly the same place a + // key-frame block does, right after the palette syntax. Nothing read + // it here before this round, and aomenc enables filter intra by + // default, so every inter frame carrying one desynced at this symbol. + // `av1_filter_intra_allowed`'s `palette_size[0] == 0` term is implied: + // a real palette-Y block already returned above. + let mut filter_intra = None; + if mode == DC_PRED + && ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get) + && let Some(class) = filter_intra_size_class(SIDE) + && dec.symbol(&mut cdfs.filter_intra[class]) != 0 + { + FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1)); + INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1)); + filter_intra = Some(dec.symbol(&mut cdfs.filter_intra_mode)); + } mode_for_tx = mode; let (mi_row, mi_col) = leaf_mi; for dr in 0..2 { @@ -17562,7 +17722,11 @@ fn decode_inter_block8( } } - read_block_tx_size( + // lane-intrainter r1: the 8x8 leaf's own intra `tx_depth` can only + // resolve to TX_4X4, whose 2x2 unit grid this leaf path has no + // prediction loop for (the >=16x16 square path above does). Refuse by + // name rather than mis-reconstruct. + if read_block_tx_size( dec, cdfs, neighbours, @@ -17571,7 +17735,15 @@ fn decode_inter_block8( (mi_cols as usize, mi_rows as usize), false, skip, - )?; + )? + .1 + .is_some() + { + return Err(unsupported( + "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 \ + transform units", + )); + } let reach = Reach::of(SIDE, px, py, y.width, y.height); if skip { y.reconstruct( @@ -17583,7 +17755,7 @@ fn decode_inter_block8( reach, &vec![0i32; SIDE * SIDE], None, - None, + filter_intra, false, ); u.reconstruct( @@ -17633,7 +17805,7 @@ fn decode_inter_block8( TX8, base_q_idx, None, - None, + filter_intra, None, false, )?; @@ -17802,6 +17974,10 @@ pub fn decode_inter_frame_tile( false, false, DeltaParams::default(), + // `enable_filter_intra`: this crate's own encoder never writes the + // sequence bit (`encode.rs`), so no intra-in-inter block of a stream + // reaching this entry point reads a `use_filter_intra` symbol. + false, ) .map(|(picture, _, _)| picture) } @@ -17885,8 +18061,13 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( // same contract as [`decode_key_frame_tile_with_cdfs`]'s own `delta` // param -- only `q_present`/`q_res` are read. delta: DeltaParams, + // lane-fiinter r1: this sequence header's own `enable_filter_intra` bit + // (spec 5.5.2), stashed in a thread-local with `tx_select` rather than + // threaded through `decode_inter_block`'s fifty parameters -- read by the + // intra-in-inter arms' `read_filter_intra_mode_info`. + enable_filter_intra: bool, ) -> Result<(Picture, Cdfs, crate::motion_field::MotionField)> { - set_inter_tx_mode(tx_select, reduced_tx_set); + set_inter_tx_mode(tx_select, reduced_tx_set, enable_filter_intra); let tpl_frame = tpl_field.map(|field| TplFrameArgs { field, order_hint_bits, diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 9b59feb2..958dd46d 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -59,7 +59,11 @@ const REFUSALS: &[&str] = &[ "a reference picture whose height does not match this frame's own true size", "a show_existing_frame header naming an empty reference slot", "an inter var-tx tree with a leaf transform larger than 32x32", - "an intra block in an inter frame whose tx_depth splits its luma transform (round 1)", + // lane-intrainter r1 lifted the >=16x16 square case (per-TU intra + // prediction + coefficients, gate + // `a_real_aomenc_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact`); + // the 8x8 leaf's TX_4X4 2x2 grid is still refused here. + "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform units", "an inter frame with no key frame before it", "an inter SB-level partition type other than NONE or SPLIT (this decoder's inter tile path recurses a superblock only as SPLIT)", "an inter partition below 16x16 other than SPLIT (16x8/8x16 rect inter leaves are not coded yet)", diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 502f462d..cec5e0d6 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -691,6 +691,7 @@ pub fn decode_stream(data: &[u8]) -> Result> { header.allow_warped_motion, header.allow_screen_content_tools, header.delta, + enable_filter_intra, )?; // lane-superres r10: mirrors the key-frame branch above -- // `decode_inter_frame_tile_with_cdfs` decodes at the downscaled @@ -4180,6 +4181,511 @@ mod tests { ); } + /// lane-intrainter r1's decisive gate: a real aomenc INTER sequence in + /// which aomenc's RD picks an INTRA block inside an inter frame AND + /// splits that block's luma transform (`tx_depth >= 1`, the intra depth + /// symbol -- not the inter var-tx tree). That block codes one intra + /// prediction plus one coefficient set per transform unit, exactly like a + /// key frame's split block but with the inter frame's CDF state and the + /// inter-frame intra mode syntax; before this lane it was a named + /// refusal. Hard-asserts [`decode::intra_in_inter_split_tx_hits`] per + /// block size: an attempt that never produced such a block proves + /// nothing, and exhausting every attempt is a FAILURE, not a SKIP. + #[test] + fn a_real_aomenc_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact() { + intra_in_inter_split_tx_gate(8); + } + + /// The 10-bit arm (both of the user's films are `yuv420p10le`). + #[test] + fn a_real_aomenc_10bit_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact() { + intra_in_inter_split_tx_gate(10); + } + + fn intra_in_inter_split_tx_gate(bit_depth: u32) { + let name = format!("intra_in_inter_split_tx_gate({bit_depth})"); + 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) = (64usize, 64usize, 8usize); + let mut refusals = Vec::new(); + let mut uncounted_exact = 0u32; + for attempt in 0..40u32 { + let seed = 42 + attempt; + // A zooming fractal: every frame moves (so the sequence is + // genuinely inter-coded) and keeps sharp new detail entering at + // the borders, which is what makes aomenc's RD choose an INTRA + // block inside an inter frame -- and then split its transform. + // A zooming fractal with a hard CUT halfway (`overlay` switching + // a second, unrelated fractal on at frame 4): after the cut every + // block is unpredictable from the reference, which is what makes + // aomenc code INTRA blocks inside an inter frame -- and at this + // cq the RD then splits their transforms. + let source = format!( + "mandelbrot=size=64x64:start_scale={}:rate=25[a];\ + mandelbrot=size=64x64:start_scale={}:rate=25[b];\ + [a][b]overlay=enable='gte(n,4)'", + 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, + // Desaturated chroma keeps `uv_mode` on DC_PRED, so the + // still-refused directional-chroma gaps never fire and + // luma detail alone drives the transform split. + "-vf", + "hue=s=0", + "-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) + ); + let depth_args: &[&str] = if bit_depth == 10 { + &["-b", "10", "--input-bit-depth=10"] + } else { + &[] + }; + let mut child = Command::new(aomenc_path()) + .args(depth_args) + .args([ + "--codec=av1", + "--passes=1", + "--end-usage=q", + "--cq-level=30", + "--cpu-used=0", + "--lag-in-frames=0", + "--auto-alt-ref=0", + // One key frame only: every later frame is an inter frame, + // which is where this gate's intra blocks must sit. The + // MIN distance is what stops aomenc's scene-cut detector + // from inserting a second key frame at the cut this gate's + // source deliberately contains. + "--kf-max-dist=1000", + "--kf-min-dist=1000", + "--threads=1", + "--row-mt=0", + "--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-filter-intra=0", + "--enable-smooth-intra=0", + "--enable-paeth-intra=0", + "--enable-directional-intra=0", + "--enable-angle-delta=0", + "--enable-cdef=0", + "--enable-restoration=0", + "--enable-palette=0", + "--enable-intrabc=0", + "--enable-cfl-intra=0", + "--enable-ref-frame-mvs=0", + // Per-arm overrides go LAST (aomenc keeps the last + // occurrence of a repeated --enable-* flag): the intra + // tx_depth symbol only exists under TX_MODE_SELECT, and + // rect partitions are a separate named refusal. + "--enable-tx-size-search=1", + "--enable-rect-partitions=0", + "--max-partition-size=32", + // Sub-16 inter partitions are a separate named refusal, + // as is the 8x8 intra leaf's own TX_4X4 split. + "--min-partition-size=16", + "--obu", + "-o", + "-", + "-", + ]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + let before = decode::intra_in_inter_split_tx_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 after = decode::intra_in_inter_split_tx_hits(); + let mut per_size = [0usize; 4]; + for i in 0..4 { + per_size[i] = after[i] - before[i]; + } + // class [[gate-skips-on-its-own-failure]]: a decode that + // succeeded is ALWAYS pixel-compared below; the counter only + // decides whether the attempt counts as firing. + let counted = per_size.iter().sum::() != 0; + if !counted { + uncounted_exact += 1; + refusals.push(format!( + "seed {seed}: decoded and pixel-compared, but no intra block in an inter \ + frame split its transform" + )); + } + 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}: split intra-in-inter blocks 8x8={} 16x16={} 32x32={} \ + 64x64={}", + per_size[0], per_size[1], per_size[2], per_size[3] + ); + 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 split-transform intra block in an inter frame:\n{}", + refusals.join("\n") + ); + } + + /// lane-fiinter r1 (class [[symbol-consumption-gap]] + + /// [[tool-disabled-in-every-gate]]): a real aomenc inter sequence with + /// `--enable-filter-intra=1` (aomenc's own default -- every inter gate + /// recipe before this one pinned it OFF, so nothing ever exercised it) in + /// which the RD picks an INTRA block inside an inter frame and gives it + /// filter intra. `read_intra_block_mode_info` reads `use_filter_intra` + /// there exactly as a key frame does; this decoder read no such symbol at + /// all until this round, so such a stream desynced at that symbol and + /// decoded silently wrong. Hard-asserts + /// [`decode::intra_in_inter_filter_intra_hits`]: 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_filter_intra_on_an_intra_block_decodes_pixel_exact() { + filter_intra_in_inter_gate(8); + } + + /// The 10-bit arm (both of the user's films are `yuv420p10le`). + #[test] + fn a_real_aomenc_10bit_inter_sequence_with_filter_intra_on_an_intra_block_decodes_pixel_exact() + { + filter_intra_in_inter_gate(10); + } + + fn filter_intra_in_inter_gate(bit_depth: u32) { + let name = format!("filter_intra_in_inter_gate({bit_depth})"); + 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) = (64usize, 64usize, 8usize); + let mut refusals = Vec::new(); + let mut uncounted_exact = 0u32; + for attempt in 0..40u32 { + let seed = 42 + attempt; + // A zooming fractal: every frame moves (so the sequence is + // genuinely inter-coded) and keeps sharp new detail entering at + // the borders, which is what makes aomenc's RD choose an INTRA + // block inside an inter frame -- and then split its transform. + // A zooming fractal with a hard CUT halfway (`overlay` switching + // a second, unrelated fractal on at frame 4): after the cut every + // block is unpredictable from the reference, which is what makes + // aomenc code INTRA blocks inside an inter frame -- and at this + // cq the RD then splits their transforms. + let source = format!( + "mandelbrot=size=64x64:start_scale={}:rate=25[a];\ + mandelbrot=size=64x64:start_scale={}:rate=25[b];\ + [a][b]overlay=enable='gte(n,4)'", + 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, + // Desaturated chroma keeps `uv_mode` on DC_PRED, so the + // still-refused directional-chroma gaps never fire and + // luma detail alone drives the transform split. + "-vf", + "hue=s=0", + "-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) + ); + let depth_args: &[&str] = if bit_depth == 10 { + &["-b", "10", "--input-bit-depth=10"] + } else { + &[] + }; + let mut child = Command::new(aomenc_path()) + .args(depth_args) + .args([ + "--codec=av1", + "--passes=1", + "--end-usage=q", + "--cq-level=30", + "--cpu-used=0", + "--lag-in-frames=0", + "--auto-alt-ref=0", + // One key frame only: every later frame is an inter frame, + // which is where this gate's intra blocks must sit. The + // MIN distance is what stops aomenc's scene-cut detector + // from inserting a second key frame at the cut this gate's + // source deliberately contains. + "--kf-max-dist=1000", + "--kf-min-dist=1000", + "--threads=1", + "--row-mt=0", + "--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-smooth-intra=0", + "--enable-paeth-intra=0", + "--enable-directional-intra=0", + "--enable-angle-delta=0", + "--enable-cdef=0", + "--enable-restoration=0", + "--enable-palette=0", + "--enable-intrabc=0", + "--enable-cfl-intra=0", + "--enable-ref-frame-mvs=0", + // Per-arm overrides go LAST (aomenc keeps the last + // occurrence of a repeated --enable-* flag): the intra + // tx_depth symbol only exists under TX_MODE_SELECT, and + // rect partitions are a separate named refusal. + "--enable-filter-intra=1", + "--enable-tx-size-search=1", + "--enable-rect-partitions=0", + "--max-partition-size=32", + // Sub-16 inter partitions are a separate named refusal, + // as is the 8x8 intra leaf's own TX_4X4 split. + "--min-partition-size=16", + "--obu", + "-o", + "-", + "-", + ]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + let before = decode::intra_in_inter_filter_intra_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 fired = decode::intra_in_inter_filter_intra_hits() - before; + // class [[gate-skips-on-its-own-failure]]: a decode that + // succeeded is ALWAYS pixel-compared below; the counter only + // decides whether the attempt counts as firing. + let counted = fired != 0; + if !counted { + uncounted_exact += 1; + refusals.push(format!( + "seed {seed}: decoded and pixel-compared, but no intra block in an inter \ + frame used filter intra" + )); + } + 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}: filter-intra blocks inside inter frames = {fired}" + ); + 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 filter-intra intra block in an inter frame:\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/fiinter-r1.report.md b/lanes/fiinter-r1.report.md new file mode 100644 index 00000000..7d9e3119 --- /dev/null +++ b/lanes/fiinter-r1.report.md @@ -0,0 +1,95 @@ +# lane-fiinter r1 -- `use_filter_intra` on an intra block inside an inter frame + +Branch `lane-fiinter`, rebased onto main `eebf24e` (charter's base `lane-intrainter e841b2a` +replayed onto main; no conflicts). + +## Premise, re-measured + +`decode_inter_block`'s INTRA arm and `decode_inter_block8`'s 8x8 INTRA arm read +`y_mode` -> `angle_delta_y` -> `uv_mode` (+cfl/angle) -> palette and then went straight to +`read_block_tx_size` -- no `use_filter_intra` symbol at all, while libaom's +`read_intra_block_mode_info` (decodemv.c) ends with `read_filter_intra_mode_info` in exactly +that place, key frame or inter frame alike. Every inter gate recipe in `stream.rs` spelled +`--enable-filter-intra=0` (69 occurrences), so nothing had ever exercised it; aomenc's own +default is ON, so his films' inter frames desynced silently at the first such block. +Classes: [[symbol-consumption-gap]] + [[tool-disabled-in-every-gate]]. + +## What changed + +- `crates/ec-av1/src/decode.rs:64-80` -- `INTRA_IN_INTER_FILTER_INTRA_HITS` counter + + `intra_in_inter_filter_intra_hits()`, the gate's firing proof (the existing + `FILTER_INTRA_HITS` is also incremented, so the key-frame gates' deltas stay meaningful). +- `crates/ec-av1/src/decode.rs:830-856` -- `ENABLE_FILTER_INTRA_INTER` thread-local, set by + `set_inter_tx_mode(tx_select, reduced_tx_set, enable_filter_intra)`; same frame-constant + stash `TX_SELECT_INTER`/`REDUCED_TX_SET_INTER` already use rather than a 51st + `decode_inter_block` parameter. +- `crates/ec-av1/src/decode.rs:17497+` -- `decode_inter_frame_tile_with_cdfs` takes + `enable_filter_intra` (last param); `decode_inter_frame_tile` passes `false` (this crate's + encoder never writes the sequence bit), `stream.rs:694` passes the sequence header's bit. +- `crates/ec-av1/src/decode.rs:15578-15594` (>=16x16 square intra-in-inter arm) and + `:17188-17204` (8x8 leaf arm) -- `use_filter_intra` read via + `cdfs.filter_intra[filter_intra_size_class(side)]` right after the palette syntax, then + `filter_intra_mode`. `av1_filter_intra_allowed`'s `palette_size[0] == 0` term is implied (a + real palette-Y block already returned by refusal); `filter_intra_size_class` returns `None` + at 64x64, so no symbol is read there, matching `av1_filter_intra_allowed_bsize`. +- Same arms: `filter_intra` now threaded into every LUMA prediction/coefficient call -- + the per-TU split path (`y.reconstruct` and `read_plane` inside the `vartx_leaves` loop, + i.e. lane-intrainter's split-tx path), the whole-block skip `reconstruct`, and the + whole-block `read_plane`. Chroma keeps `None`, exactly as the key-frame square arm does. + `read_plane`'s own `FIMODE_TO_INTRADIR` mapping (decode.rs:7445) supplies the tx_type CDF + row per TU, so lane-tiny's filter-intra tx_type row fix applies here unchanged. + +## Gate + +`stream.rs:4438-4700`: +`a_real_aomenc_inter_sequence_with_filter_intra_on_an_intra_block_decodes_pixel_exact` (8-bit) +and `..._10bit_...` (10-bit), driven by `filter_intra_in_inter_gate(bit_depth)` -- the +intrainter recipe (mandelbrot + hard overlay cut at frame 4, cq30, `--kf-min-dist=1000`, +`--enable-tx-size-search=1`, `--max/min-partition-size=32/16`) with `--enable-filter-intra=1`. +The flag is spelled ONCE (the base `=0` deleted) so no aomenc precedence question arises; +arrival is proved decoder-side by the counter, per COMMON. Every decoded frame's Y/U/V is +compared against ffmpeg; a decode error is only accepted when its message contains +"unsupported"; running out of attempts panics (no SKIP). + +``` +CARGO_TARGET_DIR=$HOME/.cache/cargo-target-fiinter EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 \ + cargo test -p ec-av1 --lib filter_intra_on_an_intra_block -- --nocapture +``` + +EVIDENCE: $HOME/.cache/fiinter-suite.log | cargo test -p ec-av1 --lib filter_intra_on_an_intra_block | 8-bit seed 42: 11 filter-intra intra-in-inter blocks, 8 frames Y/U/V exact; 10-bit seed 47: 8 blocks, 8 frames exact; buckets counted-exact=1 uncounted-exact=0 + +EVIDENCE: negative control (`&& false` in front of both new reads, decode.rs restored after) | same gate command | 8-bit: 40/40 attempts, 0 firings, 33 named refusals + 7 decoded-uncounted -> PANIC. The gate is not vacuous: without the read the stream desyncs. + +EVIDENCE: mutation sweep (`sed 's/--enable-filter-intra=0/=1/g' stream.rs`, restored after) | `cargo test -p ec-av1 --lib inter_sequence` | 15 passed / 0 failed / 2 ignored (both pre-existing `#[ignore]`s: the 10-bit 8x8-leaf-split twin and the tile-column 8x8 gate) -- every inter gate that passed with filter intra OFF still passes with it ON, including `..._split_transform_intra_block_...` at both depths. + +## Refusals + +None lifted -- there was no refusal here, only an unread symbol (which is the worse shape: +`refusal_inventory.rs` is unchanged and stays green). `gate_coverage.rs` needs no edit: its +coverage is derived from the `--enable-*` spellings in the gate source, and the two new tests +spell `--enable-filter-intra=1` at 8 and 10 bit. + +## Residue + +- deferred(a directional-intra-in-inter gate): the `"a nonzero angle delta (this encoder never + writes one)"` refusal in both intra-in-inter arms stays. The symbol read itself is correct + (`cdfs.angle_delta[mode - V_PRED]`, compared to `ANGLE_DELTA_ZERO`), so lifting it is + mechanical -- but lifting a refusal without a gate that fires it is forbidden by COMMON, and + this lane's recipe pins `--enable-angle-delta=0`/`--enable-directional-intra=0` (a nonzero + delta would need its own source family). Unblocked by: an aomenc recipe that puts a + directional intra block with a nonzero delta inside an inter frame. +- accepted: the 8x8-leaf arm's read is size-generic and compiles/decodes, but no gate proves it + FIRED -- this gate pins `--min-partition-size=16`. The mutation sweep ran the 8x8-leaf-split + gates with filter intra ON and they stayed pixel-exact, which bounds the risk but does not + prove the symbol fired at 8x8. +- accepted: CfL/palette parity is unchanged from the key-frame arm -- a real palette-Y/UV block + still refuses by name before the filter-intra read, and `UV_CFL_PRED` chroma alphas are read + as before (filter intra is luma-only). + +## Suite + film + +`cargo test -p ec-av1 --lib` (systemd unit, log `$HOME/.cache/fiinter-suite.log`): **346 passed / 0 failed / 32 ignored**, 739 s. + +EVIDENCE: $HOME/.cache/fiinter-suite.log | systemd-run --user --unit=fiinter-suite ... cargo test -p ec-av1 --lib -j3 | test result: ok. 346 passed; 0 failed; 32 ignored + +EVIDENCE: scratchpad/hg-head.obu | cargo run -p ec-av1 --example decode_probe -- hg-head.obu | 18 frame headers parsed, now stops at `unsupported: AV1 tile (filter intra on a HORZ/VERT strip (this decoder predicts square-only))` -- i.e. his film really does carry filter intra, and the next blocker is the rect-strip filter-intra predictor (another lane), not the unread inter symbol this lane fixed. diff --git a/lanes/intrainter-r1.handoff.md b/lanes/intrainter-r1.handoff.md new file mode 100644 index 00000000..5fdcc828 --- /dev/null +++ b/lanes/intrainter-r1.handoff.md @@ -0,0 +1,70 @@ +# lane-intrainter r1 handoff + +Branch `lane-intrainter`, based on main `c729a38` (worktree was already at main's head; no rebase needed). +Code commit: `955ecf9` (`feat(av1): intra blocks in inter frames may split their luma transform`). + +## Implemented (all in `crates/ec-av1/src/decode.rs`) + +- `read_block_tx_size` (~9470): intra branch no longer refuses a split `tx_depth`. It calls + `set_txfm_ctxs` with the RESOLVED transform (so later blocks' txfm ctx is right) and returns + the transform-unit leaf list `(row_mi, col_mi, tx_px)` in raster order — the same shape the + inter var-tx tree returns. +- `decode_inter_block` intra arm (~15490): the leaves ride the existing `vartx_leaves` slot; a + per-TU loop predicts + codes each unit with `txbset_for(tx_px, reduced)` (INTRA tx set), + `default_scan(tx_px)`, `Reach::of_tu` (block-relative availability), `luma_skip_ctx` + (neighbour-magnitude txb_skip ctx, not the lone-TU 0), `around_mi`, `record_mi_luma`. + Skip blocks predict PER UNIT too (an intra block reads tx_depth even when skip). + Chroma is unchanged (its transform is not split). The function tail already ran + `record_split_luma` + per-TU deblock edges whenever `vartx_leaves.is_some()`. +- Inter-frame intra syntax differences all pre-existed in that arm and are unchanged: + `y_mode_cdf[size_group]` (not kf_y_mode), `uv_mode_cfl[mode]`, angle deltas, CfL alphas, + palette-mode probes; angle_delta_y is refused nonzero, filter intra is not read in this arm. +- Counter `INTRA_IN_INTER_SPLIT_TX_HITS` + `intra_in_inter_split_tx_hits() -> [usize;4]` + bucketed by block side 8/16/32/64, one increment per split block. + +## Sizes / refusals + +- Squares 16x16..64x64 through `decode_inter_block` are lifted (the code is size-generic). + OBSERVED FIRING: 16x16 only (12 blocks 8-bit, 1 block 10-bit). 32/64 buckets stayed 0 under + `--min/max-partition-size=16/32`; unproven above 16x16. +- NEW refusal (`decode_inter_block8`, ~17070, listed in refusal_inventory.rs:63 replacing the + lifted string): "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 + transform units" — that leaf path has no per-TU intra prediction loop. +- RECT intra strips in inter frames stay refused earlier ("an intra-coded HORZ/VERT strip needs + rectangular intra prediction this decoder does not code yet"), so no rect work was needed. + +## Gate state — PASSING, both depths + +`a_real_aomenc_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact` and +`a_real_aomenc_10bit_...` (`intra_in_inter_split_tx_gate` in stream.rs). +Real aomenc, 64x64, 8 frames, mandelbrot zoom with a HARD CUT at frame 4 +(`overlay=enable='gte(n,4)'`), `--kf-min-dist=1000 --kf-max-dist=1000` (stops the scene-cut +detector inserting a second key frame), cq 30, overrides appended LAST. All frames Y/U/V vs +ffmpeg; decode errors only continue if they contain "unsupported"; exhausting 40 attempts panics. + +Run: +`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-intrainter cargo test -p ec-av1 --lib -- split_transform_intra_block --nocapture` + +Result: 8-bit seed 45 `16x16=12`, 10-bit seed 72 `16x16=1`, 0 differing samples, both `ok`. +No entropy ladder was needed — no divergence was ever observed. + +## Suite + +`$HOME/.cache/intrainter-suite.log` (unit `intrainter-suite-1788315424.service`), completed after +the turn cap: `test result: ok. 341 passed; 0 failed; 31 ignored; 0 measured` in 457.31s. Nothing +further is owed on the suite. + + +## Film + +Both `.../b6d8a07f.../scratchpad/reelc-head.obu` and `.../cdc46329.../scratchpad/reelc5.obu` stop at +"a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here" (lane-rectchroma +territory), NOT at this lane's refusal — the wall string in the charter was not reproducible on +these extracts (matches an existing ledger dead-end line). + +## Exact next step + +1. Merge (suite already green). +2. Optional follow-up round: prove 32x32/64x64 split intra-in-inter blocks (raise + `--max-partition-size` to 64 and lower cq, assert the 32/64 buckets), and lift the 8x8 leaf's + TX_4X4 2x2 grid in `decode_inter_block8`. diff --git a/lanes/intrainter-r1.report.md b/lanes/intrainter-r1.report.md new file mode 100644 index 00000000..bba71ad7 --- /dev/null +++ b/lanes/intrainter-r1.report.md @@ -0,0 +1,63 @@ +# lane-intrainter r1 — intra blocks in inter frames with a split luma transform + +Branch `lane-intrainter` off main `c729a38` (worktree already at main's head; no rebase needed). +Commit: `955ecf9`. + +## What changed + +- `crates/ec-av1/src/decode.rs` `read_block_tx_size` (~9470): the intra branch no longer + refuses a `tx_depth` that resolves below the block side. It runs `set_txfm_ctxs` with the + resolved transform (so later blocks' txfm ctx is right) and returns the transform-unit leaf + list in the same `(row_mi, col_mi, tx_px)` shape the inter var-tx tree uses, raster order. +- `crates/ec-av1/src/decode.rs` `decode_inter_block` intra arm (~15490): the returned leaves ride + the existing `vartx_leaves` slot, and a per-TU loop predicts + codes each unit + (`txbset_for(tx_px, reduced)`, `default_scan(tx_px)`, `Reach::of_tu`, `luma_skip_ctx`, + `around_mi`, `record_mi_luma`) exactly as `decode_block`'s key-frame multi-TU branch does — + including the skip case, which predicts per unit rather than whole-block. Chroma is unchanged + (its transform is not split). The function tail already did `record_split_luma` and per-TU + deblock edges whenever `vartx_leaves.is_some()`, so intra split blocks inherit both. +- `crates/ec-av1/src/decode.rs` counter `INTRA_IN_INTER_SPLIT_TX_HITS` + + `intra_in_inter_split_tx_hits() -> [usize; 4]` (bucketed 8/16/32/64), incremented once per + split intra-in-inter block. +- `crates/ec-av1/src/decode.rs` `decode_inter_block8` (~17070): an 8x8 intra leaf whose depth + resolves to TX_4X4 has no per-TU intra loop in that path — refused by name. +- `crates/ec-av1/src/refusal_inventory.rs:63`: lifted string replaced by the narrower + `"an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform units"`. +- `crates/ec-av1/src/stream.rs`: new gate `intra_in_inter_split_tx_gate` + its 8/10-bit tests. + +## Gate + +`a_real_aomenc_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact` +and `..._10bit_...`. Real aomenc, 64x64, 8 frames, mandelbrot zoom with a HARD CUT at frame 4 +(`overlay=enable='gte(n,4)'` of a second fractal) so aomenc codes intra blocks inside an inter +frame; `--kf-min-dist=1000 --kf-max-dist=1000` stops the scene-cut detector inserting a second +key frame. Overrides (`--enable-tx-size-search=1`, `--enable-rect-partitions=0`, +`--max-partition-size=32`, `--min-partition-size=16`) are appended AFTER the base recipe +(last occurrence wins). Every decoded frame's Y, U and V are compared with ffmpeg; a decode +error only continues the attempt loop if it contains "unsupported"; exhausting all 40 attempts +is a panic, never a SKIP. + +Run: +`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-intrainter cargo test -p ec-av1 --lib -- split_transform_intra_block --nocapture` + +EVIDENCE: $HOME/.cache/intrainter-suite.log | aomenc cut-fractal stream, ours vs ffmpeg, all 8 frames Y/U/V | 8-bit seed 45: 12 split intra-in-inter 16x16 blocks, 0 differing samples; 10-bit seed 72: 1 such block, 0 differing samples + +## Suite + +`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-intrainter cargo test -p ec-av1 --lib` +(as user unit `intrainter-suite-1788315424.service`, log `$HOME/.cache/intrainter-suite.log`): +`test result: ok. 341 passed; 0 failed; 31 ignored; 0 measured` in 457.31s — includes every sibling +(inter_sequence*, tx_select, 8x8_leaf_split, split_transform_*, filter_intra_*, cfl, +refusal_inventory, gate_coverage). + +## Film + +`reelc-head.obu` and `reelc5.obu` both stop at "a coded HORZ/VERT strip whose chroma transform has no +rect coefficient tables here" (lane-rectchroma), not at this lane's refusal. + +## Residue + +- deferred(a follow-up arm at --max-partition-size=64 and a lower cq): 32x32/64x64 split + intra-in-inter blocks never fired; the per-TU loop is size-generic but unproven above 16x16. +- deferred(a per-TU intra loop inside decode_inter_block8): the 8x8 leaf's TX_4X4 2x2 grid, + now the narrower named refusal.