diff --git a/crates/ec-av1/src/decode.rs b/crates/ec-av1/src/decode.rs index 044d1d7e..f909c1c7 100644 --- a/crates/ec-av1/src/decode.rs +++ b/crates/ec-av1/src/decode.rs @@ -1329,6 +1329,12 @@ pub(crate) fn tmv_hits() -> usize { crate::mvstack::tmv_hits() } +/// Current value of [`crate::mc::inter_pred_hits`] -- inter predictions +/// produced on this thread, the 10-bit inter gate's firing proof. +pub(crate) fn inter_pred_hits() -> usize { + crate::mc::inter_pred_hits() +} + /// Everything [`decode_inter_block`] needs to fold temporal MV candidates /// (spec 7.10.2.8), threaded down from [`decode_inter_frame_tile_with_cdfs`]: /// the current frame's own projected field ([`crate::motion_field::setup_motion_field`]'s diff --git a/crates/ec-av1/src/gate_coverage.rs b/crates/ec-av1/src/gate_coverage.rs index 727088f6..8be2fafd 100644 --- a/crates/ec-av1/src/gate_coverage.rs +++ b/crates/ec-av1/src/gate_coverage.rs @@ -150,6 +150,13 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // carries is a hole here too; the seven extra ones below are tools an // 8-bit gate DOES enable, whose high-bit-depth path no stream has ever // touched -- exactly the shape that hid the two lane-hbdinter defects. + // `enable-restoration` LEFT this list on 2026-09-01: lane-hbdinter's + // 10-bit inter gate passes `--enable-restoration=1` and asserts a real + // Wiener/SGR unit fired, which is what caught the two defects (SGR box + // sums never brought back to the 8-bit scale, Wiener clamp at the wrong + // bound). `enable-dist-wtd-comp` and `enable-global-motion` left it the + // same day for the same reason: lane-cwarp's 10-bit compound global-warp + // gate passes `=1` for both. ( "enable-1to4-partitions", "hole at both depths, see the 8-bit list", @@ -166,10 +173,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ "enable-cfl-intra", "hole at both depths, see the 8-bit list", ), - ( - "enable-dist-wtd-comp", - "hole at both depths, see the 8-bit list", - ), ( "enable-dual-filter", "hole at both depths, see the 8-bit list", @@ -182,10 +185,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ "enable-flip-idtx", "hole at both depths, see the 8-bit list", ), - ( - "enable-global-motion", - "hole at both depths, see the 8-bit list", - ), ( "enable-intra-edge-filter", "8-bit only: the 10-bit intra path never runs the edge filter", @@ -204,10 +203,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ "enable-ref-frame-mvs", "hole at both depths, see the 8-bit list", ), - ( - "enable-restoration", - "8-bit only -- THE instance this split was built for: every 10-bit gate passed `--enable-restoration=0`, so the SGR box sums and the Wiener clamp were never run at 10 bits and both were wrong (lane-hbdinter, 2026-09-01)", - ), ( "enable-smooth-intra", "8-bit only: no 10-bit gate enables smooth intra", diff --git a/crates/ec-av1/src/mc.rs b/crates/ec-av1/src/mc.rs index 180e0bff..ca954106 100644 --- a/crates/ec-av1/src/mc.rs +++ b/crates/ec-av1/src/mc.rs @@ -333,6 +333,7 @@ pub fn predict_with_filters( ) { assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); assert!(!reference.is_empty(), "a reference plane has samples"); + INTER_PRED_HITS.with(|c| c.set(c.get() + 1)); #[cfg(test)] let stage_t = std::time::Instant::now(); @@ -441,6 +442,20 @@ pub fn predict_scaled_hits() -> usize { PREDICT_SCALED_HITS.with(|c| c.get()) } +thread_local! { + /// lane-hbdinter: how many inter predictions this thread has produced + /// (single-reference, scaled, and the compound intermediate entry). The + /// 10-bit inter gate hard-asserts this moved, so a stream that coded + /// only intra blocks cannot pass it by construction (class + /// `gate-blind-to-feature`). + static INTER_PRED_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// Current value of [`INTER_PRED_HITS`]. +pub fn inter_pred_hits() -> usize { + INTER_PRED_HITS.with(|c| c.get()) +} + fn round_pow2_64(value: i64, shift: u32) -> i64 { if shift == 0 { value @@ -492,6 +507,7 @@ pub fn predict_scaled( ) { assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); assert!(!reference.is_empty(), "a reference plane has samples"); + INTER_PRED_HITS.with(|c| c.set(c.get() + 1)); PREDICT_SCALED_HITS.with(|c| c.set(c.get() + 1)); let y0 = y_q4.div_euclid(16); @@ -594,6 +610,7 @@ pub fn predict_compound_intermediate( ) { assert_eq!(dst.len(), block_w * block_h, "the destination is the block"); assert!(!reference.is_empty(), "a reference plane has samples"); + INTER_PRED_HITS.with(|c| c.set(c.get() + 1)); let x0 = x_q4.div_euclid(16); let xfrac = x_q4.rem_euclid(16) as usize; @@ -655,8 +672,16 @@ pub fn combine_compound( assert_eq!(pred0.len(), pred1.len(), "both refs predict the same block"); assert_eq!(dst.len(), pred0.len(), "the destination is the block"); for i in 0..dst.len() { + // libaom (`av1_highbd_dist_wtd_convolve_2d_c`, and its lowbd twin) + // applies the two shifts SEPARATELY: a truncating `>> + // DIST_PRECISION_BITS` on the weighted sum, then `ROUND_POWER_OF_TWO` + // by `round_bits == INTER_POST_ROUND`. Folding them into one + // `Round2(sum, 8)` is NOT the same function -- it rounds up one LSB + // whenever `(sum >> 4) + 8` is one below a multiple of 16 and the + // dropped low 4 bits are non-zero. let sum = pred0[i] * fwd_weight + pred1[i] * bck_weight; - dst[i] = round2(sum, INTER_POST_ROUND + DIST_PRECISION_BITS).clamp(0, crate::decode::sample_max()) as u16; + dst[i] = round2(sum >> DIST_PRECISION_BITS, INTER_POST_ROUND) + .clamp(0, crate::decode::sample_max()) as u16; } } @@ -673,15 +698,13 @@ pub fn combine_compound( pub fn diffwtd_mask(pred0: &[i32], pred1: &[i32], inv: bool, mask: &mut [u8]) { assert_eq!(pred0.len(), pred1.len(), "both refs predict the same block"); assert_eq!(mask.len(), pred0.len(), "one mask byte per pixel"); + // libaom `diffwtd_mask_d16` (`reconinter.c:307`): `round = 2*FILTER_BITS + // - round_0 - round_1 + (bd - 8)`, i.e. INTER_POST_ROUND plus the + // bit-depth headroom the CONV_BUF domain carries at 10/12-bit. `round_0` + // and `round_1` themselves only move at 12-bit (`convolve.h:83`'s + // `intbufrange > 16`), so the whole bit-depth dependence here is `bd - 8`. + let round = INTER_POST_ROUND + u32::from(crate::decode::bit_depth()).saturating_sub(8); for i in 0..mask.len() { - // lane-cwarp r1: libaom's `round` is `2*FILTER_BITS - round_0 - - // round_1 + (bd - 8)` (`diffwtd_mask_d16`, reconinter.c:306) -- the - // `(bd - 8)` term (which this function's own doc comment already - // named) was missing, so every 10-bit DIFFWTD mask was computed 4x - // too coarse. Caught by lane-cwarp's 10-bit gate arm: a 10-bit - // compound stream with global motion AND warp disabled still - // mismatched at frame 1. - let round = INTER_POST_ROUND + u32::from(crate::decode::bit_depth() - 8); let diff = round2((pred0[i] - pred1[i]).abs(), round); let m = (38 + diff / 16).clamp(0, 64); mask[i] = if inv { (64 - m) as u8 } else { m as u8 }; diff --git a/crates/ec-av1/src/restoration.rs b/crates/ec-av1/src/restoration.rs index ac35db2a..65a50043 100644 --- a/crates/ec-av1/src/restoration.rs +++ b/crates/ec-av1/src/restoration.rs @@ -529,6 +529,9 @@ fn apply_wiener_stripe( if w == 0 || h == 0 { return; } + let bd = i64::from(crate::decode::bit_depth()); + let wiener_bias = 1i64 << (bd + 3); + let wiener_limit = 1i64 << (bd + 5); let rows = h + 6; let mut inter = vec![0i32; rows * w]; for r in 0..rows { @@ -541,8 +544,20 @@ fn apply_wiener_stripe( sum += tap as i64 * lr_sample(cdef, deblocked, stride, plane_w, plane_h, v_start, v_end, row, x) as i64; } - // `WIENER_CLAMP_LIMIT(round0=3, bd=8) - 1`. - inter[r * w + c] = round2(sum, 3).clamp(0, 8191) as i32; + // libaom's `highbd_convolve_add_src_horiz_hip` clamps its + // *biased* intermediate to `[0, WIENER_CLAMP_LIMIT(3, bd) - 1]` + // (`convolve.h:43`, `(1 << (bd + 1 + FILTER_BITS - round0))`). + // Its bias over this crate's unbiased sum is exactly + // `(1 << (bd + FILTER_BITS - 1)) >> round0 == 1 << (bd + 3)` + // (the `rounding` term of that function, the rest cancelling + // against `WienerInfo`'s derived centre tap as the doc comment + // above derives), so the same clamp in *this* domain is the + // bound shifted down by that bias. At 8-bit neither end is ever + // reached by real content, which is why the old fixed `[0, 8191]` + // survived every 8-bit gate; at 10-bit the upper end is + // `128 * 1023 >> 3 == 16368`, well past `8191`, so a fixed + // 8-bit limit silently truncated most 10-bit Wiener pixels. + inter[r * w + c] = round2(sum, 3).clamp(-wiener_bias, wiener_limit - 1 - wiener_bias) as i32; } } for r in 0..h { @@ -646,7 +661,15 @@ fn compute_ab( b += px; } } - let p = if a * n < b * b { 0 } else { a * n - b * b }; + // libaom `restoration.c:660` -- the box sums are brought back + // to the 8-bit scale before `p` is formed (`a` is a sum of + // squares, so it loses twice the shift `b` does); `B[k]` below + // keeps the RAW `b`, only `p` uses the scaled pair. At 8-bit + // both shifts are 0, which is why this was invisible until now. + let bd_shift = u32::from(crate::decode::bit_depth()).saturating_sub(8); + let a_s = round2(a, 2 * bd_shift); + let b_s = round2(b, bd_shift); + let p = if a_s * n < b_s * b_s { 0 } else { a_s * n - b_s * b_s }; let z = round2(p * s as i64, SGRPROJ_MTABLE_BITS).clamp(0, 255) as usize; let a_val = SGR_X_BY_XPLUS1[z]; let b_val = round2( diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index a40ef2cb..1023c7f2 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -1982,6 +1982,189 @@ mod tests { assert_eq!(frames[0].v, ffmpeg_frames[0].v, "V vs ffmpeg (10-bit)"); } + /// The 10-bit *inter* counterpart of the gate above: a real `aomenc` + /// `yuv420p10le` sequence whose non-key frames are plain forward + /// single-`LAST_FRAME` P frames (same `--lag-in-frames=0 + /// --auto-alt-ref=0 --error-resilient=1` shape as the 8-bit inter gate), + /// decoded pixel-exact on every frame. 10-bit intra was proven exact by + /// lane-hbd; inter reconstruction at `bit_depth == 10` was never gated. + #[test] + fn a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact() { + const NAME: &str = "a_real_aomenc_10bit_inter_sequence_decodes_pixel_exact"; + let _gate_lock = lock_gate_counters(); + if !have_ffmpeg() { + eprintln!("SKIP {NAME}: no ffmpeg"); + return; + } + if !have_aomenc() { + eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display()); + return; + } + let (width, height, frame_count) = (128usize, 64usize, 16usize); + let y4m = Command::new("ffmpeg") + .args([ + "-v", + "error", + "-f", + "lavfi", + "-i", + &gradients_source(42, width, height, "duration=0.64:rate=25"), + "-pix_fmt", + "yuv420p10le", + "-strict", + "-1", + "-t", + "0.64", + "-f", + "yuv4mpegpipe", + "-", + ]) + .stdin(Stdio::null()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .output() + .expect("ffmpeg failed to run"); + assert!( + y4m.status.success(), + "ffmpeg failed to render the 10-bit fixture: {}", + String::from_utf8_lossy(&y4m.stderr) + ); + let mut child = Command::new(aomenc_path()) + .args([ + "--codec=av1", + "--passes=1", + "--end-usage=q", + "--cq-level=15", + "--cpu-used=0", + "--threads=1", + "--row-mt=0", + "--sb-size=64", + "--input-bit-depth=10", + "--bit-depth=10", + "--lag-in-frames=0", + "--auto-alt-ref=0", + "--kf-max-dist=1000", + "--error-resilient=1", + "--aq-mode=0", + "--deltaq-mode=0", + "--enable-rect-partitions=0", + "--enable-ab-partitions=0", + "--enable-1to4-partitions=0", + "--enable-filter-intra=0", + "--enable-smooth-intra=0", + "--enable-paeth-intra=0", + "--enable-directional-intra=0", + "--enable-angle-delta=0", + "--enable-tx-size-search=0", + "--enable-cdef=1", + "--enable-restoration=1", + "--min-partition-size=16", + "--max-partition-size=32", + "--enable-palette=0", + "--enable-intrabc=0", + "--enable-cfl-intra=0", + "--enable-ref-frame-mvs=0", + "--obu", + "-o", + "-", + "-", + ]) + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn() + .expect("aomenc failed to start"); + child + .stdin + .take() + .expect("aomenc stdin") + .write_all(&y4m.stdout) + .expect("writing y4m to aomenc"); + let out = child.wait_with_output().expect("aomenc failed to run"); + assert!( + out.status.success(), + "aomenc refused the 10-bit fixture: {}", + String::from_utf8_lossy(&out.stderr) + ); + let stream = out.stdout; + if let Ok(dump) = std::env::var("EC_AV1_GATE_DUMP") { + std::fs::write(dump, &stream).expect("dump stream"); + } + let mut probe = Av1Parser::new(); + let mut pos = 0usize; + while pos < stream.len() && probe.sequence_header().is_none() { + let obu = probe.parse_obu(&stream[pos..]).unwrap(); + pos += obu.total_size; + } + assert_eq!( + probe + .sequence_header() + .expect("stream has a sequence header OBU") + .color_config + .bit_depth, + 10, + "{NAME}: aomenc did not actually write a 10-bit sequence header" + ); + let before_deblock = decode::deblock_hits(); + let before_inter = decode::inter_pred_hits(); + let before_lr = crate::restoration::wiener_hits() + + crate::restoration::sgrproj_hits() + + crate::restoration::switchable_hits(); + let frames = match decode_stream(&stream) { + Ok(frames) => frames, + Err(e) => panic!("{NAME}: decode_stream refused a real 10-bit inter stream: {e}"), + }; + assert!( + decode::inter_pred_hits() > before_inter, + "{NAME}: no inter-predicted block decoded -- the gate proves nothing" + ); + assert!( + decode::deblock_hits() > before_deblock, + "{NAME}: no deblocking edge fired -- raise cq-level" + ); + // Loop restoration is where the 10-bit inter/intra defect lived + // (lane-hbdinter r1: the self-guided box sums were never brought back + // to the 8-bit scale, `restoration.c:660`); a recipe whose RD happened + // to pick RESTORE_NONE would pass while proving nothing. + assert!( + crate::restoration::wiener_hits() + + crate::restoration::sgrproj_hits() + + crate::restoration::switchable_hits() + > before_lr, + "{NAME}: no loop-restoration unit decoded a real filter -- lower cq-level" + ); + eprintln!( + "{NAME}: inter_pred {} deblock {} cdef_idx {} wiener {} sgrproj {}", + decode::inter_pred_hits() - before_inter, + decode::deblock_hits() - before_deblock, + decode::cdef_idx_hits(), + crate::restoration::wiener_hits(), + crate::restoration::sgrproj_hits(), + ); + assert_eq!(frames.len(), frame_count); + let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count); + for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() { + if got.y != want.y || got.u != want.u || got.v != want.v { + let pin = std::env::temp_dir().join("ec-av1-10bit-inter-gate-fail.obu"); + let _ = std::fs::write(&pin, &stream); + let first = |a: &Vec, b: &Vec| { + a.iter() + .zip(b) + .enumerate() + .find(|(_, (x, y))| x != y) + .map(|(k, (x, y))| (k, *x, *y)) + }; + panic!( + "{NAME}: frame {i} mismatch vs ffmpeg -- Y {:?} U {:?} V {:?}; stream pinned at {}", + first(&got.y, &want.y), + first(&got.u, &want.u), + first(&got.v, &want.v), + pin.display() + ); + } + } + } + /// lane-hbd10 r1: a real `aomenc --bit-depth=10 --film-grain-test=1` /// stream, decoded pixel-exact against ffmpeg's own 10-bit decode of the /// identical bytes (ffmpeg synthesizes grain by default -- no diff --git a/lanes/hbdinter-r1.report.md b/lanes/hbdinter-r1.report.md new file mode 100644 index 00000000..b1288d8b --- /dev/null +++ b/lanes/hbdinter-r1.report.md @@ -0,0 +1,143 @@ +# 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=16` keeps 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) + +1. `crates/ec-av1/src/restoration.rs:~649` `compute_ab` -- box sums are now + scaled back to the 8-bit range before `p` is formed + (`a = Round2(A, 2*(bd-8))`, `b = Round2(B, bd-8)`, libaom + `restoration.c:660-662`; `B[k]` keeps the RAW sum, as libaom does). + **This is the site the gate attributes the mismatch to.** +2. `crates/ec-av1/src/restoration.rs:~545` `apply_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 own `1 << (bd + 3)` bias (the + `rounding` term of `highbd_convolve_add_src_horiz_hip`; the rest cancels + against `WienerInfo`'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 is `128*1023 >> 3 == 16368`, + so most Wiener intermediates were silently truncated at 8191. +3. `crates/ec-av1/src/mc.rs` `diffwtd_mask` -- round is + `INTER_POST_ROUND + (bd - 8)` (libaom `reconinter.c:307`), was the + constant 4. +4. `crates/ec-av1/src/warp.rs:450` `warp_affine` -- `const BD: i32 = 8` + replaced by `decode::bit_depth()` in `offset_bits_horiz`, + `offset_bits_vert` and the final `sum - (1<<(bd-1)) - (1< 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=1` 10-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.rs` bd) — 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 + against `convolve.h:43` but not attributed by a failing-then-passing + pixel — unblocked by a fixture whose LR RD picks `RESTORE_WIENER` at + 10-bit (higher-detail content than `gradients`). +- FIXED after the first commit (`mc.rs` `combine_compound`, commit below): + it folded libaom's truncating `>> DIST_PRECISION_BITS` and the following + `Round2(.., INTER_POST_ROUND)` into one `Round2(.., 8)`. Those are not the + same function -- the folded form rounds one LSB up whenever + `(sum >> 4) + 8` sits one below a multiple of 16 with non-zero dropped + low bits. Bit-depth independent (the CONV_BUF `round_offset` cancels + exactly in this crate's unbiased domain, derived from + `av1_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.