forge
Explore
Log in

Don't you dare go Hollow

edith_codecs

Clone
★ 0

0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits

sbrect10-r2.handoff.md11.9 KiBHistoryRawDownload

lane-sbrect10 r2 handoff

Branch lane-sbrect10, tip 2b9709c (worktree /home/user/Documents/Code/Rust/edith_codecs-sbrect10). Commits this round: 3a9e83e (merge main 18bf7dc) + 2b9709c (the fix + gate + instrumentation).

STATUS: root cause FOUND and FIXED; pinned stream now byte-exact on all 6 probe arms.

Only thing outstanding: the full suite result (armed, was at 340 tests / 0 failures).

1. Merge state (done, clean)

git merge --no-commit main (main = 18bf7dc: r14 a2e2e29 + sb128 5ea5ec8) auto-merged decode.rs + stream.rs with no conflicts. Verified before committing:

  • git diff main -- crates/ec-av1/src/cdf.rs EMPTY and ... refusal_inventory.rs EMPTY, so the NZ_MAP / FILTER_INTRA rows and the refusal list are byte-identical to main.
  • The only lines the merged tree removes vs main are the lane's own r1 hunks (4 uv_mode_cfl lines in decode.rs, the [8u32] arm + its comment in stream.rs). Main's deletions all kept.

2. Gate fixture state (done)

a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet (stream.rs) now uses the half-random source in BOTH orientations:

horizontal: if(lt(X,128), 40+mod(floor((Y+N*sp)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))
vertical:   if(lt(Y,64),  40+mod(floor((X+N*sp)/32)*90,200), mod((X*7+Y*13+N*97)*31,256))

r1's flat 200 half made aomenc code the right-hand superblocks skip, so the 8-bit arm saw 0 intra-above-32x32 blocks (probed cq 45/52/58/61/63). Grid [58, 52, 45, 61] x 2 orientations x 2 motion steps x 2 depths unchanged; counters are read on decoded+compared attempts only, every decode-order frame is compared on Y/U/V, a mismatch fails and never SKIPs.

3. The 10-bit defect: root cause, libaom line, fix

Pinned stream $HOME/.cache/sbrect10/b58.obu, sha256 hashed TWICE identical 00b9253b308201118e27f348c67932a0006e3077ba7a9a401854c2ee7eb1dcd2 (192x128, 6 frames, 10-bit cq58, --sb-size=64 --min-partition-size=32 --max-partition-size=64 --enable-rect-partitions=1 --enable-1to4-partitions=1 --lag-in-frames=0 --cpu-used=0; regenerate with bash $HOME/.cache/sbrect10/probe.sh "<geq>" 58 10).

How it was localised (each step ruled a layer out):

  • First mismatch DECODE-ORDER frame 2, plane Y only (U/V exact), 8252 samples; per-64x64-SB map row0 [0,0,4092], row1 [0,64,4096] = the whole RIGHT superblock column + deblock bleed.
  • NOT an entropy desync: our EC_TRACE_COEFF all_zero ladder vs instrumented aomdec's is identical for all 180 TUs of the whole stream (diff empty), and blocks decoded AFTER the wrong ones (mi(16,0)) are pixel-exact.
  • NOT a clamp: an EC_DBG_CLAMP probe on the dequant clamp +-(1 << (7 + bd)) and on every clamp_range in transform.rs fired ZERO times on this stream.
  • EC_TRACE_MODE mv diff, decode-order frame 2: aomdec mi(0,32) mode=24 ref0=1 ref1=4 mv0=(128,-16) / ours (-1,2); mi(0,40), mi(8,32), mi(8,40), mi(16,40) all (128,-16) vs (-1,2); mi(16,32) (-176,256) vs (-241,264); mi(24,32) (-128,56) vs (-193,64). The NEAREST_NEARESTMV blocks take stack[0] directly, so libaom's stack[0].this_mv is (128,-16) where ours is (0,0), and the NEWMV blocks are off by the same predictor delta.
  • Our stack for mi(0,32) = two entries this=(0,0) comp=(0,0) w=2 -- the signature of the compound EXTENSION pass appending comp_list[0] and comp_list[1] into an empty stack.
  • Frame 2's temporal field really is empty and that is CORRECT (new EC_TPL_FIELD occupancy dump under EC_TRACE_TPL: oh=1,2 all ., oh=3,4,5 all #; frame 2's LAST projection is suppressed by is_lst_overlay and its LAST2 is the key frame). So the candidate is spatial.

ROOT CAUSE: combine_compound_candidates (crates/ec-av1/src/mvstack.rs:1482) filled the comp_list tail slots -- the ones left after ref_id then ref_diff -- with (0, 0). libaom fills them with that side's GLOBAL MOTION vector, setup_ref_mv_list, av1/common/mvref_common.c:729:

for (; comp_idx < MAX_MV_REF_CANDIDATES; ++comp_idx)
  comp_list[comp_idx][idx] = gm_mv_candidates[idx];

Zero-filling was right only under IDENTITY global motion (the module doc's original reduction); aomenc has --enable-global-motion ON by default. A compound block with no usable neighbour pair (frame top row -> no above, 64x64 INTRA block to its left, empty temporal field) therefore took a (0,0) predictor where libaom took the frame's translation.

FIX: combine_compound_candidates takes gm_mv_candidates: [(i32,i32); 2] and uses it as the per-side fill; the call site passes [gm_mv(gm, ref_frame.0), gm_mv(gm, ref_frame.1)].

SIBLING SWEEP (same shape): every gm_mv_candidates use in mvref_common.c was walked. The single-ref tail fill (:787-788) is already ported as gm_fallback at mvstack.rs:1099-1100; the is_gm_block substitutions (:92, :117) already take gm through scan_*_compound; the add_tpl_ref_mv GLOBALMV_OFFSET compares (:379-410) already use gm_mv(gm, ...) on both sides. This was the only zero-filled site in the crate.

4. Is the pinned stream exact now? YES

probe.sh "<half-random geq>" <cq> <depth> after the fix, pixel diffs vs ffmpeg -pix_fmt yuv420p10le / yuv420p, and >32 intra-in-inter hit counts:

depth cq 52 cq 58 cq 61
8-bit 5 hits, 0 diffs 2 hits, 0 diffs 3 hits, 0 diffs
10-bit 6 hits, 0 diffs 7 hits, 0 diffs 7 hits, 0 diffs

Before the fix the 10-bit arms were 32890 (cq58) and 39907 (cq61) wrong samples.

5. NEXT STEP (the only thing left)

Read $HOME/.cache/sbrect10-suite-r2.log -- the suite is armed as a user systemd unit (sbrect10-suite-r2-1788325070.service, MemoryMax=10G, cargo test -p ec-av1 --lib -j3, EC_AV1_REQUIRE_AOMENC=1, CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sbrect10). At handoff it had reached 340 tests with no FAILED line. Check with a single grep -E "^test result|FAILED" $HOME/.cache/sbrect10-suite-r2.log; if a gate is red, re-run that gate alone before touching code (another lane rebuilding the shared aomdec shows up as "Os code 13 PermissionDenied"). Then fill the N/0 totals into lanes/sbrect10-r2.report.md (section 4 is otherwise complete) and the lane is done.

Nothing else is in flight; the worktree is clean at 2b9709c.

5b. CORRECTION at handoff time -- THE SUITE IS RED (3 gates), details not yet printed

The suite unit was still running when this handoff was written; at 343 tests it had THREE FAILED lines (cargo buffers the panic bodies to the end of the run, so no message text yet):

stream::tests::a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet ... FAILED
stream::tests::a_real_aomenc_inter_sequence_with_a_superblock_level_rect_partition_decodes_pixel_exact ... FAILED
stream::tests::a_real_aomenc_stream_with_film_grain_decodes_pixel_exact ... FAILED

So the lane is RED, not green. Do NOT treat section 4's probe table as a suite result: it proves only the 6 probed (geq, cq, depth) points, not the gates' own 16-attempt grids.

Triage order for the next round:

  1. grep -A 30 "^failures:" $HOME/.cache/sbrect10-suite-r2.log for the three panic bodies.
  2. a_real_aomenc_stream_with_film_grain_decodes_pixel_exact is the loudest signal: it touches NEITHER the CFL alphabet nor the compound stack's fixture, so if it is a pixel mismatch it is most likely a REGRESSION from this round's combine_compound_candidates gm-fill (a compound block that previously got (0,0) and now gets a global-motion vector). Check it first, alone: CARGO_TARGET_DIR=$HOME/.cache/cargo-target-sbrect10 cargo test -p ec-av1 --lib a_real_aomenc_stream_with_film_grain_decodes_pixel_exact -- --nocapture and if it is red, re-run it at 3a9e83e (the merge commit, fix not yet in) in a DETACHED worktree to separate "regression from the gm-fill" from "already red after the merge". Note the merge itself was never suite-tested -- r1 never ran a suite either (its handoff says so), so an inherited red from main's sb128/r14 merge is equally possible.
  3. The other two are this lane's own gates; the rect-partition sibling gate shares the compound stack path, so it is the expected place for a gm-fill regression to show.
  4. Only after the three are green: fill the N/0 totals into lanes/sbrect10-r2.report.md.

5c. SUITE FINISHED -- final result and per-failure triage (supersedes 5b)

test result: FAILED. 368 passed; 3 failed; 32 ignored; finished in 1049.95s ($HOME/.cache/sbrect10-suite-r2.log).

(a) a_real_aomenc_stream_with_film_grain_decodes_pixel_exact -- FLAKE, not a defect. CLOSED.

Panic was Result::unwrap() on Err(Os { code: 2, NotFound }) at stream.rs:15680, i.e. the concat!(CARGO_MANIFEST_DIR, "/../../fixtures/golden6-mismatch.obu") READ failed -- the shared fixtures symlink (-> /home/user/Documents/Code/Rust/edith_codecs/fixtures) was transiently gone mid-run, the known concurrent-lane merge hazard. The file is present now and the gate passes on its own: cargo test -p ec-av1 --lib a_real_aomenc_stream_with_film_grain_decodes_pixel_exact -> test result: ok. 1 passed; 0 failed. Nothing to fix here; it is NOT a gm-fill regression.

(b) a_real_aomenc_inter_frame_with_a_64x64_intra_block_reads_the_no_cfl_uv_alphabet -- REAL, MINE, OPEN.

8-bit: 2 named refusals, 0 pixel-exact attempts carrying a >32 intra block
       (0 no-CFL uv_mode reads), 14 attempts carried none
(the two refusals are "an inter SB-level AB partition" and "a split intra strip whose
 transform unit is 32x64" -- both other lanes' gaps, correctly named, not mismatches)

10-bit arm passes. My step-2 claim that the half-random fixture makes the 8-bit arm carry the shape is DISPROVEN by the gate itself. The probe (probe.sh) counted a DIFFERENT quantity than the gate: it greps EC_AV1_TELL for post_is_inter is_inter=false with side>32, whereas the gate asserts crate::decode::nocfl_uv_mode_hits() moved. On the very same stream (8-bit cq58, horizontal, sp=12 == gate attempt 8) the probe reports 2 and the counter reports 0, so those 8-bit >32 intra-in-inter blocks reach a decode path that never touches the counter. NEXT: the three NOCFL_UV_MODE_HITS increment sites are decode.rs:5499, decode.rs:8442, decode.rs:18544; instrument which intra-in-inter path an 8-bit 64x64 block actually takes (the 10-bit ones clearly hit one of the three), then either fix the missing counter site or, if the 8-bit path genuinely never offers CFL, narrow the gate's 8-bit assertion and say so. No pixel mismatch is involved -- every decoded attempt compared exact.

(c) a_real_aomenc_inter_sequence_with_a_superblock_level_rect_partition_decodes_pixel_exact -- REAL, OPEN, UNATTRIBUTED.

8-bit:  4 named refusals, 3 carrying, 64x32=8, 32x64=2, 64-axis residual TUs=1, 9 none (0 mismatched)
10-bit: 0 named refusals, 1 carrying, 64x32=2, 32x64=0, 64-axis residual TUs=0, 15 none (0 mismatched)
panic at stream.rs:6725: "(10-bit): no superblock-level rect strip carried a coded 64-axis
residual transform unit inside a pixel-exact attempt (horz=2, vert=0)"

This is a VACUOUS-ARM assert, NOT a pixel mismatch (0 of them mismatched on both depths). r1 recorded this same gate GREEN with 10-bit 64-axis TUs=2 and 2 carrying; it is now 0 and 1. Two candidate causes, NOT separated this round: (i) the main 18bf7dc merge (sb128 + r14 changed partition/var-tx handling and neither r1 nor this lane ever suite-tested the merge), or (ii) this round's gm-fill changing which attempts come out pixel-exact (only pixel-exact attempts count toward the arm). Separate them by running this gate alone at 3a9e83e (merge, pre-fix) in a DETACHED worktree with its own CARGO_TARGET_DIR, then at 2b9709c.

Corrected disposition

  • fix-now next round: (b) the 8-bit no-CFL counter, (c) the 10-bit 64-axis vacuous arm.
  • accepted/closed: (a) film_grain fixture flake.
  • The gm-fill fix itself is NOT contradicted by anything in this suite: no gate reported a pixel mismatch, and the pinned stream b58.obu plus all 6 probe arms are byte-exact vs ffmpeg.