edith_codecs
Clone
0 watching0 forksRust370.3 MiB9b67700Tahinli3 days ago4021 commits
lane-hbdinter round 1 report
Branch lane-hbdinter, worktree edith_codecs-hbdinter, off main 3808cf8.
Commit d6b5912.
Premise re-measured (charter said: 10-bit stream mismatches at frame 2)
NOT reproduced as stated. Built the 10-bit counterpart of the 8-bit inter
gate (a_real_aomenc_inter_sequence_with_deblocking_decodes_pixel_exact's
recipe + --input-bit-depth=10 --bit-depth=10 --aq-mode=0 --deltaq-mode=0):
- 64x64, 4 frames, cq 55: all 4 frames pixel-exact (first run).
- 128x64, 16 frames (the charter's geometry), cq 55: all 16 exact once
--min-partition-size=16keeps aomenc out of the pre-existing "an inter partition below 16x16" refusal (which is a different lane).
So with that tool set 10-bit inter reconstruction was already exact. The
real defect only appears once loop restoration is enabled (cq-level=15,
--enable-restoration=1, the LR gate's own recipe), and it is NOT
inter-specific: the first mismatch is on frame 0, the key frame.
lane-hbd's 10-bit gate never saw it because its recipe leaves LR off.
EVIDENCE: /tmp/ec-av1-10bit-inter-gate-fail.obu | cargo test -p ec-av1 --lib a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact (compute_ab scaling reverted) | frame 0 V plane, sample 52: ours 289, ffmpeg 288
What changed (all four verified line-for-line against ~/.cache/aom-oracle/src)
crates/ec-av1/src/restoration.rs:~649compute_ab-- box sums are now scaled back to the 8-bit range beforepis formed (a = Round2(A, 2*(bd-8)),b = Round2(B, bd-8), libaomrestoration.c:660-662;B[k]keeps the RAW sum, as libaom does). This is the site the gate attributes the mismatch to.crates/ec-av1/src/restoration.rs:~545apply_wiener_stripe-- the horizontal intermediate clamp was the fixed[0, 8191](WIENER_CLAMP_LIMIT(3, bd=8) - 1,convolve.h:43) expressed in this crate's unbiased domain. Now[-(1<<(bd+3)), (1<<(bd+5)) - 1 - (1<<(bd+3))], the libaom bound shifted by libaom's own1 << (bd + 3)bias (theroundingterm ofhighbd_convolve_add_src_horiz_hip; the rest cancels againstWienerInfo's derived centre tap, as the existing doc comment derives). At 8-bit neither end is reachable -- that is why every 8-bit gate passed; at 10-bit the unbiased maximum is128*1023 >> 3 == 16368, so most Wiener intermediates were silently truncated at 8191.crates/ec-av1/src/mc.rsdiffwtd_mask-- round isINTER_POST_ROUND + (bd - 8)(libaomreconinter.c:307), was the constant 4.crates/ec-av1/src/warp.rs:450warp_affine--const BD: i32 = 8replaced bydecode::bit_depth()inoffset_bits_horiz,offset_bits_vertand the finalsum - (1<<(bd-1)) - (1<<bd)(av1_warp_affine_c). Tip from lane-gmaffine, confirmed at the source.
Ruled out, at the source, no change needed: non-compound and compound
sub-pel MC rounding. libaom only moves round_0/round_1 when
bd + FILTER_BITS - round_0 + 2 > 16 (convolve.h:83), i.e. 12-bit only;
10-bit keeps 3/11 (single) and 3/7 (compound). aom_highbd_blend_a64_d16_mask_c's
round_bits is likewise bit-depth-independent, so blend_masked_compound
is correct as written.
New counter: mc::inter_pred_hits (incremented in predict_with_filters,
predict_scaled, predict_compound_intermediate), re-exported as
decode::inter_pred_hits.
Gate
a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact (crates/ec-av1/src/stream.rs).
Real aomenc, yuv420p10le, 128x64, 16 frames, --lag-in-frames=0 --auto-alt-ref=0 --kf-max-dist=1000 --error-resilient=1 --aq-mode=0 --deltaq-mode=0 --enable-restoration=1 --enable-cdef=1 --cq-level=15,
sequence header asserted bit_depth == 10, all 16 frames compared against
ffmpeg's own yuv420p10le decode, hard-asserting three firing counters
(inter predictions, deblock edges, a non-RESTORE_NONE LR filter). Decode
errors and mismatches panic; nothing turns into SKIP.
EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-hbdinter \
cargo test -p ec-av1 --lib -j3 a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact -- --nocapture
EVIDENCE: /tmp/claude-.../scratchpad/hbdinter-suite.log | the command above, with the fix | "inter_pred 759 deblock 2592 cdef_idx 0 wiener 1 sgrproj 3", test result: ok. 1 passed
Test totals
EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -j3:
268 passed, 0 failed, 23 ignored, 0 filtered out, 664.37s.
EVIDENCE: scratchpad/hbdinter-suite.log | cargo test -p ec-av1 --lib -j3 | test result: ok. 268 passed; 0 failed; 23 ignored
Refusals
None lifted this round -- these were silent wrong-pixel defects behind
already-permitted code paths, not refusals. refusal_inventory.rs and
gate_coverage.rs unchanged and green in the suite above.
Film check
cargo run -p ec-av1 --example decode_probe on the 3s extracts already in
this worktree (fixtures/hbd-r5/{reelb,reelc}.obu):
- ReelB:
REFUSED: unsupported: AV1 tile (a partition below 8x8 ...) - ReelC:
REFUSED: unsupported: AV1 tile (a 32x32 partition type this decoder does not code (value=4))
Unchanged from lane-hbd r5 -- both films still stop at partition-coverage refusals that sit before any of the four fixed sites, so no frontier movement is claimable from this lane. The fixes matter for what happens after those two lanes land.
Residue
- deferred: 10-bit gate for masked compound (
diffwtd_mask) — needs a real aomenc--enable-masked-comp=110-bit stream that actually lands a DIFFWTD block; the 8-bit masked-compound gate exists, its 10-bit twin does not — unblocked by cloning that gate's recipe at--bit-depth=10. - deferred: 10-bit gate for warp/global motion (
warp.rsbd) — same shape; lane-gmaffine owns the warp gates, this fix should be re-verified there once its 10-bit stream exists. - deferred: 10-bit gate proving the Wiener clamp bound specifically — the
gate's stream fired Wiener once and the mismatch it catches is attributed
to
compute_ab(ablated separately); the clamp fix is source-verified againstconvolve.h:43but not attributed by a failing-then-passing pixel — unblocked by a fixture whose LR RD picksRESTORE_WIENERat 10-bit (higher-detail content thangradients). - FIXED after the first commit (
mc.rscombine_compound, commit below): it folded libaom's truncating>> DIST_PRECISION_BITSand the followingRound2(.., INTER_POST_ROUND)into oneRound2(.., 8). Those are not the same function -- the folded form rounds one LSB up whenever(sum >> 4) + 8sits one below a multiple of 16 with non-zero dropped low bits. Bit-depth independent (the CONV_BUFround_offsetcancels exactly in this crate's unbiased domain, derived fromav1_highbd_dist_wtd_convolve_2d_c), so it is a rare off-by-one at ANY depth. Flagged by lane-cwarp's measurement that 10-bit compound still mismatches frame 1 luma while single-ref is 6/6 exact -- this is my best candidate for that, but I did not have lane-cwarp's fixture, so it is UNVERIFIED against their mismatch. All 16 compound tests (incl. the two real-aomenc 8-bit compound/masked-compound gates) stay green with it:cargo test -p ec-av1 --lib -j3 compound-> 16 passed, 0 failed, 73.58s.
Overlap with lane-cwarp
lane-cwarp commit 04fc3ce (worktree edith_codecs-cwarp) carries the same
two fixes I derived independently here: mc.rs diffwtd_mask's missing
(bd - 8) and warp.rs's const BD = 8. Semantically identical, textually
different (my hunks carry different comments) -- expect a conflict in
mc.rs and warp.rs when both branches merge; either side's hunk is
correct, keep one. The LR (compute_ab, Wiener clamp) and
combine_compound fixes are unique to this branch.