forge
Explore
Log in

Don't you dare go Hollow

Motion_mode/obmc CDFs gain BLOCK_16X32/32X16 rows

Browse files at this commit

ab0445ec6691e8c5890cbb82b771aff836637c6bAhmet Kaan GümüşParent: 519a167
  • fix
    • motion_mode/obmc CDFs gain BLOCK_16X32/32X16 rows
    • rect strips index their own bsize row
Show full message
fix(av1): motion_mode/obmc CDFs gain BLOCK_16X32/32X16 rows; rect strips index their own bsize row

rect-flake-1 strip 1's motion_mode read diverged on the square-class row;
with the true rows the whole HORZ block is entropy-exact (range ladder
exact everywhere) -- residual pixel diff is prediction-side (warp).
crates/ec-av1/src/cdf.rsmodified+10 -2
@@ -1211,11 +1211,16 @@ pub const SKIP_MODE: [[u16; 3]; 3] = [[32621, 32768, 0], [20708, 32768, 0], [812
12111211 /// `motion_mode_allowed` (spec 5.11.24's `read_motion_mode`) offers
12121212 /// `OBMC_CAUSAL` rather than `WARPED_CAUSAL` -- lane-motionmode round 1
12131213 /// never reaches the three-way `motion_mode_cdf`, see `decode.rs`.
1214-pub const OBMC: [[u16; 3]; 4] = [
1214+pub const OBMC: [[u16; 3]; 6] = [
12151215 [10437, 32768, 0],
12161216 [17432, 32768, 0],
12171217 [25817, 32768, 0],
12181218 [30128, 32768, 0],
1219+ // lane-rect r2: BLOCK_16X32 (index 7) and BLOCK_32X16 (index 8) rows --
1220+ // rect strips read their own bsize row, not the square class
1221+ // (rect-flake-1: the strip's motion_mode read diverged on this).
1222+ [14423, 32768, 0],
1223+ [15142, 32768, 0],
12191224 ];
12201225
12211226 /// `default_motion_mode_cdf` (spec 9.4, `entropymode.c`), the square-bsize
@@ -1225,11 +1230,14 @@ pub const OBMC: [[u16; 3]; 4] = [
12251230 /// `read_motion_mode` reads instead of [`OBMC`] whenever `motion_mode_allowed`
12261231 /// (spec 5.11.24) resolves to `WARPED_CAUSAL`-eligible (`num_proj_ref >= 1`
12271232 /// under `allow_warped_motion`) -- lane-warp round 1.
1228-pub const MOTION_MODE: [[u16; 4]; 4] = [
1233+pub const MOTION_MODE: [[u16; 4]; 6] = [
12291234 [7651, 24760, 32768, 0],
12301235 [19419, 26810, 32768, 0],
12311236 [26260, 29116, 32768, 0],
12321237 [29516, 30701, 32768, 0],
1238+ // lane-rect r2: BLOCK_16X32 / BLOCK_32X16 rows (indices 7/8).
1239+ [5123, 23606, 32768, 0],
1240+ [11606, 24308, 32768, 0],
12331241 ];
12341242
12351243 /// `default_interintra_cdf` (spec 9.4): `interintra`, indexed by
crates/ec-av1/src/cdf_state.rsmodified+2 -2
@@ -326,13 +326,13 @@ pub(crate) struct Cdfs {
326326 /// `BLOCK_8X8`, 1 = `BLOCK_16X16`, 2 = `BLOCK_32X32`, 3 = `BLOCK_64X64`
327327 /// (`default_obmc_cdf`'s own `BLOCK_SIZES_ALL` indices 3/6/9/12 --
328328 /// this decoder only ever codes those four square sizes).
329- pub obmc: [[u16; 3]; 4],
329+ pub obmc: [[u16; 3]; 6],
330330 /// `motion_mode` (spec 5.11.24's `read_motion_mode`), the 3-symbol
331331 /// `SIMPLE_TRANSLATION`/`OBMC_CAUSAL`/`WARPED_CAUSAL` alphabet read
332332 /// instead of [`Self::obmc`] whenever `motion_mode_allowed` resolves to
333333 /// `WARPED_CAUSAL`-eligible -- same square-bsize indexing as `obmc`.
334334 /// lane-warp round 1.
335- pub motion_mode: [[u16; 4]; 4],
335+ pub motion_mode: [[u16; 4]; 6],
336336 /// `interintra`, indexed by `size_group_lookup[bsize]` -- see
337337 /// `cdf::INTERINTRA`'s own doc.
338338 pub interintra: [[u16; 3]; 4],
crates/ec-av1/src/decode.rsmodified+12 -2
@@ -6080,8 +6080,18 @@ fn decode_inter_block(
60806080 // wmtype check here.
60816081 let mut warped_selected = false;
60826082 if motion_mode_eligible {
6083- // `default_obmc_cdf`'s own index: square bsize 8/16/32/64 -> 0/1/2/3.
6084- let bsize_idx = (side.trailing_zeros() - 3) as usize;
6083+ // `default_obmc_cdf`'s own index: square bsize 8/16/32/64 ->
6084+ // 0/1/2/3; lane-rect r2: a rect strip reads its OWN bsize row
6085+ // (libaom `motion_mode_cdf[mbmi->bsize]`: BLOCK_16X32 -> 4,
6086+ // BLOCK_32X16 -> 5 in our packed table) -- rect-flake-1's
6087+ // strip motion_mode read diverged on the square row.
6088+ let bsize_idx = if write_w == write_h {
6089+ (write_w.trailing_zeros() - 3) as usize
6090+ } else if write_w == 16 {
6091+ 4
6092+ } else {
6093+ 5
6094+ };
60856095 // `motion_mode_allowed` reads the 3-symbol `motion_mode_cdf`
60866096 // instead of the 2-symbol `obmc_cdf` exactly when
60876097 // `num_proj_ref >= 1` under `allow_warped_motion`.