From 7136112251022c36fc2e52a210e1a26868dee0a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Sep 2026 13:54:53 +0300 Subject: [PATCH] feat(av1): decode a nonzero angle_delta_y on an 8x8 intra leaf inside an inter frame av1_use_angle_delta(BLOCK_8X8) is true, so the leaf codes angle_delta_y off angle_delta_cdf[mode - V_PRED] exactly as a key-frame block does; the delta already fed the directional predictor here, only the refusal stood in front of it. Gated by a real-aomenc 192x128 6-frame inter sequence (8- and 10-bit, --enable-angle-delta=1, --enable-directional-intra=1, min/max partition 8/32), 109 / 75 nonzero-delta 8x8 intra leaves on the first attempt, every decode-order frame pixel-exact vs ffmpeg. The sibling tx_depth-split refusal STAYS: its per-TU implementation is in the tree behind the refusal and decodes the 8-bit arm exactly, but a 10-bit stream still mismatches (see lanes/leaf8tx-r1.report.md). --- crates/ec-av1/src/decode.rs | 11 ++++++++ crates/ec-av1/src/refusal_inventory.rs | 1 + crates/ec-av1/src/stream.rs | 38 ++++++++++++++++++-------- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index f8d03dbd..a0f6eab7 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -22001,6 +22001,17 @@ fn decode_inter_block8( skip, )? .1; + // lane-leaf8tx r1: the per-TU loop below is written and decodes the + // 8-bit arm's 150 split leaves pixel-exact, but a 10-bit stream + // (`EC_LEAF8TX_CONTROL=tx8`, seed 68, cq 19) still mismatches from + // the split leaf onwards (luma 1140 samples from (160, 96)), so the + // refusal stays until a gate is green -- no lift without one. + if intra_leaves.is_some() { + return Err(unsupported( + "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 \ + transform units", + )); + } split8 = intra_leaves.is_some(); let reach = Reach::of(SIDE, px, py, y.width, y.height); if let Some(leaves) = intra_leaves { diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 70692fe8..6abb3c72 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -68,6 +68,7 @@ const REFUSALS: &[&str] = &[ // 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 AB partition (HORZ_A/HORZ_B/VERT_A/VERT_B; this decoder's inter tile path codes a superblock as NONE, SPLIT, HORZ, VERT, HORZ_4 or VERT_4)", // lane-inter16ab r1 lifted the AB half (HORZ_A/HORZ_B/VERT_A/VERT_B at diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index db01453e..c391a9b8 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -5962,22 +5962,21 @@ mod tests { } - /// lane-leaf8tx r1: the two remaining refusals on an INTRA 8x8 leaf - /// inside an INTER frame -- its `tx_depth` splitting the luma transform - /// into four TX_4X4 units (`--enable-tx-size-search=1`), and a nonzero - /// luma `angle_delta_y` on it (`--enable-angle-delta=1`, + /// lane-leaf8tx r1: the refusal this round lifts on an INTRA 8x8 leaf + /// inside an INTER frame -- a nonzero luma `angle_delta_y` on it + /// (`--enable-angle-delta=1`, /// `av1_use_angle_delta(BLOCK_8X8)`). Both counters are per-attempt /// deltas on an attempt that decoded to the end and is pixel-compared /// (class [[counter-from-refused-stream]]); a decode error or a mismatch /// is a FAILURE, never a SKIP. #[test] - fn a_real_aomenc_inter_sequence_with_a_split_tx_8x8_intra_leaf_decodes_pixel_exact() { + fn a_real_aomenc_inter_sequence_with_an_angle_delta_8x8_intra_leaf_decodes_pixel_exact() { tx_split_angle_in_inter8_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_tx_8x8_intra_leaf_decodes_pixel_exact() { + fn a_real_aomenc_10bit_inter_sequence_with_an_angle_delta_8x8_intra_leaf_decodes_pixel_exact() { tx_split_angle_in_inter8_gate(10); } @@ -6097,6 +6096,21 @@ mod tests { "-o", "-", ]) + // r1 diagnostic: EC_LEAF8TX_CONTROL=1 turns THIS lane's two + // tools back off (last occurrence of a repeated --enable-* + // wins), so any mismatch that survives is not this lane's. + .args(match std::env::var("EC_LEAF8TX_CONTROL").as_deref() { + Ok("angle") => vec!["--enable-tx-size-search=0", "--enable-angle-delta=1"], + Ok("tx") => vec!["--enable-tx-size-search=1", "--enable-angle-delta=0"], + Ok("tx8") => vec![ + "--enable-tx-size-search=1", + "--enable-angle-delta=0", + "--max-partition-size=8", + ], + Ok(_) => vec!["--enable-tx-size-search=0", "--enable-angle-delta=0"], + // Shipped recipe: only THIS lane's lifted tool is on. + Err(_) => vec!["--enable-tx-size-search=0", "--enable-angle-delta=1"], + }) .arg(&y4m_path) .stdin(Stdio::null()) .stdout(Stdio::piped()) @@ -6135,7 +6149,7 @@ mod tests { totals = (totals.0 + fired.0, totals.1 + fired.1); // Both lifted capabilities must fire on the SAME pixel-compared // attempt. - let counted = fired.0 > 0 && fired.1 > 0; + let counted = fired.1 > 0; if !counted { uncounted_exact += 1; refusals.push(format!( @@ -6152,8 +6166,10 @@ mod tests { assert_eq!(frames.len(), frame_count); eprintln!( "{name} seed={seed} {cq}: 8x8 intra-in-inter leaves with tx_depth=1 {}, with a \ - nonzero angle_delta_y {}", - fired.0, fired.1 + nonzero angle_delta_y {} (split-tx per size 8/16/32/64 {:?})", + fired.0, + fired.1, + decode::intra_in_inter_split_tx_hits() ); for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { for (plane, (g, w)) in [ @@ -6197,8 +6213,8 @@ mod tests { refusals.len() - uncounted_exact as usize, ); panic!( - "{name} never observed BOTH a tx_depth split and a nonzero angle delta on an 8x8 \ - intra leaf in an inter frame (totals split/angle {totals:?}):\n{}", + "{name} never observed a nonzero angle delta on an 8x8 intra leaf in an inter \ + frame (totals split/angle {totals:?}):\n{}", refusals.join("\n") ); }