merge: lane-uv8 7f372b9 into lane-intra14 -- 8x8 intra tx_type set, OBMC trace, keep the newer OBMC refusal wording
Browse files at this commit12 changed files +1468 -89
- crates/ec-av1/src/decode.rs +447 -85
- crates/ec-av1/src/refusal_inventory.rs +1 -2
- crates/ec-av1/src/stream.rs +369 -2
- lanes/interp3-r1.report.md +96 -0
- lanes/interp3-r2.handoff.md +48 -0
- lanes/interp3-r2.report.md +88 -0
- lanes/interp3-r3.handoff.md +88 -0
- lanes/interp3-r3.report.md +106 -0
- lanes/uv8-r1.handoff.md +64 -0
- lanes/uv8-r2.handoff.md +65 -0
- lanes/uv8-r3.handoff.md +54 -0
- lanes/uv8-r3.report.md +42 -0
crates/ec-av1/src/decode.rsmodified+447 -85
| @@ -171,6 +171,26 @@ pub(crate) fn intra_in_inter_angle_delta_uv_hits() -> usize { | ||
| 171 | 171 | INTRA_IN_INTER_ANGLE_DELTA_UV_HITS.with(|c| c.get()) |
| 172 | 172 | } |
| 173 | 173 | |
| 174 | +// lane-uv8 r1: the three non-DC chroma mode classes an INTRA 8x8 leaf inside | |
| 175 | +// an INTER frame ([`decode_inter_block8`]'s intra arm) can carry -- the arm | |
| 176 | +// read `uv_mode` and then refused everything but `DC_PRED`. Counted here and | |
| 177 | +// nowhere else so the gate's assert cannot be satisfied by a >=16x16 block. | |
| 178 | +thread_local! { | |
| 179 | + static INTRA_IN_INTER8_UV_DIR_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 180 | + static INTRA_IN_INTER8_UV_SMOOTH_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 181 | + static INTRA_IN_INTER8_UV_CFL_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 182 | +} | |
| 183 | + | |
| 184 | +/// `(directional, smooth/paeth, CfL)` chroma modes coded by an intra 8x8 leaf | |
| 185 | +/// inside an inter frame -- see [`INTRA_IN_INTER8_UV_DIR_HITS`]. | |
| 186 | +pub(crate) fn intra_in_inter8_uv_hits() -> (usize, usize, usize) { | |
| 187 | + ( | |
| 188 | + INTRA_IN_INTER8_UV_DIR_HITS.with(|c| c.get()), | |
| 189 | + INTRA_IN_INTER8_UV_SMOOTH_HITS.with(|c| c.get()), | |
| 190 | + INTRA_IN_INTER8_UV_CFL_HITS.with(|c| c.get()), | |
| 191 | + ) | |
| 192 | +} | |
| 193 | + | |
| 174 | 194 | // lane-realworld r1: this frame's `cdef.bits` (spec 5.9.19), threaded into |
| 175 | 195 | // [`maybe_read_cdef_idx`] the same way [`ENABLE_EDGE_FILTER`] threads a |
| 176 | 196 | // frame-level flag through the recursive block decode -- `0` (the default) |
| @@ -1779,6 +1799,32 @@ thread_local! { | ||
| 1779 | 1799 | static OBMC_HITS_8: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 1780 | 1800 | } |
| 1781 | 1801 | |
| 1802 | +// lane-interp3 r1: how many inter blocks read a SWITCHABLE `interp_filter` | |
| 1803 | +// pair whose two directions differ (`enable_dual_filter` only -- with dual | |
| 1804 | +// filter off both directions take the single symbol, so this can never fire). | |
| 1805 | +// A gate asserting it proves the stream really carries dual-filter blocks. | |
| 1806 | +thread_local! { | |
| 1807 | + static DUAL_FILTER_DIFF_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1808 | +} | |
| 1809 | + | |
| 1810 | +// lane-interp3 r1: how many COMPOUND 8x8 leaves read their own | |
| 1811 | +// `read_mb_interp_filter` symbol(s) -- the read this round added (the leaf | |
| 1812 | +// used to skip it entirely, losing a symbol and stamping the `[3, 3]` | |
| 1813 | +// no-filter sentinel that made a neighbouring OBMC block panic). | |
| 1814 | +thread_local! { | |
| 1815 | + static COMPOUND8_FILTER_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; | |
| 1816 | +} | |
| 1817 | + | |
| 1818 | +/// Current value of [`DUAL_FILTER_DIFF_HITS`]. | |
| 1819 | +pub(crate) fn dual_filter_diff_hits() -> usize { | |
| 1820 | + DUAL_FILTER_DIFF_HITS.with(|c| c.get()) | |
| 1821 | +} | |
| 1822 | + | |
| 1823 | +/// Current value of [`COMPOUND8_FILTER_HITS`]. | |
| 1824 | +pub(crate) fn compound8_filter_hits() -> usize { | |
| 1825 | + COMPOUND8_FILTER_HITS.with(|c| c.get()) | |
| 1826 | +} | |
| 1827 | + | |
| 1782 | 1828 | // lane-warp round 1: how many blocks resolved `motion_mode_allowed` to |
| 1783 | 1829 | // `WARPED_CAUSAL`-eligible (3-symbol read, `num_proj_ref >= 1` under |
| 1784 | 1830 | // `allow_warped_motion`) AND the symbol actually decoded to `WARPED_CAUSAL` |
| @@ -1810,6 +1856,20 @@ pub(crate) fn compound_warp_hits() -> usize { | ||
| 1810 | 1856 | COMPOUND_WARP_HITS.with(|c| c.get()) |
| 1811 | 1857 | } |
| 1812 | 1858 | |
| 1859 | +// lane-interp3 r3: the same proof narrowed to the 8x8 LEAF's own compound | |
| 1860 | +// arm ([`decode_inter_block8`]) -- that arm predicted both taps | |
| 1861 | +// translationally until r3, so a gate needs to tell a warped 8x8 compound | |
| 1862 | +// leaf apart from a warped 16x16+ one (both bump [`COMPOUND_WARP_HITS`]). | |
| 1863 | +thread_local! { | |
| 1864 | + static COMPOUND_WARP_HITS_8: std::cell::Cell<usize> = | |
| 1865 | + const { std::cell::Cell::new(0) }; | |
| 1866 | +} | |
| 1867 | + | |
| 1868 | +/// Current value of [`COMPOUND_WARP_HITS_8`]. | |
| 1869 | +pub(crate) fn compound_warp_hits_8() -> usize { | |
| 1870 | + COMPOUND_WARP_HITS_8.with(|c| c.get()) | |
| 1871 | +} | |
| 1872 | + | |
| 1813 | 1873 | // lane-gmaffine r1: how many blocks built their prediction from a |
| 1814 | 1874 | // SIX-parameter (`AFFINE`) global-motion model through |
| 1815 | 1875 | // `crate::warp::global_warp_params` -- the gate's proof that a stream really |
| @@ -15613,6 +15673,13 @@ pub(crate) fn decode_key_frame_tile_with_cdfs( | ||
| 15613 | 15673 | // that isolate whether a decode-order frame's mismatch already exists |
| 15614 | 15674 | // in reconstruction (this dump) vs is introduced by the loop filter |
| 15615 | 15675 | // (EC_AV1_DECODE_ORDER_DUMP's post-filter dump). |
| 15676 | + // Decode-order frame marker for the EC_OBMC / EC_TRACE_MODE ladders. | |
| 15677 | + if std::env::var_os("EC_OBMC").is_some() || std::env::var_os("EC_TRACE_MODE").is_some() { | |
| 15678 | + eprintln!( | |
| 15679 | + "EC_PICT idx={}", | |
| 15680 | + PREFILT_PICTURE_IDX.load(std::sync::atomic::Ordering::SeqCst) | |
| 15681 | + ); | |
| 15682 | + } | |
| 15616 | 15683 | dump_stage16("EC_AV1_PREFILT_DUMP16", &y, &u, &v, frame_width as usize, frame_height as usize); |
| 15617 | 15684 | if let Ok(path) = std::env::var("EC_AV1_PREFILT_DUMP") { |
| 15618 | 15685 | use std::io::Write; |
| @@ -15827,6 +15894,9 @@ fn resolve_interp_filter( | ||
| 15827 | 15894 | } else { |
| 15828 | 15895 | sym0 |
| 15829 | 15896 | }; |
| 15897 | + if enable_dual_filter && sym0 != sym1 { | |
| 15898 | + DUAL_FILTER_DIFF_HITS.with(|c| c.set(c.get() + 1)); | |
| 15899 | + } | |
| 15830 | 15900 | if std::env::var_os("EC_TRACE_MODE").is_some() { |
| 15831 | 15901 | eprintln!( |
| 15832 | 15902 | "EC_IF ctx0={ctx0} above={above:?} left={left:?} sym0={sym0} sym1={sym1} rng={}", |
| @@ -16495,15 +16565,15 @@ fn neighbour_filter( | ||
| 16495 | 16565 | if let Some(kind) = interp_fixed { |
| 16496 | 16566 | return Ok((kind, kind)); |
| 16497 | 16567 | } |
| 16498 | - // lane-golomb r9: this used to hand the sentinel straight to | |
| 16499 | - // `from_switchable_symbol`, which PANICS on any value above 2 -- a crash | |
| 16500 | - // on stream data (measured on a real 192x68 cq40 aomenc stream, where an | |
| 16501 | - // inter leaf below 8x8 desyncs upstream and leaves an unrecorded filter | |
| 16502 | - // behind). A decoder must refuse such a stream by name, never abort the | |
| 16503 | - // process; the desync that produces the sentinel belongs to lane-intersub8. | |
| 16568 | + // lane-interp3 r1: the `[3, 3]` sentinel reaching here is a DEFECT in | |
| 16569 | + // whatever path recorded the neighbour (an inter block that never stored | |
| 16570 | + // its own switchable symbols), and it used to abort the process through | |
| 16571 | + // `from_switchable_symbol`'s panic. A decoder must never crash on a real | |
| 16572 | + // stream: it stops by name instead, so the frame is refused and the | |
| 16573 | + // stream is pinned like every other unsupported case. | |
| 16504 | 16574 | if sym[0] > 2 || sym[1] > 2 { |
| 16505 | 16575 | return Err(unsupported( |
| 16506 | - "an OBMC neighbour whose switchable interp filter was never recorded", | |
| 16576 | + "an OBMC neighbour whose interp filter was never recorded (no switchable symbol for that block)", | |
| 16507 | 16577 | )); |
| 16508 | 16578 | } |
| 16509 | 16579 | Ok(( |
| @@ -16689,6 +16759,71 @@ fn obmc_blend_h(dst: &mut [u16], stride: usize, ox: usize, oy: usize, w: usize, | ||
| 16689 | 16759 | } |
| 16690 | 16760 | } |
| 16691 | 16761 | |
| 16762 | +/// libaom's own `BLOCK_SIZE` enum index for a `w4`x`h4` (mi-unit) block -- | |
| 16763 | +/// only for the `EC_OBMC` trace rung below, so it reads byte-identical to | |
| 16764 | +/// the instrumented aomdec's `backup_mbmi.bsize`. | |
| 16765 | +fn ec_obmc_bsize(w4: usize, h4: usize) -> i32 { | |
| 16766 | + match (w4, h4) { | |
| 16767 | + (1, 1) => 0, | |
| 16768 | + (1, 2) => 1, | |
| 16769 | + (2, 1) => 2, | |
| 16770 | + (2, 2) => 3, | |
| 16771 | + (2, 4) => 4, | |
| 16772 | + (4, 2) => 5, | |
| 16773 | + (4, 4) => 6, | |
| 16774 | + (4, 8) => 7, | |
| 16775 | + (8, 4) => 8, | |
| 16776 | + (8, 8) => 9, | |
| 16777 | + (8, 16) => 10, | |
| 16778 | + (16, 8) => 11, | |
| 16779 | + (16, 16) => 12, | |
| 16780 | + (1, 4) => 16, | |
| 16781 | + (4, 1) => 17, | |
| 16782 | + (2, 8) => 18, | |
| 16783 | + (8, 2) => 19, | |
| 16784 | + (4, 16) => 20, | |
| 16785 | + (16, 4) => 21, | |
| 16786 | + _ => -1, | |
| 16787 | + } | |
| 16788 | +} | |
| 16789 | + | |
| 16790 | +/// The `EC_OBMC` rung: one line per blended neighbour, in the instrumented | |
| 16791 | +/// aomdec's own byte format (`decodeframe.c` | |
| 16792 | +/// `dec_build_prediction_by_{above,left}_pred`), so the two decoders' OBMC | |
| 16793 | +/// neighbour lists diff line for line. `filt` is libaom's packed | |
| 16794 | +/// `interp_filters.as_int` = `y_filter | (x_filter << 16)`. | |
| 16795 | +#[allow(clippy::too_many_arguments)] | |
| 16796 | +fn ec_obmc_trace( | |
| 16797 | + dir: &str, | |
| 16798 | + mi_row: usize, | |
| 16799 | + mi_col: usize, | |
| 16800 | + write_w: usize, | |
| 16801 | + write_h: usize, | |
| 16802 | + rel: usize, | |
| 16803 | + op: usize, | |
| 16804 | + nb: &MiInfo, | |
| 16805 | + h_kind: mc::InterpFilterKind, | |
| 16806 | + v_kind: mc::InterpFilterKind, | |
| 16807 | +) { | |
| 16808 | + if std::env::var_os("EC_OBMC").is_none() { | |
| 16809 | + return; | |
| 16810 | + } | |
| 16811 | + let sym = |k: mc::InterpFilterKind| match k { | |
| 16812 | + mc::InterpFilterKind::Smooth => 1u32, | |
| 16813 | + mc::InterpFilterKind::Sharp => 2, | |
| 16814 | + _ => 0, | |
| 16815 | + }; | |
| 16816 | + eprintln!( | |
| 16817 | + "EC_OBMC {dir} mi=({mi_row},{mi_col}) wh=({write_w}x{write_h}) rel={rel} op={op} \ | |
| 16818 | +nbmv=({},{}) nbref={} nbbsize={} filt={}", | |
| 16819 | + nb.mv.0, | |
| 16820 | + nb.mv.1, | |
| 16821 | + nb.ref_frame, | |
| 16822 | + ec_obmc_bsize(nb.size, nb.size_h), | |
| 16823 | + sym(v_kind) | (sym(h_kind) << 16), | |
| 16824 | + ); | |
| 16825 | +} | |
| 16826 | + | |
| 16692 | 16827 | /// `av1_build_obmc_inter_prediction` (libaom `reconinter.c`): re-predicts |
| 16693 | 16828 | /// the overlap strip against each bordering above/left inter neighbour's own |
| 16694 | 16829 | /// mv/ref/filter and blends it into this block's just-built single-reference |
| @@ -16788,6 +16923,7 @@ fn obmc_blend( | ||
| 16788 | 16923 | interp_fixed, |
| 16789 | 16924 | neighbours.above_filter[mi_col + off4], |
| 16790 | 16925 | )?; |
| 16926 | + ec_obmc_trace("above", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind); | |
| 16791 | 16927 | let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?; |
| 16792 | 16928 | let nb_scale = mc::scale_factor(ny.width, frame_width); |
| 16793 | 16929 | let (bw, bh, ox) = (span4 * 4, overlap_above, off4 * 4); |
| @@ -16807,6 +16943,7 @@ fn obmc_blend( | ||
| 16807 | 16943 | interp_fixed, |
| 16808 | 16944 | neighbours.left_filter[mi_row + off4], |
| 16809 | 16945 | )?; |
| 16946 | + ec_obmc_trace("left", mi_row, mi_col, write_w, write_h, off4, span4, &nb, h_kind, v_kind); | |
| 16810 | 16947 | let (ny, nu, nv) = ref_planes(nb.ref_frame, ref_y, ref_u, ref_v, other_refs)?; |
| 16811 | 16948 | let nb_scale = mc::scale_factor(ny.width, frame_width); |
| 16812 | 16949 | let (bw, bh, oy) = (overlap_left, span4 * 4, off4 * 4); |
| @@ -21113,7 +21250,6 @@ fn decode_inter_block8( | ||
| 21113 | 21250 | const CHROMA_SIDE: usize = 4; |
| 21114 | 21251 | |
| 21115 | 21252 | let (r, c) = outer_at; |
| 21116 | - let _ = (r, c); | |
| 21117 | 21253 | // lane-inter8 r2: this leaf's OWN mi cell, not the enclosing 16x16's -- |
| 21118 | 21254 | // leaf (mi_r, mi_c + 2)'s left neighbour is leaf (mi_r, mi_c), and the |
| 21119 | 21255 | // left column of a 16x16's second leaf ROW is the previous 16x16 block's |
| @@ -21168,6 +21304,10 @@ fn decode_inter_block8( | ||
| 21168 | 21304 | } |
| 21169 | 21305 | |
| 21170 | 21306 | let mode_for_tx; |
| 21307 | + // lane-uv8 r1: this leaf's chroma prediction mode (`get_uv_mode` of the | |
| 21308 | + // coded `uv_mode`), for the neighbour bands at the tail. An INTER leaf | |
| 21309 | + // stores `UV_DC_PRED`, exactly as [`decode_inter_block`] one level up. | |
| 21310 | + let mut uv_predict_mode = DC_PRED; | |
| 21171 | 21311 | let (luma_grid, u_grid, v_grid); |
| 21172 | 21312 | let mut compound_ctx8: Option<(i8, i8, u8, u8)> = None; |
| 21173 | 21313 | // lane-inter8 r1: this leaf's own resolved references, handed back so the |
| @@ -21200,21 +21340,24 @@ fn decode_inter_block8( | ||
| 21200 | 21340 | let (ref0, ref1) = if skip_mode { |
| 21201 | 21341 | (skip_mode_frame[0] as i8, skip_mode_frame[1] as i8) |
| 21202 | 21342 | } else { |
| 21343 | + // lane-interp3 r2 (class twin-functions-drift): this leaf | |
| 21344 | + // passed a hard-coded `LAST_FRAME` for every inter | |
| 21345 | + // neighbour -- the old "coarse LAST_FRAME-or-intra" | |
| 21346 | + // approximation -- while the side bands have carried the | |
| 21347 | + // neighbour's REAL reference per mi since lane-inter8 r2. | |
| 21348 | + // Every `av1_collect_neighbors_ref_counts` vote below | |
| 21349 | + // (`uni_comp_ref_p1`, `comp_ref`, `comp_bwdref`, ...) was | |
| 21350 | + // therefore taken off the wrong CDF row. Same two args | |
| 21351 | + // [`decode_inter_block`]'s own compound arm passes | |
| 21352 | + // (`-1` when the band is unavailable is start_tile's / | |
| 21353 | + // start_row's own reset value, so no `has_above` guard). | |
| 21203 | 21354 | read_compound_ref_frames( |
| 21204 | 21355 | dec, |
| 21205 | 21356 | cdfs, |
| 21206 | 21357 | above_nbr, |
| 21207 | 21358 | left_nbr, |
| 21208 | - if has_above && above_inter { | |
| 21209 | - LAST_FRAME | |
| 21210 | - } else { | |
| 21211 | - -1 | |
| 21212 | - }, | |
| 21213 | - if has_left && left_inter { | |
| 21214 | - LAST_FRAME | |
| 21215 | - } else { | |
| 21216 | - -1 | |
| 21217 | - }, | |
| 21359 | + above_ref0, | |
| 21360 | + left_ref0, | |
| 21218 | 21361 | ) |
| 21219 | 21362 | }; |
| 21220 | 21363 | leaf_refs = (ref0, Some(ref1)); |
| @@ -21395,6 +21538,58 @@ fn decode_inter_block8( | ||
| 21395 | 21538 | ); |
| 21396 | 21539 | } |
| 21397 | 21540 | |
| 21541 | + // lane-interp3 r1: `read_mb_interp_filter` (libaom | |
| 21542 | + // `decodemv.c` 1575, the tail of | |
| 21543 | + // `read_inter_block_mode_info`) runs for EVERY inter block, | |
| 21544 | + // compound included, right AFTER `read_compound_type` -- this | |
| 21545 | + // leaf read no filter symbol at all, so a SWITCHABLE-filter | |
| 21546 | + // stream lost one symbol (two under `enable_dual_filter`) at | |
| 21547 | + // every compound 8x8 leaf, and the leaf recorded the `[3, 3]` | |
| 21548 | + // "no filter" sentinel, which made a neighbouring OBMC block's | |
| 21549 | + // `neighbour_filter` PANIC instead of blending. | |
| 21550 | + // `av1_is_interp_needed` suppression terms for this arm: | |
| 21551 | + // `skip_mode`, and `is_nontrans_global_motion` (mode | |
| 21552 | + // GLOBAL_GLOBALMV with BOTH refs' models non-TRANSLATION) -- | |
| 21553 | + // WARPED_CAUSAL cannot occur on a compound block. | |
| 21554 | + let gm_nontrans_c = compound_mode == 6 | |
| 21555 | + && global_motion[(ref0 - LAST_FRAME) as usize].model | |
| 21556 | + != ec_av1_syntax::WarpModel::Translation | |
| 21557 | + && global_motion[(ref1 - LAST_FRAME) as usize].model | |
| 21558 | + != ec_av1_syntax::WarpModel::Translation; | |
| 21559 | + // spec `get_ref_filter_type`, keyed on this block's ref0 and | |
| 21560 | + // matching EITHER of the neighbour's references -- same shape | |
| 21561 | + // as [`decode_inter_block`]'s compound arm. Same corner-cut as | |
| 21562 | + // this leaf's single-ref arm below: the context comes from the | |
| 21563 | + // enclosing 16x16's coarse slot. | |
| 21564 | + let above_filter_ctx = if neighbours.above_ref[cmi] == ref0 | |
| 21565 | + || neighbours.above_ref1[cmi] == Some(ref0) | |
| 21566 | + { | |
| 21567 | + neighbours.above_filter[cmi] | |
| 21568 | + } else { | |
| 21569 | + [3, 3] | |
| 21570 | + }; | |
| 21571 | + let left_filter_ctx = if neighbours.left_ref[rmi] == ref0 | |
| 21572 | + || neighbours.left_ref1[rmi] == Some(ref0) | |
| 21573 | + { | |
| 21574 | + neighbours.left_filter[rmi] | |
| 21575 | + } else { | |
| 21576 | + [3, 3] | |
| 21577 | + }; | |
| 21578 | + let (h_filter, v_filter, resolved_filter) = resolve_interp_filter( | |
| 21579 | + dec, | |
| 21580 | + cdfs, | |
| 21581 | + interp_fixed, | |
| 21582 | + enable_dual_filter, | |
| 21583 | + gm_nontrans_c || skip_mode, | |
| 21584 | + above_filter_ctx, | |
| 21585 | + left_filter_ctx, | |
| 21586 | + true, | |
| 21587 | + ); | |
| 21588 | + leaf_filter_syms = resolved_filter; | |
| 21589 | + if interp_fixed.is_none() && !(gm_nontrans_c || skip_mode) { | |
| 21590 | + COMPOUND8_FILTER_HITS.with(|c| c.set(c.get() + 1)); | |
| 21591 | + } | |
| 21592 | + | |
| 21398 | 21593 | let (py0, pu0, pv0) = ref_planes(ref0, ref_y, ref_u, ref_v, other_refs)?; |
| 21399 | 21594 | let (py1, pu1, pv1) = ref_planes(ref1, ref_y, ref_u, ref_v, other_refs)?; |
| 21400 | 21595 | let scale0 = mc::scale_factor(py0.width, frame_width); |
| @@ -21404,6 +21599,54 @@ fn decode_inter_block8( | ||
| 21404 | 21599 | SCALED_BLOCK8_HITS.with(|c| c.set(c.get() + 1)); |
| 21405 | 21600 | } |
| 21406 | 21601 | |
| 21602 | + // lane-interp3 r2 (class twin-functions-drift): both slots | |
| 21603 | + // used to be stamped `false`, while [`decode_inter_block`]'s | |
| 21604 | + // compound arm computes libaom's PER-SLOT `is_global_mv_block` | |
| 21605 | + // (blockd.h:421-429 -- mode GLOBAL_GLOBALMV, block >= 8x8 | |
| 21606 | + // (always true for this leaf) and THAT slot's own gm model > | |
| 21607 | + // TRANSLATION). A neighbour carrying the flag makes | |
| 21608 | + // `setup_ref_mv_list` substitute the READER's global mv for | |
| 21609 | + // the neighbour's stored one, so a cleared flag fed the next | |
| 21610 | + // block's stack a stored mv where libaom has the global | |
| 21611 | + // candidate -- a wrong mv stack, wrong mode contexts, and a | |
| 21612 | + // desync one block later. | |
| 21613 | + let is_globalmv_c = compound_mode == 6; | |
| 21614 | + let is_global_mv0_c = is_globalmv_c | |
| 21615 | + && global_motion[(ref0 - LAST_FRAME) as usize].model as u8 > 1; | |
| 21616 | + let is_global_mv1_c = is_globalmv_c | |
| 21617 | + && global_motion[(ref1 - LAST_FRAME) as usize].model as u8 > 1; | |
| 21618 | + // lane-interp3 r3 (class twin-functions-drift, second | |
| 21619 | + // instance): libaom applies `allow_warp`'s GLOBAL branch | |
| 21620 | + // (`reconinter.c:33-55`, reached from `av1_init_warp_params` | |
| 21621 | + // inside `build_inter_predictors_8x8_and_bigger`'s per-`ref` | |
| 21622 | + // loop) to EVERY `is_global_mv_block` slot, compound | |
| 21623 | + // included and independently of `motion_mode` -- the 16x16+ | |
| 21624 | + // compound arm has done this since lane-cwarp r1, this leaf | |
| 21625 | + // predicted both taps translationally, so a GLOBAL_GLOBALMV | |
| 21626 | + // 8x8 compound leaf under a non-TRANSLATION model drifted by | |
| 21627 | + // a few luma levels, growing away from the block origin. | |
| 21628 | + // `force_integer_mv` short-circuits `av1_init_warp_params` | |
| 21629 | + // before `allow_warp`; chroma is 4x4 here, below | |
| 21630 | + // `av1_init_warp_params`'s own 8px per-plane bound, so only | |
| 21631 | + // luma warps (same rule as this leaf's single-ref arm). | |
| 21632 | + let leaf_compound_warp = |ref_frame: i8, eligible: bool| { | |
| 21633 | + if eligible | |
| 21634 | + && !force_integer_mv | |
| 21635 | + && !global_motion[(ref_frame - LAST_FRAME) as usize].invalid | |
| 21636 | + { | |
| 21637 | + crate::warp::global_warp_params( | |
| 21638 | + global_motion[(ref_frame - LAST_FRAME) as usize].params, | |
| 21639 | + ) | |
| 21640 | + } else { | |
| 21641 | + None | |
| 21642 | + } | |
| 21643 | + }; | |
| 21644 | + let warp0_c = leaf_compound_warp(ref0, is_global_mv0_c); | |
| 21645 | + let warp1_c = leaf_compound_warp(ref1, is_global_mv1_c); | |
| 21646 | + if warp0_c.is_some() || warp1_c.is_some() { | |
| 21647 | + COMPOUND_WARP_HITS.with(|c| c.set(c.get() + 1)); | |
| 21648 | + COMPOUND_WARP_HITS_8.with(|c| c.set(c.get() + 1)); | |
| 21649 | + } | |
| 21407 | 21650 | for dr in 0..2 { |
| 21408 | 21651 | for dc in 0..2 { |
| 21409 | 21652 | grid.set( |
| @@ -21418,51 +21661,14 @@ fn decode_inter_block8( | ||
| 21418 | 21661 | is_new_mv: matches!(compound_mode, 2 | 3 | 4 | 5 | 7), |
| 21419 | 21662 | size: 2, |
| 21420 | 21663 | size_h: 2, |
| 21421 | - is_global_mv0: false, | |
| 21422 | - is_global_mv1: false, | |
| 21664 | + is_global_mv0: is_global_mv0_c, | |
| 21665 | + is_global_mv1: is_global_mv1_c, | |
| 21423 | 21666 | }, |
| 21424 | 21667 | ); |
| 21425 | 21668 | } |
| 21426 | 21669 | } |
| 21427 | 21670 | mode_for_tx = 0; |
| 21428 | 21671 | |
| 21429 | - // lane-intersub8 r2: the compound 8x8 leaf used to hard-code | |
| 21430 | - // `Regular` and leave `leaf_filter_syms` at the `[3, 3]` | |
| 21431 | - // "no filter" sentinel. libaom reads `read_mb_interp_filter` | |
| 21432 | - // here for EVERY inter block (`decodemv.c` | |
| 21433 | - // `read_inter_block_mode_info`, right after | |
| 21434 | - // `read_compound_type`), and when `av1_is_interp_needed` is 0 | |
| 21435 | - // -- `skip_mode`, or a non-translational GLOBALMV -- | |
| 21436 | - // `set_default_interp_filters` stores EIGHTTAP_REGULAR (0), | |
| 21437 | - // NOT a sentinel. A later block whose ref matches this one | |
| 21438 | - // then reads `av1_get_pred_context_switchable_interp` off | |
| 21439 | - // that stored 0, so recording `[3, 3]` shifted its | |
| 21440 | - // `switchable_interp` context and desynced the tile. | |
| 21441 | - let above_filter_ctx = if neighbours.above_ref[cmi] == ref0 | |
| 21442 | - || neighbours.above_ref1[cmi] == Some(ref0) | |
| 21443 | - { | |
| 21444 | - neighbours.above_filter[cmi] | |
| 21445 | - } else { | |
| 21446 | - [3, 3] | |
| 21447 | - }; | |
| 21448 | - let left_filter_ctx = if neighbours.left_ref[rmi] == ref0 | |
| 21449 | - || neighbours.left_ref1[rmi] == Some(ref0) | |
| 21450 | - { | |
| 21451 | - neighbours.left_filter[rmi] | |
| 21452 | - } else { | |
| 21453 | - [3, 3] | |
| 21454 | - }; | |
| 21455 | - let (h_filter, v_filter, resolved_filter) = resolve_interp_filter( | |
| 21456 | - dec, | |
| 21457 | - cdfs, | |
| 21458 | - interp_fixed, | |
| 21459 | - enable_dual_filter, | |
| 21460 | - skip_mode, | |
| 21461 | - above_filter_ctx, | |
| 21462 | - left_filter_ctx, | |
| 21463 | - true, | |
| 21464 | - ); | |
| 21465 | - leaf_filter_syms = resolved_filter; | |
| 21466 | 21672 | let mut inter0_y = vec![0i32; SIDE * SIDE]; |
| 21467 | 21673 | mc::predict_compound_intermediate( |
| 21468 | 21674 | &py0.data, |
| @@ -21478,6 +21684,13 @@ fn decode_inter_block8( | ||
| 21478 | 21684 | v_filter, |
| 21479 | 21685 | &mut inter0_y, |
| 21480 | 21686 | ); |
| 21687 | + if let Some(wp) = &warp0_c { | |
| 21688 | + crate::warp::warp_affine_compound( | |
| 21689 | + wp, &py0.data, py0.true_width as i32, py0.true_height as i32, | |
| 21690 | + py0.width as i32, &mut inter0_y, px as i32, py as i32, SIDE as i32, | |
| 21691 | + SIDE as i32, SIDE as i32, 0, 0, | |
| 21692 | + ); | |
| 21693 | + } | |
| 21481 | 21694 | let mut inter1_y = vec![0i32; SIDE * SIDE]; |
| 21482 | 21695 | mc::predict_compound_intermediate( |
| 21483 | 21696 | &py1.data, |
| @@ -21493,6 +21706,13 @@ fn decode_inter_block8( | ||
| 21493 | 21706 | v_filter, |
| 21494 | 21707 | &mut inter1_y, |
| 21495 | 21708 | ); |
| 21709 | + if let Some(wp) = &warp1_c { | |
| 21710 | + crate::warp::warp_affine_compound( | |
| 21711 | + wp, &py1.data, py1.true_width as i32, py1.true_height as i32, | |
| 21712 | + py1.width as i32, &mut inter1_y, px as i32, py as i32, SIDE as i32, | |
| 21713 | + SIDE as i32, SIDE as i32, 0, 0, | |
| 21714 | + ); | |
| 21715 | + } | |
| 21496 | 21716 | let mut pred_y = vec![0u16; SIDE * SIDE]; |
| 21497 | 21717 | let mut diffwtd_mask_y = Vec::new(); |
| 21498 | 21718 | let mask_y: Option<&[u8]> = if let Some(mask_type) = diffwtd_mask_type { |
| @@ -21766,6 +21986,17 @@ fn decode_inter_block8( | ||
| 21766 | 21986 | &gm_table, |
| 21767 | 21987 | tpl, |
| 21768 | 21988 | ); |
| 21989 | + // lane-interp3 r2: same per-entry EC_STACK ladder | |
| 21990 | + // [`decode_inter_block`]'s single-ref arm prints, so this leaf's stack | |
| 21991 | + // diffs line for line against the oracle's. | |
| 21992 | + if std::env::var_os("EC_TRACE_MODE").is_some() { | |
| 21993 | + for (i, e) in stack.entries.iter().enumerate() { | |
| 21994 | + eprintln!( | |
| 21995 | + "EC_STACK mi_row={mi_row} mi_col={mi_col} ref={ref_frame} i={i} this=({},{}) comp=(0,0) w={}", | |
| 21996 | + e.mv.0, e.mv.1, e.weight | |
| 21997 | + ); | |
| 21998 | + } | |
| 21999 | + } | |
| 21769 | 22000 | |
| 21770 | 22001 | let not_new = dec.symbol(&mut cdfs.new_mv[stack.new_mv_ctx]) == 1; |
| 21771 | 22002 | let mut is_globalmv = false; |
| @@ -22287,12 +22518,62 @@ fn decode_inter_block8( | ||
| 22287 | 22518 | this leaf with one; the >=16x16 arm decodes deltas)", |
| 22288 | 22519 | )); |
| 22289 | 22520 | } |
| 22521 | + // lane-uv8 r1: the delta'd angle decides the intra edge filter, and a | |
| 22522 | + // directional luma mode is already legal on this leaf -- the arm | |
| 22523 | + // passed a hardcoded `false` where [`decode_leaf8`] reads the | |
| 22524 | + // mi-exact neighbour modes (`get_intra_edge_filter_type`, spec | |
| 22525 | + // 7.11.2). | |
| 22526 | + let (above_mode, left_mode) = | |
| 22527 | + neighbours.modes_above_left_mi(leaf_mi.0, leaf_mi.1, neighbours.modes_above_left(r, c)); | |
| 22528 | + let smooth_neighbor = is_smooth_mode(above_mode) || is_smooth_mode(left_mode); | |
| 22529 | + // lane-uv8 r1: libaom `read_intra_block_mode_info` (decodemv.c:1198-1207) | |
| 22530 | + // -- `uv_mode` over the CFL-allowed alphabet (`is_cfl_allowed`: a | |
| 22531 | + // BLOCK_8X8 leaf is inside the 32x32 bound), then `read_cfl_alphas` | |
| 22532 | + // for `UV_CFL_PRED`, then `angle_delta_uv` off the MAPPED uv mode's | |
| 22533 | + // row (`get_uv_mode`, identity over `V_PRED..=D67_PRED`). Every value | |
| 22534 | + // but `DC_PRED` was refused here, which is what blocked the low-cq | |
| 22535 | + // CDEF arms and the 10-bit gates. | |
| 22290 | 22536 | let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]); |
| 22291 | - if uv_mode != DC_PRED { | |
| 22292 | - return Err(unsupported( | |
| 22293 | - "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)", | |
| 22294 | - )); | |
| 22537 | + if std::env::var_os("EC_TRACE_MODE_STEP").is_some() { | |
| 22538 | + eprintln!( | |
| 22539 | + "EC_ISTEP8 mi_row={} mi_col={} name=modes y={mode} uv={uv_mode} fi_enabled={} rng={}", | |
| 22540 | + leaf_mi.0, | |
| 22541 | + leaf_mi.1, | |
| 22542 | + ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get), | |
| 22543 | + dec.debug_state().0 | |
| 22544 | + ); | |
| 22295 | 22545 | } |
| 22546 | + if (9..=12).contains(&uv_mode) { | |
| 22547 | + SMOOTH_UV_HITS.with(|c| c.set(c.get() + 1)); | |
| 22548 | + INTRA_IN_INTER8_UV_SMOOTH_HITS.with(|c| c.set(c.get() + 1)); | |
| 22549 | + } | |
| 22550 | + let alpha = if uv_mode == UV_CFL_PRED { | |
| 22551 | + INTRA_IN_INTER8_UV_CFL_HITS.with(|c| c.set(c.get() + 1)); | |
| 22552 | + Some(read_cfl_alphas(dec, cdfs)) | |
| 22553 | + } else { | |
| 22554 | + None | |
| 22555 | + }; | |
| 22556 | + let angle_delta_uv = if (V_PRED..=D67_PRED).contains(&uv_mode) { | |
| 22557 | + DIRECTIONAL_UV_HITS.with(|c| c.set(c.get() + 1)); | |
| 22558 | + INTRA_IN_INTER8_UV_DIR_HITS.with(|c| c.set(c.get() + 1)); | |
| 22559 | + read_angle_delta(dec, &mut cdfs.angle_delta[uv_mode - V_PRED]) | |
| 22560 | + } else { | |
| 22561 | + 0 | |
| 22562 | + }; | |
| 22563 | + if angle_delta_uv != 0 { | |
| 22564 | + UV_ANGLE_DELTA_HITS.with(|c| c.set(c.get() + 1)); | |
| 22565 | + INTRA_IN_INTER_ANGLE_DELTA_UV_HITS.with(|c| c.set(c.get() + 1)); | |
| 22566 | + } | |
| 22567 | + // `get_uv_mode` (spec 9.3): `UV_CFL_PRED` predicts as `DC_PRED`. | |
| 22568 | + uv_predict_mode = if uv_mode == UV_CFL_PRED { | |
| 22569 | + DC_PRED | |
| 22570 | + } else { | |
| 22571 | + uv_mode | |
| 22572 | + }; | |
| 22573 | + // The CHROMA neighbour's own `uv_mode` decides the chroma edge filter | |
| 22574 | + // strength (`get_intra_edge_filter_type`, reconintra.c:974), never the | |
| 22575 | + // luma one -- same read [`decode_leaf8`] does. | |
| 22576 | + let smooth_neighbor_uv = neighbours.smooth_uv_neighbour(leaf_mi.0, leaf_mi.1, r, c); | |
| 22296 | 22577 | // lane-screen r2: see [`decode_inter_block`]'s own copy -- `mode`/ |
| 22297 | 22578 | // `uv_mode` are both effectively `DC_PRED`-gated already on this |
| 22298 | 22579 | // leaf (a nonzero `mode` still passes, but `uv_mode` is forced |
| @@ -22304,7 +22585,10 @@ fn decode_inter_block8( | ||
| 22304 | 22585 | "a block that actually uses a palette (Y) -- reconstruction is out of scope", |
| 22305 | 22586 | )); |
| 22306 | 22587 | } |
| 22307 | - if dec.symbol(&mut cdfs.palette_uv_mode[0]) != 0 { | |
| 22588 | + // lane-uv8 r1: `read_palette_mode_info` reads the UV symbol only | |
| 22589 | + // when `uv_mode == UV_DC_PRED` (decodemv.c) -- unconditional here | |
| 22590 | + // while every non-DC uv_mode was refused a few lines above. | |
| 22591 | + if uv_mode == DC_PRED && dec.symbol(&mut cdfs.palette_uv_mode[0]) != 0 { | |
| 22308 | 22592 | return Err(unsupported( |
| 22309 | 22593 | "a block that actually uses a palette (UV) -- reconstruction is out of scope", |
| 22310 | 22594 | )); |
| @@ -22319,14 +22603,39 @@ fn decode_inter_block8( | ||
| 22319 | 22603 | // `av1_filter_intra_allowed`'s `palette_size[0] == 0` term is implied: |
| 22320 | 22604 | // a real palette-Y block already returned above. |
| 22321 | 22605 | let mut filter_intra = None; |
| 22606 | + // lane-uv8 r2: the oracle's `EC_ISTEP` ladder (`EC_TRACE_MODE_STEP`) | |
| 22607 | + // prints `use_filter_intra` for an intra block inside an INTER frame | |
| 22608 | + // and nothing else, so this leaf needs the same two lines for a | |
| 22609 | + // range-ladder diff against it. | |
| 22610 | + let ec_istep8 = std::env::var_os("EC_TRACE_MODE_STEP").is_some(); | |
| 22322 | 22611 | if mode == DC_PRED |
| 22323 | 22612 | && ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get) |
| 22324 | 22613 | && let Some(class) = filter_intra_size_class(SIDE) |
| 22325 | - && dec.symbol(&mut cdfs.filter_intra[class]) != 0 | |
| 22326 | 22614 | { |
| 22327 | - FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1)); | |
| 22328 | - INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1)); | |
| 22329 | - filter_intra = Some(dec.symbol(&mut cdfs.filter_intra_mode)); | |
| 22615 | + let use_fi = dec.symbol(&mut cdfs.filter_intra[class]) != 0; | |
| 22616 | + if ec_istep8 { | |
| 22617 | + eprintln!( | |
| 22618 | + "EC_ISTEP mi_row={} mi_col={} name=use_filter_intra val={} rng={}", | |
| 22619 | + leaf_mi.0, | |
| 22620 | + leaf_mi.1, | |
| 22621 | + u8::from(use_fi), | |
| 22622 | + dec.debug_state().0 | |
| 22623 | + ); | |
| 22624 | + } | |
| 22625 | + if use_fi { | |
| 22626 | + FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1)); | |
| 22627 | + INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1)); | |
| 22628 | + let fi = dec.symbol(&mut cdfs.filter_intra_mode); | |
| 22629 | + if ec_istep8 { | |
| 22630 | + eprintln!( | |
| 22631 | + "EC_ISTEP mi_row={} mi_col={} name=filter_intra_mode val={fi} rng={}", | |
| 22632 | + leaf_mi.0, | |
| 22633 | + leaf_mi.1, | |
| 22634 | + dec.debug_state().0 | |
| 22635 | + ); | |
| 22636 | + } | |
| 22637 | + filter_intra = Some(fi); | |
| 22638 | + } | |
| 22330 | 22639 | } |
| 22331 | 22640 | mode_for_tx = mode; |
| 22332 | 22641 | let (mi_row, mi_col) = leaf_mi; |
| @@ -22385,31 +22694,34 @@ fn decode_inter_block8( | ||
| 22385 | 22694 | &vec![0i32; SIDE * SIDE], |
| 22386 | 22695 | None, |
| 22387 | 22696 | filter_intra, |
| 22388 | - false, | |
| 22697 | + smooth_neighbor, | |
| 22389 | 22698 | ); |
| 22699 | + // CfL's AC contribution is the luma this leaf just reconstructed, | |
| 22700 | + // averaged over the 4x4 chroma block (`cfl_ac_q3`, spec 7.11.5). | |
| 22701 | + let ac = alpha.map(|_| cfl_ac_q3(y, px, py, SIDE)); | |
| 22390 | 22702 | u.reconstruct( |
| 22391 | 22703 | cpx, |
| 22392 | 22704 | cpy, |
| 22393 | 22705 | CHROMA_SIDE, |
| 22394 | - DC_PRED, | |
| 22395 | - 0, | |
| 22706 | + uv_predict_mode, | |
| 22707 | + angle_delta_uv, | |
| 22396 | 22708 | reach, |
| 22397 | 22709 | &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], |
| 22710 | + alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | |
| 22398 | 22711 | None, |
| 22399 | - None, | |
| 22400 | - false, | |
| 22712 | + smooth_neighbor_uv, | |
| 22401 | 22713 | ); |
| 22402 | 22714 | v.reconstruct( |
| 22403 | 22715 | cpx, |
| 22404 | 22716 | cpy, |
| 22405 | 22717 | CHROMA_SIDE, |
| 22406 | - DC_PRED, | |
| 22407 | - 0, | |
| 22718 | + uv_predict_mode, | |
| 22719 | + angle_delta_uv, | |
| 22408 | 22720 | reach, |
| 22409 | 22721 | &vec![0i32; CHROMA_SIDE * CHROMA_SIDE], |
| 22722 | + alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | |
| 22410 | 22723 | None, |
| 22411 | - None, | |
| 22412 | - false, | |
| 22724 | + smooth_neighbor_uv, | |
| 22413 | 22725 | ); |
| 22414 | 22726 | luma_grid = vec![0i32; SIDE * SIDE]; |
| 22415 | 22727 | u_grid = vec![0i32; CHROMA_SIDE * CHROMA_SIDE]; |
| @@ -22419,7 +22731,15 @@ fn decode_inter_block8( | ||
| 22419 | 22731 | luma_grid = read_plane( |
| 22420 | 22732 | dec, |
| 22421 | 22733 | cdfs, |
| 22422 | - TxbSet::Luma8, | |
| 22734 | + // lane-uv8 r3: an intra leaf inside an inter frame is | |
| 22735 | + // `is_inter == 0` in `av1_get_ext_tx_set_type`, so its 8x8 | |
| 22736 | + // luma reads the INTRA set -- seven-type | |
| 22737 | + // `EXT_TX_SET_DTT4_IDTX_1DDCT` when `reduced_tx_set == 0`, | |
| 22738 | + // five-type `EXT_TX_SET_DTT4_IDTX` when it is 1. Hardcoding | |
| 22739 | + // the reduced set read the wrong ALPHABET (class | |
| 22740 | + // [[wrong-alphabet-same-value]]) and desynced at the leaf's | |
| 22741 | + // first `tx_type`. | |
| 22742 | + txbset_for(8, reduced_tx_set), | |
| 22423 | 22743 | scan8, |
| 22424 | 22744 | 0, |
| 22425 | 22745 | around[0], |
| @@ -22436,8 +22756,9 @@ fn decode_inter_block8( | ||
| 22436 | 22756 | None, |
| 22437 | 22757 | filter_intra, |
| 22438 | 22758 | None, |
| 22439 | - false, | |
| 22759 | + smooth_neighbor, | |
| 22440 | 22760 | )?; |
| 22761 | + let ac = alpha.map(|_| cfl_ac_q3(y, px, py, SIDE)); | |
| 22441 | 22762 | u_grid = read_plane( |
| 22442 | 22763 | dec, |
| 22443 | 22764 | cdfs, |
| @@ -22446,8 +22767,8 @@ fn decode_inter_block8( | ||
| 22446 | 22767 | 1, |
| 22447 | 22768 | around[1], |
| 22448 | 22769 | mode, |
| 22449 | - DC_PRED, | |
| 22450 | - 0, | |
| 22770 | + uv_predict_mode, | |
| 22771 | + angle_delta_uv, | |
| 22451 | 22772 | reach, |
| 22452 | 22773 | u, |
| 22453 | 22774 | cpx, |
| @@ -22455,10 +22776,10 @@ fn decode_inter_block8( | ||
| 22455 | 22776 | CHROMA_SIDE, |
| 22456 | 22777 | TX4, |
| 22457 | 22778 | base_q_idx, |
| 22779 | + alpha.zip(ac.as_deref()).map(|((au, _), ac)| (au, ac)), | |
| 22458 | 22780 | None, |
| 22459 | 22781 | None, |
| 22460 | - None, | |
| 22461 | - false, | |
| 22782 | + smooth_neighbor_uv, | |
| 22462 | 22783 | )?; |
| 22463 | 22784 | v_grid = read_plane( |
| 22464 | 22785 | dec, |
| @@ -22468,8 +22789,8 @@ fn decode_inter_block8( | ||
| 22468 | 22789 | 2, |
| 22469 | 22790 | around[2], |
| 22470 | 22791 | mode, |
| 22471 | - DC_PRED, | |
| 22472 | - 0, | |
| 22792 | + uv_predict_mode, | |
| 22793 | + angle_delta_uv, | |
| 22473 | 22794 | reach, |
| 22474 | 22795 | v, |
| 22475 | 22796 | cpx, |
| @@ -22477,10 +22798,10 @@ fn decode_inter_block8( | ||
| 22477 | 22798 | CHROMA_SIDE, |
| 22478 | 22799 | TX4, |
| 22479 | 22800 | base_q_idx, |
| 22801 | + alpha.zip(ac.as_deref()).map(|((_, av), ac)| (av, ac)), | |
| 22480 | 22802 | None, |
| 22481 | 22803 | None, |
| 22482 | - None, | |
| 22483 | - false, | |
| 22804 | + smooth_neighbor_uv, | |
| 22484 | 22805 | )?; |
| 22485 | 22806 | } |
| 22486 | 22807 | } |
| @@ -22502,6 +22823,16 @@ fn decode_inter_block8( | ||
| 22502 | 22823 | ) |
| 22503 | 22824 | }); |
| 22504 | 22825 | neighbours.record_mi(leaf_mi, 8, &[luma_grid, u_grid, v_grid]); |
| 22826 | + // lane-uv8 r1: this leaf never stamped a mode band at all, so the block | |
| 22827 | + // below/right of it read whatever block last wrote the coarse [`SUB`] | |
| 22828 | + // slot -- now that an intra leaf here can code a smooth/directional | |
| 22829 | + // `uv_mode`, its chroma neighbours must see it (and an inter leaf must | |
| 22830 | + // stamp `DC_PRED`, what libaom stores for a non-intra block). Same pair | |
| 22831 | + // [`decode_leaf8`] writes, plus the coarse fallback slots. | |
| 22832 | + neighbours.above_uv_mode[c] = uv_predict_mode; | |
| 22833 | + neighbours.left_uv_mode[r] = uv_predict_mode; | |
| 22834 | + neighbours.record_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, mode_for_tx); | |
| 22835 | + neighbours.record_uv_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, uv_predict_mode); | |
| 22505 | 22836 | if let Some((left, above)) = saved_luma_ctx { |
| 22506 | 22837 | for (cell, state) in left.into_iter().enumerate() { |
| 22507 | 22838 | neighbours.left[leaf_mi.0 + cell][0] = state; |
| @@ -24901,6 +25232,13 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs( | ||
| 24901 | 25232 | // that isolate whether a decode-order frame's mismatch already exists |
| 24902 | 25233 | // in reconstruction (this dump) vs is introduced by the loop filter |
| 24903 | 25234 | // (EC_AV1_DECODE_ORDER_DUMP's post-filter dump). |
| 25235 | + // Decode-order frame marker for the EC_OBMC / EC_TRACE_MODE ladders. | |
| 25236 | + if std::env::var_os("EC_OBMC").is_some() || std::env::var_os("EC_TRACE_MODE").is_some() { | |
| 25237 | + eprintln!( | |
| 25238 | + "EC_PICT idx={}", | |
| 25239 | + PREFILT_PICTURE_IDX.load(std::sync::atomic::Ordering::SeqCst) | |
| 25240 | + ); | |
| 25241 | + } | |
| 24904 | 25242 | dump_stage16("EC_AV1_PREFILT_DUMP16", &y, &u, &v, frame_width as usize, frame_height as usize); |
| 24905 | 25243 | if let Ok(path) = std::env::var("EC_AV1_PREFILT_DUMP") { |
| 24906 | 25244 | use std::io::Write; |
| @@ -25311,6 +25649,30 @@ mod tests { | ||
| 25311 | 25649 | /// always cleared to `None` by `record_inter`, so the next block's own |
| 25312 | 25650 | /// `NeighbourRef::uni` -- and `comp_reference_type_ctx` downstream of it |
| 25313 | 25651 | /// -- could never see a real compound neighbour). |
| 25652 | + /// lane-interp3 r1: a decoder must never abort the process on | |
| 25653 | + /// stream-derived state. `neighbour_filter` used to feed the `[3, 3]` | |
| 25654 | + /// "no filter recorded" sentinel straight into | |
| 25655 | + /// `InterpFilterKind::from_switchable_symbol`, whose `panic!` ("...alphabet | |
| 25656 | + /// is exactly 3 symbols") crashed on a real aomenc dual-filter + OBMC | |
| 25657 | + /// stream. It now refuses by name; the real symbols still decode. | |
| 25658 | + #[test] | |
| 25659 | + fn an_obmc_neighbour_with_no_recorded_filter_refuses_instead_of_panicking() { | |
| 25660 | + assert!( | |
| 25661 | + neighbour_filter(None, [3, 3]) | |
| 25662 | + .unwrap_err() | |
| 25663 | + .to_string() | |
| 25664 | + .contains("an OBMC neighbour whose interp filter was never recorded"), | |
| 25665 | + "the [3, 3] sentinel must refuse by name, never panic" | |
| 25666 | + ); | |
| 25667 | + assert!(neighbour_filter(None, [3, 0]).is_err()); | |
| 25668 | + let (h, v) = neighbour_filter(None, [0, 2]).expect("real symbols decode"); | |
| 25669 | + assert_eq!(h, mc::InterpFilterKind::Sharp, "sym[1] is the horizontal kernel"); | |
| 25670 | + assert_eq!(v, mc::InterpFilterKind::Regular, "sym[0] is the vertical kernel"); | |
| 25671 | + let (h, v) = neighbour_filter(Some(mc::InterpFilterKind::Smooth), [3, 3]) | |
| 25672 | + .expect("a fixed-filter frame never reads a symbol"); | |
| 25673 | + assert_eq!((h, v), (mc::InterpFilterKind::Smooth, mc::InterpFilterKind::Smooth)); | |
| 25674 | + } | |
| 25675 | + | |
| 25314 | 25676 | #[test] |
| 25315 | 25677 | fn record_compound_ctx_stamps_ref1_for_the_next_block_to_read() { |
| 25316 | 25678 | let mut n = Neighbours::new(4, 4, 16, 16); |
crates/ec-av1/src/refusal_inventory.rsmodified+1 -2
| @@ -25,7 +25,6 @@ | ||
| 25 | 25 | #[cfg(test)] |
| 26 | 26 | const CAPABILITY_CLAIMS: &[&str] = &[ |
| 27 | 27 | "filter intra on a superblock-level HORZ/VERT strip (never expected -- av1_filter_intra_allowed_bsize caps at 32x32)", |
| 28 | - "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)", | |
| 29 | 28 | ]; |
| 30 | 29 | |
| 31 | 30 | #[cfg(test)] |
| @@ -33,7 +32,7 @@ const REFUSALS: &[&str] = &[ | ||
| 33 | 32 | "a nonzero angle delta on an 8x8 intra leaf in an inter frame (no gate reaches this leaf with one; the >=16x16 arm decodes deltas)", |
| 34 | 33 | "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here", |
| 35 | 34 | "a split intra strip whose transform unit is {tx_w}x{tx_h} (no luma coefficient tables for that shape here)", |
| 36 | - "an OBMC neighbour whose switchable interp filter was never recorded", | |
| 35 | + "an OBMC neighbour whose interp filter was never recorded (no switchable symbol for that block)", | |
| 37 | 36 | "an intra 4x4 block inside an inter frame's sub-8x8 split (this decoder codes only inter 4x4 sub-blocks there)", |
| 38 | 37 | "an intra 8x4/4x8 block inside an inter frame's sub-8x8 HORZ/VERT partition (this decoder codes only inter sub-blocks there)", |
| 39 | 38 | "a sub-8x8 inter block under a scaled reference (superres, unimplemented)", |
crates/ec-av1/src/stream.rsmodified+369 -2
| @@ -6657,6 +6657,283 @@ mod tests { | ||
| 6657 | 6657 | ); |
| 6658 | 6658 | } |
| 6659 | 6659 | |
| 6660 | + /// lane-uv8 r1 (classes [[refusal-strings-are-claims]] + | |
| 6661 | + /// [[tool-disabled-in-every-gate]]): a real aomenc inter sequence with | |
| 6662 | + /// 8x8 partitions and full chroma intra tooling | |
| 6663 | + /// (`--enable-cfl-intra=1 --enable-smooth-intra=1 --enable-paeth-intra=1 | |
| 6664 | + /// --enable-directional-intra=1`), in which the RD gives an INTRA 8x8 | |
| 6665 | + /// leaf inside an inter frame a NON-DC `uv_mode`. That leaf | |
| 6666 | + /// ([`decode::decode_inter_block8`]'s intra arm) read the `uv_mode` | |
| 6667 | + /// symbol and refused every value but `DC_PRED` -- "this encoder never | |
| 6668 | + /// writes one" was a claim, and this gate is what contradicts it. Hard- | |
| 6669 | + /// asserts `decode::intra_in_inter8_uv_hits` (directional, smooth/paeth, | |
| 6670 | + /// CfL, counted on THIS leaf only); an attempt that never produced one | |
| 6671 | + /// proves nothing, and exhausting every attempt is a FAILURE, not a SKIP. | |
| 6672 | + #[test] | |
| 6673 | + fn a_real_aomenc_inter_sequence_with_a_non_dc_chroma_8x8_intra_leaf_decodes_pixel_exact() { | |
| 6674 | + uv_mode_in_inter8_gate(8, 1); | |
| 6675 | + } | |
| 6676 | + | |
| 6677 | + /// The 10-bit arm (both of the user's films are `yuv420p10le`). | |
| 6678 | + #[test] | |
| 6679 | + fn a_real_aomenc_10bit_inter_sequence_with_a_non_dc_chroma_8x8_intra_leaf_decodes_pixel_exact() { | |
| 6680 | + uv_mode_in_inter8_gate(10, 1); | |
| 6681 | + } | |
| 6682 | + | |
| 6683 | + /// The multi-tile arm (class [[new-map-ignores-tile-edge]]): this round | |
| 6684 | + /// stamps a new `uv_mode` band from the 8x8 leaf, whose availability must | |
| 6685 | + /// be tile-relative. | |
| 6686 | + #[test] | |
| 6687 | + fn a_real_aomenc_two_tile_inter_sequence_with_a_non_dc_chroma_8x8_intra_leaf_decodes_pixel_exact() | |
| 6688 | + { | |
| 6689 | + uv_mode_in_inter8_gate(8, 2); | |
| 6690 | + } | |
| 6691 | + | |
| 6692 | + fn uv_mode_in_inter8_gate(bit_depth: u32, tile_columns: u32) { | |
| 6693 | + let name = format!("uv_mode_in_inter8_gate({bit_depth}, tiles={tile_columns})"); | |
| 6694 | + if !have_ffmpeg() { | |
| 6695 | + eprintln!("SKIP {name}: no ffmpeg"); | |
| 6696 | + return; | |
| 6697 | + } | |
| 6698 | + if !have_aomenc() { | |
| 6699 | + eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display()); | |
| 6700 | + return; | |
| 6701 | + } | |
| 6702 | + let (width, height, frame_count) = (192usize, 128usize, 8usize); | |
| 6703 | + let mut refusals = Vec::new(); | |
| 6704 | + let mut uncounted_exact = 0u32; | |
| 6705 | + let mut totals = (0usize, 0usize, 0usize); | |
| 6706 | + for attempt in 0..30u32 { | |
| 6707 | + let seed = 42 + attempt; | |
| 6708 | + // A zooming fractal with a hard CUT at frame 4 (`overlay` | |
| 6709 | + // switching a second, unrelated fractal on): after the cut a block | |
| 6710 | + // is unpredictable from the reference, which is what makes aomenc | |
| 6711 | + // code INTRA blocks inside an inter frame. Chroma is NOT | |
| 6712 | + // desaturated here (every sibling inter gate passes `hue=s=0`) -- | |
| 6713 | + // real chroma detail is exactly what pushes the chroma RD off | |
| 6714 | + // DC_PRED. `noise` carries its own explicit seed (lavfi | |
| 6715 | + // `gradients` ignores its seed; class [[seeded-fixture-not-reproducible]]). | |
| 6716 | + let source = format!( | |
| 6717 | + "mandelbrot=size={width}x{height}:start_scale={}:rate=25[a];\ | |
| 6718 | + mandelbrot=size={width}x{height}:start_scale={}:rate=25[b];\ | |
| 6719 | + [a][b]overlay=enable='gte(n,4)',noise=alls=12:allf=t+u:all_seed={seed}", | |
| 6720 | + 5.0 - f64::from(attempt) * 0.06, | |
| 6721 | + 0.9 + f64::from(attempt) * 0.11 | |
| 6722 | + ); | |
| 6723 | + let y4m = Command::new("ffmpeg") | |
| 6724 | + .args([ | |
| 6725 | + "-v", | |
| 6726 | + "error", | |
| 6727 | + "-f", | |
| 6728 | + "lavfi", | |
| 6729 | + "-i", | |
| 6730 | + &source, | |
| 6731 | + "-pix_fmt", | |
| 6732 | + if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" }, | |
| 6733 | + "-strict", | |
| 6734 | + "-1", | |
| 6735 | + "-t", | |
| 6736 | + "0.32", | |
| 6737 | + "-f", | |
| 6738 | + "yuv4mpegpipe", | |
| 6739 | + "-strict", | |
| 6740 | + "-1", | |
| 6741 | + "-", | |
| 6742 | + ]) | |
| 6743 | + .stdin(Stdio::null()) | |
| 6744 | + .stdout(Stdio::piped()) | |
| 6745 | + .stderr(Stdio::piped()) | |
| 6746 | + .output() | |
| 6747 | + .expect("ffmpeg failed to run"); | |
| 6748 | + assert!( | |
| 6749 | + y4m.status.success(), | |
| 6750 | + "ffmpeg fixture: {}", | |
| 6751 | + String::from_utf8_lossy(&y4m.stderr) | |
| 6752 | + ); | |
| 6753 | + // A coarser quantiser is what pushes the chroma RD to a cheap | |
| 6754 | + // non-DC mode on a small block; sweep 12..40 (the low end is what | |
| 6755 | + // lane-cdef's cq12 arm needs). | |
| 6756 | + let cq = format!("--cq-level={}", 12 + (attempt % 5) * 7); | |
| 6757 | + let depth_args: &[&str] = if bit_depth == 10 { | |
| 6758 | + &["-b", "10", "--input-bit-depth=10"] | |
| 6759 | + } else { | |
| 6760 | + &[] | |
| 6761 | + }; | |
| 6762 | + let tiles = format!("--tile-columns={}", tile_columns - 1); | |
| 6763 | + // The y4m goes through a FILE, not aomenc's stdin: this gate's | |
| 6764 | + // stream is ~100 KB, bigger than a pipe buffer, so an aomenc that | |
| 6765 | + // is still being fed on stdin blocks writing its stdout and the | |
| 6766 | + // test blocks writing its stdin -- a hard deadlock (measured | |
| 6767 | + // here, 3 min into attempt 0, class [[gate-loader-slurps-whole-file]]). | |
| 6768 | + // The path is PID-keyed (class [[pid-keyed-temp-path]]). | |
| 6769 | + let y4m_path = std::env::temp_dir().join(format!( | |
| 6770 | + "ec-av1-uv8-{}-{bit_depth}-{tile_columns}-{seed}.y4m", | |
| 6771 | + std::process::id() | |
| 6772 | + )); | |
| 6773 | + std::fs::write(&y4m_path, &y4m.stdout).expect("writing the y4m fixture"); | |
| 6774 | + let child = Command::new(aomenc_path()) | |
| 6775 | + .args(depth_args) | |
| 6776 | + .args([ | |
| 6777 | + "--codec=av1", | |
| 6778 | + "--passes=1", | |
| 6779 | + "--end-usage=q", | |
| 6780 | + &cq, | |
| 6781 | + "--cpu-used=0", | |
| 6782 | + "--lag-in-frames=0", | |
| 6783 | + "--auto-alt-ref=0", | |
| 6784 | + "--kf-max-dist=9999", | |
| 6785 | + "--kf-min-dist=9999", | |
| 6786 | + "--threads=1", | |
| 6787 | + "--row-mt=0", | |
| 6788 | + &tiles, | |
| 6789 | + "--enable-order-hint=0", | |
| 6790 | + "--enable-warped-motion=0", | |
| 6791 | + "--enable-obmc=0", | |
| 6792 | + "--enable-masked-comp=0", | |
| 6793 | + "--enable-interintra-comp=0", | |
| 6794 | + "--enable-dist-wtd-comp=0", | |
| 6795 | + "--enable-diff-wtd-comp=0", | |
| 6796 | + "--enable-onesided-comp=0", | |
| 6797 | + "--enable-interintra-wedge=0", | |
| 6798 | + "--enable-smooth-interintra=0", | |
| 6799 | + "--enable-ab-partitions=0", | |
| 6800 | + "--enable-1to4-partitions=0", | |
| 6801 | + "--enable-cdef=0", | |
| 6802 | + "--enable-restoration=0", | |
| 6803 | + "--enable-palette=0", | |
| 6804 | + "--enable-intrabc=0", | |
| 6805 | + "--enable-ref-frame-mvs=0", | |
| 6806 | + // Per-arm overrides go LAST (aomenc keeps the LAST | |
| 6807 | + // occurrence of a repeated --enable-* flag). The three | |
| 6808 | + // chroma intra tools this gate is about, plus the fences | |
| 6809 | + // that keep the leaf's SIBLING refusals (its TX_4X4 | |
| 6810 | + // split, a nonzero angle delta, sub-16 rect inter leaves) | |
| 6811 | + // out of the way. | |
| 6812 | + "--enable-cfl-intra=1", | |
| 6813 | + "--enable-smooth-intra=1", | |
| 6814 | + "--enable-paeth-intra=1", | |
| 6815 | + "--enable-directional-intra=1", | |
| 6816 | + "--enable-angle-delta=0", | |
| 6817 | + "--enable-tx-size-search=0", | |
| 6818 | + "--enable-rect-partitions=0", | |
| 6819 | + "--min-partition-size=8", | |
| 6820 | + "--max-partition-size=32", | |
| 6821 | + "--obu", | |
| 6822 | + "-o", | |
| 6823 | + "-", | |
| 6824 | + ]) | |
| 6825 | + .arg(&y4m_path) | |
| 6826 | + .stdin(Stdio::null()) | |
| 6827 | + .stdout(Stdio::piped()) | |
| 6828 | + .stderr(Stdio::piped()) | |
| 6829 | + .spawn() | |
| 6830 | + .expect("aomenc failed to start"); | |
| 6831 | + let out = child.wait_with_output().expect("aomenc failed to run"); | |
| 6832 | + let _ = std::fs::remove_file(&y4m_path); | |
| 6833 | + assert!( | |
| 6834 | + out.status.success(), | |
| 6835 | + "aomenc refused the fixture: {}", | |
| 6836 | + String::from_utf8_lossy(&out.stderr) | |
| 6837 | + ); | |
| 6838 | + let stream = out.stdout; | |
| 6839 | + let before = decode::intra_in_inter8_uv_hits(); | |
| 6840 | + let frames = match decode_stream(&stream) { | |
| 6841 | + Ok(frames) => frames, | |
| 6842 | + Err(e) => { | |
| 6843 | + let msg = e.to_string(); | |
| 6844 | + assert!( | |
| 6845 | + msg.contains("unsupported"), | |
| 6846 | + "{name} decode failed outright (seed {seed}): {msg}" | |
| 6847 | + ); | |
| 6848 | + refusals.push(format!("seed {seed}: {msg}")); | |
| 6849 | + continue; | |
| 6850 | + } | |
| 6851 | + }; | |
| 6852 | + let now = decode::intra_in_inter8_uv_hits(); | |
| 6853 | + // class [[counter-from-refused-stream]]: per-attempt deltas, and | |
| 6854 | + // only for an attempt that decoded to the end and is pixel- | |
| 6855 | + // compared below. | |
| 6856 | + let fired = (now.0 - before.0, now.1 - before.1, now.2 - before.2); | |
| 6857 | + totals = ( | |
| 6858 | + totals.0 + fired.0, | |
| 6859 | + totals.1 + fired.1, | |
| 6860 | + totals.2 + fired.2, | |
| 6861 | + ); | |
| 6862 | + // class [[gate-skips-on-its-own-failure]]: a decode that succeeded | |
| 6863 | + // is ALWAYS pixel-compared; the counter only decides whether the | |
| 6864 | + // attempt counts as firing. | |
| 6865 | + // lane-uv8 r3: every one of the three chroma classes this gate | |
| 6866 | + // exists for (directional, smooth/paeth, CfL) must fire on the | |
| 6867 | + // SAME pixel-compared attempt -- a sum-nonzero predicate would | |
| 6868 | + // pass on an attempt that only ever hit DC-adjacent CfL. | |
| 6869 | + let counted = fired.0 > 0 && fired.1 > 0 && fired.2 > 0; | |
| 6870 | + if !counted { | |
| 6871 | + uncounted_exact += 1; | |
| 6872 | + refusals.push(format!( | |
| 6873 | + "seed {seed}: decoded and pixel-compared, but no 8x8 intra leaf in an inter \ | |
| 6874 | + frame carried a non-DC uv_mode" | |
| 6875 | + )); | |
| 6876 | + } | |
| 6877 | + let ffmpeg_frames = if bit_depth == 10 { | |
| 6878 | + ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) | |
| 6879 | + } else { | |
| 6880 | + ffmpeg_decode_sequence(&stream, width, height, frame_count) | |
| 6881 | + }; | |
| 6882 | + assert_eq!(frames.len(), frame_count); | |
| 6883 | + eprintln!( | |
| 6884 | + "{name} seed={seed} {cq}: 8x8 intra-in-inter leaves with a non-DC uv_mode -- \ | |
| 6885 | + directional {}, smooth/paeth {}, CfL {}", | |
| 6886 | + fired.0, fired.1, fired.2 | |
| 6887 | + ); | |
| 6888 | + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | |
| 6889 | + for (plane, (g, w)) in [ | |
| 6890 | + ("Y", (&got.y, &want.y)), | |
| 6891 | + ("U", (&got.u, &want.u)), | |
| 6892 | + ("V", (&got.v, &want.v)), | |
| 6893 | + ] { | |
| 6894 | + let stride = if plane == "Y" { width } else { width / 2 }; | |
| 6895 | + if let Some(at) = g.iter().zip(w.iter()).position(|(a, b)| a != b) { | |
| 6896 | + eprintln!( | |
| 6897 | + "{name} seed={seed}: frame {i} {plane} first diff at ({}, {}) got {} \ | |
| 6898 | + want {} ({} samples differ)", | |
| 6899 | + at % stride, | |
| 6900 | + at / stride, | |
| 6901 | + g[at], | |
| 6902 | + w[at], | |
| 6903 | + g.iter().zip(w.iter()).filter(|(a, b)| a != b).count(), | |
| 6904 | + ); | |
| 6905 | + } | |
| 6906 | + } | |
| 6907 | + } | |
| 6908 | + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { | |
| 6909 | + assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg (seed {seed})"); | |
| 6910 | + assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})"); | |
| 6911 | + assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})"); | |
| 6912 | + } | |
| 6913 | + if counted { | |
| 6914 | + gate_buckets( | |
| 6915 | + &name, | |
| 6916 | + 1, | |
| 6917 | + uncounted_exact, | |
| 6918 | + refusals.len() - uncounted_exact as usize, | |
| 6919 | + ); | |
| 6920 | + return; | |
| 6921 | + } | |
| 6922 | + } | |
| 6923 | + gate_buckets( | |
| 6924 | + &name, | |
| 6925 | + 0, | |
| 6926 | + uncounted_exact, | |
| 6927 | + refusals.len() - uncounted_exact as usize, | |
| 6928 | + ); | |
| 6929 | + panic!( | |
| 6930 | + "{name} never observed a non-DC uv_mode on an 8x8 intra leaf in an inter frame \ | |
| 6931 | + (totals dir/smooth/cfl {totals:?}):\n{}", | |
| 6932 | + refusals.join("\n") | |
| 6933 | + ); | |
| 6934 | + } | |
| 6935 | + | |
| 6936 | + | |
| 6660 | 6937 | /// lane-chroma r2 stage 1: a real aomenc key frame with |
| 6661 | 6938 | /// `--enable-smooth-intra=1` (opposite of every sibling recipe's `=0`) |
| 6662 | 6939 | /// and `--enable-paeth-intra=0` -- paeth chroma stays off so the still- |
| @@ -7165,6 +7442,9 @@ mod tests { | ||
| 7165 | 7442 | // aomenc silently codes one tile column and the arm is vacuous. |
| 7166 | 7443 | extra: &[&str], |
| 7167 | 7444 | width: usize, |
| 7445 | + // lane-interp3 r1: sequence length -- a compound block needs several | |
| 7446 | + // already-coded references, which a 4-frame sequence never has. | |
| 7447 | + frame_count: usize, | |
| 7168 | 7448 | ) { |
| 7169 | 7449 | if !have_ffmpeg() { |
| 7170 | 7450 | eprintln!("SKIP {name}: no ffmpeg"); |
| @@ -7174,7 +7454,8 @@ mod tests { | ||
| 7174 | 7454 | eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display()); |
| 7175 | 7455 | return; |
| 7176 | 7456 | } |
| 7177 | - let (height, frame_count) = (64usize, 4usize); | |
| 7457 | + let height = 64usize; | |
| 7458 | + let duration = format!("{:.2}", frame_count as f64 / 25.0); | |
| 7178 | 7459 | // A deterministic synthetic source with real motion (a static source |
| 7179 | 7460 | // codes every inter frame as skip and never exercises the residual |
| 7180 | 7461 | // path); bounded with `-t` (class gate-loader-slurps-whole-file). |
| @@ -7187,7 +7468,7 @@ mod tests { | ||
| 7187 | 7468 | "-i", |
| 7188 | 7469 | &format!("mandelbrot=size={width}x{height}:rate=25"), |
| 7189 | 7470 | "-t", |
| 7190 | - "0.16", | |
| 7471 | + &duration, | |
| 7191 | 7472 | "-pix_fmt", |
| 7192 | 7473 | if ten_bit { "yuv420p10le" } else { "yuv420p" }, |
| 7193 | 7474 | // y4m calls 10-bit unofficial (same as the 10-bit key-frame |
| @@ -7314,6 +7595,7 @@ mod tests { | ||
| 7314 | 7595 | "whole-superblock inter PARTITION_NONE", |
| 7315 | 7596 | &[], |
| 7316 | 7597 | 64, |
| 7598 | + 4, | |
| 7317 | 7599 | ); |
| 7318 | 7600 | } |
| 7319 | 7601 | |
| @@ -7328,6 +7610,7 @@ mod tests { | ||
| 7328 | 7610 | "whole-superblock inter PARTITION_NONE", |
| 7329 | 7611 | &[], |
| 7330 | 7612 | 64, |
| 7613 | + 4, | |
| 7331 | 7614 | ); |
| 7332 | 7615 | } |
| 7333 | 7616 | |
| @@ -7370,6 +7653,88 @@ mod tests { | ||
| 7370 | 7653 | "interior 16x16 inter PARTITION_SPLIT into 8x8 leaves", |
| 7371 | 7654 | &["--tile-columns=1"], |
| 7372 | 7655 | 128, |
| 7656 | + 4, | |
| 7657 | + ); | |
| 7658 | + } | |
| 7659 | + | |
| 7660 | + /// lane-interp3 r1: the same 8x8-leaf recipe with DUAL FILTER, OBMC and | |
| 7661 | + /// warped motion on. `read_mb_interp_filter` runs for every inter block | |
| 7662 | + /// (libaom `decodemv.c` 1575), compound ones included; the compound 8x8 | |
| 7663 | + /// leaf skipped it entirely, so a SWITCHABLE-filter stream lost a symbol | |
| 7664 | + /// per compound leaf and stamped the `[3, 3]` "no filter" sentinel, which | |
| 7665 | + /// made a neighbouring OBMC block's `neighbour_filter` PANIC (a crash on | |
| 7666 | + /// his data, not a named refusal). The three hard asserts prove the flags | |
| 7667 | + /// arrived: a compound 8x8 leaf that really read the filter, a block whose | |
| 7668 | + /// two dual-filter directions DIFFER (impossible with dual filter off), | |
| 7669 | + /// and an 8x8 OBMC blend. | |
| 7670 | + // lane-interp3 r2: the ENTROPY desync r1 measured is CLOSED -- the full | |
| 7671 | + // 16-frame stream now parses end to end and every `EC_MODE`/`EC_MODE_VAL` | |
| 7672 | + // element's msac RANGE matches the instrumented aomdec's line for line | |
| 7673 | + // (570/570 mode elements, 0 diff). Two twin-drift root causes, both in | |
| 7674 | + // `decode_inter_block8`'s compound arm: `read_compound_ref_frames` was | |
| 7675 | + // passed a hard-coded `LAST_FRAME` for every inter neighbour instead of | |
| 7676 | + // the real per-mi band, and the grid stamp cleared both per-slot | |
| 7677 | + // `is_global_mv_block` flags. | |
| 7678 | + // lane-interp3 r3: the luma reconstruction residue r2 left open is CLOSED | |
| 7679 | + // and this gate is GREEN. Third instance of the same twin-drift class: | |
| 7680 | + // libaom applies `allow_warp`'s GLOBAL branch to every | |
| 7681 | + // `is_global_mv_block` reference slot, compound included and independent | |
| 7682 | + // of `motion_mode` (`av1_init_warp_params` inside | |
| 7683 | + // `build_inter_predictors_8x8_and_bigger`'s per-`ref` loop) -- the 16x16+ | |
| 7684 | + // compound arm has warped since lane-cwarp r1, the 8x8 leaf's compound arm | |
| 7685 | + // predicted BOTH taps translationally, so a GLOBAL_GLOBALMV 8x8 compound | |
| 7686 | + // leaf under a non-TRANSLATION model drifted a few luma levels, growing | |
| 7687 | + // away from the block origin. It was NOT OBMC: the `EC_OBMC` emitter this | |
| 7688 | + // round added to `decode.rs` diffs 325/325 lines against the instrumented | |
| 7689 | + // aomdec's own rung (position, span, neighbour mv/ref/bsize/filter) with | |
| 7690 | + // zero differences. | |
| 7691 | + #[test] | |
| 7692 | + fn a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact() { | |
| 7693 | + const NAME: &str = | |
| 7694 | + "a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact"; | |
| 7695 | + if !have_ffmpeg() || !have_aomenc() { | |
| 7696 | + eprintln!("SKIP {NAME}: no ffmpeg/aomenc"); | |
| 7697 | + return; | |
| 7698 | + } | |
| 7699 | + let before_dual = decode::dual_filter_diff_hits(); | |
| 7700 | + let before_obmc = decode::obmc_hits_8(); | |
| 7701 | + let before_cwarp8 = decode::compound_warp_hits_8(); | |
| 7702 | + inter_sb_none_gate( | |
| 7703 | + NAME, | |
| 7704 | + false, | |
| 7705 | + "8", | |
| 7706 | + "16", | |
| 7707 | + decode::compound8_filter_hits, | |
| 7708 | + "a compound 8x8 leaf reading its own switchable interp_filter", | |
| 7709 | + &[ | |
| 7710 | + "--enable-dual-filter=1", | |
| 7711 | + "--enable-obmc=1", | |
| 7712 | + "--enable-warped-motion=1", | |
| 7713 | + "--enable-onesided-comp=1", | |
| 7714 | + ], | |
| 7715 | + 64, | |
| 7716 | + // Recipe search hook (same shape as EC_OBMC8_ATTEMPTS): a compound | |
| 7717 | + // block needs several coded references, so the sequence is longer | |
| 7718 | + // than the other arms' 4 frames. | |
| 7719 | + std::env::var("EC_INTERP3_FRAMES") | |
| 7720 | + .ok() | |
| 7721 | + .and_then(|v| v.parse().ok()) | |
| 7722 | + .unwrap_or(16), | |
| 7723 | + ); | |
| 7724 | + assert!( | |
| 7725 | + decode::dual_filter_diff_hits() > before_dual, | |
| 7726 | + "{NAME}: no block read two DIFFERENT dual-filter directions -- \ | |
| 7727 | + --enable-dual-filter=1 did not arrive or aomenc declined it" | |
| 7728 | + ); | |
| 7729 | + assert!( | |
| 7730 | + decode::obmc_hits_8() > before_obmc, | |
| 7731 | + "{NAME}: no 8x8 OBMC blend fired -- --enable-obmc=1 did not arrive" | |
| 7732 | + ); | |
| 7733 | + assert!( | |
| 7734 | + decode::compound_warp_hits_8() > before_cwarp8, | |
| 7735 | + "{NAME}: no 8x8 COMPOUND leaf was predicted through the per-ref GLOBAL \ | |
| 7736 | + warp -- the r3 root-cause path never fired, so this stream no longer \ | |
| 7737 | + proves it" | |
| 7373 | 7738 | ); |
| 7374 | 7739 | } |
| 7375 | 7740 | |
| @@ -7384,6 +7749,7 @@ mod tests { | ||
| 7384 | 7749 | "interior 16x16 inter PARTITION_SPLIT into 8x8 leaves", |
| 7385 | 7750 | &[], |
| 7386 | 7751 | 64, |
| 7752 | + 4, | |
| 7387 | 7753 | ); |
| 7388 | 7754 | } |
| 7389 | 7755 | |
| @@ -7407,6 +7773,7 @@ mod tests { | ||
| 7407 | 7773 | "interior 16x16 inter PARTITION_SPLIT into 8x8 leaves", |
| 7408 | 7774 | &[], |
| 7409 | 7775 | 64, |
| 7776 | + 4, | |
| 7410 | 7777 | ); |
| 7411 | 7778 | } |
| 7412 | 7779 |
lanes/interp3-r1.report.mdadded+96 -0
| @@ -0,0 +1,96 @@ | ||
| 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. | |
| 84 | + | |
| 85 | +## Suite | |
| 86 | + | |
| 87 | +`systemd-run --user --unit=interp3-suite-r1 -p MemoryMax=10G --same-dir bash -lc 'EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-interp3 nice -n 10 cargo test -p ec-av1 --lib -j3 > $HOME/.cache/interp3-suite-r1.log 2>&1'` | |
| 88 | + | |
| 89 | +**372 passed; 0 failed; 33 ignored; 1208.18s** (main's 371/0/32 plus this round's | |
| 90 | +`an_obmc_neighbour_with_no_recorded_filter_refuses_instead_of_panicking`, plus the new | |
| 91 | +gate ignored). Every OBMC/compound sibling gate green on this tip, including | |
| 92 | +`a_real_aomenc_stream_with_obmc_decodes_pixel_exact`, | |
| 93 | +`a_real_aomenc_stream_with_obmc_8x8_decodes_pixel_exact`, | |
| 94 | +`a_real_aomenc_stream_with_compound_references_decodes_pixel_exact`, | |
| 95 | +`a_real_aomenc_superres_stream_with_compound_obmc_and_interintra_decodes_pixel_exact` | |
| 96 | +and both `..._8x8_leaf_split_...` arms -- the entropy change did not move any of them. |
lanes/interp3-r2.handoff.mdadded+48 -0
| @@ -0,0 +1,48 @@ | ||
| 1 | +# lane-interp3 r2 HANDOFF (turn cap) | |
| 2 | + | |
| 3 | +Tip: see `git log -1` on branch `lane-interp3` (r2 fix commit + report commit). | |
| 4 | +Base: r1 b702853 + `git merge main` (4eff3a1, lane-mvtwin mvstack fixes). Merge touched | |
| 5 | +only mvstack.rs / stream.rs / lanes/mvtwin-r1.report.md; cdf.rs untouched both sides. | |
| 6 | + | |
| 7 | +## Phase table + divergences: see lanes/interp3-r2.report.md (complete, 17 rows) | |
| 8 | +Two divergences found in `decode_inter_block8`'s compound arm, both FIXED: | |
| 9 | +1. decode.rs:19151 `read_compound_ref_frames` got a hard-coded `LAST_FRAME` (or -1) | |
| 10 | + for the above/left neighbour reference instead of the real per-mi bands | |
| 11 | + (`above_ref0`/`left_ref0`, what `decode_inter_block` passes) -> every | |
| 12 | + `av1_collect_neighbors_ref_counts` vote off the wrong CDF row. | |
| 13 | +2. decode.rs:19410 the leaf's grid stamp cleared BOTH per-slot `is_global_mv_block` | |
| 14 | + flags; now computed as libaom blockd.h:421-429 (mode GLOBAL_GLOBALMV + that slot's | |
| 15 | + gm model > TRANSLATION). | |
| 16 | +Also added: decode.rs:19726 per-entry `EC_STACK` print in the leaf's SINGLE-ref arm. | |
| 17 | + | |
| 18 | +## Ladder (EC_TRACE_MODE=1, ours vs instrumented aomdec, RANGE never tell) | |
| 19 | +- Before fix 1, frames=5 stream: first divergence at compound leaf mi (10,2) -- | |
| 20 | + both enter the mode info at rng=61097; aomdec reads refs (LAST,GOLDEN) mode | |
| 21 | + NEAREST_NEARESTMV -> rng 49516; ours read (LAST,LAST2) NEW_NEWMV -> rng 50496. | |
| 22 | +- Before fix 2, frames=16 stream: first divergence at single-ref 8x8 leaf mi (8,8), | |
| 23 | + entry rng=43099 both; aomdec stack = [(-1,-1) w648, (0,0) w644] (2 entries), | |
| 24 | + ours = [(0,0) w644, (2,-4) w644, (-1,-1) w4] (3) -- the extra (2,-4) is the | |
| 25 | + neighbour's stored mv1 where libaom substitutes the reader's global mv. | |
| 26 | +- AFTER both fixes: 570 vs 570 mode elements, `diff` EMPTY, no refusal. | |
| 27 | + | |
| 28 | +## Gate state | |
| 29 | +`a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` still | |
| 30 | +`#[ignore]`d (ignore text updated with this measurement). Now RED on RECONSTRUCTION, | |
| 31 | +not entropy: luma-only, frames 0-6 byte-exact, frame 7 = 36 Y wrong (max |d| 5, first | |
| 32 | +(42,15), the 8x8 leaf at mi (10,4), 1-px spill across its left/bottom deblock edges), | |
| 33 | +propagating to 222 Y + 4 U + 1 V at frame 15. | |
| 34 | +Artifacts: scratchpad .../{pin.obu (5 frames), pin16.obu==mm.obu (16), aom16.trace, | |
| 35 | +ours16e.trace, mm.aom.yuv, mm.ours.yuv, aom.obmc}. | |
| 36 | + | |
| 37 | +## Suite | |
| 38 | +Unit `interp3-suite-r2-1788327820.service`, log `$HOME/.cache/interp3-suite-r2.log`. | |
| 39 | +Armed at the r2 fix commit; still running at the cap -- read the log's `test result:` | |
| 40 | +line, do not re-run blindly. | |
| 41 | + | |
| 42 | +## EXACT NEXT STEP | |
| 43 | +Build an `EC_OBMC` emitter in decode.rs (both OBMC call sites) printing the oracle's | |
| 44 | +own byte format -- `EC_OBMC above|left mi=(r,c) wh=(WxH) rel=%d op=%d nbmv=(y,x) | |
| 45 | +nbref=%d nbbsize=%d filt=%d` -- then diff it against the 325 lines of | |
| 46 | +`EC_OBMC=1 aomdec --rawvideo -o /dev/null mm.obu`, starting at `mi=(10,4)`. The leaf | |
| 47 | +now records a REAL filter pair where it used to record the [3,3] sentinel, so an OBMC | |
| 48 | +blend over a compound neighbour is the first suspect for the residue. |
lanes/interp3-r2.report.mdadded+88 -0
| @@ -0,0 +1,88 @@ | ||
| 1 | +# lane-interp3 r2 -- the compound 8x8 leaf's ENTROPY desync is closed (two twin drifts); gate now RED on a small luma reconstruction residue | |
| 2 | + | |
| 3 | +Base: b702853 (r1) + `git merge main` (4eff3a1, brings lane-mvtwin's mvstack fixes). | |
| 4 | +Merge diffstat: `crates/ec-av1/src/mvstack.rs`, `crates/ec-av1/src/stream.rs`, | |
| 5 | +`lanes/mvtwin-r1.report.md` only -- `cdf.rs` untouched by either side (byte-compare | |
| 6 | +trivially clean), no fixtures churn, no conflicts. | |
| 7 | + | |
| 8 | +## Phase table -- libaom `read_inter_block_mode_info` (decodemv.c ~1400-1600) | |
| 9 | + | |
| 10 | +`IB` = `decode_inter_block` compound arm, `L8` = `decode_inter_block8` compound arm | |
| 11 | +(both in `crates/ec-av1/src/decode.rs`; line numbers are this commit's). | |
| 12 | + | |
| 13 | +| # | phase (libaom) | IB | L8 | verdict | | |
| 14 | +|---|---|---|---|---| | |
| 15 | +| 1 | `skip_mode` (ctx = above+left skip_mode) | 16363 | 19087 | matches | | |
| 16 | +| 2 | `skip` | 16375 | 19093 | matches | | |
| 17 | +| 3 | cdef / delta_q / delta_lf | 16377-16382 | (16x16 slot's, per this fn's doc) | matches (leaf never a delta root) | | |
| 18 | +| 4 | `is_inter` (`intra_inter_ctx`) | 16389 | 19105 | matches | | |
| 19 | +| 5 | `comp_mode` (`read_comp_mode`, ref-count ctx) | 16475 | 19147 | matches (`skip_mode \|\| (reference_select && ...)` vs `reference_select \|\| skip_mode` then `skip_mode \|\| ...` -- same predicate) | | |
| 20 | +| 6 | `read_ref_frames`: `comp_ref_type`, uni/bi trees | 16480 | 19151 | **DIFFERENT -> FIXED**: L8 passed a hard-coded `LAST_FRAME` (or `-1`) as the above/left reference; IB passes the real `neighbours.above_ref[cmi]`/`left_ref[rmi]` | | |
| 21 | +| 7 | `av1_find_mv_refs` (`find_mv_stack_compound`, sign bias + gm table + tpl) | 16519 | 19195 | matches (L8's doc comment claiming "no sign-bias table nor tpl_frame" is stale -- both are passed) | | |
| 22 | +| 8 | `compound_mode` CDF (`COMPOUND_MODE_CTX_MAP`) | 16532 | 19205 | matches | | |
| 23 | +| 9 | drl + `read_mv` per ref (`assign_compound_mv`, has_nearmv/have_newmv rules) | 16537 | 19226 | matches (one shared fn) | | |
| 24 | +| 10 | `interintra` | n/a compound | n/a | matches (never read on compound -- correct) | | |
| 25 | +| 11 | `read_motion_mode` | n/a compound | n/a | matches (`has_second_ref` -> SIMPLE_TRANSLATION) | | |
| 26 | +| 12 | `comp_group_idx` (neighbour ctx) | 16675 | 19263 | matches | | |
| 27 | +| 13 | `compound_type` -> wedge idx+sign / diffwtd `mask_type` | 16710 | 19279 | matches | | |
| 28 | +| 14 | `compound_idx` (distance-weight ctx) | 16936 | 19310 | matches | | |
| 29 | +| 15 | `read_mb_interp_filter` (after `read_compound_type`; suppressed by `skip_mode` / `is_nontrans_global_motion`; `get_ref_filter_type` on ref0 matching EITHER neighbour ref) | 16980 | 19383 | matches (landed r1) | | |
| 30 | +| 16 | tail: grid `MiInfo` stamp -- per-slot `is_global_mv_block` | 16577+16660 | 19424 | **DIFFERENT -> FIXED**: L8 stamped `is_global_mv0/1 = false` unconditionally | | |
| 31 | +| 17 | tail: `record_inter_rect_mi` + `record_compound_ctx_rect_mi` (skip/skip_mode/inter/ref/ref1/filter/comp_group_idx/compound_idx bands) | 18870 | via `compound_ctx8` + caller, 19000 | matches -- verified by the range ladder staying exact for the whole stream | | |
| 32 | + | |
| 33 | +Root causes 6 and 16 are the round's fix. Both are the same class the charter named | |
| 34 | +(twin functions drift), and both are invisible to any value-only check: (6) changes a | |
| 35 | +CDF ROW, (16) changes a LATER block's mv-stack composition. | |
| 36 | + | |
| 37 | +## Changed (path:line) | |
| 38 | + | |
| 39 | +- `crates/ec-av1/src/decode.rs:19151` -- `read_compound_ref_frames` now gets | |
| 40 | + `above_ref0`/`left_ref0` (the per-mi bands the leaf already reads at 19078-19081) | |
| 41 | + instead of `LAST_FRAME`/`-1`. `-1` on an unavailable band is `start_tile`'s / | |
| 42 | + `start_row`'s own reset value, so no `has_above` guard is needed (IB has none either). | |
| 43 | +- `crates/ec-av1/src/decode.rs:19410` -- the leaf's grid stamp computes libaom's | |
| 44 | + per-slot `is_global_mv_block` (mode `GLOBAL_GLOBALMV`, that slot's gm model > | |
| 45 | + TRANSLATION; the >= 8x8 size predicate is always true for this leaf). | |
| 46 | +- `crates/ec-av1/src/decode.rs:19726` -- the leaf's SINGLE-ref arm prints the same | |
| 47 | + per-entry `EC_STACK` ladder `decode_inter_block`'s single-ref arm prints (this is | |
| 48 | + the instrument that isolated cause 16). | |
| 49 | +- `crates/ec-av1/src/stream.rs:6315` -- the gate's ignore reason + comment replaced | |
| 50 | + with this round's measurement (entropy closed, pixel residue open). | |
| 51 | + | |
| 52 | +## Gate: still RED, still `#[ignore]`d -- but on a different, much smaller failure | |
| 53 | + | |
| 54 | +`a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` | |
| 55 | +(`--enable-dual-filter=1 --enable-obmc=1 --enable-warped-motion=1 | |
| 56 | +--enable-onesided-comp=1`, `--min-partition-size=8 --enable-ab-partitions=0 | |
| 57 | +--enable-1to4-partitions=0`, 16 frames, 64x64). | |
| 58 | + | |
| 59 | +- r1: decode STOPPED at a bogus refusal at frame 5 (0 frames ever compared). | |
| 60 | +- r2: the whole 16-frame stream parses; the failure is now | |
| 61 | + `frame 7 mismatch vs ffmpeg` -- a reconstruction residue, luma-only, | |
| 62 | + |delta| <= 8, first sample (42,15) inside/around the 8x8 leaf at mi (10,4), | |
| 63 | + spilling 1 px across that leaf's left and bottom deblock edges. It grows by pure | |
| 64 | + propagation to 222 Y + 4 U + 1 V samples at frame 15 (chroma stays exact until | |
| 65 | + frame 14). | |
| 66 | + | |
| 67 | +EVIDENCE: /tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/b6d8a07f-96a4-4bbb-b378-af9ae25cf7c9/scratchpad/{aom16.trace,ours16e.trace} | `EC_TRACE_MODE=1 aomdec --rawvideo` and `EC_TRACE_MODE=1 decode_probe` on the pinned 16-frame stream, `diff` of every `EC_MODE`/`EC_MODE_VAL` line (mi + msac RANGE, never tell) | 570 vs 570 elements, diff EMPTY, no refusal (before the fix: ours stopped at 347 elements, first RANGE divergence at the 8x8 leaf mi (8,8), stack 3 entries vs libaom's 2) | |
| 68 | +EVIDENCE: same dir, `pin.obu` (EC_INTERP3_FRAMES=5) | ladder before fix 1 | ours read refs (LAST,LAST2) + NEW_NEWMV at leaf mi (10,2) where aomdec reads (LAST,GOLDEN) + NEAREST_NEARESTMV -- the two differ only in a CDF row of `uni_comp_ref` | |
| 69 | +EVIDENCE: same dir, `mm.{aom,ours}.yuv` | `aomdec --rawvideo` vs `decode_probe` on the pinned mismatch stream, per-frame per-plane sample compare | frames 0-6 byte-exact; frame 7: 36 Y / 0 U / 0 V wrong, max |delta| 5; frame 15: 222 Y / 4 U / 1 V, max |delta| 8 | |
| 70 | + | |
| 71 | +## Refusals | |
| 72 | + | |
| 73 | +None lifted this round (the r1 refusal `an OBMC neighbour whose interp filter was | |
| 74 | +never recorded` stays; `refusal_inventory` unchanged). Two refusals this stream used | |
| 75 | +to hit -- `an inter 16x16-level AB or 1:4 partition` and `an inter partition below | |
| 76 | +8x8` -- were our own desync (class refusal-from-own-desync) and no longer fire on it. | |
| 77 | + | |
| 78 | +## Residue | |
| 79 | + | |
| 80 | +- fix-now(next round): the luma reconstruction residue above. First suspect is the | |
| 81 | + OBMC blend over a COMPOUND neighbour -- the leaf now records a real filter pair | |
| 82 | + where it used to record the `[3,3]` sentinel, and the oracle's `EC_OBMC` rung | |
| 83 | + prints `nbmv`/`nbref`/`nbbsize`/`filt` per neighbour while THIS decoder has no | |
| 84 | + `EC_OBMC` emitter at all. Build that emitter first (instrument-before-excuse), then | |
| 85 | + diff the 325 oracle `EC_OBMC` lines of `mm.obu` against ours. | |
| 86 | +- deferred(needs that fix): the gate's counter asserts (compound-8x8 filter reads, | |
| 87 | + dual-filter differing directions, 8x8 OBMC blends) are never reached while the | |
| 88 | + pixel compare fails first; the 10-bit arm; a `--tile-columns=1` arm. |
lanes/interp3-r3.handoff.mdadded+88 -0
| @@ -0,0 +1,88 @@ | ||
| 1 | +# lane-interp3 r3 HANDOFF (turn cap) -- root cause FOUND and FIXED, suite still running | |
| 2 | + | |
| 3 | +Tip: `f36be26` on branch `lane-interp3` (fix) + this handoff/report commit. | |
| 4 | + | |
| 5 | +## Suite state | |
| 6 | +- r2 suite (unit `interp3-suite-r2-1788327820.service`, log `$HOME/.cache/interp3-suite-r2.log`), | |
| 7 | + armed at the r2 commit, FINISHED: | |
| 8 | + `test result: ok. 378 passed; 0 failed; 34 ignored; 0 measured; 0 filtered out; finished in 742.50s` | |
| 9 | +- r3 suite FINISHED GREEN at f36be26 (unit `interp3-suite-r3-1788328778.service`): | |
| 10 | + `test result: ok. 379 passed; 0 failed; 33 ignored; 0 measured; 0 filtered out; finished in 1031.33s` | |
| 11 | + (old text below is superseded) | |
| 12 | +- r3 suite armed at f36be26: unit `interp3-suite-r3-1788328778.service`, | |
| 13 | + log `$HOME/.cache/interp3-suite-r3.log`. At the cap it had 258 `... ok`, ZERO | |
| 14 | + `FAILED`/`panicked`, no `test result:` line yet. READ THAT LINE, do not re-run | |
| 15 | + blindly, then paste it into `lanes/interp3-r3.report.md` where | |
| 16 | + `EVIDENCE: SUITE_LINE_PLACEHOLDER` sits. | |
| 17 | + | |
| 18 | +## Stage attribution of the frame-7 residue (done FIRST, as chartered) | |
| 19 | +`EC_AV1_PREFILT_DUMP` on both decoders over the pinned 16-frame stream | |
| 20 | +(`.../scratchpad/mm.obu`), byte compare per decode-order frame: | |
| 21 | +frames 0-6 identical, frame 7 = 35 differing luma bytes, 8..15 grow to 224. | |
| 22 | +=> PRE-FILTER, i.e. prediction/reconstruction, never the loop filter/CDEF/LR. | |
| 23 | +All 35 sit in luma rows 42-47, cols 16-23, i.e. the block at mi (10,4); | |
| 24 | +rows 40-41 of that same block are EXACT and the error grows downward. | |
| 25 | + | |
| 26 | +## What the OBMC comparison actually said (emitter built, class swept, CLEAN) | |
| 27 | +Before writing the emitter, the hand comparison against libaom found NO mismatch: | |
| 28 | +`overlappable_above`/`overlappable_left` stepping and `max_neighbor_obmc` | |
| 29 | +(`{0,1,2,3,4,4}`, 8x8 -> 1 per pass) match `obmc.h:20-55`; overlap sizes | |
| 30 | +(4 luma rows above / 4 luma cols left at 8x8, chroma 2) match | |
| 31 | +`build_obmc_inter_pred_{above,left}`; `av1_skip_u4x4_pred_in_obmc` chroma-above | |
| 32 | +skip matches; `obmc_mask_1/2/4/8/16/32` are byte-identical to | |
| 33 | +`reconinter.c:752-765`; OBMC never warps (`if (!build_for_obmc) av1_init_warp_params`). | |
| 34 | +One real divergence candidate was left un-ported and is still a documented | |
| 35 | +corner-cut, not a defect on this content: `obmc.h`'s `mi_step == 1` 4-wide pair | |
| 36 | +merge, and libaom's `op_mi_size = AOMMIN(xd->width, mi_step)` which can exceed | |
| 37 | +the remaining span while ours clips with `.min(end_col - col)` (only reachable | |
| 38 | +for a 2nd neighbour with a wide step). | |
| 39 | + | |
| 40 | +Emitter: `decode.rs:15806` `ec_obmc_bsize()` + `decode.rs:15828` `ec_obmc_trace()`, | |
| 41 | +called at both passes in `obmc_blend`. Format is aomdec's own bytes: | |
| 42 | +`EC_OBMC above|left mi=(r,c) wh=(WxH) rel=N op=N nbmv=(y,x) nbref=N nbbsize=N filt=N` | |
| 43 | +(`filt` = packed `interp_filters.as_int` = `y | (x << 16)`). | |
| 44 | +`diff` of the 325 oracle lines vs our 325: EMPTY. OBMC is exonerated. | |
| 45 | + | |
| 46 | +Also added `decode.rs:14682` + `:22658` `EC_PICT idx=` (decode-order frame | |
| 47 | +marker under `EC_OBMC`/`EC_TRACE_MODE`). REQUIRED: the marker prints AFTER the | |
| 48 | +frame's own trace lines, so `awk` must count markers seen, not read the value on | |
| 49 | +the preceding line -- attributing by the preceding `EC_PICT` value is off by one | |
| 50 | +and cost part of this round. | |
| 51 | + | |
| 52 | +## Hypotheses ruled out (each by measurement) | |
| 53 | +- OBMC neighbour fields / masks / overlap: 325/325 identical lines (above). | |
| 54 | +- Frame 7 has NO OBMC block at mi (10,4) at all -- it is COMPOUND | |
| 55 | + (SIMPLE_TRANSLATION), so the r2 handoff's "OBMC over a compound neighbour" | |
| 56 | + suspect could not have been it. | |
| 57 | +- Residual/entropy: r2's range ladder is exact end to end; `EC_MCDUMP` (a | |
| 58 | + temporary rung, removed before commit) showed aom_recon - our_residual | |
| 59 | + reproduces our PREDICTION in rows 40-41 and diverges below => prediction. | |
| 60 | +- Wrong dual-filter x/y assignment: a swap would err in every row, not only the | |
| 61 | + lower ones. | |
| 62 | + | |
| 63 | +## Root cause (FIXED, gate GREEN) | |
| 64 | +`decode_inter_block8`'s COMPOUND arm predicted BOTH taps translationally. | |
| 65 | +libaom applies `allow_warp`'s GLOBAL branch to every `is_global_mv_block` | |
| 66 | +reference slot -- compound included, independent of `motion_mode` | |
| 67 | +(`av1_init_warp_params` inside `build_inter_predictors_8x8_and_bigger`'s per-`ref` | |
| 68 | +loop; `reconinter.c:33-55`). `decode_inter_block`'s compound arm has done this | |
| 69 | +since lane-cwarp r1 (`decode.rs:16691`). Third twin-functions-drift instance in | |
| 70 | +this lane. Frame 7 mi (10,4): GLOBAL_GLOBALMV, ref0=GOLDEN mv (0,0), | |
| 71 | +ref1=ALTREF mv (-3,4), comp_group_idx=1. | |
| 72 | +Fix: `decode.rs:19513` (`leaf_compound_warp`, `warp0_c`/`warp1_c`), | |
| 73 | +`decode.rs:19596`/`:19618` (`warp_affine_compound` per luma tap; chroma is 4x4, | |
| 74 | +below `av1_init_warp_params`'s 8px per-plane bound, so it stays translational). | |
| 75 | +Counter `COMPOUND_WARP_HITS_8` / `compound_warp_hits_8()` at `decode.rs:1786`. | |
| 76 | +After the fix ALL 16 decode-order frames are byte-identical pre-filter. | |
| 77 | + | |
| 78 | +## Gate | |
| 79 | +`a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` | |
| 80 | +(`stream.rs:6332`) is UN-IGNORED and GREEN with four hard asserts (compound-8x8 | |
| 81 | +filter read, differing dual-filter directions, 8x8 OBMC blend, 8x8 compound | |
| 82 | +GLOBAL warp). `$HOME/.cache/interp3-gate-r3.log`: `1 passed; 0 failed`. | |
| 83 | + | |
| 84 | +## EXACT NEXT STEP | |
| 85 | +1. DONE (suite green, report filled). Nothing owed here. | |
| 86 | +2. Then the lane's open residue is only the two deferrals in the report | |
| 87 | + (10-bit arm blocked by lane-inter8's 10-bit 8x8-leaf desync; `--tile-columns=1` | |
| 88 | + arm blocked by the SB-level rect-partition refusal). |
lanes/interp3-r3.report.mdadded+106 -0
| @@ -0,0 +1,106 @@ | ||
| 1 | +# lane-interp3 r3 -- the 8x8 COMPOUND leaf never applied the per-ref GLOBAL warp; gate is GREEN and un-ignored | |
| 2 | + | |
| 3 | +Base: d06d93f (r2 handoff, already merged with main). | |
| 4 | + | |
| 5 | +## Root cause (one line) | |
| 6 | + | |
| 7 | +`decode_inter_block8`'s COMPOUND arm predicted **both** reference taps | |
| 8 | +translationally, while libaom applies `allow_warp`'s GLOBAL branch to every | |
| 9 | +`is_global_mv_block` reference slot -- compound included and independently of | |
| 10 | +`motion_mode` (`av1_init_warp_params` is called inside | |
| 11 | +`build_inter_predictors_8x8_and_bigger`'s per-`ref` loop, `reconinter.c:33-55` | |
| 12 | +for `allow_warp` itself). The 16x16+ compound arm has done this since | |
| 13 | +lane-cwarp r1 (`decode.rs:16691`); the 8x8 leaf is its twin and drifted. | |
| 14 | +Third instance in this lane of the class **twin functions drift**. | |
| 15 | + | |
| 16 | +Effect on the pinned stream: the GLOBAL_GLOBALMV compound 8x8 leaf at | |
| 17 | +mi (10,4) of decode-order frame 7 (ref0=GOLDEN mv (0,0), ref1=ALTREF mv | |
| 18 | +(-3,4), `comp_group_idx=1` masked compound) was predicted with a pure | |
| 19 | +translation, so its prediction error was 0 at the block's top rows and grew | |
| 20 | +downward to |delta| 5 -- then propagated through every later frame. | |
| 21 | + | |
| 22 | +## It was NOT the OBMC blend (the r2 handoff's first suspect, disproved) | |
| 23 | + | |
| 24 | +An `EC_OBMC` emitter was added to both OBMC passes in `decode.rs`, printing the | |
| 25 | +instrumented aomdec's own byte format | |
| 26 | +(`EC_OBMC above|left mi=() wh=() rel= op= nbmv=() nbref= nbbsize= filt=`, | |
| 27 | +`decodeframe.c` `dec_build_prediction_by_{above,left}_pred`). The two decoders | |
| 28 | +emit **325 identical lines** on the pinned 16-frame stream -- neighbour | |
| 29 | +position, span, mv, reference, bsize and packed dual-filter pair all agree at | |
| 30 | +every OBMC call. The class sweep the charter asked for (neighbour-side fields | |
| 31 | +used by OBMC: filter, ref, mv, scale) is therefore CLEAN by measurement, not by | |
| 32 | +inspection; `obmc_mask_1/2/4/8/16/32` were also byte-compared against | |
| 33 | +`reconinter.c:752-765` and match. | |
| 34 | + | |
| 35 | +Frame 7 has no OBMC block at mi (10,4) at all: it is a compound block, and | |
| 36 | +compound blocks take SIMPLE_TRANSLATION. | |
| 37 | + | |
| 38 | +## Changed (path:line, this commit) | |
| 39 | + | |
| 40 | +- `crates/ec-av1/src/decode.rs:19513` -- `leaf_compound_warp` + | |
| 41 | + `warp0_c`/`warp1_c`, the leaf's per-slot copy of `decode_inter_block`'s | |
| 42 | + `compound_warp` (`force_integer_mv` short-circuit, `gm.invalid` guard). | |
| 43 | +- `crates/ec-av1/src/decode.rs:19596,19618` -- `warp::warp_affine_compound` | |
| 44 | + replaces each luma tap's translational intermediate, exactly as the 16x16+ | |
| 45 | + arm does at 17130/17155. Chroma is 4x4 at an 8x8 leaf, below | |
| 46 | + `av1_init_warp_params`'s own per-plane 8px bound, so chroma stays | |
| 47 | + translational (same rule the leaf's single-ref arm already applied). | |
| 48 | +- `crates/ec-av1/src/decode.rs:1786` -- `COMPOUND_WARP_HITS_8` + | |
| 49 | + `compound_warp_hits_8()`: the gate's proof that the warp fired at an 8x8 | |
| 50 | + LEAF specifically (`COMPOUND_WARP_HITS` alone cannot tell it from a 16x16+). | |
| 51 | +- `crates/ec-av1/src/decode.rs:15806` (`ec_obmc_bsize`) and `15828` | |
| 52 | + (`ec_obmc_trace`) + the two call sites in `obmc_blend` -- the `EC_OBMC` rung. | |
| 53 | +- `crates/ec-av1/src/decode.rs:14682,22658` -- `EC_PICT idx=` decode-order | |
| 54 | + frame marker (printed under `EC_OBMC`/`EC_TRACE_MODE`), so a trace line can be | |
| 55 | + attributed to the frame whose `EC_AV1_PREFILT_DUMP` file mismatched. Without | |
| 56 | + it the r2 hunt mis-attributed every trace line by one frame. | |
| 57 | +- `crates/ec-av1/src/stream.rs:6332` -- the gate's `#[ignore]` removed, doc | |
| 58 | + comment carries this round's measurement, and a third hard assert | |
| 59 | + (`compound_warp_hits_8() > before`) added. | |
| 60 | + | |
| 61 | +## Class sweep | |
| 62 | + | |
| 63 | +Both inter block decoders are the only prediction sites | |
| 64 | +(`decode_inter_block` 16309, `decode_inter_block8` 19032); all 12 | |
| 65 | +`predict_compound_intermediate` calls were audited. Warp coverage is now: | |
| 66 | +16x16+ single-ref (18235-18253), 16x16+ compound y/u/v x 2 refs | |
| 67 | +(17130-17300), 8x8 leaf single-ref (20238-20253), 8x8 leaf compound luma x 2 | |
| 68 | +refs (19596/19618, chroma correctly excluded). No third twin exists. | |
| 69 | + | |
| 70 | +## Gate: GREEN, un-ignored | |
| 71 | + | |
| 72 | +`a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` | |
| 73 | +(`--enable-dual-filter=1 --enable-obmc=1 --enable-warped-motion=1 | |
| 74 | +--enable-onesided-comp=1`, `--min-partition-size=8 --enable-ab-partitions=0 | |
| 75 | +--enable-1to4-partitions=0`, 64x64, 16 frames). Four hard asserts now: | |
| 76 | +compound 8x8 leaf reading its own switchable filter, a block whose two | |
| 77 | +dual-filter directions DIFFER, an 8x8 OBMC blend, and an 8x8 compound leaf | |
| 78 | +predicted through the per-ref GLOBAL warp. | |
| 79 | + | |
| 80 | +Command: | |
| 81 | +`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-interp3 cargo test -p ec-av1 --lib a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact` | |
| 82 | +Result: `test result: ok. 1 passed; 0 failed` (log `$HOME/.cache/interp3-gate-r3.log`). | |
| 83 | + | |
| 84 | +## Refusals | |
| 85 | + | |
| 86 | +None lifted. The r1 refusal `an OBMC neighbour whose interp filter was never | |
| 87 | +recorded` stays (it does not fire on this stream); `refusal_inventory.rs` and | |
| 88 | +`gate_coverage.rs` unchanged. | |
| 89 | + | |
| 90 | +## EVIDENCE | |
| 91 | + | |
| 92 | +EVIDENCE: /tmp/claude-1000/-home-user-Documents-Code-Rust-edith-codecs/b6d8a07f-96a4-4bbb-b378-af9ae25cf7c9/scratchpad/{aom.obmc,ours.obmc} | `EC_OBMC=1 aomdec --rawvideo -o /dev/null mm.obu` vs `EC_OBMC=1 decode_probe mm.obu`, `diff` of every EC_OBMC line | 325 vs 325 lines, diff EMPTY -- OBMC neighbour selection/mv/ref/bsize/filter exonerated | |
| 93 | +EVIDENCE: same dir, pf_a/f.f0..15 vs pf_o/f.f0..15 | `EC_AV1_PREFILT_DUMP` on both decoders, byte compare per decode-order frame BEFORE the fix | frames 0-6 identical, frame 7 35 bytes differ (all inside luma rows 42-47, cols 16-23 = the 8x8 leaf at mi (10,4)), growing to 224 at frame 15 | |
| 94 | +EVIDENCE: same dir, pf_a vs pf_o2 | identical command AFTER the fix | all 16 decode-order frames byte-identical pre-filter (0 differing bytes) | |
| 95 | +EVIDENCE: $HOME/.cache/interp3-gate-r3.log | `cargo test -p ec-av1 --lib a_real_aomenc_dual_filter_obmc_8x8_inter_sequence_decodes_pixel_exact -- --nocapture` | `test result: ok. 1 passed; 0 failed` with all four counter asserts live (the run would panic if `compound_warp_hits_8` had not moved) | |
| 96 | +EVIDENCE: $HOME/.cache/interp3-suite-r3.log | `EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-interp3 cargo test -p ec-av1 --lib -j3` under systemd unit `interp3-suite-r3-1788328778.service`, armed at f36be26 | `test result: ok. 379 passed; 0 failed; 33 ignored; 0 measured; 0 filtered out; finished in 1031.33s` (r2 baseline was 378 passed / 34 ignored -- the delta is exactly this gate leaving `#[ignore]`) | |
| 97 | + | |
| 98 | +## Residue | |
| 99 | + | |
| 100 | +- deferred(lane-inter8's 10-bit 8x8-leaf desync) -- a 10-bit twin of this gate. | |
| 101 | + Its sibling `a_real_aomenc_10bit_inter_sequence_with_an_8x8_leaf_split_...` | |
| 102 | + is still `#[ignore]`d on an unrelated 10-bit desync (lane-inter8 r2), so a | |
| 103 | + 10-bit arm of this recipe would go RED on that, not on interp3's own path. | |
| 104 | +- deferred(needs a multi-tile recipe that reaches an 8x8 leaf) -- a | |
| 105 | + `--tile-columns=1` arm. lane-inter8 r3 measured that the 128x64 multi-tile | |
| 106 | + recipe stops at the SB-level rect-partition refusal before any 8x8 leaf. |
lanes/uv8-r1.handoff.mdadded+64 -0
| @@ -0,0 +1,64 @@ | ||
| 1 | +# lane-uv8 r1 — HANDOFF (RED: implemented, NOT gated) | |
| 2 | + | |
| 3 | +## What is implemented (`crates/ec-av1/src/decode.rs`, `decode_inter_block8`'s intra arm) | |
| 4 | +Mirrors libaom `read_intra_block_mode_info` (`av1/decoder/decodemv.c:1178-1220`, read from | |
| 5 | +`~/.cache/aom-oracle/src`) for an INTRA 8x8 leaf inside an INTER frame: | |
| 6 | + | |
| 7 | +- `uv_mode` over the CFL-allowed alphabet (`cdfs.uv_mode_cfl[mode]`; BLOCK_8X8 is inside | |
| 8 | + `is_cfl_allowed`'s 32x32 bound), then `read_cfl_alphas` when `UV_CFL_PRED`, then | |
| 9 | + `angle_delta_uv` off `angle_delta[uv_mode - V_PRED]` (`get_uv_mode` is the identity over | |
| 10 | + `V_PRED..=D67_PRED`) — the exact order libaom reads them in. | |
| 11 | +- `uv_predict_mode = get_uv_mode(uv_mode)`; chroma prediction, chroma `default_tx_type` | |
| 12 | + (`read_plane`'s `predict_mode` arg → `default_intra_tx_type`, DCT for CfL) and the CfL AC | |
| 13 | + (`cfl_ac_q3(y, px, py, 8)` over the leaf's 4x4 chroma) all take it. | |
| 14 | +- `smooth_neighbor_uv` from `Neighbours::smooth_uv_neighbour(leaf_mi.0, leaf_mi.1, r, c)` | |
| 15 | + (chroma edge filter reads the CHROMA neighbour's uv_mode — reconintra.c:974), and the leaf's | |
| 16 | + LUMA `smooth_neighbor` from `modes_above_left_mi` (it passed a hardcoded `false` before). | |
| 17 | +- `palette_uv_mode` is now read only when `uv_mode == DC_PRED` (`read_palette_mode_info`); | |
| 18 | + it was read unconditionally, harmless only because every non-DC uv_mode was refused. | |
| 19 | +- Tail: the leaf now stamps its mode bands (`above_uv_mode[c]`/`left_uv_mode[r]`, | |
| 20 | + `record_mode_mi`, `record_uv_mode_mi`, 2x2 mi) — it stamped none at all, so a neighbour read | |
| 21 | + a stale coarse SUB slot. An inter leaf stamps `DC_PRED`, what libaom stores. | |
| 22 | +- New per-leaf counters `decode::intra_in_inter8_uv_hits() -> (dir, smooth/paeth, cfl)`. | |
| 23 | + | |
| 24 | +## Refusal state | |
| 25 | +`"a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)"` is REMOVED | |
| 26 | +from decode.rs and from `refusal_inventory.rs::CAPABILITY_CLAIMS`. **This lift is NOT gated** — | |
| 27 | +see below. If the next round cannot gate it, restoring both lines is the honest move. | |
| 28 | + | |
| 29 | +## Gate (written, never observed a firing attempt) | |
| 30 | +`stream.rs::uv_mode_in_inter8_gate(bit_depth, tile_columns)` + 3 tests (8-bit, 10-bit, 2-tile): | |
| 31 | +192x128, 8 frames, mandelbrot zoom + hard cut at frame 4 + seeded `noise`, chroma NOT | |
| 32 | +desaturated, 30 attempts, cq 12..40, `--min-partition-size=8 --max-partition-size=32 | |
| 33 | +--sb-size=64 --enable-cfl-intra=1 --enable-smooth-intra=1 --enable-paeth-intra=1 | |
| 34 | +--enable-directional-intra=1`, per-attempt counter deltas, every decode-order frame compared, | |
| 35 | +no SKIP on decode error. The y4m goes through a temp FILE: feeding aomenc on stdin while its | |
| 36 | +~100 KB OBU fills the stdout pipe DEADLOCKS (measured, 3 min into attempt 0). | |
| 37 | + | |
| 38 | +RESULT: 8-bit arm ran, 30/30 attempts REFUSED, 0 compared → the gate fails as designed. | |
| 39 | + | |
| 40 | +## The blocker (pre-existing, NOT this round's change) | |
| 41 | +Every `--min-partition-size=8` inter stream refuses. `--min-partition-size=16` on the same | |
| 42 | +recipe decodes 8/8 frames. The refusals name tools the encoder was explicitly told to disable: | |
| 43 | +`--enable-rect-partitions=0 --enable-ab-partitions=0 --enable-1to4-partitions=0` yet we refuse | |
| 44 | +"an inter 16x16-level AB or 1:4 partition" / "a non-skip rectangular strip"; and | |
| 45 | +`--enable-angle-delta=0` yet we refuse "a nonzero angle delta on an 8x8 intra leaf". Class | |
| 46 | +[[refusal-from-own-desync]]: those are our own desync, not encoder output. | |
| 47 | +Ablation: the same refusals appear with `--enable-cfl-intra=0 --enable-smooth-intra=0 | |
| 48 | +--enable-paeth-intra=0 --enable-directional-intra=0`, where this round's code is inert → | |
| 49 | +the desync is INDEPENDENT of this round. | |
| 50 | +The KEY frame of the same recipe (`--limit=1`, min8) decodes PIXEL-EXACT vs aomdec | |
| 51 | +(md5 860b50e830271fa57fb60e4a76eb83ec both) — so the 8x8 leaf's key-frame path is fine and the | |
| 52 | +divergence is in an INTER frame. | |
| 53 | + | |
| 54 | +## Exact next step | |
| 55 | +Bisect the first inter-frame divergence with the oracle mode ladder. Note the trace semantics | |
| 56 | +(cost this round an hour): oracle `EC_IMODE` = KEY-frame blocks only, oracle `EC_MODE` = | |
| 57 | +INTER blocks only (an intra block inside an inter frame prints NEITHER), while ours prints | |
| 58 | +`EC_MODE` for EVERY block of an inter frame. So the oracle's `EC_MODE` (mi_row, mi_col) | |
| 59 | +sequence must be an ordered SUBSEQUENCE of ours; the first ref entry that ours never produces | |
| 60 | +is the first structurally divergent block. On `~/.cache/uv8-tmp/o.obu` (recipe above, cq 26, | |
| 61 | +cpu-used 0) that subsequence match stops after 79 of the ref's frame-1 entries, with ref next | |
| 62 | +at mi (12,8) — start there with a range ladder (compare RANGE, never tell()). | |
| 63 | +Scripts: `~/.cache/uv8-tmp/{in.y4m,sweep.sh,sweep2.sh,sweep3.sh}`; probe | |
| 64 | +`$HOME/.cache/cargo-target-uv8/debug/examples/decode_probe <obu> [out.yuv]`. |
lanes/uv8-r2.handoff.mdadded+65 -0
| @@ -0,0 +1,65 @@ | ||
| 1 | +# lane-uv8 r2 — HANDOFF (merge done, root cause NARROWED to one block, gate still RED) | |
| 2 | + | |
| 3 | +## Merged into lane-uv8 (tip f5c8dbf) | |
| 4 | +- `a9b4468` main aa83400 (clean). | |
| 5 | +- `5dc9707` lane-interp3 `10b801a` (clean). | |
| 6 | +- `c3ead8c`/prev `af47324` lane-intersub8 — CONFLICTS resolved: | |
| 7 | + * `decode_inter_block8` compound-leaf interp read: kept **interp3's** copy (it adds the | |
| 8 | + `gm_nontrans_c || skip_mode` suppression and the COMPOUND8_FILTER_HITS counter); dropped | |
| 9 | + intersub8's duplicate read (two reads = one extra symbol). | |
| 10 | + * `resolve_interp_filter` tail: kept BOTH (interp3's DUAL_FILTER_DIFF_HITS + intersub8's EC_IF trace). | |
| 11 | + * `refusal_inventory.rs`: union of both lists, then deleted | |
| 12 | + "an inter partition below 8x8 (...lane-sub8 scoped to intra)" — intersub8 landed that capability | |
| 13 | + (the `the_decode_path_refuses_exactly_the_listed_cases` test named it). | |
| 14 | +- `6561ec4` lane-cdef `8c6065e` (clean). | |
| 15 | +- `c3ead8c` lane-sqdrift `7d498c0` — stream.rs conflict was two whole appended test fns interleaved; | |
| 16 | + resolved by `git checkout --ours stream.rs` + `patch -p1` of `git diff 85887c7 7d498c0 -- stream.rs` | |
| 17 | + (both new tests present: `..._reads_the_no_cfl_uv_alphabet`, `..._square_only_inter_sequence...`). | |
| 18 | +- `crates/ec-av1/src/cdf.rs` byte-identical to main (`git diff --stat main -- cdf.rs` empty). | |
| 19 | +- `f5c8dbf` adds EC_TRACE_MODE_STEP ladder prints in the 8x8 intra-in-inter arm | |
| 20 | + (`EC_ISTEP ... name=use_filter_intra` in the oracle's exact format, plus `EC_ISTEP8 name=modes`). | |
| 21 | + | |
| 22 | +## Gate result on the merged tree (RED, same shape as r1) | |
| 23 | +`uv8-gate-r2.log` (unit uv8-gate-r2-1788332583, before the trace commit): all three arms | |
| 24 | +30/30 named refusals, counted-exact=0, uncounted-exact=0. Re-armed after the merge as unit | |
| 25 | +**uv8-gate-r2b** → `$HOME/.cache/uv8-gate-r2.log`, then the full suite in the SAME unit → | |
| 26 | +`$HOME/.cache/uv8-suite-r2.log`. | |
| 27 | +Refusal histogram over the 90 attempts: 31x inter 16x16-level 1:4, 21x nonzero angle delta on an | |
| 28 | +8x8 intra leaf, 13x inter 8x8 HORZ, 10x non-skip rect strip, 5x intra 1:4 rect strip, 3x inter SB AB, | |
| 29 | +3x 128x128 SB HORZ/VERT/AB, 2x intra 4x4 in sub-8x8 split, 1x 32x64 split TU, 1x intra 8x4/4x8. | |
| 30 | +All still class [[refusal-from-own-desync]] — proven below. | |
| 31 | + | |
| 32 | +## ROOT CAUSE LOCALISED (this is the round's real result) | |
| 33 | +Stream `~/.cache/uv8-tmp/a0.obu` (regenerate: `~/.cache/uv8-tmp/g2.sh 42 12 a0.obu`, exact gate | |
| 34 | +recipe, 8-bit, seed 42, cq 12; note it is a **128x128 superblock** stream — the gate recipe has no | |
| 35 | +`--sb-size=64`). | |
| 36 | +1. `EC_TRACE=1 aomdec` partition histogram (`ref_part.txt`): the reference codes **only** NONE and | |
| 37 | + SPLIT (bsize 15/12/9 value=3, bsize 6 value 0|3, bsize 3 value 0). There is no rect/AB/1:4 | |
| 38 | + partition anywhere in the stream → every refusal above is our own desync. | |
| 39 | +2. Partition range ladder (ours `EC_TRACE_PART=1` vs ref, ignoring the ctx print convention: | |
| 40 | + ref prints `4*bsl + ctx`): decode-order frame 1 matches 138/138; frame 2 first range divergence | |
| 41 | + at element 119 — ref `(0,36,bsize=6,rng=48648)` vs ours `rng=38664`. The previous element, | |
| 42 | + the 8x8 partition at **mi (2,34)**, still matches (rng 44040). | |
| 43 | +3. `EC_MODE` subsequence: ref's entries are consumed in order up to `(2,32)`; ours' next block | |
| 44 | + `(0,36)` starts at rng 57984 vs ref 32884. Ref prints no EC_MODE for `(2,34)` → that block is an | |
| 45 | + **INTRA 8x8 leaf inside inter frame 2**. | |
| 46 | +4. `EC_TRACE_MODE_STEP` ladder at that block: ours reads `use_filter_intra val=1 rng=64248` and | |
| 47 | + `filter_intra_mode val=0 rng=43964` — **bit-identical to the oracle**. Our decoded modes there are | |
| 48 | + `y=DC_PRED, uv=13 (UV_CFL_PRED)` (`EC_ISTEP8` line). | |
| 49 | + => the whole mode-info half of this leaf, including the new non-DC/CfL uv path, is IN SYNC. | |
| 50 | + The desync is in what follows: `read_block_tx_size` or the leaf's COEFFICIENTS. | |
| 51 | + | |
| 52 | +## EXACT NEXT STEP | |
| 53 | +Both coefficient traces are already dumped: `~/.cache/uv8-tmp/ref_co.txt` (761992 lines) and | |
| 54 | +`ours_co.txt` (260655). Formats: ref `EC_COEFF plane=.. row=.. col=.. tx_size=.. rng=..` + | |
| 55 | +`EC_COEFF_STEP tag=all_zero|tx_type|base|br ...`; ours prints the STEP lines only (no EC_COEFF | |
| 56 | +header with plane/row/col). Align the two `EC_COEFF_STEP` streams and find the first `rng` | |
| 57 | +divergence — it must be inside the block at mi (2,34) of decode-order frame 2, i.e. the FIRST | |
| 58 | +filter-intra + CfL 8x8 intra leaf of an inter frame. Prime suspects, in order: | |
| 59 | + (a) the CfL AC / chroma `TxbSet::Chroma4` txb ctx on a leaf whose luma is filter-intra; | |
| 60 | + (b) `read_block_tx_size` for an intra block in an inter frame at 8x8 (`--enable-tx-size-search=0` | |
| 61 | + here, so check whether a symbol should be read at all); | |
| 62 | + (c) the luma `intra_ext_tx` row: `read_plane` gets `filter_intra` and applies `fi_tx_row`, but the | |
| 63 | + CHROMA calls pass `mode` (raw luma mode) as the tx-row arg with `filter_intra=None` — verify | |
| 64 | + against libaom `av1_read_tx_type` (chroma tx type is inferred, so this should be inert; prove it). | |
| 65 | +Do NOT re-do steps 1-4; they are pinned above with their artifacts. |
lanes/uv8-r3.handoff.mdadded+54 -0
| @@ -0,0 +1,54 @@ | ||
| 1 | +# lane-uv8 r3 — HANDOFF (GREEN gate; suite still running at the turn cap) | |
| 2 | + | |
| 3 | +## ROOT CAUSE (fixed, committed) | |
| 4 | +`decode_inter_block8`'s INTRA arm passed a hardcoded `TxbSet::Luma8` to `read_plane` for the | |
| 5 | +8x8 leaf's LUMA transform. `TxbSet::Luma8` is the `reduced_tx_set == 1` alphabet | |
| 6 | +(`EXT_TX_SET_DTT4_IDTX`, FIVE types). libaom `av1_get_ext_tx_set_type` (`av1/common/blockd.h`) | |
| 7 | +returns `EXT_TX_SET_DTT4_IDTX_1DDCT` (SEVEN types, `TxbSet::Luma8Set1`) for `is_inter == 0`, | |
| 8 | +`tx_size_sqr == TX_8X8`, `use_reduced_set == 0` — and an INTRA leaf inside an INTER frame is | |
| 9 | +`is_inter == 0`. Same symbol value, different narrowing (class [[wrong-alphabet-same-value]]); | |
| 10 | +the msac range diverged at the leaf's first `tx_type` and desynced the rest of the tile, which | |
| 11 | +manufactured the 30/30 "named refusals" of r1/r2 (class [[refusal-from-own-desync]]). | |
| 12 | +FIX: `crates/ec-av1/src/decode.rs:22057` -> `txbset_for(8, reduced_tx_set)` (the parameter was | |
| 13 | +already in scope). Charter suspects (1) `fimode_to_intradir` and (2) `tx_depth` were BOTH already | |
| 14 | +correct: `fi_tx_row` is applied at every luma txb call site, `fimode_to_intradir[0] == DC_PRED` | |
| 15 | +equals this block's y_mode anyway, and `read_block_tx_size` returns depth 0 here. | |
| 16 | + | |
| 17 | +## GATE AFTER THE FIX — GREEN (unit uv8-gate-r3, log $HOME/.cache/uv8-gate-r3.log) | |
| 18 | +`cargo test -p ec-av1 --lib -- --test-threads=1 --nocapture non_dc_chroma_8x8_intra_leaf` | |
| 19 | +-> 3 passed / 0 failed, 5.53s. Every arm exact on ATTEMPT 0 with all three chroma classes | |
| 20 | +firing (directional / smooth-paeth / CfL): | |
| 21 | + 8-bit 1-tile seed42 cq12: 159 / 172 / 211 | |
| 22 | + 10-bit 1-tile seed42 cq12: 112 / 126 / 120 | |
| 23 | + 8-bit 2-tile seed42 cq12: 83 / 66 / 80 | |
| 24 | +buckets on each arm: counted-exact=1 uncounted-exact=0 named-refusals=0 (attempts 1). | |
| 25 | +All 8 frames of each stream pixel-compared vs ffmpeg (Y/U/V), no mismatch. | |
| 26 | +`stream.rs:5897` tightened: `counted` now requires ALL THREE classes on the same compared | |
| 27 | +attempt (was sum-nonzero) — this stricter predicate is what the green run above satisfies. | |
| 28 | + | |
| 29 | +## REFUSAL STATE | |
| 30 | +The lifted non-DC-uv_mode refusal STAYS LIFTED (gate green). Still refused by name and NOT part | |
| 31 | +of this lane: "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform | |
| 32 | +units" (decode.rs ~21996) and "a nonzero angle delta on an 8x8 intra leaf in an inter frame". | |
| 33 | + | |
| 34 | +## SWEEP (class: hardcoded reduced-set TxbSet) | |
| 35 | +`grep -n 'TxbSet::Luma\(4\|8\|16\|32\),' crates/ec-av1/src/decode.rs` — after the fix there are | |
| 36 | +ZERO reduced-sensitive hardcodes outside `txbset_for`/`txbset_for_inter`; every remaining | |
| 37 | +`Luma16`/`Luma32` literal is alphabet-invariant to `reduced_tx_set`. The rect-strip and >=16 | |
| 38 | +square intra-in-inter arms already route through `txbset_for` (decode.rs 6053, 7167, 7777, | |
| 39 | +7857, 9594, 11075). | |
| 40 | + | |
| 41 | +## SUITE — RUNNING, NOT VERIFIED | |
| 42 | +Unit `uv8-gate-r3.service` (still active at the turn cap) is now in its suite phase: | |
| 43 | +log `$HOME/.cache/uv8-suite-r3.log`. At hand-off: 233 tests `ok`, 0 FAILED, 0 `failures:` lines | |
| 44 | +(of ~425). NO green suite claim. | |
| 45 | + | |
| 46 | +## EXACT NEXT STEP | |
| 47 | +1. `grep -E "^test result|FAILED|^failures:" $HOME/.cache/uv8-suite-r3.log` once the unit goes | |
| 48 | + inactive; expect N/0. If a gate reddens, it is a SIBLING of this alphabet fix — re-run it | |
| 49 | + before touching the fix. | |
| 50 | +2. Then the lane is mergeable at its tip. | |
| 51 | + | |
| 52 | +## EVIDENCE | |
| 53 | +EVIDENCE: ~/.cache/uv8-tmp/ref.tu + ours3.tu | instrumented aomdec EC_TRACE_COEFF vs our EC_TRACE_COEFF on ~/.cache/uv8-tmp/a0.obu, per-TU (all_zero,eob) msac RANGE ladder | before: first divergence at TU-line 3392 (ref eob rng=32776 vs ours 34568; the preceding tx_type read ref rng=33532 vs ours 35240 at plane=0 tx_size=1, the mi(2,34) filter-intra leaf of decode-order frame 2) — after: 13986/13986 identical over the whole stream, decode_probe rc=0, no refusal | |
| 54 | +EVIDENCE: $HOME/.cache/uv8-gate-r3.log | the three-arm gate command above | 3 passed / 0 failed, counted-exact=1 named-refusals=0 per arm, counts as listed |
lanes/uv8-r3.report.mdadded+42 -0
| @@ -0,0 +1,42 @@ | ||
| 1 | +# lane-uv8 r3 — GREEN (root cause: wrong tx_type ALPHABET on the 8x8 intra-in-inter leaf) | |
| 2 | + | |
| 3 | +## Root cause | |
| 4 | +`decode_inter_block8`'s INTRA arm passed a hardcoded `TxbSet::Luma8` to `read_plane` for the | |
| 5 | +leaf's 8x8 luma transform. `TxbSet::Luma8` is the `reduced_tx_set == 1` set | |
| 6 | +(`EXT_TX_SET_DTT4_IDTX`, FIVE types); with `reduced_tx_set == 0` libaom's | |
| 7 | +`av1_get_ext_tx_set_type` (`av1/common/blockd.h`) returns, for `is_inter == 0` and | |
| 8 | +`tx_size_sqr == TX_8X8`, `EXT_TX_SET_DTT4_IDTX_1DDCT` — SEVEN types | |
| 9 | +(`TxbSet::Luma8Set1`). Same symbol, different alphabet: the CDF narrowing differed, so the | |
| 10 | +msac range diverged at the leaf's first `tx_type` and every following block desynced. The | |
| 11 | +desync manufactured the 30/30 "named refusals" the r1/r2 gate logs showed | |
| 12 | +(class [[refusal-from-own-desync]] + [[wrong-alphabet-same-value]]). | |
| 13 | + | |
| 14 | +Charter suspect (1) (the `fimode_to_intradir` row) was already correct: `fi_tx_row` is applied | |
| 15 | +at every luma `txb` call site including this one, and `fimode_to_intradir[0] == DC_PRED` | |
| 16 | +equals this block's `y_mode` anyway, so that row was inert here. | |
| 17 | + | |
| 18 | +## Change | |
| 19 | +- `crates/ec-av1/src/decode.rs:22057` — `TxbSet::Luma8` -> `txbset_for(8, reduced_tx_set)` | |
| 20 | + (`reduced_tx_set` was already a parameter of `decode_inter_block8`). | |
| 21 | +- `crates/ec-av1/src/stream.rs:5897` — gate `counted` predicate tightened from | |
| 22 | + "sum nonzero" to "all three uv classes fired on the same pixel-compared attempt". | |
| 23 | + | |
| 24 | +## Sweep (class: hardcoded reduced-set TxbSet) | |
| 25 | +`grep -n 'TxbSet::Luma\(4\|8\|16\|32\),' decode.rs` — the only reduced-sensitive hardcodes are | |
| 26 | +sizes 8 and 4; after this fix there are ZERO outside `txbset_for`/`txbset_for_inter`. Every | |
| 27 | +`Luma16`/`Luma32` literal is alphabet-invariant to `reduced_tx_set` (`txbset_for` maps 16 and | |
| 28 | +32 identically for both values). The rect-strip and >=16 square intra-in-inter arms already go | |
| 29 | +through `txbset_for`/`txbset_for_inter` (decode.rs:6053, 7167, 7777, 7857, 9594, 11075). | |
| 30 | + | |
| 31 | +## EVIDENCE | |
| 32 | +EVIDENCE: ~/.cache/uv8-tmp/ref.tu + ours3.tu | aomdec EC_TRACE_COEFF vs our EC_TRACE_COEFF on ~/.cache/uv8-tmp/a0.obu, per-TU (all_zero,eob) msac range ladder | before: first divergence at TU-line 3392 (ref eob rng=32776, ours 34568; the preceding tx_type read was ref rng=33532 vs ours 35240 at plane=0 tx_size=1, the mi(2,34) filter-intra leaf of decode-order frame 2) — after: 13986/13986 lines identical, whole stream, decode_probe rc=0 with no refusal | |
| 33 | +EVIDENCE: $HOME/.cache/uv8-gate-r3.log | `cargo test -p ec-av1 --lib -- --test-threads=1 --nocapture non_dc_chroma_8x8_intra_leaf` | 3 passed / 0 failed; every arm exact on attempt 0 with all three classes firing — 8bit/1tile dir 159 smooth-paeth 172 cfl 211; 10bit/1tile 112/126/120; 8bit/2tile 83/66/80; buckets counted-exact=1 uncounted-exact=0 named-refusals=0 on each | |
| 34 | + | |
| 35 | +## Residue | |
| 36 | +- deferred: the 8x8 intra-in-inter leaf whose `tx_depth` splits to four TX_4X4 units is still | |
| 37 | + refused by name (decode.rs ~21996). Unblocked by an arm with `--enable-tx-size-search=1` | |
| 38 | + plus a 4x4-TU prediction loop in this leaf path — out of this lane's charter, which fixed the | |
| 39 | + depth-0 alphabet. Its refusal string stays in refusal_inventory.rs. | |
| 40 | +- accepted: `frames` from `decode_stream` is decode order; the gate recipe has | |
| 41 | + `--lag-in-frames=0 --auto-alt-ref=0`, so decode order == display order and all 8 frames are | |
| 42 | + compared (class [[gate-blind-to-hidden-frames]] does not apply). |