The compound 8x8 leaf never read its switchable interp_filter -- lost a symbol per leaf and stamped the [3,3] sentinel that made a neighbouring OBMC block PANIC
Browse files at this commitc6220cd1fabf5da494522f4ec11142b1a501cdabParent: 9864603- fix
- the compound 8x8 leaf never read its switchable interp_filter -- lost a symbol per leaf and stamped the [3,3] sentinel that made a neighbouring OBMC block PANIC
4 changed files +295 -25
- crates/ec-av1/src/decode.rs +134 -23
- crates/ec-av1/src/refusal_inventory.rs +1 -0
- crates/ec-av1/src/stream.rs +77 -2
- lanes/interp3-r1.report.md +83 -0
crates/ec-av1/src/decode.rsmodified+134 -23
| @@ -1726,6 +1726,32 @@ thread_local! { | ||
| 1726 | 1726 | static OBMC_HITS_8: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 1727 | 1727 | } |
| 1728 | 1728 | |
| 1729 | +// lane-interp3 r1: how many inter blocks read a SWITCHABLE `interp_filter` | |
| 1730 | +// pair whose two directions differ (`enable_dual_filter` only -- with dual | |
| 1731 | +// filter off both directions take the single symbol, so this can never fire). | |
| 1732 | +// A gate asserting it proves the stream really carries dual-filter blocks. | |
| 1733 | +thread_local! { | |
| 1734 | + static DUAL_FILTER_DIFF_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1735 | +} | |
| 1736 | + | |
| 1737 | +// lane-interp3 r1: how many COMPOUND 8x8 leaves read their own | |
| 1738 | +// `read_mb_interp_filter` symbol(s) -- the read this round added (the leaf | |
| 1739 | +// used to skip it entirely, losing a symbol and stamping the `[3, 3]` | |
| 1740 | +// no-filter sentinel that made a neighbouring OBMC block panic). | |
| 1741 | +thread_local! { | |
| 1742 | + static COMPOUND8_FILTER_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1743 | +} | |
| 1744 | + | |
| 1745 | +/// Current value of [`DUAL_FILTER_DIFF_HITS`]. | |
| 1746 | +pub(crate) fn dual_filter_diff_hits() -> usize { | |
| 1747 | + DUAL_FILTER_DIFF_HITS.with(|c| c.get()) | |
| 1748 | +} | |
| 1749 | + | |
| 1750 | +/// Current value of [`COMPOUND8_FILTER_HITS`]. | |
| 1751 | +pub(crate) fn compound8_filter_hits() -> usize { | |
| 1752 | + COMPOUND8_FILTER_HITS.with(|c| c.get()) | |
| 1753 | +} | |
| 1754 | + | |
| 1729 | 1755 | // lane-warp round 1: how many blocks resolved `motion_mode_allowed` to |
| 1730 | 1756 | // `WARPED_CAUSAL`-eligible (3-symbol read, `num_proj_ref >= 1` under |
| 1731 | 1757 | // `allow_warped_motion`) AND the symbol actually decoded to `WARPED_CAUSAL` |
| @@ -14856,6 +14882,9 @@ fn resolve_interp_filter( | ||
| 14856 | 14882 | } else { |
| 14857 | 14883 | sym0 |
| 14858 | 14884 | }; |
| 14885 | + if enable_dual_filter && sym0 != sym1 { | |
| 14886 | + DUAL_FILTER_DIFF_HITS.with(|c| c.set(c.get() + 1)); | |
| 14887 | + } | |
| 14859 | 14888 | ( |
| 14860 | 14889 | mc::InterpFilterKind::from_switchable_symbol(sym1 as usize), |
| 14861 | 14890 | mc::InterpFilterKind::from_switchable_symbol(sym0 as usize), |
| @@ -15515,14 +15544,25 @@ fn obmc_mask(len: usize) -> &'static [u8] { | ||
| 15515 | 15544 | fn neighbour_filter( |
| 15516 | 15545 | interp_fixed: Option<mc::InterpFilterKind>, |
| 15517 | 15546 | sym: [u8; 2], |
| 15518 | -) -> (mc::InterpFilterKind, mc::InterpFilterKind) { | |
| 15547 | +) -> Result<(mc::InterpFilterKind, mc::InterpFilterKind)> { | |
| 15519 | 15548 | if let Some(kind) = interp_fixed { |
| 15520 | - return (kind, kind); | |
| 15549 | + return Ok((kind, kind)); | |
| 15550 | + } | |
| 15551 | + // lane-interp3 r1: the `[3, 3]` sentinel reaching here is a DEFECT in | |
| 15552 | + // whatever path recorded the neighbour (an inter block that never stored | |
| 15553 | + // its own switchable symbols), and it used to abort the process through | |
| 15554 | + // `from_switchable_symbol`'s panic. A decoder must never crash on a real | |
| 15555 | + // stream: it stops by name instead, so the frame is refused and the | |
| 15556 | + // stream is pinned like every other unsupported case. | |
| 15557 | + if sym[0] > 2 || sym[1] > 2 { | |
| 15558 | + return Err(unsupported( | |
| 15559 | + "an OBMC neighbour whose interp filter was never recorded (no switchable symbol for that block)", | |
| 15560 | + )); | |
| 15521 | 15561 | } |
| 15522 | - ( | |
| 15562 | + Ok(( | |
| 15523 | 15563 | mc::InterpFilterKind::from_switchable_symbol(sym[1] as usize), |
| 15524 | 15564 | mc::InterpFilterKind::from_switchable_symbol(sym[0] as usize), |
| 15525 | - ) | |
| 15565 | + )) | |
| 15526 | 15566 | } |
| 15527 | 15567 | |
| 15528 | 15568 | /// One neighbour's own re-prediction over a `w`x`h` region, MC'd fresh |
| @@ -15800,7 +15840,7 @@ fn obmc_blend( | ||
| 15800 | 15840 | let (h_kind, v_kind) = neighbour_filter( |
| 15801 | 15841 | interp_fixed, |
| 15802 | 15842 | neighbours.above_filter[mi_col + off4], |
| 15803 | - ); | |
| 15843 | + )?; | |
| 15804 | 15844 | let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?; |
| 15805 | 15845 | let nb_scale = mc::scale_factor(ny.width, frame_width); |
| 15806 | 15846 | let (bw, bh, ox) = (span4 * 4, overlap_above, off4 * 4); |
| @@ -15819,7 +15859,7 @@ fn obmc_blend( | ||
| 15819 | 15859 | let (h_kind, v_kind) = neighbour_filter( |
| 15820 | 15860 | interp_fixed, |
| 15821 | 15861 | neighbours.left_filter[mi_row + off4], |
| 15822 | - ); | |
| 15862 | + )?; | |
| 15823 | 15863 | let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?; |
| 15824 | 15864 | let nb_scale = mc::scale_factor(ny.width, frame_width); |
| 15825 | 15865 | let (bw, bh, oy) = (overlap_left, span4 * 4, off4 * 4); |
| @@ -19302,6 +19342,58 @@ fn decode_inter_block8( | ||
| 19302 | 19342 | ); |
| 19303 | 19343 | } |
| 19304 | 19344 | |
| 19345 | + // lane-interp3 r1: `read_mb_interp_filter` (libaom | |
| 19346 | + // `decodemv.c` 1575, the tail of | |
| 19347 | + // `read_inter_block_mode_info`) runs for EVERY inter block, | |
| 19348 | + // compound included, right AFTER `read_compound_type` -- this | |
| 19349 | + // leaf read no filter symbol at all, so a SWITCHABLE-filter | |
| 19350 | + // stream lost one symbol (two under `enable_dual_filter`) at | |
| 19351 | + // every compound 8x8 leaf, and the leaf recorded the `[3, 3]` | |
| 19352 | + // "no filter" sentinel, which made a neighbouring OBMC block's | |
| 19353 | + // `neighbour_filter` PANIC instead of blending. | |
| 19354 | + // `av1_is_interp_needed` suppression terms for this arm: | |
| 19355 | + // `skip_mode`, and `is_nontrans_global_motion` (mode | |
| 19356 | + // GLOBAL_GLOBALMV with BOTH refs' models non-TRANSLATION) -- | |
| 19357 | + // WARPED_CAUSAL cannot occur on a compound block. | |
| 19358 | + let gm_nontrans_c = compound_mode == 6 | |
| 19359 | + && global_motion[(ref0 - LAST_FRAME) as usize].model | |
| 19360 | + != ec_av1_syntax::WarpModel::Translation | |
| 19361 | + && global_motion[(ref1 - LAST_FRAME) as usize].model | |
| 19362 | + != ec_av1_syntax::WarpModel::Translation; | |
| 19363 | + // spec `get_ref_filter_type`, keyed on this block's ref0 and | |
| 19364 | + // matching EITHER of the neighbour's references -- same shape | |
| 19365 | + // as [`decode_inter_block`]'s compound arm. Same corner-cut as | |
| 19366 | + // this leaf's single-ref arm below: the context comes from the | |
| 19367 | + // enclosing 16x16's coarse slot. | |
| 19368 | + let above_filter_ctx = if neighbours.above_ref[cmi] == ref0 | |
| 19369 | + || neighbours.above_ref1[cmi] == Some(ref0) | |
| 19370 | + { | |
| 19371 | + neighbours.above_filter[cmi] | |
| 19372 | + } else { | |
| 19373 | + [3, 3] | |
| 19374 | + }; | |
| 19375 | + let left_filter_ctx = if neighbours.left_ref[rmi] == ref0 | |
| 19376 | + || neighbours.left_ref1[rmi] == Some(ref0) | |
| 19377 | + { | |
| 19378 | + neighbours.left_filter[rmi] | |
| 19379 | + } else { | |
| 19380 | + [3, 3] | |
| 19381 | + }; | |
| 19382 | + let (h_filter, v_filter, resolved_filter) = resolve_interp_filter( | |
| 19383 | + dec, | |
| 19384 | + cdfs, | |
| 19385 | + interp_fixed, | |
| 19386 | + enable_dual_filter, | |
| 19387 | + gm_nontrans_c || skip_mode, | |
| 19388 | + above_filter_ctx, | |
| 19389 | + left_filter_ctx, | |
| 19390 | + true, | |
| 19391 | + ); | |
| 19392 | + leaf_filter_syms = resolved_filter; | |
| 19393 | + if interp_fixed.is_none() && !(gm_nontrans_c || skip_mode) { | |
| 19394 | + COMPOUND8_FILTER_HITS.with(|c| c.set(c.get() + 1)); | |
| 19395 | + } | |
| 19396 | + | |
| 19305 | 19397 | let (py0, pu0, pv0) = ref_planes(ref0, ref_y, ref_u, ref_v, other_refs)?; |
| 19306 | 19398 | let (py1, pu1, pv1) = ref_planes(ref1, ref_y, ref_u, ref_v, other_refs)?; |
| 19307 | 19399 | let scale0 = mc::scale_factor(py0.width, frame_width); |
| @@ -19333,11 +19425,6 @@ fn decode_inter_block8( | ||
| 19333 | 19425 | } |
| 19334 | 19426 | mode_for_tx = 0; |
| 19335 | 19427 | |
| 19336 | - // lane-av1comp corner-cut, matching this leaf's single-ref | |
| 19337 | - // arm below (`mc::predict`'s own fixed-Regular default): | |
| 19338 | - // `decode_inter_block8` never resolves a switchable filter, | |
| 19339 | - // so both compound taps use `Regular` too. | |
| 19340 | - use mc::InterpFilterKind::Regular; | |
| 19341 | 19428 | let mut inter0_y = vec![0i32; SIDE * SIDE]; |
| 19342 | 19429 | mc::predict_compound_intermediate( |
| 19343 | 19430 | &py0.data, |
| @@ -19349,8 +19436,8 @@ fn decode_inter_block8( | ||
| 19349 | 19436 | scale0, |
| 19350 | 19437 | SIDE, |
| 19351 | 19438 | SIDE, |
| 19352 | - Regular, | |
| 19353 | - Regular, | |
| 19439 | + h_filter, | |
| 19440 | + v_filter, | |
| 19354 | 19441 | &mut inter0_y, |
| 19355 | 19442 | ); |
| 19356 | 19443 | let mut inter1_y = vec![0i32; SIDE * SIDE]; |
| @@ -19364,8 +19451,8 @@ fn decode_inter_block8( | ||
| 19364 | 19451 | scale1, |
| 19365 | 19452 | SIDE, |
| 19366 | 19453 | SIDE, |
| 19367 | - Regular, | |
| 19368 | - Regular, | |
| 19454 | + h_filter, | |
| 19455 | + v_filter, | |
| 19369 | 19456 | &mut inter1_y, |
| 19370 | 19457 | ); |
| 19371 | 19458 | let mut pred_y = vec![0u16; SIDE * SIDE]; |
| @@ -19397,8 +19484,8 @@ fn decode_inter_block8( | ||
| 19397 | 19484 | scale0, |
| 19398 | 19485 | CHROMA_SIDE, |
| 19399 | 19486 | CHROMA_SIDE, |
| 19400 | - Regular, | |
| 19401 | - Regular, | |
| 19487 | + h_filter, | |
| 19488 | + v_filter, | |
| 19402 | 19489 | &mut inter0_u, |
| 19403 | 19490 | ); |
| 19404 | 19491 | let mut inter1_u = vec![0i32; CHROMA_SIDE * CHROMA_SIDE]; |
| @@ -19412,8 +19499,8 @@ fn decode_inter_block8( | ||
| 19412 | 19499 | scale1, |
| 19413 | 19500 | CHROMA_SIDE, |
| 19414 | 19501 | CHROMA_SIDE, |
| 19415 | - Regular, | |
| 19416 | - Regular, | |
| 19502 | + h_filter, | |
| 19503 | + v_filter, | |
| 19417 | 19504 | &mut inter1_u, |
| 19418 | 19505 | ); |
| 19419 | 19506 | let mut pred_u = vec![0u16; CHROMA_SIDE * CHROMA_SIDE]; |
| @@ -19443,8 +19530,8 @@ fn decode_inter_block8( | ||
| 19443 | 19530 | scale0, |
| 19444 | 19531 | CHROMA_SIDE, |
| 19445 | 19532 | CHROMA_SIDE, |
| 19446 | - Regular, | |
| 19447 | - Regular, | |
| 19533 | + h_filter, | |
| 19534 | + v_filter, | |
| 19448 | 19535 | &mut inter0_v, |
| 19449 | 19536 | ); |
| 19450 | 19537 | let mut inter1_v = vec![0i32; CHROMA_SIDE * CHROMA_SIDE]; |
| @@ -19458,8 +19545,8 @@ fn decode_inter_block8( | ||
| 19458 | 19545 | scale1, |
| 19459 | 19546 | CHROMA_SIDE, |
| 19460 | 19547 | CHROMA_SIDE, |
| 19461 | - Regular, | |
| 19462 | - Regular, | |
| 19548 | + h_filter, | |
| 19549 | + v_filter, | |
| 19463 | 19550 | &mut inter1_v, |
| 19464 | 19551 | ); |
| 19465 | 19552 | let mut pred_v = vec![0u16; CHROMA_SIDE * CHROMA_SIDE]; |
| @@ -22840,6 +22927,30 @@ mod tests { | ||
| 22840 | 22927 | /// always cleared to `None` by `record_inter`, so the next block's own |
| 22841 | 22928 | /// `NeighbourRef::uni` -- and `comp_reference_type_ctx` downstream of it |
| 22842 | 22929 | /// -- could never see a real compound neighbour). |
| 22930 | + /// lane-interp3 r1: a decoder must never abort the process on | |
| 22931 | + /// stream-derived state. `neighbour_filter` used to feed the `[3, 3]` | |
| 22932 | + /// "no filter recorded" sentinel straight into | |
| 22933 | + /// `InterpFilterKind::from_switchable_symbol`, whose `panic!` ("...alphabet | |
| 22934 | + /// is exactly 3 symbols") crashed on a real aomenc dual-filter + OBMC | |
| 22935 | + /// stream. It now refuses by name; the real symbols still decode. | |
| 22936 | + #[test] | |
| 22937 | + fn an_obmc_neighbour_with_no_recorded_filter_refuses_instead_of_panicking() { | |
| 22938 | + assert!( | |
| 22939 | + neighbour_filter(None, [3, 3]) | |
| 22940 | + .unwrap_err() | |
| 22941 | + .to_string() | |
| 22942 | + .contains("an OBMC neighbour whose interp filter was never recorded"), | |
| 22943 | + "the [3, 3] sentinel must refuse by name, never panic" | |
| 22944 | + ); | |
| 22945 | + assert!(neighbour_filter(None, [3, 0]).is_err()); | |
| 22946 | + let (h, v) = neighbour_filter(None, [0, 2]).expect("real symbols decode"); | |
| 22947 | + assert_eq!(h, mc::InterpFilterKind::Sharp, "sym[1] is the horizontal kernel"); | |
| 22948 | + assert_eq!(v, mc::InterpFilterKind::Regular, "sym[0] is the vertical kernel"); | |
| 22949 | + let (h, v) = neighbour_filter(Some(mc::InterpFilterKind::Smooth), [3, 3]) | |
| 22950 | + .expect("a fixed-filter frame never reads a symbol"); | |
| 22951 | + assert_eq!((h, v), (mc::InterpFilterKind::Smooth, mc::InterpFilterKind::Smooth)); | |
| 22952 | + } | |
| 22953 | + | |
| 22843 | 22954 | #[test] |
| 22844 | 22955 | fn record_compound_ctx_stamps_ref1_for_the_next_block_to_read() { |
| 22845 | 22956 | let mut n = Neighbours::new(4, 4, 16, 16); |
crates/ec-av1/src/refusal_inventory.rsmodified+1 -0
| @@ -34,6 +34,7 @@ const REFUSALS: &[&str] = &[ | ||
| 34 | 34 | "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here", |
| 35 | 35 | "a split intra strip whose transform unit is {tx_w}x{tx_h} (no luma coefficient tables for that shape here)", |
| 36 | 36 | "an inter partition below 8x8 (this decoder codes no inter leaf smaller than 8x8; lane-sub8 scoped to intra)", |
| 37 | + "an OBMC neighbour whose interp filter was never recorded (no switchable symbol for that block)", | |
| 37 | 38 | "a 1:4 rect strip that actually uses a palette (reconstruction is not ported at this shape)", |
| 38 | 39 | "a 16x16 block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", |
| 39 | 40 | "a 16x16 inter block whose true edge cuts through both axes needs a rectangular transform this decoder does not code yet", |
crates/ec-av1/src/stream.rsmodified+77 -2
| @@ -6087,6 +6087,9 @@ mod tests { | ||
| 6087 | 6087 | // aomenc silently codes one tile column and the arm is vacuous. |
| 6088 | 6088 | extra: &[&str], |
| 6089 | 6089 | width: usize, |
| 6090 | + // lane-interp3 r1: sequence length -- a compound block needs several | |
| 6091 | + // already-coded references, which a 4-frame sequence never has. | |
| 6092 | + frame_count: usize, | |
| 6090 | 6093 | ) { |
| 6091 | 6094 | if !have_ffmpeg() { |
| 6092 | 6095 | eprintln!("SKIP {name}: no ffmpeg"); |
| @@ -6096,7 +6099,8 @@ mod tests { | ||
| 6096 | 6099 | eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display()); |
| 6097 | 6100 | return; |
| 6098 | 6101 | } |
| 6099 | - let (height, frame_count) = (64usize, 4usize); | |
| 6102 | + let height = 64usize; | |
| 6103 | + let duration = format!("{:.2}", frame_count as f64 / 25.0); | |
| 6100 | 6104 | // A deterministic synthetic source with real motion (a static source |
| 6101 | 6105 | // codes every inter frame as skip and never exercises the residual |
| 6102 | 6106 | // path); bounded with `-t` (class gate-loader-slurps-whole-file). |
| @@ -6109,7 +6113,7 @@ mod tests { | ||
| 6109 | 6113 | "-i", |
| 6110 | 6114 | &format!("mandelbrot=size={width}x{height}:rate=25"), |
| 6111 | 6115 | "-t", |
| 6112 | - "0.16", | |
| 6116 | + &duration, | |
| 6113 | 6117 | "-pix_fmt", |
| 6114 | 6118 | if ten_bit { "yuv420p10le" } else { "yuv420p" }, |
| 6115 | 6119 | // y4m calls 10-bit unofficial (same as the 10-bit key-frame |
| @@ -6236,6 +6240,7 @@ mod tests { | ||
| 6236 | 6240 | "whole-superblock inter PARTITION_NONE", |
| 6237 | 6241 | &[], |
| 6238 | 6242 | 64, |
| 6243 | + 4, | |
| 6239 | 6244 | ); |
| 6240 | 6245 | } |
| 6241 | 6246 | |
| @@ -6250,6 +6255,7 @@ mod tests { | ||
| 6250 | 6255 | "whole-superblock inter PARTITION_NONE", |
| 6251 | 6256 | &[], |
| 6252 | 6257 | 64, |
| 6258 | + 4, | |
| 6253 | 6259 | ); |
| 6254 | 6260 | } |
| 6255 | 6261 | |
| @@ -6292,6 +6298,73 @@ mod tests { | ||
| 6292 | 6298 | "interior 16x16 inter PARTITION_SPLIT into 8x8 leaves", |
| 6293 | 6299 | &["--tile-columns=1"], |
| 6294 | 6300 | 128, |
| 6301 | + 4, | |
| 6302 | + ); | |
| 6303 | + } | |
| 6304 | + | |
| 6305 | + /// lane-interp3 r1: the same 8x8-leaf recipe with DUAL FILTER, OBMC and | |
| 6306 | + /// warped motion on. `read_mb_interp_filter` runs for every inter block | |
| 6307 | + /// (libaom `decodemv.c` 1575), compound ones included; the compound 8x8 | |
| 6308 | + /// leaf skipped it entirely, so a SWITCHABLE-filter stream lost a symbol | |
| 6309 | + /// per compound leaf and stamped the `[3, 3]` "no filter" sentinel, which | |
| 6310 | + /// made a neighbouring OBMC block's `neighbour_filter` PANIC (a crash on | |
| 6311 | + /// his data, not a named refusal). The three hard asserts prove the flags | |
| 6312 | + /// arrived: a compound 8x8 leaf that really read the filter, a block whose | |
| 6313 | + /// two dual-filter directions DIFFER (impossible with dual filter off), | |
| 6314 | + /// and an 8x8 OBMC blend. | |
| 6315 | + // lane-interp3 r1: RED, and ignored rather than deleted -- MEASURED, not | |
| 6316 | + // assumed. At `EC_INTERP3_FRAMES=4` (the other arms' length) aomenc codes | |
| 6317 | + // no compound block at all and the stream decodes; from 5 frames on it | |
| 6318 | + // does, and the decode then stops at "an inter 16x16-level AB or 1:4 | |
| 6319 | + // partition" WITH this round's filter read and at "an inter partition | |
| 6320 | + // below 8x8" WITHOUT it (measured by ablating the read) -- both are | |
| 6321 | + // impossible on a `--enable-ab-partitions=0 --enable-1to4-partitions=0 | |
| 6322 | + // --min-partition-size=8` recipe, so BOTH are our own desync | |
| 6323 | + // (class refusal-from-own-desync) and the compound 8x8 leaf carries at | |
| 6324 | + // least one more missing/misplaced symbol beyond the interp filter this | |
| 6325 | + // round added. Next round: EC_TRACE range ladder vs aomdec on the first | |
| 6326 | + // compound leaf of frame 5. | |
| 6327 | + #[ignore = "lane-interp3 r1: the compound 8x8 leaf still desyncs past the interp-filter read (surfaces as a bogus AB/1:4 refusal); the panic it used to end in is now a named refusal"] | |
| 6328 | + #[test] | |
| 6329 | + fn a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact() { | |
| 6330 | + const NAME: &str = | |
| 6331 | + "a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact"; | |
| 6332 | + if !have_ffmpeg() || !have_aomenc() { | |
| 6333 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | |
| 6334 | + return; | |
| 6335 | + } | |
| 6336 | + let before_dual = decode::dual_filter_diff_hits(); | |
| 6337 | + let before_obmc = decode::obmc_hits_8(); | |
| 6338 | + inter_sb_none_gate( | |
| 6339 | + NAME, | |
| 6340 | + false, | |
| 6341 | + "8", | |
| 6342 | + "16", | |
| 6343 | + decode::compound8_filter_hits, | |
| 6344 | + "a compound 8x8 leaf reading its own switchable interp_filter", | |
| 6345 | + &[ | |
| 6346 | + "--enable-dual-filter=1", | |
| 6347 | + "--enable-obmc=1", | |
| 6348 | + "--enable-warped-motion=1", | |
| 6349 | + "--enable-onesided-comp=1", | |
| 6350 | + ], | |
| 6351 | + 64, | |
| 6352 | + // Recipe search hook (same shape as EC_OBMC8_ATTEMPTS): a compound | |
| 6353 | + // block needs several coded references, so the sequence is longer | |
| 6354 | + // than the other arms' 4 frames. | |
| 6355 | + std::env::var("EC_INTERP3_FRAMES") | |
| 6356 | + .ok() | |
| 6357 | + .and_then(|v| v.parse().ok()) | |
| 6358 | + .unwrap_or(16), | |
| 6359 | + ); | |
| 6360 | + assert!( | |
| 6361 | + decode::dual_filter_diff_hits() > before_dual, | |
| 6362 | + "{NAME}: no block read two DIFFERENT dual-filter directions -- \ | |
| 6363 | + --enable-dual-filter=1 did not arrive or aomenc declined it" | |
| 6364 | + ); | |
| 6365 | + assert!( | |
| 6366 | + decode::obmc_hits_8() > before_obmc, | |
| 6367 | + "{NAME}: no 8x8 OBMC blend fired -- --enable-obmc=1 did not arrive" | |
| 6295 | 6368 | ); |
| 6296 | 6369 | } |
| 6297 | 6370 | |
| @@ -6306,6 +6379,7 @@ mod tests { | ||
| 6306 | 6379 | "interior 16x16 inter PARTITION_SPLIT into 8x8 leaves", |
| 6307 | 6380 | &[], |
| 6308 | 6381 | 64, |
| 6382 | + 4, | |
| 6309 | 6383 | ); |
| 6310 | 6384 | } |
| 6311 | 6385 | |
| @@ -6329,6 +6403,7 @@ mod tests { | ||
| 6329 | 6403 | "interior 16x16 inter PARTITION_SPLIT into 8x8 leaves", |
| 6330 | 6404 | &[], |
| 6331 | 6405 | 64, |
| 6406 | + 4, | |
| 6332 | 6407 | ); |
| 6333 | 6408 | } |
| 6334 | 6409 |
lanes/interp3-r1.report.mdadded+83 -0
| @@ -0,0 +1,83 @@ | ||
| 1 | +# lane-interp3 r1 -- the `switchable_interp` PANIC: the compound 8x8 leaf never read its filter | |
| 2 | + | |
| 3 | +## Root cause (cited) | |
| 4 | + | |
| 5 | +libaom `decodemv.c:1575` (`read_inter_block_mode_info`) calls `read_mb_interp_filter` | |
| 6 | +for **every** inter block, compound ones included, right after `read_compound_type`. | |
| 7 | +`decode_leaf8`'s COMPOUND arm (`crates/ec-av1/src/decode.rs`, the branch that returns at | |
| 8 | +the old line 19589) called `resolve_interp_filter` **not at all**: it predicted both taps | |
| 9 | +with a hard-coded `Regular` and returned the `[3, 3]` "no filter recorded" sentinel as the | |
| 10 | +leaf's `leaf_filter_syms`. Two consequences, both real on his data: | |
| 11 | + | |
| 12 | +1. **Entropy**: on a `SWITCHABLE`-filter frame one symbol (two under `enable_dual_filter`) | |
| 13 | + is left unread at every compound 8x8 leaf -- silent desync. | |
| 14 | +2. **Crash**: the sentinel is stamped into `Neighbours::above_filter`/`left_filter`, and a | |
| 15 | + neighbouring OBMC block's `neighbour_filter` fed it to | |
| 16 | + `mc::InterpFilterKind::from_switchable_symbol`, whose `panic!("switchable_interp's | |
| 17 | + alphabet is exactly 3 symbols")` aborted the process. That is the panic lane-r14 r3 | |
| 18 | + flagged (its `--enable-dual-filter=1 --enable-obmc=1` 192x128 cq30 stream). The same | |
| 19 | + shape was already fixed once for the SINGLE-ref 8x8 leaf (lane-gmaffine r3, decode.rs | |
| 20 | + ~21509 comment) -- the compound arm was the surviving sibling instance. | |
| 21 | + | |
| 22 | +## Changed | |
| 23 | + | |
| 24 | +- `crates/ec-av1/src/decode.rs` (compound 8x8 leaf, after the `comp_group_idx`/ | |
| 25 | + `compound_idx` reads): reads `interp_filter` in libaom's order, with `get_ref_filter_type` | |
| 26 | + neighbour contexts keyed on `ref0` and `is_compound = true`; suppression term is | |
| 27 | + `skip_mode || is_nontrans_global_motion` (GLOBAL_GLOBALMV + both refs' models non- | |
| 28 | + TRANSLATION; WARPED_CAUSAL cannot occur on compound). The 12 `predict_compound_intermediate` | |
| 29 | + taps now use the resolved `h_filter`/`v_filter` instead of `Regular`. | |
| 30 | +- `crates/ec-av1/src/decode.rs` `neighbour_filter`: returns `Result`; the `[3, 3]` sentinel | |
| 31 | + is now the named refusal `an OBMC neighbour whose interp filter was never recorded (no | |
| 32 | + switchable symbol for that block)` -- **never a panic**. Both OBMC call sites `?` it. | |
| 33 | +- `crates/ec-av1/src/decode.rs`: counters `DUAL_FILTER_DIFF_HITS` (a block whose two | |
| 34 | + dual-filter directions differ -- impossible with dual filter off) and | |
| 35 | + `COMPOUND8_FILTER_HITS`. | |
| 36 | +- `crates/ec-av1/src/refusal_inventory.rs`: the new refusal listed (inventory test green). | |
| 37 | +- `crates/ec-av1/src/stream.rs`: `inter_sb_none_gate` takes a `frame_count` | |
| 38 | + (4 frames never code a compound block); new gate | |
| 39 | + `a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` | |
| 40 | + (`--enable-dual-filter=1 --enable-obmc=1 --enable-warped-motion=1 --enable-onesided-comp=1` | |
| 41 | + on the `--min-partition-size=8 --enable-ab-partitions=0 --enable-1to4-partitions=0` | |
| 42 | + recipe, every frame compared Y/U/V vs ffmpeg, hard asserts on all three counters). | |
| 43 | +- `crates/ec-av1/src/decode.rs` test | |
| 44 | + `an_obmc_neighbour_with_no_recorded_filter_refuses_instead_of_panicking`. | |
| 45 | + | |
| 46 | +## Gate: RED, `#[ignore]`d with the measurement, not deleted | |
| 47 | + | |
| 48 | +`EC_INTERP3_FRAMES=4` -> aomenc codes no compound block, stream decodes. | |
| 49 | +From 5 frames on it does, and the decode stops at a refusal that the recipe makes | |
| 50 | +impossible: `an inter 16x16-level AB or 1:4 partition` WITH this round's filter read, and | |
| 51 | +`an inter partition below 8x8` WITHOUT it (measured by ablating the read behind a temporary | |
| 52 | +env switch, since removed). `--enable-ab-partitions=0 --enable-1to4-partitions=0 | |
| 53 | +--min-partition-size=8` cannot emit either -- so both are our own desync | |
| 54 | +(class `refusal-from-own-desync`): the compound 8x8 leaf carries at least one more | |
| 55 | +missing/misplaced symbol beyond the interp filter. The fix is therefore **necessary but not | |
| 56 | +sufficient** and is not claimed as pixel-proven. | |
| 57 | + | |
| 58 | +EVIDENCE: $HOME/.cache/interp3-suite-r1.log | `cargo test -p ec-av1 --lib -j3` under a | |
| 59 | +systemd user unit, MemoryMax=10G | totals below | |
| 60 | +EVIDENCE: gate run `EC_INTERP3_FRAMES=5..16 cargo test -p ec-av1 --lib a_real_aomenc_dual_filter_obmc_8x8` with and without the new read | 6 encodes x 2 arms | refusal string differs per arm (AB/1:4 vs below-8x8), 0 frames compared either way -- gate RED, ignored | |
| 61 | +EVIDENCE: `cargo test -p ec-av1 --lib an_obmc_neighbour_with_no_recorded` | direct call with the `[3, 3]` sentinel | 1 passed: refuses by name, no panic | |
| 62 | + | |
| 63 | +## Panic sweep of the decode path (charter clause) | |
| 64 | + | |
| 65 | +`neighbour_filter` was the only `panic!` reachable from a *stream-derived value* on the OBMC | |
| 66 | +path; converted. The rest of `decode.rs`'s 57 `panic!/unreachable!/unwrap/expect` sites, | |
| 67 | +inspected: `2733, 11268, 11617, 11636, 11683, 11996, 12015, 12052, 13820, 13998, 15225, | |
| 68 | +15533` are `unreachable!` on values a CDF alphabet or an earlier refusal already bounds | |
| 69 | +(cannot fire on any stream); `5238, 5282, 6043, 6110, 7310, 7311, 7777, 7778, 10479, 10535, | |
| 70 | +10679, 10888` are `unwrap/expect` on this decoder's own just-built state; everything above | |
| 71 | +line 22700 is inside `#[cfg(test)]`. Two remain flagged, not converted (they need a `Result` | |
| 72 | +in a counter/table helper and no stream is known to reach them): | |
| 73 | +`decode.rs:2486` `panic!("ref_hits: no per-reference counter for ref_frame {other}")` and | |
| 74 | +`decode.rs:3247` `panic!("intra mode {other} has no Intra_Mode_To_Tx_Type entry")`. | |
| 75 | +`mc.rs:203`/`:220` stay as documented invariants -- both callers now check first. | |
| 76 | + | |
| 77 | +## Residue | |
| 78 | + | |
| 79 | +- fix-now(next round): the remaining compound-8x8 desync. Method: `EC_TRACE=1` aomdec range | |
| 80 | + ladder against ours on the FIRST compound leaf of frame 5 of the gate's stream, comparing | |
| 81 | + msac RANGE element by element (never `tell()`). | |
| 82 | +- deferred(needs that fix): the 10-bit arm of the new gate, and the counter-proving | |
| 83 | + pixel-exact claim. |