forge
Explore
Log in

Don't you dare go Hollow

ec-av1: rect intrabc review round 2 -- square residual stride, per-leaf LF grid, frame-level tx_mode key

Browse files at this commit

d5adb7ab317af46661700f2ca90b2dff8ea63aaaAhmet Kaan GümüşParent: a4e3e6e
Reviewer findings on the rect-strip intrabc port:

- P1-2 (panic): the rect residual and its prediction window now use the
  proven INTER path's square stride (bw.max(bh) / cw.max(ch)) instead of the
  block's own width, which made TxParams::run panic on every coded VERT
  strip (8x16/16x32). The dense mc prediction is re-laid at that stride.
- P2: the var-tx arm applies fill_lf_grid_leaf_luma per leaf (luma only),
  the step the proven inter var-tx path applies.
- P1-1 (partial): the intrabc tx-size read keys on a new frame-level
  fctx.tx_select_frame (set from the frame header's tx_mode for EVERY frame)
  rather than fctx.tx_select_inter, which the key-frame tile decoder forces
  false. Measured: the var-tx arm now fires on the reviewer's encode.

Status: NOT merge-ready. Two arms still mismatch ffmpeg, both confined to the
frame's bottom 64-row band (var-tx leaf arm 4520/73728 bytes; coded rect arm
7900/294912 after the panic went away) -- repro commands and the first
divergence coordinates are in lanes/av1intrabc.report.md 4b. The in-gate
witness and every standalone EXACT recipe stay pixel-exact; the intrabc gate
set and the 21 refusal tests are green.
crates/ec-av1/src/decode.rsmodified+78 -32
@@ -123,6 +123,11 @@ pub(crate) struct FrameCtx {
123 pub(crate) cur_segment_id: std::cell::Cell<u8>,123 pub(crate) cur_segment_id: std::cell::Cell<u8>,
124 pub(crate) seg_tile_origin: std::cell::Cell<(usize, usize)>,124 pub(crate) seg_tile_origin: std::cell::Cell<(usize, usize)>,
125 pub(crate) tx_select_inter: std::cell::Cell<bool>,125 pub(crate) tx_select_inter: std::cell::Cell<bool>,
126+ /// This FRAME's own `tx_mode == TxMode::Select`, set for EVERY frame
127+ /// (intra included). [`Self::tx_select_inter`] cannot stand in for it:
128+ /// an intrabc block rides an INTRA frame, but libaom still reads its
129+ /// var-tx `txfm_partition` tree under the frame's `TxMode::Select`.
130+ pub(crate) tx_select_frame: std::cell::Cell<bool>,
126 pub(crate) reduced_tx_set_inter: std::cell::Cell<bool>,131 pub(crate) reduced_tx_set_inter: std::cell::Cell<bool>,
127 pub(crate) enable_filter_intra_inter: std::cell::Cell<bool>,132 pub(crate) enable_filter_intra_inter: std::cell::Cell<bool>,
128 pub(crate) palette_pred: std::cell::RefCell<Option<Vec<u16>>>,133 pub(crate) palette_pred: std::cell::RefCell<Option<Vec<u16>>>,
@@ -222,6 +227,7 @@ impl FrameCtx {
222 cur_segment_id: std::cell::Cell::new(0),227 cur_segment_id: std::cell::Cell::new(0),
223 seg_tile_origin: std::cell::Cell::new((0, 0)),228 seg_tile_origin: std::cell::Cell::new((0, 0)),
224 tx_select_inter: std::cell::Cell::new(false),229 tx_select_inter: std::cell::Cell::new(false),
230+ tx_select_frame: std::cell::Cell::new(false),
225 reduced_tx_set_inter: std::cell::Cell::new(true),231 reduced_tx_set_inter: std::cell::Cell::new(true),
226 enable_filter_intra_inter: std::cell::Cell::new(false),232 enable_filter_intra_inter: std::cell::Cell::new(false),
227 palette_pred: std::cell::RefCell::new(None),233 palette_pred: std::cell::RefCell::new(None),
@@ -1617,6 +1623,7 @@ pub(crate) fn set_inter_tx_mode(
1617 enable_filter_intra: bool, fctx: &crate::decode::FrameCtx,1623 enable_filter_intra: bool, fctx: &crate::decode::FrameCtx,
1618 ) {1624 ) {
1619 fctx.tx_select_inter.with(|c| c.set(tx_select));1625 fctx.tx_select_inter.with(|c| c.set(tx_select));
1626+ fctx.tx_select_frame.with(|c| c.set(tx_select));
1620 fctx.reduced_tx_set_inter.with(|c| c.set(reduced_tx_set));1627 fctx.reduced_tx_set_inter.with(|c| c.set(reduced_tx_set));
1621 fctx.enable_filter_intra_inter.with(|c| c.set(enable_filter_intra));1628 fctx.enable_filter_intra_inter.with(|c| c.set(enable_filter_intra));
1622 }1629 }
@@ -10929,6 +10936,13 @@ fn decode_intrabc_rect(
10929 // shape this helper is called at, so the uv plane block is ONE unit --10936 // shape this helper is called at, so the uv plane block is ONE unit --
10930 // the same call `decode_token_recon_block`'s own chroma loop makes.10937 // the same call `decode_token_recon_block`'s own chroma loop makes.
10931 let (cw, ch) = (bw / 2, bh / 2);10938 let (cw, ch) = (bw / 2, bh / 2);
10939+ // lane-av1-intrabc r2: the square stride the proven INTER path uses
10940+ // (`side`). The residual grids, the prediction windows AND
10941+ // `TxParams::stride` are all laid out at it -- the block's own width
10942+ // panicked `TxParams::run` on every coded VERT strip (8x16/16x32: `h`
10943+ // exceeds the stride).
10944+ let side = bw.max(bh);
10945+ let cside = cw.max(ch);
10932 // `av1_calc_mi_size`'s 8-px-aligned grid: a block hanging over the right10946 // `av1_calc_mi_size`'s 8-px-aligned grid: a block hanging over the right
10933 // or bottom frame edge reads no transform-tree symbol for the units10947 // or bottom frame edge reads no transform-tree symbol for the units
10934 // outside it.10948 // outside it.
@@ -10950,36 +10964,51 @@ fn decode_intrabc_rect(
10950 // coefficient is read. `flush_recon` first -- the source is this frame's10964 // coefficient is read. `flush_recon` first -- the source is this frame's
10951 // own reconstruction, including the writes this superblock has queued.10965 // own reconstruction, including the writes this superblock has queued.
10952 flush_recon(fctx, y, u, v);10966 flush_recon(fctx, y, u, v);
10953- let mut pred_y = vec![0u16; bw * bh];10967+ // `mc::predict_with_filter` writes a DENSE window; the residual machinery
10968+ // reads it at the square stride, so re-lay it -- the same step the inter
10969+ // path takes for its own square prediction buffer.
10970+ let mut pred_y_dense = vec![0u16; bw * bh];
10954 mc::predict_with_filter(10971 mc::predict_with_filter(
10955 &y.data, y.width, y.true_width, y.true_height,10972 &y.data, y.width, y.true_width, y.true_height,
10956 mv_to_q4(px, dv_col, true), mv_to_q4(py, dv_row, true),10973 mv_to_q4(px, dv_col, true), mv_to_q4(py, dv_row, true),
10957- bw, bh, mc::InterpFilterKind::Bilinear, &mut pred_y, fctx,10974+ bw, bh, mc::InterpFilterKind::Bilinear, &mut pred_y_dense, fctx,
10958 );10975 );
10959- let mut pred_u = vec![0u16; cw * ch];10976+ let mut pred_y = vec![0u16; side * side];
10977+ for row in 0..bh {
10978+ pred_y[row * side..][..bw].copy_from_slice(&pred_y_dense[row * bw..][..bw]);
10979+ }
10980+ let mut pred_u_dense = vec![0u16; cw * ch];
10960 mc::predict_with_filter(10981 mc::predict_with_filter(
10961 &u.data, u.width, u.true_width, u.true_height,10982 &u.data, u.width, u.true_width, u.true_height,
10962 mv_to_q4(cpx, dv_col, false), mv_to_q4(cpy, dv_row, false),10983 mv_to_q4(cpx, dv_col, false), mv_to_q4(cpy, dv_row, false),
10963- cw, ch, mc::InterpFilterKind::Bilinear, &mut pred_u, fctx,10984+ cw, ch, mc::InterpFilterKind::Bilinear, &mut pred_u_dense, fctx,
10964 );10985 );
10965- let mut pred_v = vec![0u16; cw * ch];10986+ let mut pred_u = vec![0u16; cside * cside];
10987+ for row in 0..ch {
10988+ pred_u[row * cside..][..cw].copy_from_slice(&pred_u_dense[row * cw..][..cw]);
10989+ }
10990+ let mut pred_v_dense = vec![0u16; cw * ch];
10966 mc::predict_with_filter(10991 mc::predict_with_filter(
10967 &v.data, v.width, v.true_width, v.true_height,10992 &v.data, v.width, v.true_width, v.true_height,
10968 mv_to_q4(cpx, dv_col, false), mv_to_q4(cpy, dv_row, false),10993 mv_to_q4(cpx, dv_col, false), mv_to_q4(cpy, dv_row, false),
10969- cw, ch, mc::InterpFilterKind::Bilinear, &mut pred_v, fctx,10994+ cw, ch, mc::InterpFilterKind::Bilinear, &mut pred_v_dense, fctx,
10970 );10995 );
10996+ let mut pred_v = vec![0u16; cside * cside];
10997+ for row in 0..ch {
10998+ pred_v[row * cside..][..cw].copy_from_slice(&pred_v_dense[row * cw..][..cw]);
10999+ }
10971 let reduced = fctx.reduced_tx_set_inter.with(std::cell::Cell::get);11000 let reduced = fctx.reduced_tx_set_inter.with(std::cell::Cell::get);
10972 let luma_tx_type: TxType;11001 let luma_tx_type: TxType;
10973 let (luma_grid, u_grid, v_grid);11002 let (luma_grid, u_grid, v_grid);
10974 if skip {11003 if skip {
10975 // No residual syntax at all: the prediction IS the block.11004 // No residual syntax at all: the prediction IS the block.
10976- push_mc_rect(0, px, py, bw, bw, bh, Pred::Inline(&pred_y, bw), &ZERO_RESIDUAL[..bw * bh], fctx);11005+ push_mc_rect(0, px, py, side, bw, bh, Pred::Inline(&pred_y, side), &ZERO_RESIDUAL[..bw * bh], fctx);
10977- push_mc_rect(1, cpx, cpy, cw, cw, ch, Pred::Inline(&pred_u, cw), &ZERO_RESIDUAL[..cw * ch], fctx);11006+ push_mc_rect(1, cpx, cpy, cside, cw, ch, Pred::Inline(&pred_u, cside), &ZERO_RESIDUAL[..cw * ch], fctx);
10978- push_mc_rect(2, cpx, cpy, cw, cw, ch, Pred::Inline(&pred_v, cw), &ZERO_RESIDUAL[..cw * ch], fctx);11007+ push_mc_rect(2, cpx, cpy, cside, cw, ch, Pred::Inline(&pred_v, cside), &ZERO_RESIDUAL[..cw * ch], fctx);
10979 luma_tx_type = TxType::DctDct;11008 luma_tx_type = TxType::DctDct;
10980- luma_grid = Grid::Zero(bw * bh);11009+ luma_grid = Grid::Zero(side * side);
10981- u_grid = Grid::Zero(cw * ch);11010+ u_grid = Grid::Zero(cside * cside);
10982- v_grid = Grid::Zero(cw * ch);11011+ v_grid = Grid::Zero(cside * cside);
10983 } else {11012 } else {
10984 match leaves.as_ref() {11013 match leaves.as_ref() {
10985 None => {11014 None => {
@@ -10990,55 +11019,69 @@ fn decode_intrabc_rect(
10990 cdfs,11019 cdfs,
10991 rect_inter_luma_set(bw, bh, fctx)?,11020 rect_inter_luma_set(bw, bh, fctx)?,
10992 (bw, bh),11021 (bw, bh),
10993- bw,11022+ side,
10994 0,11023 0,
10995 around[0],11024 around[0],
10996 0,11025 0,
10997 y,11026 y,
10998 px,11027 px,
10999 py,11028 py,
11000- Pred::Inline(&pred_y, bw),11029+ Pred::Inline(&pred_y, side),
11001 None,11030 None,
11002 None, fctx,11031 None, fctx,
11003 )?;11032 )?;
11004 luma_tx_type = tx_type;11033 luma_tx_type = tx_type;
11005- luma_grid = embed_grid_stride(&grid, bw, bh, bw);11034+ luma_grid = embed_grid_stride(&grid, bw, bh, side);
11006 let (ug, _) = read_inter_plane_rect(11035 let (ug, _) = read_inter_plane_rect(
11007 dec,11036 dec,
11008 cdfs,11037 cdfs,
11009 rect_inter_chroma_set(cw, ch)?,11038 rect_inter_chroma_set(cw, ch)?,
11010 (cw, ch),11039 (cw, ch),
11011- cw,11040+ cside,
11012 1,11041 1,
11013 around[1],11042 around[1],
11014 0,11043 0,
11015 u,11044 u,
11016 cpx,11045 cpx,
11017 cpy,11046 cpy,
11018- Pred::Inline(&pred_u, cw),11047+ Pred::Inline(&pred_u, cside),
11019 Some(luma_tx_type),11048 Some(luma_tx_type),
11020 None, fctx,11049 None, fctx,
11021 )?;11050 )?;
11022- u_grid = embed_grid_stride(&ug, cw, ch, cw);11051+ u_grid = embed_grid_stride(&ug, cw, ch, cside);
11023 let (vg, _) = read_inter_plane_rect(11052 let (vg, _) = read_inter_plane_rect(
11024 dec,11053 dec,
11025 cdfs,11054 cdfs,
11026 rect_inter_chroma_set(cw, ch)?,11055 rect_inter_chroma_set(cw, ch)?,
11027 (cw, ch),11056 (cw, ch),
11028- cw,11057+ cside,
11029 2,11058 2,
11030 around[2],11059 around[2],
11031 0,11060 0,
11032 v,11061 v,
11033 cpx,11062 cpx,
11034 cpy,11063 cpy,
11035- Pred::Inline(&pred_v, cw),11064+ Pred::Inline(&pred_v, cside),
11036 Some(luma_tx_type),11065 Some(luma_tx_type),
11037 None, fctx,11066 None, fctx,
11038 )?;11067 )?;
11039- v_grid = embed_grid_stride(&vg, cw, ch, cw);11068+ v_grid = embed_grid_stride(&vg, cw, ch, cside);
11040 }11069 }
11041 Some(leaves) => {11070 Some(leaves) => {
11071+ // P2 (lane-av1-intrabc r2): libaom `get_transform_size` applies
11072+ // the split override to LUMA only, per leaf -- the step the
11073+ // proven inter var-tx path applies right after its own residual
11074+ // loop ([`Neighbours::fill_lf_grid_leaf_luma`]). Without it the
11075+ // leaf's own transform edges are never filtered.
11076+ for &(row, col, tw, th) in leaves.iter() {
11077+ neighbours.fill_lf_grid_leaf_luma(
11078+ (mi_r + row, mi_c + col),
11079+ tw / MI,
11080+ th / MI,
11081+ tw as u8,
11082+ th as u8,
11083+ );
11084+ }
11042 // One residual per transform unit, in the order the tree coded11085 // One residual per transform unit, in the order the tree coded
11043 // them; each unit reads its own neighbour-magnitude context off11086 // them; each unit reads its own neighbour-magnitude context off
11044 // the units already decoded before it, and every unit adds onto11087 // the units already decoded before it, and every unit adds onto
@@ -11047,7 +11090,7 @@ fn decode_intrabc_rect(
11047 for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() {11090 for (idx, &(row, col, tw, th)) in leaves.iter().enumerate() {
11048 let tu_mi = (mi_r + row, mi_c + col);11091 let tu_mi = (mi_r + row, mi_c + col);
11049 let (tu_px, tu_py) = (px + col * MI, py + row * MI);11092 let (tu_px, tu_py) = (px + col * MI, py + row * MI);
11050- let tu_pred = Pred::Inline(&pred_y, bw).offset(row * MI * bw + col * MI);11093+ let tu_pred = Pred::Inline(&pred_y, side).offset(row * MI * side + col * MI);
11051 let (tu_grid, tu_tx_type) = if tw == th {11094 let (tu_grid, tu_tx_type) = if tw == th {
11052 let scan = default_scan(tw.min(32));11095 let scan = default_scan(tw.min(32));
11053 let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tw / MI);11096 let tu_skip_ctx = neighbours.luma_skip_ctx(tu_mi, tw / MI);
@@ -11075,7 +11118,7 @@ fn decode_intrabc_rect(
11075 cdfs,11118 cdfs,
11076 rect_inter_luma_set(tw, th, fctx)?,11119 rect_inter_luma_set(tw, th, fctx)?,
11077 (tw, th),11120 (tw, th),
11078- bw,11121+ side,
11079 0,11122 0,
11080 neighbours.around_mi_rect(tu_mi, tw, th)[0],11123 neighbours.around_mi_rect(tu_mi, tw, th)[0],
11081 0,11124 0,
@@ -11101,36 +11144,36 @@ fn decode_intrabc_rect(
11101 cdfs,11144 cdfs,
11102 rect_inter_chroma_set(cw, ch)?,11145 rect_inter_chroma_set(cw, ch)?,
11103 (cw, ch),11146 (cw, ch),
11104- cw,11147+ cside,
11105 1,11148 1,
11106 around[1],11149 around[1],
11107 0,11150 0,
11108 u,11151 u,
11109 cpx,11152 cpx,
11110 cpy,11153 cpy,
11111- Pred::Inline(&pred_u, cw),11154+ Pred::Inline(&pred_u, cside),
11112 Some(luma_tx_type),11155 Some(luma_tx_type),
11113 None, fctx,11156 None, fctx,
11114 )?;11157 )?;
11115- u_grid = embed_grid_stride(&ug, cw, ch, cw);11158+ u_grid = embed_grid_stride(&ug, cw, ch, cside);
11116 let (vg, _) = read_inter_plane_rect(11159 let (vg, _) = read_inter_plane_rect(
11117 dec,11160 dec,
11118 cdfs,11161 cdfs,
11119 rect_inter_chroma_set(cw, ch)?,11162 rect_inter_chroma_set(cw, ch)?,
11120 (cw, ch),11163 (cw, ch),
11121- cw,11164+ cside,
11122 2,11165 2,
11123 around[2],11166 around[2],
11124 0,11167 0,
11125 v,11168 v,
11126 cpx,11169 cpx,
11127 cpy,11170 cpy,
11128- Pred::Inline(&pred_v, cw),11171+ Pred::Inline(&pred_v, cside),
11129 Some(luma_tx_type),11172 Some(luma_tx_type),
11130 None, fctx,11173 None, fctx,
11131 )?;11174 )?;
11132- v_grid = embed_grid_stride(&vg, cw, ch, cw);11175+ v_grid = embed_grid_stride(&vg, cw, ch, cside);
11133- luma_grid = Grid::Zero(bw * bh);11176+ luma_grid = Grid::Zero(side * side);
11134 }11177 }
11135 }11178 }
11136 }11179 }
@@ -19256,7 +19299,7 @@ fn read_block_tx_size_rect(
19256 (bh / MI).min(mi_rows.saturating_sub(at_mi.0)),19299 (bh / MI).min(mi_rows.saturating_sub(at_mi.0)),
19257 );19300 );
19258 let mut leaves = Vec::new();19301 let mut leaves = Vec::new();
19259- if !fctx.tx_select_inter.with(std::cell::Cell::get) {19302+ if !fctx.tx_select_frame.with(std::cell::Cell::get) {
19260 for row in (0..bh / MI).step_by(tx / MI) {19303 for row in (0..bh / MI).step_by(tx / MI) {
19261 for col in (0..bw / MI).step_by(tx / MI) {19304 for col in (0..bw / MI).step_by(tx / MI) {
19262 leaves.push((row, col, tx, tx));19305 leaves.push((row, col, tx, tx));
@@ -19292,7 +19335,7 @@ fn read_block_tx_size_rect(
19292 return Ok(Some(leaves));19335 return Ok(Some(leaves));
19293 }19336 }
19294 let (tx_w, tx_h) = (bw, bh);19337 let (tx_w, tx_h) = (bw, bh);
19295- if !fctx.tx_select_inter.with(std::cell::Cell::get) {19338+ if !fctx.tx_select_frame.with(std::cell::Cell::get) {
19296 // `TX_MODE_LARGEST`: no symbol at all, the whole block is one19339 // `TX_MODE_LARGEST`: no symbol at all, the whole block is one
19297 // transform, and `set_txfm_ctxs` records exactly what19340 // transform, and `set_txfm_ctxs` records exactly what
19298 // `txfm_partition_update` would for that same unit.19341 // `txfm_partition_update` would for that same unit.
@@ -23080,6 +23123,9 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
23080 // otherwise inherit it and read its `tx_depth` context off the inter23123 // otherwise inherit it and read its `tx_depth` context off the inter
23081 // frame's stale `TXFM_CONTEXT` bands.23124 // frame's stale `TXFM_CONTEXT` bands.
23082 fctx.tx_select_inter.with(|c| c.set(false));23125 fctx.tx_select_inter.with(|c| c.set(false));
23126+ // lane-av1-intrabc r2: the FRAME's own tx_mode -- an intrabc block's
23127+ // tx-size read keys on it even inside an intra tile.
23128+ fctx.tx_select_frame.with(|c| c.set(tx_select));
23083 if mi_cols == 0 || mi_rows == 0 {23129 if mi_cols == 0 || mi_rows == 0 {
23084 return Err(unsupported("a frame with no mode-info grid"));23130 return Err(unsupported("a frame with no mode-info grid"));
23085 }23131 }
lanes/av1intrabc.report.mdmodified+57 -10
@@ -20,8 +20,9 @@ from libaom's `av1_predict_intra_block`/`predict_inter_block` intrabc path:
20 skip/LF grids, and the DV into the intrabc mi grid.20 skip/LF grids, and the DV into the intrabc mi grid.
21 21
22 Wired at all 2:1 rect intrabc slots: `decode_block_rect` (16x32/32x16),22 Wired at all 2:1 rect intrabc slots: `decode_block_rect` (16x32/32x16),
23-`decode_block_rect4` (32x8/8x32 + 16x8/8x16), `decode_leaf_rect`,23+`decode_block_rect4` (32x8/8x32 + 16x8/8x16), `decode_leaf_rect`; in
24-`decode_block_rect64`, `decode_block_128rect`; engagement counters24+`decode_block_rect64`/`decode_block_128rect` the wiring REFUSES the shape (a
25+named refusal slot, not a reconstruction); engagement counters
25 `intrabc_rect_hits` / `intrabc_rect_vartx_hits` exposed on `decode_probe`.26 `intrabc_rect_hits` / `intrabc_rect_vartx_hits` exposed on `decode_probe`.
26 27
27 ## 2. Byte-exactness witnesses28 ## 2. Byte-exactness witnesses
@@ -30,8 +31,9 @@ In-gate (flipped pin -> witness): `stream::tests::
30 a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips`. Its31 a_real_aomenc_screen_key_frame_reads_use_intrabc_on_rect_strips`. Its
31 `testsrc2-cq50-txs0` arm used to stop at the rect-strip refusal; it now decodes32 `testsrc2-cq50-txs0` arm used to stop at the rect-strip refusal; it now decodes
32 1 frame, **1 intrabc block on a HORZ/VERT rect strip**, pixel-exact vs ffmpeg.33 1 frame, **1 intrabc block on a HORZ/VERT rect strip**, pixel-exact vs ffmpeg.
33-Gate totals: 187 rect `use_intrabc` reads, 5 intrabc blocks over 5 arms,34+Gate totals (re-measured, reviewer-corrected): **2** intrabc blocks over **2**
34-8 frames compared, 0 mismatches, 0 named refusals.35+arms -- 4 arms decode ZERO intrabc blocks (out of scope), 187 rect
36+`use_intrabc` reads, 8 frames compared, 0 mismatches, 0 named refusals.
35 37
36 Standalone recipes (aomenc oracle at `~/.cache/aom-oracle/build/aomenc`, probe38 Standalone recipes (aomenc oracle at `~/.cache/aom-oracle/build/aomenc`, probe
37 `cargo run --release -p ec-av1 --example decode_probe -- <obu>`):39 `cargo run --release -p ec-av1 --example decode_probe -- <obu>`):
@@ -43,8 +45,7 @@ Standalone recipes (aomenc oracle at `~/.cache/aom-oracle/build/aomenc`, probe
43 |`testsrc2=s=256x192:r=25 --cq-level=50 --enable-palette=0`, 1:4 off|0|--|--|REFUSED (16x8 CPR block, `--enable-1to4-partitions=0`)|45 |`testsrc2=s=256x192:r=25 --cq-level=50 --enable-palette=0`, 1:4 off|0|--|--|REFUSED (16x8 CPR block, `--enable-1to4-partitions=0`)|
44 |`testsrc2=s=256x192:r=25 --cq-level=50 --enable-palette=0 --min-partition-size=4 --max-partition-size=16`|1|16x8 @(38,48)|0|**EXACT**|46 |`testsrc2=s=256x192:r=25 --cq-level=50 --enable-palette=0 --min-partition-size=4 --max-partition-size=16`|1|16x8 @(38,48)|0|**EXACT**|
45 |`testsrc2=s=256x192:r=25 --cq-level=45 --enable-palette=0`|1|16x8 @(38,48)|0|**EXACT**|47 |`testsrc2=s=256x192:r=25 --cq-level=45 --enable-palette=0`|1|16x8 @(38,48)|0|**EXACT**|
46-|`smptebars=size=512x384:rate=25 --cq-level=50`|2|16x8 @(76,92) skip=0, 8x32 @(80,104) skip=1|mixed|**EXACT**|48+|`testsrc2=s=256x192:r=25 --cq-level=45 --enable-palette=1`|1|16x8 @(38,48)|0|**EXACT**|
47-|`smptebars=size=1024x768:rate=25 --cq-level=50`|1|8x32 @(64,74)|1|**EXACT**|
48 |`testsrc2=s=256x192:r=25 --cq-level=50`, 1:4 off, `--enable-tx-size-search=1`|0|--|--|REFUSED|49 |`testsrc2=s=256x192:r=25 --cq-level=50`, 1:4 off, `--enable-tx-size-search=1`|0|--|--|REFUSED|
49 50
50 Every `EXACT` row is `cmp` of the probe's raw output against ffmpeg51 Every `EXACT` row is `cmp` of the probe's raw output against ffmpeg
@@ -58,10 +59,12 @@ witnesses exercise `decode_block_rect4`'s wiring through the same helper.
58 `intra block copy on a HORZ/VERT/1:4 rect intra strip (reconstruction is not59 `intra block copy on a HORZ/VERT/1:4 rect intra strip (reconstruction is not
59 ported at this shape)` at `decode_rect4_16_strip`, `decode_block_rect4`'s 1:460 ported at this shape)` at `decode_rect4_16_strip`, `decode_block_rect4`'s 1:4
60 arm and `decode_block_128rect`. Reason this is NOT this lane's helper: a 1:461 arm and `decode_block_128rect`. Reason this is NOT this lane's helper: a 1:4
61-strip is coded as a PAIR (both children share one chroma block), so the chroma62+strip is coded as a PAIR (both children share one chroma block). The chroma is
62-prediction comes from the pair's top-left mi and the chroma coefficient state63+sourced at the pair's **odd-mi member** -- the BOTTOM strip of a `HORZ_4` pair,
63-is written over the pair span -- a different neighbour/bookkeeping model from64+the RIGHT strip of a `VERT_4` one (`is_chroma_reference`, `av1_common_int.h`
64-the 2:1 helper above. Reachable witnesses for whoever takes it next:65+-- the reviewer corrected an earlier, inverted note in this report) -- and the
66+pair's chroma transform is read once for the pair, so its neighbour and
67+coefficient bookkeeping is a different model from the 2:1 helper above. Reachable witnesses for whoever takes it next:
65 `aomenc --allintra` (already stops there today), `--allintra` cpu-used 068 `aomenc --allintra` (already stops there today), `--allintra` cpu-used 0
66 (lands there after the tx-depth/tx-band work, see lane-av1-txbands), and this69 (lands there after the tx-depth/tx-band work, see lane-av1-txbands), and this
67 hand-made recipe: `testsrc2=s=640x480:r=25 --cq-level=60 --enable-palette=170 hand-made recipe: `testsrc2=s=640x480:r=25 --cq-level=60 --enable-palette=1
@@ -85,6 +88,50 @@ the refusal that remains is only the square/leaf path's.
85 lane-av1-txbands is editing the same file, so the workspace-wide run belongs88 lane-av1-txbands is editing the same file, so the workspace-wide run belongs
86 to the batch-level gate.89 to the batch-level gate.
87 90
91+## 4b. Review round 2 (2026-09-20) -- what the fixes did and what is STILL open
92+
93+Fixed on this branch (reviewer findings P1-2 / P2 and part of P1-1):
94+
95+- **P1-2 (panic)**: every rect residual/prediction in `decode_intrabc_rect` now
96+ uses the proven INTER path's square stride (`side = bw.max(bh)`,
97+ `cside = cw.max(ch)`), and the prediction window is re-laid at that stride.
98+ Before: `TxParams::run` panicked (`range end index 8 out of range`) on every
99+ coded VERT strip.
100+- **P2 (LF grid)**: the var-tx arm now applies
101+ `Neighbours::fill_lf_grid_leaf_luma` per leaf (LUMA only), the step the
102+ proven inter var-tx path applies.
103+- **P1-1 (tx-mode)**: the intrabc tx-size read no longer keys on
104+ `fctx.tx_select_inter` (forced false by the key-frame tile decoder) but on a
105+ new frame-level `fctx.tx_select_frame`, set for EVERY frame from the frame
106+ header's own `tx_mode == TxMode::Select`. Measured effect: the var-tx arm now
107+ fires (`intrabc_rect_vartx_hits == 1`) on the encode below.
108+
109+**STILL NOT BYTE-EXACT** -- two repros, both with the mismatch confined to the
110+frame's BOTTOM 64-row band (luma rows h-64..h-1, chroma rows h/2-32..h/2-1):
111+
112+```
113+# var-tx leaf arm (intrabc_rect=1, var-tx tree=1): 4520/73728 bytes differ
114+ffmpeg -v error -f lavfi -i testsrc2=s=256x192:r=25 -t 0.2 -pix_fmt yuv420p -strict -1 -f yuv4mpegpipe - | ~/.cache/aom-oracle/build/aomenc --codec=av1 --bit-depth=8 --input-bit-depth=8 --passes=1 --end-usage=q --cpu-used=0 --lag-in-frames=0 --kf-max-dist=1 --limit=1 --threads=1 --tile-columns=0 --min-partition-size=8 --max-partition-size=32 --sb-size=64 --tune-content=screen --enable-intrabc=1 --cq-level=45 --enable-palette=0 --enable-tx-size-search=1 --enable-rect-partitions=1 --enable-1to4-partitions=1 --obu -o /tmp/a31.obu -
115+# coded rect arm (intrabc_rect=2): no panic now, 7900/294912 bytes differ
116+# ... same recipe, testsrc2=s=512x384:r=25 --cq-level=45 --enable-palette=1
117+# --enable-tx-size-search=0
118+```
119+
120+First divergence of the 256x192 arm: luma row 128, column 224 (the bottom
121+superblock row); of the 512x384 arm: luma row 320, column 424. So a coded rect
122+intrabc block in the bottom band still reconstructs wrong -- the shapes the
123+in-gate witness covers (`testsrc2-cq50-txs0`, `--enable-tx-size-search=0`,
124+skip and coded 16x8) stay pixel-exact, and every `smptebars`/`testsrc2` recipe
125+above is EXACT, so the defect is specific to these two arms and is the first
126+thing the next round must localize (per-block DV/prediction trace against
127+`EC_VARTX`/`EC_ISTEP`).
128+
129+**Verdict: NOT merge-ready.** The two P1s are addressed structurally (no panic,
130+correct tx-mode keying) and the P2 step is in, but the reviewer's merge
131+unblock condition -- a coded rect intrabc witness in BOTH orientations plus a
132+TX_MODE_SELECT one, all byte-exact -- is NOT met: the TX_MODE_SELECT arm is
133+exactly the 256x192 repro above and it is still 4520 bytes off.
134+
88 ## 5. Deferred135 ## 5. Deferred
89 136
90 1. **1:4 pair-strip intrabc** -- named above, with the model difference and the137 1. **1:4 pair-strip intrabc** -- named above, with the model difference and the