forge
Explore
Log in

Don't you dare go Hollow

Lane-hbdinter r1 report

Browse files at this commit

4254638f65553ba37bb2bd6a8be400875757dc90Ahmet Kaan GümüşParent: 42752a0
  • docs
    • lane-hbdinter r1 report
Show full message
docs(av1): lane-hbdinter r1 report
lanes/hbdinter-r1.report.mdadded+124 -0
@@ -0,0 +1,124 @@
1+# lane-hbdinter round 1 report
2+
3+Branch `lane-hbdinter`, worktree `edith_codecs-hbdinter`, off main `3808cf8`.
4+Commit `d6b5912`.
5+
6+## Premise re-measured (charter said: 10-bit stream mismatches at frame 2)
7+
8+NOT reproduced as stated. Built the 10-bit counterpart of the 8-bit inter
9+gate (`a_real_aomenc_inter_sequence_with_deblocking_decodes_pixel_exact`'s
10+recipe + `--input-bit-depth=10 --bit-depth=10 --aq-mode=0 --deltaq-mode=0`):
11+
12+- 64x64, 4 frames, cq 55: **all 4 frames pixel-exact** (first run).
13+- 128x64, 16 frames (the charter's geometry), cq 55: **all 16 exact** once
14+ `--min-partition-size=16` keeps aomenc out of the pre-existing
15+ "an inter partition below 16x16" refusal (which is a different lane).
16+
17+So with that tool set 10-bit inter reconstruction was already exact. The
18+real defect only appears once **loop restoration** is enabled (cq-level=15,
19+`--enable-restoration=1`, the LR gate's own recipe), and it is NOT
20+inter-specific: the first mismatch is on **frame 0, the key frame**.
21+lane-hbd's 10-bit gate never saw it because its recipe leaves LR off.
22+
23+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
24+
25+## What changed (all four verified line-for-line against ~/.cache/aom-oracle/src)
26+
27+1. `crates/ec-av1/src/restoration.rs:~649` `compute_ab` -- box sums are now
28+ scaled back to the 8-bit range before `p` is formed
29+ (`a = Round2(A, 2*(bd-8))`, `b = Round2(B, bd-8)`, libaom
30+ `restoration.c:660-662`; `B[k]` keeps the RAW sum, as libaom does).
31+ **This is the site the gate attributes the mismatch to.**
32+2. `crates/ec-av1/src/restoration.rs:~545` `apply_wiener_stripe` -- the
33+ horizontal intermediate clamp was the fixed `[0, 8191]`
34+ (`WIENER_CLAMP_LIMIT(3, bd=8) - 1`, `convolve.h:43`) expressed in this
35+ crate's *unbiased* domain. Now `[-(1<<(bd+3)), (1<<(bd+5)) - 1 - (1<<(bd+3))]`,
36+ the libaom bound shifted by libaom's own `1 << (bd + 3)` bias (the
37+ `rounding` term of `highbd_convolve_add_src_horiz_hip`; the rest cancels
38+ against `WienerInfo`'s derived centre tap, as the existing doc comment
39+ derives). At 8-bit neither end is reachable -- that is why every 8-bit
40+ gate passed; at 10-bit the unbiased maximum is `128*1023 >> 3 == 16368`,
41+ so most Wiener intermediates were silently truncated at 8191.
42+3. `crates/ec-av1/src/mc.rs` `diffwtd_mask` -- round is
43+ `INTER_POST_ROUND + (bd - 8)` (libaom `reconinter.c:307`), was the
44+ constant 4.
45+4. `crates/ec-av1/src/warp.rs:450` `warp_affine` -- `const BD: i32 = 8`
46+ replaced by `decode::bit_depth()` in `offset_bits_horiz`,
47+ `offset_bits_vert` and the final `sum - (1<<(bd-1)) - (1<<bd)`
48+ (`av1_warp_affine_c`). Tip from lane-gmaffine, confirmed at the source.
49+
50+Ruled out, at the source, no change needed: non-compound and compound
51+sub-pel MC rounding. libaom only moves `round_0`/`round_1` when
52+`bd + FILTER_BITS - round_0 + 2 > 16` (`convolve.h:83`), i.e. 12-bit only;
53+10-bit keeps 3/11 (single) and 3/7 (compound). `aom_highbd_blend_a64_d16_mask_c`'s
54+`round_bits` is likewise bit-depth-independent, so `blend_masked_compound`
55+is correct as written.
56+
57+New counter: `mc::inter_pred_hits` (incremented in `predict_with_filters`,
58+`predict_scaled`, `predict_compound_intermediate`), re-exported as
59+`decode::inter_pred_hits`.
60+
61+## Gate
62+
63+`a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact` (crates/ec-av1/src/stream.rs).
64+Real aomenc, `yuv420p10le`, 128x64, 16 frames, `--lag-in-frames=0
65+--auto-alt-ref=0 --kf-max-dist=1000 --error-resilient=1 --aq-mode=0
66+--deltaq-mode=0 --enable-restoration=1 --enable-cdef=1 --cq-level=15`,
67+sequence header asserted `bit_depth == 10`, all 16 frames compared against
68+ffmpeg's own `yuv420p10le` decode, hard-asserting three firing counters
69+(inter predictions, deblock edges, a non-`RESTORE_NONE` LR filter). Decode
70+errors and mismatches panic; nothing turns into SKIP.
71+
72+```
73+EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-hbdinter \
74+ cargo test -p ec-av1 --lib -j3 a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact -- --nocapture
75+```
76+
77+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
78+
79+## Test totals
80+
81+`EC_AV1_REQUIRE_AOMENC=1 cargo test -p ec-av1 --lib -j3`:
82+**268 passed, 0 failed, 23 ignored, 0 filtered out, 664.37s.**
83+
84+EVIDENCE: scratchpad/hbdinter-suite.log | cargo test -p ec-av1 --lib -j3 | test result: ok. 268 passed; 0 failed; 23 ignored
85+
86+## Refusals
87+
88+None lifted this round -- these were silent wrong-pixel defects behind
89+already-permitted code paths, not refusals. `refusal_inventory.rs` and
90+`gate_coverage.rs` unchanged and green in the suite above.
91+
92+## Film check
93+
94+`cargo run -p ec-av1 --example decode_probe` on the 3s extracts already in
95+this worktree (`fixtures/hbd-r5/{reelb,reelc}.obu`):
96+
97+- ReelB: `REFUSED: unsupported: AV1 tile (a partition below 8x8 ...)`
98+- ReelC: `REFUSED: unsupported: AV1 tile (a 32x32 partition type this decoder does not code (value=4))`
99+
100+Unchanged from lane-hbd r5 -- both films still stop at partition-coverage
101+refusals that sit *before* any of the four fixed sites, so no frontier
102+movement is claimable from this lane. The fixes matter for what happens
103+after those two lanes land.
104+
105+## Residue
106+
107+- deferred: 10-bit gate for masked compound (`diffwtd_mask`) — needs a real
108+ aomenc `--enable-masked-comp=1` 10-bit stream that actually lands a
109+ DIFFWTD block; the 8-bit masked-compound gate exists, its 10-bit twin does
110+ not — unblocked by cloning that gate's recipe at `--bit-depth=10`.
111+- deferred: 10-bit gate for warp/global motion (`warp.rs` bd) — same shape;
112+ lane-gmaffine owns the warp gates, this fix should be re-verified there
113+ once its 10-bit stream exists.
114+- deferred: 10-bit gate proving the Wiener clamp bound specifically — the
115+ gate's stream fired Wiener once and the mismatch it catches is attributed
116+ to `compute_ab` (ablated separately); the clamp fix is source-verified
117+ against `convolve.h:43` but not attributed by a failing-then-passing
118+ pixel — unblocked by a fixture whose LR RD picks `RESTORE_WIENER` at
119+ 10-bit (higher-detail content than `gradients`).
120+- accepted: `combine_compound` folds libaom's `>> DIST_PRECISION_BITS`
121+ then `Round2(.., round_bits)` into one `Round2(.., 8)`. Bit-depth
122+ independent, so out of this lane's scope, but the two are not
123+ algebraically identical for odd intermediates -- flagged for whoever owns
124+ compound.