forge
Explore
Log in

Don't you dare go Hollow

Merge branch 'lane-fiinter': intra blocks in inter frames read use_filter_intra (aomenc default on; symbol was never consumed)

Browse files at this commit

7eb5f179fc09767ed7b18232ae8a667f9b79dda0Ahmet Kaan GümüşParent: 4bf9109c98870c
lane-fiinter was rebased off lane-intrainter, so this ONE merge carries both
lanes' work: the per-TU luma split of an intra block inside an inter frame
(intrainter, commit 94492b4 on this branch) and the use_filter_intra read in
both intra-in-inter arms with its ENABLE_FILTER_INTRA_INTER thread-local.
Merging lane-intrainter e841b2a separately would have replayed the same content
from a different base; it is retired as subsumed, proven by its own gates
passing here (a_real_aomenc_{,10bit_}inter_sequence_with_a_split_transform_intra_block).

Merged clean; one call site rebound to the widened Reach::of_tu(tx_w, tx_h) from
the rectsplitx merge (decode.rs:16147).

Gates on the merged tree, all green: split_transform_intra_block (8+10-bit),
filter_intra_on_an_intra_block (8+10-bit), inter_sequence* , tx_select*,
8x8_leaf_split, refusal_inventory, gate_coverage, base_ctx_rect_offsets --
29 passed / 0 failed / 2 ignored.
crates/ec-av1/src/decode.rsmodified+237 -56
@@ -71,6 +71,20 @@ pub(crate) fn filter_intra_hits() -> usize {
71 FILTER_INTRA_HITS.with(|c| c.get())71 FILTER_INTRA_HITS.with(|c| c.get())
72 }72 }
73 73
74+// lane-fiinter r1: how many of those `use_filter_intra == 1` symbols belonged
75+// to an INTRA block inside an INTER frame (`read_intra_block_mode_info`'s own
76+// `read_filter_intra_mode_info` call), which no gate exercised before this
77+// round -- every inter gate recipe passed `--enable-filter-intra=0`.
78+thread_local! {
79+ static INTRA_IN_INTER_FILTER_INTRA_HITS: std::cell::Cell<usize> =
80+ const { std::cell::Cell::new(0) };
81+}
82+
83+/// Current value of [`INTRA_IN_INTER_FILTER_INTRA_HITS`].
84+pub(crate) fn intra_in_inter_filter_intra_hits() -> usize {
85+ INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.get())
86+}
87+
74 // lane-realworld r1: this frame's `cdef.bits` (spec 5.9.19), threaded into88 // lane-realworld r1: this frame's `cdef.bits` (spec 5.9.19), threaded into
75 // [`maybe_read_cdef_idx`] the same way [`ENABLE_EDGE_FILTER`] threads a89 // [`maybe_read_cdef_idx`] the same way [`ENABLE_EDGE_FILTER`] threads a
76 // frame-level flag through the recursive block decode -- `0` (the default)90 // frame-level flag through the recursive block decode -- `0` (the default)
@@ -882,6 +896,11 @@ thread_local! {
882 // frame-constant.896 // frame-constant.
883 static TX_SELECT_INTER: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };897 static TX_SELECT_INTER: std::cell::Cell<bool> = const { std::cell::Cell::new(false) };
884 static REDUCED_TX_SET_INTER: std::cell::Cell<bool> = const { std::cell::Cell::new(true) };898 static REDUCED_TX_SET_INTER: std::cell::Cell<bool> = const { std::cell::Cell::new(true) };
899+ // lane-fiinter r1: this sequence header's own `enable_filter_intra` bit,
900+ // frame-constant like the two above and stashed the same way -- an intra
901+ // block inside an inter frame reads `use_filter_intra` under it.
902+ static ENABLE_FILTER_INTRA_INTER: std::cell::Cell<bool> =
903+ const { std::cell::Cell::new(false) };
885 }904 }
886 905
887 /// Current value of [`TXFM_SPLIT_READS`].906 /// Current value of [`TXFM_SPLIT_READS`].
@@ -894,10 +913,16 @@ pub(crate) fn txfm_split_hits() -> usize {
894 TXFM_SPLIT_HITS.with(|c| c.get())913 TXFM_SPLIT_HITS.with(|c| c.get())
895 }914 }
896 915
897-/// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`].916+/// Sets the current thread's [`TX_SELECT_INTER`]/[`REDUCED_TX_SET_INTER`]/
898-pub(crate) fn set_inter_tx_mode(tx_select: bool, reduced_tx_set: bool) {917+/// [`ENABLE_FILTER_INTRA_INTER`].
918+pub(crate) fn set_inter_tx_mode(
919+ tx_select: bool,
920+ reduced_tx_set: bool,
921+ enable_filter_intra: bool,
922+) {
899 TX_SELECT_INTER.with(|c| c.set(tx_select));923 TX_SELECT_INTER.with(|c| c.set(tx_select));
900 REDUCED_TX_SET_INTER.with(|c| c.set(reduced_tx_set));924 REDUCED_TX_SET_INTER.with(|c| c.set(reduced_tx_set));
925+ ENABLE_FILTER_INTRA_INTER.with(|c| c.set(enable_filter_intra));
901 }926 }
902 927
903 // How many `partition_w16` reads (a 16x16 block's own partition symbol, key928 // How many `partition_w16` reads (a 16x16 block's own partition symbol, key
@@ -1262,6 +1287,19 @@ pub(crate) fn palette_split_tx_hits() -> usize {
1262 PALETTE_SPLIT_TX_HITS.with(|c| c.get())1287 PALETTE_SPLIT_TX_HITS.with(|c| c.get())
1263 }1288 }
1264 1289
1290+// lane-intrainter r1: intra blocks inside an INTER frame whose `tx_depth`
1291+// symbol split their luma transform, bucketed by block side (8, 16, 32, 64) --
1292+// the gate's proof that the lifted path actually ran, per size.
1293+thread_local! {
1294+ static INTRA_IN_INTER_SPLIT_TX_HITS: std::cell::Cell<[usize; 4]> =
1295+ const { std::cell::Cell::new([0; 4]) };
1296+}
1297+
1298+/// Current value of [`INTRA_IN_INTER_SPLIT_TX_HITS`], indexed 8/16/32/64.
1299+pub(crate) fn intra_in_inter_split_tx_hits() -> [usize; 4] {
1300+ INTRA_IN_INTER_SPLIT_TX_HITS.with(std::cell::Cell::get)
1301+}
1302+
1265 thread_local! {1303 thread_local! {
1266 /// A just-decoded palette-Y block's own predicted pixels1304 /// A just-decoded palette-Y block's own predicted pixels
1267 /// (`side*side`, row-major, `colors[map[i]]`), consumed by1305 /// (`side*side`, row-major, `colors[map[i]]`), consumed by
@@ -10036,27 +10074,40 @@ fn read_block_tx_size(
10036 let tx = if is_inter {10074 let tx = if is_inter {
10037 side.min(64)10075 side.min(64)
10038 } else {10076 } else {
10039- let resolved = read_tx_size(10077+ read_tx_size(
10040 dec,10078 dec,
10041 cdfs,10079 cdfs,
10042 n,10080 n,
10043 at_mi,10081 at_mi,
10044 side,10082 side,
10045 Some(tx_size_context_txfm(n, at_mi, side)),10083 Some(tx_size_context_txfm(n, at_mi, side)),
10046- );10084+ )
10047- if resolved != side {
10048- // An intra block inside an inter frame whose `tx_depth` splits its
10049- // luma transform needs the per-transform-unit intra prediction
10050- // loop `decode_block` runs for a key frame; this path predicts the
10051- // whole block at once, so refuse rather than mis-reconstruct.
10052- return Err(unsupported(
10053- "an intra block in an inter frame whose tx_depth splits its luma transform \
10054- (round 1)",
10055- ));
10056- }
10057- resolved
10058 };10085 };
10059 set_txfm_ctxs(n, at_mi, tx, side_mi, side_mi, skip && is_inter);10086 set_txfm_ctxs(n, at_mi, tx, side_mi, side_mi, skip && is_inter);
10087+ if !is_inter && tx != side {
10088+ // lane-intrainter r1: an intra block inside an inter frame whose
10089+ // `tx_depth` split its luma transform codes exactly the key-frame
10090+ // split path's transform units (`decode_block`'s multi-TU loop),
10091+ // raster order over the block. Handed back in the same leaf shape the
10092+ // inter var-tx tree uses, so the caller's per-TU luma loop, the
10093+ // `record_split_luma` neighbour write-back and the per-TU deblock
10094+ // edges are the ones it already runs for a var-tx inter block. A
10095+ // caller that has no per-TU intra loop (the 8x8 leaf) refuses on
10096+ // seeing `Some` here.
10097+ let step = tx / MI;
10098+ let mut leaves = Vec::new();
10099+ for row in (0..side_mi).step_by(step) {
10100+ for col in (0..side_mi).step_by(step) {
10101+ leaves.push((row, col, tx));
10102+ }
10103+ }
10104+ INTRA_IN_INTER_SPLIT_TX_HITS.with(|c| {
10105+ let mut h = c.get();
10106+ h[(side.trailing_zeros() as usize).saturating_sub(3).min(3)] += 1;
10107+ c.set(h);
10108+ });
10109+ return Ok((tx, Some(leaves)));
10110+ }
10060 Ok((tx, None))10111 Ok((tx, None))
10061 }10112 }
10062 10113
@@ -16020,6 +16071,24 @@ fn decode_inter_block(
16020 ));16071 ));
16021 }16072 }
16022 }16073 }
16074+ // lane-fiinter r1: `read_filter_intra_mode_info` (libaom `decodemv.c`,
16075+ // the tail of `read_intra_block_mode_info`) -- an intra block inside
16076+ // an INTER frame reads `use_filter_intra` in exactly the same place a
16077+ // key-frame block does, right after the palette syntax. Nothing read
16078+ // it here before this round, and aomenc enables filter intra by
16079+ // default, so every inter frame carrying one desynced at this symbol.
16080+ // `av1_filter_intra_allowed`'s `palette_size[0] == 0` term is implied:
16081+ // a real palette-Y block already returned above.
16082+ let mut filter_intra = None;
16083+ if mode == DC_PRED
16084+ && ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get)
16085+ && let Some(class) = filter_intra_size_class(side)
16086+ && dec.symbol(&mut cdfs.filter_intra[class]) != 0
16087+ {
16088+ FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1));
16089+ INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1));
16090+ filter_intra = Some(dec.symbol(&mut cdfs.filter_intra_mode));
16091+ }
16023 mode_for_tx = mode;16092 mode_for_tx = mode;
16024 block_filter = [3, 3];16093 block_filter = [3, 3];
16025 ref_frame_for_lf = 0;16094 ref_frame_for_lf = 0;
@@ -16046,7 +16115,14 @@ fn decode_inter_block(
16046 }16115 }
16047 }16116 }
16048 16117
16049- read_block_tx_size(16118+ // lane-intrainter r1: an intra block in an inter frame reads the same
16119+ // `tx_depth` symbol a key-frame block does, and when it splits, the
16120+ // block codes one intra prediction + one coefficient set PER
16121+ // transform unit (`decode_block`'s multi-TU branch), not one for the
16122+ // whole block. The leaf list rides the existing `vartx_leaves` slot,
16123+ // whose tail already does the split-block neighbour write-back
16124+ // (`record_split_luma`) and the per-TU deblock edges.
16125+ vartx_leaves = read_block_tx_size(
16050 dec,16126 dec,
16051 cdfs,16127 cdfs,
16052 neighbours,16128 neighbours,
@@ -16055,21 +16131,80 @@ fn decode_inter_block(
16055 (mi_cols as usize, mi_rows as usize),16131 (mi_cols as usize, mi_rows as usize),
16056 false,16132 false,
16057 skip,16133 skip,
16058- )?;16134+ )?
16135+ .1;
16059 let reach = Reach::of(side, px, py, y.width, y.height);16136 let reach = Reach::of(side, px, py, y.width, y.height);
16137+ let split_luma = vartx_leaves.is_some();
16138+ if let Some(leaves) = vartx_leaves.clone() {
16139+ let reduced = REDUCED_TX_SET_INTER.with(std::cell::Cell::get);
16140+ for &(row, col, tx_px) in &leaves {
16141+ let tu_mi = (at_mi.0 + row, at_mi.1 + col);
16142+ let (tu_px, tu_py) = (px + col * MI, py + row * MI);
16143+ // A transform unit inside a block is not a block at that
16144+ // position (class from lane-palette2 r12): top-right /
16145+ // bottom-left availability is the block's, narrowed by the
16146+ // unit's own offset inside it.
16147+ let tu_reach = Reach::of_tu(side, side, col * MI, row * MI, tx_px, tx_px, reach);
16148+ let tu_grid = if skip {
16149+ y.reconstruct(
16150+ tu_px,
16151+ tu_py,
16152+ tx_px,
16153+ mode,
16154+ 0,
16155+ tu_reach,
16156+ &vec![0i32; tx_px * tx_px],
16157+ None,
16158+ filter_intra,
16159+ false,
16160+ );
16161+ vec![0i32; tx_px * tx_px]
16162+ } else {
16163+ // The unit's bsize is smaller than the block it sits in,
16164+ // so `txb_skip_ctx` is the neighbour-magnitude table, not
16165+ // the lone-TU 0 (`get_txb_ctx_general`).
16166+ let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tx_px / MI);
16167+ read_plane(
16168+ dec,
16169+ cdfs,
16170+ txbset_for(tx_px, reduced),
16171+ &default_scan(tx_px),
16172+ 0,
16173+ neighbours.around_mi(tu_mi, tx_px)[0],
16174+ mode,
16175+ mode,
16176+ 0,
16177+ tu_reach,
16178+ y,
16179+ tu_px,
16180+ tu_py,
16181+ tx_px,
16182+ tx_px,
16183+ base_q_idx,
16184+ None,
16185+ filter_intra,
16186+ Some(tu_skip_ctx),
16187+ false,
16188+ )?
16189+ };
16190+ neighbours.record_mi_luma(tu_mi, tx_px, &tu_grid);
16191+ }
16192+ }
16060 if skip {16193 if skip {
16061- y.reconstruct(16194+ if !split_luma {
16062- px,16195+ y.reconstruct(
16063- py,16196+ px,
16064- side,16197+ py,
16065- mode,16198+ side,
16066- 0,16199+ mode,
16067- reach,16200+ 0,
16068- &vec![0i32; side * side],16201+ reach,
16069- None,16202+ &vec![0i32; side * side],
16070- None,16203+ None,
16071- false,16204+ filter_intra,
16072- );16205+ false,
16206+ );
16207+ }
16073 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side));16208 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side));
16074 u.reconstruct(16209 u.reconstruct(
16075 cpx,16210 cpx,
@@ -16100,28 +16235,35 @@ fn decode_inter_block(
16100 v_grid = vec![0i32; chroma_side * chroma_side];16235 v_grid = vec![0i32; chroma_side * chroma_side];
16101 } else {16236 } else {
16102 let around = neighbours.around(at, side);16237 let around = neighbours.around(at, side);
16103- luma_grid = read_plane(16238+ luma_grid = if split_luma {
16104- dec,16239+ // Already coded and reconstructed unit by unit above; the
16105- cdfs,16240+ // block-level grid is only the neighbour write-back's input,
16106- luma_set_intra,16241+ // which `record_split_luma` ignores for plane 0.
16107- scan_luma,16242+ vec![0i32; side * side]
16108- 0,16243+ } else {
16109- around[0],16244+ read_plane(
16110- mode,16245+ dec,
16111- mode,16246+ cdfs,
16112- 0,16247+ luma_set_intra,
16113- reach,16248+ scan_luma,
16114- y,16249+ 0,
16115- px,16250+ around[0],
16116- py,16251+ mode,
16117- side,16252+ mode,
16118- luma_tx,16253+ 0,
16119- base_q_idx,16254+ reach,
16120- None,16255+ y,
16121- None,16256+ px,
16122- None,16257+ py,
16123- false,16258+ side,
16124- )?;16259+ luma_tx,
16260+ base_q_idx,
16261+ None,
16262+ filter_intra,
16263+ None,
16264+ false,
16265+ )?
16266+ };
16125 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side));16267 let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side));
16126 u_grid = read_plane(16268 u_grid = read_plane(
16127 dec,16269 dec,
@@ -17539,6 +17681,24 @@ fn decode_inter_block8(
17539 ));17681 ));
17540 }17682 }
17541 }17683 }
17684+ // lane-fiinter r1: `read_filter_intra_mode_info` (libaom `decodemv.c`,
17685+ // the tail of `read_intra_block_mode_info`) -- an intra block inside
17686+ // an INTER frame reads `use_filter_intra` in exactly the same place a
17687+ // key-frame block does, right after the palette syntax. Nothing read
17688+ // it here before this round, and aomenc enables filter intra by
17689+ // default, so every inter frame carrying one desynced at this symbol.
17690+ // `av1_filter_intra_allowed`'s `palette_size[0] == 0` term is implied:
17691+ // a real palette-Y block already returned above.
17692+ let mut filter_intra = None;
17693+ if mode == DC_PRED
17694+ && ENABLE_FILTER_INTRA_INTER.with(std::cell::Cell::get)
17695+ && let Some(class) = filter_intra_size_class(SIDE)
17696+ && dec.symbol(&mut cdfs.filter_intra[class]) != 0
17697+ {
17698+ FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1));
17699+ INTRA_IN_INTER_FILTER_INTRA_HITS.with(|c| c.set(c.get() + 1));
17700+ filter_intra = Some(dec.symbol(&mut cdfs.filter_intra_mode));
17701+ }
17542 mode_for_tx = mode;17702 mode_for_tx = mode;
17543 let (mi_row, mi_col) = leaf_mi;17703 let (mi_row, mi_col) = leaf_mi;
17544 for dr in 0..2 {17704 for dr in 0..2 {
@@ -17562,7 +17722,11 @@ fn decode_inter_block8(
17562 }17722 }
17563 }17723 }
17564 17724
17565- read_block_tx_size(17725+ // lane-intrainter r1: the 8x8 leaf's own intra `tx_depth` can only
17726+ // resolve to TX_4X4, whose 2x2 unit grid this leaf path has no
17727+ // prediction loop for (the >=16x16 square path above does). Refuse by
17728+ // name rather than mis-reconstruct.
17729+ if read_block_tx_size(
17566 dec,17730 dec,
17567 cdfs,17731 cdfs,
17568 neighbours,17732 neighbours,
@@ -17571,7 +17735,15 @@ fn decode_inter_block8(
17571 (mi_cols as usize, mi_rows as usize),17735 (mi_cols as usize, mi_rows as usize),
17572 false,17736 false,
17573 skip,17737 skip,
17574- )?;17738+ )?
17739+ .1
17740+ .is_some()
17741+ {
17742+ return Err(unsupported(
17743+ "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 \
17744+ transform units",
17745+ ));
17746+ }
17575 let reach = Reach::of(SIDE, px, py, y.width, y.height);17747 let reach = Reach::of(SIDE, px, py, y.width, y.height);
17576 if skip {17748 if skip {
17577 y.reconstruct(17749 y.reconstruct(
@@ -17583,7 +17755,7 @@ fn decode_inter_block8(
17583 reach,17755 reach,
17584 &vec![0i32; SIDE * SIDE],17756 &vec![0i32; SIDE * SIDE],
17585 None,17757 None,
17586- None,17758+ filter_intra,
17587 false,17759 false,
17588 );17760 );
17589 u.reconstruct(17761 u.reconstruct(
@@ -17633,7 +17805,7 @@ fn decode_inter_block8(
17633 TX8,17805 TX8,
17634 base_q_idx,17806 base_q_idx,
17635 None,17807 None,
17636- None,17808+ filter_intra,
17637 None,17809 None,
17638 false,17810 false,
17639 )?;17811 )?;
@@ -17802,6 +17974,10 @@ pub fn decode_inter_frame_tile(
17802 false,17974 false,
17803 false,17975 false,
17804 DeltaParams::default(),17976 DeltaParams::default(),
17977+ // `enable_filter_intra`: this crate's own encoder never writes the
17978+ // sequence bit (`encode.rs`), so no intra-in-inter block of a stream
17979+ // reaching this entry point reads a `use_filter_intra` symbol.
17980+ false,
17805 )17981 )
17806 .map(|(picture, _, _)| picture)17982 .map(|(picture, _, _)| picture)
17807 }17983 }
@@ -17885,8 +18061,13 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
17885 // same contract as [`decode_key_frame_tile_with_cdfs`]'s own `delta`18061 // same contract as [`decode_key_frame_tile_with_cdfs`]'s own `delta`
17886 // param -- only `q_present`/`q_res` are read.18062 // param -- only `q_present`/`q_res` are read.
17887 delta: DeltaParams,18063 delta: DeltaParams,
18064+ // lane-fiinter r1: this sequence header's own `enable_filter_intra` bit
18065+ // (spec 5.5.2), stashed in a thread-local with `tx_select` rather than
18066+ // threaded through `decode_inter_block`'s fifty parameters -- read by the
18067+ // intra-in-inter arms' `read_filter_intra_mode_info`.
18068+ enable_filter_intra: bool,
17888 ) -> Result<(Picture, Cdfs, crate::motion_field::MotionField)> {18069 ) -> Result<(Picture, Cdfs, crate::motion_field::MotionField)> {
17889- set_inter_tx_mode(tx_select, reduced_tx_set);18070+ set_inter_tx_mode(tx_select, reduced_tx_set, enable_filter_intra);
17890 let tpl_frame = tpl_field.map(|field| TplFrameArgs {18071 let tpl_frame = tpl_field.map(|field| TplFrameArgs {
17891 field,18072 field,
17892 order_hint_bits,18073 order_hint_bits,
crates/ec-av1/src/refusal_inventory.rsmodified+5 -1
@@ -59,7 +59,11 @@ const REFUSALS: &[&str] = &[
59 "a reference picture whose height does not match this frame's own true size",59 "a reference picture whose height does not match this frame's own true size",
60 "a show_existing_frame header naming an empty reference slot",60 "a show_existing_frame header naming an empty reference slot",
61 "an inter var-tx tree with a leaf transform larger than 32x32",61 "an inter var-tx tree with a leaf transform larger than 32x32",
62- "an intra block in an inter frame whose tx_depth splits its luma transform (round 1)",62+ // lane-intrainter r1 lifted the >=16x16 square case (per-TU intra
63+ // prediction + coefficients, gate
64+ // `a_real_aomenc_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact`);
65+ // the 8x8 leaf's TX_4X4 2x2 grid is still refused here.
66+ "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform units",
63 "an inter frame with no key frame before it",67 "an inter frame with no key frame before it",
64 "an inter SB-level partition type other than NONE or SPLIT (this decoder's inter tile path recurses a superblock only as SPLIT)",68 "an inter SB-level partition type other than NONE or SPLIT (this decoder's inter tile path recurses a superblock only as SPLIT)",
65 "an inter partition below 16x16 other than SPLIT (16x8/8x16 rect inter leaves are not coded yet)",69 "an inter partition below 16x16 other than SPLIT (16x8/8x16 rect inter leaves are not coded yet)",
crates/ec-av1/src/stream.rsmodified+506 -0
@@ -691,6 +691,7 @@ pub fn decode_stream(data: &[u8]) -> Result<Vec<Picture>> {
691 header.allow_warped_motion,691 header.allow_warped_motion,
692 header.allow_screen_content_tools,692 header.allow_screen_content_tools,
693 header.delta,693 header.delta,
694+ enable_filter_intra,
694 )?;695 )?;
695 // lane-superres r10: mirrors the key-frame branch above --696 // lane-superres r10: mirrors the key-frame branch above --
696 // `decode_inter_frame_tile_with_cdfs` decodes at the downscaled697 // `decode_inter_frame_tile_with_cdfs` decodes at the downscaled
@@ -4180,6 +4181,511 @@ mod tests {
4180 );4181 );
4181 }4182 }
4182 4183
4184+ /// lane-intrainter r1's decisive gate: a real aomenc INTER sequence in
4185+ /// which aomenc's RD picks an INTRA block inside an inter frame AND
4186+ /// splits that block's luma transform (`tx_depth >= 1`, the intra depth
4187+ /// symbol -- not the inter var-tx tree). That block codes one intra
4188+ /// prediction plus one coefficient set per transform unit, exactly like a
4189+ /// key frame's split block but with the inter frame's CDF state and the
4190+ /// inter-frame intra mode syntax; before this lane it was a named
4191+ /// refusal. Hard-asserts [`decode::intra_in_inter_split_tx_hits`] per
4192+ /// block size: an attempt that never produced such a block proves
4193+ /// nothing, and exhausting every attempt is a FAILURE, not a SKIP.
4194+ #[test]
4195+ fn a_real_aomenc_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact() {
4196+ intra_in_inter_split_tx_gate(8);
4197+ }
4198+
4199+ /// The 10-bit arm (both of the user's films are `yuv420p10le`).
4200+ #[test]
4201+ fn a_real_aomenc_10bit_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact() {
4202+ intra_in_inter_split_tx_gate(10);
4203+ }
4204+
4205+ fn intra_in_inter_split_tx_gate(bit_depth: u32) {
4206+ let name = format!("intra_in_inter_split_tx_gate({bit_depth})");
4207+ if !have_ffmpeg() {
4208+ eprintln!("SKIP {name}: no ffmpeg");
4209+ return;
4210+ }
4211+ if !have_aomenc() {
4212+ eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display());
4213+ return;
4214+ }
4215+ let (width, height, frame_count) = (64usize, 64usize, 8usize);
4216+ let mut refusals = Vec::new();
4217+ let mut uncounted_exact = 0u32;
4218+ for attempt in 0..40u32 {
4219+ let seed = 42 + attempt;
4220+ // A zooming fractal: every frame moves (so the sequence is
4221+ // genuinely inter-coded) and keeps sharp new detail entering at
4222+ // the borders, which is what makes aomenc's RD choose an INTRA
4223+ // block inside an inter frame -- and then split its transform.
4224+ // A zooming fractal with a hard CUT halfway (`overlay` switching
4225+ // a second, unrelated fractal on at frame 4): after the cut every
4226+ // block is unpredictable from the reference, which is what makes
4227+ // aomenc code INTRA blocks inside an inter frame -- and at this
4228+ // cq the RD then splits their transforms.
4229+ let source = format!(
4230+ "mandelbrot=size=64x64:start_scale={}:rate=25[a];\
4231+ mandelbrot=size=64x64:start_scale={}:rate=25[b];\
4232+ [a][b]overlay=enable='gte(n,4)'",
4233+ 5.0 - f64::from(attempt) * 0.06,
4234+ 0.9 + f64::from(attempt) * 0.11
4235+ );
4236+ let y4m = Command::new("ffmpeg")
4237+ .args([
4238+ "-v",
4239+ "error",
4240+ "-f",
4241+ "lavfi",
4242+ "-i",
4243+ &source,
4244+ // Desaturated chroma keeps `uv_mode` on DC_PRED, so the
4245+ // still-refused directional-chroma gaps never fire and
4246+ // luma detail alone drives the transform split.
4247+ "-vf",
4248+ "hue=s=0",
4249+ "-pix_fmt",
4250+ if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" },
4251+ "-strict",
4252+ "-1",
4253+ "-t",
4254+ "0.32",
4255+ "-f",
4256+ "yuv4mpegpipe",
4257+ "-strict",
4258+ "-1",
4259+ "-",
4260+ ])
4261+ .stdin(Stdio::null())
4262+ .stdout(Stdio::piped())
4263+ .stderr(Stdio::piped())
4264+ .output()
4265+ .expect("ffmpeg failed to run");
4266+ assert!(
4267+ y4m.status.success(),
4268+ "ffmpeg fixture: {}",
4269+ String::from_utf8_lossy(&y4m.stderr)
4270+ );
4271+ let depth_args: &[&str] = if bit_depth == 10 {
4272+ &["-b", "10", "--input-bit-depth=10"]
4273+ } else {
4274+ &[]
4275+ };
4276+ let mut child = Command::new(aomenc_path())
4277+ .args(depth_args)
4278+ .args([
4279+ "--codec=av1",
4280+ "--passes=1",
4281+ "--end-usage=q",
4282+ "--cq-level=30",
4283+ "--cpu-used=0",
4284+ "--lag-in-frames=0",
4285+ "--auto-alt-ref=0",
4286+ // One key frame only: every later frame is an inter frame,
4287+ // which is where this gate's intra blocks must sit. The
4288+ // MIN distance is what stops aomenc's scene-cut detector
4289+ // from inserting a second key frame at the cut this gate's
4290+ // source deliberately contains.
4291+ "--kf-max-dist=1000",
4292+ "--kf-min-dist=1000",
4293+ "--threads=1",
4294+ "--row-mt=0",
4295+ "--enable-order-hint=0",
4296+ "--enable-warped-motion=0",
4297+ "--enable-obmc=0",
4298+ "--enable-masked-comp=0",
4299+ "--enable-interintra-comp=0",
4300+ "--enable-dist-wtd-comp=0",
4301+ "--enable-diff-wtd-comp=0",
4302+ "--enable-onesided-comp=0",
4303+ "--enable-interintra-wedge=0",
4304+ "--enable-smooth-interintra=0",
4305+ "--enable-ab-partitions=0",
4306+ "--enable-1to4-partitions=0",
4307+ "--enable-filter-intra=0",
4308+ "--enable-smooth-intra=0",
4309+ "--enable-paeth-intra=0",
4310+ "--enable-directional-intra=0",
4311+ "--enable-angle-delta=0",
4312+ "--enable-cdef=0",
4313+ "--enable-restoration=0",
4314+ "--enable-palette=0",
4315+ "--enable-intrabc=0",
4316+ "--enable-cfl-intra=0",
4317+ "--enable-ref-frame-mvs=0",
4318+ // Per-arm overrides go LAST (aomenc keeps the last
4319+ // occurrence of a repeated --enable-* flag): the intra
4320+ // tx_depth symbol only exists under TX_MODE_SELECT, and
4321+ // rect partitions are a separate named refusal.
4322+ "--enable-tx-size-search=1",
4323+ "--enable-rect-partitions=0",
4324+ "--max-partition-size=32",
4325+ // Sub-16 inter partitions are a separate named refusal,
4326+ // as is the 8x8 intra leaf's own TX_4X4 split.
4327+ "--min-partition-size=16",
4328+ "--obu",
4329+ "-o",
4330+ "-",
4331+ "-",
4332+ ])
4333+ .stdin(Stdio::piped())
4334+ .stdout(Stdio::piped())
4335+ .stderr(Stdio::piped())
4336+ .spawn()
4337+ .expect("aomenc failed to start");
4338+ child
4339+ .stdin
4340+ .take()
4341+ .expect("aomenc stdin")
4342+ .write_all(&y4m.stdout)
4343+ .expect("writing y4m to aomenc");
4344+ let out = child.wait_with_output().expect("aomenc failed to run");
4345+ assert!(
4346+ out.status.success(),
4347+ "aomenc refused the fixture: {}",
4348+ String::from_utf8_lossy(&out.stderr)
4349+ );
4350+ let stream = out.stdout;
4351+ let before = decode::intra_in_inter_split_tx_hits();
4352+ let frames = match decode_stream(&stream) {
4353+ Ok(frames) => frames,
4354+ Err(e) => {
4355+ let msg = e.to_string();
4356+ assert!(
4357+ msg.contains("unsupported"),
4358+ "{name} decode failed outright (seed {seed}): {msg}"
4359+ );
4360+ refusals.push(format!("seed {seed}: {msg}"));
4361+ continue;
4362+ }
4363+ };
4364+ let after = decode::intra_in_inter_split_tx_hits();
4365+ let mut per_size = [0usize; 4];
4366+ for i in 0..4 {
4367+ per_size[i] = after[i] - before[i];
4368+ }
4369+ // class [[gate-skips-on-its-own-failure]]: a decode that
4370+ // succeeded is ALWAYS pixel-compared below; the counter only
4371+ // decides whether the attempt counts as firing.
4372+ let counted = per_size.iter().sum::<usize>() != 0;
4373+ if !counted {
4374+ uncounted_exact += 1;
4375+ refusals.push(format!(
4376+ "seed {seed}: decoded and pixel-compared, but no intra block in an inter \
4377+ frame split its transform"
4378+ ));
4379+ }
4380+ let ffmpeg_frames = if bit_depth == 10 {
4381+ ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
4382+ } else {
4383+ ffmpeg_decode_sequence(&stream, width, height, frame_count)
4384+ };
4385+ assert_eq!(frames.len(), frame_count);
4386+ eprintln!(
4387+ "{name} seed={seed}: split intra-in-inter blocks 8x8={} 16x16={} 32x32={} \
4388+ 64x64={}",
4389+ per_size[0], per_size[1], per_size[2], per_size[3]
4390+ );
4391+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
4392+ for (plane, (g, w)) in [
4393+ ("Y", (&got.y, &want.y)),
4394+ ("U", (&got.u, &want.u)),
4395+ ("V", (&got.v, &want.v)),
4396+ ] {
4397+ let stride = if plane == "Y" { width } else { width / 2 };
4398+ if let Some(at) = g.iter().zip(w.iter()).position(|(a, b)| a != b) {
4399+ eprintln!(
4400+ "{name} seed={seed}: frame {i} {plane} first diff at ({}, {}) got {} \
4401+ want {} ({} samples differ)",
4402+ at % stride,
4403+ at / stride,
4404+ g[at],
4405+ w[at],
4406+ g.iter().zip(w.iter()).filter(|(a, b)| a != b).count(),
4407+ );
4408+ }
4409+ }
4410+ }
4411+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
4412+ assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg (seed {seed})");
4413+ assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})");
4414+ assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})");
4415+ }
4416+ if counted {
4417+ gate_buckets(
4418+ &name,
4419+ 1,
4420+ uncounted_exact,
4421+ refusals.len() - uncounted_exact as usize,
4422+ );
4423+ return;
4424+ }
4425+ }
4426+ gate_buckets(
4427+ &name,
4428+ 0,
4429+ uncounted_exact,
4430+ refusals.len() - uncounted_exact as usize,
4431+ );
4432+ panic!(
4433+ "{name} never observed a split-transform intra block in an inter frame:\n{}",
4434+ refusals.join("\n")
4435+ );
4436+ }
4437+
4438+ /// lane-fiinter r1 (class [[symbol-consumption-gap]] +
4439+ /// [[tool-disabled-in-every-gate]]): a real aomenc inter sequence with
4440+ /// `--enable-filter-intra=1` (aomenc's own default -- every inter gate
4441+ /// recipe before this one pinned it OFF, so nothing ever exercised it) in
4442+ /// which the RD picks an INTRA block inside an inter frame and gives it
4443+ /// filter intra. `read_intra_block_mode_info` reads `use_filter_intra`
4444+ /// there exactly as a key frame does; this decoder read no such symbol at
4445+ /// all until this round, so such a stream desynced at that symbol and
4446+ /// decoded silently wrong. Hard-asserts
4447+ /// [`decode::intra_in_inter_filter_intra_hits`]: an attempt that never
4448+ /// produced one proves nothing, and exhausting every attempt is a
4449+ /// FAILURE, not a SKIP.
4450+ #[test]
4451+ fn a_real_aomenc_inter_sequence_with_filter_intra_on_an_intra_block_decodes_pixel_exact() {
4452+ filter_intra_in_inter_gate(8);
4453+ }
4454+
4455+ /// The 10-bit arm (both of the user's films are `yuv420p10le`).
4456+ #[test]
4457+ fn a_real_aomenc_10bit_inter_sequence_with_filter_intra_on_an_intra_block_decodes_pixel_exact()
4458+ {
4459+ filter_intra_in_inter_gate(10);
4460+ }
4461+
4462+ fn filter_intra_in_inter_gate(bit_depth: u32) {
4463+ let name = format!("filter_intra_in_inter_gate({bit_depth})");
4464+ if !have_ffmpeg() {
4465+ eprintln!("SKIP {name}: no ffmpeg");
4466+ return;
4467+ }
4468+ if !have_aomenc() {
4469+ eprintln!("SKIP {name}: no aomenc at {}", aomenc_path().display());
4470+ return;
4471+ }
4472+ let (width, height, frame_count) = (64usize, 64usize, 8usize);
4473+ let mut refusals = Vec::new();
4474+ let mut uncounted_exact = 0u32;
4475+ for attempt in 0..40u32 {
4476+ let seed = 42 + attempt;
4477+ // A zooming fractal: every frame moves (so the sequence is
4478+ // genuinely inter-coded) and keeps sharp new detail entering at
4479+ // the borders, which is what makes aomenc's RD choose an INTRA
4480+ // block inside an inter frame -- and then split its transform.
4481+ // A zooming fractal with a hard CUT halfway (`overlay` switching
4482+ // a second, unrelated fractal on at frame 4): after the cut every
4483+ // block is unpredictable from the reference, which is what makes
4484+ // aomenc code INTRA blocks inside an inter frame -- and at this
4485+ // cq the RD then splits their transforms.
4486+ let source = format!(
4487+ "mandelbrot=size=64x64:start_scale={}:rate=25[a];\
4488+ mandelbrot=size=64x64:start_scale={}:rate=25[b];\
4489+ [a][b]overlay=enable='gte(n,4)'",
4490+ 5.0 - f64::from(attempt) * 0.06,
4491+ 0.9 + f64::from(attempt) * 0.11
4492+ );
4493+ let y4m = Command::new("ffmpeg")
4494+ .args([
4495+ "-v",
4496+ "error",
4497+ "-f",
4498+ "lavfi",
4499+ "-i",
4500+ &source,
4501+ // Desaturated chroma keeps `uv_mode` on DC_PRED, so the
4502+ // still-refused directional-chroma gaps never fire and
4503+ // luma detail alone drives the transform split.
4504+ "-vf",
4505+ "hue=s=0",
4506+ "-pix_fmt",
4507+ if bit_depth == 10 { "yuv420p10le" } else { "yuv420p" },
4508+ "-strict",
4509+ "-1",
4510+ "-t",
4511+ "0.32",
4512+ "-f",
4513+ "yuv4mpegpipe",
4514+ "-strict",
4515+ "-1",
4516+ "-",
4517+ ])
4518+ .stdin(Stdio::null())
4519+ .stdout(Stdio::piped())
4520+ .stderr(Stdio::piped())
4521+ .output()
4522+ .expect("ffmpeg failed to run");
4523+ assert!(
4524+ y4m.status.success(),
4525+ "ffmpeg fixture: {}",
4526+ String::from_utf8_lossy(&y4m.stderr)
4527+ );
4528+ let depth_args: &[&str] = if bit_depth == 10 {
4529+ &["-b", "10", "--input-bit-depth=10"]
4530+ } else {
4531+ &[]
4532+ };
4533+ let mut child = Command::new(aomenc_path())
4534+ .args(depth_args)
4535+ .args([
4536+ "--codec=av1",
4537+ "--passes=1",
4538+ "--end-usage=q",
4539+ "--cq-level=30",
4540+ "--cpu-used=0",
4541+ "--lag-in-frames=0",
4542+ "--auto-alt-ref=0",
4543+ // One key frame only: every later frame is an inter frame,
4544+ // which is where this gate's intra blocks must sit. The
4545+ // MIN distance is what stops aomenc's scene-cut detector
4546+ // from inserting a second key frame at the cut this gate's
4547+ // source deliberately contains.
4548+ "--kf-max-dist=1000",
4549+ "--kf-min-dist=1000",
4550+ "--threads=1",
4551+ "--row-mt=0",
4552+ "--enable-order-hint=0",
4553+ "--enable-warped-motion=0",
4554+ "--enable-obmc=0",
4555+ "--enable-masked-comp=0",
4556+ "--enable-interintra-comp=0",
4557+ "--enable-dist-wtd-comp=0",
4558+ "--enable-diff-wtd-comp=0",
4559+ "--enable-onesided-comp=0",
4560+ "--enable-interintra-wedge=0",
4561+ "--enable-smooth-interintra=0",
4562+ "--enable-ab-partitions=0",
4563+ "--enable-1to4-partitions=0",
4564+ "--enable-smooth-intra=0",
4565+ "--enable-paeth-intra=0",
4566+ "--enable-directional-intra=0",
4567+ "--enable-angle-delta=0",
4568+ "--enable-cdef=0",
4569+ "--enable-restoration=0",
4570+ "--enable-palette=0",
4571+ "--enable-intrabc=0",
4572+ "--enable-cfl-intra=0",
4573+ "--enable-ref-frame-mvs=0",
4574+ // Per-arm overrides go LAST (aomenc keeps the last
4575+ // occurrence of a repeated --enable-* flag): the intra
4576+ // tx_depth symbol only exists under TX_MODE_SELECT, and
4577+ // rect partitions are a separate named refusal.
4578+ "--enable-filter-intra=1",
4579+ "--enable-tx-size-search=1",
4580+ "--enable-rect-partitions=0",
4581+ "--max-partition-size=32",
4582+ // Sub-16 inter partitions are a separate named refusal,
4583+ // as is the 8x8 intra leaf's own TX_4X4 split.
4584+ "--min-partition-size=16",
4585+ "--obu",
4586+ "-o",
4587+ "-",
4588+ "-",
4589+ ])
4590+ .stdin(Stdio::piped())
4591+ .stdout(Stdio::piped())
4592+ .stderr(Stdio::piped())
4593+ .spawn()
4594+ .expect("aomenc failed to start");
4595+ child
4596+ .stdin
4597+ .take()
4598+ .expect("aomenc stdin")
4599+ .write_all(&y4m.stdout)
4600+ .expect("writing y4m to aomenc");
4601+ let out = child.wait_with_output().expect("aomenc failed to run");
4602+ assert!(
4603+ out.status.success(),
4604+ "aomenc refused the fixture: {}",
4605+ String::from_utf8_lossy(&out.stderr)
4606+ );
4607+ let stream = out.stdout;
4608+ let before = decode::intra_in_inter_filter_intra_hits();
4609+ let frames = match decode_stream(&stream) {
4610+ Ok(frames) => frames,
4611+ Err(e) => {
4612+ let msg = e.to_string();
4613+ assert!(
4614+ msg.contains("unsupported"),
4615+ "{name} decode failed outright (seed {seed}): {msg}"
4616+ );
4617+ refusals.push(format!("seed {seed}: {msg}"));
4618+ continue;
4619+ }
4620+ };
4621+ let fired = decode::intra_in_inter_filter_intra_hits() - before;
4622+ // class [[gate-skips-on-its-own-failure]]: a decode that
4623+ // succeeded is ALWAYS pixel-compared below; the counter only
4624+ // decides whether the attempt counts as firing.
4625+ let counted = fired != 0;
4626+ if !counted {
4627+ uncounted_exact += 1;
4628+ refusals.push(format!(
4629+ "seed {seed}: decoded and pixel-compared, but no intra block in an inter \
4630+ frame used filter intra"
4631+ ));
4632+ }
4633+ let ffmpeg_frames = if bit_depth == 10 {
4634+ ffmpeg_decode_sequence_10bit(&stream, width, height, frame_count)
4635+ } else {
4636+ ffmpeg_decode_sequence(&stream, width, height, frame_count)
4637+ };
4638+ assert_eq!(frames.len(), frame_count);
4639+ eprintln!(
4640+ "{name} seed={seed}: filter-intra blocks inside inter frames = {fired}"
4641+ );
4642+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
4643+ for (plane, (g, w)) in [
4644+ ("Y", (&got.y, &want.y)),
4645+ ("U", (&got.u, &want.u)),
4646+ ("V", (&got.v, &want.v)),
4647+ ] {
4648+ let stride = if plane == "Y" { width } else { width / 2 };
4649+ if let Some(at) = g.iter().zip(w.iter()).position(|(a, b)| a != b) {
4650+ eprintln!(
4651+ "{name} seed={seed}: frame {i} {plane} first diff at ({}, {}) got {} \
4652+ want {} ({} samples differ)",
4653+ at % stride,
4654+ at / stride,
4655+ g[at],
4656+ w[at],
4657+ g.iter().zip(w.iter()).filter(|(a, b)| a != b).count(),
4658+ );
4659+ }
4660+ }
4661+ }
4662+ for (i, (got, want)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
4663+ assert_eq!(got.y, want.y, "frame {i} luma vs ffmpeg (seed {seed})");
4664+ assert_eq!(got.u, want.u, "frame {i} U vs ffmpeg (seed {seed})");
4665+ assert_eq!(got.v, want.v, "frame {i} V vs ffmpeg (seed {seed})");
4666+ }
4667+ if counted {
4668+ gate_buckets(
4669+ &name,
4670+ 1,
4671+ uncounted_exact,
4672+ refusals.len() - uncounted_exact as usize,
4673+ );
4674+ return;
4675+ }
4676+ }
4677+ gate_buckets(
4678+ &name,
4679+ 0,
4680+ uncounted_exact,
4681+ refusals.len() - uncounted_exact as usize,
4682+ );
4683+ panic!(
4684+ "{name} never observed a filter-intra intra block in an inter frame:\n{}",
4685+ refusals.join("\n")
4686+ );
4687+ }
4688+
4183 /// lane-chroma r2 stage 1: a real aomenc key frame with4689 /// lane-chroma r2 stage 1: a real aomenc key frame with
4184 /// `--enable-smooth-intra=1` (opposite of every sibling recipe's `=0`)4690 /// `--enable-smooth-intra=1` (opposite of every sibling recipe's `=0`)
4185 /// and `--enable-paeth-intra=0` -- paeth chroma stays off so the still-4691 /// and `--enable-paeth-intra=0` -- paeth chroma stays off so the still-
lanes/fiinter-r1.report.mdadded+95 -0
@@ -0,0 +1,95 @@
1+# lane-fiinter r1 -- `use_filter_intra` on an intra block inside an inter frame
2+
3+Branch `lane-fiinter`, rebased onto main `eebf24e` (charter's base `lane-intrainter e841b2a`
4+replayed onto main; no conflicts).
5+
6+## Premise, re-measured
7+
8+`decode_inter_block`'s INTRA arm and `decode_inter_block8`'s 8x8 INTRA arm read
9+`y_mode` -> `angle_delta_y` -> `uv_mode` (+cfl/angle) -> palette and then went straight to
10+`read_block_tx_size` -- no `use_filter_intra` symbol at all, while libaom's
11+`read_intra_block_mode_info` (decodemv.c) ends with `read_filter_intra_mode_info` in exactly
12+that place, key frame or inter frame alike. Every inter gate recipe in `stream.rs` spelled
13+`--enable-filter-intra=0` (69 occurrences), so nothing had ever exercised it; aomenc's own
14+default is ON, so his films' inter frames desynced silently at the first such block.
15+Classes: [[symbol-consumption-gap]] + [[tool-disabled-in-every-gate]].
16+
17+## What changed
18+
19+- `crates/ec-av1/src/decode.rs:64-80` -- `INTRA_IN_INTER_FILTER_INTRA_HITS` counter +
20+ `intra_in_inter_filter_intra_hits()`, the gate's firing proof (the existing
21+ `FILTER_INTRA_HITS` is also incremented, so the key-frame gates' deltas stay meaningful).
22+- `crates/ec-av1/src/decode.rs:830-856` -- `ENABLE_FILTER_INTRA_INTER` thread-local, set by
23+ `set_inter_tx_mode(tx_select, reduced_tx_set, enable_filter_intra)`; same frame-constant
24+ stash `TX_SELECT_INTER`/`REDUCED_TX_SET_INTER` already use rather than a 51st
25+ `decode_inter_block` parameter.
26+- `crates/ec-av1/src/decode.rs:17497+` -- `decode_inter_frame_tile_with_cdfs` takes
27+ `enable_filter_intra` (last param); `decode_inter_frame_tile` passes `false` (this crate's
28+ encoder never writes the sequence bit), `stream.rs:694` passes the sequence header's bit.
29+- `crates/ec-av1/src/decode.rs:15578-15594` (>=16x16 square intra-in-inter arm) and
30+ `:17188-17204` (8x8 leaf arm) -- `use_filter_intra` read via
31+ `cdfs.filter_intra[filter_intra_size_class(side)]` right after the palette syntax, then
32+ `filter_intra_mode`. `av1_filter_intra_allowed`'s `palette_size[0] == 0` term is implied (a
33+ real palette-Y block already returned by refusal); `filter_intra_size_class` returns `None`
34+ at 64x64, so no symbol is read there, matching `av1_filter_intra_allowed_bsize`.
35+- Same arms: `filter_intra` now threaded into every LUMA prediction/coefficient call --
36+ the per-TU split path (`y.reconstruct` and `read_plane` inside the `vartx_leaves` loop,
37+ i.e. lane-intrainter's split-tx path), the whole-block skip `reconstruct`, and the
38+ whole-block `read_plane`. Chroma keeps `None`, exactly as the key-frame square arm does.
39+ `read_plane`'s own `FIMODE_TO_INTRADIR` mapping (decode.rs:7445) supplies the tx_type CDF
40+ row per TU, so lane-tiny's filter-intra tx_type row fix applies here unchanged.
41+
42+## Gate
43+
44+`stream.rs:4438-4700`:
45+`a_real_aomenc_inter_sequence_with_filter_intra_on_an_intra_block_decodes_pixel_exact` (8-bit)
46+and `..._10bit_...` (10-bit), driven by `filter_intra_in_inter_gate(bit_depth)` -- the
47+intrainter recipe (mandelbrot + hard overlay cut at frame 4, cq30, `--kf-min-dist=1000`,
48+`--enable-tx-size-search=1`, `--max/min-partition-size=32/16`) with `--enable-filter-intra=1`.
49+The flag is spelled ONCE (the base `=0` deleted) so no aomenc precedence question arises;
50+arrival is proved decoder-side by the counter, per COMMON. Every decoded frame's Y/U/V is
51+compared against ffmpeg; a decode error is only accepted when its message contains
52+"unsupported"; running out of attempts panics (no SKIP).
53+
54+```
55+CARGO_TARGET_DIR=$HOME/.cache/cargo-target-fiinter EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 \
56+ cargo test -p ec-av1 --lib filter_intra_on_an_intra_block -- --nocapture
57+```
58+
59+EVIDENCE: $HOME/.cache/fiinter-suite.log | cargo test -p ec-av1 --lib filter_intra_on_an_intra_block | 8-bit seed 42: 11 filter-intra intra-in-inter blocks, 8 frames Y/U/V exact; 10-bit seed 47: 8 blocks, 8 frames exact; buckets counted-exact=1 uncounted-exact=0
60+
61+EVIDENCE: negative control (`&& false` in front of both new reads, decode.rs restored after) | same gate command | 8-bit: 40/40 attempts, 0 firings, 33 named refusals + 7 decoded-uncounted -> PANIC. The gate is not vacuous: without the read the stream desyncs.
62+
63+EVIDENCE: mutation sweep (`sed 's/--enable-filter-intra=0/=1/g' stream.rs`, restored after) | `cargo test -p ec-av1 --lib inter_sequence` | 15 passed / 0 failed / 2 ignored (both pre-existing `#[ignore]`s: the 10-bit 8x8-leaf-split twin and the tile-column 8x8 gate) -- every inter gate that passed with filter intra OFF still passes with it ON, including `..._split_transform_intra_block_...` at both depths.
64+
65+## Refusals
66+
67+None lifted -- there was no refusal here, only an unread symbol (which is the worse shape:
68+`refusal_inventory.rs` is unchanged and stays green). `gate_coverage.rs` needs no edit: its
69+coverage is derived from the `--enable-*` spellings in the gate source, and the two new tests
70+spell `--enable-filter-intra=1` at 8 and 10 bit.
71+
72+## Residue
73+
74+- deferred(a directional-intra-in-inter gate): the `"a nonzero angle delta (this encoder never
75+ writes one)"` refusal in both intra-in-inter arms stays. The symbol read itself is correct
76+ (`cdfs.angle_delta[mode - V_PRED]`, compared to `ANGLE_DELTA_ZERO`), so lifting it is
77+ mechanical -- but lifting a refusal without a gate that fires it is forbidden by COMMON, and
78+ this lane's recipe pins `--enable-angle-delta=0`/`--enable-directional-intra=0` (a nonzero
79+ delta would need its own source family). Unblocked by: an aomenc recipe that puts a
80+ directional intra block with a nonzero delta inside an inter frame.
81+- accepted: the 8x8-leaf arm's read is size-generic and compiles/decodes, but no gate proves it
82+ FIRED -- this gate pins `--min-partition-size=16`. The mutation sweep ran the 8x8-leaf-split
83+ gates with filter intra ON and they stayed pixel-exact, which bounds the risk but does not
84+ prove the symbol fired at 8x8.
85+- accepted: CfL/palette parity is unchanged from the key-frame arm -- a real palette-Y/UV block
86+ still refuses by name before the filter-intra read, and `UV_CFL_PRED` chroma alphas are read
87+ as before (filter intra is luma-only).
88+
89+## Suite + film
90+
91+`cargo test -p ec-av1 --lib` (systemd unit, log `$HOME/.cache/fiinter-suite.log`): **346 passed / 0 failed / 32 ignored**, 739 s.
92+
93+EVIDENCE: $HOME/.cache/fiinter-suite.log | systemd-run --user --unit=fiinter-suite ... cargo test -p ec-av1 --lib -j3 | test result: ok. 346 passed; 0 failed; 32 ignored
94+
95+EVIDENCE: scratchpad/hg-head.obu | cargo run -p ec-av1 --example decode_probe -- hg-head.obu | 18 frame headers parsed, now stops at `unsupported: AV1 tile (filter intra on a HORZ/VERT strip (this decoder predicts square-only))` -- i.e. his film really does carry filter intra, and the next blocker is the rect-strip filter-intra predictor (another lane), not the unread inter symbol this lane fixed.
lanes/intrainter-r1.handoff.mdadded+70 -0
@@ -0,0 +1,70 @@
1+# lane-intrainter r1 handoff
2+
3+Branch `lane-intrainter`, based on main `c729a38` (worktree was already at main's head; no rebase needed).
4+Code commit: `955ecf9` (`feat(av1): intra blocks in inter frames may split their luma transform`).
5+
6+## Implemented (all in `crates/ec-av1/src/decode.rs`)
7+
8+- `read_block_tx_size` (~9470): intra branch no longer refuses a split `tx_depth`. It calls
9+ `set_txfm_ctxs` with the RESOLVED transform (so later blocks' txfm ctx is right) and returns
10+ the transform-unit leaf list `(row_mi, col_mi, tx_px)` in raster order — the same shape the
11+ inter var-tx tree returns.
12+- `decode_inter_block` intra arm (~15490): the leaves ride the existing `vartx_leaves` slot; a
13+ per-TU loop predicts + codes each unit with `txbset_for(tx_px, reduced)` (INTRA tx set),
14+ `default_scan(tx_px)`, `Reach::of_tu` (block-relative availability), `luma_skip_ctx`
15+ (neighbour-magnitude txb_skip ctx, not the lone-TU 0), `around_mi`, `record_mi_luma`.
16+ Skip blocks predict PER UNIT too (an intra block reads tx_depth even when skip).
17+ Chroma is unchanged (its transform is not split). The function tail already ran
18+ `record_split_luma` + per-TU deblock edges whenever `vartx_leaves.is_some()`.
19+- Inter-frame intra syntax differences all pre-existed in that arm and are unchanged:
20+ `y_mode_cdf[size_group]` (not kf_y_mode), `uv_mode_cfl[mode]`, angle deltas, CfL alphas,
21+ palette-mode probes; angle_delta_y is refused nonzero, filter intra is not read in this arm.
22+- Counter `INTRA_IN_INTER_SPLIT_TX_HITS` + `intra_in_inter_split_tx_hits() -> [usize;4]`
23+ bucketed by block side 8/16/32/64, one increment per split block.
24+
25+## Sizes / refusals
26+
27+- Squares 16x16..64x64 through `decode_inter_block` are lifted (the code is size-generic).
28+ OBSERVED FIRING: 16x16 only (12 blocks 8-bit, 1 block 10-bit). 32/64 buckets stayed 0 under
29+ `--min/max-partition-size=16/32`; unproven above 16x16.
30+- NEW refusal (`decode_inter_block8`, ~17070, listed in refusal_inventory.rs:63 replacing the
31+ lifted string): "an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4
32+ transform units" — that leaf path has no per-TU intra prediction loop.
33+- RECT intra strips in inter frames stay refused earlier ("an intra-coded HORZ/VERT strip needs
34+ rectangular intra prediction this decoder does not code yet"), so no rect work was needed.
35+
36+## Gate state — PASSING, both depths
37+
38+`a_real_aomenc_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact` and
39+`a_real_aomenc_10bit_...` (`intra_in_inter_split_tx_gate` in stream.rs).
40+Real aomenc, 64x64, 8 frames, mandelbrot zoom with a HARD CUT at frame 4
41+(`overlay=enable='gte(n,4)'`), `--kf-min-dist=1000 --kf-max-dist=1000` (stops the scene-cut
42+detector inserting a second key frame), cq 30, overrides appended LAST. All frames Y/U/V vs
43+ffmpeg; decode errors only continue if they contain "unsupported"; exhausting 40 attempts panics.
44+
45+Run:
46+`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-intrainter cargo test -p ec-av1 --lib -- split_transform_intra_block --nocapture`
47+
48+Result: 8-bit seed 45 `16x16=12`, 10-bit seed 72 `16x16=1`, 0 differing samples, both `ok`.
49+No entropy ladder was needed — no divergence was ever observed.
50+
51+## Suite
52+
53+`$HOME/.cache/intrainter-suite.log` (unit `intrainter-suite-1788315424.service`), completed after
54+the turn cap: `test result: ok. 341 passed; 0 failed; 31 ignored; 0 measured` in 457.31s. Nothing
55+further is owed on the suite.
56+
57+
58+## Film
59+
60+Both `.../b6d8a07f.../scratchpad/reelc-head.obu` and `.../cdc46329.../scratchpad/reelc5.obu` stop at
61+"a coded HORZ/VERT strip whose chroma transform has no rect coefficient tables here" (lane-rectchroma
62+territory), NOT at this lane's refusal — the wall string in the charter was not reproducible on
63+these extracts (matches an existing ledger dead-end line).
64+
65+## Exact next step
66+
67+1. Merge (suite already green).
68+2. Optional follow-up round: prove 32x32/64x64 split intra-in-inter blocks (raise
69+ `--max-partition-size` to 64 and lower cq, assert the 32/64 buckets), and lift the 8x8 leaf's
70+ TX_4X4 2x2 grid in `decode_inter_block8`.
lanes/intrainter-r1.report.mdadded+63 -0
@@ -0,0 +1,63 @@
1+# lane-intrainter r1 — intra blocks in inter frames with a split luma transform
2+
3+Branch `lane-intrainter` off main `c729a38` (worktree already at main's head; no rebase needed).
4+Commit: `955ecf9`.
5+
6+## What changed
7+
8+- `crates/ec-av1/src/decode.rs` `read_block_tx_size` (~9470): the intra branch no longer
9+ refuses a `tx_depth` that resolves below the block side. It runs `set_txfm_ctxs` with the
10+ resolved transform (so later blocks' txfm ctx is right) and returns the transform-unit leaf
11+ list in the same `(row_mi, col_mi, tx_px)` shape the inter var-tx tree uses, raster order.
12+- `crates/ec-av1/src/decode.rs` `decode_inter_block` intra arm (~15490): the returned leaves ride
13+ the existing `vartx_leaves` slot, and a per-TU loop predicts + codes each unit
14+ (`txbset_for(tx_px, reduced)`, `default_scan(tx_px)`, `Reach::of_tu`, `luma_skip_ctx`,
15+ `around_mi`, `record_mi_luma`) exactly as `decode_block`'s key-frame multi-TU branch does —
16+ including the skip case, which predicts per unit rather than whole-block. Chroma is unchanged
17+ (its transform is not split). The function tail already did `record_split_luma` and per-TU
18+ deblock edges whenever `vartx_leaves.is_some()`, so intra split blocks inherit both.
19+- `crates/ec-av1/src/decode.rs` counter `INTRA_IN_INTER_SPLIT_TX_HITS` +
20+ `intra_in_inter_split_tx_hits() -> [usize; 4]` (bucketed 8/16/32/64), incremented once per
21+ split intra-in-inter block.
22+- `crates/ec-av1/src/decode.rs` `decode_inter_block8` (~17070): an 8x8 intra leaf whose depth
23+ resolves to TX_4X4 has no per-TU intra loop in that path — refused by name.
24+- `crates/ec-av1/src/refusal_inventory.rs:63`: lifted string replaced by the narrower
25+ `"an 8x8 intra leaf in an inter frame whose tx_depth splits it into 4x4 transform units"`.
26+- `crates/ec-av1/src/stream.rs`: new gate `intra_in_inter_split_tx_gate` + its 8/10-bit tests.
27+
28+## Gate
29+
30+`a_real_aomenc_inter_sequence_with_a_split_transform_intra_block_decodes_pixel_exact`
31+and `..._10bit_...`. Real aomenc, 64x64, 8 frames, mandelbrot zoom with a HARD CUT at frame 4
32+(`overlay=enable='gte(n,4)'` of a second fractal) so aomenc codes intra blocks inside an inter
33+frame; `--kf-min-dist=1000 --kf-max-dist=1000` stops the scene-cut detector inserting a second
34+key frame. Overrides (`--enable-tx-size-search=1`, `--enable-rect-partitions=0`,
35+`--max-partition-size=32`, `--min-partition-size=16`) are appended AFTER the base recipe
36+(last occurrence wins). Every decoded frame's Y, U and V are compared with ffmpeg; a decode
37+error only continues the attempt loop if it contains "unsupported"; exhausting all 40 attempts
38+is a panic, never a SKIP.
39+
40+Run:
41+`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-intrainter cargo test -p ec-av1 --lib -- split_transform_intra_block --nocapture`
42+
43+EVIDENCE: $HOME/.cache/intrainter-suite.log | aomenc cut-fractal stream, ours vs ffmpeg, all 8 frames Y/U/V | 8-bit seed 45: 12 split intra-in-inter 16x16 blocks, 0 differing samples; 10-bit seed 72: 1 such block, 0 differing samples
44+
45+## Suite
46+
47+`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-intrainter cargo test -p ec-av1 --lib`
48+(as user unit `intrainter-suite-1788315424.service`, log `$HOME/.cache/intrainter-suite.log`):
49+`test result: ok. 341 passed; 0 failed; 31 ignored; 0 measured` in 457.31s — includes every sibling
50+(inter_sequence*, tx_select, 8x8_leaf_split, split_transform_*, filter_intra_*, cfl,
51+refusal_inventory, gate_coverage).
52+
53+## Film
54+
55+`reelc-head.obu` and `reelc5.obu` both stop at "a coded HORZ/VERT strip whose chroma transform has no
56+rect coefficient tables here" (lane-rectchroma), not at this lane's refusal.
57+
58+## Residue
59+
60+- deferred(a follow-up arm at --max-partition-size=64 and a lower cq): 32x32/64x64 split
61+ intra-in-inter blocks never fired; the per-TU loop is size-generic but unproven above 16x16.
62+- deferred(a per-TU intra loop inside decode_inter_block8): the 8x8 leaf's TX_4X4 2x2 grid,
63+ now the narrower named refusal.