forge
Explore
Log in

Don't you dare go Hollow

The loop filter ignored spec 7.14.2's skip/pu_edge suppression, filtering a var-tx interior edge lattice the reference never touches

Browse files at this commit

fc0fe408d7258b84a7ee54323edd455672a14302Ahmet Kaan GümüşParent: 6f01e4d
  • fix
    • the loop filter ignored spec 7.14.2's skip/pu_edge suppression, filtering a var-tx interior edge lattice the reference never touches
Show full message
fix(av1): the loop filter ignored spec 7.14.2's skip/pu_edge suppression, filtering a var-tx interior edge lattice the reference never touches

edge_params dropped the `!pv_skip || !curr_skipped || pu_edge` term on the invariant
"a coded block's transform is always its own full size", which var-tx broke: every 8-px
interior transform edge inside a skipped inter block was filtered. Adds a per-4x4-mi
coded-block-origin band (written alongside the skip flag) for the pu_edge term.

On the pinned 192x68 cq61 tile_cols=1 8-bit stream, decode-order frame 1 goes 7244 -> 0
wrong post-deblock luma px; its pre-filter reconstruction was already bit-exact, which
disproves the compound-prediction premise this round started from. The 1:4 rect-vartx
sibling gate stays green. The straddling gate still fails on a different, isolated
defect: decode frame 2 is wrong pre-filter in the x=96..127 column band.
(cherry picked from commit 6bc2c8b32c187d51e7723249c7eecbad9a298466)
crates/ec-av1/src/decode.rsmodified+31 -0
@@ -4428,6 +4428,12 @@ struct Neighbours {
44284428 /// unobservable from the pixels alone. Counted by
44294429 /// [`cdef_unwritten_skip_units`].
44304430 skip_written: Vec<bool>,
4431+ /// Per-4x4-mi origin `(mi_row, mi_col)` of the coded (prediction) block
4432+ /// covering that cell -- spec 7.14.2's `isBlockEdge`/libaom `pu_edge`,
4433+ /// which re-enables the loop filter at a prediction boundary between two
4434+ /// skipped inter blocks (lane-mergefix r4). Written by
4435+ /// [`Self::fill_skip_grid_rect`], whose `at_mi` IS that origin.
4436+ blk_org_grid: Vec<[u16; 2]>,
44314437 skip_grid_cols_mi: usize,
44324438 /// Per-4x4-mi luma transform width in pixels (8/16/32/64) -- this decoder
44334439 /// never splits a coded block's transform below its own size (round 2:
@@ -4548,6 +4554,7 @@ impl Neighbours {
45484554 mi_rows,
45494555 skip_grid: vec![false; cols * (SUB / MI) * rows * (SUB / MI)],
45504556 skip_written: vec![false; cols * (SUB / MI) * rows * (SUB / MI)],
4557+ blk_org_grid: vec![[0u16; 2]; cols * (SUB / MI) * rows * (SUB / MI)],
45514558 skip_grid_cols_mi: cols * (SUB / MI),
45524559 tx_grid: vec![0u8; cols * (SUB / MI) * rows * (SUB / MI)],
45534560 tx_h_grid: vec![0u8; cols * (SUB / MI) * rows * (SUB / MI)],
@@ -4982,6 +4989,9 @@ impl Neighbours {
49824989 if let Some(cell) = self.skip_written.get_mut(idx) {
49834990 *cell = true;
49844991 }
4992+ if let Some(org) = self.blk_org_grid.get_mut(idx) {
4993+ *org = [mi_r as u16, mi_c as u16];
4994+ }
49854995 }
49864996 }
49874997 }
@@ -14211,6 +14221,27 @@ fn edge_params(
1421114221 let cur_delta_lf = i32::from(n.delta_lf_grid[mi_r * n.skip_grid_cols_mi + mi_c][delta_idx]);
1421214222 let pv_delta_lf = i32::from(n.delta_lf_grid[pv_mi_r * n.skip_grid_cols_mi + pv_mi_c][delta_idx]);
1421314223
14224+ // spec 7.14.2 / libaom `set_lpf_parameters`: a transform edge between two
14225+ // SKIPPED INTER blocks is filtered only when it is also a prediction
14226+ // (coded-block) edge -- `!pv_skip || !curr_skipped || pu_edge`. The
14227+ // omission of this term (on the stale invariant "a coded block's transform
14228+ // is always its own full size", which var-tx broke) had us filtering an
14229+ // interior 8-px lattice the reference never touches: on the pinned 192x68
14230+ // inter stream frame 1 went from 7244 wrong post-deblock luma px to 0.
14231+ let cur_org = n.blk_org_grid[mi_r * n.skip_grid_cols_mi + mi_c];
14232+ let pu_edge = if dir == 0 {
14233+ mi_c == usize::from(cur_org[1])
14234+ } else {
14235+ mi_r == usize::from(cur_org[0])
14236+ };
14237+ if !pu_edge
14238+ && cur_ref != 0
14239+ && pv_ref != 0
14240+ && n.skip_at(mi_r, mi_c)
14241+ && n.skip_at(pv_mi_r, pv_mi_c)
14242+ {
14243+ return None;
14244+ }
1421414245 let cur_level = lf_level(lf, plane_idx, dir, cur_ref, cur_delta_lf, segment_id_at(mi_r, mi_c));
1421514246 let pv_level = lf_level(
1421614247 lf,