diff --git a/crates/ec-av1/examples/decode_probe.rs b/crates/ec-av1/examples/decode_probe.rs index 92c83905..fd3be17f 100644 --- a/crates/ec-av1/examples/decode_probe.rs +++ b/crates/ec-av1/examples/decode_probe.rs @@ -33,6 +33,11 @@ fn main() { println!("rect4_32: horz={h} vert={v} coded={c}"); let (rtu, rsplit, robmc) = ec_av1::stream::rect_inter_tu_counters(); println!("rect_inter: tu={rtu} txsplit={rsplit} obmc_leaf={robmc}"); + let i4 = ec_av1::stream::intra_rect4_in_inter_counters(); + println!( + "intra_rect4_in_inter: 64x16={} 16x64={} 32x8={} 8x32={}", + i4.0, i4.1, i4.2, i4.3 + ); let ir = ec_av1::stream::inter_rect_counters(); println!( "inter_rect: 32x8={} 8x32={} 64x32={} 32x64={} 64x16={} 16x64={}", diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 8f8db88b..81cea900 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -1882,6 +1882,33 @@ pub(crate) fn intra_rect_strip_in_inter_hits(class: usize) -> usize { INTRA_RECT_IN_INTER_HITS.with(|c| c.get()[class]) } +// lane-intra14 r1: how many intra-coded 1:4 strips decoded on the INTER +// block path, per shape -- [0] 64x16, [1] 16x64, [2] 32x8, [3] 8x32. Every +// one of them was the named refusal "an intra-coded 1:4 (or other non-2:1) +// rect strip on the inter block path" before this round. +thread_local! { + static INTRA_RECT4_IN_INTER_HITS: std::cell::Cell<[usize; 4]> = + const { std::cell::Cell::new([0; 4]) }; +} + +/// Current value of [`INTRA_RECT4_IN_INTER_HITS`] for one shape +/// (0 = 64x16, 1 = 16x64, 2 = 32x8, 3 = 8x32). +pub(crate) fn intra_rect4_strip_in_inter_hits(shape: usize) -> usize { + INTRA_RECT4_IN_INTER_HITS.with(|c| c.get()[shape]) +} + +// lane-intra14 r1: set while an INTRA block of an INTER frame is decoded +// through one of the key-frame rect readers ([`decode_block_rect4`], +// [`decode_block_rect64`]). `Some((size_group, skip))` tells +// [`read_intra_mode_rect`] that (a) `skip`/segment id/cdef/delta-q were +// already read by [`decode_inter_block`] and (b) the luma mode comes off +// `y_mode_cdf[size_group_lookup[bsize]]` (libaom `read_intra_block_mode_info`, +// decodemv.c:1189), never the key frame's above/left `kf_y_mode` pair. +thread_local! { + static INTRA_IN_INTER_MODE: std::cell::Cell> = + const { std::cell::Cell::new(None) }; +} + // lane-rectx r5: how many times a NON-strip `kf_y_mode` reader // ([`decode_block`], [`decode_block_rect`], [`decode_block_rect64`]) took an // above/left mode from the mi-exact map that DIFFERS from its coarse 16x16 @@ -5312,6 +5339,13 @@ fn read_intra_mode_rect( } }; } + // lane-intra14 r1: on the INTER block path everything up to and including + // `is_inter` was already read by [`decode_inter_block`], so this reader + // starts at the mode syntax with the `skip` that caller read. + let inter = INTRA_IN_INTER_MODE.with(std::cell::Cell::get); + let skip = if let Some((_, skip)) = inter { + skip + } else { // Same `intra_segment_id` placement as the square reader above. let (seg_w_mi, seg_h_mi) = (bw / 4, bh / 4); if seg_id_pre_skip() { @@ -5330,9 +5364,18 @@ fn read_intra_mode_rect( maybe_read_delta_q(dec, cdfs, mi_r, mi_c, false, skip); maybe_read_delta_lf(dec, cdfs, mi_r, mi_c, false, skip); istep!("dq", 0); - let above_ctx = INTRA_MODE_CTX[above_mode]; - let left_ctx = INTRA_MODE_CTX[left_mode]; - let mode = dec.symbol(&mut cdfs.kf_y_mode[above_ctx][left_ctx]); + skip + }; + // libaom `read_intra_block_mode_info` (decodemv.c:1189) vs the key + // frame's `read_intra_frame_mode_info` (decodemv.c:1065 `read_intra_mode` + // off `kf_y_mode_cdf[above][left]`). + let mode = if let Some((size_group, _)) = inter { + dec.symbol(&mut cdfs.y_mode[size_group]) + } else { + let above_ctx = INTRA_MODE_CTX[above_mode]; + let left_ctx = INTRA_MODE_CTX[left_mode]; + dec.symbol(&mut cdfs.kf_y_mode[above_ctx][left_ctx]) + }; istep!("mode", mode as i32); let angle_delta_y = if (V_PRED..=D67_PRED).contains(&mode) { read_angle_delta(dec, &mut cdfs.angle_delta[mode - V_PRED]) @@ -5982,9 +6025,18 @@ fn decode_intra_rect_in_inter( (8, 16) => (1usize, 1usize), (16, 32) => (2, 2), (32, 64) => (3, 3), + // lane-intra14 r1: the 1:4 strips, read off libaom's own tables -- + // `size_group_lookup` (common_data.h:61) gives BLOCK_8X32/32X8 group + // 1 and BLOCK_16X64/64X16 group 2, while + // `bsize_to_tx_size_depth_table` (blockd.h:1347) gives them depth + // 3 and 4, i.e. tx categories 2 and 3 -- the diagonal a 2:1 strip + // keeps is genuinely broken here, which is why the shape was refused + // rather than read from the 2:1 row. + (8, 32) => (1, 2), + (16, 64) => (2, 3), _ => { return Err(unsupported( - "an intra-coded 1:4 (or other non-2:1) rect strip on the inter block path", + "an intra-coded 16x4/4x16 strip on the inter block path (the 16x16-level 1:4 inter partition is refused before this point)", )) } }; @@ -5997,6 +6049,70 @@ fn decode_intra_rect_in_inter( is consumed for square blocks only)", )); } + // lane-intra14 r1: a 1:4 strip decodes through the very readers the KEY + // FRAME path already proves for this shape ([`decode_block_rect4`] at the + // 32 level, [`decode_block_rect64`] at 64 -- both already handle the 1:4 + // luma/chroma transform tables, the per-unit split walk and the strip's + // own neighbour records). The ONLY difference on an inter frame is the + // mode-info read, which [`INTRA_IN_INTER_MODE`] switches to + // `read_intra_block_mode_info`'s `y_mode[size_group]` plus the `skip` + // this caller already read. `tx_cat` above is the same category those + // readers hardcode (cat 2 in `decode_block_rect4`, cat 3 in + // `decode_block_rect64`), asserted here so a future shape cannot drift. + if bw.max(bh) == 4 * bw.min(bh) { + debug_assert_eq!(tx_cat, if bw.max(bh) == 64 { 3 } else { 2 }); + INTRA_IN_INTER_MODE.with(|c| c.set(Some((size_group, skip)))); + let res = if bw.max(bh) == 64 { + decode_block_rect64( + dec, + cdfs, + neighbours, + (mi_r / (SUB / MI), mi_c / (SUB / MI)), + bw, + bh, + y, + u, + v, + ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get), + allow_screen_content_tools, + base_q_idx, + TX_SELECT_INTER.with(std::cell::Cell::get), + REDUCED_TX_SET_INTER.with(std::cell::Cell::get), + ) + } else { + decode_block_rect4( + dec, + cdfs, + neighbours, + (mi_r, mi_c), + bw, + bh, + None, + y, + u, + v, + ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get), + allow_screen_content_tools, + base_q_idx, + TX_SELECT_INTER.with(std::cell::Cell::get), + ) + .map(|_| ()) + }; + INTRA_IN_INTER_MODE.with(|c| c.set(None)); + res?; + let shape = match (bw, bh) { + (64, 16) => 0, + (16, 64) => 1, + (32, 8) => 2, + _ => 3, + }; + INTRA_RECT4_IN_INTER_HITS.with(|h| { + let mut v = h.get(); + v[shape] += 1; + h.set(v); + }); + return Ok(()); + } let mode = dec.symbol(&mut cdfs.y_mode[size_group]); if mode >= 13 { return Err(unsupported( diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index cb1b26ea..5fc134be 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -73,7 +73,7 @@ const REFUSALS: &[&str] = &[ // inter path's intra arm now routes 2:1 strips through `decode_rect_split`); // what is left is the 1:4 shape, whose `bsize_to_tx_size_cat` breaks the // size-group/category diagonal the 2:1 shapes share. - "an intra-coded 1:4 (or other non-2:1) rect strip on the inter block path", + "an intra-coded 16x4/4x16 strip on the inter block path (the 16x16-level 1:4 inter partition is refused before this point)", "a split (nonzero tx_depth) transform on an intra HORZ/VERT strip in an inter frame", // The same arm's screen-content gate: palette/intrabc syntax is consumed // for square blocks only, so a strip in such a frame would skip symbols. diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 3bde2750..af974805 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -68,6 +68,18 @@ pub fn inter_rect_counters() -> (usize, usize, usize, usize, usize, usize) { ) } +/// lane-intra14 r1: INTRA-coded 1:4 strips decoded on the INTER block path +/// (64x16, 16x64, 32x8, 8x32) -- the counters a recipe sweep needs from +/// outside the crate. +pub fn intra_rect4_in_inter_counters() -> (usize, usize, usize, usize) { + ( + crate::decode::intra_rect4_strip_in_inter_hits(0), + crate::decode::intra_rect4_strip_in_inter_hits(1), + crate::decode::intra_rect4_strip_in_inter_hits(2), + crate::decode::intra_rect4_strip_in_inter_hits(3), + ) +} + pub fn rect4_32_counters() -> (usize, usize, usize) { ( crate::decode::rect4_32_horz_hits(), @@ -4570,6 +4582,294 @@ mod tests { ); } + /// lane-intra14 r1's decisive gate: a real aomenc INTER sequence with + /// `--enable-1to4-partitions=1`, whose fast-zooming content makes aomenc + /// code INTRA blocks inside inter frames on 1:4 strip shapes (32x8/8x32 at + /// the 32 level, 64x16/16x64 at the superblock level). Every such block + /// was the named refusal "an intra-coded 1:4 (or other non-2:1) rect strip + /// on the inter block path" until this round; they now decode through the + /// same `decode_block_rect4` / `decode_block_rect64` readers the KEY FRAME + /// 1:4 paths already prove, with only the mode-info read switched to + /// `read_intra_block_mode_info` (libaom decodemv.c:1189). + /// + /// Hard-asserts `intra_rect4_strip_in_inter_hits` (0 = 64x16, 1 = 16x64, + /// 2 = 32x8, 3 = 8x32) summed over the attempts that were actually + /// pixel-compared, and every decode-order frame is compared. A decode that + /// succeeds is ALWAYS pixel-compared (class + /// [[gate-skips-on-its-own-failure]]); exhausting every attempt without a + /// counted strip is a FAILURE, never a SKIP. + #[test] + // MEASURED (r1, 40 gate attempts + 150 recipe-sweep attempts, see + // lanes/intra14-r1.report.md): on THIS tree every aomenc stream that + // carries an intra 1:4 strip inside an inter frame ALSO carries a + // non-skip INTER 2:1 rect strip / SB-level AB partition / sub-8 inter + // partition, each refused by name by another lane's surface before the + // frame completes -- so no attempt can be pixel-compared yet and this + // gate cannot pass. It is `#[ignore]`d rather than weakened; un-ignore + // it (and re-run) once the inter rect-leaf lane lands. + #[ignore = "blocked: every stream with an intra 1:4 strip also hits the inter rect-strip refusal"] + fn a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact() { + intra_rect4_in_inter_gate(8); + } + + /// The 10-bit arm (both of the user's films are `yuv420p10le`). + #[test] + // MEASURED (r1, 40 gate attempts + 150 recipe-sweep attempts, see + // lanes/intra14-r1.report.md): on THIS tree every aomenc stream that + // carries an intra 1:4 strip inside an inter frame ALSO carries a + // non-skip INTER 2:1 rect strip / SB-level AB partition / sub-8 inter + // partition, each refused by name by another lane's surface before the + // frame completes -- so no attempt can be pixel-compared yet and this + // gate cannot pass. It is `#[ignore]`d rather than weakened; un-ignore + // it (and re-run) once the inter rect-leaf lane lands. + #[ignore = "blocked: every stream with an intra 1:4 strip also hits the inter rect-strip refusal"] + fn a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact_10bit() { + intra_rect4_in_inter_gate(10); + } + + fn intra_rect4_in_inter_gate(bit_depth: u32) { + const NAME: &str = + "a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact"; + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let (width, height, frame_count) = (192usize, 128usize, 8usize); + let mut refusals: Vec = Vec::new(); + let mut uncounted_exact = 0u32; + let mut compared = 0u32; + let mut shapes = [0usize; 4]; + for attempt in 0..40u32 { + let seed = 42 + attempt; + // Same source class as the 2:1 sibling gate: a FAST mandelbrot + // zoom (`end_scale`/`end_pts`) so consecutive frames share almost + // no content and aomenc's RD codes blocks INTRA inside INTER + // frames, with `--kf-min-dist=1000` forbidding a new key frame. + let source = format!( + "mandelbrot=size={width}x{height}:start_scale={}:end_scale=0.004:end_pts=8:rate=25", + 5.0 - f64::from(attempt) * 0.06 + ); + let y4m = Command::new("ffmpeg") + .args([ + "-v", "error", "-f", "lavfi", "-i", &source, "-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 { + &[] + }; + // MEASURED (r1, 40 attempts): `--cpu-used=0` makes aomenc pick + // 128x128 superblocks on this frame size, which decode_stream + // refuses by name, so the preset sweep starts at 1. + let cpu = format!("--cpu-used={}", 1 + attempt % 4); + // The higher the quantiser the more 1:4 intra strips inside inter + // frames, so the sweep walks cq 63 first. + let cq = format!("--cq-level={}", [63u32, 55, 45, 35][(attempt / 4) as usize % 4]); + let mut child = Command::new(aomenc_path()) + .args(depth_args) + .arg(&cpu) + .arg(&cq) + .args([ + // Every flag spelled exactly once (class + // [[aomenc-last-flag-wins]]). These are what the gate is + // about: 1:4 partitions ON, min size 16 so the 16x16-level + // 1:4 (refused elsewhere) is out of reach. + "--enable-rect-partitions=1", + "--enable-1to4-partitions=1", + // MEASURED (r1): at `--min-partition-size=16` aomenc codes + // 16x16-level 1:4 partitions (16x4/4x16 strips), which the + // inter partition path refuses by name (another lane's + // surface) in 12/40 attempts. 32 keeps this gate's two + // reachable levels -- the 32-level 32x8/8x32 and the + // superblock-level 64x16/16x64 -- and nothing else. + "--min-partition-size=32", + "--max-partition-size=64", + // MEASURED (r1): with tx-size search ON, 8/40 attempts stop + // at the 2:1 strip's own split-tx refusal (merge-cross-product, + // another lane's surface) before a 1:4 strip is reached. + "--enable-tx-size-search=0", + "--enable-filter-intra=1", + "--enable-intra-edge-filter=1", + "--codec=av1", + "--passes=1", + "--end-usage=q", + "--lag-in-frames=0", + "--auto-alt-ref=0", + "--kf-min-dist=1000", + "--kf-max-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-smooth-intra=0", + "--enable-paeth-intra=0", + "--enable-directional-intra=0", + "--enable-angle-delta=0", + "--enable-cdef=0", + "--enable-restoration=0", + // Ledger dead-end (lane-r14): a NEW gate spelling + // `--enable-cfl-intra=1` retires that tool from + // `NEVER_EXERCISED_8BIT` on the flag alone while no CfL + // hit counter exists to assert -- so it stays 0 here. + // Palette stays 0 for the same class of reason: this arm + // refuses a screen-content frame whole, so a palette flag + // would buy no coverage. + "--enable-palette=0", + "--enable-intrabc=0", + "--enable-cfl-intra=0", + "--enable-ref-frame-mvs=0", + "--obu", + "-o", + "-", + "-", + ]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + let before: Vec = + (0..4).map(decode::intra_rect4_strip_in_inter_hits).collect(); + let frames = match decode_stream(&stream) { + Ok(frames) => frames, + Err(e) => { + let msg = e.to_string(); + assert!( + msg.contains("unsupported"), + "intra-1:4-in-inter decode failed outright (seed {seed}): {msg}" + ); + refusals.push(format!("seed {seed} {cpu} {cq}: {msg}")); + continue; + } + }; + let delta: Vec = (0..4) + .map(|k| decode::intra_rect4_strip_in_inter_hits(k) - before[k]) + .collect(); + 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!( + "intra14 gate {bit_depth}-bit seed={seed} {cpu} {cq}: intra 1:4 strips in inter \ + frames 64x16={} 16x64={} 32x8={} 8x32={}", + delta[0], delta[1], delta[2], delta[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) { + let maxd = g + .iter() + .zip(w.iter()) + .map(|(a, b)| i32::from(*a).abs_diff(i32::from(*b))) + .max() + .unwrap_or(0); + eprintln!( + "intra14 gate {bit_depth}-bit seed={seed}: frame {i} {plane} first \ + diff at ({}, {}) got {} want {} ({} samples differ, max |d|={maxd})", + at % stride, + at / stride, + g[at], + w[at], + g.iter().zip(w.iter()).filter(|(a, b)| a != b).count(), + ); + } + assert_eq!(g, w, "{plane} vs ffmpeg (seed {seed}, frame {i})"); + } + } + compared += 1; + if delta.iter().all(|d| *d == 0) { + uncounted_exact += 1; + refusals.push(format!( + "seed {seed} {cpu} {cq}: decoded and pixel-compared, but no intra 1:4 strip on \ + the inter path" + )); + } + for k in 0..4 { + shapes[k] += delta[k]; + } + // Both LEVELS (32 and 64) is the bar; orientation is whichever the + // encoder picks. + if shapes[0] + shapes[1] > 0 && shapes[2] + shapes[3] > 0 { + break; + } + } + gate_buckets( + NAME, + compared - uncounted_exact, + uncounted_exact, + refusals.len() - uncounted_exact as usize, + ); + eprintln!( + "{NAME} ({bit_depth}-bit): compared {compared} streams, intra 1:4 strips in inter \ + frames: 64x16={} 16x64={} 32x8={} 8x32={}; refusals:\n{}", + shapes[0], + shapes[1], + shapes[2], + shapes[3], + refusals.join("\n") + ); + assert!( + compared > 0, + "{NAME} ({bit_depth}-bit): every attempt hit a named refusal -- nothing was \ + pixel-compared:\n{}", + refusals.join("\n") + ); + assert!( + shapes[2] + shapes[3] > 0, + "{NAME} ({bit_depth}-bit): no 32-level intra 1:4 strip (32x8/8x32) fired over \ + {compared} compared streams (64x16={} 16x64={} 32x8={} 8x32={})", + shapes[0], + shapes[1], + shapes[2], + shapes[3] + ); + } + fn tx_select_inter_gate(bit_depth: u32) { if !have_ffmpeg() { eprintln!( diff --git a/lanes/intra14-r1.report.md b/lanes/intra14-r1.report.md new file mode 100644 index 00000000..09a01250 --- /dev/null +++ b/lanes/intra14-r1.report.md @@ -0,0 +1,105 @@ +# lane-intra14 r1 -- intra-coded 1:4 rect strips on the INTER block path + +Branch `lane-intra14` off main `7a47fc1`. **RED**: the decoder work is done and +demonstrably fires, but NO real-aomenc attempt on this tree can be +pixel-compared, so the lifted refusal is **ungated** and this branch MUST NOT +merge as-is. + +## What changed + +* `crates/ec-av1/src/decode.rs:5987` (`decode_intra_rect_in_inter`) -- the + `(size_group, tx_cat)` table gains the 1:4 rows `(8,32) -> (1,2)` and + `(16,64) -> (2,3)`, read off libaom `size_group_lookup` + (common_data.h:61) and `bsize_to_tx_size_depth_table` (blockd.h:1347). A 1:4 + strip then decodes through the KEY-FRAME readers that already prove the + shape: `decode_block_rect4` (32-level 32x8/8x32) and `decode_block_rect64` + (SB-level 64x16/16x64) -- transform tables, per-unit split walk, chroma, + Reach, neighbour records, palette/filter-intra refusals all reused unchanged. +* `crates/ec-av1/src/decode.rs` `INTRA_IN_INTER_MODE` (thread-local) -- the one + genuine difference on an inter frame is the mode-info read. + `read_intra_mode_rect` now, when it is set, (a) takes the `skip` the inter + path already read instead of re-reading skip/segment id/cdef/delta-q and + (b) reads the luma mode off `y_mode[size_group]` + (libaom `read_intra_block_mode_info`, decodemv.c:1189) instead of + `kf_y_mode[above][left]` (decodemv.c's key-frame reader). Everything after + that -- angle deltas (decodemv.c:1191/1203), uv_mode + CfL (1196-1201), + palette (1215), filter intra (the `read_filter_intra_mode_info` tail) -- is + bit-identical between the two libaom readers, which is why no other symbol + needed a branch. +* Counters `INTRA_RECT4_IN_INTER_HITS` (0=64x16, 1=16x64, 2=32x8, 3=8x32), + exported as `stream::intra_rect4_in_inter_counters()` and printed by + `examples/decode_probe`. +* `refusal_inventory.rs:76` -- "an intra-coded 1:4 (or other non-2:1) rect + strip on the inter block path" replaced by the narrower + "an intra-coded 16x4/4x16 strip on the inter block path (the 16x16-level 1:4 + inter partition is refused before this point)": 16x4/4x16 is unreachable + because `decode.rs:20332` refuses the 16x16-level 1:4 inter partition first, + and `decode_block_rect4`'s tables are 32x8-specific. +* `stream.rs` -- gate `a_real_aomenc_inter_sequence_with_an_intra_1to4_strip_decodes_pixel_exact` + (+ `_10bit`), currently `#[ignore]`d with the blocker named (see below). + +## Why the gate cannot pass on this tree (MEASURED) + +40 gate attempts per depth + ~150 recipe-sweep attempts (frame sizes 64x64, +96x96, 128x128, 192x128, 256x192; mandelbrot fast-zoom, static-background + +moving overlay, 64x16/16x64/32x8/8x32 moving bars, testsrc2; cq 35..63; +cpu-used 1..4; min/max-partition-size 32/32, 32/64, 64/64): + +* Every stream in which an intra 1:4 strip actually fires (counters 1..4 per + stream, e.g. `32x8=4`, `64x16=2`, `16x64=3`, `8x32=4`) ALSO carries a + non-skip INTER 2:1 rect strip ("a non-skip rectangular (HORZ/VERT/HORZ_B) + strip needs rectangular residual coding"), an SB-level AB partition, or a + sub-8 inter partition -- each another lane's named refusal, hit before the + frame completes, so the attempt is never pixel-compared. +* Every recipe under which all attempts decode whole (`--max-partition-size=32`, + or a static background with a moving overlay) fires ZERO 1:4 intra strips: + aomenc only reaches for 1:4 partitions in the same neighbourhoods where it + also picks the SB-level rect/AB shapes this decoder still refuses. +* Class [[counter-from-refused-stream]] applies: the counters above come from + REFUSED streams and prove only that the new code path is entered, never that + its pixels are right. The gate counts deltas on decoded+compared attempts + only, which is why it currently fails/ignores rather than reading green. + +So: **un-ignore and re-run this gate once the inter rect-leaf lane (lane-r14 r3, +`decode.rs` var-tx leaves) lands** -- that is the refusal that aborts every +candidate stream. + +## Film check (his ReelB extract) + +`decode_probe scratchpad/census3/kf/seg_4500.obu` (3840x1608 yuv420p10le, +213 frame headers): + +* BEFORE (charter premise): stops at "an intra-coded 1:4 (or other non-2:1) + rect strip on the inter block path". +* AFTER: `intra_rect4_in_inter: 64x16=0 16x64=4 32x8=0 8x32=0` -- four intra + 16x64 strips decode -- and the stop string is now + "a split intra strip whose transform unit is 64x32 (no luma coefficient + tables for that shape here)" (`decode_rect_split`'s luma-shape guard: the + SB-level 2:1 strip at tx depth 0, i.e. a TX_64X32 luma transform, which no + path here codes). Frames decoded (EC_AV1_FINAL_DUMP file count): 1 (the head + key frame) -- the new stop is still inside decode-order frame 1. + +EVIDENCE: /tmp/claude-1000/.../scratchpad/census3/kf/seg_4500.obu | decode_probe before/after the change, EC_AV1_FINAL_DUMP file count | 4 intra 16x64 strips decoded; stop string moved from the 1:4 refusal to "transform unit is 64x32"; 1 frame dumped +EVIDENCE: $HOME/.cache/intra14-suite-r1.log | `cargo test -p ec-av1 --lib` under a systemd unit | see totals below + +## Residue + +* fix-now (next round / successor lane): the gate is `#[ignore]`d. deferred -- + what unblocks it: the inter rect-strip refusal ("a non-skip rectangular + (HORZ/VERT/HORZ_B) strip needs rectangular residual coding"), lane-r14 r3. +* deferred: pixel-byte compare of the film's pre-stop frames through + EC_PROBE_OUT16 -- only ONE frame decodes before the stop, and it is the key + frame already proven bit-exact by lane-hgkf; what unblocks a meaningful + compare is the 64x32 luma transform above. +* accepted: `--enable-cfl-intra=0` and `--enable-palette=0` in the new gate + (ledger dead-end: a new gate spelling `--enable-cfl-intra=1` retires the tool + from `NEVER_EXERCISED_8BIT` on the flag alone with no CfL counter to assert; + the screen-content frame is refused whole on this path, so a palette flag + would buy no coverage). Deviation from the charter's flag list, stated here. +* accepted: `--enable-tx-size-search=0` and `--min-partition-size=32` in the + gate recipe -- measured, both named in the source comments. +* open (NOT mine, found here): at 192x128 mandelbrot start_scale 4.76, cq 55, + cpu-used 1, WITHOUT any rect/1:4 partition (`--enable-rect-partitions=0`), + decode-order frame 4 mismatches ffmpeg by 3729 luma samples (max |d| = 6) and + frames 5-7 drift (24k samples, max |d| ~220). Pre-existing square-path defect + on this tree, unrelated to this lane.