forge
Explore
Log in

Don't you dare go Hollow

8x8 leaf read its single_ref and interp-filter neighbour contexts at SUB(16px) indices after the bands went mi-granular

Browse files at this commit

7250c10a09c4352e99c3af8cc7dcb7b0b9104da8Ahmet Kaan GümüşParent: cadfff7
  • fix
    • 8x8 leaf read its single_ref and interp-filter neighbour contexts at SUB(16px) indices after the bands went mi-granular
Show full message
fix(av1): 8x8 leaf read its single_ref and interp-filter neighbour contexts at SUB(16px) indices after the bands went mi-granular

lane-gmaffine r3, on top of the lane-inter8 merge. `decode_inter_block8`
still indexed `neighbours.above_ref/above_ref1/above_filter` with `c` and
`left_*` with `r` -- `outer_at`, the enclosing 16x16's SUB(16px) coordinates
-- while every other read in the same function had moved to `cmi`/`rmi` (mi,
4px) with lane-inter8 r2's mi-granular bands. Wrong units, so a leaf's
`read_single_ref` p1..p6 contexts and its `switchable_interp` neighbour rows
came from an unrelated 16px column/row.

Measured on the gate's own recipe (--min/--max-partition-size=8, gm and warp
both off, 8-bit cq32): aomdec's EC_MODE_VAL ladder and ours agree on mode, mv,
ref and range for the 16 leaves of the first 32x32 up to (6,4); leaf (6,6) had
identical mode/mv/stack but post-mode-info range 41953 vs aomdec's 38345 --
the divergence sat after the mv, in the filter/ref tail. With mi indices that
leaf and the next 15 now match to the range.

Instrument kept: `EC_MODE_VAL8` under EC_TRACE_MODE, one line per 8x8 leaf
(newmv/globalmv/ref0/mv/stack/rng), diffable against aomdec's EC_MODE_VAL.

Both 8x8 motion gates are still RED: the next divergence is leaf mi=(0,14) of
the same frame, where aomdec reads NEWMV (mv 0,-12) and we read not-new from a
3-entry stack.
crates/ec-av1/src/decode.rsmodified+21 -10
@@ -11480,10 +11480,10 @@ fn decode_inter_block8(
1148011480 let ref_frame = read_single_ref(
1148111481 dec,
1148211482 cdfs,
11483- neighbours.above_ref[c],
11484- neighbours.above_ref1[c],
11485- neighbours.left_ref[r],
11486- neighbours.left_ref1[r],
11483+ neighbours.above_ref[cmi],
11484+ neighbours.above_ref1[cmi],
11485+ neighbours.left_ref[rmi],
11486+ neighbours.left_ref1[rmi],
1148711487 );
1148811488 leaf_refs = (ref_frame, None);
1148911489 let (sref_y, sref_u, sref_v) = ref_planes(ref_frame, ref_y, ref_u, ref_v, other_refs)?;
@@ -11701,17 +11701,17 @@ fn decode_inter_block8(
1170111701 // wrong CDF row. Upgrade: give `Neighbours` a real 8x8-granular
1170211702 // filter array, same shape as the `[3, 3]` approximation the caller
1170311703 // records after the leaf loop.
11704- let above_filter_ctx = if neighbours.above_ref[c] == ref_frame
11705- || neighbours.above_ref1[c] == Some(ref_frame)
11704+ let above_filter_ctx = if neighbours.above_ref[cmi] == ref_frame
11705+ || neighbours.above_ref1[cmi] == Some(ref_frame)
1170611706 {
11707- neighbours.above_filter[c]
11707+ neighbours.above_filter[cmi]
1170811708 } else {
1170911709 [3, 3]
1171011710 };
11711- let left_filter_ctx = if neighbours.left_ref[r] == ref_frame
11712- || neighbours.left_ref1[r] == Some(ref_frame)
11711+ let left_filter_ctx = if neighbours.left_ref[rmi] == ref_frame
11712+ || neighbours.left_ref1[rmi] == Some(ref_frame)
1171311713 {
11714- neighbours.left_filter[r]
11714+ neighbours.left_filter[rmi]
1171511715 } else {
1171611716 [3, 3]
1171711717 };
@@ -11728,6 +11728,17 @@ fn decode_inter_block8(
1172811728 false,
1172911729 );
1173011730 leaf_filter_syms = resolved_filter;
11731+ if std::env::var_os("EC_TRACE_MODE").is_some() {
11732+ eprintln!(
11733+ "EC_MODE_VAL8 mi_row={} mi_col={} newmv={is_new_mv} globalmv={is_globalmv} ref0={ref_frame} mv0=({},{}) stack={} rng={}",
11734+ leaf_mi.0,
11735+ leaf_mi.1,
11736+ mv.0,
11737+ mv.1,
11738+ stack.entries.len(),
11739+ dec.debug_state().0
11740+ );
11741+ }
1173111742 // lane-gmaffine r1: `allow_warp`'s `global_warp_allowed` branch
1173211743 // (`reconinter.c:33-55`), gated INDEPENDENTLY of `motion_mode` --
1173311744 // see [`decode_inter_block`]'s own copy. A local WARPED_CAUSAL model