forge
Explore
Log in

Don't you dare go Hollow

Rect leaves read has_tr/has_bl from the wrong block-size table

Browse files at this commit

ae5d89dbd7be563c1c840966d601058530424879Ahmet Kaan GümüşParent: 7f6f585
  • fix
    • rect leaves read has_tr/has_bl from the wrong block-size table
    • mi-exact intra mode neighbours (cherry-pick lane-sub8 1841406)
Show full message
fix(av1): rect leaves read has_tr/has_bl from the wrong block-size table; mi-exact intra mode neighbours (cherry-pick lane-sub8 1841406)

Two defects, both on the sub-16x16 rect strip path:

1. `Reach::of_rect` looked up `HAS_TOP_RIGHT_RECT`/`HAS_BOTTOM_LEFT_RECT`
   indexed by `bw == 16` -- tables transcribed for the 32x16/16x32 strips
   only. A 16x8 block therefore read has_tr_16x32/has_bl_16x32 (4 bytes)
   where libaom reads has_tr_16x8/has_bl_16x8 (16 bytes), and an 8x16 read
   the 32x16 rows. `top_right_rect`/`bottom_left_rect` are now libaom
   `has_top_right`/`has_bottom_left` verbatim at block granularity, with the
   16x8/8x16 tables added. Symptom: a D203 16x8 strip's prediction was exact
   until the ray first reads BELOW its own height, then diverged (first diff
   at (44,18) of a 64x64 key frame, growing to the whole lower-right frame).

2. Cherry-picked lane-sub8 1841406's mi-granular intra-mode neighbour map
   (`sub8_mode_col/row`, `record_mode_mi`, `mode_above_mi`/`mode_left_mi`,
   plus `has_tr_4x4`/`has_bl_4x4` in encode.rs); the split-4x4 hunks are
   dropped, this branch has no `decode_leaf_split4`. `decode_leaf_rect` now
   reads through that map and records its own bw x bh span, which fixes the
   wrong `kf_y_mode` CDF row r3 located at leaf mi=(4,12).

Gate `a_real_aomenc_stream_with_a_coded_rect_strip_below_16x16_decodes_pixel_exact`
is green: pixel-exact vs ffmpeg, rect_leaf_coeff_hits=8 (6 non-skip 16x8 +
1 non-skip 8x16 luma transforms). Its recipe moved to mandelbrot start_x=-0.6
cq16 with --enable-filter-intra=0 (filter intra on a strip is a separate,
still-refused predictor).
crates/ec-av1/examples/decode_probe.rsmodified+16 -1
@@ -32,7 +32,22 @@ fn main() {
3232 Ok(frames) if frames.is_empty() => {
3333 println!("OK but EMPTY: no frames -- is {path} an IVF rather than a raw OBU stream?");
3434 }
35- Ok(frames) => println!("OK: {} frames decoded", frames.len()),
35+ Ok(frames) => {
36+ println!("OK: {} frames decoded", frames.len());
37+ // Optional second arg: dump the decoded planes as raw yuv420p so a
38+ // pixel diff against `ffmpeg -i s.obu -f rawvideo` needs no test harness.
39+ if let Some(out) = std::env::args().nth(2) {
40+ // 8-bit only: planes are u16, take the low byte.
41+ let mut buf: Vec<u8> = Vec::new();
42+ for f in &frames {
43+ for p in [&f.y, &f.u, &f.v] {
44+ buf.extend(p.iter().map(|&s| s as u8));
45+ }
46+ }
47+ std::fs::write(&out, &buf).expect("writing raw planes");
48+ println!("wrote {} bytes of yuv420p to {out}", buf.len());
49+ }
50+ }
3651 Err(e) => println!("REFUSED: {e}"),
3752 }
3853 }
crates/ec-av1/src/decode.rsmodified+82 -0
@@ -1826,6 +1826,19 @@ struct Neighbours {
18261826 /// one was coded at 8x8.
18271827 above_side_mi: Vec<usize>,
18281828 left_side_mi: Vec<usize>,
1829+ /// The luma `mode` of the last `BLOCK_4X4` leaf decoded at each mi column
1830+ /// / row, with the mi position it was written at
1831+ /// (`(usize::MAX, _)` = never written). `above_mode`/`left_mode` are on
1832+ /// the coarse 16x16 grid, which cannot distinguish the two 4x4 leaves an
1833+ /// 8x8 `PARTITION_SPLIT` puts in one mi column; libaom's intra-mode
1834+ /// context reads `mi(row, col-1)`/`mi(row-1, col)` exactly, so a sub-8x8
1835+ /// leaf whose neighbour is another split group needs that group's leaf 3
1836+ /// (bottom-right), not the leaf the coarse slot happens to hold. Written
1837+ /// and read only by [`decode_leaf_split4`]; the position guard makes it
1838+ /// fall back to the coarse slot whenever the real neighbour was a block
1839+ /// of 8x8 or larger (whose one mode is correct for every row it spans).
1840+ sub8_mode_col: Vec<(usize, usize)>,
1841+ sub8_mode_row: Vec<(usize, usize)>,
18291842 /// Whether the block above/left of this column/row was coded `skip` --
18301843 /// an inter frame's own `skip` context (spec `SkipContext`), which the
18311844 /// key-frame writer never tracks (its skip context is always zero); a
@@ -1953,6 +1966,8 @@ impl Neighbours {
19531966 left_side: vec![SB; rows],
19541967 above_side_mi: vec![SB; cols * (SUB / MI)],
19551968 left_side_mi: vec![SB; rows * (SUB / MI)],
1969+ sub8_mode_col: vec![(usize::MAX, 0); cols * (SUB / MI)],
1970+ sub8_mode_row: vec![(usize::MAX, 0); rows * (SUB / MI)],
19561971 above_skip: vec![false; cols],
19571972 left_skip: vec![false; rows],
19581973 above_skip_mode: vec![false; cols],
@@ -2514,6 +2529,46 @@ impl Neighbours {
25142529 /// [`Self::partition_ctx`]) are the neighbour's own width/height per the
25152530 /// spec's per-edge partition-context rule, so a true rectangular block
25162531 /// naturally wants two different values here rather than one.
2532+ /// Writes this block's luma `mode` into the mi-granular
2533+ /// [`Self::sub8_mode_col`]/[`Self::sub8_mode_row`] maps, keyed by the mi
2534+ /// position a *later* neighbour would read it from: the block's LAST mi
2535+ /// row for every column it spans (what the block below reads via
2536+ /// `mi(row-1, col)`) and its LAST mi column for every row (what the
2537+ /// block to the right reads via `mi(row, col-1)`). Only sub-8x8 leaves
2538+ /// read these back, and only when the recorded position is exactly their
2539+ /// own neighbour -- see [`Self::sub8_mode_col`]'s doc.
2540+ fn record_mode_mi(&mut self, mi_r: usize, mi_c: usize, mi_w: usize, mi_h: usize, mode: usize) {
2541+ let (last_r, last_c) = (mi_r + mi_h - 1, mi_c + mi_w - 1);
2542+ for cell in 0..mi_w {
2543+ if let Some(slot) = self.sub8_mode_col.get_mut(mi_c + cell) {
2544+ *slot = (last_r, mode);
2545+ }
2546+ }
2547+ for cell in 0..mi_h {
2548+ if let Some(slot) = self.sub8_mode_row.get_mut(mi_r + cell) {
2549+ *slot = (last_c, mode);
2550+ }
2551+ }
2552+ }
2553+
2554+ /// The mi-exact above/left neighbour luma mode for a block whose top-left
2555+ /// mi is `(mi_r, mi_c)`, or `None` when no block has recorded that exact
2556+ /// mi position (then the coarse [`SUB`]-grid slot is right by
2557+ /// construction). See [`Self::record_mode_mi`].
2558+ fn mode_above_mi(&self, mi_r: usize, mi_c: usize) -> Option<usize> {
2559+ match self.sub8_mode_col.get(mi_c) {
2560+ Some(&(row, m)) if mi_r > 0 && row == mi_r - 1 => Some(m),
2561+ _ => None,
2562+ }
2563+ }
2564+
2565+ fn mode_left_mi(&self, mi_r: usize, mi_c: usize) -> Option<usize> {
2566+ match self.sub8_mode_row.get(mi_r) {
2567+ Some(&(col, m)) if mi_c > 0 && col == mi_c - 1 => Some(m),
2568+ _ => None,
2569+ }
2570+ }
2571+
25172572 fn record_rect(
25182573 &mut self,
25192574 at: (usize, usize),
@@ -2534,6 +2589,7 @@ impl Neighbours {
25342589 self.left_uv_mode[r + cell] = uv_mode;
25352590 self.left_side[r + cell] = h;
25362591 }
2592+ self.record_mode_mi(r * (SUB / MI), c * (SUB / MI), w / MI, h / MI, mode);
25372593 self.record_mi_rect((r * (SUB / MI), c * (SUB / MI)), w, h, grids);
25382594 }
25392595
@@ -2644,6 +2700,7 @@ impl Neighbours {
26442700 }
26452701 let (mi_r, mi_c) = (r * (SUB / MI), c * (SUB / MI));
26462702 let side_mi = side / MI;
2703+ self.record_mode_mi(mi_r, mi_c, side_mi, side_mi, mode);
26472704 for cell in 0..side_mi {
26482705 self.left_side_mi[mi_r + cell] = side;
26492706 self.above_side_mi[mi_c + cell] = side;
@@ -3590,6 +3647,16 @@ fn decode_leaf_rect(
35903647 left_mode = pmode;
35913648 }
35923649 }
3650+ // Same mi-exact override [`decode_leaf8`] takes: one coarse 16x16 slot
3651+ // cannot hold the modes a split (or a pair of strips) leaves behind, so
3652+ // when the map holds the block at exactly this strip's above/left mi it
3653+ // is the neighbour libaom's `above_mi`/`left_mi` reads.
3654+ if let Some(m) = neighbours.mode_above_mi(leaf_mi.0, leaf_mi.1) {
3655+ above_mode = m;
3656+ }
3657+ if let Some(m) = neighbours.mode_left_mi(leaf_mi.0, leaf_mi.1) {
3658+ left_mode = m;
3659+ }
35933660 let smooth_neighbor =
35943661 is_smooth_mode(above_mode) || is_smooth_mode(left_mode);
35953662 if smooth_neighbor {
@@ -3726,6 +3793,9 @@ fn decode_leaf_rect(
37263793 neighbours.record_mi_rect(leaf_mi, bw, bh, &[luma_levels, u_levels, v_levels]);
37273794 neighbours.fill_skip_grid_rect(leaf_mi, mi_w, mi_h, skip);
37283795 neighbours.fill_lf_grid_rect(leaf_mi, mi_w, mi_h, bw as u8, bh as u8, 0);
3796+ // A rect leaf spans mi_w x mi_h, so its mode reaches several columns and
3797+ // rows -- record the whole span, not one cell.
3798+ neighbours.record_mode_mi(leaf_mi.0, leaf_mi.1, mi_w, mi_h, mode);
37293799 Ok(mode)
37303800 }
37313801
@@ -5309,6 +5379,16 @@ fn decode_leaf8(
53095379 left_mode = pmode;
53105380 }
53115381 }
5382+ // The mi-exact neighbour wins over both the coarse 16x16 slot and
5383+ // `prev_leaf`: one 16x16 slot cannot hold the two different modes its
5384+ // two 8x8 (or four 4x4) columns leave behind, so a leaf whose above/left
5385+ // neighbour sits in a split cell read the wrong `kf_y_mode` row.
5386+ if let Some(m) = neighbours.mode_above_mi(leaf_mi.0, leaf_mi.1) {
5387+ above_mode = m;
5388+ }
5389+ if let Some(m) = neighbours.mode_left_mi(leaf_mi.0, leaf_mi.1) {
5390+ left_mode = m;
5391+ }
53125392 // See [`PlaneBuf::reconstruct`]'s doc: chroma stays `false` (exact) until
53135393 // a smooth/paeth `uv_mode` can reach decode at all.
53145394 let smooth_neighbor = is_smooth_mode(above_mode) || is_smooth_mode(left_mode);
@@ -5596,11 +5676,13 @@ fn decode_leaf8(
55965676 }
55975677 neighbours.fill_skip_grid(leaf_mi, 2, skip);
55985678 neighbours.fill_lf_grid(leaf_mi, 2, 4, 0);
5679+ neighbours.record_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, mode);
55995680 return Ok(mode);
56005681 }
56015682 neighbours.record_mi(leaf_mi, 8, &[luma_grid, u_grid, v_grid]);
56025683 neighbours.fill_skip_grid(leaf_mi, 2, skip);
56035684 neighbours.fill_lf_grid(leaf_mi, 2, 8, 0);
5685+ neighbours.record_mode_mi(leaf_mi.0, leaf_mi.1, 2, 2, mode);
56045686 Ok(mode)
56055687 }
56065688
crates/ec-av1/src/encode.rsmodified+95 -34
@@ -1020,7 +1020,7 @@ pub(crate) struct Reach {
10201020 /// it. Indexed by the block's position in the superblock, in blocks of its own
10211021 /// size, as `row * (128 / side) + col` (`Reach::table_stride`) -- libaom's
10221022 /// 128, not this crate's 64 superblock -- bit by bit from the low end.
1023-const HAS_TOP_RIGHT: [&[u8]; 3] = [
1023+const HAS_TOP_RIGHT: [&[u8]; 4] = [
10241024 &[255, 85, 119, 85, 127, 85, 119, 85],
10251025 &[95, 87],
10261026 // has_tr_8x8 (libaom av1/common/reconintra.c) -- table_stride(8) == 16
@@ -1029,11 +1029,28 @@ const HAS_TOP_RIGHT: [&[u8]; 3] = [
10291029 255, 255, 85, 85, 119, 119, 85, 85, 127, 127, 85, 85, 119, 119, 85, 85, 255, 127, 85, 85,
10301030 119, 119, 85, 85, 127, 127, 85, 85, 119, 119, 85, 85,
10311031 ],
1032+
1033+ // has_tr_4x4 (libaom av1/common/reconintra.c, transcribed verbatim) --
1034+ // table_stride(4) == 32 (128 / 4), so 32 bits per row, 32 rows, 128
1035+ // bytes. Sub-8x8 leaves (lane-sub8) are the only blocks that reach here
1036+ // with side 4 outside a TX4 split; without their own row they clamped
1037+ // into the 8x8 table and read above-right samples the decoder has not
1038+ // written yet (all-zero pixels in the bottom-right triangle of a
1039+ // directional 4x4 leaf).
1040+ &[
1041+ 255, 255, 255, 255, 85, 85, 85, 85, 119, 119, 119, 119, 85, 85, 85, 85, 127, 127, 127, 127,
1042+ 85, 85, 85, 85, 119, 119, 119, 119, 85, 85, 85, 85, 255, 127, 255, 127, 85, 85, 85, 85,
1043+ 119, 119, 119, 119, 85, 85, 85, 85, 127, 127, 127, 127, 85, 85, 85, 85, 119, 119, 119, 119,
1044+ 85, 85, 85, 85, 255, 255, 255, 127, 85, 85, 85, 85, 119, 119, 119, 119, 85, 85, 85, 85,
1045+ 127, 127, 127, 127, 85, 85, 85, 85, 119, 119, 119, 119, 85, 85, 85, 85, 255, 127, 255, 127,
1046+ 85, 85, 85, 85, 119, 119, 119, 119, 85, 85, 85, 85, 127, 127, 127, 127, 85, 85, 85, 85,
1047+ 119, 119, 119, 119, 85, 85, 85, 85,
1048+ ],
10321049 ];
10331050
10341051 /// `has_bl_16x16` / `has_bl_32x32`: the same, for the block below and to the
10351052 /// left.
1036-const HAS_BOTTOM_LEFT: [&[u8]; 3] = [
1053+const HAS_BOTTOM_LEFT: [&[u8]; 4] = [
10371054 &[84, 16, 84, 0, 84, 16, 84, 0],
10381055 &[4, 4],
10391056 // has_bl_8x8 (libaom av1/common/reconintra.c)
@@ -1041,6 +1058,16 @@ const HAS_BOTTOM_LEFT: [&[u8]; 3] = [
10411058 84, 85, 16, 17, 84, 85, 0, 1, 84, 85, 16, 17, 84, 85, 0, 0, 84, 85, 16, 17, 84, 85, 0, 1,
10421059 84, 85, 16, 17, 84, 85, 0, 0,
10431060 ],
1061+
1062+ // has_bl_4x4 (same source, same order).
1063+ &[
1064+ 84, 85, 85, 85, 16, 17, 17, 17, 84, 85, 85, 85, 0, 1, 1, 1, 84, 85, 85, 85, 16, 17, 17, 17,
1065+ 84, 85, 85, 85, 0, 0, 1, 0, 84, 85, 85, 85, 16, 17, 17, 17, 84, 85, 85, 85, 0, 1, 1, 1, 84,
1066+ 85, 85, 85, 16, 17, 17, 17, 84, 85, 85, 85, 0, 0, 0, 0, 84, 85, 85, 85, 16, 17, 17, 17, 84,
1067+ 85, 85, 85, 0, 1, 1, 1, 84, 85, 85, 85, 16, 17, 17, 17, 84, 85, 85, 85, 0, 0, 1, 0, 84, 85,
1068+ 85, 85, 16, 17, 17, 17, 84, 85, 85, 85, 0, 1, 1, 1, 84, 85, 85, 85, 16, 17, 17, 17, 84, 85,
1069+ 85, 85, 0, 0, 0, 0,
1070+ ],
10441071 ];
10451072
10461073 /// `has_tr_32x16`/`has_tr_16x32` (libaom `reconintra.c`) -- lane-intradisp
@@ -1051,6 +1078,34 @@ const HAS_TOP_RIGHT_RECT: [&[u8]; 2] = [&[15, 5, 7, 5], &[255, 119, 127, 119]];
10511078 /// `has_bl_32x16`/`has_bl_16x32`, same source, same order.
10521079 const HAS_BOTTOM_LEFT_RECT: [&[u8]; 2] = [&[78, 14, 78, 14], &[16, 0, 16, 0]];
10531080
1081+/// libaom `reconintra.c`'s `has_tr_*`/`has_bl_*` for the four rectangular
1082+/// block sizes this decoder codes, transcribed verbatim (lane-rectx r4).
1083+/// The 16x8/8x16 rows are what the 32x16/16x32 pair above cannot stand in
1084+/// for: they are 16 bytes, not 4, and their bit pattern is a different
1085+/// coding order entirely -- reading the 16x32 table for a 16x8 block gave
1086+/// the wrong bottom-left availability and a directional (D203) strip whose
1087+/// prediction diverged exactly where it starts reading below its own height.
1088+/// `has_tr_vert_tables`/`has_bl_vert_tables` hold the SAME pointers as these
1089+/// for every W<H entry, and are NULL for W>H (no VERT_A/B ever produces one),
1090+/// so the partition type does not select a different table at these sizes.
1091+fn has_tr_rect_table(bw: usize, bh: usize) -> &'static [u8] {
1092+ match (bw, bh) {
1093+ (16, 8) => &[255, 0, 85, 0, 119, 0, 85, 0, 127, 0, 85, 0, 119, 0, 85, 0],
1094+ (8, 16) => &[255, 255, 119, 119, 127, 127, 119, 119, 255, 127, 119, 119, 127, 127, 119, 119],
1095+ (32, 16) => &[15, 5, 7, 5],
1096+ _ => &[255, 119, 127, 119],
1097+ }
1098+}
1099+
1100+fn has_bl_rect_table(bw: usize, bh: usize) -> &'static [u8] {
1101+ match (bw, bh) {
1102+ (16, 8) => &[254, 84, 254, 16, 254, 84, 254, 0, 254, 84, 254, 16, 254, 84, 254, 0],
1103+ (8, 16) => &[16, 17, 0, 1, 16, 17, 0, 0, 16, 17, 0, 1, 16, 17, 0, 0],
1104+ (32, 16) => &[78, 14, 78, 14],
1105+ _ => &[16, 0, 16, 0],
1106+ }
1107+}
1108+
10541109 impl Reach {
10551110 /// What a block of `side` samples at `(x, y)` may read past its own edges,
10561111 /// in a frame of `width` by `height`.
@@ -1080,37 +1135,49 @@ impl Reach {
10801135 }
10811136 }
10821137
1083- fn position_rect(bw: usize, bh: usize, x: usize, y: usize) -> (usize, usize, usize, usize) {
1084- (
1085- (y % SUPERBLOCK) / bh,
1086- (x % SUPERBLOCK) / bw,
1087- SUPERBLOCK / bh,
1088- SUPERBLOCK / bw,
1089- )
1090- }
1091-
1138+ /// libaom `has_top_right` at block granularity (`row_off`/`col_off` 0,
1139+ /// the transform covering the whole block, luma): everything before the
1140+ /// table lookup is that function's own early-exit ladder.
10921141 fn top_right_rect(bw: usize, bh: usize, x: usize, y: usize) -> bool {
1093- let (row, col, _per_row, per_col) = Self::position_rect(bw, bh, x, y);
1094- if row == 0 {
1142+ const SB_MI: usize = SUPERBLOCK / 4;
1143+ let (mi_row, mi_col) = (y / 4, x / 4);
1144+ let bw_log2 = (bw / 4).trailing_zeros() as usize;
1145+ let bh_log2 = (bh / 4).trailing_zeros() as usize;
1146+ let blk_row = (mi_row & (SB_MI - 1)) >> bh_log2;
1147+ let blk_col = (mi_col & (SB_MI - 1)) >> bw_log2;
1148+ // Top row of the superblock: the top-right pixels are in the (already
1149+ // decoded) superblock above.
1150+ if blk_row == 0 {
10951151 return true;
10961152 }
1097- if col + 1 == per_col {
1153+ // Rightmost column: they fall in the superblock to the right.
1154+ if ((blk_col + 1) << bw_log2) >= SB_MI {
10981155 return false;
10991156 }
1100- let table = HAS_TOP_RIGHT_RECT[usize::from(bw == 16)];
1101- Self::bit(table, (row * Self::table_stride(bw) + col) % (table.len() * 8))
1157+ let table = has_tr_rect_table(bw, bh);
1158+ Self::bit(table, (blk_row << (4 - bw_log2)) + blk_col)
11021159 }
11031160
1161+ /// libaom `has_bottom_left`, same granularity as [`Self::top_right_rect`].
11041162 fn bottom_left_rect(bw: usize, bh: usize, x: usize, y: usize) -> bool {
1105- let (row, col, per_row, _per_col) = Self::position_rect(bw, bh, x, y);
1106- if col == 0 {
1107- return row * bh + bh < SUPERBLOCK;
1163+ const SB_MI: usize = SUPERBLOCK / 4;
1164+ let (mi_row, mi_col) = (y / 4, x / 4);
1165+ let bw_log2 = (bw / 4).trailing_zeros() as usize;
1166+ let bh_log2 = (bh / 4).trailing_zeros() as usize;
1167+ let blk_row = (mi_row & (SB_MI - 1)) >> bh_log2;
1168+ let blk_col = (mi_col & (SB_MI - 1)) >> bw_log2;
1169+ // Leftmost column of the superblock: the bottom-left pixels are in
1170+ // the left superblock iff they stay inside its height.
1171+ if blk_col == 0 {
1172+ return (blk_row << bh_log2) + (bh / 4) < SB_MI;
11081173 }
1109- if row + 1 == per_row {
1174+ // Bottom row (and not the leftmost column): they fall in the
1175+ // superblock below, which is not decoded yet.
1176+ if ((blk_row + 1) << bh_log2) >= SB_MI {
11101177 return false;
11111178 }
1112- let table = HAS_BOTTOM_LEFT_RECT[usize::from(bw == 16)];
1113- Self::bit(table, (row * Self::table_stride(bw) + col) % (table.len() * 8))
1179+ let table = has_bl_rect_table(bw, bh);
1180+ Self::bit(table, (blk_row << (4 - bw_log2)) + blk_col)
11141181 }
11151182
11161183 /// Neither, which is all a mode that reads no further than its own edges
@@ -1134,17 +1201,9 @@ impl Reach {
11341201 if col + 1 == per_side {
11351202 return false;
11361203 }
1137- // corner-cut: `HAS_TOP_RIGHT`/`HAS_BOTTOM_LEFT` only carry dedicated
1138- // rows for side 8/16/32/64 (libaom's own `has_tr_8x8`/`has_tr_16x16`
1139- // families); a `TxMode::Select` TX4 transform unit reaches here with
1140- // side 4, whose real table (`has_tr_4x4`, 128 bytes) was never
1141- // transcribed. Clamping into the 16/32 table's own bit range keeps
1142- // this in-bounds and correct at every position that table already
1143- // covers periodically -- wrong only at the small remainder past its
1144- // length, a reach over-/under-estimate (extra or missing above-right
1145- // reference pixels), never a stream desync (Reach never gates a
1146- // symbol read). Ceiling: transcribe `has_tr_4x4`/`has_bl_4x4`
1147- // verbatim and give TX4 its own `HAS_TOP_RIGHT`/`HAS_BOTTOM_LEFT` row.
1204+ // lane-sub8 r4: side 4 now has its own `has_tr_4x4`/`has_bl_4x4`
1205+ // row (the corner-cut this comment used to describe); sides 16/32/64
1206+ // share row 0 exactly as libaom's tables repeat.
11481207 let table = HAS_TOP_RIGHT[Self::table(side)];
11491208 Self::bit(
11501209 table,
@@ -1164,7 +1223,7 @@ impl Reach {
11641223 if row + 1 == per_side {
11651224 return false;
11661225 }
1167- // corner-cut: see `top_right`'s note -- same clamp, same ceiling.
1226+ // See `top_right`'s note.
11681227 let table = HAS_BOTTOM_LEFT[Self::table(side)];
11691228 Self::bit(
11701229 table,
@@ -1200,6 +1259,8 @@ impl Reach {
12001259 1
12011260 } else if side == 8 {
12021261 2
1262+ } else if side == 4 {
1263+ 3
12031264 } else {
12041265 0
12051266 }
crates/ec-av1/src/stream.rsmodified+7 -2
@@ -5370,7 +5370,7 @@ mod tests {
53705370 "-f",
53715371 "lavfi",
53725372 "-i",
5373- &format!("mandelbrot=size={width}x{height}:start_x=0.4"),
5373+ &format!("mandelbrot=size={width}x{height}:start_x=-0.6"),
53745374 "-pix_fmt",
53755375 "yuv420p",
53765376 "-t",
@@ -5393,7 +5393,7 @@ mod tests {
53935393 "--codec=av1",
53945394 "--passes=1",
53955395 "--end-usage=q",
5396- "--cq-level=24",
5396+ "--cq-level=16",
53975397 "--cpu-used=4",
53985398 "--threads=1",
53995399 "--row-mt=0",
@@ -5403,6 +5403,11 @@ mod tests {
54035403 "--enable-ab-partitions=0",
54045404 "--enable-1to4-partitions=0",
54055405 "--enable-tx-size-search=0",
5406+ // Filter intra on a strip is a separate, still-refused
5407+ // predictor (`filter intra on a HORZ/VERT strip`); this
5408+ // gate is about the rect RESIDUAL path, so it is off here
5409+ // and covered by the square filter-intra gate instead.
5410+ "--enable-filter-intra=0",
54065411 "--reduced-tx-type-set=1",
54075412 "--min-partition-size=8",
54085413 "--max-partition-size=32",