diff --git a/crates/ec-av1/examples/decode_probe.rs b/crates/ec-av1/examples/decode_probe.rs index d38d4691..bdee65a7 100644 --- a/crates/ec-av1/examples/decode_probe.rs +++ b/crates/ec-av1/examples/decode_probe.rs @@ -118,6 +118,10 @@ fn main() { ); // lane-rectres r1: how many of those 32x8/8x32 strips coded a real // rectangular residual transform unit (a skipped one codes none). + println!( + "sub8_chroma_tx_from_ref: {}", + ec_av1::stream::sub8_chroma_tx_from_ref_hits() + ); let r328 = ec_av1::stream::rect32x8_inter_tu_hits(); println!("rect32x8_inter_tu: 32x8={} 8x32={}", r328[0], r328[1]); // lane-intra16x4: INTRA strips of an inter 16x16-level 1:4 partition. diff --git a/crates/ec-av1/fixtures/reelc_sb128_inter_witness.obu b/crates/ec-av1/fixtures/reelc_sb128_inter_witness.obu index 93af712ad7895155256d25851a0377b572e9fb89..9c69c0572e31cfffd0a93fe800e3af13e6870ddd 100644 GIT binary patch delta 11574 zcmV-6Ey>cKlM3zZ3V?(Gv;v=re-Z#10oW1%GUPod0VoTa92phB002M$s^AZtq`(JF zhrh|p06b7WY)*z|ymkI`Kmy<5{{IC10{a022MXl^=KTcv=F!bG_WK0$-2DXo2K@m3 z{{;B*`2ha_^wY5n`2P~`mhk@i_YU~_`uzgwEc*Qd^5o;GB?A8wBeek#e;5!53zZqA+Eh zL+C!E8{3EEA^3ce_4MFH^TG!4Gy`u>>5q?1e9K4NP#(BlHJxUNF5dxZNnz4dvi2`h zR4J94Peh>?FUjv4H}9q{f9sBG^ysxw`BuziFi1|`gP~S6B0ODS-(IWGL_-!~KymUG zDH4wN6_`uo(CbCG%3fm!!568qoDs1&J(oEFkjw>;&s=OuZ@!YZO_WeuqkTcDkZj4Y zJUI<`N2bCAJ4FrZ<~kJY z$wizC_BwZd;*+Tu_qJ*{nUN_k09=j>2Lbu>Q$jt`UtsgTe+BWdc2!#V(LT#MyWcT{ zz7&;wGcqi|S?0EM3`89!COF2iE8TaSTLe1lm|)1USk%=={&(#(ewFcD?2A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x-G8be*2 zXKm9Fx946FD(pD?%1;S3ZGK*0=IJsC!2 zbq3Zfm_?|ODijaEA{b?V9I4CEq4DRvOhrEL(vF-Yf3Y8K#Iwv2;{*3p0&*@(`a-A} zNVaet=xCWj++3lZzaE_Sp@~th94KGgA(&s9Y5#@Bh8lpD;_e3ZIPx311n(lzY0ij^ z;1;Zzh*1j}z4|rgz7u={YUm3I`u3qW%cH^ZWq5;lDMH2~l=wqT19C8#kMk_CMD1R^&Wdb} zb*OGnG7(pjDrS(UG?yV&gz^uELrz@Qp` zT{d*HQWgQ`*6(}Yv1jbiv}%q>V&uTa!BM3MHOof$voTJP^3bA-PhLu;d-#mID3Gga oelu`5C05ofPQ|!dvV^T?Zw`6%PYsucZu*#wp#P&_5&#+j=rChg4gdfE delta 13 UcmaF+hHL(0u7(!IEll$}0WN usize { SUB8_INTER_SPLIT_HITS.with(|c| c.get()) } +// lane-t900 r7: sub-8x8 inter groups whose one chroma unit inherits a +// `tx_type` DIFFERENT from the group's FIRST sub-block -- the only shape that +// tells the two rules apart (`av1_get_tx_type` indexes `xd->tx_type_map`, +// which `set_mi_offsets` re-points to the CHROMA-REFERENCE sub-block, so the +// first sub-block's type is never the one). Reading it off sub-block 0 +// inverted one 4x4 chroma unit on the wrong basis with the entropy stream +// perfectly in sync (no chroma `tx_type` symbol is coded), so a gate can only +// see this rule through this counter. +thread_local! { + static SUB8_CHROMA_TX_FROM_REF_HITS: std::cell::Cell = const { std::cell::Cell::new(0) }; +} + +/// Current value of `SUB8_CHROMA_TX_FROM_REF_HITS`. +pub fn sub8_chroma_tx_from_ref_hits() -> usize { + SUB8_CHROMA_TX_FROM_REF_HITS.with(|c| c.get()) +} + +fn note_sub8_chroma_tx(first_sub: TxType, chroma_ref: TxType, coeffs: bool) { + if coeffs && first_sub != chroma_ref { + SUB8_CHROMA_TX_FROM_REF_HITS.with(|c| c.set(c.get() + 1)); + } +} + // How many 4x8 / 8x4 leaves (lane-tx4x8's `PARTITION_VERT`/`PARTITION_HORZ` // of an 8x8 block) this thread's decode reconstructed with REAL coefficients // -- a skipped leaf exercises the prediction and the mi bookkeeping but never @@ -14668,6 +14691,9 @@ fn read_inter_plane_rect( ac_delta, tx_type, ); + if std::env::var_os("EC_TRACE_TXTYPE").is_some() { + eprintln!("OUR_TXTYPE plane={plane_idx} x={x} y={y} w={w} h={h} tx_type={tx_type:?} inh={inherited_luma_tx_type:?}"); + } // `reconstruct_mc_rect` reads both buffers at the square prediction // stride, so the dense `w x h` residual is re-laid at that stride first. let mut strided = vec![0i32; stride * stride]; @@ -18449,6 +18475,9 @@ fn read_inter_plane( None, )?; note_chroma_class1(plane_idx, tx_type); + if std::env::var_os("EC_TRACE_TXTYPE").is_some() { + eprintln!("OUR_TXTYPE plane={plane_idx} x={x} y={y} side={side} tx_type={tx_type:?} inh={inherited_luma_tx_type:?}"); + } // lane-inter8 r1: a 64-point transform covers the whole 64x64 area but // codes only its top-left 32x32 of frequencies (spec 5.11.40) -- the // caller hands the 32-point `scan` there, and the coded corner goes into @@ -22451,10 +22480,11 @@ fn decode_inter_block( // lane-t900 r6: THAT WITNESS EXISTS, so `EC_INTRA16X4_DECODE` is gone // and the refusal is narrowed back to "no chroma-pair record". The // witness is a REAL 10-bit 1920x792 128-superblock film stream, not an - // aomenc recipe: `fixtures/reelc_sb128_inter_witness.obu` (166303 bytes, - // 19 frame-carrying OBUs, 14 decode-order frames) decodes all 14 - // decode-order frames byte-exact against instrumented aomdec - // (`EC_AV1_FINAL_DUMP`) and all 12 shown frames pixel-exact against + // aomenc recipe: `fixtures/reelc_sb128_inter_witness.obu` (177773 bytes, + // 23 frame-carrying OBUs, 16 decode-order frames, extended from 14 in + // lane-t900 r7) decodes all 16 decode-order frames byte-exact against + // instrumented aomdec + // (`EC_AV1_FINAL_DUMP`) and all 15 shown frames pixel-exact against // ffmpeg, while this arm fires 78x 16x4 + 149x 4x16 (108 of them // chroma-paired). Unlike lane-sub8x4 r3's phantom (class // `counter-from-refused-stream`) every one of those hits lies inside a @@ -23282,6 +23312,7 @@ fn decode_inter_sub8_split4( let mut piece: [Option<(i8, (i32, i32), mc::InterpFilterKind, mc::InterpFilterKind)>; 4] = [None; 4]; let mut first_tx_type = TxType::DctDct; + let mut sub0_tx_type = TxType::DctDct; let mut last_skip = true; // Set when the chroma-reference (last) sub-block is INTRA: it coded the // group's one chroma unit itself. @@ -23576,14 +23607,19 @@ fn decode_inter_sub8_split4( None, None, )?; - if i == 0 || piece[0].is_none() { - // `av1_get_tx_type`: an inter block's chroma inherits the - // tx_type of the CO-LOCATED luma position, which for the - // group's one chroma unit is luma (0, 0) -- the FIRST - // sub-block, not the last. lane-sub8intra: an INTRA first - // sub-block writes no inter tx_type there at all, so the - // later inter sub-blocks' own is what `xd->tx_type_map` - // holds. + if i == 0 { + sub0_tx_type = tx_type; + } + if i == 3 { + // `av1_get_tx_type`'s chroma tail scales `blk_row`/`blk_col` + // back by the subsampling, but it indexes `xd->tx_type_map`, + // which `set_mi_offsets` (av1_common_int.h:1679) re-points to + // the CURRENT sub-block's own mi -- so the group's one chroma + // unit inherits the CHROMA-REFERENCE (last) sub-block's + // tx_type, never the group's first. lane-t900 r7: reading it + // off sub-block 0 left the entropy stream in sync (no symbol + // is coded for chroma) and inverted one 4x4 chroma unit on the + // wrong basis. first_tx_type = tx_type; } neighbours.record_mi_luma_rect(lmi, B4, B4, &luma_grid); @@ -23673,6 +23709,8 @@ fn decode_inter_sub8_split4( &pred_v, Some(first_tx_type), None, )? .0; + let coded = ug.iter().chain(vg.iter()).any(|&c| c != 0); + note_sub8_chroma_tx(sub0_tx_type, first_tx_type, coded); (ug, vg) }; neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED); @@ -24204,6 +24242,7 @@ fn decode_inter_sub8_rect2( let mut piece: [Option<(i8, (i32, i32), mc::InterpFilterKind, mc::InterpFilterKind)>; 2] = [None; 2]; let mut first_tx_type = TxType::DctDct; + let mut sub0_tx_type = TxType::DctDct; let mut last_skip = true; // Set when the chroma-reference sub-block is INTRA: it coded the group's // one chroma unit itself. @@ -24552,13 +24591,15 @@ fn decode_inter_sub8_rect2( None, )? }; - if idx == 0 && (i == 0 || piece[0].is_none()) { - // `av1_get_tx_type`: the group's one chroma unit scales - // back to luma (0, 0), i.e. the FIRST sub-block's first - // transform unit -- unless that sub-block is INTRA - // (lane-sub8intra), in which case it wrote no inter - // tx_type at all and `xd->tx_type_map[0]` of the - // chroma-reference block is this one's. + if idx == 0 && i == 0 { + sub0_tx_type = tu_tx_type; + } + if idx == 0 && i == 1 { + // `av1_get_tx_type` indexes `xd->tx_type_map`, which + // `set_mi_offsets` (av1_common_int.h:1679) re-points to the + // CURRENT sub-block: the group's one chroma unit inherits + // the CHROMA-REFERENCE (second) sub-block's first transform + // unit, never the first sub-block's (lane-t900 r7). first_tx_type = tu_tx_type; } neighbours.record_mi_luma_rect(tu_mi, tw, th, &tu_grid); @@ -24662,6 +24703,8 @@ fn decode_inter_sub8_rect2( &pred_v, Some(first_tx_type), None, )? .0; + let coded = ug.iter().chain(vg.iter()).any(|&c| c != 0); + note_sub8_chroma_tx(sub0_tx_type, first_tx_type, coded); (ug, vg) }; neighbours.record_uv_mode_mi(gr, gc, 2, 2, DC_PRED); diff --git a/crates/ec-av1/src/stream.rs b/crates/ec-av1/src/stream.rs index 32f12e90..b1459936 100644 --- a/crates/ec-av1/src/stream.rs +++ b/crates/ec-av1/src/stream.rs @@ -87,6 +87,13 @@ pub fn rect32x8_inter_tu_hits() -> [usize; 2] { crate::decode::rect32x8_inter_tu_hits() } +/// lane-t900 r7: sub-8x8 inter groups whose one chroma unit inherited a +/// `tx_type` different from the group's FIRST sub-block, i.e. groups that can +/// only decode right under `av1_get_tx_type`'s chroma-reference rule. +pub fn sub8_chroma_tx_from_ref_hits() -> usize { + crate::decode::sub8_chroma_tx_from_ref_hits() +} + /// lane-intra16x4: `(16x4, 4x16, chroma-reference)` INTRA strips decoded inside /// an inter 16x16-level 1:4 partition. pub fn intra16x4_in_inter_hits() -> (usize, usize, usize) { @@ -30282,12 +30289,18 @@ mod tests { } /// lane-t900 r6: the 128-superblock INTER witness. - /// `crates/ec-av1/fixtures/reelc_sb128_inter_witness.obu`, 166303 bytes, - /// sha256 `1191ce80e2c6c5855eaf7a8f5e8cda2cdf809f467b0dbc5e26df96dfa6b2c8bd`: - /// the first 19 frame-carrying OBUs of a 2 s cut taken 900 s into a 10-bit - /// 1920x792 AV1 stream with `use_128x128_superblock=1`, 14 decode-order - /// frames, 12 shown. Cut twice independently from the source (`-ss 900 -t 2 + /// `crates/ec-av1/fixtures/reelc_sb128_inter_witness.obu`, 177773 bytes, + /// sha256 `09d995946d27695ef4b7b1a24a4d7ad85f8e2c8176d58ee54e825efc061f9cbc`: + /// the first 23 frame-carrying OBUs of a 2 s cut taken 900 s into a 10-bit + /// 1920x792 AV1 stream with `use_128x128_superblock=1`, 16 decode-order + /// frames, 15 shown. Cut twice independently from the source (`-ss 900 -t 2 /// -c:v copy` then the OBU truncation) -- both cuts hash identically. + /// lane-t900 r7 extended it from 19 OBUs / 14 frames: decode-order frame 14 + /// is the ONLY frame in this repository's fixtures whose sub-8x8 inter + /// chroma inherits a `tx_type` from a chroma-reference sub-block that + /// differs from its group's first sub-block AND codes coefficients + /// (`sub8_chroma_tx_from_ref_hits`), i.e. the only frame that can tell + /// `av1_get_tx_type`'s two candidate rules apart. /// /// It is the first stream in this repository that decodes exactly while /// five separately-found defects' paths all fire, which is why the asserts @@ -30344,6 +30357,7 @@ mod tests { crate::decode::intra_in_inter_txctx_hits(), crate::decode::edge_filter_mi_fix_hits(), ); + let sub8tx_before = crate::decode::sub8_chroma_tx_from_ref_hits(); let i16_before = crate::decode::intra16x4_in_inter_hits(); let frames = match decode_stream(&stream) { Ok(frames) => frames, @@ -30358,6 +30372,7 @@ mod tests { crate::decode::intra_in_inter_txctx_hits() - before.5, crate::decode::edge_filter_mi_fix_hits() - before.6, ); + let sub8tx = crate::decode::sub8_chroma_tx_from_ref_hits() - sub8tx_before; let i16_now = crate::decode::intra16x4_in_inter_hits(); let i16 = ( i16_now.0 - i16_before.0, @@ -30375,13 +30390,14 @@ mod tests { ("intra16x4_in_inter 16x4", i16.0), ("intra16x4_in_inter 4x16", i16.1), ("intra16x4_in_inter chroma_ref", i16.2), + ("sub8_chroma_tx_from_ref", sub8tx), ] { assert!( n > 0, "{NAME}: {what} never fired on this stream -- the gate would be vacuous for it" ); } - assert_eq!(frames.len(), 12, "{NAME}: 12 shown frames"); + assert_eq!(frames.len(), 15, "{NAME}: 15 shown frames"); assert_eq!((frames[0].width, frames[0].height), (width, height)); let ffmpeg_frames = ffmpeg_decode_sequence_10bit(&stream, width, height, frames.len()); assert_eq!( @@ -30397,9 +30413,10 @@ mod tests { assert_eq!(ours.v, theirs.v, "{NAME}: frame {i} V vs ffmpeg"); } eprintln!( - "{NAME}: 12 shown frames pixel-exact on every plane; warp_plane_suppress={} \ + "{NAME}: 15 shown frames pixel-exact on every plane; warp_plane_suppress={} \ cdef_idx={} inter_sb128_vert={} interintra_rect={} non_chroma_ref_ctx_skip={} \ - intra_in_inter_txctx={} edge_filter_mi_fix={} intra16x4_in_inter={:?}", + intra_in_inter_txctx={} edge_filter_mi_fix={} intra16x4_in_inter={:?} \ + sub8_chroma_tx_from_ref={sub8tx}", fired.0, fired.1, fired.2, fired.3, fired.4, fired.5, fired.6, i16 ); } diff --git a/lanes/t900-r7.handoff.md b/lanes/t900-r7.handoff.md new file mode 100644 index 00000000..18b36efb --- /dev/null +++ b/lanes/t900-r7.handoff.md @@ -0,0 +1,48 @@ +# lane-t900 r7 handoff -- frame-14 chroma basis CLOSED; next stop is t900 frame 41 (ONE U sample) + +Branch `lane-t900`, tip `5c2ab6a5` (fix+gate `04154beb`, report `5c2ab6a5`), +main `3b529205` merged (fast-forward). Suite on this tip: **426 passed, 0 +failed, 38 ignored** (`$HOME/.cache/t900-suite-r7.log`). + +## Closed this round + +Sub-8x8 inter groups: the one chroma unit inherits the CHROMA-REFERENCE (last) +sub-block's first transform unit's `tx_type`, because `av1_get_tx_type` indexes +`xd->tx_type_map`, which `set_mi_offsets` (av1_common_int.h:1679) re-points to +the CURRENT sub-block. `decode.rs:23614` (`i == 3`) and `decode.rs:24598` +(`idx == 0 && i == 1`). Counter `sub8_chroma_tx_from_ref_hits`. + +Witness fixture EXTENDED (same path): 23 frame-carrying OBUs, 177773 bytes, +sha256 `09d995946d27695ef4b7b1a24a4d7ad85f8e2c8176d58ee54e825efc061f9cbc`, +16 decode-order frames, 15 shown. `trunc.py <2s cut> 23`. + +## Instruments (reuse, do not rebuild) + +* Oracle `~/.cache/t900-tmp/aom-build/aomdec` -- private build of the SHARED + source with the additive `EC_TRACE_TXTYPE` rung + (`decodetxb.c:187`: `EC_TXTYPE mi=, plane= br= bc= txs= tx_type=`). + Only prints for units that are not `all_zero` (libaom returns at + `decodetxb.c:172` before it). +* Ours: `EC_TRACE_TXTYPE=1` -> `OUR_TXTYPE plane= x= y= (side=|w= h=) tx_type= + inh=` (`decode.rs:14695` rect, `decode.rs:18480` square). `x`/`y` are that + plane's own pixel coords. +* `~/.cache/t900-tmp/`: `pf.sh` (prefilter compare), `px.py` (per-plane diff; + RUN IT FROM `~/.cache/t900-tmp`, its paths are relative), `cmp.sh` + (decode-order final compare), `sb.py`, `lad.py`, `reg.py`, cuts + `cut_{900,5400,6300,8100}.obu` (2 s each) and dumps `d_r7_*`. + +## Next defect, already localised to one sample + +t900 cut, decode-order frame 41: ONE U sample differs, chroma (354,395), +aomdec 490 vs ours 491. y=395 is the LAST chroma row (792/2 = 396). No cascade +-- frame 42 is exact. Start with `pf.sh` on that cut: if the PREFILTER frame 41 +is exact, it is a post-filter (deblock/CDEF/LR) bottom-edge rounding, which is +a different class from every r2-r7 fix. + +Then, each its own round: t5400 frame 33 (1642397 bytes), t6300 frame 11 (35 +bytes -- small, likely another basis/rounding defect), t8100 frame 1 (1313 +bytes). All four cuts now decode ALL frames; no refusal stops any of them, and +`~/.cache/reelc-0-10s.obu` decodes 240 frames with no env switches. + +`intra128_in_inter` fires 0 times on every stream tried, so its refusal stays +un-lifted for want of a witness (do not lift it without one). diff --git a/lanes/t900-r7.report.md b/lanes/t900-r7.report.md new file mode 100644 index 00000000..05b4cec0 --- /dev/null +++ b/lanes/t900-r7.report.md @@ -0,0 +1,119 @@ +# lane-t900 r7 -- sub-8x8 inter chroma inherits the CHROMA-REFERENCE sub-block's tx_type + +Branch `lane-t900`, code+fixture commit `04154beb` on top of main `3b529205` +(merged first, fast-forward). `CARGO_TARGET_DIR=$HOME/.cache/cargo-target-t900` +(suite/gates) and `-t900-b` (release `decode_probe`). + +## Root cause (r6's open defect, closed) + +`av1_get_tx_type` (`av1/common/blockd.h:1291-1305`) scales a chroma transform's +`blk_row`/`blk_col` back by the subsampling and indexes `xd->tx_type_map`. +`set_mi_offsets` (`av1/common/av1_common_int.h:1679`) re-points that pointer to +the CURRENT sub-block's mi, so for a sub-8x8 group the block current at the +chroma read is the CHROMA-REFERENCE (last) sub-block -- its first transform +unit's `tx_type` is what chroma inherits. Both sub-8x8 inter paths took the +group's FIRST sub-block: + +* `crates/ec-av1/src/decode.rs:23614` (`decode_inter_sub8_split4`): `i == 0` -> `i == 3`; +* `crates/ec-av1/src/decode.rs:24598` (`decode_inter_sub8_rect2`): `idx == 0 && (i == 0 || piece[0].is_none())` -> `idx == 0 && i == 1`. + +The `piece[0].is_none()` (INTRA first sub-block) special case disappears: under +the correct rule the chroma-reference block's own type is always the answer. + +No chroma `tx_type` symbol is coded, so the msac stream stayed in sync and only +the inverse transform's BASIS was wrong (class `tx-type-set-membership`). + +tx_type VALUES, both sides, at the defect (`~/.cache/t900-tmp/t900_h.obu`, +decode-order frame 14, luma 8x8 at (944,568) = mi(142,236) split HORZ into two +8x4 sub-blocks; the top one is skip, the bottom one codes `ADST_FLIPADST`): + +| side | rung | value | +|---|---|---| +| aomdec | `EC_TXTYPE mi=143,236 plane=0 br=0 bc=0 txs=6 tx_type=7` | luma 8x4 = ADST_FLIPADST | +| aomdec | `EC_TXTYPE mi=143,236 plane=1 br=0 bc=0 txs=0 tx_type=7` | chroma 4x4 = ADST_FLIPADST | +| ours (pre-fix) | `OUR_TXTYPE plane=1 x=472 y=284 side=4 tx_type=DctDct inh=Some(DctDct)` | chroma 4x4 = DCT_DCT | + +(V is absent from the oracle's list because its unit was `all_zero` -- which is +exactly why the residue was U-only.) + +Instrumentation added this round: additive, env-gated `EC_TRACE_TXTYPE` rungs -- +oracle `av1/decoder/decodetxb.c:187` (`EC_TXTYPE mi= plane= br= bc= txs= +tx_type=`, built into the PRIVATE `~/.cache/t900-tmp/aom-build`, never +`~/.cache/aom-oracle/build`) and ours `decode.rs:14695/18480` (`OUR_TXTYPE +plane= x= y= (side|w,h)= tx_type= inh=`). + +EVIDENCE: ~/.cache/t900-tmp/pf_h3/, aom_tt.log:25618-25619, our_tt.log:29969-29971 | pf.sh h3 (aomdec vs ours, EC_AV1_PREFILT_DUMP16) then px.py per frame | frame 14 U diff 14 px -> 0; all 16 decode-order frames Y/U/V 0 px + +## Same-shape sweep + +Every site that hands an inherited chroma `tx_type` to +`read_inter_plane`/`read_inter_plane_rect` was checked (`grep -n +"Some(first_tx_type)\|Some(luma_tx_type)"`, 18 hits): 14 are WITHIN one block +(the block's own top-left var-tx unit, where the current-block rule and the +first-unit rule coincide -- correct), the 4 sub-8x8 group ones are the two +fixed paths' U and V reads. No other cross-sub-block inheritance exists. + +## Gate + +`a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_decode_pixel_exact` +(`crates/ec-av1/src/stream.rs:30334`), the r6 witness, EXTENDED from 19 to 23 +frame-carrying OBUs so it covers decode-order frame 14: +`crates/ec-av1/fixtures/reelc_sb128_inter_witness.obu`, 177773 bytes, sha256 +`09d995946d27695ef4b7b1a24a4d7ad85f8e2c8176d58ee54e825efc061f9cbc`, 16 +decode-order frames, 15 shown. Two independent `-ss 900 -t 2 -c:v copy` cuts + +`trunc.py 23` hash identically. + +New counter `sub8_chroma_tx_from_ref_hits` (`decode.rs:3323`, re-exported +`stream.rs:90`, printed by `decode_probe`) counts ONLY the groups that tell the +two rules apart: chroma-reference `tx_type` != first sub-block's AND the chroma +unit codes coefficients. The gate hard-asserts it > 0 (fires 2) next to its +eight existing counters. + + a_10bit_128sb_film_frames_with_warp_cdef_and_interintra_decode_pixel_exact: + 15 shown frames pixel-exact on every plane; warp_plane_suppress=15 + cdef_idx=852 inter_sb128_vert=76 interintra_rect=118 + non_chroma_ref_ctx_skip=194 intra_in_inter_txctx=2069 + edge_filter_mi_fix=206 intra16x4_in_inter=(80, 163, 113) + sub8_chroma_tx_from_ref=2 + +Refusals: none lifted, none added (`refusal_inventory` + `gate_coverage` green). + +## Suite + +`cargo test -p ec-av1 --lib` (systemd unit `t900-suite-r7-1788376817`, log +`$HOME/.cache/t900-suite-r7.log`): **426 passed, 0 failed, 38 ignored** -- +identical to the r6 tip. Sibling gates named in the charter all green in that +run: the witness gate, `a_real_aomenc_10bit_stream_with_interintra_wedge_...`, +`a_real_aomenc_inter_sequence_with_intra_sub8x8_leaves_...`, +`a_real_aomenc_inter_sequence_with_a_sub8x8_inter_split_...`, +`a_real_aomenc_stream_with_a_sub8_rect_leaf_...`, +`a_real_aomenc_stream_with_a_sub8_split_...`, +`a_real_aomenc_stream_with_a_coded_strip_whose_chroma_is_a_4to1_or_sub8_rect_...`, +`refusal_inventory` (3), `gate_coverage` (9). + +## Film frontier, this tip (2 s cuts, decode-order vs aomdec `EC_AV1_FINAL_DUMP`) + +| cut | aom frames | ours | first differing | size of that diff | stop | +|---|---|---|---|---|---| +| t900 | 267 | 267 | **41** (was 14) | 1 sample: U(354,395) 490 vs 491 | -- | +| t5400 | 275 | 275 | **33** (was 1) | 1642397 bytes | -- | +| t6300 | 125 | 125 | **11** (was 1) | 35 bytes | -- | +| t8100 | 96 | 96 | 1 | 1313 bytes | none (r6's Golomb stop is GONE) | + +EVIDENCE: ~/.cache/t900-tmp/d_r7_{900,5400,6300,8100}/ | cmp.sh per cut, aomdec vs decode_probe, byte compare per decode-order frame | first differing frame 14->41, 1->33, 1->11, 1 (t8100 now decodes all 96 frames instead of stopping at 32) + +`~/.cache/reelc-0-10s.obu`: 240 frames decoded, NO env switches (r6's +"an intra-coded 128x64 block on the inter block path" stop is gone -- other +lanes' merges). With `EC_INTRA128_IN_INTER=1` the arm fires **0 times** +(`intra128_in_inter: 128x64=0 64x128=0`), so that refusal is NOT lifted: there +is still no witness for it. + +## Residue + +* fix-now(next round): t900 decode-order frame 41 -- ONE U sample at chroma + (354,395), 490 vs 491, on the LAST chroma row, no cascade (frame 42 exact). + Smells like a post-filter bottom-edge rounding, not an entropy defect. +* deferred(a round of its own): t5400 frame 33, t6300 frame 11 (35 bytes), + t8100 frame 1 -- three independent untouched defects, each needs its own + pf.sh -> sb.py -> EC_MODE ladder. +* accepted: the intra-128-in-inter refusal stays; 0 hits on every stream tried.