From 1fd22e3f2bcfa6ac2b4102a24ace394adcd84884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Wed, 2 Sep 2026 08:58:05 +0300 Subject: [PATCH] docs(sb128c): r4 report -- deblock root cause, cdef claim disproved, frame-5 residue --- lanes/sb128c-r4.report.md | 132 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 lanes/sb128c-r4.report.md diff --git a/lanes/sb128c-r4.report.md b/lanes/sb128c-r4.report.md new file mode 100644 index 00000000..6da0b849 --- /dev/null +++ b/lanes/sb128c-r4.report.md @@ -0,0 +1,132 @@ +# lane-sb128c r4 report + +Tip `lane-sb128c` @ `6226c27` (worktree `edith_codecs-sb128c`, +`CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sb128c`). + +## VERDICT: RED + +The r3 residue is CLOSED at its root cause (deblock), but the gate stream has a +SECOND, independent defect one decode-order frame later, in reconstruction. + +## (0) r3 suite result line + +`sb128c-suite-r3-1788327685.service`, `$HOME/.cache/sb128c-suite-r3.log`: +`test result: FAILED. 371 passed; 1 failed; 32 ignored; 0 measured; 0 filtered +out; finished in 797.36s`. The one failure is r3's own known-RED gate +`a_real_aomenc_inter_128x128_none_root_decodes_pixel_exact`. + +## (1) The x=64 band -- ROOT CAUSE FOUND AND FIXED + +Method: stage bisection with the aomdec instrumentation rungs, decode order. + +| decode-order frame | pre-filter | post-deblock | final (CDEF+LR) | +|---|---|---|---| +| 0..3 | exact | exact | exact | +| 4 | **exact** | **98 Y px, 274 C** | 98 Y / 274 C | +| 5..8 | wrong | wrong | wrong | + +Pre-filter exact + post-deblock wrong on the SAME frame => the loop filter, not +a symbol. The decisive measurement: against `EC_AV1_PREFILT_DUMP`, aomdec's own +post-deblock dump changes **ZERO** pixels in luma columns 50..78 of that frame, +while ours changes 98 (peak 26 at column 63, footprint 58..66 = the 14-tap +vertical filter at x=64). libaom does not filter that edge at all. + +Why: libaom `av1_loopfilter.c:set_one_param_for_line_luma` (and `_chroma`) + +```c +const int32_t pu_edge = mi_prev != mbmi; +if (!pu_edge) curr_skipped = mbmi->skip_txfm && is_inter_block(mbmi); +if ((pu_edge || !curr_skipped) && level) { params->filter_length = ...; } +``` + +`get_transform_size` still reports TX_64X64 for a SKIP 128x128 inter block, so +the transform-unit edge at x=64 exists -- it is simply suppressed because it is +not a prediction-unit edge and the block is skipped. Every 128 block in this +stream is `is_inter=1 skip=1`. + +Fix (`crates/ec-av1/src/decode.rs`, commit `6226c27`): +- the per-leaf `fill_lf_grid_rect` loop (the var-tx leaf publication, ~line + 19256) is gated on `!(skip && is_inter)`. The block-level publication of + `write_w = 128` stays, which IS the suppression. The 128 root is the only + block that reaches that loop skipped: `read_block_tx_size`'s + `TX_MODE_LARGEST` branch hands back four TX_64X64 leaves for `side > 64` + regardless of `skip`, while every `side <= 64` skip inter block gets `None`. +- `fill_lf_grid_rect`'s uv extent (~line 4186) drops its `.min(32)` cap. The + cap was INERT for every block up to 64 wide (`64/2 == 32`) and wrong for a + 128-sided one, where it published an internal chroma TU edge every 32 chroma + px. A non-skip 128 block still gets uv 32, through its own per-leaf calls + (`w_mi * MI == 64`). +- `dump_stage` now indexes its file per decode-order picture. It wrote a fixed + `.f0` every frame, so `EC_AV1_POSTDEBLOCK_DUMP` only ever held the LAST + picture and could not be compared against aomdec's indexed rung -- that is + the instrument this root cause needed. + +Result on `$HOME/.cache/sb128c-work/g-61-8-0.obu`: decode-order frames 0..4 are +now exact at pre-filter, post-deblock AND final (`EC_AV1_FINAL_DUMP`, hidden +frames included). Before the fix frame 4 was wrong at post-deblock. + +## (1b) CDEF for a 128 root -- the charter's suspicion is WRONG, verified + +`read_cdef` (`av1/decoder/decodemv.c`) reads at most one literal PER CALL, and +is called once per BLOCK. For a `PARTITION_NONE` 128 root there is exactly one +block in the superblock, so exactly ONE `cdef_idx` symbol is read +(`index = cdef_unit_col_in_sb + 2 * cdef_unit_row_in_sb` = 0), and it is stored +into the block's own `MB_MODE_INFO`, which every mi cell of all four 64x64 CDEF +units points at. r1's "replicated over 4 quadrants" is CORRECT; no change made. +(Four symbols are read only when the 128 root SPLITs into four non-skip 64s.) + +## (2) The NEW frontier: decode-order frame 5, reconstruction + +Every reference of frame 5 is now pixel-exact at every stage, and frame 5 is +already wrong at PRE-FILTER, so this is not filter propagation: + +``` +decode-order 5 pre-filter: Y 19609 px rows 128..255 cols 0..255 maxd 33 + C 5207 px +per-64x64-quadrant Y diff: [0,0,0,0] [0,0,0,0] [3707,844,3137,3889] [183,177,3844,3828] +first bad pixel: (128, 0) +``` + +The whole BOTTOM superblock row, both 128x128 superblocks, from its very first +pixel; rows 0..127 exact. Our own mode trace for that picture lists the bottom +row as two `side=128 is_inter=1 skip=1` blocks. A skipped inter block's +reconstruction is pure motion compensation, the entropy stream stays in sync +for all 9 frames, and the quadrant diff is content-dependent (flat quadrants +mostly match, detailed ones mostly do not) -- the signature of a slightly wrong +predictor, i.e. mv / reference / interp filter / OBMC, NOT of a wrong write +geometry. Frame 4's own `(32,0)` 128 skip block decodes exact, so 128-wide MC +per se works. + +fix-now for r5; it is the only thing between this gate and GREEN. + +## (3) 128-level HORZ/VERT + AB -- NOT STARTED + +deferred: 128-level HORZ/VERT (128x64, 64x128) and AB on key and inter paths -- +r4's budget went to (0)/(1) and the stage bisection that found the root cause; +unblocked by nothing, it is r5 work. It remains the FRONTIER for his 10-bit AV1 +film. + +## ReelC re-probe (unchanged, as expected -- (3) was not started) + +Both `$HOME/.cache/sb128c-work/reelc2s.obu` and `$HOME/.cache/reelc-head.obu` +(1428 bytes each, `use_128x128_superblock=true bit_depth=10`) stop at +`a 128x128 superblock HORZ/VERT or AB partition (only SPLIT and NONE are +decoded at the 128 root)` with `EC_AV1_FINAL_DUMP` count **1**. That one frame +is **byte-identical** to ffmpeg's `yuv420p10le` decode of the same extract +(4561920 bytes, `cmp` clean). + +## EVIDENCE + +``` +EVIDENCE: $HOME/.cache/sb128c-work/{pf-o,pf-m}.f0..f8, {pd-o,pd-m}.f* | aomdec EC_AV1_PREFILT_DUMP/EC_AV1_POSTDEBLOCK_DUMP vs ours, per decode-order frame | decode-order 0-4 pre-filter exact; frame 4 post-deblock 98 Y + 274 C before the fix +EVIDENCE: $HOME/.cache/sb128c-work/pd-o.f4 vs pf-o.f4 | aomdec's own post-deblock minus pre-filter, luma cols 50..78 | 0 pixels changed by libaom; ours changed 98 (peak 26 at col 63) +EVIDENCE: $HOME/.cache/sb128c-work/{fo,fm}.f0..f8 | EC_AV1_FINAL_DUMP (post CDEF+LR, decode order, hidden frames included) after the fix | frames 0-4 exact, first divergence decode-order 5 +EVIDENCE: $HOME/.cache/sb128c-work/pf-m.f5 vs pf-o.f5 | per-64x64 quadrant diff map | rows 128..255 only, first bad pixel (128,0), maxd 33 +EVIDENCE: $HOME/.cache/sb128c-work/{td.f0,ff.yuv} | decode_probe EC_AV1_FINAL_DUMP vs ffmpeg -pix_fmt yuv420p10le on reelc2s.obu | cmp IDENTICAL, 4561920 bytes +EVIDENCE: $HOME/.cache/sb128c-suite-r3.log | full lib suite on the r3 tip | 371 passed; 1 failed; 32 ignored +``` + +## Suite + +`$HOME/.cache/sb128c-suite-r4.log` (unit `sb128c-suite-r4-1788328542.service`), +totals in the handoff. One KNOWN RED expected: the gate above.