R2 report -- skipped-CfL root cause, gate, census 11/24, suite 378/0
Browse files at this commit28382aa3a2f02f2f55024a2f692ce2c55fa19a44Parent: f4f89df- docs
- r2 report -- skipped-CfL root cause, gate, census 11/24, suite 378/0
2 changed files +189 -0
- lanes/COMMON-20260901.md +6 -0
- lanes/kf1200-r2.report.md +183 -0
lanes/COMMON-20260901.mdmodified+6 -0
| @@ -100,3 +100,9 @@ If you ran it: extract your own hunks, `git checkout -- crates/`, re-apply. | ||
| 100 | 100 | never two suites per lane; film extracts ≤2 s; a watchdog (`ec-memwatch` user unit, log |
| 101 | 101 | `$HOME/.cache/ec-memwatch.log`) SIGKILLs any codec/test process above 6 GiB RSS or the largest one |
| 102 | 102 | when MemAvailable < 3 GiB — a killed run means YOUR command exceeded the budget: bound it, do not retry as-is. |
| 103 | + | |
| 104 | +## WORKTREE SETUP (2026-09-02, three lanes lost a round to this) | |
| 105 | +A new worktree needs the TOP-LEVEL fixtures symlink: `ln -s /home/user/Documents/Code/Rust/edith_codecs/fixtures <worktree>/fixtures`. | |
| 106 | +Without it exactly one gate fails: a_real_aomenc_stream_with_film_grain_decodes_pixel_exact with Os NotFound — it is NOT a decode defect. | |
| 107 | +New files under crates/ec-av1/fixtures/ need `git add -f` (bare `fixtures` in .gitignore); verify with `git ls-files`. | |
| 108 | +Commit-msg hook rejects film titles / home paths: describe streams by codec/resolution/bit depth. |
lanes/kf1200-r2.report.mdadded+183 -0
| @@ -0,0 +1,183 @@ | ||
| 1 | +# lane-kf1200 r2 — a skipped sub-8x8 chroma block dropped its CfL alpha | |
| 2 | + | |
| 3 | +## 1. Merge | |
| 4 | + | |
| 5 | +`git merge --no-commit main` (main `85887c7`, lane-mvtwin + lane-sb128b) — clean | |
| 6 | +auto-merge, no conflicts. `crates/ec-av1/src/cdf.rs` byte-identical to main's | |
| 7 | +(`cmp <(git show main:.../cdf.rs) .../cdf.rs` → identical). r1's pair-mi chroma | |
| 8 | +edge-filter fix and its counter survive at `decode.rs:7747`. Commit `d85d7d2`. | |
| 9 | +main contains neither lane-reelckf nor lane-kf900 (`git log --oneline main | grep` | |
| 10 | +→ empty for both), so no duplicate-implementation resolution was needed and the | |
| 11 | +multi-million-byte census rows are still lane-kf900's territory. | |
| 12 | + | |
| 13 | +## 2. Defect found and fixed: `-ss 300`, 463 bytes → 0 | |
| 14 | + | |
| 15 | +Re-measured premise on this branch (1-frame truncation, hash stable twice): | |
| 16 | +U 219 / V 220 samples wrong, Y exact. `EC_AV1_PREFILT_DUMP16` ours vs aomdec's: | |
| 17 | +227 U + 227 V wrong **before the loop filter**, in a 16x16 chroma region at | |
| 18 | +chroma `(384,412)` — reconstruction, not filters. | |
| 19 | + | |
| 20 | +First bad sample chroma `(412,384)` = the 4x4 chroma block of the `BLOCK_4X4` | |
| 21 | +2x2 group at luma mi `(206,192)`. aomdec `EC_TRACE_MODE`: | |
| 22 | +`EC_IMODE_VAL mi_row=207 mi_col=193 mode=4 uv_mode=13 skip=1` — `uv_mode = 13` | |
| 23 | +is `UV_CFL_PRED`, `skip_txfm = 1`. Our `OUR_PRED x=384 y=412 side=4 mode=0 | |
| 24 | +sum=8240 row0=[515,515,515,515]` is flat: DC with **no CfL term at all** | |
| 25 | +(aomdec's own prediction sums to 8241 with a bottom-left ramp). | |
| 26 | + | |
| 27 | +Root cause: both sub-8x8 leaf decoders passed a literal `None` for the CfL | |
| 28 | +argument in their `skip_txfm` arm — | |
| 29 | + | |
| 30 | +- `crates/ec-av1/src/decode.rs:10554/10555` (the 4-leaf `BLOCK_4X4` group) | |
| 31 | +- `crates/ec-av1/src/decode.rs:10916/10917` (the 2-leaf group) | |
| 32 | + | |
| 33 | +libaom's `av1_predict_intra_block_facade` (`av1/common/reconintra.c:1719`) calls | |
| 34 | +`cfl_predict_block` whenever `mbmi->uv_mode == UV_CFL_PRED`; `skip_txfm` only | |
| 35 | +suppresses the residual, never the alpha. Both arms now compute | |
| 36 | +`cfl_ac_q3(y, gpx, gpy, 8)` and pass `alpha.zip(ac)`, exactly like the | |
| 37 | +non-skip arm two lines below and like the rect skip arms already did. | |
| 38 | + | |
| 39 | +### Class sweep | |
| 40 | + | |
| 41 | +Every chroma `reconstruct` / `reconstruct_rect` call site in `decode.rs` was | |
| 42 | +parsed and its cfl argument printed (script in the r2 scratchpad). The rect | |
| 43 | +skip arms (`6015`, `6519`, `8078`) already pass `alpha.zip(ac)`; the only other | |
| 44 | +literal `None` is `20284/20296`, which sits directly behind the refusal | |
| 45 | +"a non-DC chroma mode on an 8x8 inter-frame leaf" (`decode.rs:20212`), so | |
| 46 | +`uv_mode == DC_PRED` is guaranteed there. No other instance of the class. | |
| 47 | + | |
| 48 | +### Counter + gate | |
| 49 | + | |
| 50 | +- `decode.rs:2207` `SKIP_CFL_HITS` / `pub fn skip_cfl_hits()` — skipped sub-8x8 | |
| 51 | + chroma blocks that carried a CfL alpha. | |
| 52 | +- `crates/ec-av1/src/stream.rs` | |
| 53 | + `the_reelb_ss300_key_frame_skipped_cfl_decodes_pixel_exact` — pins | |
| 54 | + `crates/ec-av1/fixtures/reelb_ss300_key_frame.obu` (139 201 B, sha256 | |
| 55 | + `7e3ddf0d602f9496b2f7eb11f051fd4a045020e094d5bc02f83825e2c494ef12`, one | |
| 56 | + 3840x1608 yuv420p10le key frame), decodes it, HARD-asserts | |
| 57 | + `skip_cfl_hits > 0`, then compares Y/U/V against ffmpeg's own 10-bit decode. | |
| 58 | + `git add -f` was used (bare `fixtures` in .gitignore); `git ls-files` confirms | |
| 59 | + it is tracked. | |
| 60 | + | |
| 61 | +Why a fixture and not an aomenc recipe: lane-reelckf r1's ledger dead-end — | |
| 62 | +20 recipes (cq 40..63 × nine lavfi sources, min/max-partition sweeps, sb-size | |
| 63 | +64 and 128) never produced a **skipped** sub-8x8 CfL block (`skip_cfl` counter | |
| 64 | +0 in all). The shape fires exactly **once** in a whole 4K key frame, which is | |
| 65 | +why no synthetic source reaches it. | |
| 66 | + | |
| 67 | +No refusal lifted → `refusal_inventory.rs` / `gate_coverage.rs` unchanged. | |
| 68 | + | |
| 69 | +## 3. Remaining residuals — triaged, one class | |
| 70 | + | |
| 71 | +`-ss 600 / 2400 / 3300 / 5700` (48771 / 42343 / 39971 / 16375 bytes) are ONE | |
| 72 | +defect class, not four: in every one of them the damage is confined to the | |
| 73 | +**last 8 luma rows** of the frame. | |
| 74 | + | |
| 75 | +| -ss | Y rows wrong | U/V rows | first bad Y sample | | |
| 76 | +|----:|---|---|---| | |
| 77 | +| 600 | 1595..1607 | 796..803 | (1595, 2916) | | |
| 78 | +| 2400 | 1595..1607 | 796..803 | (1595, 2445) | | |
| 79 | +| 3300 | 1595..1607 | 796..803 | (1595, 1235) | | |
| 80 | +| 5700 | 1596..1607 | 796..803 | (1596, 3039) | | |
| 81 | + | |
| 82 | +`EC_AV1_PREFILT_DUMP16` on `-ss 600` narrows it further: pre-loop-filter the | |
| 83 | +damage is exactly rows **1600..1607**, columns **192..3839** (rows 1595..1599 | |
| 84 | +in the final picture are deblock spill across the y=1600 edge). The frame is | |
| 85 | +1608 rows = 25 full 64-px superblock rows + one 8-row remainder, so this is the | |
| 86 | +bottom **partial** superblock row, and the first three superblocks of it | |
| 87 | +(columns 0..191) are pixel-exact. | |
| 88 | + | |
| 89 | +Divergence localised to a single block. Through luma mi `(400,47)` our | |
| 90 | +prediction trace matches aomdec's block for block (mi 44: four TX_4X4 in an | |
| 91 | +8x8; mi 46: 8x8 — `EC_PRED mi_row=400 mi_col=46 txw=8 txh=8`). At the very | |
| 92 | +first block of superblock #3: | |
| 93 | + | |
| 94 | +- aomdec: `EC_PRED mi_row=400 mi_col=48 txw=16 txh=8 mode=2 p_angle=180 bsize=5 part=1 ft=1` | |
| 95 | +- ours: `OUR_PRED x=192 y=1600 bw=32 bh=16 mode=0 ad=0` (decode.rs:6511) | |
| 96 | + | |
| 97 | +i.e. we read a 32x16 `PARTITION_HORZ` where libaom reads a 16x8, and the mode | |
| 98 | +differs too — a **partition-symbol divergence at the root of a partial-height | |
| 99 | +superblock** (`has_rows == false`, only 2 of 16 mi rows present), not a | |
| 100 | +prediction bug and not caused by the preceding block. Everything after it in | |
| 101 | +that row is garbage because the row never re-syncs (it is the last row, so | |
| 102 | +nothing propagates downward). | |
| 103 | + | |
| 104 | +`-ss 4800` (2348 bytes in r1, **34 bytes** after this round's CfL fix) is a | |
| 105 | +different, much smaller shape: chroma only, | |
| 106 | +U 29 + V 5 samples in the final picture. `EC_AV1_PREFILT_DUMP16` puts it | |
| 107 | +**pre-loop-filter** too — U 25 + V 3 samples in an **8x4 chroma patch** at | |
| 108 | +rows 540..543, cols 1200..1207 (`|d| <= 6`), luma exact. That is the same | |
| 109 | +geometry as r1's defect (an 8x4 chroma block = the chroma half of a 16x8 | |
| 110 | +`PARTITION_HORZ_4` pair) at luma mi ~`(270,600)`, so it is a strong candidate | |
| 111 | +for a sibling of the pair-mi bug rather than a new class. | |
| 112 | + | |
| 113 | +## 4. Disposition | |
| 114 | + | |
| 115 | +- fix-now (done): `-ss 300` skipped-CfL, fixed + gated + swept. | |
| 116 | +- deferred: the bottom partial-superblock partition divergence (`-ss 600`, | |
| 117 | + 2400, 3300, 5700). Unblocked by: a range ladder over the partition symbols | |
| 118 | + of superblock `(mi_row=400, mi_col=48)` in `s600_f1.obu` comparing aomdec's | |
| 119 | + `r->ec.rng` at `EC_IMODE` against ours — the first three superblocks of the | |
| 120 | + same row are exact, so the ladder starts already in sync at mi 400/47. | |
| 121 | +- deferred: `-ss 4800` (34 B, down from 2348) — stage-attributed (pre-loop-filter, chroma-only, | |
| 122 | + 8x4 patch at chroma (540,1200), luma mi ~(270,600)); the per-block | |
| 123 | + `EC_IMODE_VAL`/`EC_PRED` comparison at that mi is the next step. | |
| 124 | +- accepted: `-ss 900 / 1500 / 2100 / 2700 / 3900 / 6000 / 6300 / 6600` | |
| 125 | + (multi-million bytes) are lane-kf900's entropy desyncs, not merged into main. | |
| 126 | + | |
| 127 | +## 5. 24 key-frame census (bytes differing vs ffmpeg, 1 truncated frame each) | |
| 128 | + | |
| 129 | +Recipe: `$HOME/.cache/kf1200-census-r2.log` (script `census.sh` in the r2 | |
| 130 | +scratchpad) — `ffmpeg -ss S -t 0.4 -c:v copy -f obu`, `trunc.py … 1`, each | |
| 131 | +stream sha256'd twice (identical in all 24 rows), `EC_PROBE_OUT16` vs | |
| 132 | +`ffmpeg -pix_fmt yuv420p10le`. | |
| 133 | + | |
| 134 | +| -ss | r1 (after pair-mi fix) | r2 (after skipped-CfL fix) | | |
| 135 | +|----:|-----------------------:|---------------------------:| | |
| 136 | +| 0 | 0 | 0 | | |
| 137 | +| **300** | **463** | **0** | | |
| 138 | +| 600 | 48771 | 48771 | | |
| 139 | +| 900 | 14057191 | 14057191 | | |
| 140 | +| 1200 | 0 | 0 | | |
| 141 | +| 1500 | 16649650 | 16649650 | | |
| 142 | +| 1800 | 0 | 0 | | |
| 143 | +| 2100 | 15147782 | 15148697 | | |
| 144 | +| 2400 | 42343 | 42343 | | |
| 145 | +| 2700 | 7726287 | 7726168 | | |
| 146 | +| 3000 | 0 | 0 | | |
| 147 | +| 3300 | 39971 | 39971 | | |
| 148 | +| 3600 | 0 | 0 | | |
| 149 | +| 3900 | 7554023 | 7554023 | | |
| 150 | +| 4200 | 0 | 0 | | |
| 151 | +| 4500 | 0 | 0 | | |
| 152 | +| **4800** | **2348** | **34** | | |
| 153 | +| 5100 | 0 | 0 | | |
| 154 | +| 5400 | 0 | 0 | | |
| 155 | +| 5700 | 16375 | 16375 | | |
| 156 | +| 6000 | 15449720 | 15449720 | | |
| 157 | +| 6300 | 15410864 | 15410664 | | |
| 158 | +| 6600 | 15181688 | 15180826 | | |
| 159 | +| 6900 | 0 | 0 | | |
| 160 | + | |
| 161 | +**11 of 24 key frames now decode pixel-exact** (was 10). `-ss 300` is exact; | |
| 162 | +`-ss 4800` fell 2348 → 34 bytes (its remaining 8x4 chroma patch is the residue | |
| 163 | +described in §3). Rows differing by a few hundred bytes inside the | |
| 164 | +multi-million-byte segments are the usual desync churn of lane-kf900's | |
| 165 | +territory, not a regression: none of them changed sign or magnitude class. | |
| 166 | + | |
| 167 | +## 6. Suite | |
| 168 | + | |
| 169 | +`cargo test -p ec-av1 --lib` under `systemd-run --user --unit=kf1200-suite-r2b | |
| 170 | +-p MemoryMax=10G`, `EC_AV1_REQUIRE_AOMENC=1 EC_NOMEMGUARD=1 -j3`, log | |
| 171 | +`$HOME/.cache/kf1200-suite-r2.log`: | |
| 172 | +**378 passed / 0 failed / 33 ignored**, 794.95 s. | |
| 173 | + | |
| 174 | +## EVIDENCE | |
| 175 | + | |
| 176 | +EVIDENCE: $HOME/.cache/kf1200-suite-r2.log | systemd unit kf1200-suite-r2b, EC_AV1_REQUIRE_AOMENC=1, cargo test -p ec-av1 --lib -j3 | test result: ok. 378 passed; 0 failed; 33 ignored; 794.95s | |
| 177 | +EVIDENCE: scratchpad/kf1200/{o300,r300} | 1-frame -ss 300 truncation (sha256 7e3ddf0d602f9496 twice), EC_PROBE_OUT16 vs ffmpeg -pix_fmt yuv420p10le | before fix Y 0 / U 219 / V 220 samples differ; after fix Y 0 / U 0 / V 0 | |
| 178 | +EVIDENCE: scratchpad/kf1200/{pre300.f0,apre300.f0} | EC_AV1_PREFILT_DUMP16 ours vs aomdec, same stream | 227 U + 227 V wrong PRE-loop-filter in a 16x16 chroma region at (384,412) => reconstruction | |
| 179 | +EVIDENCE: scratchpad/kf1200/{o300.trace,a300.trace} | EC_PRED=1 ours, EC_TRACE_MODE=1 EC_PRED=1 aomdec | aomdec EC_IMODE_VAL mi_row=207 mi_col=193 uv_mode=13 (UV_CFL_PRED) skip=1; ours OUR_PRED x=384 y=412 side=4 mode=0 sum=8240 flat (no CfL term) | |
| 180 | +EVIDENCE: gate run `cargo test -p ec-av1 --lib the_reelb_ss300 -- --nocapture` | pinned 1-frame fixture + ffmpeg 10-bit reference | "1 skipped sub-8x8 CfL chroma blocks, frame pixel-exact", 1 passed / 0 failed | |
| 181 | +EVIDENCE: scratchpad/kf1200/{pre600.f0,apre600.f0} | EC_AV1_PREFILT_DUMP16 ours vs aomdec on the -ss 600 1-frame stream | damage exactly luma rows 1600..1607, cols 192..3839 = the bottom partial (8-row) superblock row from superblock #3 on | |
| 182 | +EVIDENCE: scratchpad/kf1200/{o600.trace,a600p.trace} | EC_PRED both decoders | mi (400,44) and (400,46) match block for block; at mi (400,48) aomdec txw=16 txh=8 mode=2 bsize=5 vs ours bw=32 bh=16 mode=0 => partition divergence at the partial-SB root | |
| 183 | +EVIDENCE: $HOME/.cache/kf1200-census-r2.log | census.sh, 24 key frames, each stream hashed twice | 11/24 pixel-exact (was 10); -ss 300 463->0, -ss 4800 2348->34 |