forge
Explore
Log in

Don't you dare go Hollow

Merge lane-av1422chrtx: a 32-point INTER chroma unit inherits the luma's IDTX

Browse files at this commit

1d5fb9c7898d548cee3de42b180e7cbcc1d7371aAhmet Kaan GümüşParent: 60a0116a3e343b
libaom (av1/common/blockd.h, quoted in the report): the chroma unit's tx_type is the SAME
xd->tx_type_map cell the luma unit stamped (scaled by subsampling_x/y), then reduced by the INTER
transform set -- and at 32 points that set is EXT_TX_SET_DCT_IDTX, whose name says it: DCT_DCT plus
IDTX, so av1_ext_tx_used[DCT_IDTX][IDTX] is true and the luma's coded IDTX survives. The clamp to
DCT_DCT is txsize_sqr_up_map[tx_size] > TX_32X32 (64 and up), NOT >= 32.
Ours was a HARDCODED '32-point chroma is DCT_DCT' rule in read_plane and read_rect_chroma_unit,
ordered BEFORE the armed intrabc_chroma_tx slot, so an intrabc block's inherited IDTX was never even
consulted. read_inter_plane was already correct (reduce_inherited_chroma_tx_type's sqr_up == 32 arm
IS libaom's inter set verbatim); only the two intrabc readers that go through read_plane /
read_rect_chroma_unit were wrong. Both now resolve intra / inter-armed / size separately, so the only
behaviour change is: a 32-point chroma unit of an intrabc block moves from DCT_DCT to IDTX, and only
when the luma coded IDTX (the slot is armed exclusively under intrabc_dv.is_some(), both set sites
verified). 64-point chroma still reduces to DctDct, intra chroma at 32+ untouched, sub-32 units
byte-identical, lossless clamp untouched.
Proof: 420_oddheight_320x232.obu U 5772/V 12086 -> 0/0/0, 16/16 frames exact; a fresh 320x248
U 14343/V 16310 -> 0/0/0; the 27-cell sweep goes 19 -> 25 exact (newly exact 320x232, 322x232,
324x232, 320x248, 324x240). The non-vacuity control is re-run AFTER the fix (flipping a real oracle
byte moves the count by exactly +1 in the right plane and spoils exactly one frame), and the tripwire
gate is FLIPPED as required: the_pinned_420_oddheight_witness_is_pinned_and_decodes_byte_exact asserts
(0,0,0) with exact == frames, with a mutation proof (restoring DctDct reds it by name with
left (0,200,17658) vs right (0,0,0)).
Two cells still diverge with LUMA errors (320x236 Y 234349, 322x248 Y 36286) -- a separate,
unlocalised mechanism, disclosed in the report's not_done rather than folded into this claim.

Conflict resolution in stream.rs: lanes film10fix and chrtx both appended to the control area.
Kept film10fix's ffmpeg-comparator control whole (ours), took chrtx's new count_rawvideo_diffs
3-arg call and its flipped gate, and repaired the doc comment the splice left describing the
superseded ratchet.
crates/ec-av1/src/decode.rsmodified+51 -23
@@ -21274,27 +21274,47 @@ fn read_plane(
21274 if lossless(fctx) {21274 if lossless(fctx) {
21275 coding.tx_type = None;21275 coding.tx_type = None;
21276 }21276 }
21277- // Luma's `default_tx_type` is only a fallback for the sizes whose21277+ // A chroma plane's `tx_type` is *never* its own coded symbol
21278- // `TxbSet` carries no symbol at all (32-point and up), which the spec21278+ // (`coding.tx_type` is always `None` for every `TxbSet::Chroma*`), so it is
21279- // fixes at `DCT_DCT` regardless of mode; a chroma plane's `tx_type` is21279+ // resolved, not read. Three cases, in libaom's own order
21280- // *never* its own coded symbol (`coding.tx_type` is always `None` for21280+ // (`av1_get_tx_type` / `av1_get_ext_tx_set_type`, `blockd.h`):
21281- // every `TxbSet::Chroma*`), so it would take `Intra_Mode_To_Tx_Type` of21281+ //
21282- // the plane's own predicted mode (`default_intra_tx_type`) -- except21282+ // * **intra** chroma: `intra_mode_to_tx_type(mbmi, PLANE_TYPE_UV)` -- the
21283- // `av1_get_ext_tx_set_type` (`blockd.h`) resolves chroma at `tx_size_sqr21283+ // plane's own predicted mode (`default_intra_tx_type`) -- then clamped by
21284- // >= TX_32X32` to `EXT_TX_SET_DCTONLY`, which forces the result back to21284+ // `av1_get_ext_tx_set_type`. At 32 points and up that set is
21285- // `DCT_DCT` no matter what the mode-indexed table said (`TxbSet::Chroma8`21285+ // `EXT_TX_SET_DCTONLY` (the `is_inter ? EXT_TX_SET_DCT_IDTX :
21286- // and `Chroma16` never hit this — every value `default_intra_tx_type` can21286+ // EXT_TX_SET_DCTONLY` line), which forces `DCT_DCT` no matter what the
21287- // produce is already a member of both `TX_SET_INTRA_1`/`_2`, so nothing21287+ // mode-indexed table said. `TxbSet::Chroma8`/`Chroma16` never hit this --
21288- // narrows there — only `Chroma32` and up do).21288+ // every value `default_intra_tx_type` can produce is already a member of
21289- let default_tx_type = if plane_idx == 0 || side >= 32 {21289+ // both `TX_SET_INTRA_1`/`_2`, so nothing narrows there -- only
21290+ // `Chroma32` and up do.
21291+ // * **inter** chroma, i.e. [`INTRABC_CHROMA_TX`]: the same
21292+ // `xd->tx_type_map` cell the luma unit stamped (`blk_row <<=
21293+ // pd->subsampling_y`, `blk_col <<= pd->subsampling_x`), reduced by the
21294+ // INTER transform set. At **32 points** that set is
21295+ // `EXT_TX_SET_DCT_IDTX`, NOT `EXT_TX_SET_DCTONLY` -- so a 32-point
21296+ // inter chroma unit inherits the luma's coded `IDTX`, and the identity
21297+ // transform (a plain copy) is what libaom actually runs.
21298+ // [`reduce_inherited_chroma_tx_type`] is that reduction verbatim.
21299+ // * 64 points and up is `EXT_TX_SET_DCTONLY` for both, which the same
21300+ // reduction already yields.
21301+ //
21302+ // The `side >= 32` -> `DCT_DCT` clamp this replaces was written for the
21303+ // intra case (and read as libaom's clamp at `tx_size_sqr_up >= TX_32X32`),
21304+ // but libaom's cap is `txsize_sqr_up_map[tx_size] > TX_32X32` -- 64 and up
21305+ // -- so it also swallowed a 32-point INTER chroma unit's inherited `IDTX`
21306+ // and ran `DCT_DCT` where libaom ran the identity transform.
21307+ // Sub-32 units keep the raw inherited type exactly as before.
21308+ let default_tx_type = if plane_idx == 0 {
21290 TxType::DctDct21309 TxType::DctDct
21291 } else if let Some(inherited) = fctx.intrabc_chroma_tx.with(std::cell::Cell::get) {21310 } else if let Some(inherited) = fctx.intrabc_chroma_tx.with(std::cell::Cell::get) {
21292- // See [`INTRABC_CHROMA_TX`]: an intrabc block is an inter block for21311+ if side >= 32 {
21293- // `av1_get_tx_type`, so chroma inherits luma's coded type (the21312+ reduce_inherited_chroma_tx_type(inherited, side, side, fctx)
21294- // `side >= 32` arm above is already libaom's `EXT_TX_SET_DCTONLY`21313+ } else {
21295- // clamp at `tx_size_sqr_up >= TX_32X32`, matching21314+ inherited
21296- // [`read_inter_plane`]'s own `side < 32` guard).21315+ }
21297- inherited21316+ } else if side >= 32 {
21317+ TxType::DctDct
21298 } else {21318 } else {
21299 default_intra_tx_type(predict_mode as u8)21319 default_intra_tx_type(predict_mode as u8)
21300 };21320 };
@@ -21477,12 +21497,20 @@ fn read_rect_chroma_unit(
21477 if ss_x(fctx) == 1 && ss_y(fctx) == 0 && w != h {21497 if ss_x(fctx) == 1 && ss_y(fctx) == 0 && w != h {
21478 hit!(CHROMA422_RECT_HITS);21498 hit!(CHROMA422_RECT_HITS);
21479 }21499 }
21480- let default_tx = if w.max(h) >= 32 {21500+ // The same three cases as [`read_plane`], for the same reason: at 32 points
21501+ // an INTER chroma unit's transform set is `EXT_TX_SET_DCT_IDTX` (the luma's
21502+ // coded `IDTX` survives) where the intra set is `EXT_TX_SET_DCTONLY`, and
21503+ // an armed [`INTRABC_CHROMA_TX`] slot means the block IS an inter block.
21504+ let default_tx = if let Some(inherited) = fctx.intrabc_chroma_tx.with(std::cell::Cell::get) {
21505+ if w.max(h) >= 32 {
21506+ reduce_inherited_chroma_tx_type(inherited, w, h, fctx)
21507+ } else {
21508+ inherited
21509+ }
21510+ } else if w.max(h) >= 32 {
21481 TxType::DctDct21511 TxType::DctDct
21482 } else {21512 } else {
21483- fctx.intrabc_chroma_tx21513+ default_intra_tx_type(uv_predict_mode as u8)
21484- .with(std::cell::Cell::get)
21485- .unwrap_or_else(|| default_intra_tx_type(uv_predict_mode as u8))
21486 };21514 };
21487 let mut coding = cdfs.txb(set, uv_predict_mode);21515 let mut coding = cdfs.txb(set, uv_predict_mode);
21488 let (levels, tx_type) = read_coeffs_rect(21516 let (levels, tx_type) = read_coeffs_rect(
crates/ec-av1/src/stream.rsmodified+97 -54
@@ -10248,7 +10248,6 @@ pub(crate) mod tests {
10248 }10248 }
10249 std::path::PathBuf::from("ffmpeg")10249 std::path::PathBuf::from("ffmpeg")
10250 }10250 }
10251-
10252 /// The instrumented `aomdec` beside the `aomenc` oracle10251 /// The instrumented `aomdec` beside the `aomenc` oracle
10253 /// (`scripts/build-aom-oracle.sh` + `scripts/instrument-aom-oracle.sh`).10252 /// (`scripts/build-aom-oracle.sh` + `scripts/instrument-aom-oracle.sh`).
10254 fn aomdec_path() -> std::path::PathBuf {10253 fn aomdec_path() -> std::path::PathBuf {
@@ -10369,9 +10368,13 @@ pub(crate) mod tests {
10369 /// Returns `(wrong_y, wrong_u, wrong_v, frames_total, frames_exact)`, or10368 /// Returns `(wrong_y, wrong_u, wrong_v, frames_total, frames_exact)`, or
10370 /// `None` when the two sides are not byte-comparable at all (a size10369 /// `None` when the two sides are not byte-comparable at all (a size
10371 /// mismatch, which is a different failure and must not read as "exact").10370 /// mismatch, which is a different failure and must not read as "exact").
10371+ /// `flip` flips ONE bit of the ORACLE's own bytes before comparing, so
10372+ /// [`the_counting_oracle_diff_detects_one_flipped_oracle_byte`] can prove
10373+ /// the comparison still reads the oracle on a stream that is now exact.
10372 fn count_rawvideo_diffs(10374 fn count_rawvideo_diffs(
10373 stream: &[u8],10375 stream: &[u8],
10374 name: &str,10376 name: &str,
10377+ flip: Option<usize>,
10375 ) -> Option<(usize, usize, usize, usize, usize)> {10378 ) -> Option<(usize, usize, usize, usize, usize)> {
10376 let dir = std::env::temp_dir().join(format!("ec-av1-{name}-{}", std::process::id()));10379 let dir = std::env::temp_dir().join(format!("ec-av1-{name}-{}", std::process::id()));
10377 let _ = std::fs::remove_dir_all(&dir);10380 let _ = std::fs::remove_dir_all(&dir);
@@ -10393,7 +10396,15 @@ pub(crate) mod tests {
10393 "{name}: the oracle aomdec refused the stream: {}",10396 "{name}: the oracle aomdec refused the stream: {}",
10394 String::from_utf8_lossy(&out.stderr)10397 String::from_utf8_lossy(&out.stderr)
10395 );10398 );
10396- let want = std::fs::read(&raw).expect("aomdec rawvideo output");10399+ let mut want = std::fs::read(&raw).expect("aomdec rawvideo output");
10400+ if let Some(i) = flip {
10401+ assert!(
10402+ i < want.len(),
10403+ "{name}: flip index {i} is past the oracle's {} bytes",
10404+ want.len()
10405+ );
10406+ want[i] ^= 0x01;
10407+ }
10397 let _ = std::fs::remove_dir_all(&dir);10408 let _ = std::fs::remove_dir_all(&dir);
10398 let bit_depth = stream_bit_depth(stream, name);10409 let bit_depth = stream_bit_depth(stream, name);
10399 let decoded = decode_stream(stream).expect("decode for comparison");10410 let decoded = decode_stream(stream).expect("decode for comparison");
@@ -10431,17 +10442,26 @@ pub(crate) mod tests {
10431 Some((wrong[0], wrong[1], wrong[2], frames, exact))10442 Some((wrong[0], wrong[1], wrong[2], frames, exact))
10432 }10443 }
10433 10444
10434- /// lane-av1422anom: the non-vacuity test for [`count_rawvideo_diffs`].10445+ /// lane-av1422h232: the non-vacuity test for [`count_rawvideo_diffs`].
10435 ///10446 ///
10436 /// A cell-classifying counter that cannot report a difference is worse10447 /// A cell-classifying counter that cannot report a difference is worse
10437- /// than no counter, because it reports "exact" for everything. This10448+ /// than no counter, because it reports "exact" for everything -- that is
10438- /// proves the counting path fires: it decodes the pinned odd-height 4:2:010449+ /// exactly how lane-av1422remeasure's "18/18 byte-exact" table was
10439- /// witness, which is KNOWN to differ from the oracle, and asserts a10450+ /// produced (it compared our own packed samples against the same
10440- /// non-zero per-plane count. If a future edit makes the helper return10451+ /// samples, never reading `aomdec`'s output).
10441- /// zeros for a stream that really does differ, this goes red by name.10452+ ///
10442- #[test]10453+ /// It used to lean on the pinned witness DIFFERING to prove the counting
10443- fn the_counting_oracle_diff_reports_a_real_difference() {10454+ /// path fires. That witness is byte-exact now (lane-av1422hrtx fixed the
10444- const NAME: &str = "the_counting_oracle_diff_reports_a_real_difference";10455+ /// 32-point inter chroma `tx_type`), so "it differs" is no longer
10456+ /// available and a witness-based version of this test would be vacuous by
10457+ /// construction. Instead this proves the same property directly and
10458+ /// unconditionally: flipping ONE bit of the ORACLE's own bytes must move
10459+ /// the count by exactly one, in the plane that bit is in, and knock exactly
10460+ /// one frame out of `frames_exact`. A comparator that had stopped reading
10461+ /// the oracle reports the baseline numbers again and fails by name.
10462+ #[test]
10463+ fn the_counting_oracle_diff_detects_one_flipped_oracle_byte() {
10464+ const NAME: &str = "the_counting_oracle_diff_detects_one_flipped_oracle_byte";
10445 // lane-av1cmpaudit2: same mutex as every other oracle gate -- this10465 // lane-av1cmpaudit2: same mutex as every other oracle gate -- this
10446 // one reads `aomdec_path()`, so it must not overlap a sibling's10466 // one reads `aomdec_path()`, so it must not overlap a sibling's
10447 // tampered-oracle run.10467 // tampered-oracle run.
@@ -10451,19 +10471,32 @@ pub(crate) mod tests {
10451 .join("420_oddheight_320x232.obu");10471 .join("420_oddheight_320x232.obu");
10452 let data = std::fs::read(&path).expect("the pinned witness is missing");10472 let data = std::fs::read(&path).expect("the pinned witness is missing");
10453 let (wy, wu, wv, frames, exact) =10473 let (wy, wu, wv, frames, exact) =
10454- count_rawvideo_diffs(&data, NAME).expect("the two sides must be byte-comparable");10474+ count_rawvideo_diffs(&data, NAME, None).expect("the two sides must be byte-comparable");
10455- assert!(10475+ assert_eq!(
10456- wy + wu + wv > 0,10476+ (wy, wu, wv, exact),
10457- "{NAME}: the pinned witness differs from `aomdec --rawvideo`, so a correct \10477+ (0, 0, 0, frames),
10458- comparison MUST report a non-zero count -- reporting zero here means the \10478+ "{NAME}: the pinned witness must decode byte-exactly against `aomdec --rawvideo`"
10459- comparison stopped reading the oracle's bytes"10479+ );
10460- );10480+ // Frame 0 byte 0 is luma; byte 90_000 is inside frame 0's chroma.
10461- assert!(10481+ for (idx, plane) in [(0usize, 0usize), (90_000, 1)] {
10462- exact < frames,10482+ let (wy, wu, wv, _, exact) = count_rawvideo_diffs(&data, NAME, Some(idx))
10463- "{NAME}: at least one frame of the pinned witness is not byte-identical to \10483+ .expect("the two sides must be byte-comparable");
10464- the oracle, so frames_exact must be below the frame count"10484+ let got = [wy, wu, wv];
10465- );10485+ assert_eq!(
10466- eprintln!("{NAME}: witness reports Y={wy} U={wu} V={wv}, frames_exact={exact}/{frames}");10486+ got.iter().sum::<usize>(),
10487+ 1,
10488+ "{NAME}: flipping oracle byte {idx} must report exactly ONE wrong sample \
10489+ across all planes -- got {got:?}. Reporting the unflipped numbers means \
10490+ the comparison stopped reading the oracle's bytes"
10491+ );
10492+ assert_eq!(got[plane], 1, "{NAME}: byte {idx} is in plane {plane}");
10493+ assert_eq!(
10494+ exact,
10495+ frames - 1,
10496+ "{NAME}: one flipped byte spoils one frame"
10497+ );
10498+ }
10499+ eprintln!("{NAME}: baseline exact, each flipped oracle byte reported as exactly 1");
10467 }10500 }
10468 10501
10469 /// lane-av1cmpaudit2: the permanent CONTROL for the class10502 /// lane-av1cmpaudit2: the permanent CONTROL for the class
@@ -10536,8 +10569,9 @@ pub(crate) mod tests {
10536 (1, 0),10569 (1, 0),
10537 "{NAME}: arm 1 expects one decode-order frame and no hidden frames"10570 "{NAME}: arm 1 expects one decode-order frame and no hidden frames"
10538 );10571 );
10539- let (wy, wu, wv, n, exact) = count_rawvideo_diffs(&stream, "oracle-control-arm1-count")10572+ let (wy, wu, wv, n, exact) =
10540- .expect("arm 1: the two sides must be byte-comparable");10573+ count_rawvideo_diffs(&stream, "oracle-control-arm1-count", None)
10574+ .expect("arm 1: the two sides must be byte-comparable");
10541 assert_eq!(10575 assert_eq!(
10542 (wy, wu, wv),10576 (wy, wu, wv),
10543 (0, 0, 0),10577 (0, 0, 0),
@@ -10632,7 +10666,7 @@ exit 0
10632 decode_all_frames_vs_oracle(&stream, "oracle-control-arm2-alldumps");10666 decode_all_frames_vs_oracle(&stream, "oracle-control-arm2-alldumps");
10633 });10667 });
10634 let count_red = {10668 let count_red = {
10635- let counted = count_rawvideo_diffs(&stream, "oracle-control-arm2-count")10669+ let counted = count_rawvideo_diffs(&stream, "oracle-control-arm2-count", None)
10636 .unwrap_or_else(|| {10670 .unwrap_or_else(|| {
10637 panic!(10671 panic!(
10638 "{NAME}: a single flipped oracle byte must NOT change the buffer \10672 "{NAME}: a single flipped oracle byte must NOT change the buffer \
@@ -11070,28 +11104,32 @@ exit 0
11070 );11104 );
11071 }11105 }
11072 11106
11073- /// lane-av1422anom: the odd-frame-HEIGHT 4:2:0 reconstruction defect,11107+ /// lane-av1422chrtx: the odd-frame-HEIGHT 4:2:0 witness, pinned and now
11074- /// pinned and ratcheted.11108+ /// EXACT (lane-av1422anom had pinned it as a ratchet on its own defect).
11075 ///11109 ///
11076 /// This is NOT a 4:2:2 cell and needs no bypass -- it is ordinary 4:2:0,11110 /// This is NOT a 4:2:2 cell and needs no bypass -- it is ordinary 4:2:0,
11077- /// reachable by any user today. The 320x232 stream (luma height 232, i.e.11111+ /// reachable by any user. lane-av1422anom pinned it as a RATCHET asserting
11078- /// not the 240 that every existing 4:2:0 fixture happens to use)11112+ /// its own measured defect `(0, 200, 17658)`, and said whoever fixed it
11079- /// reconstructs 17658 chroma samples wrongly out of 593920, in 3 of 1611113+ /// must flip that to exactness. That is done, and the flip is the
11080- /// shown frames, and the wrong samples are present in the decoder's own11114+ /// deliverable:
11081- /// `EC_AV1_PREFILT_DUMP` -- the post-reconstruction, PRE-loop-filter11115+ ///
11082- /// stage -- so deblock, CDEF and loop restoration are all exonerated.11116+ /// the defect was a chroma `tx_type`, not a geometry. libaom's
11083- /// The 4:2:0 controls at heights 240 and 242 are byte-exact, so it is the11117+ /// `av1_get_ext_tx_set_type` (`blockd.h`) resolves a **32-point** chroma
11084- /// height, not the width, and not "odd" in the mod-2 sense (232 and 24811118+ /// unit to `EXT_TX_SET_DCT_IDTX` when the block `is_inter` -- so an
11085- /// are both even and both fail).11119+ /// Intra-Block-Copy block whose luma coded `IDTX` runs the identity
11086- ///11120+ /// transform on its chroma. `read_plane`'s `side >= 32` clamp forced
11087- /// The gate is a RATCHET, not an exactness gate: it pins the measured11121+ /// `DCT_DCT` there (its `DCT_DCT` cap is really libaom's
11088- /// wrong-sample counts, so the defect cannot change silently, and whoever11122+ /// `txsize_sqr_up_map[tx_size] > TX_32X32`, i.e. 64 and up), so the
11089- /// fixes it is forced to update these numbers deliberately. An exactness11123+ /// residual was a 32-point IDCT where libaom's was a plain copy of the
11090- /// gate cannot be written until the fix lands.11124+ /// dequantized coefficients `>>2`. The wrong samples sat in one 64x64
11091- #[test]11125+ /// IBC block's 32x32 chroma unit at chroma (128,96) on frame 0, and
11092- fn the_pinned_420_oddheight_witness_is_pinned_and_ratchets_its_reconstruction_defect() {11126+ /// propagated from there through the inter frames.
11093- const NAME: &str =11127+ ///
11094- "the_pinned_420_oddheight_witness_is_pinned_and_ratchets_its_reconstruction_defect";11128+ /// `the_counting_oracle_diff_detects_one_flipped_oracle_byte` is the
11129+ /// non-vacuity control that keeps the `0` above worth anything.
11130+ #[test]
11131+ fn the_pinned_420_oddheight_witness_is_pinned_and_decodes_byte_exact() {
11132+ const NAME: &str = "the_pinned_420_oddheight_witness_is_pinned_and_decodes_byte_exact";
11095 // lane-av1cmpaudit2: same mutex as every other oracle gate.11133 // lane-av1cmpaudit2: same mutex as every other oracle gate.
11096 let _gate_lock = lock_gate_counters();11134 let _gate_lock = lock_gate_counters();
11097 const FILE: &str = "420_oddheight_320x232.obu";11135 const FILE: &str = "420_oddheight_320x232.obu";
@@ -11110,17 +11148,22 @@ exit 0
11110 assert_eq!(data.len(), BYTES, "{NAME}: {FILE} size drifted");11148 assert_eq!(data.len(), BYTES, "{NAME}: {FILE} size drifted");
11111 assert_eq!(fnv1a64(&data), FNV1A64, "{NAME}: {FILE} bytes drifted");11149 assert_eq!(fnv1a64(&data), FNV1A64, "{NAME}: {FILE} bytes drifted");
11112 let (wy, wu, wv, frames, exact) =11150 let (wy, wu, wv, frames, exact) =
11113- count_rawvideo_diffs(&data, NAME).expect("the two sides must be byte-comparable");11151+ count_rawvideo_diffs(&data, NAME, None).expect("the two sides must be byte-comparable");
11114 assert_eq!(11152 assert_eq!(
11115 (wy, wu, wv),11153 (wy, wu, wv),
11116- (0, 200, 17658),11154+ (0, 0, 0),
11117- "{NAME}: the measured defect moved. If this is now EXACT the \11155+ "{NAME}: the pinned 320x232 witness must decode byte-exactly against \
11118- reconstruction defect is FIXED -- update this gate to assert \11156+ `aomdec --rawvideo` on every plane. It was a RATCHET asserting its own \
11119- (0, 0, 0) and delete the ratchet comment, and say so in the \11157+ measured defect (0, 200, 17658); lane-av1422chrtx flipped it to exactness \
11120- report. Any other value is a change nobody has accounted for."11158+ when the 32-point INTER chroma `tx_type` (EXT_TX_SET_DCT_IDTX, not \
11159+ EXT_TX_SET_DCTONLY) was fixed. Any non-zero value here is a regression -- \
11160+ name it in the report."
11121 );11161 );
11122 assert_eq!(frames, 16, "{NAME}: shown frame count");11162 assert_eq!(frames, 16, "{NAME}: shown frame count");
11123- assert_eq!(exact, 0, "{NAME}: byte-exact shown frames");11163+ assert_eq!(
11164+ exact, frames,
11165+ "{NAME}: every shown frame must be byte-exact"
11166+ );
11124 }11167 }
11125 11168
11126 /// lane-hidden r2: the `--arnr-maxframes=0` SECOND ARM of an existing11169 /// lane-hidden r2: the `--arnr-maxframes=0` SECOND ARM of an existing
lanes/av1422h232.report.mdmodified+151 -0
@@ -257,3 +257,154 @@ a second pin. **It must not be forgotten.**
257 `EC_AV1_ALLOW_422_PROBE` bypass, which this lane must not commit. The257 `EC_AV1_ALLOW_422_PROBE` bypass, which this lane must not commit. The
258 mechanism argument in §3 is an argument, not a measurement.258 mechanism argument in §3 is an argument, not a measurement.
259 - **Full suite not run** (lane rules: scoped only).259 - **Full suite not run** (lane rules: scoped only).
260+
261+---
262+
263+# 8. lane-av1422chrtx — THE FIX (added after Main accepted the report)
264+
265+Branch `lane-av1422chrtx`, off `4c366a8b`.
266+
267+## 8.1 libaom, quoted
268+
269+`av1/common/blockd.h`, `av1_get_tx_type`:
270+
271+```c
272+ if (xd->lossless[mbmi->segment_id] || txsize_sqr_up_map[tx_size] > TX_32X32) {
273+ return DCT_DCT;
274+ }
275+ ...
276+ if (is_inter_block(mbmi)) {
277+ blk_row <<= pd->subsampling_y;
278+ blk_col <<= pd->subsampling_x;
279+ tx_type = xd->tx_type_map[blk_row * xd->tx_type_map_stride + blk_col];
280+ } else {
281+ tx_type = intra_mode_to_tx_type(mbmi, PLANE_TYPE_UV);
282+ }
283+ const TxSetType tx_set_type =
284+ av1_get_ext_tx_set_type(tx_size, is_inter_block(mbmi), reduced_tx_set);
285+ if (!av1_ext_tx_used[tx_set_type][tx_type]) tx_type = DCT_DCT;
286+```
287+
288+and `av1_get_ext_tx_set_type`, same file:
289+
290+```c
291+ const TX_SIZE tx_size_sqr_up = txsize_sqr_up_map[tx_size];
292+ if (tx_size_sqr_up > TX_32X32) return EXT_TX_SET_DCTONLY;
293+ if (tx_size_sqr_up == TX_32X32)
294+ return is_inter ? EXT_TX_SET_DCT_IDTX : EXT_TX_SET_DCTONLY;
295+```
296+
297+**Answer to Main's question 1: option (a)** — for an INTER block the chroma unit's
298+`tx_type` is the **same `xd->tx_type_map` cell the luma unit stamped**, scaled by
299+`subsampling_x/y`. It is then reduced by the INTER transform set, and at 32 points
300+that set is `EXT_TX_SET_DCT_IDTX`, so the luma's `IDTX` survives. The cap to
301+`DCT_DCT` is `txsize_sqr_up_map[tx_size] > TX_32X32` — **64 and up**, not 32.
302+
303+## 8.2 our site, named
304+
305+`crates/ec-av1/src/decode.rs`, `read_plane`:
306+
307+```rust
308+let default_tx_type = if plane_idx == 0 || side >= 32 {
309+ TxType::DctDct
310+} else if let Some(inherited) = fctx.intrabc_chroma_tx... {
311+ inherited
312+} else {
313+ default_intra_tx_type(predict_mode as u8)
314+};
315+```
316+
317+**A hardcoded "32-point chroma is `DCT_DCT`" rule** (the `side >= 32` arm), written
318+for the intra case and read as libaom's clamp at `tx_size_sqr_up >= TX_32X32`. It
319+swallowed the inherited `IDTX` **before** the armed-slot arm could ever run, so a
320+32-point intrabc chroma unit ran a 32-point IDCT where libaom ran the identity
321+transform. `read_rect_chroma_unit` carried the identical rule (`w.max(h) >= 32`).
322+`read_inter_plane` was already correct — it routes through
323+`reduce_inherited_chroma_tx_type`, whose `sqr_up == 32 → [DctDct, Idtx]` arm is
324+libaom's inter set verbatim.
325+
326+## 8.3 the fix
327+
328+Both sites now resolve the three cases separately, and only an ARMED
329+`intrabc_chroma_tx` slot (set exclusively under `if intrabc_dv.is_some()`, verified
330+at both set sites) changes behaviour:
331+
332+```rust
333+let default_tx_type = if plane_idx == 0 { TxType::DctDct }
334+ else if let Some(inherited) = fctx.intrabc_chroma_tx... {
335+ if side >= 32 { reduce_inherited_chroma_tx_type(inherited, side, side, fctx) }
336+ else { inherited } // sub-32 unchanged, byte for byte
337+ } else if side >= 32 { TxType::DctDct } // intra, unchanged
338+ else { default_intra_tx_type(predict_mode as u8) };
339+```
340+
341+**Blast radius (Main's question 6):** a size-cap change, and it is deliberately
342+confined. It can only move a **32-point chroma unit of an intrabc block** from
343+`DCT_DCT` to `IDTX`, and only when the luma coded `IDTX`. 64-point chroma still
344+reduces to `DCT_DCT` (`sqr_up > 32`), intra chroma at 32+ is untouched, sub-32
345+units are untouched, and the lossless clamp above both sites is untouched.
346+
347+## 8.4 proof
348+
349+**Both witnesses, same flip-controlled comparator:**
350+
351+| stream | before | after |
352+|---|---|---|
353+| `420_oddheight_320x232.obu` (pinned) | Y 0 / U 5772 / V 12086, 0/16 exact | **0 / 0 / 0, 16/16 exact** |
354+| `320x248` (fresh, same recipe) | Y 0 / U 14343 / V 16310 | **0 / 0 / 0, 16/16 exact** |
355+
356+**Non-vacuity control, unchanged and re-run after the fix:** flipping oracle byte
357+0 → `Y=1, exact=15/16`; flipping oracle byte 90000 → `U=1, exact=15/16`. Exactly
358++1 in the right plane, one frame spoiled.
359+
360+**27-cell sweep after the fix: 25 of 27 exact, up from 19.** Newly exact:
361+`320x232`, `322x232`, `324x232`, `320x248`, `324x240`.
362+
363+**Two survivors, named not absorbed:**
364+* `320x236` — Y=234349, U=56957, V=52981
365+* `322x248` — Y=36286, U=13359, V=13001
366+
367+Both carry **luma** wrong-sample counts. A chroma `tx_type` fix cannot produce a
368+luma difference, so these are a **different defect**, in the odd-dimension class
369+(236 mod 8 = 4, 322 mod 8 = 2 — dimensions whose luma plane overhangs the coding
370+grid). **Not claimed as this mechanism.** Still open, still unnamed.
371+
372+**Regression scope:** `a_pinned_444_inter_stream_chroma_units_inherit_their_own_quadrants_tx_type`,
373+`a_pinned_444_rect_inter_stream_resolves_each_chroma_unit_from_its_own_luma_leaf`,
374+`a_444_rect_strip_chroma_tiled_2x1_and_1x2_units_take_their_own_above_right_reach`
375+— all **pass**. A scoped `intrabc chroma chroma_units` run: **68 passed, 0 failed,
376+1 ignored**.
377+
378+## 8.5 the tripwire flip (deliverable, done)
379+
380+`the_pinned_420_oddheight_witness_is_pinned_and_ratchets_its_reconstruction_defect`
381+→ **`the_pinned_420_oddheight_witness_is_pinned_and_decodes_byte_exact`**, asserting
382+`(0, 0, 0)` and `exact == frames`, with the ratchet doc replaced by the mechanism.
383+
384+`count_rawvideo_diffs` gained a `flip: Option<usize>` that flips one bit of the
385+**oracle's own bytes**, and the old non-vacuity test (which relied on the witness
386+*differing*, now vacuous by construction) became
387+**`the_counting_oracle_diff_detects_one_flipped_oracle_byte`** — it asserts the
388+baseline is exact, then that a flipped oracle byte reports exactly 1 in the right
389+plane and exactly one fewer exact frame. It passes.
390+
391+**Mutation proof for the flipped gate:** restoring the pre-fix resolution
392+(`reduce_inherited_chroma_tx_type(inherited, side, side, fctx)` → `TxType::DctDct`)
393+makes it red **by name**:
394+
395+```
396+left: (0, 200, 17658)
397+right: (0, 0, 0)
398+test result: FAILED. 0 passed; 1 failed
399+```
400+
401+— the pre-fix defect, to the sample. Restored afterwards (tree clean).
402+
403+## 8.6 `not_done` for this half
404+
405+* `320x236` and `322x248` still diverge, with **luma** errors — a separate
406+ unlocalised defect in the odd-dimension class.
407+* 4:2:2 not re-measured (needs the probe bypass this lane must not commit); the
408+ mechanism argument in §3 now rests on a source line rather than on inference.
409+* No `320x248` fixture committed as a second pin; recipe + sha256 are in §3.
410+* Full suite not run (lane rules: scoped only).