forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-wii': wedge-interintra blend decodes (opus-verified vs libaom; gate fires wii_hits 2-7 per run, hard-asserted)

Browse files at this commit

f03f2a32b4d1b828874156706e0941d8a404471cAhmet Kaan GümüşParent: 51096e8098e9a7
crates/ec-av1/src/decode.rsmodified+76 -20
@@ -229,6 +229,17 @@ pub(crate) fn wedge_hits() -> usize {
229 WEDGE_HITS.load(std::sync::atomic::Ordering::Relaxed)229 WEDGE_HITS.load(std::sync::atomic::Ordering::Relaxed)
230 }230 }
231 231
232+/// How many blocks decoded a real wedge-INTERINTRA block
233+/// (`interintra == 1 && use_wedge_interintra == 1`) -- lane-wii r2's proof
234+/// a gate fixture exercised the wedge blend (fixed sign 0), not just the
235+/// smooth arm counted by `INTERINTRA_HITS`.
236+static WII_HITS: std::sync::atomic::AtomicUsize = std::sync::atomic::AtomicUsize::new(0);
237+
238+/// Current value of [`WII_HITS`].
239+pub(crate) fn wii_hits() -> usize {
240+ WII_HITS.load(std::sync::atomic::Ordering::Relaxed)
241+}
242+
232 /// Current value of [`OBMC_HITS_8`].243 /// Current value of [`OBMC_HITS_8`].
233 pub(crate) fn obmc_hits_8() -> usize {244 pub(crate) fn obmc_hits_8() -> usize {
234 OBMC_HITS_8.load(std::sync::atomic::Ordering::Relaxed)245 OBMC_HITS_8.load(std::sync::atomic::Ordering::Relaxed)
@@ -4640,7 +4651,17 @@ const II_WEIGHTS_1D: [u8; 128] = [
4640 /// in `pred`: `comp = (mask*intra + (64-mask)*inter + 32) >> 6`4651 /// in `pred`: `comp = (mask*intra + (64-mask)*inter + 32) >> 6`
4641 /// (`aom_blend_a64_mask`, intra as src0). `ii_size_scales[plane_bsize]`4652 /// (`aom_blend_a64_mask`, intra as src0). `ii_size_scales[plane_bsize]`
4642 /// reduces to `128 / side` for the square plane sizes this decoder reaches.4653 /// reduces to `128 / side` for the square plane sizes this decoder reaches.
4643-fn interintra_blend(plane: &PlaneBuf, x: usize, y: usize, side: usize, ii_mode: u8, pred: &mut [u8]) {4654+/// lane-wii r2: `wedge == Some(..)` replaces the mode mask with the wedge
4655+/// codebook mask (fixed sign 0; luma stride, 2x2 box-averaged for chroma).
4656+fn interintra_blend(
4657+ plane: &PlaneBuf,
4658+ x: usize,
4659+ y: usize,
4660+ side: usize,
4661+ ii_mode: u8,
4662+ wedge: Option<(&'static [u8], usize)>,
4663+ pred: &mut [u8],
4664+) {
4644 // `interintra_to_intra_mode`: II_DC/II_V/II_H/II_SMOOTH.4665 // `interintra_to_intra_mode`: II_DC/II_V/II_H/II_SMOOTH.
4645 let intra_mode = match ii_mode {4666 let intra_mode = match ii_mode {
4646 0 => crate::intra::DC_PRED,4667 0 => crate::intra::DC_PRED,
@@ -4675,11 +4696,28 @@ fn interintra_blend(plane: &PlaneBuf, x: usize, y: usize, side: usize, ii_mode:
4675 let scale = 128 / side;4696 let scale = 128 / side;
4676 for i in 0..side {4697 for i in 0..side {
4677 for j in 0..side {4698 for j in 0..side {
4678- let m = u32::from(match ii_mode {4699+ let m = u32::from(match wedge {
4679- 0 => 32,4700+ // lane-wii r2: wedge-interintra mask (aom_blend_a64_mask
4680- 1 => II_WEIGHTS_1D[i * scale],4701+ // over the wedge codebook, intra as src0, fixed sign 0).
4681- 2 => II_WEIGHTS_1D[j * scale],4702+ // Luma plane: mask rows are luma-resolution, ms == side.
4682- _ => II_WEIGHTS_1D[i.min(j) * scale],4703+ // 4:2:0 chroma: 2x2 box average (reconinter.c sub8x8 --
4704+ // subw == subh == 1).
4705+ Some((mask, ms)) if ms == side => mask[i * side + j],
4706+ Some((mask, ms)) => {
4707+ let t = 2 * i * ms + 2 * j;
4708+ ((u32::from(mask[t])
4709+ + u32::from(mask[t + 1])
4710+ + u32::from(mask[t + ms])
4711+ + u32::from(mask[t + ms + 1])
4712+ + 2)
4713+ >> 2) as u8
4714+ }
4715+ None => match ii_mode {
4716+ 0 => 32,
4717+ 1 => II_WEIGHTS_1D[i * scale],
4718+ 2 => II_WEIGHTS_1D[j * scale],
4719+ _ => II_WEIGHTS_1D[i.min(j) * scale],
4720+ },
4683 });4721 });
4684 let idx = i * side + j;4722 let idx = i * side + j;
4685 pred[idx] =4723 pred[idx] =
@@ -6077,6 +6115,7 @@ fn decode_inter_block(
6077 // `SINGLE_INTER_MODE_START..END` by construction).6115 // `SINGLE_INTER_MODE_START..END` by construction).
6078 // `size_group_lookup`: BLOCK_16X16 -> 2, BLOCK_32X32 -> 3.6116 // `size_group_lookup`: BLOCK_16X16 -> 2, BLOCK_32X32 -> 3.
6079 let mut interintra_mode: Option<u8> = None;6117 let mut interintra_mode: Option<u8> = None;
6118+ let mut wedge_mask: Option<(&'static [u8], usize)> = None;
6080 if enable_interintra_compound && !skip_mode && (side == 16 || side == 32) {6119 if enable_interintra_compound && !skip_mode && (side == 16 || side == 32) {
6081 let bsize_group = if side == 16 { 2 } else { 3 };6120 let bsize_group = if side == 16 { 2 } else { 3 };
6082 let interintra = dec.symbol(&mut cdfs.interintra[bsize_group]) == 1;6121 let interintra = dec.symbol(&mut cdfs.interintra[bsize_group]) == 1;
@@ -6089,12 +6128,21 @@ fn decode_inter_block(
6089 let wedge_bsize = if side == 16 { 6 } else { 9 };6128 let wedge_bsize = if side == 16 { 6 } else { 9 };
6090 let wedge = dec.symbol(&mut cdfs.wedge_interintra[wedge_bsize]) == 1;6129 let wedge = dec.symbol(&mut cdfs.wedge_interintra[wedge_bsize]) == 1;
6091 if wedge {6130 if wedge {
6092- return Err(unsupported(6131+ // lane-wii r2 (spec 5.11.25): `wedge_index` is an
6093- "a wedge-interintra block (use_wedge_interintra == 1, \6132+ // ADAPTING CDF symbol over the same `wedge_bsize` row;
6094- wedge-masked blending unimplemented)",6133+ // NO sign symbol follows -- libaom fixes
6134+ // INTERINTRA_WEDGE_SIGN 0 (blockd.h).
6135+ let wedge_index = dec.symbol(&mut cdfs.wedge_idx[wedge_bsize]);
6136+ WII_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
6137+ wedge_mask = Some((
6138+ crate::wedge::wedge_masks()
6139+ .codebook(side)
6140+ .mask(0, wedge_index as usize),
6141+ side,
6095 ));6142 ));
6143+ } else {
6144+ INTERINTRA_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
6096 }6145 }
6097- INTERINTRA_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
6098 interintra_mode = Some(ii);6146 interintra_mode = Some(ii);
6099 }6147 }
6100 }6148 }
@@ -6413,9 +6461,9 @@ fn decode_inter_block(
6413 // result, all planes (reconinter.c av1_build_interintra_predictor6461 // result, all planes (reconinter.c av1_build_interintra_predictor
6414 // plane loop).6462 // plane loop).
6415 if let Some(ii) = interintra_mode {6463 if let Some(ii) = interintra_mode {
6416- interintra_blend(y, px, py, side, ii, &mut pred_y);6464+ interintra_blend(y, px, py, side, ii, wedge_mask, &mut pred_y);
6417- interintra_blend(u, cpx, cpy, chroma_side, ii, &mut pred_u);6465+ interintra_blend(u, cpx, cpy, chroma_side, ii, wedge_mask, &mut pred_u);
6418- interintra_blend(v, cpx, cpy, chroma_side, ii, &mut pred_v);6466+ interintra_blend(v, cpx, cpy, chroma_side, ii, wedge_mask, &mut pred_v);
6419 }6467 }
6420 6468
6421 if skip {6469 if skip {
@@ -7318,6 +7366,7 @@ fn decode_inter_block8(
7318 // (compound already returned above), GLOBALMV already refused7366 // (compound already returned above), GLOBALMV already refused
7319 // (round 3), so the only real gate left is the header enable bit.7367 // (round 3), so the only real gate left is the header enable bit.
7320 let mut interintra_mode: Option<u8> = None;7368 let mut interintra_mode: Option<u8> = None;
7369+ let mut wedge_mask: Option<(&'static [u8], usize)> = None;
7321 if enable_interintra_compound && !skip_mode {7370 if enable_interintra_compound && !skip_mode {
7322 let interintra = dec.symbol(&mut cdfs.interintra[SIZE_GROUP_8]) == 1;7371 let interintra = dec.symbol(&mut cdfs.interintra[SIZE_GROUP_8]) == 1;
7323 if interintra {7372 if interintra {
@@ -7327,12 +7376,19 @@ fn decode_inter_block8(
7327 let ii = dec.symbol(&mut cdfs.interintra_mode[SIZE_GROUP_8]) as u8;7376 let ii = dec.symbol(&mut cdfs.interintra_mode[SIZE_GROUP_8]) as u8;
7328 let wedge = dec.symbol(&mut cdfs.wedge_interintra[3]) == 1;7377 let wedge = dec.symbol(&mut cdfs.wedge_interintra[3]) == 1;
7329 if wedge {7378 if wedge {
7330- return Err(unsupported(7379+ // lane-wii r2: same adapting `wedge_index` symbol as the
7331- "a wedge-interintra block (use_wedge_interintra == 1, \7380+ // 16/32 leaf, fixed sign 0 -- see that site's comment.
7332- wedge-masked blending unimplemented)",7381+ let wedge_index = dec.symbol(&mut cdfs.wedge_idx[3]);
7382+ WII_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
7383+ wedge_mask = Some((
7384+ crate::wedge::wedge_masks()
7385+ .codebook(SIDE)
7386+ .mask(0, wedge_index as usize),
7387+ SIDE,
7333 ));7388 ));
7389+ } else {
7390+ INTERINTRA_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
7334 }7391 }
7335- INTERINTRA_HITS.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
7336 interintra_mode = Some(ii);7392 interintra_mode = Some(ii);
7337 }7393 }
7338 }7394 }
@@ -7473,9 +7529,9 @@ fn decode_inter_block8(
7473 // Non-wedge interintra blend, mutually exclusive with OBMC (the7529 // Non-wedge interintra blend, mutually exclusive with OBMC (the
7474 // motion_mode symbol is not read for an interintra block).7530 // motion_mode symbol is not read for an interintra block).
7475 if let Some(ii) = interintra_mode {7531 if let Some(ii) = interintra_mode {
7476- interintra_blend(y, px, py, SIDE, ii, &mut pred_y);7532+ interintra_blend(y, px, py, SIDE, ii, wedge_mask, &mut pred_y);
7477- interintra_blend(u, cpx, cpy, CHROMA_SIDE, ii, &mut pred_u);7533+ interintra_blend(u, cpx, cpy, CHROMA_SIDE, ii, wedge_mask, &mut pred_u);
7478- interintra_blend(v, cpx, cpy, CHROMA_SIDE, ii, &mut pred_v);7534+ interintra_blend(v, cpx, cpy, CHROMA_SIDE, ii, wedge_mask, &mut pred_v);
7479 }7535 }
7480 7536
7481 if skip {7537 if skip {
crates/ec-av1/src/stream.rsmodified+183 -0
@@ -3641,6 +3641,189 @@ mod tests {
3641 crate::decode::interintra_hits()3641 crate::decode::interintra_hits()
3642 );3642 );
3643 }3643 }
3644+
3645+ /// lane-wii r2: `--enable-interintra-wedge=1` streams must DECODE
3646+ /// pixel-exact -- the wedge-interintra syntax (adapting `wedge_index`
3647+ /// CDF symbol, fixed sign 0) and the wedge mask blend are ported over
3648+ /// the checksum-verified codebook. `--enable-masked-comp=0` stays so
3649+ /// the encoder cannot route inter blocks through the still-unported
3650+ /// COMPOUND_WEDGE/DIFFWTD path. A refusal naming interintra/wedge
3651+ /// fails the gate; refusals for OTHER named capabilities still skip
3652+ /// that seed. Zero `wii_hits` on a run means the encoder never
3653+ /// selected wedge-interintra -- soft-skipped (warned), not failed:
3654+ /// that is encoder choice, not a decoder bug.
3655+ #[test]
3656+ fn a_real_aomenc_stream_with_interintra_wedge_decodes_pixel_exact() {
3657+ const NAME: &str = "a_real_aomenc_stream_with_interintra_wedge_decodes_pixel_exact";
3658+ let _gate_lock = lock_gate_counters();
3659+ if !have_ffmpeg() {
3660+ eprintln!("SKIP {NAME}: no ffmpeg");
3661+ return;
3662+ }
3663+ if !have_aomenc() {
3664+ eprintln!("SKIP {NAME}: no aomenc at {}", aomenc_path().display());
3665+ return;
3666+ }
3667+ let (width, height, frame_count) = (64usize, 64usize, 24usize);
3668+ let mut named_refusals = 0u32;
3669+ let mut matched = 0u32;
3670+ let n_attempts: u32 = std::env::var("EC_WEDGE_GATE_ATTEMPTS")
3671+ .ok()
3672+ .and_then(|s| s.parse().ok())
3673+ .unwrap_or(40);
3674+ for attempt in 0..n_attempts {
3675+ let seed = 42 + attempt;
3676+ let duration = frame_count as f64 / 25.0;
3677+ let source = if attempt % 2 == 0 {
3678+ format!("gradients=size={width}x{height}:seed={seed}:duration={duration}:rate=25")
3679+ } else {
3680+ // `end_pts` does NOT bound mandelbrot (it generated 300+
3681+ // frames and hung the gate for an hour); `-t` below is the
3682+ // real bound, matching every other mandelbrot gate recipe.
3683+ format!("mandelbrot=size={width}x{height}:rate=25")
3684+ };
3685+ let duration_arg = format!("{duration}");
3686+ let y4m = Command::new("ffmpeg")
3687+ .args([
3688+ "-v",
3689+ "error",
3690+ "-f",
3691+ "lavfi",
3692+ "-i",
3693+ &source,
3694+ "-pix_fmt",
3695+ "yuv420p",
3696+ "-t",
3697+ &duration_arg,
3698+ "-f",
3699+ "yuv4mpegpipe",
3700+ "-",
3701+ ])
3702+ .stdin(Stdio::null())
3703+ .stdout(Stdio::piped())
3704+ .stderr(Stdio::piped())
3705+ .output()
3706+ .expect("ffmpeg failed to run");
3707+ assert!(
3708+ y4m.status.success(),
3709+ "ffmpeg fixture: {}",
3710+ String::from_utf8_lossy(&y4m.stderr)
3711+ );
3712+ let args: Vec<&str> = vec![
3713+ "--codec=av1",
3714+ "--passes=1",
3715+ "--end-usage=q",
3716+ "--cq-level=45",
3717+ "--cpu-used=0",
3718+ "--kf-max-dist=1000",
3719+ "--threads=1",
3720+ "--row-mt=0",
3721+ "--auto-alt-ref=1",
3722+ "--lag-in-frames=16",
3723+ "--enable-fwd-kf=0",
3724+ "--enable-order-hint=1",
3725+ "--enable-warped-motion=1",
3726+ "--enable-obmc=1",
3727+ "--tune-content=default",
3728+ "--enable-masked-comp=0",
3729+ "--enable-interintra-comp=1",
3730+ "--enable-onesided-comp=0",
3731+ "--enable-interintra-wedge=1",
3732+ "--enable-smooth-interintra=1",
3733+ "--enable-rect-partitions=0",
3734+ "--enable-ab-partitions=0",
3735+ "--enable-1to4-partitions=0",
3736+ "--enable-filter-intra=0",
3737+ "--enable-smooth-intra=0",
3738+ "--enable-paeth-intra=0",
3739+ "--enable-directional-intra=0",
3740+ "--enable-angle-delta=0",
3741+ "--enable-tx-size-search=0",
3742+ "--enable-cdef=0",
3743+ "--enable-restoration=0",
3744+ "--max-partition-size=32",
3745+ "--min-partition-size=32",
3746+ "--enable-palette=0",
3747+ "--enable-intrabc=0",
3748+ "--enable-cfl-intra=0",
3749+ "--enable-ref-frame-mvs=0",
3750+ "--obu",
3751+ "-o",
3752+ "-",
3753+ "-",
3754+ ];
3755+ let mut child = Command::new(aomenc_path())
3756+ .args(&args)
3757+ .stdin(Stdio::piped())
3758+ .stdout(Stdio::piped())
3759+ .stderr(Stdio::piped())
3760+ .spawn()
3761+ .expect("aomenc failed to start");
3762+ child
3763+ .stdin
3764+ .take()
3765+ .expect("aomenc stdin")
3766+ .write_all(&y4m.stdout)
3767+ .expect("writing y4m to aomenc");
3768+ let out = child.wait_with_output().expect("aomenc failed to run");
3769+ assert!(
3770+ out.status.success(),
3771+ "aomenc refused the fixture: {}",
3772+ String::from_utf8_lossy(&out.stderr)
3773+ );
3774+ let stream = out.stdout;
3775+ let frames = match decode_stream(&stream) {
3776+ Err(e) => {
3777+ let msg = e.to_string();
3778+ assert!(
3779+ msg.contains("unsupported"),
3780+ "{NAME} failed outright, not a named refusal (seed {seed}): {msg}"
3781+ );
3782+ // Verifier note (lane-wii r2): no refusal string containing
3783+ // "wedge"/"interintra" exists in the decoder any more, so
3784+ // string-forbidding asserts here would be vacuous (class
3785+ // gate-blind-to-feature). The proof this gate carries is
3786+ // pixel-exact decode plus the wii_hits count printed below.
3787+ named_refusals += 1;
3788+ eprintln!("seed {seed} refusal (non-wedge capability): {msg}");
3789+ continue;
3790+ }
3791+ Ok(frames) => frames,
3792+ };
3793+ let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frame_count);
3794+ assert_eq!(frames.len(), frame_count);
3795+ let mismatched = frames
3796+ .iter()
3797+ .zip(&ffmpeg_frames)
3798+ .any(|(got, want)| got.y != want.y || got.u != want.u || got.v != want.v);
3799+ if mismatched && let Ok(path) = std::env::var("EC_AV1_GATE_DUMP") {
3800+ std::fs::write(&path, &stream).expect("writing pinned stream");
3801+ eprintln!("EC_AV1_GATE_DUMP: wrote mismatching stream (seed {seed}) to {path}");
3802+ }
3803+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
3804+ assert_eq!(got.y, want.y, "{NAME} frame {i} luma vs ffmpeg (seed {seed})");
3805+ assert_eq!(got.u, want.u, "{NAME} frame {i} U vs ffmpeg (seed {seed})");
3806+ assert_eq!(got.v, want.v, "{NAME} frame {i} V vs ffmpeg (seed {seed})");
3807+ }
3808+ matched += 1;
3809+ }
3810+ assert!(
3811+ matched > 0,
3812+ "{NAME}: every attempt refused on other capabilities; the gate never exercised wedge-interintra"
3813+ );
3814+ // Hardened from a soft-note (verifier: gate-blind-to-feature): the
3815+ // recipe fired wedge-interintra on EVERY one of 6 hammer runs
3816+ // (wii_hits 2-7), so a zero-hit run is a regression, not sampling.
3817+ assert!(
3818+ crate::decode::wii_hits() > 0,
3819+ "{NAME}: {matched} pixel-exact matches but zero wedge-interintra blocks fired -- \
3820+ the blend is unexercised (recipe fired 2-7 hits per run when landed)"
3821+ );
3822+ eprintln!(
3823+ "{NAME}: {named_refusals} other-capability refusals, {matched} pixel-exact matches out of {n_attempts}, wii_hits={}",
3824+ crate::decode::wii_hits()
3825+ );
3826+ }
3644 /// lane-rectgate r1: every prior gate pins `--enable-rect-partitions=03827 /// lane-rectgate r1: every prior gate pins `--enable-rect-partitions=0
3645 /// --enable-ab-partitions=0 --min/max-partition-size=32` so aomenc never3828 /// --enable-ab-partitions=0 --min/max-partition-size=32` so aomenc never
3646 /// gets to choose a real rect/ab split. This charter's premise ("rect3829 /// gets to choose a real rect/ab split. This charter's premise ("rect
lanes/wii-r1.charter.mdadded+56 -0
@@ -0,0 +1,56 @@
1+# lane-wii r1 charter — wedge-interintra blend
2+
3+## Where you are
4+Worktree /home/user/Documents/Code/Rust/edith_codecs-wii, branch lane-wii @ 6f4ca37.
5+Build/test ONLY: `env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-wii cargo test -p ec-av1 --release --lib <name> -- --nocapture`
6+FOREGROUND, `nice -n 19`, `CARGO_BUILD_JOBS=4`. Never push; never touch other worktrees; fixtures/ is a symlink.
7+BUDGET: ~60 calls. Commit compiling WIP + report by call 45. Read ONLY what is named.
8+
9+## Facts you build on (do not re-derive)
10+- Non-wedge interintra already decodes bit-exact (smooth-mask blend). The
11+ refusals to replace are decode.rs:6078 (16/32 path; `wedge` flag already
12+ consumed at 6075) and decode.rs:7316 (8x8 leaf path, wedge_interintra[3]).
13+- The COMPOUND_WEDGE codebook is on main: crates/ec-av1/src/wedge.rs
14+ (checksum-verified vs an independent C oracle, lanes/wedge_dump.c). It
15+ covers 8x8/16x16/32x32 — exactly the interintra wedge sizes here.
16+- libaom oracle /tmp/libaom-src:
17+ - av1/decoder/decodemv.c ~1546-1553: after use_wedge_interintra == 1, read
18+ `interintra_wedge_index` via wedge_idx_cdf[bsize] (16 symbols);
19+ interintra_wedge_sign is NOT read (fixed 0). CHECK our decode already has
20+ a wedge_idx CDF read on the compound path — reuse the same cdfs field the
21+ COMPOUND_WEDGE branch uses (verify the CDF is the SAME table in libaom —
22+ wedge_idx_cdf is shared — and that its counter-reset/save wiring already
23+ includes it; class cdf-counter-not-reset).
24+ - av1/common/reconinter.c combine_interintra + av1_build_interintra_pred:
25+ wedge interintra blends with av1_get_contiguous_soft_mask(wedge_index,
26+ 1, bsize) — note the SIGN=1 there vs stored sign 0; port exactly. Chroma:
27+ check build_interintra_predictors_sbp / how chroma gets the mask
28+ (subsampled luma mask via aom_blend_a64_mask subw/subh — same shape as
29+ the COMPOUND_WEDGE chroma path already landed; mirror it).
30+ - The blend combines the INTRA predictor over the INTER predictor with the
31+ wedge mask replacing the smooth interintra mask — everything else about
32+ the existing interintra path (mode, intra pred construction) is unchanged.
33+- Existing interintra pins: fixtures ii-flake-*.obu are in the 15-pin default
34+ list — your regression canary.
35+
36+## Scope
37+1. Replace both refusals: read interintra_wedge_index, thread it to the
38+ interintra blend, blend with the wedge mask (luma + chroma). Add a
39+ WII_HITS atomic (copy WEDGE_HITS pattern).
40+2. Gate: stream.rs has an interintra gate test (grep interintra in
41+ stream.rs tests). Add a wedge-interintra recipe variant: aomenc with
42+ --enable-interintra-wedge=1 (default on) + diagonal/structured content —
43+ the mandelbrot recipe that fired COMPOUND_WEDGE (grep the maskcomp gate)
44+ is the starting point; also try --enable-masked-comp=0 to push RD toward
45+ interintra wedge. Refusal string FORBIDDEN once fired; soft-skip zero-hit
46+ runs; hammer 6x with EC_AV1_GATE_DUMP self-pin
47+ (/tmp/claude-1000/wii-flake-N.obu). Mismatch = pin + report recon-diff
48+ location (EC_AV1_PREFILT_DUMP both sides), do NOT guess-fix.
49+3. 15-pin default list + full lib suite green.
50+
51+## Done criteria
52+1. Both refusals replaced; WII_HITS fired live at least once (count in
53+ report) or the recipe search documented as residue with the blend
54+ codebook-verified; pins green; lib green.
55+2. Committed to lane-wii (wip commit after EVERY green milestone); REPORT
56+ lanes/wii-r1.report.md, verdict FIRST line, evidence per claim.
lanes/wii-r1.report.mdadded+44 -0
@@ -0,0 +1,44 @@
1+# lane-wii report (r1 recon HANDOFF + r2 flash build; orchestrator-verified and finished)
2+
3+VERDICT: PASS — wedge-interintra decodes for real; gate fires it live every run (wii_hits 2-7, hard-asserted); 14 pins green; lib 221/0.
4+
5+## What landed
6+- 84a8fa7 (flash r2 build, orchestrator-committed at its cap): both refusals
7+ (16/32 path + 8x8 leaf) replaced. Symbol stream: after use_wedge_interintra
8+ == 1, ONE adapting symbol `wedge_idx[bsize]` (rows 6/9/3 = 16x16/32x32/8x8),
9+ NO sign bit — sign fixed 0 (libaom blockd.h INTERINTRA_WEDGE_SIGN). Blend:
10+ wedge codebook mask replaces the smooth interintra mask in interintra_blend
11+ ((m*intra + (64-m)*inter + 32)>>6, intra weighted); chroma box-averages the
12+ luma-stride mask 2x2 ((m00+m01+m10+m11+2)>>2), exactly blend_a64_mask's
13+ subw==subh==1 path. WII_HITS atomic.
14+- Gate a_real_aomenc_stream_with_interintra_wedge_decodes_pixel_exact:
15+ gradients/mandelbrot alternating content, --enable-interintra-wedge=1,
16+ masked-comp off.
17+
18+## Orchestrator fixes on top of the flash build
19+- Gate hang: builder's `mandelbrot=...end_pts=24` does NOT bound the source
20+ (300+ frames generated; 1h CPU, pipe deadlock, two hung orphan processes).
21+ Bound with `-t` like every landed mandelbrot recipe. Class instance:
22+ gate's own fixture generation unbounded (kin to gate-loader-slurps-whole-file).
23+- Verifier finding (opus, claim 5 REFUTED): the gate's forbidden-refusal
24+ strings were vacuous (no "wedge"/"interintra" refusal exists any more) and
25+ wii_hits was only a soft note. Vacuous asserts replaced with a comment;
26+ wii_hits==0 hardened to a HARD assert after 6/6 hammer runs each fired 2-7
27+ hits.
28+
29+## Verification
30+- Cross-provider: opus source-level verification vs libaom — claims 1-4, 6
31+ CONFIRMED (symbol order decodemv.c:1549-1554; sign 0 blockd.h:40 — the r1
32+ charter's SIGN=1 came from an ENCODER search heuristic, compound_type.c:691;
33+ blend blend.h:23-28 + blend_a64_mask.c:251-259; INTERINTRA_HITS move weakens
34+ no gate since the interintra gate pins wedge=0). Claim 5 (gate) refuted and
35+ fixed above.
36+- Orchestrator re-ran: hardened gate green (wii_hits=3), 6 prior hammer runs
37+ green (hits 6,7,2,6,5,3), 14-pin list green, lib 221/0 (gate excluded run)
38+ + gate separately.
39+
40+## Residue
41+- 25-29/40 gate attempts refuse on non-IDENTITY single-ref GLOBAL MOTION
42+ (mandelbrot pan) — a real, now well-measured capability gap; queue.
43+- r1 flash round burned its whole cap on recon (zero edits); r2 charter
44+ carried the handoff + two corrections (SIGN=1 error, literal(4) error).
lanes/wii-r2.charter.mdadded+61 -0
@@ -0,0 +1,61 @@
1+# lane-wii r2 charter — CONTINUATION (r1 was 100% recon, zero edits)
2+
3+Execute the r1 HANDOFF plan verbatim, with ONE CORRECTION, in worktree
4+/home/user/Documents/Code/Rust/edith_codecs-wii (lane-wii @ 6f4ca37).
5+Build/test ONLY: `env CARGO_TARGET_DIR=$HOME/.cache/cargo-target-wii cargo test -p ec-av1 --release --lib <name> -- --nocapture`
6+FOREGROUND, `nice -n 19`, `CARGO_BUILD_JOBS=4`. BUDGET ~55 calls; commit compiling
7+WIP + report by call 40. Do NOT redo recon the handoff already grounded.
8+
9+## CORRECTION (r1 handoff error — this would desync)
10+The wedge index is NOT `dec.literal(4)`. It is an ADAPTING CDF symbol, exactly
11+like the COMPOUND_WEDGE path at decode.rs:5418:
12+ `let wedge_index = dec.symbol(&mut cdfs.wedge_idx[wedge_bsize]);`
13+(8x8 leaf path uses `cdfs.wedge_idx[3]`, see decode.rs:6927.) NO sign symbol is
14+read for interintra; sign is fixed 0 (libaom blockd.h INTERINTRA_WEDGE_SIGN 0).
15+The `wedge_bsize` index for 16/32 already exists at the wedge_interintra read
16+site (decode.rs:6075: `let wedge_bsize = if side == 16 { 6 } else { 9 };`) —
17+verify wedge_idx uses the SAME bsize indexing as wedge_interintra there (both
18+are [BLOCK_SIZES_ALL]-indexed in libaom; our cdfs.wedge_idx is [;22] full-size,
19+our wedge_interintra was remapped — check how 5418 computes ITS wedge_bsize and
20+copy that).
21+
22+## r1 HANDOFF plan (verified findings, follow as written)
23+- Blend semantics (reconinter.c:1059-1076 combine_interintra): wedge branch =
24+ aom_blend_a64_mask(comppred, intrapred, interpred, mask,
25+ mask_stride=block_size_wide[bsize], bw, bh, subw, subh) — mask weights INTRA
26+ (src0), same polarity/rounding as the existing smooth arm
27+ `(m*intra + (64-m)*inter + 32)>>6` in interintra_blend (decode.rs:4660-4673).
28+ subw/subh: luma 0; 4:2:0 chroma 1 → chroma m = (m00+m10+m01+m11+2)>>2.
29+- Codebook API: crate::wedge::wedge_masks().codebook(side).mask(0, wedge_index)
30+ -> &'static [u8], row stride = cb.bw = luma side.
31+- Edit sites (tag #EE47; line numbers valid BEFORE first edit):
32+ (a) WII_HITS static+accessor after decode.rs:227 (copy MASKED_COMPOUND_HITS
33+ shape 205-215);
34+ (b) interintra_blend sig at 4628: insert `wedge: Option<(&'static [u8], usize)>`
35+ before `pred`; mask selection 4663-4668 →
36+ `match wedge { Some((mask, ms)) if ms == side => mask[i*side+j],
37+ Some((mask, ms)) => { let t = 2*i*ms + 2*j;
38+ ((u32::from(mask[t]) + u32::from(mask[t+1]) + u32::from(mask[t+ms])
39+ + u32::from(mask[t+ms+1]) + 2) >> 2) as u8 },
40+ None => match ii_mode { ...existing... } }`;
41+ (c) 16/32 path: `let mut wedge_mask: Option<(&'static [u8], usize)> = None;`
42+ after the interintra_mode decl at 6064; refusal 6076-6081 → read
43+ wedge_index per the CORRECTION, WII_HITS.fetch_add, set wedge_mask from
44+ the codebook; blend calls 6401-6403 pass wedge_mask to all three planes
45+ (chroma subsampling handled inside blend via ms != side);
46+ (d) 8x8 leaf path: re-read decode.rs:7290-7330 first (r1 never saw
47+ 7305-7319); same shape at the 7313-7319 refusal, wedge_idx[3], decl in
48+ that scope, blend calls 7461-7463.
49+- Gates in order: cargo check first; then scoped
50+ `cargo test -p ec-av1 --release --lib interintra -- --nocapture`; then the
51+ 15-pin default list (pinned_warp); then full lib. WIP COMMIT after every
52+ green milestone.
53+- Gate recipe: extend stream.rs a_real_aomenc_stream_with_interintra_decodes_
54+ pixel_exact (~3460) with a wedge variant copying the aomenc flag tail
55+ (~3595-3598) + --enable-interintra-wedge=1, fallback --enable-masked-comp=0,
56+ mandelbrot/gradient content; refusal string FORBIDDEN once fired; soft-skip
57+ zero-hit runs; hammer 6x with EC_AV1_GATE_DUMP self-pin
58+ (/tmp/claude-1000/wii-flake-N.obu). Mismatch = pin + report recon-diff
59+ location, do NOT guess-fix.
60+- Report lanes/wii-r1.report.md: verdict FIRST line, evidence per claim, note
61+ both charter corrections (r1's SIGN=1 error AND r1's literal(4) error).