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/rd.c b/av1/encoder/rd.c
index 1c9ed43..bb2ba61 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -50,14 +50,15 @@
// certain modes are assumed to be based on 8x8 blocks.
// This table is used to correct for block size.
// The factors here are << 2 (2 = x0.5, 32 = x8 etc).
-static const uint8_t rd_thresh_block_size_factor[BLOCK_SIZES] = {
+static const uint8_t rd_thresh_block_size_factor[BLOCK_SIZES_ALL] = {
#if CONFIG_CHROMA_2X2 || CONFIG_CHROMA_SUB8X8
2, 2, 2,
#endif
- 2, 3, 3, 4, 6, 6, 8, 12, 12, 16, 24, 24, 32,
+ 2, 3, 3, 4, 6, 6, 8, 12, 12, 16, 24, 24, 32,
#if CONFIG_EXT_PARTITION
- 48, 48, 64
+ 48, 48, 64,
#endif // CONFIG_EXT_PARTITION
+ 4, 4, 8, 8
};
static void fill_mode_costs(AV1_COMP *cpi) {
@@ -302,7 +303,7 @@
0, MAXQ);
const int q = compute_rd_thresh_factor(qindex, cm->bit_depth);
- for (bsize = 0; bsize < BLOCK_SIZES; ++bsize) {
+ for (bsize = 0; bsize < BLOCK_SIZES_ALL; ++bsize) {
// Threshold here seems unnecessarily harsh but fine given actual
// range of values used for cpi->sf.thresh_mult[].
const int t = q * rd_thresh_block_size_factor[bsize];
@@ -458,12 +459,12 @@
#endif // CONFIG_INTERINTRA
#endif // CONFIG_EXT_INTER
#if CONFIG_MOTION_VAR || CONFIG_WARPED_MOTION
- for (i = BLOCK_8X8; i < BLOCK_SIZES; i++) {
+ for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; i++) {
av1_cost_tokens((int *)cpi->motion_mode_cost[i],
cm->fc->motion_mode_prob[i], av1_motion_mode_tree);
}
#if CONFIG_MOTION_VAR && CONFIG_WARPED_MOTION
- for (i = BLOCK_8X8; i < BLOCK_SIZES; i++) {
+ for (i = BLOCK_8X8; i < BLOCK_SIZES_ALL; i++) {
cpi->motion_mode_cost1[i][0] = av1_cost_bit(cm->fc->obmc_prob[i], 0);
cpi->motion_mode_cost1[i][1] = av1_cost_bit(cm->fc->obmc_prob[i], 1);
}