forge
Explore
Log in

Don't you dare go Hollow

An intra block inside an inter frame refused a nonzero angle_delta_y -- the refusal claimed "this encoder never writes one" and aomenc writes one by default

Browse files at this commit

ac20fa3c5c854a330117c8515c57cb7432afffbfAhmet Kaan GümüşParent: c98870c
  • fix
    • an intra block inside an inter frame refused a nonzero angle_delta_y -- the refusal claimed "this encoder never writes one" and aomenc writes one by default
Show full message
fix(av1): an intra block inside an inter frame refused a nonzero angle_delta_y -- the refusal claimed "this encoder never writes one" and aomenc writes one by default

`read_intra_angle_info` writes angle_delta_y for any directional y_mode at
bsize >= 8x8 in an inter frame exactly as in a key frame, and aomenc's
--enable-angle-delta defaults to 1: the first gate attempt (seed 42) carries
4 such blocks. decode_inter_block now reads the delta and threads it through
its split-transform per-TU and block-level luma predictions, and derives
smooth_neighbor (get_intra_edge_filter_type) via Neighbours::modes_above_left
instead of the hardcoded `false` that decided the intra edge filter's
strength. New gate a_real_aomenc_inter_sequence_with_a_directional_intra_block
_with_angle_delta_decodes_pixel_exact (8-bit + 10-bit) asserts the hit counter
and compares every frame's Y/U/V vs ffmpeg. Flipping all 56
--enable-angle-delta=0 spellings to =1 leaves the 17 inter_sequence gates
green (no hidden defect). decode_inter_block8's 8x8 leaf keeps its refusal --
80 attempts never reached a directional 8x8 intra leaf -- reworded to a claim
about this decoder's coverage rather than about the encoder.
crates/ec-av1/src/decode.rsmodified+80 -23
@@ -85,6 +85,27 @@ pub(crate) fn intra_in_inter_filter_intra_hits() -> usize {
85 INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.get())85 INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.get())
86 }86 }
87 87
88+// lane-angleinter r1: how many INTRA blocks inside an INTER frame carried a
89+// nonzero `angle_delta_y` / `angle_delta_uv` (`read_intra_angle_info`). Both
90+// arms refused a nonzero luma delta before this round, and no inter gate
91+// enabled `--enable-angle-delta` (aomenc's own default is 1).
92+thread_local! {
93+ static INTRA_IN_INTER_ANGLE_DELTA_Y_HITS: std::cell::Cell<usize> =
94+ const { std::cell::Cell::new(0) };
95+ static INTRA_IN_INTER_ANGLE_DELTA_UV_HITS: std::cell::Cell<usize> =
96+ const { std::cell::Cell::new(0) };
97+}
98+
99+/// Current value of [`INTRA_IN_INTER_ANGLE_DELTA_Y_HITS`].
100+pub(crate) fn intra_in_inter_angle_delta_y_hits() -> usize {
101+ INTRA_IN_INTER_ANGLE_DELTA_Y_HITS.with(|c| c.get())
102+}
103+
104+/// Current value of [`INTRA_IN_INTER_ANGLE_DELTA_UV_HITS`].
105+pub(crate) fn intra_in_inter_angle_delta_uv_hits() -> usize {
106+ INTRA_IN_INTER_ANGLE_DELTA_UV_HITS.with(|c| c.get())
107+}
108+
88 // lane-realworld r1: this frame's `cdef.bits` (spec 5.9.19), threaded into109 // lane-realworld r1: this frame's `cdef.bits` (spec 5.9.19), threaded into
89 // [`maybe_read_cdef_idx`] the same way [`ENABLE_EDGE_FILTER`] threads a110 // [`maybe_read_cdef_idx`] the same way [`ENABLE_EDGE_FILTER`] threads a
90 // frame-level flag through the recursive block decode -- `0` (the default)111 // frame-level flag through the recursive block decode -- `0` (the default)
@@ -15510,14 +15531,29 @@ fn decode_inter_block(
15510 "an intra mode this decoder does not code (round 2)",15531 "an intra mode this decoder does not code (round 2)",
15511 ));15532 ));
15512 }15533 }
15513- if (V_PRED..=D67_PRED).contains(&mode) {15534+ // lane-angleinter r1: `read_intra_angle_info` (libaom `decodemv.c`,
15514- let angle = dec.symbol(&mut cdfs.angle_delta[mode - V_PRED]);15535+ // inside `read_intra_block_mode_info`) -- an intra block in an inter
15515- if angle != ANGLE_DELTA_ZERO {15536+ // frame reads `angle_delta_y` off the same
15516- return Err(unsupported(15537+ // `angle_delta_cdf[mode - V_PRED]` row a key-frame block does, and
15517- "a nonzero angle delta (this encoder never writes one)",15538+ // the delta feeds the directional predictor (and the edge
15518- ));15539+ // filter/upsample decision derived from the delta'd angle) unchanged.
15519- }15540+ // The symbol was read and then refused before this round even though
15520- }15541+ // aomenc enables `--enable-angle-delta` by default.
15542+ let angle_delta_y = if (V_PRED..=D67_PRED).contains(&mode) {
15543+ read_angle_delta(dec, &mut cdfs.angle_delta[mode - V_PRED])
15544+ } else {
15545+ 0
15546+ };
15547+ if angle_delta_y != 0 {
15548+ INTRA_IN_INTER_ANGLE_DELTA_Y_HITS.with(|c| c.set(c.get() + 1));
15549+ }
15550+ // The delta'd angle decides whether the intra edge filter runs at
15551+ // all, so this block needs the same luma edge-filter-type neighbour
15552+ // check a key-frame block does (`get_intra_edge_filter_type`, spec
15553+ // 7.11.2) -- this arm passed a hardcoded `false` while every
15554+ // directional intra-in-inter block was refused above.
15555+ let (nb_above_mode, nb_left_mode) = neighbours.modes_above_left(r, c);
15556+ let smooth_neighbor = is_smooth_mode(nb_above_mode) || is_smooth_mode(nb_left_mode);
15521 let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]);15557 let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]);
15522 if (9..=12).contains(&uv_mode) {15558 if (9..=12).contains(&uv_mode) {
15523 SMOOTH_UV_HITS.with(|c| c.set(c.get() + 1));15559 SMOOTH_UV_HITS.with(|c| c.set(c.get() + 1));
@@ -15541,6 +15577,7 @@ fn decode_inter_block(
15541 };15577 };
15542 if angle_delta_uv != 0 {15578 if angle_delta_uv != 0 {
15543 UV_ANGLE_DELTA_HITS.with(|c| c.set(c.get() + 1));15579 UV_ANGLE_DELTA_HITS.with(|c| c.set(c.get() + 1));
15580+ INTRA_IN_INTER_ANGLE_DELTA_UV_HITS.with(|c| c.set(c.get() + 1));
15544 }15581 }
15545 uv_predict_mode = if uv_mode == UV_CFL_PRED {15582 uv_predict_mode = if uv_mode == UV_CFL_PRED {
15546 DC_PRED15583 DC_PRED
@@ -15652,12 +15689,12 @@ fn decode_inter_block(
15652 tu_py,15689 tu_py,
15653 tx_px,15690 tx_px,
15654 mode,15691 mode,
15655- 0,15692+ angle_delta_y,
15656 tu_reach,15693 tu_reach,
15657 &vec![0i32; tx_px * tx_px],15694 &vec![0i32; tx_px * tx_px],
15658 None,15695 None,
15659 filter_intra,15696 filter_intra,
15660- false,15697+ smooth_neighbor,
15661 );15698 );
15662 vec![0i32; tx_px * tx_px]15699 vec![0i32; tx_px * tx_px]
15663 } else {15700 } else {
@@ -15674,7 +15711,7 @@ fn decode_inter_block(
15674 neighbours.around_mi(tu_mi, tx_px)[0],15711 neighbours.around_mi(tu_mi, tx_px)[0],
15675 mode,15712 mode,
15676 mode,15713 mode,
15677- 0,15714+ angle_delta_y,
15678 tu_reach,15715 tu_reach,
15679 y,15716 y,
15680 tu_px,15717 tu_px,
@@ -15685,7 +15722,7 @@ fn decode_inter_block(
15685 None,15722 None,
15686 filter_intra,15723 filter_intra,
15687 Some(tu_skip_ctx),15724 Some(tu_skip_ctx),
15688- false,15725+ smooth_neighbor,
15689 )?15726 )?
15690 };15727 };
15691 neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid);15728 neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid);
@@ -15698,12 +15735,12 @@ fn decode_inter_block(
15698 py,15735 py,
15699 side,15736 side,
15700 mode,15737 mode,
15701- 0,15738+ angle_delta_y,
15702 reach,15739 reach,
15703 &vec![0i32; side * side],15740 &vec![0i32; side * side],
15704 None,15741 None,
15705 filter_intra,15742 filter_intra,
15706- false,15743+ smooth_neighbor,
15707 );15744 );
15708 }15745 }
15709 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side));15746 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side));
@@ -15751,7 +15788,7 @@ fn decode_inter_block(
15751 around[0],15788 around[0],
15752 mode,15789 mode,
15753 mode,15790 mode,
15754- 0,15791+ angle_delta_y,
15755 reach,15792 reach,
15756 y,15793 y,
15757 px,15794 px,
@@ -15762,7 +15799,7 @@ fn decode_inter_block(
15762 None,15799 None,
15763 filter_intra,15800 filter_intra,
15764 None,15801 None,
15765- false,15802+ smooth_neighbor,
15766 )?15803 )?
15767 };15804 };
15768 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side));15805 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side));
@@ -17151,14 +17188,34 @@ fn decode_inter_block8(
17151 "an intra mode this decoder does not code (round 2)",17188 "an intra mode this decoder does not code (round 2)",
17152 ));17189 ));
17153 }17190 }
17154- if (V_PRED..=D67_PRED).contains(&mode) {17191+ // lane-angleinter r1: `read_intra_angle_info` (libaom `decodemv.c`,
17155- let angle = dec.symbol(&mut cdfs.angle_delta[mode - V_PRED]);17192+ // inside `read_intra_block_mode_info`) -- an intra block in an inter
17156- if angle != ANGLE_DELTA_ZERO {17193+ // frame reads `angle_delta_y` off the same
17194+ // `angle_delta_cdf[mode - V_PRED]` row a key-frame block does, and
17195+ // the delta feeds the directional predictor (and the edge
17196+ // filter/upsample decision derived from the delta'd angle) unchanged.
17197+ // The symbol was read and then refused before this round even though
17198+ // aomenc enables `--enable-angle-delta` by default.
17199+ let angle_delta_y = if (V_PRED..=D67_PRED).contains(&mode) {
17200+ read_angle_delta(dec, &mut cdfs.angle_delta[mode - V_PRED])
17201+ } else {
17202+ 0
17203+ };
17204+ if angle_delta_y != 0 {
17205+ INTRA_IN_INTER_ANGLE_DELTA_Y_HITS.with(|c| c.set(c.get() + 1));
17206+ // lane-angleinter r1: the >=16x16 arm's lift is gated by a real
17207+ // aomenc stream; this leaf's is NOT -- 80 attempts across two
17208+ // sizes and five quantisers never produced an 8x8 intra leaf with
17209+ // a nonzero delta (the leaf's own sibling refusals -- non-DC
17210+ // chroma, the TX_4X4 split, sub-16 rect inter leaves -- fire
17211+ // first). The prediction below would handle it; refusing keeps
17212+ // the rule that no lift ships ungated. Note the claim is about
17213+ // THIS DECODER's gate coverage, not about what an encoder writes.
17157 return Err(unsupported(17214 return Err(unsupported(
17158- "a nonzero angle delta (this encoder never writes one)",17215+ "a nonzero angle delta on an 8x8 intra leaf in an inter frame (no gate reaches \
17216+ this leaf with one; the >=16x16 arm decodes deltas)",
17159 ));17217 ));
17160 }17218 }
17161- }
17162 let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]);17219 let uv_mode = dec.symbol(&mut cdfs.uv_mode_cfl[mode]);
17163 if uv_mode != DC_PRED {17220 if uv_mode != DC_PRED {
17164 return Err(unsupported(17221 return Err(unsupported(
@@ -17252,7 +17309,7 @@ fn decode_inter_block8(
17252 py,17309 py,
17253 SIDE,17310 SIDE,
17254 mode,17311 mode,
17255- 0,17312+ angle_delta_y,
17256 reach,17313 reach,
17257 &vec![0i32; SIDE * SIDE],17314 &vec![0i32; SIDE * SIDE],
17258 None,17315 None,
@@ -17297,7 +17354,7 @@ fn decode_inter_block8(
17297 around[0],17354 around[0],
17298 mode,17355 mode,
17299 mode,17356 mode,
17300- 0,17357+ angle_delta_y,
17301 reach,17358 reach,
17302 y,17359 y,
17303 px,17360 px,
crates/ec-av1/src/gate_coverage.rsmodified+0 -8
@@ -148,10 +148,6 @@ const ALIASES: &[(&str, &str)] = &[("superres-mode", "enable-superres")];
148 /// depth retires the entry, and this test fails until it is deleted.148 /// depth retires the entry, and this test fails until it is deleted.
149 #[cfg(test)]149 #[cfg(test)]
150 const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[150 const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[
151- (
152- "enable-angle-delta",
153- "off in 36 gates, on in none: the directional-intra gates pin it off to isolate the base modes",
154- ),
155 (151 (
156 "enable-cfl-intra",152 "enable-cfl-intra",
157 "off in 41 gates, on in none: chroma-from-luma prediction is unimplemented",153 "off in 41 gates, on in none: chroma-from-luma prediction is unimplemented",
@@ -214,10 +210,6 @@ const NEVER_EXERCISED_10BIT: &[(&str, &str)] = &[ // lane-cwarp's 10-bit comp
214 // gate passes `=1` for both. `enable-1to4-partitions` left it on 2026-09-02:210 // gate passes `=1` for both. `enable-1to4-partitions` left it on 2026-09-02:
215 // lane-tx64x16 r4's 32-level 1:4 gate has a 10-bit arm that asserts both211 // lane-tx64x16 r4's 32-level 1:4 gate has a 10-bit arm that asserts both
216 // orientations and coded strips inside pixel-exact attempts.212 // orientations and coded strips inside pixel-exact attempts.
217- (
218- "enable-angle-delta",
219- "hole at both depths, see the 8-bit list",
220- ),
221 (213 (
222 "enable-cfl-intra",214 "enable-cfl-intra",
223 "hole at both depths, see the 8-bit list",215 "hole at both depths, see the 8-bit list",
crates/ec-av1/src/refusal_inventory.rsmodified+1 -1
@@ -26,11 +26,11 @@
26 const CAPABILITY_CLAIMS: &[&str] = &[26 const CAPABILITY_CLAIMS: &[&str] = &[
27 "filter intra on a superblock-level HORZ/VERT strip (never expected -- av1_filter_intra_allowed_bsize caps at 32x32)",27 "filter intra on a superblock-level HORZ/VERT strip (never expected -- av1_filter_intra_allowed_bsize caps at 32x32)",
28 "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)",28 "a non-DC chroma mode on an 8x8 inter-frame leaf (this encoder never writes one)",
29- "a nonzero angle delta (this encoder never writes one)",
30 ];29 ];
31 30
32 #[cfg(test)]31 #[cfg(test)]
33 const REFUSALS: &[&str] = &[32 const REFUSALS: &[&str] = &[
33+ "a nonzero angle delta on an 8x8 intra leaf in an inter frame (no gate reaches this leaf with one; the >=16x16 arm decodes deltas)",
34 "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here",34 "a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here",
35 "a coded 1:4 HORZ_4/VERT_4 strip whose transform splits only once (the unit is still a 2:1 rect, not a square)",35 "a coded 1:4 HORZ_4/VERT_4 strip whose transform splits only once (the unit is still a 2:1 rect, not a square)",
36 "a HORZ/VERT intra strip below 16x16 with a split transform (per-unit rect prediction is not ported)",36 "a HORZ/VERT intra strip below 16x16 with a split transform (per-unit rect prediction is not ported)",
crates/ec-av1/src/stream.rsmodified+267 -0
@@ -4686,6 +4686,273 @@ mod tests {
4686 );4686 );
4687 }4687 }
4688 4688
4689+ /// lane-angleinter r1 (class [[refusal-strings-are-claims]] +
4690+ /// [[tool-disabled-in-every-gate]]): a real aomenc inter sequence with
4691+ /// `--enable-angle-delta=1` and `--enable-directional-intra=1` (aomenc's
4692+ /// own defaults; every inter gate before this one pinned BOTH off) in
4693+ /// which the RD gives an INTRA block inside an inter frame a directional
4694+ /// luma mode with a nonzero `angle_delta_y`. Both intra-in-inter arms
4695+ /// read that symbol and then REFUSED it as "this encoder never writes
4696+ /// one" -- the claim is false, `read_intra_angle_info` writes it exactly
4697+ /// as a key frame does. Hard-asserts
4698+ /// [`decode::intra_in_inter_angle_delta_y_hits`]; an attempt that never
4699+ /// produced one proves nothing, and exhausting every attempt is a
4700+ /// FAILURE, not a SKIP.
4701+ #[test]
4702+ fn a_real_aomenc_inter_sequence_with_a_directional_intra_block_with_angle_delta_decodes_pixel_exact()
4703+ {
4704+ angle_delta_in_inter_gate(8, "--min-partition-size=16");
4705+ }
4706+
4707+ /// The 10-bit arm (both of the user's films are `yuv420p10le`).
4708+ #[test]
4709+ fn a_real_aomenc_10bit_inter_sequence_with_a_directional_intra_block_with_angle_delta_decodes_pixel_exact()
4710+ {
4711+ angle_delta_in_inter_gate(10, "--min-partition-size=16");
4712+ }
4713+
4714+ fn angle_delta_in_inter_gate(bit_depth: u32, min_partition: &str) {
4715+ let name = format!("angle_delta_in_inter_gate({bit_depth}, min={min_partition})");
4716+ let leaf8 = min_partition.ends_with('8');
4717+ assert!(!leaf8, "the 8x8-leaf arm keeps its refusal; see the module note");
4718+ if !have_ffmpeg() {
4719+ eprintln!("SKIP {name}: no ffmpeg");
4720+ return;
4721+ }
4722+ if !have_aomenc() {
4723+ eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display());
4724+ return;
4725+ }
4726+ let (width, height, frame_count) = (64usize, 64usize, 8usize);
4727+ let mut refusals = Vec::new();
4728+ let mut uncounted_exact = 0u32;
4729+ for attempt in 0..40u32 {
4730+ let seed = 42 + attempt;
4731+ // A zooming fractal: every frame moves (so the sequence is
4732+ // genuinely inter-coded) and keeps sharp new detail entering at
4733+ // the borders, which is what makes aomenc's RD choose an INTRA
4734+ // block inside an inter frame -- and then split its transform.
4735+ // A zooming fractal with a hard CUT halfway (`overlay` switching
4736+ // a second, unrelated fractal on at frame 4): after the cut every
4737+ // block is unpredictable from the reference, which is what makes
4738+ // aomenc code INTRA blocks inside an inter frame -- and at this
4739+ // cq the RD then splits their transforms.
4740+ let source = format!(
4741+ "mandelbrot=size={width}x{height}:start_scale={}:rate=25[a];\
4742+ mandelbrot=size={width}x{height}:start_scale={}:rate=25[b];\
4743+ [a][b]overlay=enable='gte(n,4)'",
4744+ 5.0 - f64::from(attempt) * 0.06,
4745+ 0.9 + f64::from(attempt) * 0.11
4746+ );
4747+ let y4m = Command::new("ffmpeg")
4748+ .args([
4749+ "-v",
4750+ "error",
4751+ "-f",
4752+ "lavfi",
4753+ "-i",
4754+ &source,
4755+ // Desaturated chroma keeps `uv_mode` on DC_PRED, so the
4756+ // still-refused directional-chroma gaps never fire and
4757+ // luma detail alone drives the transform split.
4758+ "-vf",
4759+ "hue=s=0",
4760+ "-pix_fmt",
4761+ if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" },
4762+ "-strict",
4763+ "-1",
4764+ "-t",
4765+ "0.32",
4766+ "-f",
4767+ "yuv4mpegpipe",
4768+ "-strict",
4769+ "-1",
4770+ "-",
4771+ ])
4772+ .stdin(Stdio::null())
4773+ .stdout(Stdio::piped())
4774+ .stderr(Stdio::piped())
4775+ .output()
4776+ .expect("ffmpeg failed to run");
4777+ assert!(
4778+ y4m.status.success(),
4779+ "ffmpeg fixture: {}",
4780+ String::from_utf8_lossy(&y4m.stderr)
4781+ );
4782+ // The 8x8-leaf arm is fenced by three sibling refusals (non-DC
4783+ // chroma on an 8x8 leaf, its TX_4X4 split, sub-16 rect inter
4784+ // leaves), so it sweeps the quantiser as well as the source: a
4785+ // coarser q is what pushes the RD to directional intra at 8x8.
4786+ let cq = if leaf8 {
4787+ format!("--cq-level={}", 20 + (attempt % 5) * 10)
4788+ } else {
4789+ "--cq-level=30".to_string()
4790+ };
4791+ let depth_args: &[&str] = if bit_depth == 10 {
4792+ &["-b", "10", "--input-bit-depth=10"]
4793+ } else {
4794+ &[]
4795+ };
4796+ let mut child = Command::new(aomenc_path())
4797+ .args(depth_args)
4798+ .args([
4799+ "--codec=av1",
4800+ "--passes=1",
4801+ "--end-usage=q",
4802+ &cq,
4803+ "--cpu-used=0",
4804+ "--lag-in-frames=0",
4805+ "--auto-alt-ref=0",
4806+ // One key frame only: every later frame is an inter frame,
4807+ // which is where this gate's intra blocks must sit. The
4808+ // MIN distance is what stops aomenc's scene-cut detector
4809+ // from inserting a second key frame at the cut this gate's
4810+ // source deliberately contains.
4811+ "--kf-max-dist=1000",
4812+ "--kf-min-dist=1000",
4813+ "--threads=1",
4814+ "--row-mt=0",
4815+ "--enable-order-hint=0",
4816+ "--enable-warped-motion=0",
4817+ "--enable-obmc=0",
4818+ "--enable-masked-comp=0",
4819+ "--enable-interintra-comp=0",
4820+ "--enable-dist-wtd-comp=0",
4821+ "--enable-diff-wtd-comp=0",
4822+ "--enable-onesided-comp=0",
4823+ "--enable-interintra-wedge=0",
4824+ "--enable-smooth-interintra=0",
4825+ "--enable-ab-partitions=0",
4826+ "--enable-1to4-partitions=0",
4827+ "--enable-smooth-intra=0",
4828+ "--enable-paeth-intra=0",
4829+ "--enable-directional-intra=1",
4830+ "--enable-angle-delta=1",
4831+ "--enable-cdef=0",
4832+ "--enable-restoration=0",
4833+ "--enable-palette=0",
4834+ "--enable-intrabc=0",
4835+ "--enable-cfl-intra=0",
4836+ "--enable-ref-frame-mvs=0",
4837+ // Per-arm overrides go LAST (aomenc keeps the last
4838+ // occurrence of a repeated --enable-* flag): the intra
4839+ // tx_depth symbol only exists under TX_MODE_SELECT, and
4840+ // rect partitions are a separate named refusal.
4841+ "--enable-filter-intra=1",
4842+ "--enable-tx-size-search=1",
4843+ "--enable-rect-partitions=0",
4844+ "--max-partition-size=32",
4845+ // Sub-16 inter partitions are a separate named refusal,
4846+ // as is the 8x8 intra leaf's own TX_4X4 split.
4847+ min_partition,
4848+ "--obu",
4849+ "-o",
4850+ "-",
4851+ "-",
4852+ ])
4853+ .stdin(Stdio::piped())
4854+ .stdout(Stdio::piped())
4855+ .stderr(Stdio::piped())
4856+ .spawn()
4857+ .expect("aomenc failed to start");
4858+ child
4859+ .stdin
4860+ .take()
4861+ .expect("aomenc stdin")
4862+ .write_all(&y4m.stdout)
4863+ .expect("writing y4m to aomenc");
4864+ let out = child.wait_with_output().expect("aomenc failed to run");
4865+ assert!(
4866+ out.status.success(),
4867+ "aomenc refused the fixture: {}",
4868+ String::from_utf8_lossy(&out.stderr)
4869+ );
4870+ let stream = out.stdout;
4871+ let before = decode::intra_in_inter_angle_delta_y_hits();
4872+ let before_uv = decode::intra_in_inter_angle_delta_uv_hits();
4873+ let frames = match decode_stream(&stream) {
4874+ Ok(frames) => frames,
4875+ Err(e) => {
4876+ let msg = e.to_string();
4877+ assert!(
4878+ msg.contains("unsupported"),
4879+ "{name} decode failed outright (seed {seed}): {msg}"
4880+ );
4881+ refusals.push(format!("seed {seed}: {msg}"));
4882+ continue;
4883+ }
4884+ };
4885+ let fired = decode::intra_in_inter_angle_delta_y_hits() - before;
4886+ let fired_uv = decode::intra_in_inter_angle_delta_uv_hits() - before_uv;
4887+ // class [[gate-skips-on-its-own-failure]]: a decode that
4888+ // succeeded is ALWAYS pixel-compared below; the counter only
4889+ // decides whether the attempt counts as firing.
4890+ let counted = fired != 0;
4891+ if !counted {
4892+ uncounted_exact += 1;
4893+ refusals.push(format!(
4894+ "seed {seed}: decoded and pixel-compared, but no intra block in an inter \
4895+ frame carried a nonzero angle_delta_y"
4896+ ));
4897+ }
4898+ let ffmpeg_frames = if bit_depth == 10 {
4899+ ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
4900+ } else {
4901+ ffmpeg_decode_sequence(&stream, width, height, frame_count)
4902+ };
4903+ assert_eq!(frames.len(), frame_count);
4904+ eprintln!(
4905+ "{name} seed={seed}: intra-in-inter blocks with a nonzero angle_delta_y = \
4906+ {fired}, angle_delta_uv = {fired_uv}"
4907+ );
4908+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
4909+ for (plane, (g, w)) in [
4910+ ("Y", (&got.y, &want.y)),
4911+ ("U", (&got.u, &want.u)),
4912+ ("V", (&got.v, &want.v)),
4913+ ] {
4914+ let stride = if plane == "Y" { width } else { width / 2 };
4915+ if let Some(at) = g.iter().zip(w.iter()).position(|(a, b)| a != b) {
4916+ eprintln!(
4917+ "{name} seed={seed}: frame {i} {plane} first diff at ({}, {}) got {} \
4918+ want {} ({} samples differ)",
4919+ at % stride,
4920+ at / stride,
4921+ g[at],
4922+ w[at],
4923+ g.iter().zip(w.iter()).filter(|(a, b)| a != b).count(),
4924+ );
4925+ }
4926+ }
4927+ }
4928+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
4929+ assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg (seed {seed})");
4930+ assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})");
4931+ assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})");
4932+ }
4933+ if counted {
4934+ gate_buckets(
4935+ &name,
4936+ 1,
4937+ uncounted_exact,
4938+ refusals.len() - uncounted_exact as usize,
4939+ );
4940+ return;
4941+ }
4942+ }
4943+ gate_buckets(
4944+ &name,
4945+ 0,
4946+ uncounted_exact,
4947+ refusals.len() - uncounted_exact as usize,
4948+ );
4949+ panic!(
4950+ "{name} never observed a nonzero angle delta on an intra block in an inter \
4951+ frame:\n{}",
4952+ refusals.join("\n")
4953+ );
4954+ }
4955+
4689 /// lane-chroma r2 stage 1: a real aomenc key frame with4956 /// lane-chroma r2 stage 1: a real aomenc key frame with
4690 /// `--enable-smooth-intra=1` (opposite of every sibling recipe's `=0`)4957 /// `--enable-smooth-intra=1` (opposite of every sibling recipe's `=0`)
4691 /// and `--enable-paeth-intra=0` -- paeth chroma stays off so the still-4958 /// and `--enable-paeth-intra=0` -- paeth chroma stays off so the still-
lanes/angleinter-r1.report.mdadded+105 -0
@@ -0,0 +1,105 @@
1+# lane-angleinter r1 — a nonzero angle delta on an intra block inside an inter frame
2+
3+Branch `lane-angleinter` off `lane-fiinter` 6b82994. Class:
4+[[refusal-strings-are-claims]] + [[tool-disabled-in-every-gate]].
5+
6+## The claim, tested
7+
8+Both intra-in-inter arms read `angle_delta_y` and then refused it as
9+"a nonzero angle delta (this encoder never writes one)". The claim is FALSE:
10+aomenc's `--enable-angle-delta` defaults to 1 and libaom's
11+`read_intra_angle_info` (inside `read_intra_block_mode_info`, decodemv.c)
12+writes the symbol for any directional `y_mode` at bsize >= 8x8 exactly as a
13+key frame does. A real default-settings inter stream desynced there.
14+
15+Confirmed by the gate below on the FIRST attempt (seed 42, 8-bit): 4 intra
16+blocks inside inter frames carry a nonzero `angle_delta_y`.
17+
18+## What changed
19+
20+- `crates/ec-av1/src/decode.rs:15542` (`decode_inter_block`, >=16x16 arm):
21+ refusal replaced by `read_angle_delta`; the delta is threaded into every
22+ luma prediction of the block — the split-transform per-TU
23+ `reconstruct`/`read_plane` pair and the block-level pair — where a literal
24+ `0` used to go.
25+- `crates/ec-av1/src/decode.rs:15555`: the same arm derived
26+ `smooth_neighbor` (`get_intra_edge_filter_type`, spec 7.11.2) via the
27+ existing `Neighbours::modes_above_left` helper; it passed a hardcoded
28+ `false` before, which was unobservable while every directional
29+ intra-in-inter block was refused, and decides the intra edge filter's
30+ strength once a delta'd angle reaches it.
31+- `crates/ec-av1/src/decode.rs:82` (+ around): counters
32+ `intra_in_inter_angle_delta_y_hits` / `intra_in_inter_angle_delta_uv_hits`.
33+- `crates/ec-av1/src/decode.rs:17191` (`decode_inter_block8`, 8x8 leaf):
34+ the refusal STAYS, reworded to a claim about this decoder's gate coverage
35+ instead of about the encoder — see "Not lifted" below.
36+- `crates/ec-av1/src/stream.rs`: gate `angle_delta_in_inter_gate` + its 8-bit
37+ and 10-bit tests.
38+- `refusal_inventory.rs`: the capability claim is gone; the 8x8-leaf refusal
39+ is listed as a decoder-scoped refusal. `gate_coverage.rs`:
40+ `enable-angle-delta` deleted from `NEVER_EXERCISED_8BIT` and `_10BIT`.
41+
42+## Gate
43+
44+`a_real_aomenc_inter_sequence_with_a_directional_intra_block_with_angle_delta_decodes_pixel_exact`
45+(+ `..._10bit_...`). Recipe = the intrainter/fiinter one (64x64 mandelbrot
46+zoom with a hard overlay cut at frame 4, `--cq-level=30`, `--kf-min-dist=1000`
47+`--kf-max-dist=1000`, `--min-partition-size=16`) with
48+`--enable-directional-intra=1` and `--enable-angle-delta=1` — each flag
49+spelled ONCE in the arg list (the base recipe's `=0` entries were edited in
50+place, so flag precedence cannot silently invert the arm). Every frame's Y, U
51+and V are compared against ffmpeg; a decode error or mismatch is a FAILURE,
52+never a SKIP; the hit counter is a hard assert.
53+
54+```
55+cargo test -p ec-av1 --lib with_a_directional_intra_block_with_angle_delta -- --nocapture
56+```
57+
58+EVIDENCE: $HOME/.cache/angleinter-suite.log | aomenc --enable-angle-delta=1 --enable-directional-intra=1, 8 frames decoded and Y/U/V-compared vs ffmpeg | 8-bit seed 42: 4 nonzero-angle_delta_y intra-in-inter blocks, 0 sample mismatches; 10-bit seed 47: 4 blocks, 0 mismatches (buckets counted-exact=1 uncounted-exact=0)
59+
60+EVIDENCE: negative control (scratchpad decode.rs.bak diff) | re-inserted `return Err(unsupported("NEGATIVE CONTROL: a nonzero angle delta"))` at decode.rs:15549, reran both gates | 2 passed -> 2 FAILED, all 40 attempts refused with that string; lift reverted afterwards
61+
62+## Mutation sweep (task 3)
63+
64+All 56 `--enable-angle-delta=0` spellings in `stream.rs` flipped to `=1`, then
65+the 17 `inter_sequence` gates rerun: **17 passed / 0 failed** — no hidden
66+defect behind the flag. stream.rs restored from the scratchpad copy
67+afterwards (only the new gate's own two spellings are `=1` on the branch).
68+
69+EVIDENCE: mutation run | sed -i 's/--enable-angle-delta=0/=1/g' + `cargo test -p ec-av1 --lib inter_sequence` | test result: ok. 17 passed; 0 failed; 2 ignored
70+
71+## Not lifted (disposition)
72+
73+`deferred: the 8x8-leaf arm's nonzero-delta case (decode.rs:17205) — 80
74+attempts (64x64 and 128x128 sources, cq 20/30/40/50/60, seeds 42..81) never
75+produced an 8x8 intra leaf with a nonzero angle_delta_y, nor even one with a
76+directional luma mode: the leaf's three sibling refusals ("a non-DC chroma
77+mode on an 8x8 inter-frame leaf", "an 8x8 intra leaf ... whose tx_depth
78+splits it into 4x4 transform units", "an inter partition below 16x16 other
79+than SPLIT") fire first on 37/40 attempts. Lifting it would ship an ungated
80+capability claim (class refusal-lifted-without-a-gate), so the refusal stays,
81+reworded to be about this decoder. — unblocked by: lifting the non-DC-chroma
82+and TX_4X4-split refusals on that leaf, which then makes a directional 8x8
83+intra leaf reachable.`
84+
85+`accepted: angle_delta_uv fired 0 times in every passing attempt — the
86+recipe's `hue=s=0` desaturation is what keeps uv_mode on DC and the transform
87+split luma-driven. The uv delta path was already read AND already threaded
88+into both chroma predictions before this round (decode.rs:15556 ff.), so the
89+lift did not touch it; the counter is in place for a future chroma gate.`
90+
91+`accepted: decode_inter_block8 still passes a hardcoded `false` for its luma
92+edge-filter neighbour type. Unobservable while its directional-mode
93+population is empty (see above); reverted rather than shipped ungated.`
94+
95+## Suite + film
96+
97+`cargo test -p ec-av1 --lib` (systemd unit, log `$HOME/.cache/angleinter-suite.log`):
98+**348 passed / 0 failed / 32 ignored**, 384 s.
99+
100+Film probe (`hg-head.obu`, 0.4 s of the ReelB 2160p10 film, 18 frame
101+headers): now stops at `filter intra on a HORZ/VERT strip (this decoder
102+predicts square-only)` — a different, rect-prediction refusal; the angle-delta
103+refusal is no longer on its path.
104+
105+EVIDENCE: $HOME/.cache/angleinter-suite.log | `cargo test -p ec-av1 --lib` under a systemd unit + `cargo run --example decode_probe -- hg-head.obu` | 348 passed / 0 failed; film refusal string = "filter intra on a HORZ/VERT strip"