Motion_mode/obmc CDFs gain BLOCK_16X32/32X16 rows
Browse files at this commitab0445ec6691e8c5890cbb82b771aff836637c6bParent: 519a167- fix
- motion_mode/obmc CDFs gain BLOCK_16X32/32X16 rows
- rect strips index their own bsize row
3 changed files +24 -6
- crates/ec-av1/src/cdf.rs +10 -2
- crates/ec-av1/src/cdf_state.rs +2 -2
- crates/ec-av1/src/decode.rs +12 -2
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 | |||
| 1211 | /// `motion_mode_allowed` (spec 5.11.24's `read_motion_mode`) offers | 1211 | /// `motion_mode_allowed` (spec 5.11.24's `read_motion_mode`) offers |
| 1212 | /// `OBMC_CAUSAL` rather than `WARPED_CAUSAL` -- lane-motionmode round 1 | 1212 | /// `OBMC_CAUSAL` rather than `WARPED_CAUSAL` -- lane-motionmode round 1 |
| 1213 | /// never reaches the three-way `motion_mode_cdf`, see `decode.rs`. | 1213 | /// 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] = [ |
| 1215 | [10437, 32768, 0], | 1215 | [10437, 32768, 0], |
| 1216 | [17432, 32768, 0], | 1216 | [17432, 32768, 0], |
| 1217 | [25817, 32768, 0], | 1217 | [25817, 32768, 0], |
| 1218 | [30128, 32768, 0], | 1218 | [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], | ||
| 1219 | ]; | 1224 | ]; |
| 1220 | 1225 | ||
| 1221 | /// `default_motion_mode_cdf` (spec 9.4, `entropymode.c`), the square-bsize | 1226 | /// `default_motion_mode_cdf` (spec 9.4, `entropymode.c`), the square-bsize |
| @@ -1225,11 +1230,14 @@ pub const OBMC: [[u16; 3]; 4] = [ | |||
| 1225 | /// `read_motion_mode` reads instead of [`OBMC`] whenever `motion_mode_allowed` | 1230 | /// `read_motion_mode` reads instead of [`OBMC`] whenever `motion_mode_allowed` |
| 1226 | /// (spec 5.11.24) resolves to `WARPED_CAUSAL`-eligible (`num_proj_ref >= 1` | 1231 | /// (spec 5.11.24) resolves to `WARPED_CAUSAL`-eligible (`num_proj_ref >= 1` |
| 1227 | /// under `allow_warped_motion`) -- lane-warp round 1. | 1232 | /// under `allow_warped_motion`) -- lane-warp round 1. |
| 1228 | -pub const MOTION_MODE: [[u16; 4]; 4] = [ | 1233 | +pub const MOTION_MODE: [[u16; 4]; 6] = [ |
| 1229 | [7651, 24760, 32768, 0], | 1234 | [7651, 24760, 32768, 0], |
| 1230 | [19419, 26810, 32768, 0], | 1235 | [19419, 26810, 32768, 0], |
| 1231 | [26260, 29116, 32768, 0], | 1236 | [26260, 29116, 32768, 0], |
| 1232 | [29516, 30701, 32768, 0], | 1237 | [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], | ||
| 1233 | ]; | 1241 | ]; |
| 1234 | 1242 | ||
| 1235 | /// `default_interintra_cdf` (spec 9.4): `interintra`, indexed by | 1243 | /// `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 { | |||
| 326 | /// `BLOCK_8X8`, 1 = `BLOCK_16X16`, 2 = `BLOCK_32X32`, 3 = `BLOCK_64X64` | 326 | /// `BLOCK_8X8`, 1 = `BLOCK_16X16`, 2 = `BLOCK_32X32`, 3 = `BLOCK_64X64` |
| 327 | /// (`default_obmc_cdf`'s own `BLOCK_SIZES_ALL` indices 3/6/9/12 -- | 327 | /// (`default_obmc_cdf`'s own `BLOCK_SIZES_ALL` indices 3/6/9/12 -- |
| 328 | /// this decoder only ever codes those four square sizes). | 328 | /// this decoder only ever codes those four square sizes). |
| 329 | - pub obmc: [[u16; 3]; 4], | 329 | + pub obmc: [[u16; 3]; 6], |
| 330 | /// `motion_mode` (spec 5.11.24's `read_motion_mode`), the 3-symbol | 330 | /// `motion_mode` (spec 5.11.24's `read_motion_mode`), the 3-symbol |
| 331 | /// `SIMPLE_TRANSLATION`/`OBMC_CAUSAL`/`WARPED_CAUSAL` alphabet read | 331 | /// `SIMPLE_TRANSLATION`/`OBMC_CAUSAL`/`WARPED_CAUSAL` alphabet read |
| 332 | /// instead of [`Self::obmc`] whenever `motion_mode_allowed` resolves to | 332 | /// instead of [`Self::obmc`] whenever `motion_mode_allowed` resolves to |
| 333 | /// `WARPED_CAUSAL`-eligible -- same square-bsize indexing as `obmc`. | 333 | /// `WARPED_CAUSAL`-eligible -- same square-bsize indexing as `obmc`. |
| 334 | /// lane-warp round 1. | 334 | /// lane-warp round 1. |
| 335 | - pub motion_mode: [[u16; 4]; 4], | 335 | + pub motion_mode: [[u16; 4]; 6], |
| 336 | /// `interintra`, indexed by `size_group_lookup[bsize]` -- see | 336 | /// `interintra`, indexed by `size_group_lookup[bsize]` -- see |
| 337 | /// `cdf::INTERINTRA`'s own doc. | 337 | /// `cdf::INTERINTRA`'s own doc. |
| 338 | pub interintra: [[u16; 3]; 4], | 338 | pub interintra: [[u16; 3]; 4], |
crates/ec-av1/src/decode.rsmodified+12 -2
| @@ -6080,8 +6080,18 @@ fn decode_inter_block( | |||
| 6080 | // wmtype check here. | 6080 | // wmtype check here. |
| 6081 | let mut warped_selected = false; | 6081 | let mut warped_selected = false; |
| 6082 | if motion_mode_eligible { | 6082 | if motion_mode_eligible { |
| 6083 | - // `default_obmc_cdf`'s own index: square bsize 8/16/32/64 -> 0/1/2/3. | 6083 | + // `default_obmc_cdf`'s own index: square bsize 8/16/32/64 -> |
| 6084 | - let bsize_idx = (side.trailing_zeros() - 3) as usize; | 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 | + }; | ||
| 6085 | // `motion_mode_allowed` reads the 3-symbol `motion_mode_cdf` | 6095 | // `motion_mode_allowed` reads the 3-symbol `motion_mode_cdf` |
| 6086 | // instead of the 2-symbol `obmc_cdf` exactly when | 6096 | // instead of the 2-symbol `obmc_cdf` exactly when |
| 6087 | // `num_proj_ref >= 1` under `allow_warped_motion`. | 6097 | // `num_proj_ref >= 1` under `allow_warped_motion`. |