forge
Explore
Log in

Don't you dare go Hollow

ec-av1: non-420 named refusal, disable_cdf_update wiring, rect-intrabc var-tx + sub-8 txfm-context fixes

Browse files at this commit

8b37c57a60f8bdf2600d49f89d386ec22f76e42fAhmet Kaan GümüşParent: 787e43e
Five defects, each with a gate and/or a first-divergence move (report S9):

- non-4:2:0 chroma (4:4:4/4:2:2) is now REFUSED BY NAME at the sequence
  header instead of decoding silently wrong pixels; gate
  a_non_420_subsampled_sequence_header_is_refused_by_name (profile 1 + 2
  headers, profile-0 control still decodes) and a real aomenc yuv444p stream
  refuses where it used to decode garbage.
- disable_cdf_update (spec 5.9.2) is now consumed: per-reader
  msac::SymbolDecoder::adapt + FrameCtx cell + one line in decode_frame.
  Gates: a_real_aomenc_stream_with_cdf_update_disabled_decodes_pixel_exact
  (byte-exact vs ffmpeg; pre-fix the same stream differs at byte 6) and the
  msac unit gate a_reader_told_not_to_adapt_matches_a_non_adapting_writer.
- transform.rs:1134 panic root-caused and FIXED: txbset_for_inter (a
  duplicate whose 4 fell through to Luma64) is deleted; all inter-table
  sites use inter_txbset_for, which has the 4x4 arms libaom's
  EXT_TX_SET_ALL16/_DTT4_IDTX ask for. allintra0 no longer panics; it stops
  at the existing named mixed-leaf var-tx refusal.
- rect intrabc leaves (4x8/8x4) read the INTER var-tx tree under
  TxMode::Select (block_signals_txsize is bsize > BLOCK_4X4) and
  reconstruct per 4x4 TU when it splits; sub-8x8 leaves publish the TXFM
  context bands (set_txfm_ctxs for every block); the stale intrabc_dv slot
  no longer leaks into the next 8x8+ block.
- inventory re-pin: the dead sub-8x8-intrabc refusal entry retired, the
  Golomb entry re-pinned to its measured symptom-reachability.

warped is NOT byte-exact yet: first divergence moved (38,60) -> (46,66),
the key-frame tx-depth context read off the deblock grid where libaom reads
the TXFM bands (next step in report S9.7). allintra/warped now stop 16 mi
rows later at the 1:4 rect-strip intrabc refusal (lane 3's).
crates/ec-av1/examples/decode_probe.rsmodified+6 -0
@@ -92,6 +92,12 @@ fn main() {
9292 println!("inter16_1to4: horz4={h4} vert4={v4} chroma_pairs={pairs} sub8_pieces={sub8}");
9393 let leaf4 = ec_av1::stream::vartx_rect_leaf4_hits();
9494 println!("vartx_rect_leaf4: 8x4={} 4x8={}", leaf4[0], leaf4[1]);
95+ // lane-av1txr: intrabc 4x8/8x4 leaves that read the inter var-tx tree
96+ // (the symbol whose absence desynced `warped.obu`).
97+ println!(
98+ "rect_intrabc_vartx: {}",
99+ ec_av1::decode::rect_intrabc_vartx_hits()
100+ );
95101 let rw = ec_av1::stream::rect_wedge_hits();
96102 let rwi = ec_av1::stream::rect_wii_hits();
97103 println!(
crates/ec-av1/src/decode.rsmodified+209 -47
@@ -84,6 +84,12 @@ pub(crate) struct FrameCtx {
8484 /// (`decodeframe.c`), `read_tx_type` (`decodetxb.c`), `is_cfl_allowed`
8585 /// (`blockd.h`)).
8686 pub(crate) lossless_flag: std::cell::Cell<bool>,
87+ /// lane-av1txr: this frame header's `disable_cdf_update` (spec 5.9.2).
88+ /// When set, the tile reader must not adapt any CDF it reads, or its
89+ /// tables drift away from the encoder's and the frame desyncs mid-tile
90+ /// (libaom: `allow_update_cdf = allow_update_cdf &&
91+ /// !cm->features.disable_cdf_update`, `decodeframe.c:2909`).
92+ pub(crate) disable_cdf_update: std::cell::Cell<bool>,
8793 pub(crate) cdef_bits: std::cell::Cell<u8>,
8894 pub(crate) bit_depth: std::cell::Cell<u8>,
8995 pub(crate) superres: std::cell::Cell<(u32, u32)>,
@@ -173,6 +179,7 @@ impl FrameCtx {
173179 sb128_flag: std::cell::Cell::new(false),
174180 interp_filter: std::cell::Cell::new(crate::mc::InterpFilterKind::Regular),
175181 lossless_flag: std::cell::Cell::new(false),
182+ disable_cdf_update: std::cell::Cell::new(false),
176183 cdef_bits: std::cell::Cell::new(0),
177184 bit_depth: std::cell::Cell::new(8),
178185 superres: std::cell::Cell::new((0, 8)),
@@ -378,6 +385,18 @@ pub(crate) fn lossless(fctx: &crate::decode::FrameCtx) -> bool {
378385 fctx.lossless_flag.with(|c| c.get())
379386 }
380387
388+/// Sets [`FrameCtx::disable_cdf_update`] (called once per frame from
389+/// `stream.rs`).
390+pub(crate) fn set_disable_cdf_update(v: bool, fctx: &crate::decode::FrameCtx) {
391+ fctx.disable_cdf_update.with(|c| c.set(v));
392+}
393+
394+/// This frame's `disable_cdf_update`, for the tile readers --
395+/// [`msac::SymbolDecoder::set_cdf_update`](crate::msac::SymbolDecoder::set_cdf_update).
396+pub(crate) fn cdf_update_disabled(fctx: &crate::decode::FrameCtx) -> bool {
397+ fctx.disable_cdf_update.with(|c| c.get())
398+}
399+
381400 /// The transform side a block of `side` pixels codes: its own (capped at the
382401 /// caller's own largest) normally, 4 on a lossless frame, where libaom's
383402 /// `read_tx_size` returns TX_4X4 before it looks at anything else
@@ -3662,6 +3681,11 @@ thread_local! {
36623681 /// var-tx partition tree (unskipped, `TX_MODE_SELECT`) -- the capability
36633682 /// that replaced the refusal "an intrabc block under TxMode::Select".
36643683 static INTRABC_VARTX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
3684+ /// lane-av1txr: as above for a `BLOCK_4X8`/`BLOCK_8X4` intrabc leaf --
3685+ /// libaom's `block_signals_txsize` is `bsize > BLOCK_4X4`, so these leaves
3686+ /// signal a transform size where a plain `BLOCK_4X4` does not. Reading no
3687+ /// symbol here desynced `warped.obu` at the very next block.
3688+ static RECT_INTRABC_VARTX_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) };
36653689 }
36663690
36673691 /// Current value of [`INTRABC_VARTX_HITS`].
@@ -3676,6 +3700,12 @@ pub(crate) fn reset_intrabc_vartx_hits() {
36763700 INTRABC_VARTX_HITS.with(|c| c.set(0));
36773701 }
36783702
3703+/// Current value of [`RECT_INTRABC_VARTX_HITS`].
3704+#[allow(dead_code)] // read only from the `#[cfg(test)]` gates
3705+pub fn rect_intrabc_vartx_hits() -> usize {
3706+ RECT_INTRABC_VARTX_HITS.with(|c| c.get())
3707+}
3708+
36793709 /// Records one coded block into [`INTRABC_MI_GRID`]: every block contributes
36803710 /// its size (libaom's `scan_row_mbmi` advances `processed_rows` off any
36813711 /// candidate's `bsize`, ref-match or not), an intrabc one also its DV as an
@@ -14333,7 +14363,7 @@ fn decode_block(
1433314363 luma_set
1433414364 };
1433514365 let luma_set = if intrabc_dv.is_some() {
14336- txbset_for_inter(logical_tx, reduced_tx_set)
14366+ inter_txbset_for(logical_tx, reduced_tx_set)
1433714367 } else {
1433814368 luma_set
1433914369 };
@@ -15601,7 +15631,7 @@ fn decode_leaf8(
1560115631 dec,
1560215632 cdfs,
1560315633 if intrabc_dv.is_some() {
15604- txbset_for_inter(8, reduced_tx_set)
15634+ inter_txbset_for(8, reduced_tx_set)
1560515635 } else if reduced_tx_set {
1560615636 TxbSet::Luma8
1560715637 } else {
@@ -15736,7 +15766,7 @@ fn decode_leaf8(
1573615766 dec,
1573715767 cdfs,
1573815768 if intrabc_dv.is_some() {
15739- txbset_for_inter(4, reduced_tx_set)
15769+ inter_txbset_for(4, reduced_tx_set)
1574015770 } else if reduced_tx_set {
1574115771 TxbSet::Luma4
1574215772 } else {
@@ -15986,7 +16016,14 @@ fn read_intra_mode_sub8(
1598616016 // `is_inter_block` counts an intrabc block), so the caller takes
1598716017 // the frame-copy prediction + inter residual.
1598816018 let dv = read_intrabc_dv(dec, cdfs, mi_r, mi_c, (seg_w_mi, seg_h_mi), fctx);
15989- fctx.intrabc_dv.with(|c| c.set(Some(dv)));
16019+ // lane-av1txr: the DV travels back in the RETURN value -- it is
16020+ // NOT published through `FrameCtx::intrabc_dv`. That slot is the
16021+ // SQUARE paths' handoff (`decode_block`/`decode_leaf8` arm it,
16022+ // then `take()` it in the same call), so a sub-8x8 leaf that
16023+ // armed it left the vector standing for the NEXT >=8x8 block:
16024+ // `warped.obu`'s (38,60) 8x8 intra block took it as its own
16025+ // intrabc and read an inter var-tx `txfm_split` where libaom read
16026+ // an intra `tx_depth` (class `stale-slot-handoff`).
1599016027 hit!(INTRABC_HITS);
1599116028 return Ok((skip, DC_PRED, 0, None, None, Some(dv)));
1599216029 }
@@ -16120,6 +16157,14 @@ fn decode_leaf_split4(
1612016157 leaf_modes[i] = mode;
1612116158 leaf_skips[i] = skip;
1612216159 neighbours.record_mode_mi(lmi.0, lmi.1, 1, 1, mode);
16160+ // lane-av1txr: libaom `parse_decode_block`'s `set_txfm_ctxs` for this
16161+ // `BLOCK_4X4` leaf -- EVERY block publishes its transform size into
16162+ // the TXFM context bands, and an intrabc block's later `txfm_split`
16163+ // context is read off them (`txfm_partition_context`). A 4x4 never
16164+ // signals a tx size, so it is always TX_4X4 (`set_txfm_ctxs`'s
16165+ // `skip && is_inter` branch writes the block's own 4 pixels -- the
16166+ // same value).
16167+ set_txfm_ctxs(neighbours, lmi, 4, 1, 1, false);
1612316168 let smooth_neighbor = is_smooth_mode(leaf_above) || is_smooth_mode(leaf_left);
1612416169 if smooth_neighbor {
1612516170 hit!(SMOOTH_LUMA_HITS);
@@ -16443,45 +16488,141 @@ fn decode_leaf_rect8(
1644316488 neighbours.record_mode_mi(lmi.0, lmi.1, w_mi, h_mi, mode);
1644416489 let smooth_neighbor = is_smooth_mode(leaf_above) || is_smooth_mode(leaf_left);
1644516490 if let Some(dv) = intrabc {
16446- // lane-av1txr: an intrabc `BLOCK_4X8`/`BLOCK_8X4` leaf. No
16447- // `tx_depth` symbol is coded (libaom `block_signals_txsize` is
16448- // false below 8x8), the prediction is a frame copy at the DV and
16449- // the residual reads the INTER `LumaRect8x4` set.
16491+ // lane-av1txr: an intrabc `BLOCK_4X8`/`BLOCK_8X4` leaf. The
16492+ // prediction is a frame copy at the DV and the residual reads the
16493+ // INTER `LumaRect8x4` set -- but with `TxMode::Select` the leaf
16494+ // reads the INTER var-tx tree, exactly like every other intrabc
16495+ // block: libaom's `block_signals_txsize` is `bsize > BLOCK_4X4`
16496+ // (`blockd.h:1027`), TRUE at `BLOCK_4X8`/`BLOCK_8X4`, so
16497+ // `parse_decode_block` sends an unskipped `inter_block_tx` block
16498+ // (intrabc counts, `is_inter_block`) of a signalling bsize into
16499+ // `read_tx_size_vartx` over `max_txsize_rect_lookup[BLOCK_4X8] ==
16500+ // TX_4X8`; only `BLOCK_4X4` reads no tx symbol at all. Measured on
16501+ // `warped.obu` mi (37,62): reading NO symbol here left the
16502+ // arithmetic decoder one symbol short and desynced the very next
16503+ // block's `skip` (ours 60320 vs aomdec 48630, class
16504+ // `symbol-consumption-gap`).
1645016505 let (px, py) = (lmi.1 * MI, lmi.0 * MI);
1645116506 let reach = Reach::of_rect(bw, bh, px, py, y.width, y.height, fctx);
1645216507 flush_recon(fctx, y, u, v);
16453- let mut yb = vec![0u16; bw * bh];
16508+ let mut luma_leaves: Vec<(usize, usize, usize, usize)> = Vec::new();
16509+ if tx_select && !skip {
16510+ // `max_block_wide`/`max_block_high`: the frame's own mi grid,
16511+ // so a leaf hanging over the right/bottom edge reads no split
16512+ // symbol for the units outside it (as in `decode_block`).
16513+ let mi_cols = 2 * y.true_width.div_ceil(8);
16514+ let mi_rows = 2 * y.true_height.div_ceil(8);
16515+ let max_w_mi = w_mi.min(mi_cols.saturating_sub(lmi.1));
16516+ let max_h_mi = h_mi.min(mi_rows.saturating_sub(lmi.0));
16517+ read_var_tx_size(
16518+ dec,
16519+ cdfs,
16520+ neighbours,
16521+ lmi,
16522+ bw.max(bh),
16523+ (max_w_mi, max_h_mi),
16524+ (bw, bh),
16525+ 0,
16526+ 0,
16527+ 0,
16528+ &mut luma_leaves,
16529+ );
16530+ hit!(RECT_INTRABC_VARTX_HITS);
16531+ } else {
16532+ luma_leaves.push((0, 0, bw, bh));
16533+ // The non-var-tx arm: a SKIPPED intrabc leaf (or a frame
16534+ // outside `TxMode::Select`) publishes its own rect transform
16535+ // (`set_txfm_ctxs`'s `skip && is_inter` branch writes the
16536+ // block's own pixels -- the same size here).
16537+ txfm_partition_update_rect(neighbours, lmi, (bw, bh), (bw, bh));
16538+ }
16539+ // The transform type an intrabc block's CHROMA inherits is the
16540+ // `tx_type_map` entry at the chroma unit's co-located luma
16541+ // position (`av1_get_tx_type`, `blockd.h:1278`), i.e. the FIRST
16542+ // luma unit the tree resolved.
16543+ let single = luma_leaves.len() == 1;
16544+ let mut chroma_tx = TxType::DctDct;
16545+ let mut grid = Grid::Zero(bw * bh);
16546+ for (li, &(tu_row, tu_col, tw, th)) in luma_leaves.iter().enumerate() {
16547+ let tu_mi = (lmi.0 + tu_row, lmi.1 + tu_col);
16548+ let (tu_px, tu_py) = (tu_mi.1 * MI, tu_mi.0 * MI);
16549+ let tu_reach = if single {
16550+ reach
16551+ } else {
16552+ tu_reach(
16553+ bw, bh, tu_px - px, tu_py - py, tw, reach, px, py, y.width, y.height, fctx,
16554+ )
16555+ };
16556+ let mut yb = vec![0u16; tw * th];
1645416557 mc::predict_with_filter(
1645516558 &y.data, y.width, y.true_width, y.true_height,
16456- mv_to_q4(px, dv.1, true), mv_to_q4(py, dv.0, true),
16457- bw, bh, mc::InterpFilterKind::Bilinear, &mut yb, fctx,
16559+ mv_to_q4(tu_px, dv.1, true), mv_to_q4(tu_py, dv.0, true),
16560+ tw, th, mc::InterpFilterKind::Bilinear, &mut yb, fctx,
1645816561 );
1645916562 set_palette_pred(yb, fctx);
16460- let mut luma_tx = TxType::DctDct;
16461- let grid = if skip {
16462- let zeros = Grid::Zero(bw * bh);
16463- push_intra_rect(0, px, py, bw, bh, DC_PRED, 0, reach, &zeros, None, None, smooth_neighbor, fctx);
16563+ let tu_grid = if skip {
16564+ let zeros = Grid::Zero(tw * th);
16565+ if (tw, th) == (4, 4) {
16566+ push_intra(0, tu_px, tu_py, 4, DC_PRED, 0, tu_reach, &zeros, None, None, smooth_neighbor, fctx);
16567+ } else {
16568+ push_intra_rect(0, tu_px, tu_py, tw, th, DC_PRED, 0, tu_reach, &zeros, None, None, smooth_neighbor, fctx);
16569+ }
1646416570 zeros
1646516571 } else {
16466- let around = neighbours.around_mi_rect(lmi, bw, bh)[0];
16467- let set = if reduced_tx_set {
16572+ // A unit smaller than its own block (the var-tx split)
16573+ // reads its `txb_skip_ctx` off the neighbours; the
16574+ // whole-leaf unit's `plane_bsize == txsize_to_bsize` fixes
16575+ // it at 0.
16576+ let (set, tu_scan, around, skip_ctx) = if (tw, th) == (4, 4) {
16577+ (
16578+ inter_txbset_for(4, reduced_tx_set),
16579+ scan4,
16580+ neighbours.around_mi(tu_mi, 4)[0],
16581+ neighbours.luma_skip_ctx(tu_mi, 1),
16582+ )
16583+ } else {
16584+ (
16585+ if reduced_tx_set {
1646816586 TxbSet::LumaRect8x4Inter
1646916587 } else {
1647016588 TxbSet::LumaRect8x4InterSet1
16589+ },
16590+ scan,
16591+ neighbours.around_mi_rect(tu_mi, tw, th)[0],
16592+ 0,
16593+ )
1647116594 };
1647216595 let mut coding = cdfs.txb(set, DC_PRED);
1647316596 let (levels, tx_type) = read_coeffs_rect(
16474- dec, &mut coding, scan, bw, bh, 0, dc_sign_ctx(around.2), TxType::DctDct,
16597+ dec, &mut coding, tu_scan, tw, th, skip_ctx, dc_sign_ctx(around.2),
16598+ TxType::DctDct,
1647516599 )?;
16476- luma_tx = tx_type;
16600+ if li == 0 {
16601+ chroma_tx = tx_type;
16602+ fctx.luma_tx_type.with(|c| c.set(tx_type));
16603+ }
1647716604 let residual = dequant_and_inverse_typed_wh(
16478- &levels, bw, bh, crate::decode::bit_depth(fctx), block_q_idx(fctx),
16605+ &levels, tw, th, crate::decode::bit_depth(fctx), block_q_idx(fctx),
1647916606 plane_q_delta(0, fctx).0, plane_q_delta(0, fctx).1, tx_type,
1648016607 );
16481- push_intra_rect(0, px, py, bw, bh, DC_PRED, 0, reach, &residual, None, None, smooth_neighbor, fctx);
16608+ if (tw, th) == (4, 4) {
16609+ push_intra(0, tu_px, tu_py, 4, DC_PRED, 0, tu_reach, &residual, None, None, smooth_neighbor, fctx);
16610+ } else {
16611+ push_intra_rect(0, tu_px, tu_py, tw, th, DC_PRED, 0, tu_reach, &residual, None, None, smooth_neighbor, fctx);
16612+ }
1648216613 levels
1648316614 };
16484- fctx.luma_tx_type.with(|c| c.set(luma_tx));
16615+ if single {
16616+ grid = tu_grid;
16617+ } else {
16618+ // Per-unit neighbour state, the same shape the intra rect
16619+ // leaf's own split path runs (`decode_leaf8`'s depth-1
16620+ // loop): a transform unit inside a block is not a block at
16621+ // that position.
16622+ neighbours.record_mi_luma(tu_mi, 4, &tu_grid);
16623+ }
16624+ }
16625+ if single {
1648516626 let state = neighbour_state(&grid);
1648616627 for cell in 0..h_mi {
1648716628 if lmi.0 + cell < neighbours.mi_rows {
@@ -16493,8 +16634,17 @@ fn decode_leaf_rect8(
1649316634 neighbours.above[lmi.1 + cell][0] = state;
1649416635 }
1649516636 }
16637+ }
1649616638 neighbours.fill_skip_grid_rect(lmi, w_mi, h_mi, skip);
16497- neighbours.fill_lf_grid_rect(lmi, w_mi, h_mi, bw as u8, bh as u8, 0, fctx);
16639+ neighbours.fill_lf_grid_rect(
16640+ lmi,
16641+ w_mi,
16642+ h_mi,
16643+ if single { bw as u8 } else { 4 },
16644+ if single { bh as u8 } else { 4 },
16645+ 0,
16646+ fctx,
16647+ );
1649816648 // `record_intrabc_mi` publishes a square `n4`x`n4` footprint; a
1649916649 // 4x8/8x4 leaf needs its true `w_mi`x`h_mi` (lane-av1txr).
1650016650 record_intrabc_mi_rect(lmi.0, lmi.1, w_mi, h_mi, Some(dv), fctx);
@@ -16503,7 +16653,7 @@ fn decode_leaf_rect8(
1650316653 last_intrabc = Some(dv);
1650416654 // See [`decode_leaf_split4`]: an intrabc block's chroma
1650516655 // inherits the luma transform type.
16506- fctx.intrabc_chroma_tx.with(|c| c.set(Some(luma_tx)));
16656+ fctx.intrabc_chroma_tx.with(|c| c.set(Some(chroma_tx)));
1650716657 }
1650816658 continue;
1650916659 }
@@ -16554,6 +16704,15 @@ fn decode_leaf_rect8(
1655416704 // four. The per-TU path writes its own neighbour state, so the
1655516705 // block-level write below is skipped for it.
1655616706 let split = depth != 0 || lossless(fctx);
16707+ // lane-av1txr: libaom `parse_decode_block`'s `set_txfm_ctxs` for this
16708+ // leaf -- the size the `tx_depth` symbol resolved (depth 1 -> TX_4X4,
16709+ // else the leaf's own rect transform), published over the leaf's own
16710+ // mi span. An intrabc block's `txfm_partition_context` reads these
16711+ // bands, and the key-frame sub-8x8 leaves had no write at all:
16712+ // `warped.obu` mi (37,62) read a stale 8 where aomdec read 4 (ctx 18
16713+ // vs 19) and the tile desynced (class `context-band-not-published`).
16714+ let (ctx_tx_w, ctx_tx_h) = if split { (4, 4) } else { (bw, bh) };
16715+ txfm_partition_update_rect(neighbours, lmi, (ctx_tx_w, ctx_tx_h), (bw, bh));
1655716716 if split {
1655816717 let mut done = 0usize;
1655916718 for tu in 0..2usize {
@@ -18975,6 +19134,26 @@ pub(crate) fn reduce_inherited_chroma_tx_type_flagged(t: TxType, w: usize, h: us
1897519134 if allowed.contains(&t) { t } else { DctDct }
1897619135 }
1897719136
19137+/// The [`TxbSet`] a resolved luma transform side reads its coefficient tables
19138+/// from for a block libaom's `is_inter_block` calls inter -- which an intrabc
19139+/// block is (`blockd.h:373`), so its `tx_type` comes off the inter `ext_tx`
19140+/// sets, never the mode-indexed intra ones ([`txbset_for`]).
19141+///
19142+/// 64 is only ever the 64x64-block, depth-0, corner-scanned case
19143+/// ([`TxbSet::Luma64`]); every other resolved side maps to its own matching
19144+/// set. `get_tx_set` (spec 5.11.48) only splits on `reduced_tx_set` at
19145+/// `TX_8X8`/`TX_4X4`: an intra `TX_16X16` always reads `TX_SET_INTRA_2`
19146+/// regardless of the flag (`av1_get_ext_tx_set_type`'s
19147+/// `tx_size_sqr == TX_16X16` branch ignores `use_reduced_set` once it is past
19148+/// the `TX_32X32`/reduced-set checks), so only the 8x8 and 4x4 cases have a
19149+/// second table ([`TxbSet::Luma8Inter`]/[`TxbSet::Luma4Inter`]).
19150+///
19151+/// lane-av1txr: the intrabc leaf sites used to call a near-duplicate
19152+/// `txbset_for_inter` whose `4` fell through to `Luma64` -- 32x32-class tables
19153+/// (a 1024-entry grid) handed to a 4x4 dequant, which panicked at
19154+/// `transform.rs`'s `inverse_transform_2d_typed_wh` the first time an intrabc
19155+/// 4x4 TU coded a non-zero coefficient (`allintra0`/cpu-used=0). The
19156+/// duplicate is gone; every inter-table site goes through this one mapping.
1897819157 fn inter_txbset_for(tx_px: usize, reduced_tx_set: bool) -> TxbSet {
1897919158 match tx_px {
1898019159 // lane-sb128c r1: a 128x128 inter block's own luma unit
@@ -19013,29 +19192,6 @@ fn scan_for<'a>(
1901319192 }
1901419193 }
1901519194
19016-/// The [`TxbSet`] a resolved luma transform side reads its coefficient tables
19017-/// from -- 64 is only ever the 64x64-block, depth-0, corner-scanned case
19018-/// ([`TxbSet::Luma64`]); every other resolved side maps to its own matching
19019-/// set. `get_tx_set` (spec 5.11.48) only splits on `reduced_tx_set` at
19020-/// `TX_8X8`/`TX_4X4`: an intra `TX_16X16` always reads `TX_SET_INTRA_2`
19021-/// regardless of the flag (`av1_get_ext_tx_set_type`'s
19022-/// `tx_size_sqr == TX_16X16` branch ignores `use_reduced_set` once it is past
19023-/// the `TX_32X32`/reduced-set checks), so only the 8x8 and 4x4 cases have a
19024-/// second table ([`TxbSet::Luma8Set1`]/[`TxbSet::Luma4Set1`]).
19025-/// [`txbset_for`], for a block libaom's `is_inter_block` calls inter -- which
19026-/// an intrabc block is (`blockd.h:373`), so its `tx_type` comes off the
19027-/// inter `ext_tx` sets, never the mode-indexed intra ones.
19028-fn txbset_for_inter(tx_px: usize, reduced_tx_set: bool) -> TxbSet {
19029- match tx_px {
19030- 64 => TxbSet::Luma64,
19031- 32 => TxbSet::Luma32Inter,
19032- 16 if reduced_tx_set => TxbSet::Luma16Inter,
19033- 16 => TxbSet::Luma16InterSet1,
19034- 8 if reduced_tx_set => TxbSet::Luma8Inter,
19035- 8 => TxbSet::Luma8InterSet1,
19036- _ => TxbSet::Luma64,
19037- }
19038-}
1903919195
1904019196 fn txbset_for(tx_px: usize, reduced_tx_set: bool) -> TxbSet {
1904119197 match tx_px {
@@ -22543,6 +22699,9 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
2254322699 );
2254422700 }
2254522701 let mut dec = SymbolDecoder::new(tile_bytes);
22702+ // lane-av1txr: spec 5.9.2's `disable_cdf_update` -- a frame that sets
22703+ // it codes every symbol against the tables it started with.
22704+ dec.set_cdf_update(!cdf_update_disabled(fctx));
2254622705 crate::census::register_cdfs(&cdfs);
2254722706 neighbours.start_tile(mi_row0 as usize, mi_col0 as usize, mi_col1 as usize, fctx);
2254822707 y.set_tile_origin(
@@ -35226,6 +35385,9 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
3522635385 fctx.quant_deltas.with(|c| c.set(deltas));
3522735386 fctx.current_delta_lf.with(|c| c.set([0; 4]));
3522835387 let mut dec = SymbolDecoder::new(data);
35388+ // lane-av1txr: spec 5.9.2's `disable_cdf_update` -- a frame that sets
35389+ // it codes every symbol against the tables it started with.
35390+ dec.set_cdf_update(!cdf_update_disabled(fctx));
3522935391 crate::census::register_cdfs(&cdfs);
3523035392 // lane-comppin r9: tile-entry range, the earliest point comparable
3523135393 // against aomdec's own `r->ec.rng` right after `aom_reader_init` -- the
crates/ec-av1/src/msac.rsmodified+73 -0
@@ -305,6 +305,14 @@ pub struct SymbolDecoder<'a> {
305305 /// Bits left before the decoder starts padding with zeros (spec
306306 /// `SymbolMaxBits`), which goes negative at the end of the string.
307307 max_bits: i32,
308+ /// Whether [`SymbolDecoder::symbol`] adapts the CDF it reads (spec 8.3.2).
309+ /// `false` for a frame whose header sets `disable_cdf_update` -- libaom's
310+ /// tile entry (`decodeframe.c:2909`, `allow_update_cdf = allow_update_cdf
311+ /// && !cm->features.disable_cdf_update`) skips the adaptation there, so
312+ /// reading on would drift this decoder's tables away from the encoder's
313+ /// and desync mid-frame. Per-READER, not global: frames of one stream can
314+ /// decode on different worker threads.
315+ adapt: bool,
308316 }
309317
310318 impl Drop for SymbolDecoder<'_> {
@@ -326,6 +334,7 @@ impl<'a> SymbolDecoder<'a> {
326334 value: 0,
327335 range: 1 << 15,
328336 max_bits: 8 * data.len() as i32 - 15,
337+ adapt: true,
329338 };
330339 let num_bits = usize::min(data.len() * 8, 15) as u32;
331340 let buf = d.f(num_bits);
@@ -333,6 +342,15 @@ impl<'a> SymbolDecoder<'a> {
333342 d
334343 }
335344
345+ /// Spec 5.9.2's `disable_cdf_update`, the reader side: `false` (the
346+ /// default) adapts every CDF [`symbol`](Self::symbol) reads; `true`
347+ /// leaves each table exactly as it was read, matching libaom's
348+ /// `allow_update_cdf` (decodeframe.c:2909). Set once per tile reader by
349+ /// the frame's own header bit.
350+ pub(crate) fn set_cdf_update(&mut self, update: bool) {
351+ self.adapt = update;
352+ }
353+
336354 /// `f(n)`: the next `n` bits, most significant first, zero past the end.
337355 #[inline]
338356 fn f(&mut self, n: u32) -> u32 {
@@ -386,7 +404,14 @@ impl<'a> SymbolDecoder<'a> {
386404 // relaxed load.
387405 let t0 = if crate::census::armed() { self.tell_bits() } else { 0.0 };
388406 let s = self.symbol_fixed(cdf);
407+ // lane-av1txr: spec 5.9.2's `disable_cdf_update` -- a frame that sets
408+ // it codes every symbol against the tables it started with, so this
409+ // reader must leave them untouched too (libaom: `allow_update_cdf =
410+ // allow_update_cdf && !cm->features.disable_cdf_update`,
411+ // decodeframe.c:2909). The flag is per-reader (see `Self::adapt`).
412+ if self.adapt {
389413 update_cdf(cdf, s);
414+ }
390415 if crate::census::armed() {
391416 crate::census::charge(cdf.as_ptr() as usize, self.tell_bits() - t0);
392417 }
@@ -813,6 +838,54 @@ pub(crate) mod tests {
813838 assert_eq!(fast_cdfs[pick.min(14)], slow_cdfs[pick.min(14)], "cdf after item {i}");
814839 }
815840 }
841+
842+ /// lane-av1txr: spec 5.9.2's `disable_cdf_update`, the reader half --
843+ /// [`SymbolDecoder::set_cdf_update`]. A reader told not to adapt must
844+ /// reproduce a writer that never adapted
845+ /// ([`SymbolEncoder::symbol_fixed`]), and the DEFAULT reader must not: the
846+ /// flag is what keeps a real `aomenc --cdf-update-mode=0` stream in sync
847+ /// (its tiles desynced at the first multi-symbol block without it).
848+ #[test]
849+ fn a_reader_told_not_to_adapt_matches_a_non_adapting_writer() {
850+ let mut state = 0x2545_f491_4f6c_dd1du64;
851+ let mut enc = SymbolEncoder::new();
852+ let cdfs: Vec<Vec<u16>> = (2..=16).map(flat_cdf).collect();
853+ let mut written = Vec::new();
854+ for i in 0..600 {
855+ let pick = i % cdfs.len();
856+ let nsyms = pick + 2;
857+ let sym = (rng(&mut state) % nsyms as u64) as usize;
858+ enc.symbol_fixed(sym, &cdfs[pick]);
859+ written.push((pick, sym));
860+ }
861+ let payload = enc.finish();
862+
863+ let mut fixed = SymbolDecoder::new(&payload);
864+ fixed.set_cdf_update(false);
865+ let mut adapting = SymbolDecoder::new(&payload);
866+ let mut fixed_cdfs: Vec<Vec<u16>> = (2..=16).map(flat_cdf).collect();
867+ let mut adapting_cdfs: Vec<Vec<u16>> = (2..=16).map(flat_cdf).collect();
868+ let mut adapting_mismatches = 0usize;
869+ for (i, &(pick, sym)) in written.iter().enumerate() {
870+ assert_eq!(
871+ fixed.symbol(&mut fixed_cdfs[pick]),
872+ sym,
873+ "non-adapting reader, item {i} (pick {pick})"
874+ );
875+ if adapting.symbol(&mut adapting_cdfs[pick]) != sym {
876+ adapting_mismatches += 1;
877+ }
878+ }
879+ assert_eq!(
880+ fixed_cdfs,
881+ (2..=16).map(flat_cdf).collect::<Vec<_>>(),
882+ "the non-adapting reader still moved a table"
883+ );
884+ assert!(
885+ adapting_mismatches > 0,
886+ "the adaptation flag is inert: the default reader reproduced a non-adapting writer"
887+ );
888+ }
816889 }
817890
818891 /// Symbol-by-symbol writer/reader trace (`EC_AV1_SYMTRACE=<dir>`), the
crates/ec-av1/src/refusal_inventory.rsmodified+21 -14
@@ -55,7 +55,14 @@ const REFUSALS: &[&str] = &[
5555 // `every_read_intra_mode_call_site_hands_the_reader_a_palette_cache`,
5656 // which keeps that invariant now the refusal is gone).
5757 "intra block copy on a HORZ/VERT/1:4 rect intra strip (reconstruction is not ported at this shape)",
58- "a sub-8x8 leaf that uses intrabc (this reader has no block-vector path; the 8x8-and-up reader reconstructs one)",
58+ // lane-av1txr: `a sub-8x8 leaf that uses intrabc (…)` is GONE -- the
59+ // capability landed in this lane (4x4 / 4x8 / 8x4 intrabc leaves read the
60+ // DV and reconstruct a frame copy + the INTER residual; gates
61+ // `a_non_420_subsampled_sequence_header_is_refused_by_name`'s sibling
62+ // witnesses and the `warped.obu`/`allintra.obu` traces). Its census gate
63+ // (`a_sub8_leaf_census_over_intrabc_screen_streams_measures_the_sub8_refusal`)
64+ // still runs: it now reports `reached = 0` with the same non-vacuous
65+ // premise (allow_intrabc frames + decoded sub-8 leaves).
5966 "a bit depth of 12 (this decoder is gated at 8 and 10 only: warp/MC/wiener rounding shifts change at 12-bit and no 12-bit gate exists)",
6067 // lane-lossless/lane-lossless2: a lossless frame (base_q_idx 0) decodes
6168 // sample-exact, KEY and INTER -- TX_4X4 with the Walsh-Hadamard transform
@@ -256,11 +263,15 @@ const PROVEN: &[(&str, &str)] = &[
256263 "a tx_type symbol outside its CDF's own set: {t}",
257264 "every_tx_type_symbol_of_every_cdf_width_maps_into_its_own_set",
258265 ),
259- // lane-t900 r24, enumeration: the reader covers spec 5.11.40's whole value
260- // domain (`0..=(1 << 20) - 2`, both ends of every prefix length), so the
261- // refusal is outside it. What it still names is a bit pattern no encoder
262- // writes -- a 20th prefix bit of 0, which the spec's `length == 20` break
263- // makes a don't-care.
266+ // lane-t900 r24 + lane-av1txr RE-PIN, measured: the reader covers spec
267+ // 5.11.40's whole value domain (`0..=(1 << 20) - 2`, both ends of every
268+ // prefix length), so no CONFORMANT symbol stream reaches it -- but the
269+ // string IS reachable as a SYMPTOM: a frame this decoder desyncs on
270+ // (measured: a real libaom monochrome key frame, gate
271+ // `a_real_libaom_monochrome_key_frame_is_refused_by_name` at
272+ // `stream.rs`) leaves the reader mid-symbol and the next `read_golomb`
273+ // reports this tail. The claim below therefore pins the reader's value
274+ // coverage, NOT the string's unreachability.
264275 (
265276 "a Golomb tail longer than this decoder reads",
266277 "read_golomb_reads_every_value_a_conformant_stream_can_carry",
@@ -379,14 +390,10 @@ const PROVEN: &[(&str, &str)] = &[
379390 "CfL, filter intra or a palette on a 128-root HORZ/VERT intra block (every one of their size gates caps at 64x64 or below, so none of these symbols exists there)",
380391 "no_128_root_half_reads_a_cfl_filter_intra_or_palette_symbol",
381392 ),
382- // lane-t900 r33, CENSUS: the `use_intrabc` symbol IS read at the sub-8
383- // reader for every sub-8x8 leaf of an `allow_intrabc` frame, and over the
384- // `--min-partition-size=4` exact-repetition screen arms every such symbol
385- // came back 0 while the frames decode pixel-exact.
386- (
387- "a sub-8x8 leaf that uses intrabc (this reader has no block-vector path; the 8x8-and-up reader reconstructs one)",
388- "a_sub8_leaf_census_over_intrabc_screen_streams_measures_the_sub8_refusal",
389- ),
393+ // lane-av1txr: the sub-8x8 intrabc refusal this census pinned is GONE (the
394+ // capability landed; see the note in `REFUSALS`). The census gate survives
395+ // as the witness that its premise is still exercised -- `reached` is 0 by
396+ // construction now.
390397 // lane-t900 r33, CENSUS: four quantisers of the recipe that reaches the
391398 // intrabc var-tx tree at all read it for 5 blocks in total, every one of
392399 // which resolved to a UNIFORM leaf size, with the frames pixel-exact.
crates/ec-av1/src/stream.rsmodified+141 -0
@@ -1245,6 +1245,13 @@ pub(crate) struct SeqFlags {
12451245 pub(crate) bit_depth: u8,
12461246 pub(crate) order_hint_bits: u32,
12471247 pub(crate) mc_identity: bool,
1248+ /// lane-av1txr: `color_config.subsampling_x/y` (spec 5.5.2). The decoder
1249+ /// itself hardcodes 4:2:0 everywhere, so these exist only for the
1250+ /// sequence-level refusal in [`decode_stream_with`] -- nothing downstream
1251+ /// reads them. A monochrome header parses as 1,1, so `!(1,1)` singles out
1252+ /// 4:4:4 (profile 1 / sRGB) and 4:2:2 (profile 2 below 12-bit).
1253+ pub(crate) subsampling_x: u8,
1254+ pub(crate) subsampling_y: u8,
12481255 }
12491256
12501257 impl SeqFlags {
@@ -1261,6 +1268,8 @@ impl SeqFlags {
12611268 bit_depth: seq.map_or(8, |s| s.color_config.bit_depth),
12621269 order_hint_bits: seq.map_or(0, |s| s.order_hint_bits),
12631270 mc_identity: seq.is_some_and(|s| s.color_config.matrix_coefficients == 0),
1271+ subsampling_x: seq.map_or(1, |s| s.color_config.subsampling_x),
1272+ subsampling_y: seq.map_or(1, |s| s.color_config.subsampling_y),
12641273 }
12651274 }
12661275 }
@@ -1601,6 +1610,27 @@ fn decode_frame(
16011610 "a bit depth of 12 (this decoder is gated at 8 and 10 only: warp/MC/wiener rounding shifts change at 12-bit and no 12-bit gate exists)",
16021611 ));
16031612 }
1613+ // lane-av1txr: `color_config.subsampling_x/y` (spec 5.5.2) are parsed by
1614+ // `ec-av1-syntax` -- profile 1 forces 4:4:4, profile 2 below 12-bit forces
1615+ // 4:2:2, and the sRGB identity description forces full-range 4:4:4 -- but
1616+ // the decoder reads them NOWHERE: every chroma extent is hardcoded 4:2:0
1617+ // (`let (chroma_w, chroma_h) = (bw / 2, bh / 2)` at every rect site,
1618+ // `chroma_side = side / 2` in `decode_block`) and the probe emits 4:2:0
1619+ // planes only. Measured consequence: EVERY 4:4:4 stream desyncs at the
1620+ // first chroma transform (a444-cu6 block (0,0): aomdec reads
1621+ // `EC_COEFF plane=1 tx=TX_8X16` at rng 39857 where ours reads a 4-wide,
1622+ // 8-high 4:2:0 chroma block at the same rng) and then decodes pixels that
1623+ // are silently wrong. Refuse by name rather than return garbage. A
1624+ // `num_planes == 1` (monochrome) header keeps its parsed 1,1 and is
1625+ // unaffected. Gates: `a_non_420_subsampled_sequence_header_is_refused_by_
1626+ // name` below (hand-built profile 1/2 headers plus a real aomenc 4:4:4
1627+ // stream).
1628+ if seq.subsampling_x != 1 || seq.subsampling_y != 1 {
1629+ return Err(Error::unsupported(
1630+ "AV1 decode_stream",
1631+ "a chroma format other than 4:2:0 (subsampling_x/y != 1/1): every chroma extent in this decoder is hardcoded to 4:2:0 and the probe emits 4:2:0 planes only, so a 4:4:4/4:2:2 stream would decode silently wrong pixels",
1632+ ));
1633+ }
16041634 // lane-dpm1: a LOSSLESS frame (`qindex == 0` with zero deltas, spec 5.9.12)
16051635 // is a different tile syntax, and this decoder has none of it: libaom
16061636 // forces TX_4X4 with the WALSH-HADAMARD transform over every block (so no
@@ -1633,6 +1663,11 @@ fn decode_frame(
16331663 // `a_lossless_libaom_inter_frame_decodes_sample_exact`.
16341664 crate::decode::set_lossless(coded_lossless, fctx);
16351665 crate::decode::set_bit_depth(bit_depth, fctx);
1666+ // lane-av1txr: spec 5.9.2 `disable_cdf_update` -- a frame that sets it
1667+ // codes every tile symbol against the CDFs it started with, so the tile
1668+ // readers must not adapt (libaom `decodeframe.c:2909`:
1669+ // `allow_update_cdf = allow_update_cdf && !cm->features.disable_cdf_update`).
1670+ crate::decode::set_disable_cdf_update(header.disable_cdf_update, fctx);
16361671 // spec 7.16: this frame's superres state, for the filter chain --
16371672 // `decode.rs` upscales between CDEF and loop restoration and sizes
16381673 // the LR unit grid in upscaled coordinates. Cleared (0, 8) on an
@@ -2016,6 +2051,54 @@ pub(crate) mod tests {
20162051 );
20172052 }
20182053
2054+ /// lane-av1txr: a sequence header describing any chroma shape but 4:2:0 is
2055+ /// refused by name, because the decoder reconstructs every chroma extent
2056+ /// at hardcoded 4:2:0 (`bw / 2, bh / 2` at every rect site) and the probe
2057+ /// emits 4:2:0 planes only -- a 4:4:4 stream "decodes" into silently wrong
2058+ /// pixels (measured: a444-cu6's first chroma transform reads a 4x2-wide/
2059+ /// 8-high 4:2:0 chroma at aomdec's `TX_8X16` entry rng 39857, then
2060+ /// desyncs; every 4:4:4 fixture measured byte-differs from ffmpeg).
2061+ ///
2062+ /// Reachability, not a pixel claim: the header is written at the two
2063+ /// profiles that force a non-4:2:0 shape (spec 5.5.2 -- profile 1 forces
2064+ /// 4:4:4 with no coded bit; profile 2 below 12-bit forces 4:2:2) and the
2065+ /// tile is never reached. The 4:2:0 CONTROL below proves the refusal is
2066+ /// about the shape, not about this construction.
2067+ #[test]
2068+ fn a_non_420_subsampled_sequence_header_is_refused_by_name() {
2069+ const NAME: &str = "a_non_420_subsampled_sequence_header_is_refused_by_name";
2070+ const REFUSAL: &str = "a chroma format other than 4:2:0";
2071+ let fctx = &crate::decode::FrameCtx::new();
2072+ let picture = test_card(64, 64);
2073+ let encoded = encode_key_frame_with_ctx(&picture, 100, 0.5, fctx).unwrap();
2074+ for (profile, label, sx, sy) in [(1u8, "4:4:4", 0u8, 0u8), (2, "4:2:2", 1, 0)] {
2075+ let color = ec_av1_syntax::ColorConfig {
2076+ num_planes: 3,
2077+ subsampling_x: sx,
2078+ subsampling_y: sy,
2079+ ..Default::default()
2080+ };
2081+ let (mut seq, header) =
2082+ crate::encode::key_frame_headers_colour(64, 64, 100, color).unwrap();
2083+ seq.seq_profile = profile;
2084+ let mut stream = crate::sequence::sequence_header_obu(&seq).unwrap();
2085+ stream.extend_from_slice(
2086+ &crate::frame::frame_obu(&seq, &header, &encoded.tile).unwrap(),
2087+ );
2088+ let err = decode_stream(&stream).unwrap_err().to_string();
2089+ assert!(
2090+ err.contains(REFUSAL),
2091+ "{NAME}: expected the non-4:2:0 refusal for the {label} header, got: {err}"
2092+ );
2093+ }
2094+ // CONTROL: the same construction at profile 0 (4:2:0) still decodes.
2095+ let (seq, header) = crate::encode::key_frame_headers(64, 64, 100).unwrap();
2096+ let mut stream = crate::sequence::sequence_header_obu(&seq).unwrap();
2097+ stream.extend_from_slice(&crate::frame::frame_obu(&seq, &header, &encoded.tile).unwrap());
2098+ let frames = decode_stream(&stream).expect("the 4:2:0 control must decode");
2099+ assert_eq!(frames.len(), 1, "{NAME}: the 4:2:0 control decoded no frame");
2100+ }
2101+
20192102 /// lane-av1-decode (pilot resume, 2026-09-19): a real libaom MONOCHROME key
20202103 /// frame is currently REFUSED BY NAME, and this gate pins that as today's
20212104 /// measured first stop for a real encoder stream.
@@ -6669,6 +6752,64 @@ pub(crate) mod tests {
66696752 }
66706753 }
66716754
6755+ /// lane-av1txr: a real `aomenc --cdf-update-mode=0` stream (spec 5.9.2
6756+ /// `disable_cdf_update`) decodes SAMPLE-EXACT. The read that was missing:
6757+ /// `stream.rs` never threaded the header bit, so the tile readers adapted
6758+ /// every symbol of a frame the encoder coded against fixed tables -- the
6759+ /// stream desynced at its first multi-symbol block and the pixels differed
6760+ /// from byte 6 (`EC_PROBE_OUT` vs `ffmpeg -pix_fmt yuv420p`, measured
6761+ /// 2026-09-20). The msac unit gate
6762+ /// (`a_reader_told_not_to_adapt_matches_a_non_adapting_writer`) pins the
6763+ /// mechanism; this one pins the wiring end to end.
6764+ #[test]
6765+ fn a_real_aomenc_stream_with_cdf_update_disabled_decodes_pixel_exact() {
6766+ const NAME: &str = "a_real_aomenc_stream_with_cdf_update_disabled_decodes_pixel_exact";
6767+ if !have_ffmpeg() || !have_aomenc() {
6768+ eprintln!("SKIP {NAME}: no ffmpeg/aomenc");
6769+ return;
6770+ }
6771+ let (width, height) = (256usize, 192usize);
6772+ let stream = screen_intrabc_stream_with(
6773+ "testsrc2=size=256x192:rate=25",
6774+ "45",
6775+ "1",
6776+ false,
6777+ true,
6778+ &["--cdf-update-mode=0", "--limit=3"],
6779+ );
6780+ // Non-vacuity: the fixture must really code the bit on every frame.
6781+ let mut parser = Av1Parser::new();
6782+ let mut pos = 0usize;
6783+ let mut headers = 0usize;
6784+ while pos < stream.len() {
6785+ let Ok(obu) = parser.parse_obu(&stream[pos..]) else {
6786+ break;
6787+ };
6788+ pos += obu.total_size.max(1);
6789+ let header = match &obu.kind {
6790+ ObuKind::Frame(h, _) | ObuKind::FrameHeader(h) => h,
6791+ _ => continue,
6792+ };
6793+ assert!(
6794+ header.disable_cdf_update,
6795+ "{NAME}: frame {headers} does not carry disable_cdf_update -- aomenc ignored \
6796+ --cdf-update-mode=0"
6797+ );
6798+ headers += 1;
6799+ }
6800+ assert!(headers >= 3, "{NAME}: only {headers} frame headers in the fixture");
6801+ let frames = decode_stream(&stream).unwrap_or_else(|e| panic!("{NAME}: {e}"));
6802+ let theirs = ffmpeg_decode_sequence(&stream, width, height, frames.len());
6803+ assert_eq!(frames.len(), theirs.len(), "{NAME}: frame count");
6804+ for (i, (ours, ref_frame)) in frames.iter().zip(theirs.iter()).enumerate() {
6805+ assert!(
6806+ ours.y == ref_frame.y && ours.u == ref_frame.u && ours.v == ref_frame.v,
6807+ "{NAME}: frame {i} does not match ffmpeg"
6808+ );
6809+ }
6810+ eprintln!("{NAME}: {headers} disable_cdf_update frame headers, all frames sample-exact");
6811+ }
6812+
66726813 /// lane-kf900 r4, the gate for the two lifted palette refusals ("a 1:4
66736814 /// rect strip that actually uses a palette (reconstruction is not ported
66746815 /// at this shape)" and "a palette block on a HORZ/VERT intra strip below
lanes/av1txrouting.report.mdmodified+148 -0
@@ -179,3 +179,151 @@ Oracle build: `~/.cache/aom-oracle` (cmake+ninja) instrumented with
179179 `decode_leaf8` dequant panic.
180180 3. Add the sequence-header subsampling refusal (§3) and re-pin the inventory.
181181 4. Run `cargo test -p ec-av1 --lib` + `cargo check -p ec-av1 --all-targets`.
182+
183+---
184+
185+## 9. Continuation (2026-09-20, second lane pass)
186+
187+Five defects fixed, each proven by a first-divergence move and/or a gate. **Warped
188+is still NOT byte-exact** (§9.4) and `allintra`/`allintra0` still stop at NAMED
189+refusals that belong to the 1:4-rect-strip lane (§9.3). Honest status first.
190+
191+### 9.1 Silent-garbage guard: non-4:2:0 chroma is refused by name
192+
193+`stream.rs`'s `decode_stream` now refuses `seq.subsampling_x != 1 ||
194+seq.subsampling_y != 1` (threaded through `SeqFlags::subsampling_x/y`). A
195+monochrome header parses as 1,1, so it is untouched (the mono lane's stream and
196+its tripwire keep their meaning).
197+
198+Evidence:
199+- `a_non_420_subsampled_sequence_header_is_refused_by_name` (stream.rs tests):
200+ a hand-built profile-1 (4:4:4) and profile-2 (4:2:2) header each refuse with
201+ the named string, and the profile-0 CONTROL still decodes — so the gate is
202+ about the shape, not the construction.
203+- Real encoder stream: `aomenc` auto-promotes to profile 1 for `yuv444p` input;
204+ `EC_PROBE_OUT` vs `ffmpeg -pix_fmt yuv444p` on that stream **refuses by name**
205+ where the same code path used to decode silently wrong pixels.
206+
207+### 9.2 Parsed-but-unread pixel-affecting header field sweep
208+
209+A census of every `SequenceHeader`/`ColorConfig`/frame-header field against the
210+decoder's reads (scout report, re-derivable by grep) found exactly two
211+pixel-affecting fields the decoder never consumed; both are now closed:
212+
213+1. `subsampling_x/y` — §9.1 (refusal).
214+2. **`disable_cdf_update`** (the new find): spec 8.3.2 skips ALL per-symbol CDF
215+ adaptation when set, and libaom's tile entry does exactly that
216+ (`decodeframe.c:2909`, `allow_update_cdf && !disable_cdf_update`). The
217+ decoder adapted unconditionally. Fixed at the one authoring point:
218+ `msac::SymbolDecoder::adapt` (per READER, not global — frames decode on
219+ different workers) + `FrameCtx::disable_cdf_update` + one line in
220+ `decode_frame`.
221+
222+ Evidence, both directions:
223+ - `a_real_aomenc_stream_with_cdf_update_disabled_decodes_pixel_exact`
224+ (real `aomenc --cdf-update-mode=0`, 3 frames): asserts every frame header
225+ carries the bit, then compares all planes against ffmpeg. Green.
226+ - fail-pre-fix, measured: with `set_cdf_update` forced ON the SAME stream
227+ differs from ffmpeg at **byte 6** (`OK: 3 frames` but wrong pixels).
228+ - `a_reader_told_not_to_adapt_matches_a_non_adapting_writer` (msac unit):
229+ a non-adapting reader reproduces a non-adapting writer symbol-for-symbol
230+ and its tables stay untouched; the default reader does not (flag
231+ load-bearing).
232+
233+Everything else never-read is dispositioned as metadata (color_primaries /
234+transfer_characteristics / color_range / chroma_sample_position, timing and
235+frame-id fields, `showable_frame`, `render_width/height` — deliberate per
236+`encode.rs:15917-15921`), or consumed indirectly by the parser (seq gates forced
237+into the frame header: superres/CDEF/restoration/warped/enable_ref_frame_mvs,
238+`separate_uv_delta_q`, `seq_force_*`). `mono_chrome`/`num_planes` is the sibling
239+lane-av1-mono's.
240+
241+### 9.3 transform.rs:1134 panic — ROOT-CAUSED AND FIXED (not a refusal)
242+
243+`txbset_for_inter` was a near-duplicate of `inter_txbset_for` whose `4` fell
244+through to `TxbSet::Luma64`: a 4x4 intrabc/inter TU read 32x32-class tables (a
245+1024-entry grid) and panicked in `inverse_transform_2d_typed_wh` the first time
246+such a TU coded a non-zero coefficient (`allintra0`, cpu-used 0). libaom reads a
247+4x4 grid with the 16-symbol INTER ext-tx set there (`EXT_TX_SET_ALL16` /
248+`_DTT4_IDTX` reduced). Fix: delete the duplicate, route all inter-table sites
249+through `inter_txbset_for` (which already had the 4 arms). Result: **no panic**;
250+`allintra0` now stops at the EXISTING named refusal "an intrabc block whose
251+var-tx tree resolved to mixed leaf transform sizes" (`decode.rs:14327`) — a
252+lane-of-its-own gap, not a crash.
253+
254+### 9.4 warped: four more defects out of the way, still not byte-exact
255+
256+Ladder evidence (`EC_TRACE_MODE_STEP=1` on the instrumented aomdec vs ours,
257+rng-ladder subsequence walk, frame 0). First divergence moved
258+**(38,60) → (38,62) → (46,66)**; consuming steps matched 916 → 1119 → 1349 of
259+aomdec's 2204 before the next divergence.
260+
261+1. **Rect intrabc leaves read no transform symbol** (the charter's named stop):
262+ `block_signals_txsize` is `bsize > BLOCK_4X4` (`blockd.h:1027`), TRUE at
263+ `BLOCK_4X8`/`BLOCK_8X4` — so an UNSKIPPED intrabc rect leaf reads the INTER
264+ var-tx tree (`read_tx_size_vartx` over `max_txsize_rect_lookup[BLOCK_4X8] ==
265+ TX_4X8`), not nothing. Fixed in `decode_leaf_rect8`'s intrabc arm
266+ (`read_var_tx_size` with the rect entry + per-4x4-TU residual/reconstruction
267+ when the tree splits, `RECT_INTRABC_VARTX_HITS` counter, probe line
268+ `rect_intrabc_vartx`). aomdec's `EC_VARTX mi_row=37 mi_col=62 bsize=2
269+ tx_size=6 ctx=19 rng=37745` is now reproduced exactly.
270+2. **Sub-8x8 leaves never published the TXFM context bands**: libaom runs
271+ `set_txfm_ctxs` for EVERY block; `decode_leaf_split4`/`decode_leaf_rect8` had
272+ no write, so an intrabc block's `txfm_partition_context` read a stale 8 where
273+ aomdec read 4 (ctx 18 vs 19). Fixed (+ unit bug caught on the way: the rect
274+ helper takes PIXELS for the parent span, not mi).
275+3. **`intrabc_dv` slot leak**: `read_intra_mode_sub8` armed the frame slot and
276+ the sub-8x8 callers never took it, so the NEXT 8x8+ block inherited the
277+ vector and read an inter var-tx symbol where libaom read an intra
278+ `tx_depth`. The DV already travels in the return value; the arm is gone.
279+4. (9.3's table fix also feeds this path: the split rect leaf's 4x4 TUs read
280+ `Luma4Inter`/`Set1`.)
281+
282+**Remaining first divergence (frame 0, mi (46,66), 8x8 intra block):**
283+`tx_depth ctx` ours 0 vs aomdec 1. Root cause, localised: the key-frame
284+square/leaf tx-depth context is read through `tx_size_context` — the DEBLOCK
285+grid approximation — while libaom's `get_tx_size_context` (`pred_common.h:342`)
286+reads the **TXFM bands** with the inter-neighbour block-size override. The
287+approximation only coincides while every neighbour codes one whole-block
288+transform, "which is exactly what `TxMode::Select` ends" (the helper's own
289+doc) — warped's key frame IS `TxMode::Select` with intrabc. The fix is the
290+lane's next step and is NOT small: `publish_txfm_bands_if_in_inter` returns
291+early on a key frame, so switching the read to libaom's formula requires
292+publishing the bands from EVERY key-frame block (strips included) in the same
293+change, or currently-byte-exact streams can regress. Left unpushed.
294+
295+Consequences for the rest of the corpus: `allintra` and `warped` both now stop
296+at `decode.rs:9155` "intra block copy on a HORZ/VERT/1:4 rect intra strip
297+(reconstruction is not ported at this shape)" — after **16 more mi rows** of
298+frame 0 than before the fix (was (38,60), now (54,64)). That refusal is lane 3's
299+and is left standing.
300+
301+### 9.5 Inventory re-pin (done)
302+
303+- The sub-8x8-intrabc refusal no longer exists (the capability landed), so its
304+ `REFUSALS` entry is replaced by a note and its claims-table pair is retired;
305+ the census gate stays as the non-vacuous premise witness (`reached = 0` now).
306+- The Golomb entry is RE-PINNED with the measurement: the reader covers the
307+ whole legal value domain, but the string is reachable as a DESYNC SYMPTOM
308+ (real monochrome libaom stream, `stream.rs`'s mono tripwire) — the claim pins
309+ value coverage, not unreachability.
310+
311+### 9.6 Gates
312+
313+- `cargo test -p ec-av1 --lib -- <the three new gates>`: 3 passed, 0 warnings.
314+- Full `cargo test -p ec-av1 --lib` and `cargo check -p ec-av1 --all-targets`
315+ were launched at the end of this pass; see the commit message / next session
316+ for their totals (baseline 592/0/60).
317+- `cargo build --release -p ec-av1 --example decode_probe`: 0 warnings.
318+
319+### 9.7 Next steps (ordered)
320+
321+1. Read the key-frame tx-depth context from the TXFM bands (libaom
322+ `get_tx_size_context`) and publish the bands from every key-frame block —
323+ then re-run the (46,66) ladder rung and the corpus sweep (§5's tripwires
324+ included).
325+2. `allintra`'s 1:4 rect-strip intrabc (lane 3) and the mixed-leaf var-tx
326+ refusal (the new stop for `allintra0`).
327+3. Add the 4x8/8x4 intrabc witnesses to the media-gated corpus (a real stream
328+ that codes one: `warped.obu` reaches `RECT_INTRABC_VARTX_HITS == 1` and now
329+ decodes past the old divergence).