ext-partition-types: Add 4:1 partitions
This patch adds support for 4:1 rectangular blocks to various common
data arrays, and adds new partition types to the EXT_PARTITION_TYPES
experiment which will use them.
This patch has the following restrictions, which can be lifted in
future patches:
* ext-partition-types is incompatible with fp_mb_stats and supertx
for the moment
* Currently only 32x32 superblocks can use the new partition types
There's a slightly odd restriction about when we allow
PARTITION_HORZ_4 or PARTITION_VERT_4. Since these both live in the
EXT_PARTITION_TYPES CDF, read_partition() can only return them if both
has_rows and has_cols is true. This means that at least half of the
width and height of the block must be visible. It might be nice to
relax that restriction but that would imply a change to how we encode
partition types, which seems already to be in a state of flux, so
maybe it's better to wait until that has settled down.
Change-Id: Id7fc3fd0f762f35f63b3d3e3bf4e07c245c7b4fa
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 05dca20..021abb4 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -2442,7 +2442,8 @@
xd->mi = cm->mi_grid_visible + (mi_row * cm->mi_stride + mi_col);
m = xd->mi[0];
- assert(m->mbmi.sb_type <= cm->sb_size);
+ assert(m->mbmi.sb_type <= cm->sb_size ||
+ (m->mbmi.sb_type >= BLOCK_4X16 && m->mbmi.sb_type <= BLOCK_32X8));
bh = mi_size_high[m->mbmi.sb_type];
bw = mi_size_wide[m->mbmi.sb_type];
@@ -2510,7 +2511,8 @@
#endif
xd->mi = cm->mi_grid_visible + mi_offset;
- assert(mbmi->sb_type <= cm->sb_size);
+ assert(mbmi->sb_type <= cm->sb_size ||
+ (mbmi->sb_type >= BLOCK_4X16 && mbmi->sb_type <= BLOCK_32X8));
bh = mi_size_high[mbmi->sb_type];
bw = mi_size_wide[mbmi->sb_type];
@@ -2896,6 +2898,10 @@
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
const int hbs = mi_size_wide[bsize] / 2;
+#if CONFIG_EXT_PARTITION_TYPES
+ const int quarter_step = mi_size_wide[bsize] / 4;
+ int i;
+#endif
const PARTITION_TYPE partition = get_partition(cm, mi_row, mi_col, bsize);
const BLOCK_SIZE subsize = get_subsize(bsize, partition);
#if CONFIG_CB4X4
@@ -3001,6 +3007,24 @@
write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
mi_row + hbs, mi_col + hbs);
break;
+ case PARTITION_HORZ_4:
+ for (i = 0; i < 4; ++i) {
+ int this_mi_row = mi_row + i * quarter_step;
+ if (i > 0 && this_mi_row >= cm->mi_rows) break;
+
+ write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
+ this_mi_row, mi_col);
+ }
+ break;
+ case PARTITION_VERT_4:
+ for (i = 0; i < 4; ++i) {
+ int this_mi_col = mi_col + i * quarter_step;
+ if (i > 0 && this_mi_col >= cm->mi_cols) break;
+
+ write_modes_b_wrapper(cpi, tile, w, tok, tok_end, supertx_enabled,
+ mi_row, this_mi_col);
+ }
+ break;
#endif // CONFIG_EXT_PARTITION_TYPES
default: assert(0);
}
@@ -4611,7 +4635,12 @@
}
#endif
#if CONFIG_WEDGE && !CONFIG_NEW_MULTISYMBOL
- for (i = 0; i < BLOCK_SIZES; i++) {
+#if CONFIG_EXT_PARTITION_TYPES
+ int block_sizes_to_update = BLOCK_SIZES_ALL;
+#else
+ int block_sizes_to_update = BLOCK_SIZES;
+#endif
+ for (i = 0; i < block_sizes_to_update; i++) {
if (is_interintra_allowed_bsize(i) && is_interintra_wedge_used(i))
av1_cond_prob_diff_update(header_bc, &fc->wedge_interintra_prob[i],
cm->counts.wedge_interintra[i], probwt);