Merge branch 'lane-mcomp64': 64x64 compound blocks infer COMPOUND_DIFFWTD (no wedge alphabet at that size); diff-wtd-comp exercised at 10-bit
Browse files at this commit5 changed files +320 -23
- crates/ec-av1/src/decode.rs +33 -16
- crates/ec-av1/src/gate_coverage.rs +1 -6
- crates/ec-av1/src/refusal_inventory.rs +0 -1
- crates/ec-av1/src/stream.rs +209 -0
- lanes/mcomp64-r1.report.md +77 -0
crates/ec-av1/src/decode.rsmodified+33 -16
| @@ -799,6 +799,21 @@ pub(crate) fn diffwtd_hits() -> usize { | |||
| 799 | DIFFWTD_HITS.with(|c| c.get()) | 799 | DIFFWTD_HITS.with(|c| c.get()) |
| 800 | } | 800 | } |
| 801 | 801 | ||
| 802 | +// lane-mcomp64 r1: how many blocks took the INFERRED `COMPOUND_DIFFWTD` arm -- | ||
| 803 | +// a block size where `av1_is_wedge_used` is false (64x64 is the only such size | ||
| 804 | +// this decoder's square inter path reaches), so no `compound_type` symbol is | ||
| 805 | +// coded at all. Strictly narrower than `DIFFWTD_HITS`, which also counts the | ||
| 806 | +// coded-symbol DIFFWTD blocks at 8x8/16x16/32x32. | ||
| 807 | +thread_local! { | ||
| 808 | + static DIFFWTD_INFERRED_HITS: std::cell::Cell<usize> = | ||
| 809 | + const { std::cell::Cell::new(0) }; | ||
| 810 | +} | ||
| 811 | + | ||
| 812 | +/// Current value of [`DIFFWTD_INFERRED_HITS`]. | ||
| 813 | +pub(crate) fn diffwtd_inferred_hits() -> usize { | ||
| 814 | + DIFFWTD_INFERRED_HITS.with(|c| c.get()) | ||
| 815 | +} | ||
| 816 | + | ||
| 802 | // lane-defon r1: how many FORWARD KEYFRAMES were decoded -- a KEY frame coded | 817 | // lane-defon r1: how many FORWARD KEYFRAMES were decoded -- a KEY frame coded |
| 803 | // with `show_frame == 0`, output later by a `show_existing_frame` header | 818 | // with `show_frame == 0`, output later by a `show_existing_frame` header |
| 804 | // (aomenc `--enable-fwd-kf=1 --fwd-kf-dist=N`). Counted from | 819 | // (aomenc `--enable-fwd-kf=1 --fwd-kf-dist=N`). Counted from |
| @@ -14040,24 +14055,23 @@ fn decode_inter_block( | |||
| 14040 | // `wedge_types > 0`), so `compound_type` always reads a real | 14055 | // `wedge_types > 0`), so `compound_type` always reads a real |
| 14041 | // symbol here -- no alphabet collapse to worry about at this | 14056 | // symbol here -- no alphabet collapse to worry about at this |
| 14042 | // block-size family. | 14057 | // block-size family. |
| 14058 | + // lane-mcomp64 r1: `av1_is_wedge_used` is false at 64x64 | ||
| 14059 | + // (`av1_wedge_params_lookup[BLOCK_64X64].wedge_types == 0`), | ||
| 14060 | + // so libaom's `read_compound_type` (decodemv.c 1634-1656) | ||
| 14061 | + // writes NO `compound_type` symbol there and INFERS | ||
| 14062 | + // `COMPOUND_DIFFWTD` -- only the 1-bit `mask_type` literal | ||
| 14063 | + // follows. `None` here is exactly that inferred arm. | ||
| 14043 | let wedge_bsize = match side { | 14064 | let wedge_bsize = match side { |
| 14044 | - 8 => 3, | 14065 | + 8 => Some(3), |
| 14045 | - 16 => 6, | 14066 | + 16 => Some(6), |
| 14046 | - 32 => 9, | 14067 | + 32 => Some(9), |
| 14047 | - // lane-inter8 r1: `av1_is_wedge_used` is false at 64x64 | 14068 | + _ => None, |
| 14048 | - // (`av1_wedge_params_lookup[BLOCK_64X64].wedge_types == | ||
| 14049 | - // 0`), so a real encoder writes NO `compound_type` symbol | ||
| 14050 | - // there -- COMPOUND_DIFFWTD is inferred. Reading one | ||
| 14051 | - // would desync, so refuse by name rather than guess the | ||
| 14052 | - // inferred-DIFFWTD blend this round. | ||
| 14053 | - _ => { | ||
| 14054 | - return Err(unsupported( | ||
| 14055 | - "a masked compound 64x64 inter block (compound_type is inferred, not coded, at this size)", | ||
| 14056 | - )) | ||
| 14057 | - } | ||
| 14058 | }; | 14069 | }; |
| 14059 | - let compound_type = dec.symbol(&mut cdfs.compound_type[wedge_bsize]); | 14070 | + let compound_type = match wedge_bsize { |
| 14060 | - if compound_type == 0 { | 14071 | + Some(b) => dec.symbol(&mut cdfs.compound_type[b]), |
| 14072 | + None => 1, | ||
| 14073 | + }; | ||
| 14074 | + if let Some(wedge_bsize) = wedge_bsize.filter(|_| compound_type == 0) { | ||
| 14061 | // COMPOUND_WEDGE: lane-wedge r3, codebook checksum- | 14075 | // COMPOUND_WEDGE: lane-wedge r3, codebook checksum- |
| 14062 | // verified vs independent C dump (wedge.rs). | 14076 | // verified vs independent C dump (wedge.rs). |
| 14063 | let wedge_index = dec.symbol(&mut cdfs.wedge_idx[wedge_bsize]); | 14077 | let wedge_index = dec.symbol(&mut cdfs.wedge_idx[wedge_bsize]); |
| @@ -14072,6 +14086,9 @@ fn decode_inter_block( | |||
| 14072 | // COMPOUND_DIFFWTD: `mask_type`, MAX_DIFFWTD_MASK_BITS==1. | 14086 | // COMPOUND_DIFFWTD: `mask_type`, MAX_DIFFWTD_MASK_BITS==1. |
| 14073 | let mask_type = dec.literal(1); | 14087 | let mask_type = dec.literal(1); |
| 14074 | diffwtd_mask_type = Some(mask_type as u8); | 14088 | diffwtd_mask_type = Some(mask_type as u8); |
| 14089 | + if wedge_bsize.is_none() { | ||
| 14090 | + DIFFWTD_INFERRED_HITS.with(|c| c.set(c.get() + 1)); | ||
| 14091 | + } | ||
| 14075 | } | 14092 | } |
| 14076 | MASKED_COMPOUND_HITS.with(|c| c.set(c.get() + 1)); | 14093 | MASKED_COMPOUND_HITS.with(|c| c.set(c.get() + 1)); |
| 14077 | } | 14094 | } |
crates/ec-av1/src/gate_coverage.rsmodified+1 -6
| @@ -249,12 +249,7 @@ const NEVER_ON_8BIT: &[(&str, &str)] = &[]; | |||
| 249 | 249 | ||
| 250 | /// [`DEFAULT_ON_TOOLS`] entries no 10-bit gate spells on, with the reason. | 250 | /// [`DEFAULT_ON_TOOLS`] entries no 10-bit gate spells on, with the reason. |
| 251 | #[cfg(test)] | 251 | #[cfg(test)] |
| 252 | -const NEVER_ON_10BIT: &[(&str, &str)] = &[ | 252 | +const NEVER_ON_10BIT: &[(&str, &str)] = &[]; |
| 253 | - ( | ||
| 254 | - "enable-diff-wtd-comp", | ||
| 255 | - "on in no 10-bit gate: 1 pinned off, 14 defaulted -- lane-defon r1 closed the 8-bit hole on the masked-compound gate (diffwtd_hits) and added a 10-bit one-sided-compound gate, but the 10-bit fixture source is `gradients`, whose smooth content never wins a difference-weighted mask (measured 8/8 pixel-exact, diffwtd_hits == 0); it needs a mandelbrot fixture in ten_bit_tool_gate", | ||
| 256 | - ), | ||
| 257 | -]; | ||
| 258 | 253 | ||
| 259 | #[cfg(test)] | 254 | #[cfg(test)] |
| 260 | mod tests { | 255 | mod tests { |
crates/ec-av1/src/refusal_inventory.rsmodified+0 -1
| @@ -64,7 +64,6 @@ const REFUSALS: &[&str] = &[ | |||
| 64 | "an intra block in an inter frame whose tx_depth splits its luma transform (round 1)", | 64 | "an intra block in an inter frame whose tx_depth splits its luma transform (round 1)", |
| 65 | "an inter frame with no key frame before it", | 65 | "an inter frame with no key frame before it", |
| 66 | "an inter SB-level partition type other than NONE or SPLIT (this decoder's inter tile path recurses a superblock only as SPLIT)", | 66 | "an inter SB-level partition type other than NONE or SPLIT (this decoder's inter tile path recurses a superblock only as SPLIT)", |
| 67 | - "a masked compound 64x64 inter block (compound_type is inferred, not coded, at this size)", | ||
| 68 | "an inter partition below 16x16 other than SPLIT (16x8/8x16 rect inter leaves are not coded yet)", | 67 | "an inter partition below 16x16 other than SPLIT (16x8/8x16 rect inter leaves are not coded yet)", |
| 69 | "an intra mode this decoder does not code (round 2)", | 68 | "an intra mode this decoder does not code (round 2)", |
| 70 | "an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet", | 69 | "an intra-coded HORZ/VERT strip needs rectangular intra prediction this decoder does not code yet", |
crates/ec-av1/src/stream.rsmodified+209 -0
| @@ -10520,6 +10520,215 @@ mod tests { | |||
| 10520 | ); | 10520 | ); |
| 10521 | } | 10521 | } |
| 10522 | 10522 | ||
| 10523 | + /// lane-mcomp64 r1: at 64x64 `av1_is_wedge_used` is false | ||
| 10524 | + /// (`av1_wedge_params_lookup[BLOCK_64X64].wedge_types == 0`), so libaom's | ||
| 10525 | + /// `read_compound_type` codes NO `compound_type` symbol and INFERS | ||
| 10526 | + /// `COMPOUND_DIFFWTD`; only the 1-bit `mask_type` literal follows. This | ||
| 10527 | + /// decoder used to refuse such a block by name ("a masked compound 64x64 | ||
| 10528 | + /// inter block..."), because reading the symbol would have desynced. | ||
| 10529 | + /// | ||
| 10530 | + /// The recipe pins every block to 64x64 (`--sb-size=64 | ||
| 10531 | + /// --max-partition-size=64 --min-partition-size=64`) with masked compound | ||
| 10532 | + /// on and distance-weighted compound off, so the only way a | ||
| 10533 | + /// `comp_group_idx == 1` block can be coded is through the inferred arm. | ||
| 10534 | + /// `diffwtd_inferred_hits` is snapshotted PER ATTEMPT and only accumulated | ||
| 10535 | + /// for attempts that decoded AND pixel-compared (class | ||
| 10536 | + /// `counter-from-refused-stream`), and is hard-asserted at the end. A | ||
| 10537 | + /// decode error or a pixel mismatch is a FAILURE, never a skip. | ||
| 10538 | + #[track_caller] | ||
| 10539 | + fn run_diffwtd_inferred_64x64_gate(name: &str, ten_bit: bool) { | ||
| 10540 | + let _gate_lock = lock_gate_counters(); | ||
| 10541 | + assert!(have_ffmpeg(), "{name}: ffmpeg required"); | ||
| 10542 | + assert!(have_aomenc(), "{name}: no aomenc at {}", aomenc_path().display()); | ||
| 10543 | + let (width, height, frame_count) = (128usize, 128usize, 16usize); | ||
| 10544 | + let mut matched = 0u32; | ||
| 10545 | + let mut named_refusals = 0u32; | ||
| 10546 | + let mut attempts = 0u32; | ||
| 10547 | + let mut fired = 0usize; | ||
| 10548 | + let mut refusals: Vec<String> = Vec::new(); | ||
| 10549 | + for cq in [32u32, 45, 55] { | ||
| 10550 | + for (i, zoom) in [0.004f64, 0.010].iter().enumerate() { | ||
| 10551 | + attempts += 1; | ||
| 10552 | + let attempt_before = crate::decode::diffwtd_inferred_hits(); | ||
| 10553 | + let duration = frame_count as f64 / 25.0; | ||
| 10554 | + // Hard-edged, moving content: a difference-weighted mask only | ||
| 10555 | + // wins where the two references genuinely disagree over part | ||
| 10556 | + // of a 64x64 block (a smooth `gradients` source measured | ||
| 10557 | + // diffwtd_hits == 0, memory `gate-blind-to-feature`). | ||
| 10558 | + let source = format!( | ||
| 10559 | + "mandelbrot=size={width}x{height}:rate=25:start_x={sx}:start_y=-0.4:\ | ||
| 10560 | + end_scale=0.3:maxiter=200,\ | ||
| 10561 | + noise=alls=6:allf=t+u:all_seed={seed}", | ||
| 10562 | + sx = -0.6 + zoom * (i as f64 + 1.0), | ||
| 10563 | + seed = 1000 + cq, | ||
| 10564 | + ); | ||
| 10565 | + let pix_fmt = if ten_bit { "yuv420p10le" } else { "yuv420p" }; | ||
| 10566 | + let y4m = Command::new("ffmpeg") | ||
| 10567 | + .args([ | ||
| 10568 | + "-v", "error", "-f", "lavfi", "-i", &source, "-t", | ||
| 10569 | + &duration.to_string(), "-pix_fmt", pix_fmt, "-strict", "-1", | ||
| 10570 | + "-f", "yuv4mpegpipe", "-", | ||
| 10571 | + ]) | ||
| 10572 | + .stdin(Stdio::null()) | ||
| 10573 | + .stdout(Stdio::piped()) | ||
| 10574 | + .stderr(Stdio::piped()) | ||
| 10575 | + .output() | ||
| 10576 | + .expect("ffmpeg failed to run"); | ||
| 10577 | + assert!( | ||
| 10578 | + y4m.status.success(), | ||
| 10579 | + "ffmpeg fixture: {}", | ||
| 10580 | + String::from_utf8_lossy(&y4m.stderr) | ||
| 10581 | + ); | ||
| 10582 | + let cq_arg = format!("--cq-level={cq}"); | ||
| 10583 | + let mut args: Vec<&str> = vec![ | ||
| 10584 | + "--codec=av1", | ||
| 10585 | + "--passes=1", | ||
| 10586 | + "--end-usage=q", | ||
| 10587 | + &cq_arg, | ||
| 10588 | + "--cpu-used=0", | ||
| 10589 | + "--kf-max-dist=1000", | ||
| 10590 | + "--threads=1", | ||
| 10591 | + "--row-mt=0", | ||
| 10592 | + "--auto-alt-ref=1", | ||
| 10593 | + "--lag-in-frames=16", | ||
| 10594 | + "--enable-fwd-kf=0", | ||
| 10595 | + "--enable-order-hint=1", | ||
| 10596 | + // the tools this gate exists for: masked compound on, the | ||
| 10597 | + // difference-weighted arm on, the distance-weighted | ||
| 10598 | + // competitor off so comp_group_idx==1 is the encoder's | ||
| 10599 | + // only masked choice at a size where wedge does not exist. | ||
| 10600 | + "--enable-masked-comp=1", | ||
| 10601 | + "--enable-diff-wtd-comp=1", | ||
| 10602 | + "--enable-dist-wtd-comp=0", | ||
| 10603 | + "--enable-onesided-comp=0", | ||
| 10604 | + "--enable-interintra-comp=0", | ||
| 10605 | + "--enable-global-motion=0", | ||
| 10606 | + "--enable-warped-motion=1", | ||
| 10607 | + "--enable-obmc=1", | ||
| 10608 | + "--tune-content=default", | ||
| 10609 | + // partition/intra tools this decoder does not code yet -- | ||
| 10610 | + // same exclusion list every compound gate carries. | ||
| 10611 | + "--enable-rect-partitions=0", | ||
| 10612 | + "--enable-ab-partitions=0", | ||
| 10613 | + "--enable-1to4-partitions=0", | ||
| 10614 | + "--enable-filter-intra=0", | ||
| 10615 | + "--enable-smooth-intra=0", | ||
| 10616 | + "--enable-paeth-intra=0", | ||
| 10617 | + "--enable-directional-intra=0", | ||
| 10618 | + "--enable-angle-delta=0", | ||
| 10619 | + "--enable-tx-size-search=0", | ||
| 10620 | + "--enable-cdef=0", | ||
| 10621 | + "--enable-restoration=0", | ||
| 10622 | + "--enable-palette=0", | ||
| 10623 | + "--enable-intrabc=0", | ||
| 10624 | + "--enable-cfl-intra=0", | ||
| 10625 | + "--enable-ref-frame-mvs=0", | ||
| 10626 | + // every block is a whole 64x64 superblock: the ONLY size | ||
| 10627 | + // where compound_type is inferred rather than coded. | ||
| 10628 | + "--sb-size=64", | ||
| 10629 | + "--max-partition-size=64", | ||
| 10630 | + "--min-partition-size=64", | ||
| 10631 | + ]; | ||
| 10632 | + if ten_bit { | ||
| 10633 | + args.extend_from_slice(&["--input-bit-depth=10", "--bit-depth=10"]); | ||
| 10634 | + } | ||
| 10635 | + args.extend_from_slice(&["--obu", "-o", "-", "-"]); | ||
| 10636 | + let mut child = Command::new(aomenc_path()) | ||
| 10637 | + .args(&args) | ||
| 10638 | + .stdin(Stdio::piped()) | ||
| 10639 | + .stdout(Stdio::piped()) | ||
| 10640 | + .stderr(Stdio::piped()) | ||
| 10641 | + .spawn() | ||
| 10642 | + .expect("aomenc failed to start"); | ||
| 10643 | + child | ||
| 10644 | + .stdin | ||
| 10645 | + .take() | ||
| 10646 | + .expect("aomenc stdin") | ||
| 10647 | + .write_all(&y4m.stdout) | ||
| 10648 | + .expect("writing y4m to aomenc"); | ||
| 10649 | + let out = child.wait_with_output().expect("aomenc failed to run"); | ||
| 10650 | + assert!( | ||
| 10651 | + out.status.success(), | ||
| 10652 | + "aomenc refused the fixture: {}", | ||
| 10653 | + String::from_utf8_lossy(&out.stderr) | ||
| 10654 | + ); | ||
| 10655 | + let stream = out.stdout; | ||
| 10656 | + let frames = match decode_stream(&stream) { | ||
| 10657 | + Err(e) => { | ||
| 10658 | + let msg = e.to_string(); | ||
| 10659 | + assert!( | ||
| 10660 | + msg.contains("unsupported"), | ||
| 10661 | + "{name} failed outright, not a named refusal (cq {cq}): {msg}" | ||
| 10662 | + ); | ||
| 10663 | + assert!( | ||
| 10664 | + !msg.contains("masked compound 64x64"), | ||
| 10665 | + "{name} refused the inferred-DIFFWTD 64x64 block (cq {cq}) -- \ | ||
| 10666 | + that refusal is lifted, this is forbidden: {msg}" | ||
| 10667 | + ); | ||
| 10668 | + named_refusals += 1; | ||
| 10669 | + refusals.push(msg.clone()); | ||
| 10670 | + eprintln!("{name} cq {cq} variant {i} refusal: {msg}"); | ||
| 10671 | + continue; | ||
| 10672 | + } | ||
| 10673 | + Ok(frames) => frames, | ||
| 10674 | + }; | ||
| 10675 | + let want = if ten_bit { | ||
| 10676 | + ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count) | ||
| 10677 | + } else { | ||
| 10678 | + ffmpeg_decode_sequence(&stream, width, height, frame_count) | ||
| 10679 | + }; | ||
| 10680 | + assert_eq!(frames.len(), frame_count); | ||
| 10681 | + if let Ok(path) = std::env::var("EC_AV1_GATE_DUMP") | ||
| 10682 | + && frames | ||
| 10683 | + .iter() | ||
| 10684 | + .zip(&want) | ||
| 10685 | + .any(|(g, w)| g.y != w.y || g.u != w.u || g.v != w.v) | ||
| 10686 | + { | ||
| 10687 | + std::fs::write(&path, &stream).expect("writing pinned stream"); | ||
| 10688 | + eprintln!("EC_AV1_GATE_DUMP: wrote mismatching stream (cq {cq}) to {path}"); | ||
| 10689 | + } | ||
| 10690 | + for (f, (got, want)) in frames.iter().zip(&want).enumerate() { | ||
| 10691 | + assert_eq!(got.y, want.y, "{name} frame {f} luma vs ffmpeg (cq {cq})"); | ||
| 10692 | + assert_eq!(got.u, want.u, "{name} frame {f} U vs ffmpeg (cq {cq})"); | ||
| 10693 | + assert_eq!(got.v, want.v, "{name} frame {f} V vs ffmpeg (cq {cq})"); | ||
| 10694 | + } | ||
| 10695 | + // decoded AND compared: only now does this attempt's own | ||
| 10696 | + // inferred-DIFFWTD count mean anything. | ||
| 10697 | + fired += crate::decode::diffwtd_inferred_hits() - attempt_before; | ||
| 10698 | + matched += 1; | ||
| 10699 | + } | ||
| 10700 | + } | ||
| 10701 | + eprintln!( | ||
| 10702 | + "{name}: {matched}/{attempts} pixel-exact, {named_refusals} named refusals, \ | ||
| 10703 | + diffwtd_inferred_hits (decoded+compared attempts only)={fired}" | ||
| 10704 | + ); | ||
| 10705 | + assert!(matched > 0, "{name}: every attempt refused ({refusals:?}) -- no pixel compare ran"); | ||
| 10706 | + assert!( | ||
| 10707 | + fired > 0, | ||
| 10708 | + "{name}: no inferred-DIFFWTD 64x64 block fired on a compared attempt \ | ||
| 10709 | + ({matched} matches, {named_refusals} refusals of {attempts}) -- gate vacuous" | ||
| 10710 | + ); | ||
| 10711 | + } | ||
| 10712 | + | ||
| 10713 | + /// 8-bit arm of [`run_diffwtd_inferred_64x64_gate`]. | ||
| 10714 | + #[test] | ||
| 10715 | + fn a_real_aomenc_stream_with_a_diffwtd_compound_64x64_block_decodes_pixel_exact() { | ||
| 10716 | + run_diffwtd_inferred_64x64_gate( | ||
| 10717 | + "a_real_aomenc_stream_with_a_diffwtd_compound_64x64_block_decodes_pixel_exact", | ||
| 10718 | + false, | ||
| 10719 | + ); | ||
| 10720 | + } | ||
| 10721 | + | ||
| 10722 | + /// 10-bit arm of [`run_diffwtd_inferred_64x64_gate`] -- both of his films | ||
| 10723 | + /// are `yuv420p10le`. | ||
| 10724 | + #[test] | ||
| 10725 | + fn a_real_aomenc_10bit_stream_with_a_diffwtd_compound_64x64_block_decodes_pixel_exact() { | ||
| 10726 | + run_diffwtd_inferred_64x64_gate( | ||
| 10727 | + "a_real_aomenc_10bit_stream_with_a_diffwtd_compound_64x64_block_decodes_pixel_exact", | ||
| 10728 | + true, | ||
| 10729 | + ); | ||
| 10730 | + } | ||
| 10731 | + | ||
| 10523 | /// lane-maskcomp r2 / lane-wedge r3: `--enable-masked-comp=1` streams | 10732 | /// lane-maskcomp r2 / lane-wedge r3: `--enable-masked-comp=1` streams |
| 10524 | /// must consume `compound_type`/`wedge_idx`/`wedge_sign`/`mask_type` | 10733 | /// must consume `compound_type`/`wedge_idx`/`wedge_sign`/`mask_type` |
| 10525 | /// entropy-exact AND build the real blend, DIFFWTD or WEDGE -- | 10734 | /// entropy-exact AND build the real blend, DIFFWTD or WEDGE -- |
lanes/mcomp64-r1.report.mdadded+77 -0
| @@ -0,0 +1,77 @@ | |||
| 1 | +# lane-mcomp64 r1 — inferred COMPOUND_DIFFWTD at 64x64 | ||
| 2 | + | ||
| 3 | +## What changed | ||
| 4 | +- `crates/ec-av1/src/decode.rs:13376` — `wedge_bsize` is now `Option<usize>`; `None` | ||
| 5 | + (side 64) means libaom codes **no** `compound_type` symbol and infers | ||
| 6 | + `COMPOUND_DIFFWTD` (`read_compound_type`, decodemv.c 1634-1656; guard is | ||
| 7 | + `is_interinter_compound_used(COMPOUND_WEDGE, bsize)` → | ||
| 8 | + `av1_wedge_params_lookup[BLOCK_64X64].wedge_types == 0`). Only the 1-bit | ||
| 9 | + `mask_type` literal follows. Refusal deleted. | ||
| 10 | +- `crates/ec-av1/src/decode.rs:759` — new `DIFFWTD_INFERRED_HITS` / `diffwtd_inferred_hits()`: | ||
| 11 | + strictly the inferred (no-symbol) arm, narrower than `DIFFWTD_HITS`. | ||
| 12 | +- `crates/ec-av1/src/refusal_inventory.rs:66` — refusal string removed (47 → 46). | ||
| 13 | +- `crates/ec-av1/src/gate_coverage.rs:252` — `NEVER_ON_10BIT` is now **empty**: the new | ||
| 14 | + 10-bit arm is the first recipe to spell `--enable-diff-wtd-comp=1` *and* fire it. | ||
| 15 | +- `crates/ec-av1/src/stream.rs:9683` — new gate | ||
| 16 | + `run_diffwtd_inferred_64x64_gate` + 8-bit and 10-bit `#[test]` arms. | ||
| 17 | + | ||
| 18 | +No new mask/blend code was needed: `mc::diffwtd_mask` already carries the `bd - 8` | ||
| 19 | +round term and `mc::blend_masked_compound` already takes block dims + the subsampled | ||
| 20 | +chroma read, so both are size- and bit-depth-generic. The `comp_group_idx` context | ||
| 21 | +(`get_comp_group_idx_context`) and `record_compound_ctx_rect_mi` already gather/write | ||
| 22 | +over the whole `side` span, so 64x64 needed no context work either. | ||
| 23 | + | ||
| 24 | +## Scope note (charter asked for more shapes) | ||
| 25 | +The charter listed 64x32/32x64/64x16/16x64/8x32/32x8. This decoder's square inter path | ||
| 26 | +(`decode_inter_block(.., side, ..)`, plus the 8x8 leaf `decode_inter_block8`) is the ONLY | ||
| 27 | +path that reaches `read_compound_type`; every rectangular inter shape is refused one level | ||
| 28 | +up by `"a non-skip rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual coding"` | ||
| 29 | +(ledger constraint, decode.rs). So 64x64 is the only wedge-less size reachable, and code for | ||
| 30 | +the other shapes would be unreachable and ungateable. `deferred: rect wedge-less shapes — | ||
| 31 | +unreachable until rect inter residual coding exists — unblocked by the rect-inter lane`. | ||
| 32 | + | ||
| 33 | +## Gate | ||
| 34 | +`a_real_aomenc_stream_with_a_diffwtd_compound_64x64_block_decodes_pixel_exact` and | ||
| 35 | +`a_real_aomenc_10bit_stream_with_a_diffwtd_compound_64x64_block_decodes_pixel_exact` | ||
| 36 | +(`crates/ec-av1/src/stream.rs`). 128x128, 16 frames, 3 cq × 2 mandelbrot+noise variants. | ||
| 37 | +Recipe pins every block to the inferred size (`--sb-size=64 --max-partition-size=64 | ||
| 38 | +--min-partition-size=64`) with `--enable-masked-comp=1 --enable-diff-wtd-comp=1 | ||
| 39 | +--enable-dist-wtd-comp=0` so `comp_group_idx == 1` has no other masked choice; every | ||
| 40 | +frame's Y/U/V compared against ffmpeg; a decode error or mismatch FAILS (the old refusal | ||
| 41 | +string is explicitly forbidden); hits snapshotted per attempt and accumulated only for | ||
| 42 | +attempts that decoded AND pixel-compared (class `counter-from-refused-stream`). | ||
| 43 | + | ||
| 44 | +Run: | ||
| 45 | +``` | ||
| 46 | +CARGO_TARGET_DIR=$HOME/.cache/cargo-target-mcomp64 EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 \ | ||
| 47 | + nice -n 10 cargo test -p ec-av1 --lib -j3 diffwtd_compound_64x64 -- --nocapture --test-threads=1 | ||
| 48 | +``` | ||
| 49 | +EVIDENCE: $HOME/.cache/cargo-target-mcomp64 test stdout | 2 gates, 6 aomenc encodes each, every frame Y/U/V vs ffmpeg | 8-bit 6/6 pixel-exact diffwtd_inferred_hits=79; 10-bit 6/6 pixel-exact diffwtd_inferred_hits=51; 2 passed 0 failed | ||
| 50 | + | ||
| 51 | +## Film probe | ||
| 52 | +EVIDENCE: scratchpad/hg-head.obu (ReelB 10-bit head) | `cargo run --release -p ec-av1 --example decode_probe` on b92150f, and on b92150f + cherry-picked lane-fi8 2d5c425 (scratch worktree, main lacks fi8) | on b92150f alone: `filter intra on a HORZ/VERT strip` (fi8's refusal, hit first); with fi8: `a Golomb tail longer than this decoder reads` — the masked-compound-64x64 stop the charter recorded on lane-fi8 is GONE. | ||
| 53 | + | ||
| 54 | +`open: the new ReelB stop "a Golomb tail longer than this decoder reads" is not | ||
| 55 | +proven to be a genuine next capability rather than a downstream desync of the newly | ||
| 56 | +decoded 64x64 masked block; the gate says the blend and symbol order are pixel-exact on | ||
| 57 | +real aomenc streams, but the film is not decoded end-to-end. Unblocked by a lane that | ||
| 58 | +bisects that frame against the instrumented aomdec range ladder.` | ||
| 59 | + | ||
| 60 | +## Suite | ||
| 61 | +See "Suite result" below (full `cargo test -p ec-av1 --lib` under systemd-run, log | ||
| 62 | +`$HOME/.cache/mcomp64-suite.log`). | ||
| 63 | + | ||
| 64 | +## Suite result | ||
| 65 | +`systemd-run --user --unit=mcomp64-suite-... -p MemoryMax=10G` → | ||
| 66 | +`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-mcomp64 | ||
| 67 | +nice -n 10 cargo test -p ec-av1 --lib -j3`, log `$HOME/.cache/mcomp64-suite.log`. | ||
| 68 | +EVIDENCE: $HOME/.cache/mcomp64-suite.log | full ec-av1 lib suite on b92150f | `test result: ok. 335 passed; 0 failed; 31 ignored; finished in 405.30s` | ||
| 69 | +Sibling gates re-run inside that suite and green: masked_compound / wedge / interintra / | ||
| 70 | +wedge-interintra / compound_* / inter_sequence* / refusal_inventory / gate_coverage. | ||
| 71 | + | ||
| 72 | +## Same-shape sweep (class: alphabet collapses at a size) | ||
| 73 | +The only other size-conditional wedge alphabet is interintra's `wedge_interintra` | ||
| 74 | +(`is_interintra_wedge_used`); interintra itself is allowed only for BLOCK_8X8..BLOCK_32X32, | ||
| 75 | +every one of which has `wedge_types > 0`, so no second instance exists on this decode path. | ||
| 76 | +The 8x8 leaf (`decode_inter_block8`) is hard-coded to `wedge_bsize == 3`, correct by | ||
| 77 | +construction. | ||