forge
Explore
Log in

Don't you dare go Hollow

Inter tile writer codes a true-edge-straddling 32x32 quadrant

Browse files at this commit

cdfc846432de954731531f4b42f659e89b9a6831Ahmet Kaan GümüşParent: 5a60e3d
  • fix
    • inter tile writer codes a true-edge-straddling 32x32 quadrant
Show full message
fix(av1): inter tile writer codes a true-edge-straddling 32x32 quadrant

sb_coeff_inter_frame_tile refused every straddling 32x32 quadrant
outright, with a message claiming an 8x8 split it never actually
needs for the common edge-at-or-past-halfway case (e.g. 1280x720,
where 720 mod 32 == 16). Ported the key-frame writer's Quadrant::Split
handling: such a quadrant now splits into up to four 16x16 leaves,
coded through the inter frame's intra branch (no Luma16Inter tx_type
table exists for a genuine inter leaf at that size, and these leaves
only fill the true edge's sliver of real content). The genuine
"strictly before half of a 16x16" class -- which does need a
rectangular transform -- still refuses, with an accurate message.

sb_coeff_inter_frame_tile's `blocks` parameter is now `&[Quadrant]`
(reusing the key-frame writer's own type) instead of `&[BlockCoeffs]`;
encode_inter_frame's search does the matching split, reusing
code_square for the 16x16 leaves.
crates/ec-av1/src/encode.rsmodified+185 -35
@@ -1936,7 +1936,7 @@ pub(crate) fn encode_inter_frame(
19361936 let (sb_cols, sb_rows) = (cols.div_ceil(2), rows.div_ceil(2));
19371937 let (mi_cols, mi_rows) = (header.mi_cols as usize, header.mi_rows as usize);
19381938 let mut grid = MiGrid::new(mi_cols, mi_rows);
1939- let mut blocks = vec![BlockCoeffs::default(); cols * rows];
1939+ let mut blocks = vec![Quadrant::Whole(BlockCoeffs::default()); cols * rows];
19401940
19411941 for sb_r in 0..sb_rows {
19421942 for sb_c in 0..sb_cols {
@@ -1947,45 +1947,130 @@ pub(crate) fn encode_inter_frame(
19471947 if r32 >= rows || c32 >= cols {
19481948 continue;
19491949 }
1950- let (x, y) = (c32 * BLOCK, r32 * BLOCK);
1951- let (mi_row, mi_col) = (r32 * 8, c32 * 8);
1952- let stack =
1953- find_mv_stack(&grid, mi_row, mi_col, 8, 8, LAST_FRAME, mi_cols, mi_rows);
1954-
1955- let block = search_inter_block(
1956- &mut luma,
1957- &mut chroma,
1958- (x, y),
1959- &search,
1960- &mode_bits_table,
1961- reference,
1962- &stack,
1950+ // spec `decode_partition`'s hasRows/hasCols recomputed at this
1951+ // 32x32 block's own half (`crate::tile::has_half`), same as
1952+ // the key frame search: the true frame edge can fall inside a
1953+ // quadrant a superblock-level check already let through, and
1954+ // such a quadrant cannot be left whole -- it must split into
1955+ // the 16x16 leaves that are actually inside the true frame
1956+ // (`crate::tile::sb_coeff_inter_frame_tile`'s `Quadrant::Split`
1957+ // arm).
1958+ let (has_cols32, has_rows32) = (
1959+ crate::tile::has_half(
1960+ c32 as u32 * crate::tile::BLOCK_MI,
1961+ crate::tile::BLOCK_MI,
1962+ header.mi_cols,
1963+ ),
1964+ crate::tile::has_half(
1965+ r32 as u32 * crate::tile::BLOCK_MI,
1966+ crate::tile::BLOCK_MI,
1967+ header.mi_rows,
1968+ ),
19631969 );
1970+ if has_cols32 && has_rows32 {
1971+ let (x, y) = (c32 * BLOCK, r32 * BLOCK);
1972+ let (mi_row, mi_col) = (r32 * 8, c32 * 8);
1973+ let stack =
1974+ find_mv_stack(&grid, mi_row, mi_col, 8, 8, LAST_FRAME, mi_cols, mi_rows);
19641975
1965- if let Some(info) = block.inter {
1966- for dr in 0..8 {
1967- for dc in 0..8 {
1968- grid.set(
1969- mi_row + dr,
1970- mi_col + dc,
1971- MiInfo {
1972- is_inter: true,
1973- ref_frame: LAST_FRAME,
1974- mv: info.mv,
1975- is_new_mv: matches!(info.mode, InterMode::NewMv),
1976- },
1977- );
1976+ let block = search_inter_block(
1977+ &mut luma,
1978+ &mut chroma,
1979+ (x, y),
1980+ &search,
1981+ &mode_bits_table,
1982+ reference,
1983+ &stack,
1984+ );
1985+
1986+ if let Some(info) = block.inter {
1987+ for dr in 0..8 {
1988+ for dc in 0..8 {
1989+ grid.set(
1990+ mi_row + dr,
1991+ mi_col + dc,
1992+ MiInfo {
1993+ is_inter: true,
1994+ ref_frame: LAST_FRAME,
1995+ mv: info.mv,
1996+ is_new_mv: matches!(info.mode, InterMode::NewMv),
1997+ },
1998+ );
1999+ }
19782000 }
19792001 }
2002+ blocks[r32 * cols + c32] = Quadrant::Whole(block);
2003+ } else {
2004+ // The sub-positions actually inside the true frame, same
2005+ // filter as `sb_coeff_inter_frame_tile`'s `sub_positions`.
2006+ let sub_positions: Vec<(usize, usize)> = (0..4)
2007+ .map(|i| (r32 * 2 + i / 2, c32 * 2 + i % 2))
2008+ .filter(|&(sr, sc)| {
2009+ (sr as u32) * crate::tile::SUB_MI < header.mi_rows
2010+ && (sc as u32) * crate::tile::SUB_MI < header.mi_cols
2011+ })
2012+ .collect();
2013+ // A 16x16 leaf the true edge itself cuts through needs a
2014+ // rectangular (HORZ/VERT) transform this writer does not
2015+ // code, same refusal as the key frame search's
2016+ // `split_legal` check.
2017+ if let Some(&(sr, sc)) = sub_positions.iter().find(|&&(sr, sc)| {
2018+ !crate::tile::has_half(
2019+ sc as u32 * crate::tile::SUB_MI,
2020+ crate::tile::SUB_MI,
2021+ header.mi_cols,
2022+ ) || !crate::tile::has_half(
2023+ sr as u32 * crate::tile::SUB_MI,
2024+ crate::tile::SUB_MI,
2025+ header.mi_rows,
2026+ )
2027+ }) {
2028+ return Err(Error::unsupported(
2029+ "AV1 encode",
2030+ format!(
2031+ "the 16x16 block at ({sc},{sr}) straddles the true frame \
2032+ edge in a way that needs a rectangular (HORZ/VERT) \
2033+ transform this encoder does not code yet"
2034+ ),
2035+ ));
2036+ }
2037+ // Coded through the inter frame's intra branch only (see
2038+ // `crate::tile::sb_coeff_inter_frame_tile`'s doc comment on
2039+ // its `Quadrant::Split` arm): no `Luma16Inter` tx_type
2040+ // table exists yet for a genuine inter leaf at this size,
2041+ // and these leaves only ever fill the sliver of real
2042+ // content a true edge lands in the middle of a 32x32
2043+ // block, not a leaf a motion search chose on its own.
2044+ let mut leaves = Vec::with_capacity(sub_positions.len());
2045+ for (sr, sc) in sub_positions {
2046+ let (x, y) = (sc * SUB, sr * SUB);
2047+ let (block, _cost) = code_square(
2048+ &mut luma,
2049+ &mut chroma,
2050+ (x, y),
2051+ SUB,
2052+ &search,
2053+ &mode_bits_table,
2054+ );
2055+ leaves.push(block);
2056+ }
2057+ blocks[r32 * cols + c32] = Quadrant::Split(leaves);
19802058 }
1981- blocks[r32 * cols + c32] = block;
19822059 }
19832060 }
19842061 }
19852062
1986- let modes = blocks.iter().map(|b| b.mode).collect::<Vec<_>>();
1987- let inter_block_share =
1988- blocks.iter().filter(|b| b.inter.is_some()).count() as f64 / blocks.len() as f64;
2063+ let modes = blocks
2064+ .iter()
2065+ .flat_map(Quadrant::blocks)
2066+ .map(|b| b.mode)
2067+ .collect::<Vec<_>>();
2068+ let inter_block_share = blocks
2069+ .iter()
2070+ .flat_map(Quadrant::blocks)
2071+ .filter(|b| b.inter.is_some())
2072+ .count() as f64
2073+ / modes.len() as f64;
19892074 let tile = sb_coeff_inter_frame_tile(header.mi_cols, header.mi_rows, base_q_idx, &blocks)?;
19902075 let mut stream = temporal_delimiter();
19912076 stream.extend_from_slice(&frame_obu(&seq, &header, &tile)?);
@@ -2268,10 +2353,10 @@ mod tests {
22682353 ..BlockCoeffs::default()
22692354 };
22702355 let blocks = vec![
2271- residual_block,
2272- skipped_block.clone(),
2273- skipped_block.clone(),
2274- skipped_block,
2356+ Quadrant::Whole(residual_block),
2357+ Quadrant::Whole(skipped_block.clone()),
2358+ Quadrant::Whole(skipped_block.clone()),
2359+ Quadrant::Whole(skipped_block),
22752360 ];
22762361 let tile =
22772362 sb_coeff_inter_frame_tile(inter_header.mi_cols, inter_header.mi_rows, 100, &blocks)
@@ -2547,6 +2632,71 @@ mod tests {
25472632 }
25482633 }
25492634
2635+ /// 1280x720 -- the export size a real edith timeline hits -- is exactly
2636+ /// the "half straddle" class: 720 mod 32 == 16, so the true frame edge
2637+ /// falls at exactly half of the last row of 32x32 blocks (`has_half`'s
2638+ /// `pos + side_mi / 2 < bound` boundary), which is the case
2639+ /// `sb_coeff_inter_frame_tile`'s `Quadrant::Split` now codes rather than
2640+ /// refusing. A key frame alone already covered this size; this proves the
2641+ /// inter tile writer's parity with it across a real multi-frame export.
2642+ #[test]
2643+ fn a_sequence_round_trips_at_the_exactly_half_straddle_size() {
2644+ if !have_ffmpeg() {
2645+ eprintln!("SKIP a_sequence_round_trips_at_the_exactly_half_straddle_size: no ffmpeg");
2646+ return;
2647+ }
2648+ let (width, height) = (1280usize, 720usize);
2649+ let pictures: Vec<Picture> = (0..3)
2650+ .map(|i| panned_test_card(width, height, i * 3))
2651+ .collect();
2652+ let encoded = encode_sequence(&pictures, 100, 0.5).unwrap();
2653+ assert_eq!(encoded.frames.len(), 3);
2654+ for (i, frame) in encoded.frames.iter().enumerate() {
2655+ assert_eq!(
2656+ (frame.reconstruction.width, frame.reconstruction.height),
2657+ (width, height),
2658+ "frame {i}: reconstruction size"
2659+ );
2660+ }
2661+ assert_eq!(
2662+ ffprobe_size(&encoded.stream),
2663+ (width as u32, height as u32),
2664+ "ffprobe reports the true (display) 1280x720 size"
2665+ );
2666+ let decoded = ffmpeg_decode_sequence(&encoded.stream, width, height, 3);
2667+ assert_eq!(decoded.len(), 3, "decoded frame count");
2668+ for (i, (frame, decoded)) in encoded.frames.iter().zip(&decoded).enumerate() {
2669+ assert_eq!(decoded.y, frame.reconstruction.y, "frame {i}: luma");
2670+ assert_eq!(decoded.u, frame.reconstruction.u, "frame {i}: U");
2671+ assert_eq!(decoded.v, frame.reconstruction.v, "frame {i}: V");
2672+ }
2673+ }
2674+
2675+ /// 640x360 is the class the charter asks be kept consistent between the
2676+ /// key frame and inter frame writers: 360 mod 32 == 8, so a 16x16 leaf's
2677+ /// own half (`has_half` at the SUB level) itself straddles the true edge
2678+ /// -- the genuine "needs an 8x8/rectangular transform" case neither
2679+ /// writer codes. Both must refuse it the same way.
2680+ #[test]
2681+ fn both_writers_refuse_the_same_strictly_before_half_straddle_size() {
2682+ let (width, height) = (640usize, 360usize);
2683+ let picture = Picture::grey(width, height);
2684+ let key_err = encode_key_frame(&picture, 100, 0.5).unwrap_err();
2685+ assert!(
2686+ key_err.to_string().contains("rectangular"),
2687+ "key frame refusal: {key_err}"
2688+ );
2689+
2690+ // `encode_sequence`'s second frame is the inter path: same size,
2691+ // same class of refusal expected.
2692+ let pictures = vec![picture.clone(), picture];
2693+ let inter_err = encode_sequence(&pictures, 100, 0.5).unwrap_err();
2694+ assert!(
2695+ inter_err.to_string().contains("rectangular"),
2696+ "inter frame refusal: {inter_err}"
2697+ );
2698+ }
2699+
25502700 /// One frame of a real clip, scaled to a whole number of 32x32 blocks.
25512701 fn clip_frame(clip: &str, skip: &str, width: usize, height: usize) -> Picture {
25522702 let out = Command::new("ffmpeg")
crates/ec-av1/src/tile.rsmodified+188 -23
@@ -581,7 +581,7 @@ pub enum Quadrant {
581581
582582 impl Quadrant {
583583 /// The blocks it carries, in the order they are coded.
584- fn blocks(&self) -> &[BlockCoeffs] {
584+ pub(crate) fn blocks(&self) -> &[BlockCoeffs] {
585585 match self {
586586 Quadrant::Whole(block) => std::slice::from_ref(block),
587587 Quadrant::Split(blocks) => blocks.as_slice(),
@@ -1857,7 +1857,7 @@ pub fn sb_coeff_inter_frame_tile(
18571857 mi_cols: u32,
18581858 mi_rows: u32,
18591859 base_q_idx: u8,
1860- blocks: &[BlockCoeffs],
1860+ blocks: &[Quadrant],
18611861 ) -> Result<Vec<u8>> {
18621862 check_blocks(mi_cols, mi_rows)?;
18631863 // `block_grid`'s ceiling, not a plain division: a true frame size that is
@@ -1871,8 +1871,9 @@ pub fn sb_coeff_inter_frame_tile(
18711871 "an inter frame needs one entry per 32x32 block inside the true frame",
18721872 ));
18731873 }
1874- if let Some(bad) = blocks
1875- .iter()
1874+ let coded: Vec<&BlockCoeffs> = blocks.iter().flat_map(Quadrant::blocks).collect();
1875+ if let Some(bad) = coded
1876+ .into_iter()
18761877 .find(|b| b.inter.is_none() && usize::from(b.mode) >= INTRA_MODES)
18771878 {
18781879 return Err(Error::unsupported(
@@ -1885,7 +1886,7 @@ pub fn sb_coeff_inter_frame_tile(
18851886 }
18861887
18871888 /// `Y_MODE`'s size group (spec `Size_Group`) for a 32x32 block, the only
1888- /// size this writer's intra branch codes.
1889+ /// size this writer's inter branch codes.
18891890 const SIZE_GROUP_32: usize = 3;
18901891 /// `Ref_Frame_List`'s `LAST_FRAME` (spec 3): the only reference this
18911892 /// writer's single-reference chain ever names.
@@ -1909,6 +1910,7 @@ pub fn sb_coeff_inter_frame_tile(
19091910 let inter_planes = [TxbSet::Luma32Inter, TxbSet::Chroma16, TxbSet::Chroma16];
19101911 let scan32 = default_scan(TX32);
19111912 let scan16 = default_scan(TX16);
1913+ let scan8 = default_scan(TX8);
19121914 let zero_grids = [
19131915 vec![0i32; TX32 * TX32],
19141916 vec![0i32; TX16 * TX16],
@@ -1951,28 +1953,102 @@ pub fn sb_coeff_inter_frame_tile(
19511953 if r32 >= rows || c32 >= cols {
19521954 continue;
19531955 }
1954- let block = &blocks[(r32 * cols + c32) as usize];
1956+ let site = &blocks[(r32 * cols + c32) as usize];
19551957 let at = (r32 as usize * 2, c32 as usize * 2);
1956- let (r, c) = at;
19571958 let ctx32 = neighbours.partition_ctx(at, BLOCK);
1958- // This writer has no rectangular (HORZ/VERT) or further-split
1959- // representation for a 32x32 block, so one that itself
1960- // straddles the true edge is refused rather than miscoded --
1961- // mirroring `sb_coeff_key_frame_tile`'s "cannot be left whole"
1962- // refusal, just with no split arm to fall back to here.
1959+ // spec `decode_partition`'s hasRows/hasCols recomputed at this
1960+ // quadrant's own half: a whole 32x32 block cannot be left
1961+ // whole once its own half straddles the true edge, mirroring
1962+ // `sb_coeff_key_frame_tile`'s "cannot be left whole" refusal.
19631963 let (has_cols32, has_rows32) = (
19641964 has_half(c32 * BLOCK_MI, BLOCK_MI, mi_cols),
19651965 has_half(r32 * BLOCK_MI, BLOCK_MI, mi_rows),
19661966 );
1967- if !has_cols32 || !has_rows32 {
1968- return Err(Error::unsupported(
1969- "AV1 tile",
1970- "a 32x32 inter-frame block that straddles the true frame edge \
1971- needs an 8x8 split this writer does not code",
1972- ));
1973- }
1974- enc.symbol(PARTITION_NONE, &mut cdfs.partition_w32[ctx32]);
1967+ let block = match site {
1968+ Quadrant::Whole(block) => {
1969+ if !has_cols32 || !has_rows32 {
1970+ return Err(Error::unsupported(
1971+ "AV1 tile",
1972+ "a 32x32 block that is half outside the true frame \
1973+ cannot be left whole",
1974+ ));
1975+ }
1976+ enc.symbol(PARTITION_NONE, &mut cdfs.partition_w32[ctx32]);
1977+ block
1978+ }
1979+ Quadrant::Split(sub_blocks) => {
1980+ // Same filter as `sb_coeff_key_frame_tile`'s
1981+ // `sub_positions`: only the 16x16 leaves whose own mi
1982+ // origin is inside the true frame are coded.
1983+ let sub_positions: Vec<(usize, usize)> = (0..4)
1984+ .map(|i| (r32 as usize * 2 + i / 2, c32 as usize * 2 + i % 2))
1985+ .filter(|&(sr, sc)| {
1986+ (sr as u32) * SUB_MI < mi_rows && (sc as u32) * SUB_MI < mi_cols
1987+ })
1988+ .collect();
1989+ if sub_blocks.len() != sub_positions.len() {
1990+ return Err(Error::unsupported(
1991+ "AV1 tile",
1992+ "a split 32x32 inter-frame block needs one 16x16 entry \
1993+ per sub-block inside the true frame",
1994+ ));
1995+ }
1996+ // Same three-way spec signaling as the superblock
1997+ // level above, recomputed at this quadrant's own half.
1998+ match (has_cols32, has_rows32) {
1999+ (true, true) => {
2000+ enc.symbol(PARTITION_SPLIT, &mut cdfs.partition_w32[ctx32]);
2001+ }
2002+ (true, false) => {
2003+ enc.symbol_fixed(
2004+ 1,
2005+ &gather(&cdfs.partition_w32[ctx32], VERT_ALIKE),
2006+ );
2007+ }
2008+ (false, true) => {
2009+ enc.symbol_fixed(
2010+ 1,
2011+ &gather(&cdfs.partition_w32[ctx32], HORZ_ALIKE),
2012+ );
2013+ }
2014+ (false, false) => {}
2015+ }
2016+ for (leaf, (sr, sc)) in sub_blocks.iter().zip(sub_positions) {
2017+ // A 16x16 leaf the true frame edge itself cuts
2018+ // through needs a rectangular transform this
2019+ // writer does not code yet -- same refusal as
2020+ // `sb_coeff_key_frame_tile`'s SUB level, just
2021+ // named for an inter-frame leaf.
2022+ let (has_cols16, has_rows16) = (
2023+ has_half(sc as u32 * SUB_MI, SUB_MI, mi_cols),
2024+ has_half(sr as u32 * SUB_MI, SUB_MI, mi_rows),
2025+ );
2026+ if !has_cols16 || !has_rows16 {
2027+ return Err(Error::unsupported(
2028+ "AV1 tile",
2029+ "a 16x16 inter-frame block the true frame edge cuts \
2030+ through needs a rectangular transform this writer \
2031+ does not code yet",
2032+ ));
2033+ }
2034+ let at16 = (sr, sc);
2035+ let ctx16 = neighbours.partition_ctx(at16, SUB);
2036+ enc.symbol(PARTITION_NONE, &mut cdfs.partition_w16[ctx16]);
2037+ write_inter_frame_intra_leaf(
2038+ &mut enc,
2039+ &mut cdfs,
2040+ &mut neighbours,
2041+ leaf,
2042+ at16,
2043+ &scan16,
2044+ &scan8,
2045+ )?;
2046+ }
2047+ continue;
2048+ }
2049+ };
19752050
2051+ let (r, c) = at;
19762052 let has_above = r32 > 0;
19772053 let has_left = c32 > 0;
19782054 let skip_ctx =
@@ -2098,6 +2174,85 @@ pub fn sb_coeff_inter_frame_tile(
20982174 Ok(enc.finish())
20992175 }
21002176
2177+/// Writes one 16x16 leaf a straddling 32x32 quadrant's [`Quadrant::Split`]
2178+/// splits into, always through the inter frame's intra branch (spec
2179+/// `inter_frame_mode_info`'s intra branch, `is_inter` coded `false`): no
2180+/// `Luma16Inter` tx_type table exists yet for a genuine inter leaf at this
2181+/// size (see [`TxbSet::Luma32Inter`]'s doc comment), and these leaves only
2182+/// ever fill the sliver of real content a true edge lands in the middle of a
2183+/// 32x32 block, never a leaf a motion search chose on its own. Its own
2184+/// `PARTITION_NONE` symbol is already written, same contract as
2185+/// [`write_block`].
2186+fn write_inter_frame_intra_leaf(
2187+ enc: &mut SymbolEncoder,
2188+ cdfs: &mut Cdfs,
2189+ neighbours: &mut Neighbours,
2190+ block: &BlockCoeffs,
2191+ at: (usize, usize),
2192+ scan16: &Vec<u16>,
2193+ scan8: &Vec<u16>,
2194+) -> Result<()> {
2195+ if usize::from(block.mode) >= INTRA_MODES {
2196+ return Err(Error::unsupported(
2197+ "AV1 tile",
2198+ format!(
2199+ "intra mode {} is not one of the thirteen this writer codes",
2200+ block.mode
2201+ ),
2202+ ));
2203+ }
2204+ /// `Y_MODE`'s size group (spec `Size_Group`, `common_data.h`'s
2205+ /// `size_group_lookup[BLOCK_16X16]`) for this leaf's own size.
2206+ const SIZE_GROUP_16: usize = 2;
2207+
2208+ let (r, c) = at;
2209+ let skip_ctx = usize::from(neighbours.above_skip[c]) + usize::from(neighbours.left_skip[r]);
2210+ enc.symbol(usize::from(block.skip), &mut cdfs.skip[skip_ctx]);
2211+
2212+ let (has_above, has_left) = (r > 0, c > 0);
2213+ let ii_ctx = intra_inter_ctx(
2214+ has_above,
2215+ has_left,
2216+ neighbours.above_inter[c],
2217+ neighbours.left_inter[r],
2218+ );
2219+ enc.symbol(0, &mut cdfs.intra_inter[ii_ctx]); // is_inter = false
2220+
2221+ let mode = usize::from(block.mode);
2222+ enc.symbol(mode, &mut cdfs.y_mode[SIZE_GROUP_16]);
2223+ if (V_PRED..=D67_PRED).contains(&mode) {
2224+ enc.symbol(ANGLE_DELTA_ZERO, &mut cdfs.angle_delta[mode - V_PRED]);
2225+ }
2226+ enc.symbol(DC_PRED, &mut cdfs.uv_mode_cfl[mode]);
2227+
2228+ if block.skip {
2229+ let zero_grids = [
2230+ vec![0i32; TX16 * TX16],
2231+ vec![0i32; TX8 * TX8],
2232+ vec![0i32; TX8 * TX8],
2233+ ];
2234+ neighbours.record(at, SUB, mode, &zero_grids);
2235+ } else {
2236+ let grids = [
2237+ level_grid(&block.luma, TX16)?,
2238+ level_grid(&block.u, TX8)?,
2239+ level_grid(&block.v, TX8)?,
2240+ ];
2241+ write_block_planes(
2242+ enc,
2243+ cdfs,
2244+ &[TxbSet::Luma16, TxbSet::Chroma8, TxbSet::Chroma8],
2245+ &grids,
2246+ &[scan16, scan8, scan8],
2247+ &neighbours.around(at, SUB),
2248+ mode,
2249+ );
2250+ neighbours.record(at, SUB, mode, &grids);
2251+ }
2252+ neighbours.record_inter(at, SUB, block.skip, false);
2253+ Ok(())
2254+}
2255+
21012256 #[cfg(test)]
21022257 mod tests {
21032258 use super::*;
@@ -4354,7 +4509,12 @@ mod tests {
43544509 skip: true,
43554510 ..BlockCoeffs::default()
43564511 };
4357- let blocks = vec![block.clone(), block.clone(), block.clone(), block];
4512+ let blocks = vec![
4513+ Quadrant::Whole(block.clone()),
4514+ Quadrant::Whole(block.clone()),
4515+ Quadrant::Whole(block.clone()),
4516+ Quadrant::Whole(block),
4517+ ];
43584518 let data = sb_coeff_inter_frame_tile(16, 16, 90, &blocks).unwrap();
43594519 // Hand count: one partition_w64, then per block partition_w32 + skip +
43604520 // is_inter + 3 single_ref + new_mv + zero_mv + ref_mv = 9, times four.
@@ -4398,7 +4558,12 @@ mod tests {
43984558 skip: true,
43994559 ..BlockCoeffs::default()
44004560 };
4401- let blocks = vec![nearest.clone(), nearest.clone(), nearest, newmv];
4561+ let blocks = vec![
4562+ Quadrant::Whole(nearest.clone()),
4563+ Quadrant::Whole(nearest.clone()),
4564+ Quadrant::Whole(nearest),
4565+ Quadrant::Whole(newmv),
4566+ ];
44024567 let data = sb_coeff_inter_frame_tile(16, 16, 90, &blocks).unwrap();
44034568
44044569 let (count, results) = decode_inter_sb(&data, 16, 16, false);
@@ -4457,7 +4622,7 @@ mod tests {
44574622 skip: true,
44584623 ..BlockCoeffs::default()
44594624 };
4460- let blocks = vec![block; 4];
4625+ let blocks = vec![Quadrant::Whole(block); 4];
44614626 let data = sb_coeff_inter_frame_tile(16, 16, 90, &blocks).unwrap();
44624627
44634628 assert_eq!(