An intrabc block's chroma tx_type is inherited from its luma transform, not derived from the chroma intra mode -- every screen-content key frame with a real intra-block-copy block desynced at the first chroma eob symbol
Browse files at this commitd68cb8466ebbabfd358fc90ba751421d15f50dadParent: 593f3e5- fix
- an intrabc block's chroma tx_type is inherited from its luma transform, not derived from the chroma intra mode -- every screen-content key frame with a real intra-block-copy block desynced at the first chroma eob symbol
4 changed files +218 -45
- crates/ec-av1/src/decode.rs +32 -0
- crates/ec-av1/src/gate_coverage.rs +7 -14
- crates/ec-av1/src/stream.rs +61 -31
- lanes/kf900-r6.report.md +118 -0
crates/ec-av1/src/decode.rsmodified+32 -0
| @@ -1569,6 +1569,21 @@ thread_local! { | ||
| 1569 | 1569 | static INTRABC_DV: std::cell::Cell<Option<(i32, i32)>> = const { std::cell::Cell::new(None) }; |
| 1570 | 1570 | /// How many blocks decoded `use_intrabc == 1` -- the gate's hit counter. |
| 1571 | 1571 | static INTRABC_HITS: std::cell::Cell<usize> = const { std::cell::Cell::new(0) }; |
| 1572 | + /// The `tx_type` the last plane-0 [`read_plane`] actually coded, kept so | |
| 1573 | + /// an intrabc block's chroma reads can inherit it (see | |
| 1574 | + /// [`INTRABC_CHROMA_TX`]). Written on every luma read; only ever read | |
| 1575 | + /// through that one arming site. | |
| 1576 | + static LUMA_TX_TYPE: std::cell::Cell<TxType> = const { std::cell::Cell::new(TxType::DctDct) }; | |
| 1577 | + /// libaom `av1_get_tx_type` (`blockd.h:1350`): for `PLANE_TYPE_UV` it | |
| 1578 | + /// branches on `is_inter_block(mbmi)` -- which `is_intrabc_block` also | |
| 1579 | + /// satisfies (`blockd.h:373`) -- and takes the *colocated luma | |
| 1580 | + /// transform's coded* `tx_type` (`mbmi->txk_type[...]`), never | |
| 1581 | + /// `intra_mode_to_tx_type` of the chroma mode. `Some` only across an | |
| 1582 | + /// intrabc block's two chroma [`read_plane`] calls; the type decides the | |
| 1583 | + /// `TX_CLASS`, hence the scan order, `eob_multi_ctx` and every nz context | |
| 1584 | + /// -- getting it wrong desyncs the chroma coefficients, it is not a | |
| 1585 | + /// reconstruction-only detail. | |
| 1586 | + static INTRABC_CHROMA_TX: std::cell::Cell<Option<TxType>> = const { std::cell::Cell::new(None) }; | |
| 1572 | 1587 | } |
| 1573 | 1588 | |
| 1574 | 1589 | /// Whether this frame's header set `allow_intrabc` -- [`INTRABC_MI_GRID`] is |
| @@ -9515,6 +9530,13 @@ fn read_plane( | ||
| 9515 | 9530 | // narrows there — only `Chroma32` and up do). |
| 9516 | 9531 | let default_tx_type = if plane_idx == 0 || side >= 32 { |
| 9517 | 9532 | TxType::DctDct |
| 9533 | + } else if let Some(inherited) = INTRABC_CHROMA_TX.with(std::cell::Cell::get) { | |
| 9534 | + // See [`INTRABC_CHROMA_TX`]: an intrabc block is an inter block for | |
| 9535 | + // `av1_get_tx_type`, so chroma inherits luma's coded type (the | |
| 9536 | + // `side >= 32` arm above is already libaom's `EXT_TX_SET_DCTONLY` | |
| 9537 | + // clamp at `tx_size_sqr_up >= TX_32X32`, matching | |
| 9538 | + // [`read_inter_plane`]'s own `side < 32` guard). | |
| 9539 | + inherited | |
| 9518 | 9540 | } else { |
| 9519 | 9541 | default_intra_tx_type(predict_mode as u8) |
| 9520 | 9542 | }; |
| @@ -9528,6 +9550,9 @@ fn read_plane( | ||
| 9528 | 9550 | None, |
| 9529 | 9551 | )?; |
| 9530 | 9552 | note_chroma_class1(plane_idx, tx_type); |
| 9553 | + if plane_idx == 0 { | |
| 9554 | + LUMA_TX_TYPE.with(|c| c.set(tx_type)); | |
| 9555 | + } | |
| 9531 | 9556 | // A 64x64 luma block's transform covers the whole 64x64 area, but only its |
| 9532 | 9557 | // top-left 32x32 of frequencies are coded (spec 5.11.40); the rest of the |
| 9533 | 9558 | // dequantized grid stays zero, which `inverse_transform_2d`'s own `< 32` |
| @@ -9928,6 +9953,12 @@ fn decode_block( | ||
| 9928 | 9953 | smooth_neighbor, |
| 9929 | 9954 | )?; |
| 9930 | 9955 | let ac = alpha.map(|_| cfl_ac_q3(y, px, py, side)); |
| 9956 | + // Armed for exactly this block's two chroma reads (see | |
| 9957 | + // [`INTRABC_CHROMA_TX`]); the luma call above just set | |
| 9958 | + // [`LUMA_TX_TYPE`] to the type it coded. | |
| 9959 | + if intrabc_dv.is_some() { | |
| 9960 | + INTRABC_CHROMA_TX.with(|c| c.set(Some(LUMA_TX_TYPE.with(std::cell::Cell::get)))); | |
| 9961 | + } | |
| 9931 | 9962 | if let Some((ub, _)) = &palette_uv_bufs { |
| 9932 | 9963 | set_palette_pred(ub.clone()); |
| 9933 | 9964 | } |
| @@ -9984,6 +10015,7 @@ fn decode_block( | ||
| 9984 | 10015 | None, |
| 9985 | 10016 | smooth_neighbor_uv, |
| 9986 | 10017 | )?; |
| 10018 | + INTRABC_CHROMA_TX.with(|c| c.set(None)); | |
| 9987 | 10019 | neighbours.record(at, side, mode, uv_predict_mode, &[luma_grid, u_grid, v_grid]); |
| 9988 | 10020 | } else { |
| 9989 | 10021 | // Several luma transform units, raster order (spec |
crates/ec-av1/src/gate_coverage.rsmodified+7 -14
| @@ -42,16 +42,13 @@ | ||
| 42 | 42 | /// its tool is now covered by a real stream. |
| 43 | 43 | #[cfg(test)] |
| 44 | 44 | const NEVER_EXERCISED: &[(&str, &str)] = &[ |
| 45 | - // lane-intrabc r1: the DV itself (mv stack against INTRA_FRAME, `ndvc` | |
| 46 | - // full-pel read, `av1_find_ref_dv` fallback) and the block-copy | |
| 47 | - // prediction are now decoded, but every real aomenc intrabc block this | |
| 48 | - // lane could produce sits under TX_MODE_SELECT, whose inter var-tx | |
| 49 | - // partition tree is unread -- so no stream reconstructs one end to end | |
| 50 | - // yet and this entry stays. | |
| 51 | - ( | |
| 52 | - "enable-intrabc", | |
| 53 | - "the block vector is decoded and predicted from, but every real stream's intrabc block needs the unread inter var-tx transform tree", | |
| 54 | - ), | |
| 45 | + // `enable-intrabc` LEFT this list on 2026-09-02 (lane-kf900 r6). The | |
| 46 | + // premise it carried -- "every real stream's intrabc block sits under | |
| 47 | + // TX_MODE_SELECT" -- was false: with `--enable-tx-size-search=0` aomenc | |
| 48 | + // codes intrabc blocks under TX_MODE_LARGEST, and | |
| 49 | + // `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` | |
| 50 | + // spells `--enable-intrabc=1` and decodes three such 8-bit streams whole- | |
| 51 | + // frame pixel-exact against ffmpeg, with the block counter asserted > 0. | |
| 55 | 52 | ]; |
| 56 | 53 | |
| 57 | 54 | /// The `--enable-*` tools this decoder cares about, whether or not any gate |
| @@ -167,10 +164,6 @@ const NEVER_EXERCISED_8BIT: &[(&str, &str)] = &[ | ||
| 167 | 164 | "enable-global-motion", |
| 168 | 165 | "off in 5 gates, on in none at 8 bits; lane-gm owns the global-warp prediction that is still missing", |
| 169 | 166 | ), |
| 170 | - ( | |
| 171 | - "enable-intrabc", | |
| 172 | - "the block vector is decoded and predicted from, but every real stream's intrabc block needs the unread inter var-tx transform tree", | |
| 173 | - ), | |
| 174 | 167 | ( |
| 175 | 168 | "enable-rect-tx", |
| 176 | 169 | "never spelled; rect transforms reach the decoder only through partition shape, never through a gate that names the tool", |
crates/ec-av1/src/stream.rsmodified+61 -31
| @@ -2759,30 +2759,22 @@ mod tests { | ||
| 2759 | 2759 | let (width, height) = (256usize, 192usize); |
| 2760 | 2760 | // (arm, source, per-arm overrides AFTER the base recipe, expect_refusal, |
| 2761 | 2761 | // must_read_use_intrabc) |
| 2762 | - let arms: [(&str, &str, &[&str], bool, bool); 3] = [ | |
| 2763 | - ( | |
| 2764 | - "testsrc2-screen-nopalette-cq50", | |
| 2765 | - "testsrc2=s=256x192:r=25", | |
| 2766 | - &["--cq-level=50", "--enable-palette=0", "--enable-tx-size-search=0"], | |
| 2767 | - true, | |
| 2768 | - true, | |
| 2769 | - ), | |
| 2770 | - ( | |
| 2771 | - "smptebars-screen-nopalette-cq45", | |
| 2772 | - "smptebars=size=256x192:rate=25", | |
| 2773 | - &["--cq-level=45", "--enable-palette=0", "--enable-tx-size-search=0"], | |
| 2774 | - false, | |
| 2775 | - true, | |
| 2776 | - ), | |
| 2777 | - ( | |
| 2778 | - "testsrc2-screen-nopalette-cq63", | |
| 2779 | - "testsrc2=s=256x192:r=25", | |
| 2780 | - &["--cq-level=63", "--enable-palette=0", "--enable-tx-size-search=1"], | |
| 2781 | - false, | |
| 2782 | - false, | |
| 2783 | - ), | |
| 2762 | + const TS: &str = "testsrc2=s=256x192:r=25"; | |
| 2763 | + const SB: &str = "smptebars=size=256x192:rate=25"; | |
| 2764 | + // (arm, source, per-arm overrides AFTER the base recipe, expect_refusal, | |
| 2765 | + // must_read_use_intrabc_on_a_rect_strip) | |
| 2766 | + let arms: [(&str, &str, &[&str], bool, bool); 7] = [ | |
| 2767 | + ("testsrc2-cq50-txs0", TS, &["--cq-level=50", "--enable-palette=0", "--enable-tx-size-search=0"], true, true), | |
| 2768 | + ("smptebars-cq40-txs0", SB, &["--cq-level=40", "--enable-palette=0", "--enable-tx-size-search=0"], false, false), | |
| 2769 | + ("smptebars-cq45-txs0", SB, &["--cq-level=45", "--enable-palette=0", "--enable-tx-size-search=0"], false, true), | |
| 2770 | + ("smptebars-cq45-txs1", SB, &["--cq-level=45", "--enable-palette=0", "--enable-tx-size-search=1"], false, false), | |
| 2771 | + ("smptebars-cq50-txs1", SB, &["--cq-level=50", "--enable-palette=0", "--enable-tx-size-search=1"], false, false), | |
| 2772 | + ("smptebars-cq55-txs0", SB, &["--cq-level=55", "--enable-palette=0", "--enable-tx-size-search=0"], false, false), | |
| 2773 | + ("testsrc2-cq63-txs1", TS, &["--cq-level=63", "--enable-palette=0", "--enable-tx-size-search=1"], false, false), | |
| 2784 | 2774 | ]; |
| 2785 | 2775 | let (mut reads_total, mut refused, mut frames_compared) = (0usize, 0u32, 0usize); |
| 2776 | + let (mut blocks_total, mut fired_arms, mut out_of_scope, mut out_of_scope_mismatch) = | |
| 2777 | + (0usize, 0u32, 0u32, 0u32); | |
| 2786 | 2778 | for (arm, src, extra, expect_refusal, must_read) in &arms { |
| 2787 | 2779 | let render = || { |
| 2788 | 2780 | let out = Command::new("ffmpeg") |
| @@ -2823,6 +2815,9 @@ mod tests { | ||
| 2823 | 2815 | // `allow_screen_content_tools` (and with it the frame |
| 2824 | 2816 | // header's `allow_intrabc` bit) comes from here. |
| 2825 | 2817 | "--tune-content=screen", |
| 2818 | + // Spelled so `gate_coverage` counts the tool as exercised | |
| 2819 | + // rather than defaulted (class `tool-disabled-in-every-gate`). | |
| 2820 | + "--enable-intrabc=1", | |
| 2826 | 2821 | ]) |
| 2827 | 2822 | // aomenc keeps the LAST occurrence of a repeated flag. |
| 2828 | 2823 | .args(*extra) |
| @@ -2850,9 +2845,15 @@ mod tests { | ||
| 2850 | 2845 | ); |
| 2851 | 2846 | let stream = out.stdout; |
| 2852 | 2847 | decode::reset_rect_intrabc_reads(); |
| 2848 | + crate::decode::reset_intrabc_hits(); | |
| 2853 | 2849 | let decoded = decode_stream(&stream); |
| 2854 | 2850 | let reads = decode::rect_intrabc_reads(); |
| 2851 | + // Blocks that decoded `use_intrabc == 1` (square path), i.e. that | |
| 2852 | + // read a DV and predicted from the current frame -- distinct from | |
| 2853 | + // `reads`, which counts rect strips that merely READ the flag. | |
| 2854 | + let blocks = crate::decode::intrabc_hits(); | |
| 2855 | 2855 | reads_total += reads; |
| 2856 | + blocks_total += blocks; | |
| 2856 | 2857 | if *must_read { |
| 2857 | 2858 | assert!( |
| 2858 | 2859 | reads > 0, |
| @@ -2868,19 +2869,38 @@ mod tests { | ||
| 2868 | 2869 | reconstruction is not ported, it must refuse by name" |
| 2869 | 2870 | ); |
| 2870 | 2871 | assert!(!frames.is_empty(), "{NAME}: {arm} decoded no frame"); |
| 2871 | - if *must_read { | |
| 2872 | - // Arm 1: entropy coverage only (see PIXEL RESIDUE above). | |
| 2873 | - eprintln!("{NAME}: {arm} decoded {} frame(s), {reads} rect use_intrabc reads", frames.len()); | |
| 2874 | - continue; | |
| 2875 | - } | |
| 2876 | 2872 | let ffmpeg_frames = ffmpeg_decode_sequence(&stream, width, height, frames.len()); |
| 2877 | 2873 | assert_eq!(frames.len(), ffmpeg_frames.len(), "{NAME}: {arm} frame count"); |
| 2874 | + // EVERY frame is compared; an arm whose decode never hit an | |
| 2875 | + // intrabc block proves nothing about the DV/prediction path, | |
| 2876 | + // so it is counted OUT OF SCOPE -- but a mismatch there is | |
| 2877 | + // still a failure (`out_of_scope_mismatch == 0`), never a skip. | |
| 2878 | + let mut same = true; | |
| 2878 | 2879 | for (i, (ours, theirs)) in frames.iter().zip(ffmpeg_frames.iter()).enumerate() { |
| 2879 | - assert_eq!(ours.y, theirs.y, "{NAME}: {arm} luma, frame {i}"); | |
| 2880 | - assert_eq!(ours.u, theirs.u, "{NAME}: {arm} U, frame {i}"); | |
| 2881 | - assert_eq!(ours.v, theirs.v, "{NAME}: {arm} V, frame {i}"); | |
| 2880 | + let ok = ours.y == theirs.y && ours.u == theirs.u && ours.v == theirs.v; | |
| 2881 | + if !ok { | |
| 2882 | + eprintln!("{NAME}: {arm} MISMATCH at frame {i}"); | |
| 2883 | + } | |
| 2884 | + same &= ok; | |
| 2882 | 2885 | frames_compared += 1; |
| 2883 | 2886 | } |
| 2887 | + if blocks > 0 { | |
| 2888 | + fired_arms += 1; | |
| 2889 | + assert!( | |
| 2890 | + same, | |
| 2891 | + "{NAME}: {arm} decoded {blocks} intrabc block(s) and did not match ffmpeg" | |
| 2892 | + ); | |
| 2893 | + } else { | |
| 2894 | + out_of_scope += 1; | |
| 2895 | + if !same { | |
| 2896 | + out_of_scope_mismatch += 1; | |
| 2897 | + } | |
| 2898 | + } | |
| 2899 | + eprintln!( | |
| 2900 | + "{NAME}: {arm} {} frame(s), {reads} rect use_intrabc reads, \ | |
| 2901 | + {blocks} intrabc block(s), exact={same}", | |
| 2902 | + frames.len() | |
| 2903 | + ); | |
| 2884 | 2904 | } |
| 2885 | 2905 | Err(e) => { |
| 2886 | 2906 | let msg = e.to_string(); |
| @@ -2900,11 +2920,21 @@ mod tests { | ||
| 2900 | 2920 | } |
| 2901 | 2921 | eprintln!( |
| 2902 | 2922 | "{NAME}: {reads_total} rect-strip use_intrabc symbol(s) read, \ |
| 2903 | - {refused} refused by name, {frames_compared} frames compared pixel-exact" | |
| 2923 | + {blocks_total} intrabc block(s) decoded across {fired_arms} arm(s), \ | |
| 2924 | + {refused} refused by name, {frames_compared} frames compared, \ | |
| 2925 | + {out_of_scope} out of scope ({out_of_scope_mismatch} mismatched)" | |
| 2904 | 2926 | ); |
| 2905 | 2927 | assert!(reads_total > 0, "{NAME}: gate is vacuous -- no arm read the symbol"); |
| 2928 | + assert!( | |
| 2929 | + blocks_total > 0 && fired_arms > 0, | |
| 2930 | + "{NAME}: gate is vacuous -- no compared arm actually decoded an intrabc block" | |
| 2931 | + ); | |
| 2906 | 2932 | assert_eq!(refused, 1, "{NAME}: expected exactly one named intrabc refusal"); |
| 2907 | 2933 | assert!(frames_compared > 0, "{NAME}: no frame was compared pixel-exact"); |
| 2934 | + assert_eq!( | |
| 2935 | + out_of_scope_mismatch, 0, | |
| 2936 | + "{NAME}: an arm without an intrabc block still mismatched ffmpeg" | |
| 2937 | + ); | |
| 2908 | 2938 | } |
| 2909 | 2939 | |
| 2910 | 2940 | /// lane-kf900 r4, the gate for the two lifted palette refusals ("a 1:4 |
lanes/kf900-r6.report.mdadded+118 -0
| @@ -0,0 +1,118 @@ | ||
| 1 | +# lane-kf900 r6 report -- intrabc chroma tx_type was derived as intra, not inherited from luma | |
| 2 | + | |
| 3 | +Tip on `lane-kf900` (parent `cbfe32d`). GREEN for defect A. Defect B root-caused, NOT fixed | |
| 4 | +(deferred with the exact cause below). | |
| 5 | + | |
| 6 | +## The charter's premise for defect A was stale -- measured, not assumed | |
| 7 | + | |
| 8 | +The charter said `read_intrabc_dv` desyncs at the square 16x16 intrabc block mi(32,44) of | |
| 9 | +`b.obu`. It does not. The oracle carries an `EC_TRACE_IBC` rung inside `read_intrabc_info` | |
| 10 | +(`~/.cache/aom-oracle/src/av1/decoder/decodemv.c:752`) and prints, for the ONE intrabc block | |
| 11 | +in that stream: | |
| 12 | + | |
| 13 | +``` | |
| 14 | +EC_IBC mi_row=32 mi_col=44 bsize=6 skip=0 nstack=0 nearest=(0,0) near=(0,0) dv_ref=(-512,0) dv=(-512,-608) | |
| 15 | +``` | |
| 16 | + | |
| 17 | +Ours (`EC_AV1_TRACE=1`) printed `TRACE intrabc dv=(-512, -608)` -- bit-identical, including the | |
| 18 | +`av1_find_ref_dv` fallback branch (`mvref_common.h:267`: `mi_row - mib_size < tile->mi_row_start` | |
| 19 | +picks the `(0, -(MI_SIZE*mib_size + 256))` column form, else the `(-MI_SIZE*mib_size, 0)` row | |
| 20 | +form). Note also that a wrong DV predictor CANNOT desync anything: `read_mv` reads joint + | |
| 21 | +components before adding `ref`, so the predictor only moves the reconstructed vector. | |
| 22 | + | |
| 23 | +## Defect A -- root cause (cited) | |
| 24 | + | |
| 25 | +Cross-decoder coefficient ladder (`EC_TRACE_COEFF` both sides, compare `rng` not `tell`): | |
| 26 | + | |
| 27 | +``` | |
| 28 | +plane=0 all_zero ctx=0 rng=40876 both (the intrabc block's luma TU) | |
| 29 | +plane=0 eob=16 rng=40712 both ours: tx=VDct class=vert | |
| 30 | +plane=0 after_bases rng=58543 both | |
| 31 | +plane=1 all_zero ctx=7 rng=63400 both (chroma U) | |
| 32 | +plane=1 eob ref eob=8 rng=65032 ours eob=5 rng=37532 <-- first divergence | |
| 33 | +``` | |
| 34 | + | |
| 35 | +Luma coded `V_DCT`. libaom `av1_get_tx_type` (`av1/common/blockd.h`) branches `PLANE_TYPE_UV` | |
| 36 | +on `is_inter_block(mbmi)`, and `is_inter_block` counts `is_intrabc_block` (`blockd.h:373`), so | |
| 37 | +an intrabc block's CHROMA `tx_type` is the colocated LUMA transform's coded type | |
| 38 | +(`mbmi->txk_type[...]`), never `intra_mode_to_tx_type` of the chroma mode. We took the intra | |
| 39 | +rule and got `DCT_DCT`, i.e. `TX_CLASS_2D` where libaom had `TX_CLASS_VERT` -- which changes | |
| 40 | +`eob_multi_ctx` (0 vs 1), the scan order and every nz context. The chroma coefficients desynced | |
| 41 | +at the first `eob` symbol of the first intrabc block and the rest of the tile was garbage. | |
| 42 | + | |
| 43 | +This is the same rule `read_inter_plane` already implements for ordinary inter blocks | |
| 44 | +(`inherited_luma_tx_type`, `decode.rs:15475`); the intrabc path is an intra-side reader, so it | |
| 45 | +never went through it. Class sweep: `read_inter_plane` (inter) and this site (intrabc) are the | |
| 46 | +only two inter-typed chroma reads -- rect-strip and sub-8x8 intrabc still refuse by name, so no | |
| 47 | +third site exists. | |
| 48 | + | |
| 49 | +## Changes (defect A) | |
| 50 | + | |
| 51 | +| path | why | | |
| 52 | +| --- | --- | | |
| 53 | +| `crates/ec-av1/src/decode.rs` thread-locals `LUMA_TX_TYPE` / `INTRABC_CHROMA_TX` (next to `INTRABC_HITS`) | the luma `read_plane` does not return its coded `tx_type`; same off-stack idiom as `INTRABC_DV`/`PALETTE_PRED` | | |
| 54 | +| `crates/ec-av1/src/decode.rs` `read_plane` `default_tx_type` | chroma inherits the luma type while `INTRABC_CHROMA_TX` is armed; the pre-existing `side >= 32` arm is already libaom's `EXT_TX_SET_DCTONLY` clamp, matching `read_inter_plane`'s own `side < 32` guard | | |
| 55 | +| `crates/ec-av1/src/decode.rs` `read_plane` after `read_coeffs` | records the plane-0 coded `tx_type` | | |
| 56 | +| `crates/ec-av1/src/decode.rs` `decode_block`, `logical_tx == side` branch | arms `INTRABC_CHROMA_TX` for exactly this block's two chroma reads and clears it after V (no leak into the next block) | | |
| 57 | +| `crates/ec-av1/src/stream.rs` `a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips` | 3 arms -> 7, `--enable-intrabc=1` spelled in the base recipe, every frame of every decoding arm compared, per-arm `intrabc_hits` counter, out-of-scope accounting | | |
| 58 | +| `crates/ec-av1/src/gate_coverage.rs` | `enable-intrabc` removed from the 8-bit `NEVER_EXERCISED` and never-on lists (its stated premise is disproven); the 10-bit hole entry stays | | |
| 59 | + | |
| 60 | +## Gate | |
| 61 | + | |
| 62 | +``` | |
| 63 | +cargo test -p ec-av1 --lib a_real_aomenc_screen_key_frame_reads_use_intrabc -- --nocapture | |
| 64 | +``` | |
| 65 | +``` | |
| 66 | +testsrc2-cq50-txs0 REFUSED (expected): intra block copy on a HORZ/VERT/1:4 rect intra strip | |
| 67 | +smptebars-cq40-txs0 1 frame(s), 41 rect use_intrabc reads, 1 intrabc block(s), exact=true | |
| 68 | +smptebars-cq45-txs0 1 frame(s), 35 rect use_intrabc reads, 1 intrabc block(s), exact=true | |
| 69 | +smptebars-cq45-txs1 1 frame(s), 0 reads, 0 intrabc block(s), exact=true | |
| 70 | +smptebars-cq50-txs1 1 frame(s), 0 reads, 0 intrabc block(s), exact=true | |
| 71 | +smptebars-cq55-txs0 1 frame(s), 31 rect use_intrabc reads, 1 intrabc block(s), exact=true | |
| 72 | +testsrc2-cq63-txs1 1 frame(s), 0 reads, 0 intrabc block(s), exact=true | |
| 73 | +185 rect-strip use_intrabc symbol(s) read, 4 intrabc block(s) decoded across 3 arm(s), | |
| 74 | +1 refused by name, 6 frames compared, 3 out of scope (0 mismatched) | |
| 75 | +-> 1 passed | |
| 76 | +``` | |
| 77 | +`gate_coverage` (9 tests) green. No refusal string was lifted this round, so | |
| 78 | +`refusal_inventory.rs` is unchanged (47 entries): rect-strip intrabc reconstruction and | |
| 79 | +"intrabc under TxMode::Select" both still stand, and the gate proves the first one still fires. | |
| 80 | + | |
| 81 | +## Defect B -- root-caused, NOT fixed | |
| 82 | + | |
| 83 | +Stream: `testsrc2=s=256x192:r=25`, cq45 cpu-used 0, `--tune-content=screen --enable-palette=1 | |
| 84 | +--enable-tx-size-search=1 --enable-intrabc=1` (saved `$HOME/.cache/kf900-r6/DIFF_45_1_1_test.obu`). | |
| 85 | + | |
| 86 | +Order question in the charter, answered from the source: `parse_decode_block` | |
| 87 | +(`av1/decoder/decodeframe.c:1158` then `:1176`) calls `av1_visit_palette(..., av1_decode_palette_tokens)` | |
| 88 | +BEFORE `read_tx_size`. Our rect reader already has that order -- it is not the defect. | |
| 89 | + | |
| 90 | +The ladder is exact through mi(0,8) `angle_uv` (rng 42372 both). The block is a 32x8 rect strip | |
| 91 | +with a Y palette. The first colour-index-map symbol is then read at rng **34824** (oracle) vs | |
| 92 | +**51354** (ours), i.e. the divergence is inside `read_palette_mode_info`. Our | |
| 93 | +`read_palette_colors_y`/`_uv` match `decodemv.c` line for line (delta `+1` on Y only, telescoped | |
| 94 | +`range`, the `AOMMIN(bits, ceil_log2(range))` adaptation, the V delta/raw branch) -- so the | |
| 95 | +differing quantity is the COLOUR CACHE size, i.e. the neighbour palette. | |
| 96 | + | |
| 97 | +Root cause: `Neighbours::{above,left}_palette_{size,colors}` are indexed on the **16-px SUB | |
| 98 | +grid** (`decode.rs:4029-4034`), while libaom keeps `palette_size` per 4-px mi cell. The | |
| 99 | +already-documented corner-cut in `record_palette_y_rect` ("safe today because every sub-16 leaf | |
| 100 | +path refuses palette outright") is no longer true: this frame codes 16x8 rect strips WITH | |
| 101 | +palettes. For mi(0,8) libaom's `xd->left_mbmi` is mi(0,7) = the 16x8 block at mi(0,4), palette | |
| 102 | +size 3; our `left_palette_size[0]` had already been overwritten by mi(2,4) (palette size 2, | |
| 103 | +same 16-px cell), so we read 2 cache bits where libaom read 3 and the arithmetic decoder | |
| 104 | +desynced there. | |
| 105 | + | |
| 106 | +`deferred: defect B (palette colour cache at sub-16 granularity) -- the fix is the corner-cut's | |
| 107 | +own stated upgrade path, widening the four Y and four UV palette neighbour arrays from SUB to mi | |
| 108 | +granularity and passing the block's real mi position from all ~8 record/lookup call sites -- | |
| 109 | +unblocked by nothing but budget; a fresh round can start straight at decode.rs:3863-3943, | |
| 110 | +4010-4045, 4118-4175, 4348-4351, 5806-5817.` | |
| 111 | + | |
| 112 | +## EVIDENCE | |
| 113 | + | |
| 114 | +* `EVIDENCE: $HOME/.cache/kf900-r5/{b.obu,b2.yuv,b2_ref.yuv} | decode_probe vs ffmpeg -i on the same bytes, before/after the chroma-inheritance fix | before: OK + wrong pixels; after: cmp reports the 73728-byte frame identical (PIXEL_EXACT)` | |
| 115 | +* `EVIDENCE: $HOME/.cache/kf900-r5/{co.txt,cr.txt} | EC_TRACE_COEFF ladder both decoders on b.obu | luma exact through after_bases rng=58543, first divergence at the chroma eob: ref 65032 (eob 8) vs ours 37532 (eob 5)` | |
| 116 | +* `EVIDENCE: oracle EC_TRACE_IBC on $HOME/.cache/kf900-r5/b.obu vs our EC_AV1_TRACE | one intrabc block, mi(32,44) | dv=(-512,-608) identical -- the chartered DV defect does not exist` | |
| 117 | +* `EVIDENCE: $HOME/.cache/kf900-r6/{all_o.txt,all_r.txt} | EC_TRACE_MODE_STEP + EC_TRACE_PALETTE both decoders on DIFF_45_1_1_test.obu | exact to mi(0,8) angle_uv rng=42372, palette map starts at 34824 (ref) vs 51354 (ours)` | |
| 118 | +* `EVIDENCE: $HOME/.cache/kf900-r6/sweep.log | 32-point aomenc sweep (2 sources x cq40/45/50/55 x txs x palette, --enable-intrabc=1) decoded and cmp'd against ffmpeg | every pal=0 arm that decodes is EXACT; the 5 remaining DIFF arms are all pal=1` |