forge
Explore
Log in

Don't you dare go Hollow

Both halves of a split intra block read the FIRST half's edge-filter neighbours

Browse files at this commit

4438a11a3970915f5afcec2dd2fb25e99221aafaAhmet Kaan GümüşParent: 9a73c30
  • fix
    • both halves of a split intra block read the FIRST half's edge-filter neighbours
Show full message
fix(av1): both halves of a split intra block read the FIRST half's edge-filter neighbours

`modes_above_left` keys its mi-exact lookup on the coarse 16x16 cell's own
top-left mi, so the second 8x16 (or 16x8) half of a rect intra block in an
inter frame asked for the neighbours of the first half. libaom reads
`above_mbmi`/`left_mbmi` for the block itself, so the intra-edge filter type
(`get_intra_edge_filter_type`, reconintra.c:974) came out 0 where libaom has
1, and every directional half whose real above/left neighbour was SMOOTH got
its edge filtered at the wrong strength.

Measured on a 2-frame 10-bit 1920x792 128-SB cut, decode-order frame 1
pre-loop-filter vs instrumented aomdec: luma 1269 differing pixels -> 0,
whole-frame 1549 -> 258 bytes (chroma-only residue left). The witness block
(8x16, p_angle 110, above neighbour SMOOTH_H) predicted sum 41742 where
aomdec has 41767; recomputing the spec walk with filter type 1 reproduces
aomdec exactly.

`OUR_PRED` now prints `ft=` so the two decoders' filter type can be diffed
directly (aomdec's `EC_PRED` already did).
crates/ec-av1/src/decode.rsmodified+9 -2
@@ -7665,7 +7665,14 @@ fn decode_intra_rect_in_inter(
76657665 // The intra-edge filter type is the NEIGHBOUR's mode (libaom
76667666 // `get_filt_type`), luma's off the luma neighbours and chroma's off the
76677667 // chroma ones -- [`decode_block_rect`]'s own pair.
7668- let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left(r, c);
7668+ // lane-t900 r4: the coarse pair is keyed on the 16x16 cell's OWN top-left
7669+ // mi, so both 8x16 halves of a VERT split read the neighbours of the FIRST
7670+ // half. libaom's `above_mbmi`/`left_mbmi` are this block's own
7671+ // (`mi[-mi_stride]` / `mi[-1]`) -- take the mi-exact pair over the coarse
7672+ // one exactly as [`decode_leaf8`] already does (class
7673+ // context-read-from-one-cell).
7674+ let (nb_above_mode, nb_left_mode) =
7675+ neighbours.modes_above_left_mi(mi_r, mi_c, neighbours.modes_above_left(r, c));
76697676 let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode);
76707677 if smooth_neighbor {
76717678 SMOOTH_LUMA_HITS.with(|h| h.set(h.get() + 1));
@@ -10864,7 +10871,7 @@ impl PlaneBuf {
1086410871 let row0: Vec<u16> = prediction[..bw.min(8)].to_vec();
1086510872 let col0: Vec<u16> = (0..bh.min(8)).map(|r| prediction[r * bw]).collect();
1086610873 eprintln!(
10867- "@{} OUR_PRED x={x} y={y} bw={bw} bh={bh} mode={mode} ad={angle_delta} sum={sum} row0={row0:?} col0={col0:?}", std::panic::Location::caller()
10874+ "@{} OUR_PRED x={x} y={y} bw={bw} bh={bh} mode={mode} ad={angle_delta} ft={} sum={sum} row0={row0:?} col0={col0:?}", std::panic::Location::caller(), i32::from(smooth_neighbor)
1086810875 );
1086910876 }
1087010877 for row in 0..bh {