diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index baf99419..0bf43632 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -3555,11 +3555,17 @@ fn read_coeffs( let (range, value) = dec.debug_state(); eprintln!("EC_AV1_STATE_BEFORE_TXBSKIP range={range} value={value}"); } + let dbg_txbskip = if std::env::var_os("EC_TRACE_COEFF").is_some() { + coding.txb_skip[skip_ctx] + } else { + [0; 3] + }; let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1; if std::env::var_os("EC_TRACE_COEFF").is_some() { let (rng, _) = dec.debug_state(); eprintln!( - "EC_COEFF_STEP tag=all_zero ctx={skip_ctx} all_zero={} rng={rng}", + "EC_COEFF_STEP tag=all_zero side={} ctx={skip_ctx} cdf={dbg_txbskip:?} all_zero={} rng={rng}", + coding.side, all_zero as i32 ); } @@ -22575,12 +22581,13 @@ 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() { + // lane-leaf8tx r2: the per-TU loop below is written and its ENTROPY is + // range-exact against aomdec for 1216 of 1217 luma 4x4 txb_skip reads + // on the 10-bit seed-68 stream, but the 1217th (the split leaf at + // mi(30,36) of frame 5) reads the same table/ctx with a DIFFERENT + // adapted CDF row, so the refusal stays until a gate is green. + // `EC_LEAF8TX_SPLIT=1` bypasses it for the ablation arms. + if intra_leaves.is_some() && std::env::var_os("EC_LEAF8TX_SPLIT").is_none() { return Err(unsupported( "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 \ transform units", diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 536caac5..ad78add6 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -17490,6 +17490,8 @@ mod tests { let (width, height, frames) = (192usize, 128usize, 6usize); let mut refusals: Vec = Vec::new(); let mut fired = 0u32; + let mut cdef_fired = 0u32; + let mut leaf_fired = 0u32; for (depth, cq, sp) in [(8u32, 8u32, 3u32), (8, 10, 3), (8, 12, 6), (10, 8, 3), (10, 12, 6)] { let pix = if depth == 10 { "yuv420p10le" } else { "yuv420p" }; let src = format!( @@ -17579,16 +17581,19 @@ mod tests { } }; assert_eq!(decoded.len(), frames, "frame count (depth={depth} cq={cq})"); - assert!( - decode::cdef_skipped_units() > skipped_before, - "no 8x8 CDEF unit was excluded by the all-skip rule \ - (depth={depth} cq={cq})" - ); - assert!( - decode::inter8_skip_band_hits() > leaves_before, - "no sub-16x16 inter leaf wrote the CDEF skip band \ - (depth={depth} cq={cq})" - ); + // lane-leaf8tx r2: continue-and-sweep, not a per-attempt hard + // assert. Lifting a refusal reshuffles WHICH attempt this gate + // lands on (class [[parallel-flake-is-attempt-selection]]): the + // first decoded attempt need not carry a sub-16 leaf, and + // aborting there skipped the pixel compare entirely. Every + // decoded attempt is compared; the counters are asserted once, + // at the end, over the compared attempts. + if decode::cdef_skipped_units() > skipped_before { + cdef_fired += 1; + } + if decode::inter8_skip_band_hits() > leaves_before { + leaf_fired += 1; + } let reference = if depth == 10 { ffmpeg_decode_sequence_10bit(&stream, width, height, frames) } else { @@ -17607,7 +17612,19 @@ mod tests { // hard-asserts both counters plus all six frames on all three planes. assert!( fired >= 2, - "fewer than 2 firing+pixel-exact attempts:\n{}", + "fewer than 2 decoded+pixel-exact attempts:\n{}", + refusals.join("\n") + ); + assert!( + cdef_fired > 0, + "no compared attempt excluded an 8x8 CDEF unit by the all-skip rule \ + ({fired} compared):\n{}", + refusals.join("\n") + ); + assert!( + leaf_fired > 0, + "no compared attempt had a sub-16x16 inter leaf write the CDEF skip band \ + ({fired} compared):\n{}", refusals.join("\n") ); }