diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 8cc1cbf3..b0b57691 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -12154,6 +12154,13 @@ fn apply_deblock( if std::env::var_os("EC_AV1_DEBUG_SKIP_DEBLOCK").is_some() { return; } + // lane-mergefix r4 debug rung: frame-level loop filter parameters. + if std::env::var_os("EC_LFPARAMS").is_some() { + eprintln!( + "EC_LFPARAMS level={:?} sharpness={} delta_enabled={} delta_update={} ref_deltas={:?} mode_deltas={:?}", + lf.level, lf.sharpness, lf.delta_enabled, lf.delta_update, lf.ref_deltas, lf.mode_deltas + ); + } if lf.level[0] != 0 || lf.level[1] != 0 { deblock_plane(y, 0, lf, n, frame_width, frame_height); } diff --git a/lanes/mergefix-r4.handoff.md b/lanes/mergefix-r4.handoff.md new file mode 100644 index 00000000..4acfbbc3 --- /dev/null +++ b/lanes/mergefix-r4.handoff.md @@ -0,0 +1,32 @@ +# lane-mergefix r4 handoff + +Tip: lane-mergefix (this commit). Only change is the `EC_LFPARAMS` debug rung. + +## Do not re-hunt: frame 1 is NOT a compound-prediction defect +Frame 1 pre-filter reconstruction is BIT-EXACT vs the oracle (0 px). The rung that showed +it: our `EC_AV1_PREFILT_DUMP16` (cropped 192x68, u16 LE) vs aomdec `EC_AV1_PREFILT_DUMP` +(cropped 192x68, u8). First differing prediction sample: NONE — there is none. +The divergence appears at the POSTDEBLOCK rung: aomdec's `EC_AV1_POSTDEBLOCK_DUMP` is the +mi-ALIGNED buffer (192x72 luma, 20736 bytes total), ours is the crop; crop to 68 rows +before comparing or you will read garbage. Frame 1 postdeblock: 7244 differing px, first +at row 0 col 0. Against the shared pre-filter picture libaom changes 718 px, we change +7345 — we filter 6753 px libaom leaves alone. + +## r5 job +1. Port spec 7.14.2 / libaom `set_lpf_parameters` suppression into `edge_params` + (decode.rs ~13276, whose comment states the now-false invariant): + filter only when `(curr_level || pv_lvl) && (!pv_skip || !curr_skipped || pu_edge)`, + `curr_skipped = skip_txfm && is_inter`. +2. Check the inter/var-tx LF TU grid: `EC_TXGRID_TRACE=1` shows all of frame 1's + `mi_row=16` publishing `w_mi=2 h_mi=2 tx_px=8` 8x8 TUs; libaom gives a skip-inter block + one whole-block `max_txsize_rect_lookup` TU. +Levels are ruled out: `EC_LFPARAMS=1` (new) prints frame 1 as +`level=[20,16,20,26] sharpness=0 delta_enabled=true delta_update=false +ref_deltas=[1,0,0,0,-1,0,-1,-1] mode_deltas=[0,0]`; max |delta| vs pre-filter is 10 in +BOTH decoders, so it is edge COUNT, not edge strength. + +## Environment +Stream `~/.cache/mergefix-tmp/str61.obu` md5 a14892ed0ba88b6ad2b566e251ea2d33 (`mkstr.sh`); +instrumented oracle `~/.cache/mergefix-tmp/aom-build/aomdec`. Note `EC_AV1_PREFILT_DUMP16` +SEGFAULTS on this 8-bit stream in aomdec — use the 8-bit rung there. +Artifacts: `~/.cache/mergefix-tmp/r4_{pre,ours,aom,apd}.f*`, `r4_lfgrid.txt`. diff --git a/lanes/mergefix-r4.report.md b/lanes/mergefix-r4.report.md new file mode 100644 index 00000000..0c609f60 --- /dev/null +++ b/lanes/mergefix-r4.report.md @@ -0,0 +1,46 @@ +# lane-mergefix r4 report + +## Verdict: the r3/charter premise is FALSE — frame 1 is not a prediction defect + +Frame 1 of the pinned stream reconstructs BIT-EXACT (0 differing luma px, whole +cropped frame) against the instrumented oracle's pre-filter dump. The 3376 px the +straddling gate reports are introduced by OUR DEBLOCK, not by compound prediction: +we filter ~10x more pixels than libaom on that frame. + +EVIDENCE: ~/.cache/mergefix-tmp/{r4_pre.f1,r4_aom.f1,r4_ours.f1,r4_apd.f1} | +`EC_AV1_PREFILT_DUMP16=

decode_probe str61.obu` vs +`EC_AV1_PREFILT_DUMP=

aomdec --rawvideo -o /dev/null str61.obu`, then the same pair +of POSTDEBLOCK rungs (aomdec's dump is the mi-ALIGNED buffer 192x72, ours the crop +192x68 — crop before comparing) | +frame 0 pre 0 / postdeblock 0; frame 1 pre 0 / postdeblock 7244 differing luma px; +against the shared pre-filter picture libaom changes 718 px, we change 7345 +(6753 pixels we filter that libaom leaves alone, 126 the other way). + +## Where it points (not yet fixed) +Filter levels are not the cause: frame 1 parses `level=[20,16,20,26] sharpness=0 +delta_enabled=true delta_update=false ref_deltas=[1,0,0,0,-1,0,-1,-1] mode_deltas=[0,0]` +(new rung `EC_LFPARAMS`, decode.rs ~12157), and the pattern is "extra edges", not +"stronger filtering" (max |delta| vs pre-filter is 10 on BOTH decoders). + +The suspect is the loop-filter TU grid on inter frames plus the missing skip +suppression of spec 7.14.2 / libaom `set_lpf_parameters` +(`if ((curr_level || pv_lvl) && (!pv_skip || !curr_skipped || pu_edge))`, where +`curr_skipped = skip_txfm && is_inter`). `edge_params` (decode.rs ~13276) documents +that it deliberately omits that term under the invariant "a coded block's transform is +always its own full size" — an invariant var-tx broke. `EC_TXGRID_TRACE` shows the whole +`mi_row=16` row of frame 1 publishing 8x8 TUs (`w_mi=2 h_mi=2 tx_px=8`), i.e. an 8-px +interior edge lattice that libaom does not filter when both sides are skip-inter and the +edge is not a PU edge. + +## Changed +- `crates/ec-av1/src/decode.rs` ~12157: `EC_LFPARAMS` rung (frame-level loop filter + params) — the instrument that ruled the level out. No behavioural change. + +## Gates +Not re-run this round (no behavioural change shipped); the straddling gate stands where +r2/r3 left it (3376/3622 px, see r3 report). + +## Disposition +- fix-now (r5): port `set_lpf_parameters`' skip/pu_edge suppression + verify the inter + var-tx / skip-inter LF TU grid publishes the block's max rect tx size. +- accepted: r3's partition-context finding stays unshipped (sibling-gate trade).