edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
lane-kf1200 r2 — a skipped sub-8x8 chroma block dropped its CfL alpha
1. Merge
git merge --no-commit main (main 85887c7, lane-mvtwin + lane-sb128b) — clean
auto-merge, no conflicts. crates/ec-av1/src/cdf.rs byte-identical to main's
(cmp <(git show main:.../cdf.rs) .../cdf.rs → identical). r1's pair-mi chroma
edge-filter fix and its counter survive at decode.rs:7747. Commit d85d7d2.
main contains neither lane-reelckf nor lane-kf900 (git log --oneline main | grep
→ empty for both), so no duplicate-implementation resolution was needed and the
multi-million-byte census rows are still lane-kf900's territory.
2. Defect found and fixed: -ss 300, 463 bytes → 0
Re-measured premise on this branch (1-frame truncation, hash stable twice):
U 219 / V 220 samples wrong, Y exact. EC_AV1_PREFILT_DUMP16 ours vs aomdec's:
227 U + 227 V wrong before the loop filter, in a 16x16 chroma region at
chroma (384,412) — reconstruction, not filters.
First bad sample chroma (412,384) = the 4x4 chroma block of the BLOCK_4X4
2x2 group at luma mi (206,192). aomdec EC_TRACE_MODE:
EC_IMODE_VAL mi_row=207 mi_col=193 mode=4 uv_mode=13 skip=1 — uv_mode = 13
is UV_CFL_PRED, skip_txfm = 1. Our OUR_PRED x=384 y=412 side=4 mode=0 sum=8240 row0=[515,515,515,515] is flat: DC with no CfL term at all
(aomdec's own prediction sums to 8241 with a bottom-left ramp).
Root cause: both sub-8x8 leaf decoders passed a literal None for the CfL
argument in their skip_txfm arm —
crates/ec-av1/src/decode.rs:10554/10555(the 4-leafBLOCK_4X4group)crates/ec-av1/src/decode.rs:10916/10917(the 2-leaf group)
libaom's av1_predict_intra_block_facade (av1/common/reconintra.c:1719) calls
cfl_predict_block whenever mbmi->uv_mode == UV_CFL_PRED; skip_txfm only
suppresses the residual, never the alpha. Both arms now compute
cfl_ac_q3(y, gpx, gpy, 8) and pass alpha.zip(ac), exactly like the
non-skip arm two lines below and like the rect skip arms already did.
Class sweep
Every chroma reconstruct / reconstruct_rect call site in decode.rs was
parsed and its cfl argument printed (script in the r2 scratchpad). The rect
skip arms (6015, 6519, 8078) already pass alpha.zip(ac); the only other
literal None is 20284/20296, which sits directly behind the refusal
"a non-DC chroma mode on an 8x8 inter-frame leaf" (decode.rs:20212), so
uv_mode == DC_PRED is guaranteed there. No other instance of the class.
Counter + gate
decode.rs:2207SKIP_CFL_HITS/pub fn skip_cfl_hits()— skipped sub-8x8 chroma blocks that carried a CfL alpha.crates/ec-av1/src/stream.rsthe_reelb_ss300_key_frame_skipped_cfl_decodes_pixel_exact— pinscrates/ec-av1/fixtures/reelb_ss300_key_frame.obu(139 201 B, sha2567e3ddf0d602f9496b2f7eb11f051fd4a045020e094d5bc02f83825e2c494ef12, one 3840x1608 yuv420p10le key frame), decodes it, HARD-assertsskip_cfl_hits > 0, then compares Y/U/V against ffmpeg's own 10-bit decode.git add -fwas used (barefixturesin .gitignore);git ls-filesconfirms it is tracked.
Why a fixture and not an aomenc recipe: lane-reelckf r1's ledger dead-end —
20 recipes (cq 40..63 × nine lavfi sources, min/max-partition sweeps, sb-size
64 and 128) never produced a skipped sub-8x8 CfL block (skip_cfl counter
0 in all). The shape fires exactly once in a whole 4K key frame, which is
why no synthetic source reaches it.
No refusal lifted → refusal_inventory.rs / gate_coverage.rs unchanged.
3. Remaining residuals — triaged, one class
-ss 600 / 2400 / 3300 / 5700 (48771 / 42343 / 39971 / 16375 bytes) are ONE
defect class, not four: in every one of them the damage is confined to the
last 8 luma rows of the frame.
| -ss | Y rows wrong | U/V rows | first bad Y sample |
|---|---|---|---|
| 600 | 1595..1607 | 796..803 | (1595, 2916) |
| 2400 | 1595..1607 | 796..803 | (1595, 2445) |
| 3300 | 1595..1607 | 796..803 | (1595, 1235) |
| 5700 | 1596..1607 | 796..803 | (1596, 3039) |
EC_AV1_PREFILT_DUMP16 on -ss 600 narrows it further: pre-loop-filter the
damage is exactly rows 1600..1607, columns 192..3839 (rows 1595..1599
in the final picture are deblock spill across the y=1600 edge). The frame is
1608 rows = 25 full 64-px superblock rows + one 8-row remainder, so this is the
bottom partial superblock row, and the first three superblocks of it
(columns 0..191) are pixel-exact.
Divergence localised to a single block. Through luma mi (400,47) our
prediction trace matches aomdec's block for block (mi 44: four TX_4X4 in an
8x8; mi 46: 8x8 — EC_PRED mi_row=400 mi_col=46 txw=8 txh=8). At the very
first block of superblock #3:
- aomdec:
EC_PRED mi_row=400 mi_col=48 txw=16 txh=8 mode=2 p_angle=180 bsize=5 part=1 ft=1 - ours:
OUR_PRED x=192 y=1600 bw=32 bh=16 mode=0 ad=0(decode.rs:6511)
i.e. we read a 32x16 PARTITION_HORZ where libaom reads a 16x8, and the mode
differs too — a partition-symbol divergence at the root of a partial-height
superblock (has_rows == false, only 2 of 16 mi rows present), not a
prediction bug and not caused by the preceding block. Everything after it in
that row is garbage because the row never re-syncs (it is the last row, so
nothing propagates downward).
-ss 4800 (2348 bytes in r1, 34 bytes after this round's CfL fix) is a
different, much smaller shape: chroma only,
U 29 + V 5 samples in the final picture. EC_AV1_PREFILT_DUMP16 puts it
pre-loop-filter too — U 25 + V 3 samples in an 8x4 chroma patch at
rows 540..543, cols 1200..1207 (|d| <= 6), luma exact. That is the same
geometry as r1's defect (an 8x4 chroma block = the chroma half of a 16x8
PARTITION_HORZ_4 pair) at luma mi ~(270,600), so it is a strong candidate
for a sibling of the pair-mi bug rather than a new class.
4. Disposition
- fix-now (done):
-ss 300skipped-CfL, fixed + gated + swept. - deferred: the bottom partial-superblock partition divergence (
-ss 600, 2400, 3300, 5700). Unblocked by: a range ladder over the partition symbols of superblock(mi_row=400, mi_col=48)ins600_f1.obucomparing aomdec'sr->ec.rngatEC_IMODEagainst ours — the first three superblocks of the same row are exact, so the ladder starts already in sync at mi 400/47. - deferred:
-ss 4800(34 B, down from 2348) — stage-attributed (pre-loop-filter, chroma-only, 8x4 patch at chroma (540,1200), luma mi ~(270,600)); the per-blockEC_IMODE_VAL/EC_PREDcomparison at that mi is the next step. - accepted:
-ss 900 / 1500 / 2100 / 2700 / 3900 / 6000 / 6300 / 6600(multi-million bytes) are lane-kf900's entropy desyncs, not merged into main.
5. 24 key-frame census (bytes differing vs ffmpeg, 1 truncated frame each)
Recipe: $HOME/.cache/kf1200-census-r2.log (script census.sh in the r2
scratchpad) — ffmpeg -ss S -t 0.4 -c:v copy -f obu, trunc.py … 1, each
stream sha256'd twice (identical in all 24 rows), EC_PROBE_OUT16 vs
ffmpeg -pix_fmt yuv420p10le.
| -ss | r1 (after pair-mi fix) | r2 (after skipped-CfL fix) |
|---|---|---|
| 0 | 0 | 0 |
| 300 | 463 | 0 |
| 600 | 48771 | 48771 |
| 900 | 14057191 | 14057191 |
| 1200 | 0 | 0 |
| 1500 | 16649650 | 16649650 |
| 1800 | 0 | 0 |
| 2100 | 15147782 | 15148697 |
| 2400 | 42343 | 42343 |
| 2700 | 7726287 | 7726168 |
| 3000 | 0 | 0 |
| 3300 | 39971 | 39971 |
| 3600 | 0 | 0 |
| 3900 | 7554023 | 7554023 |
| 4200 | 0 | 0 |
| 4500 | 0 | 0 |
| 4800 | 2348 | 34 |
| 5100 | 0 | 0 |
| 5400 | 0 | 0 |
| 5700 | 16375 | 16375 |
| 6000 | 15449720 | 15449720 |
| 6300 | 15410864 | 15410664 |
| 6600 | 15181688 | 15180826 |
| 6900 | 0 | 0 |
11 of 24 key frames now decode pixel-exact (was 10). -ss 300 is exact;
-ss 4800 fell 2348 → 34 bytes (its remaining 8x4 chroma patch is the residue
described in §3). Rows differing by a few hundred bytes inside the
multi-million-byte segments are the usual desync churn of lane-kf900's
territory, not a regression: none of them changed sign or magnitude class.
6. Suite
cargo test -p ec-av1 --lib under systemd-run --user --unit=kf1200-suite-r2b -p MemoryMax=10G, EC_AV1_REQUIRE_AOMENC=1 EC_NOMEMGUARD=1 -j3, log
$HOME/.cache/kf1200-suite-r2.log:
378 passed / 0 failed / 33 ignored, 794.95 s.
EVIDENCE
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
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
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
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)
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
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
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
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