debug(av1): EC_LFPARAMS rung + r4 report -- frame 1 of the pinned 192x68 stream reconstructs bit-exact, the mismatch is our deblock filtering 10x more edges than the oracle
Browse files at this commit85dc25f4531e74e9dfd52a44a19d00d7d0764741Parent: b4995b03 changed files +85 -0
- crates/ec-av1/src/decode.rs +7 -0
- lanes/mergefix-r4.handoff.md +32 -0
- lanes/mergefix-r4.report.md +46 -0
crates/ec-av1/src/decode.rsmodified+7 -0
| @@ -12154,6 +12154,13 @@ fn apply_deblock( | |||
| 12154 | if std::env::var_os("EC_AV1_DEBUG_SKIP_DEBLOCK").is_some() { | 12154 | if std::env::var_os("EC_AV1_DEBUG_SKIP_DEBLOCK").is_some() { |
| 12155 | return; | 12155 | return; |
| 12156 | } | 12156 | } |
| 12157 | + // lane-mergefix r4 debug rung: frame-level loop filter parameters. | ||
| 12158 | + if std::env::var_os("EC_LFPARAMS").is_some() { | ||
| 12159 | + eprintln!( | ||
| 12160 | + "EC_LFPARAMS level={:?} sharpness={} delta_enabled={} delta_update={} ref_deltas={:?} mode_deltas={:?}", | ||
| 12161 | + lf.level, lf.sharpness, lf.delta_enabled, lf.delta_update, lf.ref_deltas, lf.mode_deltas | ||
| 12162 | + ); | ||
| 12163 | + } | ||
| 12157 | if lf.level[0] != 0 || lf.level[1] != 0 { | 12164 | if lf.level[0] != 0 || lf.level[1] != 0 { |
| 12158 | deblock_plane(y, 0, lf, n, frame_width, frame_height); | 12165 | deblock_plane(y, 0, lf, n, frame_width, frame_height); |
| 12159 | } | 12166 | } |
lanes/mergefix-r4.handoff.mdadded+32 -0
| @@ -0,0 +1,32 @@ | |||
| 1 | +# lane-mergefix r4 handoff | ||
| 2 | + | ||
| 3 | +Tip: lane-mergefix (this commit). Only change is the `EC_LFPARAMS` debug rung. | ||
| 4 | + | ||
| 5 | +## Do not re-hunt: frame 1 is NOT a compound-prediction defect | ||
| 6 | +Frame 1 pre-filter reconstruction is BIT-EXACT vs the oracle (0 px). The rung that showed | ||
| 7 | +it: our `EC_AV1_PREFILT_DUMP16` (cropped 192x68, u16 LE) vs aomdec `EC_AV1_PREFILT_DUMP` | ||
| 8 | +(cropped 192x68, u8). First differing prediction sample: NONE — there is none. | ||
| 9 | +The divergence appears at the POSTDEBLOCK rung: aomdec's `EC_AV1_POSTDEBLOCK_DUMP` is the | ||
| 10 | +mi-ALIGNED buffer (192x72 luma, 20736 bytes total), ours is the crop; crop to 68 rows | ||
| 11 | +before comparing or you will read garbage. Frame 1 postdeblock: 7244 differing px, first | ||
| 12 | +at row 0 col 0. Against the shared pre-filter picture libaom changes 718 px, we change | ||
| 13 | +7345 — we filter 6753 px libaom leaves alone. | ||
| 14 | + | ||
| 15 | +## r5 job | ||
| 16 | +1. Port spec 7.14.2 / libaom `set_lpf_parameters` suppression into `edge_params` | ||
| 17 | + (decode.rs ~13276, whose comment states the now-false invariant): | ||
| 18 | + filter only when `(curr_level || pv_lvl) && (!pv_skip || !curr_skipped || pu_edge)`, | ||
| 19 | + `curr_skipped = skip_txfm && is_inter`. | ||
| 20 | +2. Check the inter/var-tx LF TU grid: `EC_TXGRID_TRACE=1` shows all of frame 1's | ||
| 21 | + `mi_row=16` publishing `w_mi=2 h_mi=2 tx_px=8` 8x8 TUs; libaom gives a skip-inter block | ||
| 22 | + one whole-block `max_txsize_rect_lookup` TU. | ||
| 23 | +Levels are ruled out: `EC_LFPARAMS=1` (new) prints frame 1 as | ||
| 24 | +`level=[20,16,20,26] sharpness=0 delta_enabled=true delta_update=false | ||
| 25 | +ref_deltas=[1,0,0,0,-1,0,-1,-1] mode_deltas=[0,0]`; max |delta| vs pre-filter is 10 in | ||
| 26 | +BOTH decoders, so it is edge COUNT, not edge strength. | ||
| 27 | + | ||
| 28 | +## Environment | ||
| 29 | +Stream `~/.cache/mergefix-tmp/str61.obu` md5 a14892ed0ba88b6ad2b566e251ea2d33 (`mkstr.sh`); | ||
| 30 | +instrumented oracle `~/.cache/mergefix-tmp/aom-build/aomdec`. Note `EC_AV1_PREFILT_DUMP16` | ||
| 31 | +SEGFAULTS on this 8-bit stream in aomdec — use the 8-bit rung there. | ||
| 32 | +Artifacts: `~/.cache/mergefix-tmp/r4_{pre,ours,aom,apd}.f*`, `r4_lfgrid.txt`. | ||
lanes/mergefix-r4.report.mdadded+46 -0
| @@ -0,0 +1,46 @@ | |||
| 1 | +# lane-mergefix r4 report | ||
| 2 | + | ||
| 3 | +## Verdict: the r3/charter premise is FALSE — frame 1 is not a prediction defect | ||
| 4 | + | ||
| 5 | +Frame 1 of the pinned stream reconstructs BIT-EXACT (0 differing luma px, whole | ||
| 6 | +cropped frame) against the instrumented oracle's pre-filter dump. The 3376 px the | ||
| 7 | +straddling gate reports are introduced by OUR DEBLOCK, not by compound prediction: | ||
| 8 | +we filter ~10x more pixels than libaom on that frame. | ||
| 9 | + | ||
| 10 | +EVIDENCE: ~/.cache/mergefix-tmp/{r4_pre.f1,r4_aom.f1,r4_ours.f1,r4_apd.f1} | | ||
| 11 | +`EC_AV1_PREFILT_DUMP16=<p> decode_probe str61.obu` vs | ||
| 12 | +`EC_AV1_PREFILT_DUMP=<p> aomdec --rawvideo -o /dev/null str61.obu`, then the same pair | ||
| 13 | +of POSTDEBLOCK rungs (aomdec's dump is the mi-ALIGNED buffer 192x72, ours the crop | ||
| 14 | +192x68 — crop before comparing) | | ||
| 15 | +frame 0 pre 0 / postdeblock 0; frame 1 pre 0 / postdeblock 7244 differing luma px; | ||
| 16 | +against the shared pre-filter picture libaom changes 718 px, we change 7345 | ||
| 17 | +(6753 pixels we filter that libaom leaves alone, 126 the other way). | ||
| 18 | + | ||
| 19 | +## Where it points (not yet fixed) | ||
| 20 | +Filter levels are not the cause: frame 1 parses `level=[20,16,20,26] sharpness=0 | ||
| 21 | +delta_enabled=true delta_update=false ref_deltas=[1,0,0,0,-1,0,-1,-1] mode_deltas=[0,0]` | ||
| 22 | +(new rung `EC_LFPARAMS`, decode.rs ~12157), and the pattern is "extra edges", not | ||
| 23 | +"stronger filtering" (max |delta| vs pre-filter is 10 on BOTH decoders). | ||
| 24 | + | ||
| 25 | +The suspect is the loop-filter TU grid on inter frames plus the missing skip | ||
| 26 | +suppression of spec 7.14.2 / libaom `set_lpf_parameters` | ||
| 27 | +(`if ((curr_level || pv_lvl) && (!pv_skip || !curr_skipped || pu_edge))`, where | ||
| 28 | +`curr_skipped = skip_txfm && is_inter`). `edge_params` (decode.rs ~13276) documents | ||
| 29 | +that it deliberately omits that term under the invariant "a coded block's transform is | ||
| 30 | +always its own full size" — an invariant var-tx broke. `EC_TXGRID_TRACE` shows the whole | ||
| 31 | +`mi_row=16` row of frame 1 publishing 8x8 TUs (`w_mi=2 h_mi=2 tx_px=8`), i.e. an 8-px | ||
| 32 | +interior edge lattice that libaom does not filter when both sides are skip-inter and the | ||
| 33 | +edge is not a PU edge. | ||
| 34 | + | ||
| 35 | +## Changed | ||
| 36 | +- `crates/ec-av1/src/decode.rs` ~12157: `EC_LFPARAMS` rung (frame-level loop filter | ||
| 37 | + params) — the instrument that ruled the level out. No behavioural change. | ||
| 38 | + | ||
| 39 | +## Gates | ||
| 40 | +Not re-run this round (no behavioural change shipped); the straddling gate stands where | ||
| 41 | +r2/r3 left it (3376/3622 px, see r3 report). | ||
| 42 | + | ||
| 43 | +## Disposition | ||
| 44 | +- fix-now (r5): port `set_lpf_parameters`' skip/pu_edge suppression + verify the inter | ||
| 45 | + var-tx / skip-inter LF TU grid publishes the block's max rect tx size. | ||
| 46 | +- accepted: r3's partition-context finding stays unshipped (sibling-gate trade). | ||