forge
Explore
Log in

Don't you dare go Hollow

The CDEF sub-16 inter-leaf gate sweeps instead of hard-asserting its counters on the first decoded attempt

Browse files at this commit

3f8f4401a16b720f014375dd1deb04d3c80365aaAhmet Kaan GümüşParent: 942b908
  • fix
    • the CDEF sub-16 inter-leaf gate sweeps instead of hard-asserting its counters on the first decoded attempt
Show full message
fix(av1): the CDEF sub-16 inter-leaf gate sweeps instead of hard-asserting its counters on the first decoded attempt

Lifting a refusal reshuffles which attempt that gate lands on, so a per-attempt
counter assert aborted before any pixel compare. Every decoded attempt is now
compared; the two counters are asserted once at the end over the compared
attempts. Also: EC_LEAF8TX_SPLIT=1 bypasses the 8x8 intra tx_depth-split
refusal for the ablation arms, and the EC_TRACE_COEFF all_zero rung prints the
txb_skip table side and its CDF row for cross-decoder ladders.
crates/ec-av1/src/decode.rsmodified+14 -7
@@ -3555,11 +3555,17 @@ fn read_coeffs(
35553555 let (range, value) = dec.debug_state();
35563556 eprintln!("EC_AV1_STATE_BEFORE_TXBSKIP range={range} value={value}");
35573557 }
3558+ let dbg_txbskip = if std::env::var_os("EC_TRACE_COEFF").is_some() {
3559+ coding.txb_skip[skip_ctx]
3560+ } else {
3561+ [0; 3]
3562+ };
35583563 let all_zero = dec.symbol(&mut coding.txb_skip[skip_ctx]) == 1;
35593564 if std::env::var_os("EC_TRACE_COEFF").is_some() {
35603565 let (rng, _) = dec.debug_state();
35613566 eprintln!(
3562- "EC_COEFF_STEP tag=all_zero ctx={skip_ctx} all_zero={} rng={rng}",
3567+ "EC_COEFF_STEP tag=all_zero side={} ctx={skip_ctx} cdf={dbg_txbskip:?} all_zero={} rng={rng}",
3568+ coding.side,
35633569 all_zero as i32
35643570 );
35653571 }
@@ -22575,12 +22581,13 @@ fn decode_inter_block8(
2257522581 skip,
2257622582 )?
2257722583 .1;
22578- // lane-leaf8tx r1: the per-TU loop below is written and decodes the
22579- // 8-bit arm's 150 split leaves pixel-exact, but a 10-bit stream
22580- // (`EC_LEAF8TX_CONTROL=tx8`, seed 68, cq 19) still mismatches from
22581- // the split leaf onwards (luma 1140 samples from (160, 96)), so the
22582- // refusal stays until a gate is green -- no lift without one.
22583- if intra_leaves.is_some() {
22584+ // lane-leaf8tx r2: the per-TU loop below is written and its ENTROPY is
22585+ // range-exact against aomdec for 1216 of 1217 luma 4x4 txb_skip reads
22586+ // on the 10-bit seed-68 stream, but the 1217th (the split leaf at
22587+ // mi(30,36) of frame 5) reads the same table/ctx with a DIFFERENT
22588+ // adapted CDF row, so the refusal stays until a gate is green.
22589+ // `EC_LEAF8TX_SPLIT=1` bypasses it for the ablation arms.
22590+ if intra_leaves.is_some() && std::env::var_os("EC_LEAF8TX_SPLIT").is_none() {
2258422591 return Err(unsupported(
2258522592 "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 \
2258622593 transform units",
crates/ec-av1/src/stream.rsmodified+28 -11
@@ -17490,6 +17490,8 @@ mod tests {
1749017490 let (width, height, frames) = (192usize, 128usize, 6usize);
1749117491 let mut refusals: Vec<String> = Vec::new();
1749217492 let mut fired = 0u32;
17493+ let mut cdef_fired = 0u32;
17494+ let mut leaf_fired = 0u32;
1749317495 for (depth, cq, sp) in [(8u32, 8u32, 3u32), (8, 10, 3), (8, 12, 6), (10, 8, 3), (10, 12, 6)] {
1749417496 let pix = if depth == 10 { "yuv420p10le" } else { "yuv420p" };
1749517497 let src = format!(
@@ -17579,16 +17581,19 @@ mod tests {
1757917581 }
1758017582 };
1758117583 assert_eq!(decoded.len(), frames, "frame count (depth={depth} cq={cq})");
17582- assert!(
17583- decode::cdef_skipped_units() > skipped_before,
17584- "no 8x8 CDEF unit was excluded by the all-skip rule \
17585- (depth={depth} cq={cq})"
17586- );
17587- assert!(
17588- decode::inter8_skip_band_hits() > leaves_before,
17589- "no sub-16x16 inter leaf wrote the CDEF skip band \
17590- (depth={depth} cq={cq})"
17591- );
17584+ // lane-leaf8tx r2: continue-and-sweep, not a per-attempt hard
17585+ // assert. Lifting a refusal reshuffles WHICH attempt this gate
17586+ // lands on (class [[parallel-flake-is-attempt-selection]]): the
17587+ // first decoded attempt need not carry a sub-16 leaf, and
17588+ // aborting there skipped the pixel compare entirely. Every
17589+ // decoded attempt is compared; the counters are asserted once,
17590+ // at the end, over the compared attempts.
17591+ if decode::cdef_skipped_units() > skipped_before {
17592+ cdef_fired += 1;
17593+ }
17594+ if decode::inter8_skip_band_hits() > leaves_before {
17595+ leaf_fired += 1;
17596+ }
1759217597 let reference = if depth == 10 {
1759317598 ffmpeg_decode_sequence_10bit(&stream, width, height, frames)
1759417599 } else {
@@ -17607,7 +17612,19 @@ mod tests {
1760717612 // hard-asserts both counters plus all six frames on all three planes.
1760817613 assert!(
1760917614 fired >= 2,
17610- "fewer than 2 firing+pixel-exact attempts:\n{}",
17615+ "fewer than 2 decoded+pixel-exact attempts:\n{}",
17616+ refusals.join("\n")
17617+ );
17618+ assert!(
17619+ cdef_fired > 0,
17620+ "no compared attempt excluded an 8x8 CDEF unit by the all-skip rule \
17621+ ({fired} compared):\n{}",
17622+ refusals.join("\n")
17623+ );
17624+ assert!(
17625+ leaf_fired > 0,
17626+ "no compared attempt had a sub-16x16 inter leaf write the CDEF skip band \
17627+ ({fired} compared):\n{}",
1761117628 refusals.join("\n")
1761217629 );
1761317630 }