forge
Explore
Log in

Don't you dare go Hollow

merge: main (5d81a67) into lane-t900 -- rect4/rect64 txfm-band tails meet the in-inter band publication

Browse files at this commit

c11cb863edbeefac5fc7dd8bad4efd869d1ae991Ahmet Kaan GümüşParent: d52f6321395e7b
Both writes carry the same (tx_w,tx_h) for the same footprint, so the split
arms now publish twice with identical values; the in-inter publication stays
because it also covers the non-split and refusing exits.
crates/ec-av1/examples/decode_probe.rsmodified+66 -0
@@ -146,6 +146,72 @@ fn main() {
146 _ => continue,146 _ => continue,
147 };147 };
148 frames_seen += 1;148 frames_seen += 1;
149+ // lane-frame36: `EC_PROBE_HDR=1` prints one line per frame header, so a
150+ // silent wall can be triaged by "which header field is new at frame N"
151+ // before any pixel work (class: a header field parsed then never consumed).
152+ if std::env::var("EC_PROBE_HDR").is_ok() {
153+ let h = header;
154+ let gm: Vec<String> = h
155+ .global_motion
156+ .iter()
157+ .map(|w| format!("{:?}", w.model))
158+ .collect();
159+ println!(
160+ "HDR {}: type={:?} show={} showable={} show_existing={}({}) intra={} \
161+ size={}x{} up={} superres={}/{} order_hint={} primary_ref={} refresh={:#04x} \
162+ refs={:?} order_hints={:?} sign_bias={:?} err_res={} disable_cdf={} \
163+ screen_tools={} int_mv={} intrabc={} hp_mv={} interp={:?} switchable_motion={} \
164+ ref_mvs={} base_q={} seg={} deltaq={} deltalf={} lf_level={:?} lf_deltas={:?}/{:?} \
165+ cdef_bits={} lr={:?} tx_mode={:?} ref_sel={} skip_mode={}({:?}) warp={} \
166+ reduced_tx={} gm={:?} grain={}/seed={} lossless={}",
167+ frames_seen - 1,
168+ h.frame_type,
169+ h.show_frame,
170+ h.showable_frame,
171+ h.show_existing_frame,
172+ h.frame_to_show_map_idx,
173+ h.frame_is_intra,
174+ h.frame_width,
175+ h.frame_height,
176+ h.upscaled_width,
177+ h.use_superres,
178+ h.superres_denom,
179+ h.order_hint,
180+ h.primary_ref_frame,
181+ h.refresh_frame_flags,
182+ h.ref_frame_idx,
183+ h.order_hints,
184+ h.ref_frame_sign_bias,
185+ h.error_resilient_mode,
186+ h.disable_cdf_update,
187+ h.allow_screen_content_tools,
188+ h.force_integer_mv,
189+ h.allow_intrabc,
190+ h.allow_high_precision_mv,
191+ h.interpolation_filter,
192+ h.is_motion_mode_switchable,
193+ h.use_ref_frame_mvs,
194+ h.quantization.base_q_idx,
195+ h.segmentation.enabled,
196+ h.delta.q_present,
197+ h.delta.lf_present,
198+ h.loop_filter.level,
199+ h.loop_filter.ref_deltas,
200+ h.loop_filter.mode_deltas,
201+ h.cdef.bits,
202+ h.loop_restoration.frame_restoration_type,
203+ h.tx_mode,
204+ h.reference_select,
205+ h.skip_mode_present,
206+ h.skip_mode_frame,
207+ h.allow_warped_motion,
208+ h.reduced_tx_set,
209+ gm,
210+ h.film_grain.apply_grain,
211+ h.film_grain.grain_seed,
212+ h.coded_lossless,
213+ );
214+ }
149 let t = &header.tile_info;215 let t = &header.tile_info;
150 let entry = (t.cols, t.rows, t.uniform_spacing, t.context_update_tile_id);216 let entry = (t.cols, t.rows, t.uniform_spacing, t.context_update_tile_id);
151 if !seen.contains(&entry) {217 if !seen.contains(&entry) {
crates/ec-av1/fixtures/reelb_arf_witness.obuadded+0 -0

Binary file changed

crates/ec-av1/src/decode.rsmodified+91 -1
@@ -1107,6 +1107,9 @@ pub(crate) fn vartx_rect_leaf4_hits() -> [usize; 2] {
1107 1107
1108 /// Records one rectangular var-tx leaf.1108 /// Records one rectangular var-tx leaf.
1109 fn vartx_rect_leaf_hit(tw: usize, th: usize) {1109 fn vartx_rect_leaf_hit(tw: usize, th: usize) {
1110+ if std::env::var_os("EC_VARTXLEAF").is_some() {
1111+ eprintln!("EC_VARTXLEAF tw={tw} th={th}");
1112+ }
1110 let cell = if tw.min(th) == 4 { &VARTX_RECT_LEAF4_HITS } else { &VARTX_RECT_LEAF_HITS };1113 let cell = if tw.min(th) == 4 { &VARTX_RECT_LEAF4_HITS } else { &VARTX_RECT_LEAF_HITS };
1111 cell.with(|c| {1114 cell.with(|c| {
1112 let mut h = c.get();1115 let mut h = c.get();
@@ -2652,6 +2655,18 @@ pub(crate) fn sub16_split_hits() -> usize {
2652 SUB16_SPLIT_HITS.with(|c| c.get())2655 SUB16_SPLIT_HITS.with(|c| c.get())
2653 }2656 }
2654 2657
2658+// lane-frame36 r2: superblock-level strips ([`decode_block_rect64`]) whose
2659+// luma transform is SPLIT and which therefore leave through that fn's early
2660+// return -- the arm that published no `TXFM_CONTEXT` band until this round.
2661+thread_local! {
2662+ static RECT64_SPLIT_TXFM_PUBLISH_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
2663+}
2664+
2665+/// Current value of `RECT64_SPLIT_TXFM_PUBLISH_HITS`.
2666+pub(crate) fn rect64_split_txfm_publish_hits() -> usize {
2667+ RECT64_SPLIT_TXFM_PUBLISH_HITS.with(|c| c.get())
2668+}
2669+
2655 /// Current value of `RECT4_COEFF_HITS`.2670 /// Current value of `RECT4_COEFF_HITS`.
2656 pub(crate) fn rect4_coeff_hits() -> usize {2671 pub(crate) fn rect4_coeff_hits() -> usize {
2657 RECT4_COEFF_HITS.with(|c| c.get())2672 RECT4_COEFF_HITS.with(|c| c.get())
@@ -4326,7 +4341,7 @@ fn read_coeffs_rect(
4326 };4341 };
4327 if rect_trace {4342 if rect_trace {
4328 let (rng, _) = dec.debug_state();4343 let (rng, _) = dec.debug_state();
4329- eprintln!("EC_COEFF_STEP tag=sign_rect pos={pos} sign={} rng={rng}", u8::from(negative));4344+ eprintln!("EC_COEFF_STEP tag=sign_rect pos={pos} sign={} dcctx={sign_ctx} rng={rng}", u8::from(negative));
4330 }4345 }
4331 let level = if level.abs_diff(0) as i32 > MAX_BR_LEVEL {4346 let level = if level.abs_diff(0) as i32 > MAX_BR_LEVEL {
4332 let g = read_golomb(dec)?;4347 let g = read_golomb(dec)?;
@@ -5386,6 +5401,15 @@ impl Neighbours {
5386 left_coded |= left.level != 0;5401 left_coded |= left.level != 0;
5387 vote += dc_vote(left.dc);5402 vote += dc_vote(left.dc);
5388 }5403 }
5404+ if plane == 0 && std::env::var_os("EC_DCDUMP").is_some() {
5405+ let ab: Vec<String> = (0..w_mi)
5406+ .map(|k| format!("{:?}/{}", self.above[mi_c + k][0].dc, self.above[mi_c + k][0].level))
5407+ .collect();
5408+ let lf: Vec<String> = (0..h_mi)
5409+ .map(|k| format!("{:?}/{}", self.left[mi_r + k][0].dc, self.left[mi_r + k][0].level))
5410+ .collect();
5411+ eprintln!("EC_DCDUMP mi=({mi_r},{mi_c}) wh=({w},{h}) vote={vote} above=[{}] left=[{}]", ab.join(","), lf.join(","));
5412+ }
5389 (above_coded, left_coded, vote)5413 (above_coded, left_coded, vote)
5390 })5414 })
5391 }5415 }
@@ -8710,6 +8734,13 @@ fn decode_block_rect4(
8710 if !skip {8734 if !skip {
8711 RECT4_COEFF_HITS.with(|c| c.set(c.get() + 1));8735 RECT4_COEFF_HITS.with(|c| c.set(c.get() + 1));
8712 }8736 }
8737+ // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,
8738+ // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter
8739+ // frame, so this 1:4 strip -- which is also the INTER frame's reader
8740+ // for 32x8/8x32 ([`decode_intra_rect4_in_inter`]) -- publishes its
8741+ // transform size in both TXFM_CONTEXT bands. Without it the next block
8742+ // reads the row's stale value.
8743+ txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh));
8713 return Ok((mode, uv_predict_mode));8744 return Ok((mode, uv_predict_mode));
8714 }8745 }
8715 // The coarse (16-px [`SUB`] cell) mode/side arrays cannot name a strip8746 // The coarse (16-px [`SUB`] cell) mode/side arrays cannot name a strip
@@ -8860,6 +8891,13 @@ fn decode_block_rect4(
8860 } else {8891 } else {
8861 RECT4_32_VERT_HITS.with(|c| c.set(c.get() + 1));8892 RECT4_32_VERT_HITS.with(|c| c.set(c.get() + 1));
8862 }8893 }
8894+ // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,
8895+ // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter
8896+ // frame, so this 1:4 strip -- which is also the INTER frame's reader
8897+ // for 32x8/8x32 ([`decode_intra_rect4_in_inter`]) -- publishes its
8898+ // transform size in both TXFM_CONTEXT bands. Without it the next block
8899+ // reads the row's stale value.
8900+ txfm_partition_update_rect(neighbours, (mi_r, mi_c), (bw, bh), (bw, bh));
8863 return Ok((mode, uv_predict_mode));8901 return Ok((mode, uv_predict_mode));
8864 };8902 };
8865 if let Some(b) = &palette_y_buf {8903 if let Some(b) = &palette_y_buf {
@@ -8922,6 +8960,13 @@ fn decode_block_rect4(
8922 } else {8960 } else {
8923 RECT4_32_VERT_HITS.with(|c| c.set(c.get() + 1));8961 RECT4_32_VERT_HITS.with(|c| c.set(c.get() + 1));
8924 }8962 }
8963+ // lane-frame36 r2 (same shape as `decode_block_rect64`'s split arm,
8964+ // swept this round): `set_txfm_ctxs` runs for EVERY block of an inter
8965+ // frame, so this 1:4 strip -- which is also the INTER frame's reader
8966+ // for 32x8/8x32 ([`decode_intra_rect4_in_inter`]) -- publishes its
8967+ // transform size in both TXFM_CONTEXT bands. Without it the next block
8968+ // reads the row's stale value.
8969+ txfm_partition_update_rect(neighbours, (mi_r, mi_c), (bw, bh), (bw, bh));
8925 Ok((mode, uv_predict_mode))8970 Ok((mode, uv_predict_mode))
8926 }8971 }
8927 8972
@@ -9486,6 +9531,17 @@ fn decode_rect4_16_strip(
9486 record_strip_palette(9531 record_strip_palette(
9487 neighbours, lmi, bw, bh, pal_y_size, pal_y_colors, pal_uv_size, pal_uv_colors,9532 neighbours, lmi, bw, bh, pal_y_size, pal_y_colors, pal_uv_size, pal_uv_colors,
9488 );9533 );
9534+ // `set_txfm_ctxs(mbmi->tx_size, n4_w, n4_h, skip && is_inter, xd)`
9535+ // (libaom `decode_token_recon_block`, run for EVERY block of an inter
9536+ // frame): the above row records `tx_size_wide` over the block's width and
9537+ // the left column `tx_size_high` over its height. This 1:4 strip reader is
9538+ // also the INTER frame's reader for the shape ([`decode_intra_rect4_in_inter`]),
9539+ // and it published neither band -- so the block after a 64x16 strip read
9540+ // the row's init value 64 as its left transform height and took
9541+ // `tx_size_cat3` row 1 where libaom takes row 0 (lane-frame36 r1: the
9542+ // 3840x1608 10-bit stream's first silent wall, decode-order frame 33 at
9543+ // mi(16,480)). Same write as [`set_txfm_ctxs`], rect-aware.
9544+ txfm_partition_update_rect(neighbours, lmi, (tx_w, tx_h), (bw, bh));
9489 Ok((mode, last_uv_mode, (tx_w, tx_h)))9545 Ok((mode, last_uv_mode, (tx_w, tx_h)))
9490 }9546 }
9491 9547
@@ -9688,6 +9744,16 @@ fn decode_block_rect64(
9688 let (puv_size, puv_colors) =9744 let (puv_size, puv_colors) =
9689 palette_uv.as_ref().map_or((0, [0u16; 8]), |p| (p.size, p.u_colors));9745 palette_uv.as_ref().map_or((0, [0u16; 8]), |p| (p.size, p.u_colors));
9690 neighbours.record_palette_uv_rect((mi_r, mi_c), bw, bh, puv_size, puv_colors);9746 neighbours.record_palette_uv_rect((mi_r, mi_c), bw, bh, puv_size, puv_colors);
9747+ // lane-frame36 r2: `set_txfm_ctxs` runs for EVERY block and this early
9748+ // return skips the fn's own tail, so a SPLIT superblock-level strip
9749+ // published no TXFM_CONTEXT band and the next block read the row's init
9750+ // value 64 as its left transform height. Measured on the 10-bit
9751+ // 3840x1608 stream, decode-order frame 33: after the split 16x64 strip
9752+ // at mi(192,140) (`tx_depth=1` -> TX_16X32) the 32x64 block at
9753+ // mi(192,144) took `tx_size_cat3` row 2 where libaom takes row 1. The
9754+ // bands carry the SPLIT unit's size, not the block's.
9755+ txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh));
9756+ RECT64_SPLIT_TXFM_PUBLISH_HITS.with(|c| c.set(c.get() + 1));
9691 RECT_PARTITION_HITS.with(|c| c.set(c.get() + 1));9757 RECT_PARTITION_HITS.with(|c| c.set(c.get() + 1));
9692 return Ok(());9758 return Ok(());
9693 }9759 }
@@ -10005,6 +10071,17 @@ fn decode_block_rect64(
10005 neighbours.record_palette_uv_rect((mi_r, mi_c), bw, bh, puv_size, puv_colors);10071 neighbours.record_palette_uv_rect((mi_r, mi_c), bw, bh, puv_size, puv_colors);
10006 neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, skip);10072 neighbours.fill_skip_grid_rect((mi_r, mi_c), bw / MI, bh / MI, skip);
10007 neighbours.fill_lf_grid_rect((mi_r, mi_c), bw / MI, bh / MI, tx_w as u8, tx_h as u8, 0);10073 neighbours.fill_lf_grid_rect((mi_r, mi_c), bw / MI, bh / MI, tx_w as u8, tx_h as u8, 0);
10074+ // `set_txfm_ctxs(mbmi->tx_size, n4_w, n4_h, skip && is_inter, xd)`
10075+ // (libaom `decode_token_recon_block`, run for EVERY block of an inter
10076+ // frame): the above row records `tx_size_wide` over the block's width and
10077+ // the left column `tx_size_high` over its height. This 1:4 strip reader is
10078+ // also the INTER frame's reader for the shape ([`decode_intra_rect4_in_inter`]),
10079+ // and it published neither band -- so the block after a 64x16 strip read
10080+ // the row's init value 64 as its left transform height and took
10081+ // `tx_size_cat3` row 1 where libaom takes row 0 (lane-frame36 r1: the
10082+ // 3840x1608 10-bit stream's first silent wall, decode-order frame 33 at
10083+ // mi(16,480)). Same write as [`set_txfm_ctxs`], rect-aware.
10084+ txfm_partition_update_rect(neighbours, (mi_r, mi_c), (tx_w, tx_h), (bw, bh));
10008 SB_RECT_HITS.with(|c| c.set(c.get() + 1));10085 SB_RECT_HITS.with(|c| c.set(c.get() + 1));
10009 match (bw, bh) {10086 match (bw, bh) {
10010 (64, 16) => SB_RECT4_HORZ_HITS.with(|c| c.set(c.get() + 1)),10087 (64, 16) => SB_RECT4_HORZ_HITS.with(|c| c.set(c.get() + 1)),
@@ -13538,6 +13615,19 @@ fn tx_size_context_txfm(n: &Neighbours, (mi_r, mi_c): (usize, usize), side: usiz
13538 if has_left && n.left_inter[mi_r] {13615 if has_left && n.left_inter[mi_r] {
13539 left = n.left_side_mi[mi_r] >= side;13616 left = n.left_side_mi[mi_r] >= side;
13540 }13617 }
13618+ if std::env::var_os("EC_TXCTX").is_some() {
13619+ eprintln!(
13620+ "EC_TXCTX mi={mi_r},{mi_c} own={side} ha={has_above} hl={has_left} \
13621+ above_txfm={} left_txfm={} above_inter={} left_inter={} above_side={} left_side={} \
13622+ above={above} left={left}",
13623+ n.above_txfm[mi_c],
13624+ n.left_txfm[mi_r],
13625+ n.above_inter[mi_c],
13626+ n.left_inter[mi_r],
13627+ n.above_side_mi[mi_c],
13628+ n.left_side_mi[mi_r],
13629+ );
13630+ }
13541 match (has_above, has_left) {13631 match (has_above, has_left) {
13542 (true, true) => usize::from(above) + usize::from(left),13632 (true, true) => usize::from(above) + usize::from(left),
13543 (true, false) => usize::from(above),13633 (true, false) => usize::from(above),
crates/ec-av1/src/stream.rsmodified+123 -27
@@ -8803,8 +8803,18 @@ mod tests {
8803 let (width, height) =8803 let (width, height) =
8804 if firing { (384usize, 256usize) } else { (192usize, 128usize) };8804 if firing { (384usize, 256usize) } else { (192usize, 128usize) };
8805 let vertical = attempt % 2 == 1;8805 let vertical = attempt % 2 == 1;
8806+ // lane-vartxsplit r2, MEASURED against the oracle
8807+ // (`EC_VARTX` histogram, ~40 aomenc runs): at cq 10 this
8808+ // source splits NO rectangular transform at all -- aomdec
8809+ // reads only TX_8X8/TX_16X16/TX_8X16/TX_16X8 split symbols,
8810+ // so the leaves gaterecipe r1 counted here came out of a
8811+ // stream our decoder was already desynced on (class
8812+ // counter-from-refused-stream). cq 44 and 46 are the two
8813+ // quantisers of that sweep whose stream really carries
8814+ // `TX_32X8`/`TX_8X32` splits (16x8 and 8x16 rectangular
8815+ // var-tx leaves) AND decodes pixel-exact on all six frames.
8806 let cq = if firing {8816 let cq = if firing {
8807- 108817+ if attempt == 16 { 44 } else { 46 }
8808 } else {8818 } else {
8809 [30, 36, 44, 52][(attempt / 2 % 4) as usize]8819 [30, 36, 44, 52][(attempt / 2 % 4) as usize]
8810 };8820 };
@@ -8829,9 +8839,17 @@ mod tests {
8829 // the RD case for `txfm_partition`.8839 // the RD case for `txfm_partition`.
8830 "128+90*sin((X+N*3)/6)*sin(Y/2)+50*sin((X*Y)/37)".to_string()8840 "128+90*sin((X+N*3)/6)*sin(Y/2)+50*sin((X*Y)/37)".to_string()
8831 } else if firing {8841 } else if firing {
8832- // The transposed twin (a one-sided gate could never8842+ // lane-vartxsplit r2: BOTH leaf orientations come out of
8833- // separate 32x16 from 16x32).8843+ // this one source (three 16x8 leaves and one 8x16 on
8834- "128+90*sin((Y+N*3)/6)*sin(X/2)+50*sin((X*Y)/37)".to_string()8844+ // attempt 16), so the firing pair is the same texture at
8845+ // two quantisers. Its transposed twin was measured over
8846+ // cq 40..56 and splits no rectangular transform at all;
8847+ // at cq 56 it also mismatches ffmpeg from decode-order
8848+ // frame 2 with ZERO rect var-tx leaves in it -- an open
8849+ // reconstruction defect (8-pixel-wide luma column, see
8850+ // lanes/vartxsplit-r2.report.md), not something to hide
8851+ // inside this gate's attempt list.
8852+ "128+90*sin((X+N*3)/6)*sin(Y/2)+50*sin((X*Y)/37)".to_string()
8835 } else if vertical {8853 } else if vertical {
8836 format!(8854 format!(
8837 "128+60*sin((Y+N*({sp}+9*mod(floor(X/16),2)))/7)+25*sin(X/11)"8855 "128+60*sin((Y+N*({sp}+9*mod(floor(X/16),2)))/7)+25*sin(X/11)"
@@ -8985,24 +9003,27 @@ mod tests {
8985 compared + out_of_scope > 0,9003 compared + out_of_scope > 0,
8986 "{NAME} ({bit_depth}-bit): every attempt refused -- the gate compared no pixels"9004 "{NAME} ({bit_depth}-bit): every attempt refused -- the gate compared no pixels"
8987 );9005 );
8988- // The firing half. MEASURED on the merged tree (lane-r14 r4, ~709006+ // The firing half. lane-vartxsplit r2 re-measured it against
8989- // aomenc runs): the 8-bit 384x256 banded recipe codes BOTH9007+ // the oracle: attempts 16/17 (384x256 product texture, cq 44/46,
8990- // orientations of the split -- cq 38 gives four 32x16 leaves (out9008+ // `--min-partition-size=8 --enable-tx-size-search=1`) are the only
8991- // of four 64x16 strips), cq 32 one 16x32 leaf (out of four 16x649009+ // recipes of a ~40-run sweep whose stream carries `TX_32X8` /
8992- // strips). Those two streams stop LATER on another lane's live9010+ // `TX_8X32` split symbols, i.e. RECTANGULAR var-tx leaves (16x8
8993- // refusal ("an inter 16x16-level AB or 1:4 partition", "a non-skip9011+ // and 8x16, both orientations out of the same stream). They now
8994- // rectangular (HORZ/VERT/HORZ_B) strip needs rectangular residual9012+ // decode PIXEL-EXACT on all six frames, so the assert is on the
8995- // coding"), so the leaves are proved DECODED, not proved9013+ // pixel-compared tally, not on the "decoded anywhere" one --
8996- // pixel-exact; every attempt that ran to the end is compared9014+ // `fired_*` stays only to separate a refused stream's leaves from
8997- // frame by frame above. At 10 bits the same sweep fires nothing9015+ // a proved one (class counter-from-refused-stream). At 10 bits
8998- // (aomenc picks other shapes), so the firing assert is 8-bit only9016+ // the same sweep either fires nothing or mismatches on a
8999- // -- and it is a hard assert, never a print.9017+ // reconstruction defect of another shape (report), so the firing
9018+ // assert stays 8-bit -- and it is a hard assert, never a print.
9000 if bit_depth == 8 {9019 if bit_depth == 8 {
9001 assert!(9020 assert!(
9002- fired_32x16 > 0 && fired_16x32 > 0,9021+ leaf_32x16 > 0 && leaf_16x32 > 0,
9003- "{NAME}: the rectangular var-tx leaf arm never fired (32x16={fired_32x16}, \9022+ "{NAME}: the rectangular var-tx leaf arm never fired on a pixel-exact \
9004- 16x32={fired_16x32}, {named_refusals} refusals, {compared} compared) -- \9023+ attempt (pixel-compared 32x16={leaf_32x16}, 16x32={leaf_16x32}, decoded \
9005- `sub_tx_size_map[TX_64X16] == TX_32X16` is unproved by this gate"9024+ anywhere 32x16={fired_32x16} 16x32={fired_16x32}, {named_refusals} \
9025+ refusals, {compared} compared) -- the rectangular sub-transform path is \
9026+ unproved by this gate"
9006 );9027 );
9007 }9028 }
9008 }9029 }
@@ -11131,13 +11152,22 @@ mod tests {
11131 // this shape ever makes aomenc split a 16x4/4x16 strip's transform --11152 // this shape ever makes aomenc split a 16x4/4x16 strip's transform --
11132 // an aomdec EC_TRACE_COEFF histogram of those streams carries whole11153 // an aomdec EC_TRACE_COEFF histogram of those streams carries whole
11133 // TX_16X4/TX_4X16 units and no sub-transform. The one recipe that DOES11154 // TX_16X4/TX_4X16 units and no sub-transform. The one recipe that DOES
11134- // split it (384x256, `128+90*sin((X+N*3)/6)*sin(Y/2)+50*sin((X*Y)/37)`,11155+ // split it (384x256 product texture, cq 10, --min-partition-size=8)
11135- // cq 10, --min-partition-size=8 --max-partition-size=6411156+ // was RE-MEASURED by lane-vartxsplit r2 on the merged tree: that
11136- // --enable-tx-size-search=1) fires 6 of these leaves and then11157+ // stream now decodes PIXEL-EXACT on all six frames and fires ZERO
11137- // MISMATCHES ffmpeg at decode-order frame 2 -- an open DECODE defect11158+ // rectangular var-tx leaves of any size -- the "6 split-tx 8x4 leaves"
11138- // handed off, not something to hide inside a passing gate. So the arm11159+ // were counted out of an already-desynced decode (the desync is what
11139- // is reported as unproven here instead of asserted on a stream nobody11160+ // lane-sub8x4 fixed). r2 also swept THIS gate's own source family at
11140- // has decoded exactly.11161+ // cq 46/56/63 (12 streams, both orientations, both motion steps,
11162+ // --min-partition-size=4 --enable-tx-size-search=1): zero
11163+ // TX_16X4/TX_4X16 split symbols in aomdec's EC_VARTX histogram, all 12
11164+ // pixel-exact. What does split a 16x4/4x16 transform is the product
11165+ // texture at --min-partition-size=4 (140 + 238 splits at cq 44), and
11166+ // every such stream either stops at a refusal our own desync raises or
11167+ // mismatches ffmpeg from decode-order frame 1 -- an open defect handed
11168+ // off in lanes/vartxsplit-r2.report.md. So the arm stays
11169+ // reported-unproven instead of asserted on a stream nobody has decoded
11170+ // exactly.
11141 eprintln!(11171 eprintln!(
11142 "{NAME}: split-tx-8x4 arm unproven (arms {arms_total:?}) -- no recipe of this \11172 "{NAME}: split-tx-8x4 arm unproven (arms {arms_total:?}) -- no recipe of this \
11143 sweep produces a split 16x4/4x16 transform; see lanes/gaterecipe-r1.report.md"11173 sweep produces a split 16x4/4x16 transform; see lanes/gaterecipe-r1.report.md"
@@ -30150,6 +30180,72 @@ mod tests {
30150 );30180 );
30151 }30181 }
30152 30182
30183+ /// lane-frame36 r2: the hidden-ARF witness. `crates/ec-av1/fixtures/
30184+ /// reelb_arf_witness.obu`, 32126 bytes, sha256
30185+ /// `7f3b060da5aa9c537633e760c4af71316237db7692f6ae0d459bd2c2dd867d37`:
30186+ /// the first 58 frame-carrying OBUs of a 2 s head cut of the 10-bit
30187+ /// 3840x1608 AV1 HDR10 stream, 40 decode-order frames, 37 shown.
30188+ ///
30189+ /// What it covers that no earlier fixture did: decode-order frame 33 is a
30190+ /// HIDDEN alt-ref (`show_frame=0`, order_hint 64, `cdef_bits=1`, loop
30191+ /// restoration `[Switchable, Sgrproj, Switchable]`, `skip_mode_frame`
30192+ /// [1,6]) -- the first frame of the stream carrying a SPLIT
30193+ /// superblock-level intra strip in an inter frame. Its 16x64 strip at
30194+ /// mi(192,140) reads `tx_depth=1` (TX_16X32), and until this round
30195+ /// [`decode_block_rect64`]'s split arm returned past the tail that
30196+ /// publishes the `TXFM_CONTEXT` bands, so the 32x64 block at mi(192,144)
30197+ /// read the row's init value 64 as its left transform height and took
30198+ /// `tx_size_cat3` row 2 where aomdec takes row 1 -- a desync no shown
30199+ /// frame exposed until the ARF was displayed (class
30200+ /// `gate-blind-to-hidden-frames`).
30201+ ///
30202+ /// The counter assert is on `rect64_split_txfm_publish_hits`, the split
30203+ /// arm that was silent, so a stream that stopped carrying the shape fails
30204+ /// the gate instead of passing it vacuously.
30205+ #[test]
30206+ fn a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact() {
30207+ const NAME: &str =
30208+ "a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact";
30209+ if !have_ffmpeg() {
30210+ eprintln!("SKIP {NAME}: no ffmpeg");
30211+ return;
30212+ }
30213+ let path = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
30214+ .join("fixtures/reelb_arf_witness.obu");
30215+ let stream = std::fs::read(&path)
30216+ .unwrap_or_else(|e| panic!("{NAME}: reading {}: {e}", path.display()));
30217+ let (width, height) = (3840usize, 1608usize);
30218+ let before = crate::decode::rect64_split_txfm_publish_hits();
30219+ let frames = match decode_stream(&stream) {
30220+ Ok(frames) => frames,
30221+ Err(e) => panic!("{NAME}: decode_stream refused: {e}"),
30222+ };
30223+ let fired = crate::decode::rect64_split_txfm_publish_hits() - before;
30224+ assert!(
30225+ fired > 0,
30226+ "{NAME}: no split superblock-level strip in the stream -- the gate would be vacuous"
30227+ );
30228+ assert_eq!(frames.len(), 37, "{NAME}: 37 shown frames");
30229+ assert_eq!((frames[0].width, frames[0].height), (width, height));
30230+ let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len());
30231+ assert_eq!(
30232+ ffmpeg_frames.len(),
30233+ frames.len(),
30234+ "{NAME}: ffmpeg returned {} frames, we decoded {}",
30235+ ffmpeg_frames.len(),
30236+ frames.len()
30237+ );
30238+ for (i, (ours, theirs)) in frames.iter().zip(&ffmpeg_frames).enumerate() {
30239+ assert_eq!(ours.y, theirs.y, "{NAME}: frame {i} luma vs ffmpeg");
30240+ assert_eq!(ours.u, theirs.u, "{NAME}: frame {i} U vs ffmpeg");
30241+ assert_eq!(ours.v, theirs.v, "{NAME}: frame {i} V vs ffmpeg");
30242+ }
30243+ eprintln!(
30244+ "{NAME}: 37 shown frames pixel-exact on every plane, \
30245+ rect64_split_txfm_publish={fired}"
30246+ );
30247+ }
30248+
30153 30249
30154 /// lane-sub8x4 r2, the gate that lifts BOTH sub-8x8 intra refusals ("an30250 /// lane-sub8x4 r2, the gate that lifts BOTH sub-8x8 intra refusals ("an
30155 /// intra 4x4 block inside an inter frame's sub-8x8 split" and "an intra30251 /// intra 4x4 block inside an inter frame's sub-8x8 split" and "an intra
lanes/COMMON-20260901.mdmodified+5 -2
@@ -20,8 +20,11 @@ WORKING RULES (binding):
20 EC_AV1_PREFILT_DUMP). Ours: EC_TRACE_COEFF / EC_TRACE_MODE / EC_TRACE_MODE_STEP in decode.rs.20 EC_AV1_PREFILT_DUMP). Ours: EC_TRACE_COEFF / EC_TRACE_MODE / EC_TRACE_MODE_STEP in decode.rs.
21 Cross-decoder bisection compares msac RANGE element by element, never tell().21 Cross-decoder bisection compares msac RANGE element by element, never tell().
22 The reference is at the oracle source tree (find via scripts/build-aom-oracle.sh).22 The reference is at the oracle source tree (find via scripts/build-aom-oracle.sh).
23-- FIRST STEP, always: `git log --oneline -8 main` and rebase your branch onto main23+- FIRST STEP, always: `git log --oneline -8 main` and MERGE main into your branch
24- (`git rebase main`; resolve conflicts, keeping main's fixes). Then RE-MEASURE your lane's24+ (`git merge main`; never rebase a branch a merge agent may already have taken;
25+ resolve conflicts keeping BOTH sides' features, re-read every hand-resolved function).
26+ A charter line saying "never rebase/merge" means never rebase and never merge OTHER lanes;
27+ merging main is always the first step. Then RE-MEASURE your lane's
25 premise before building — charters may carry stale premises. Cite the command that28 premise before building — charters may carry stale premises. Cite the command that
26 produced every premise you act on.29 produced every premise you act on.
27 - Fixtures: `fixtures` is a symlink to main's fixtures dir (shared). Pin any new stream30 - Fixtures: `fixtures` is a symlink to main's fixtures dir (shared). Pin any new stream
lanes/frame36-r1.handoff.mdadded+76 -0
@@ -0,0 +1,76 @@
1+# lane-frame36 r1 HANDOFF (branch `lane-frame36`)
2+
3+## Working stream (pinned prefix, not yet a repo fixture)
4+`~/.cache/frame36-tmp/n58.obu` -- `python3 <scratch>/census4/trunc.py ~/.cache/hg-0.obu 58 <out>`
5+of the 2 s head cut of the 10-bit 3840x1608 stream. 32126 bytes,
6+sha256 `7f3b060da5aa9c537633e760c4af71316237db7692f6ae0d459bd2c2dd867d37`,
7+md5 `1e93c12f622cd1fb0c1cd9485cd8932e`. 58 frame headers, 40 decoded frames,
8+37 output frames. `ffmpeg -i n58.obu -pix_fmt yuv420p10le -f rawvideo` = 685393920 B.
9+
10+## What output frame 36 IS (EC_PROBE_HDR=1, a NEW rung added this round to decode_probe)
11+The charter's `EC_PROBE_HDR` did not exist; it does now (`decode_probe.rs`, one line per
12+frame header: type/show/showable/show_existing/refresh/refs/order hints/primary_ref/
13+q/seg/delta q,lf/lf levels+deltas/cdef bits/LR types/tx mode/ref_select/skip mode/warp/
14+reduced_tx/gm models/grain seed/lossless).
15+
16+* OUTPUT frame 36 = header **57**, a `show_existing_frame` of slot 6, whose content is the
17+ hidden frame coded at header **52** (`show=false showable=true`, order_hint 36,
18+ primary_ref=1, refresh 0x40, base_q 61, lf_level [1,1,4,0]).
19+* The real first wrong frame is **decode-order frame 33 = header 49**: `show=false`,
20+ order_hint 64 (the next ARF), primary_ref=0, refresh 0x02, base_q 34,
21+ refs=[0,2,0,0,0,3,0], order_hints=[32,0,32,32,32,16,32], skip_mode_frame [1,6]
22+ (every other frame uses [1,5]). Fields NEW at this frame vs 0..48:
23+ **cdef_bits 0 -> 1** and **loop_restoration [None,None,None] -> [Switchable,Sgrproj,Switchable]**
24+ (both revert at header 50). First non-zero `lf_level` in the whole stream is header 47
25+ ([4,4,0,0], luma only); first non-zero CHROMA lf level is header 50 ([3,3,1,1]).
26+ size/superres/seg/intrabc/hp_mv/reduced_tx/gm/tx_mode never change; gm is Identity throughout.
27+* Decode-order frames 33,34,35,36 map to headers 49,50,51,52; the whole wall is
28+ "hidden ARF wrong -> everything that references it wrong" (class `gate-blind-to-hidden-frames`).
29+
30+## Stage narrowing (all on n58.obu, both sides run under systemd-run MemoryMax=6G)
31+`EC_AV1_PREFILT_DUMP16` (ours) vs aomdec `EC_AV1_PREFILT_DUMP16` (the 8-bit
32+`EC_AV1_PREFILT_DUMP` **segfaults on this 10-bit stream** -- use the 16 variants;
33+aomdec has no POSTCDEF rung) at decode frame 33: prefilt already differs
34+(12222910 B of 18524160), i.e. **prediction/residual, not deblock/CDEF/LR/film grain**.
35+
36+## First wrong pixel (BEFORE the fix)
37+Prefilt frame 33: Y (x=1920, y=64) ours 173 vs aomdec 170; U/V first at (960,32).
38+That is superblock (mi_row 16, mi_col 480), 64x64, PARTITION_NONE, intra, in an inter frame.
39+
40+## Ladder result (EC_TRACE_PART/EC_TRACE_MODE_STEP ours vs aomdec EC_TRACE=1+EC_TRACE_MODE_STEP=1)
41+SB entry rng matches (36104 both). First diverging element:
42+`tx_depth` at mi(16,480) -- ours `val=0 ctx=1 rng=56472`, aomdec `val=0 ctx=0 cat=3 rng=34964`
43+(same value, wrong CDF ROW -> different range -> desync; class `wrong-alphabet-same-value`).
44+`EC_TXCTX` (print added to `tx_size_context_txfm` this round) shows why:
45+`left_txfm[16]=64` where libaom has the 64x16 strip's tx HEIGHT 16.
46+The preceding SB (16,464) is PARTITION_HORZ_4 = four 64x16 INTRA strips inside an inter frame.
47+
48+## Root cause + fix (committed)
49+`decode_block_rect64` / `decode_block_rect4` (the 1:4 strip readers, which are ALSO the inter
50+frame's readers via `decode_intra_rect4_in_inter`, decode.rs ~7455) never published libaom's
51+`set_txfm_ctxs` bands, so the next block read `TXFM_CTX_INIT` (64) as the left transform height.
52+Fix = one call each to the existing `txfm_partition_update_rect(neighbours, at_mi, (tx_w,tx_h), (bw,bh))`
53+at their tails (decode.rs:9389 area and :9911 area).
54+Result on n58.obu: output frame 36 differing bytes **1992768 -> 765464**; decode-order
55+prefilt f33 12222910 -> 6446616, f34 4549085 -> 1005614, f35 -> 759498, f36 -> 763799.
56+Frames 0..32 and 37,38,39 stay byte-exact vs aomdec's own FINAL dump.
57+
58+## EXACT NEXT STEP
59+The wall is NOT closed -- decode frame 33 (header 49) still differs. Redo the same ladder on the
60+NEW binary: `EC_TRACE_PART=1 EC_TRACE_MODE_STEP=1` ours vs `EC_TRACE=1 EC_TRACE_MODE_STEP=1`
61+aomdec, group lines into frames by the `EC_PART mi_row=0 mi_col=0 bsize=12` marker (ours now
62+emits 40 groups, aomdec 40; our SB-root print skips the last partial SB row -- compare by
63+`(mi_row,mi_col) -> rng`, our `ctx=` field is NOT aomdec's), find the first SB whose ENTRY rng
64+differs in frame 33 and dump every line of the SB BEFORE it. Then: pin the prefix as
65+`crates/ec-av1/fixtures/reelb_frame36_witness.obu` (`git add -f`) with a gate over every plane of
66+every decode-order frame + a hard assert on `intra_rect4_in_inter` (this stream: 64x16=8 16x64=9),
67+update gate_coverage, run the suite as a systemd unit, and re-probe the full `hg-0.obu`.
68+
69+## Artifacts (all under ~/.cache/frame36-tmp)
70+`n58.obu`, `hdr58.txt` (58 EC_PROBE_HDR lines), `ours/` + `aom/` (FINAL dumps, 40 frames each),
71+`opre/` + `apre/` (PREFILT16), `opd/` + `apd/` (POSTDEBLOCK16), `opart.txt`/`apart.txt`,
72+`omode.txt`/`amode.txt`, `osb464.txt`/`asb464.txt`, `otx.txt`.
73+
74+EVIDENCE: ~/.cache/frame36-tmp/{o,r}.raw | release decode_probe + ffmpeg on the pinned 58-OBU prefix, diff16.py 3840x1608 | frames 0-35 0 bytes, frame 36 1992768 -> 765464 after the fix
75+EVIDENCE: ~/.cache/frame36-tmp/{opre,apre}/p.f33 | ours EC_AV1_PREFILT_DUMP16 vs aomdec EC_AV1_PREFILT_DUMP16 | 12222910 differing bytes pre-filter => not a post-filter defect
76+EVIDENCE: ~/.cache/frame36-tmp/{omode,amode}.txt | EC_TRACE_PART+EC_TRACE_MODE_STEP vs aomdec EC_TRACE+EC_TRACE_MODE_STEP | first diverging element tx_depth mi(16,480) ctx 1 vs 0, rng 56472 vs 34964
lanes/frame36-r2.handoff.mdadded+51 -0
@@ -0,0 +1,51 @@
1+# lane-frame36 r2 HANDOFF (branch `lane-frame36`, tip c9e15d7)
2+
3+## Root causes this round
4+1. FIXED (decode.rs:9594) -- `decode_block_rect64`'s `depth != 0` (split) arm returns
5+ early past the tail `txfm_partition_update_rect` r1 added, so a SPLIT superblock-level
6+ strip published NO `TXFM_CONTEXT` band. libaom's `set_txfm_ctxs` runs for every block
7+ with the SPLIT unit's size. Frame 33: the 16x64 strip at mi(192,140) reads `tx_depth=1`
8+ (TX_16X32), so libaom has `left_txfm=32`; ours kept 64 and the 32x64 intra block at
9+ mi(192,144) read `tx_size_cat3` row 2 where aomdec reads row 1 (same value, different
10+ range).
11+2. FIXED by class sweep, latent (decode.rs:8625/8776/8839) -- `decode_block_rect4` (32-level
12+ 1:4 strips, also the inter frame's 32x8/8x32 intra reader) published the bands on none of
13+ its three exits. This stream carries no such block once frame 33 is correct (the 48/40
14+ counters before the fix were phantoms of the desync).
15+
16+## Current divergence in decode frame 33
17+NONE. Ladder identical: every superblock ENTRY range of every traced frame equals aomdec's
18+(ours[i] = aomdec[i+1]; our SB-root print skips the last partial SB row, and our group 0
19+holds frames 0+1). Pixel state: all 37 shown frames of the 58-OBU prefix are byte-exact vs
20+ffmpeg, and all 48 frames of the whole 2 s head cut are byte-exact.
21+Frame 36 differing bytes: 0 (1992768 before r1, 765464 at r1's tip fa20907).
22+
23+## Instrumentation added
24+`EC_TRACE_MODE_STEP` now prints the oracle-format
25+`EC_ISTEP mi_row=.. mi_col=.. name=tx_depth val=.. ctx=.. cat=.. rng=..` in
26+`decode_intra_rect_in_inter` (decode.rs:7541) -- that line named root cause 1 in one run.
27+Counter `decode::rect64_split_txfm_publish_hits()`.
28+
29+## Gate + fixture
30+`crates/ec-av1/fixtures/reelb_arf_witness.obu` (32126 B, sha256
31+7f3b060da5aa9c537633e760c4af71316237db7692f6ae0d459bd2c2dd867d37, `git add -f`),
32+gated by `a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact`
33+(stream.rs): every plane of all 37 shown frames vs ffmpeg + hard assert on the counter
34+(4 on this stream). Ran alone: `ok. 1 passed`, 94.77 s.
35+No refusal lifted, so refusal_inventory/gate_coverage are unchanged.
36+
37+## EXACT NEXT STEP
38+1. Full suite (never run this round -- the r2 unit was cancelled at the turn cap):
39+ `systemd-run --user --unit=frame36-suite-$(date +%s) -p MemoryMax=10G --same-dir bash -lc
40+ 'EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-frame36
41+ nice -n 10 cargo test -p ec-av1 --lib -j3 > $HOME/.cache/frame36-suite.log 2>&1'`.
42+ Known RED on main beecb64 (not this lane):
43+ `real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal`.
44+ 169 tests had passed, 0 failed, when the unit was cancelled.
45+2. Then the next wall: cut a LONGER segment of the same stream (`ffmpeg -ss <t> -t 2 ... -f obu`)
46+ and re-run `decode_probe` + `diff16.py`; the 2 s head is now fully exact.
47+
48+## Artifacts (~/.cache/frame36-tmp)
49+`n58.obu`, `r.raw`/`o2.raw` (prefix), `full_r.raw`/`full_o2.raw` (48-frame cut),
50+`r2/omode5.txt` (ours ladder, post-fix), `r2/amode.txt` (aomdec ladder),
51+`r2/split.py` + `r2/sb.py` (frame split / per-SB dump), `probe_r2.log` (post-fix counters).
lanes/frame36-r2.report.mdadded+74 -0
@@ -0,0 +1,74 @@
1+# lane-frame36 r2 report (branch `lane-frame36`)
2+
3+Tip: `c9e15d7` (r1 tip was `fa20907`).
4+
5+## Root cause found this round (one, entropy-level)
6+
7+`decode_block_rect64`'s `depth != 0` arm returns early, past the tail
8+`txfm_partition_update_rect` that r1 added -- so a SPLIT superblock-level strip
9+(64x16 / 16x64 / 64x32 / 32x64) published NO `TXFM_CONTEXT` band, and the next
10+block read the row's init value 64 as its left transform height. libaom runs
11+`set_txfm_ctxs(mbmi->tx_size, ...)` for every block, with the SPLIT unit's size.
12+
13+Measured (decode-order frame 33, the hidden ARF, of the 58-OBU prefix): the
14+16x64 strip at mi(192,140) reads `tx_depth=1` -> TX_16X32, so libaom's
15+`left_txfm_context[192]` is 32; ours stayed 64, and the 32x64 intra block at
16+mi(192,144) read `tx_size_cat3` row 2 where aomdec reads row 1 -- same value,
17+different range (class `wrong-alphabet-same-value`), desync to the end of the
18+frame. Fix: `crates/ec-av1/src/decode.rs:9594` (one call), plus the counter
19+`rect64_split_txfm_publish_hits` and the oracle-format
20+`EC_ISTEP ... name=tx_depth ... cat=` print in `decode_intra_rect_in_inter`
21+(decode.rs:7541) that named it.
22+
23+## Class sweep (same shape)
24+
25+`decode_block_rect4` (32-level 1:4 strips; also the inter frame's reader for an
26+intra 32x8/8x32) published the bands on NONE of its three exits -- fixed the
27+same way (decode.rs:8625/8776/8839). Latent here: once frame 33 decodes
28+correctly this stream carries no intra 32x8/8x32 at all (the 48/40 counted
29+before the fix were phantoms of the desync, class `counter-from-refused-stream`).
30+The 48-frame decode was re-measured byte-exact WITH the sweep in.
31+
32+## Frame 33 state
33+
34+EXACT. Every superblock ENTRY range of every traced frame of the prefix equals
35+aomdec's (39 groups ours vs 40 aomdec: our SB-root print skips the last partial
36+SB row, and our group 0 holds frames 0+1; the mapping is ours[i] = aomdec[i+1]).
37+No PREFILT16 stage compare was needed -- the pixels are equal.
38+
39+## Film (the 2 s head cut of the 10-bit 3840x1608 stream)
40+
41+`~/.cache/hg-0.obu`, 48 decode-order frames: differing bytes per frame
42+`0,0,0,...,0` (all 48 zero) vs `ffmpeg -pix_fmt yuv420p10le`. The r1 wall
43+(output frame 36, 765464 differing bytes; 1992768 before r1) is CLOSED.
44+
45+## Gate
46+
47+`a_10bit_film_hidden_arf_with_split_superblock_strips_decodes_pixel_exact`
48+(`crates/ec-av1/src/stream.rs`), fixture `crates/ec-av1/fixtures/reelb_arf_witness.obu`
49+(32126 B, sha256 7f3b060da5aa9c537633e760c4af71316237db7692f6ae0d459bd2c2dd867d37,
50+`git add -f`): every plane of all 37 shown frames vs ffmpeg, hard assert
51+`rect64_split_txfm_publish_hits > 0` (4 on this stream).
52+Command:
53+`EC_NOMEMGUARD=1 EC_AV1_REQUIRE_AOMENC=1 CARGO_TARGET_DIR=$HOME/.cache/cargo-target-frame36 cargo test -p ec-av1 --lib a_10bit_film_hidden_arf_with_split_superblock_strips -- --nocapture`
54+Result: `ok. 1 passed`, 94.77 s.
55+
56+## Refusals
57+
58+None lifted this round (the defect was a wrong decode, not a refusal), so
59+`refusal_inventory.rs` is unchanged; `gate_coverage.rs` needs no entry either --
60+this gate runs a pinned film stream, not an `aomenc` recipe.
61+
62+## EVIDENCE
63+
64+EVIDENCE: ~/.cache/frame36-tmp/r2/{omode5,amode}.txt | ours EC_TRACE_PART+EC_TRACE_MODE+EC_TRACE_MODE_STEP vs aomdec EC_TRACE+EC_TRACE_MODE+EC_TRACE_MODE_STEP+EC_VARTX on the 58-OBU prefix, SB-root range compare per frame | 0 differing superblock entry ranges in every frame (was: first diff at SB(192,160) of frame 33, 38758 vs 39618)
65+EVIDENCE: ~/.cache/frame36-tmp/{o2.raw,r.raw} | decode_probe EC_PROBE_OUT16 vs ffmpeg -pix_fmt yuv420p10le on the 58-OBU prefix, diff16.py 3840x1608 | all 37 output frames 0 differing bytes (frame 36 was 765464)
66+EVIDENCE: ~/.cache/frame36-tmp/{full_o2.raw,full_r.raw} | same, on the whole 48-frame 2 s head cut | all 48 frames 0 differing bytes
67+EVIDENCE: ~/.cache/frame36-tmp/r2/omode4.txt | ours EC_TXCTX at mi(192,144) | above_txfm=64 left_txfm=64 -> ctx 2, aomdec ctx 1: the stale left band
68+
69+## Residue
70+
71+- accepted: our `EC_TRACE_PART` SB-root print skips the last partial SB row
72+ (tracing only; pixels of those rows are compared and exact).
73+- deferred(a longer film cut): only the 2 s head is proven; the next wall in the
74+ full film is unmeasured -- the census under `lanes/` is the unblocker.
lanes/vartxsplit-r1.handoff.mdadded+57 -0
@@ -0,0 +1,57 @@
1+# lane-vartxsplit r1 — handoff (root cause FOUND and FIXED; gate work not done)
2+
3+## Pinned stream (reproducible: two runs, identical md5)
4+`~/.cache/vartxsplit-tmp/s8.obu`, md5 `842355ef494455ead0352f62f84f2c56`
5+(generator `~/.cache/vartxsplit-tmp/gen.sh`), 8-bit 384x256 6 frames @25,
6+source `128+90*sin((X+N*3)/6)*sin(Y/2)+50*sin((X*Y)/37)`, oracle aomenc:
7+`--codec=av1 --passes=1 --end-usage=q --cq-level=10 --cpu-used=0 --threads=1 --row-mt=0
8+ --sb-size=64 --bit-depth=8 --input-bit-depth=8 --enable-restoration=0 --enable-palette=0
9+ --deltaq-mode=0 --enable-filter-intra=0 --enable-cfl-intra=0 --enable-intrabc=0
10+ --lag-in-frames=0 --kf-max-dist=9999 --tile-columns=0 --enable-tx-size-search=1
11+ --enable-rect-partitions=1 --enable-ab-partitions=1 --enable-1to4-partitions=1
12+ --min-partition-size=8 --max-partition-size=64 --obu`
13+(gaterecipe r1's recipe 1; the 10-bit 16x32 twin was NOT re-measured this round.)
14+
15+## First diverging element (before the fix)
16+Decode-order frame 2, luma, block mi(8,16) (8x16, TX_8X16), the FIRST DC-sign symbol
17+of its plane-0 transform unit:
18+- entry range 43680 in both decoders;
19+- aomdec `EC_COEFF_STEP tag=sign c=0 sign=1 dcctx=0 rng=41828`
20+- ours `EC_COEFF_STEP tag=sign_rect pos=0 sign=1 dcctx=1 rng=41148`
21+i.e. same value, wrong CDF row: our DC-sign context was 1 (negative vote) where libaom's
22+is 0. Everything before it — partitions, var-tx `txfm_split` ladder (1362 lines of frame 1
23+byte-identical; 92 lines of frame 2), coefficients — matched.
24+
25+## Root cause (fixed, decode.rs)
26+`EC_DCDUMP mi=(8,16) wh=(8,16) vote=-2 above=[Some(true)/7,Some(false)/7]
27+left=[None/0,None/0,Some(true)/7,Some(true)/7]`: the two left cells at mi rows 8-9 were
28+EMPTY. They belong to the compound 8x8 leaf at mi(8,14) whose transform SPLIT into four
29+4x4 TUs. `read_inter_luma8` returns an all-zero placeholder `luma_grid` in the split case
30+because each 4x4 TU already wrote its own plane-0 state via `record_mi_luma`; the compound
31+leaf arm then called `neighbours.record_mi(leaf_mi, 8, ...)`, which rewrites all three
32+planes of those cells and erased the four per-TU cul_level/DC-sign records. The
33+single-ref twin (`decode_leaf8`, decode.rs:25091) already had the `saved_luma_ctx`
34+save/restore around exactly this call; the compound arm never got it (class:
35+twin-functions-drift / mvstack-compound-tpl-extension).
36+
37+Fix: same save/restore around `record_mi` in the compound arm (decode.rs, the
38+`neighbours.record_mi(leaf_mi, 8, ...)` at the end of the compound 8x8 leaf).
39+
40+## Result
41+`dump_yuv s8.obu` vs `ffmpeg -pix_fmt yuv420p`: all 6 frames byte-identical
42+(was: frames 2-5 differ, 91201 luma samples on frame 2).
43+
44+## NOT done (next steps, in order)
45+1. Full suite (`systemd-run --user --unit=vartxsplit-suite-... cargo test -p ec-av1 --lib`).
46+2. Re-measure the 10-bit 16x32 arm (gaterecipe recipe 2: gate A's flag set,
47+ `--enable-ab-partitions=0 --enable-dual-filter=0 --enable-obmc=0 --enable-tx64=1`,
48+ attempt 16/17) — it may be the same defect or a second one; recipe 1's compound leaf
49+ only exists because THIS recipe leaves `--enable-obmc`/dual-filter on.
50+3. Turn the gate B `split-tx-8x4` arm (stream.rs ~11036, marked unproven by gaterecipe r1)
51+ back into a hard assert, and add the 10-bit 16x32 arm to
52+ `real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal`.
53+4. refusal_inventory + gate_coverage untouched this round (no refusal lifted).
54+
55+## Instrumentation left in the tree (env-gated, cheap)
56+- `EC_DCDUMP=1`: `around_mi_rect` prints per-cell above/left DC state + vote (plane 0).
57+- `EC_TRACE_COEFF` rect sign line now carries `dcctx=`.
lanes/vartxsplit-r2.report.mdadded+122 -0
@@ -0,0 +1,122 @@
1+# lane-vartxsplit r2 — the 10-bit case was stale; the gate's firing recipe was vacuous
2+
3+Branch `lane-vartxsplit`, merged with main (beecb64) at `335ccdc` (the r1 compound-8x8
4+`saved_luma_ctx` fix landed independently on main via lane-sub8x4; the merge kept main's
5+copy — same semantics, same call site).
6+
7+## (1) The 10-bit 16x32 case (gaterecipe recipe 2) — VERDICT: already fixed by the merge
8+
9+Streams (each hashed twice, identical): `~/.cache/vartxsplit-tmp/s10.obu`
10+md5 `99980afd5945c61621d38c4e5c104db9`, transposed twin `s10v.obu`
11+md5 `93890af7b420886beb5394bf30f6f805` (384x256, 6 frames @25, yuv420p10le, cq 10,
12+gate A's flag set, `--min-partition-size=8 --max-partition-size=64`, generator
13+`~/.cache/vartxsplit-tmp/gen10.sh` / `gen10v.sh`).
14+
15+- At `cba81e6` (pre-merge): `s10` differed from ffmpeg at decode-order frames 4-5,
16+ `s10v` at frames 2-5.
17+- At `335ccdc` (post-merge): **all six frames of both streams are byte-identical to
18+ `ffmpeg -pix_fmt yuv420p10le`, Y/U/V** — no new fix was needed. The premise expired
19+ with lane-sub8x4 (class stale-premise-lanes).
20+- The recipe also carries **no 16x32 var-tx leaf at all**: aomdec's `EC_VARTX` histogram
21+ of both streams reads only tx_size 1/2/7/8 split symbols — zero `TX_16X64`/`TX_64X16`
22+ (and zero `TX_8X32`/`TX_32X8`). The "46 16x32 leaves" gaterecipe r1 recorded were
23+ counted inside an already-desynced decode.
24+
25+EVIDENCE: ~/.cache/vartxsplit-tmp/s10.obu + s10v.obu | aomenc (twice, equal md5) -> dump_yuv -> ffmpeg yuv420p10le rawvideo compare, 6 frames x 3 planes | 12/12 frames byte-identical, oracle EC_VARTX 16x32/32x16 split symbols = 0
26+
27+Same-shape sweep asked for in the charter (`record_mi` with a placeholder grid after a
28+split): `grep -n "saved_luma_ctx"` in decode.rs shows both 8x8 leaf arms (single-ref
29+`decode_leaf8` and the compound arm) now save/restore, and they are the only
30+`record_mi(..., 8, ...)` call sites that follow a `split8` transform; the rect strip and
31+sub8 rect2/split4 arms publish their own per-TU state and never rewrite a placeholder
32+grid over it.
33+
34+## (2) Gate A — `real_aomenc_1to4_streams_..._rect_vartx_leaves_fire_before_a_named_refusal`
35+
36+RED on the merged tree with "leaves decoded anywhere 32x16=0 16x32=0". Root cause is the
37+RECIPE, not a counter placement: the firing attempts' cq-10 stream contains **no
38+rectangular sub-transform** (oracle `EC_VARTX`, above), so the counter is right and the
39+old 21/15 reading came from a desynced decode (class counter-from-refused-stream, second
40+instance in this gate).
41+
42+Re-measured (`~/.cache/vartxsplit-tmp/sweep2.sh`, `sweep3.sh`, ~40 aomenc runs; oracle
43+histogram of tx_size 15/16/17/18 with val=1): the same product texture at **cq 44 and 46**
44+is what splits a rectangular transform — `TX_32X8`/`TX_8X32` splits giving **16x8 and 8x16
45+rect var-tx leaves**, both orientations out of one stream — and both streams decode
46+pixel-exact. So attempts 16/17 now run cq 44 / cq 46 on the horizontal source, and the
47+firing assert was **strengthened**: it asserts the PIXEL-COMPARED tally
48+(`leaf_32x16 > 0 && leaf_16x32 > 0`), not "decoded anywhere".
49+
50+EVIDENCE: ~/.cache/vartxsplit-tmp/p_44.obu, p_46.obu | aomenc -> EC_VARTXLEAF decode -> ffmpeg yuv420p compare | ours 3x 16x8 + 1x 8x16 leaves each, 6/6 frames exact (oracle: tx15/1=1 tx16/1=3 at cq 44)
51+
52+## (3) Gate B — the split-tx-8x4 arm stays reported-unproven (DEVIATION from the charter)
53+
54+The charter asked for a hard assert. It cannot be honest today, and this is measured, not
55+assumed:
56+- gate B's own source family never splits a 16x4/4x16 transform at ANY quantiser: 12 fresh
57+ streams (both orientations, both motion steps, cq 46/56/63, `--min-partition-size=4
58+ --max-partition-size=16 --enable-tx-size-search=1`) carry **zero** TX_16X4/TX_4X16 split
59+ symbols in aomdec's `EC_VARTX` histogram, and all 12 decode pixel-exact;
60+- the recipe gaterecipe r1 credited with 6 split-tx 8x4 leaves (`s8.obu`, md5
61+ `842355ef494455ead0352f62f84f2c56`) now decodes **pixel-exact on all six frames with
62+ ZERO rect var-tx leaves** — those 6 were read out of the desync lane-sub8x4 fixed;
63+- the product texture at `--min-partition-size=4` DOES split it heavily (140 TX_16X4 +
64+ 238 TX_4X16 at cq 44), but every one of those streams either raises a refusal our own
65+ desync produces ("an OBMC neighbour whose switchable interp filter…", "a Golomb tail
66+ longer than this decoder reads" — both with `--enable-obmc=0 --enable-dual-filter=0` on
67+ the command line, i.e. class refusal-from-own-desync) or mismatches ffmpeg from
68+ decode-order frame 1.
69+
70+EVIDENCE: ~/.cache/vartxsplit-tmp/sweep5.sh + sweep6.sh logs | 24 aomenc streams -> aomdec EC_VARTX histogram + our decode + ffmpeg compare | gate-B family 12/12 exact with 0 TX_16X4 splits; product-texture min-part-4 family 0/12 exact
71+
72+The gate's comment now carries this measurement instead of gaterecipe's stale one.
73+
74+## (4) Open defect handed off (not mine to close this round)
75+
76+384x256 product texture, `--min-partition-size=8 --max-partition-size=64`, transposed
77+source at cq 56 (`pv_56.obu`) — 8-bit, mismatches ffmpeg from decode-order frame 2 with
78+ZERO rect var-tx leaves. Triaged:
79+- **entropy is EXACT**: the deduped msac range sequence of frames 0-2 vs instrumented
80+ aomdec has 243696 insertions (our extra `br` prints after `base_eob`) and **0 deletions**
81+ — we read exactly the symbols the reference wrote. It is a RECONSTRUCTION defect.
82+- shape: luma columns **8..15** (one 8-pixel-wide strip), rows 124..224, 241 samples,
83+ delta -17..+2, plus one 8x4 chroma unit at (108,88) in both U and V, delta -16.
84+The 10-bit twins behave the same way (`t10_46`, `t10v_48`, `t10v_52`: mismatch with zero
85+rect leaves; `t10v_40` fires 2+2 leaves and mismatches only on frame 5). This is why no
86+10-bit firing arm was added to gate A — deferred(the 8-wide-strip reconstruction defect
87+above), it would make the gate's own `oos_mismatch` assert red.
88+
89+## Instrumentation added
90+`EC_VARTXLEAF=1` (decode.rs `vartx_rect_leaf_hit`): prints `tw=`/`th=` per rectangular
91+var-tx leaf — this is what separated "our counter moved" from "the recipe never coded the
92+shape" in one run.
93+
94+## Gate + suite results (merged tree, `335ccdc` + this lane's two commits)
95+
96+```
97+real_aomenc_1to4_streams_decode_pixel_exact_and_rect_vartx_leaves_fire_before_a_named_refusal
98+ (8-bit): 0 named refusals, 2 pixel-exact attempts carrying the arm,
99+ pixel-compared rect var-tx leaves 32x16=6 16x32=2, leaves decoded anywhere 32x16=6 16x32=2,
100+ 16 attempts carried none (0 of them mismatched)
101+ (10-bit): 0 named refusals, ... 16 attempts carried none (0 of them mismatched)
102+a_real_aomenc_inter_sequence_with_16x16_level_1to4_partitions_decodes_pixel_exact
103+ (8-bit): 0 named refusals, 2 pixel-exact attempts, per-arm
104+ HORZ_4/VERT_4/chroma-pair/sub8x8-chroma/split-tx-8x4=[1, 1, 2, 2, 0], 30 carried none (0 mismatched)
105+ split-tx-8x4 arm unproven (arms [1, 1, 2, 2, 0])
106+named gates + refusal_inventory + gate_coverage + sub8 + obmc:
107+ test result: ok. 26 passed; 0 failed; 0 ignored; 435 filtered out; 135.30s
108+full suite: test result: ok. 424 passed; 0 failed; 37 ignored; 0 measured; 855.00s
109+```
110+
111+EVIDENCE: /home/user/.cache/vartxsplit-gates.log + /home/user/.cache/vartxsplit-suite.log | cargo test -p ec-av1 --lib (named gates, then whole lib, both as systemd user units) | 26/26 named green, suite 424 passed 0 failed 37 ignored
112+
113+## Residue
114+- deferred: the 8-pixel-wide-column reconstruction defect (section 4) — entropy proved
115+ exact, so it is a prediction/filter-stage bug — unblocked by a lane that owns the
116+ 8xN inter reconstruction path; it is what keeps a 10-bit firing arm out of gate A.
117+- deferred: the split-tx-8x4 hard assert — unblocked by that same defect (it is what
118+ makes every `--min-partition-size=4` product-texture stream red).
119+- accepted: gate A's leaves are 16x8/8x16 (`TX_32X8`/`TX_8X32` splits), not the 32x16/16x32
120+ its variable names say; no `TX_64X16`/`TX_16X64` split exists in any recipe measured in
121+ ~70 aomenc runs across r1+r2. The counter is one generic "rect var-tx leaf with both
122+ sides >= 8" pair; renaming it is churn this lane did not spend.