Commit 5d149e1d authored by Debargha Mukherjee's avatar Debargha Mukherjee
Browse files

Remove sub-4x4 block sizes

Removes unused BLOCK_2X2, BLOCK_2X4 and BLOCK_4X2 from the
BLOCK_SIZE enum.

Change-Id: I964d99718026c51a1eaf30d4a1fc83cc52f94083
parent f54656db
......@@ -131,9 +131,6 @@ static const uint64_t above_64x64_txform_mask[TX_SIZES] = {
// 00000000
// 00000000
static const uint64_t left_prediction_mask[BLOCK_SIZES_ALL] = {
0x0000000000000001ULL, // BLOCK_2X2,
0x0000000000000001ULL, // BLOCK_2X4,
0x0000000000000001ULL, // BLOCK_4X2,
0x0000000000000001ULL, // BLOCK_4X4,
0x0000000000000001ULL, // BLOCK_4X8,
0x0000000000000001ULL, // BLOCK_8X4,
......@@ -157,9 +154,6 @@ static const uint64_t left_prediction_mask[BLOCK_SIZES_ALL] = {
// 64 bit mask to shift and set for each prediction size.
static const uint64_t above_prediction_mask[BLOCK_SIZES_ALL] = {
0x0000000000000001ULL, // BLOCK_2X2
0x0000000000000001ULL, // BLOCK_2X4
0x0000000000000001ULL, // BLOCK_4X2
0x0000000000000001ULL, // BLOCK_4X4
0x0000000000000001ULL, // BLOCK_4X8
0x0000000000000001ULL, // BLOCK_8X4
......@@ -184,9 +178,6 @@ static const uint64_t above_prediction_mask[BLOCK_SIZES_ALL] = {
// each 8x8 block that would be in the top left most block of the given block
// size in the 64x64 block.
static const uint64_t size_mask[BLOCK_SIZES_ALL] = {
0x0000000000000001ULL, // BLOCK_2X2
0x0000000000000001ULL, // BLOCK_2X4
0x0000000000000001ULL, // BLOCK_4X2
0x0000000000000001ULL, // BLOCK_4X4
0x0000000000000001ULL, // BLOCK_4X8
0x0000000000000001ULL, // BLOCK_8X4
......@@ -235,9 +226,6 @@ static const uint16_t above_64x64_txform_mask_uv[TX_SIZES] = {
// 16 bit left mask to shift and set for each uv prediction size.
static const uint16_t left_prediction_mask_uv[BLOCK_SIZES_ALL] = {
0x0001, // BLOCK_2X2,
0x0001, // BLOCK_2X4,
0x0001, // BLOCK_4X2,
0x0001, // BLOCK_4X4,
0x0001, // BLOCK_4X8,
0x0001, // BLOCK_8X4,
......@@ -261,9 +249,6 @@ static const uint16_t left_prediction_mask_uv[BLOCK_SIZES_ALL] = {
// 16 bit above mask to shift and set for uv each prediction size.
static const uint16_t above_prediction_mask_uv[BLOCK_SIZES_ALL] = {
0x0001, // BLOCK_2X2
0x0001, // BLOCK_2X4
0x0001, // BLOCK_4X2
0x0001, // BLOCK_4X4
0x0001, // BLOCK_4X8
0x0001, // BLOCK_8X4
......@@ -287,9 +272,6 @@ static const uint16_t above_prediction_mask_uv[BLOCK_SIZES_ALL] = {
// 64 bit mask to shift and set for each uv prediction size
static const uint16_t size_mask_uv[BLOCK_SIZES_ALL] = {
0x0001, // BLOCK_2X2
0x0001, // BLOCK_2X4
0x0001, // BLOCK_4X2
0x0001, // BLOCK_4X4
0x0001, // BLOCK_4X8
0x0001, // BLOCK_8X4
......@@ -1517,8 +1499,7 @@ static void get_filter_level_and_masks_non420(
(blk_row * mi_size_high[BLOCK_8X8] << TX_UNIT_HIGH_LOG2) >> 1;
const int tx_col_idx =
(blk_col * mi_size_wide[BLOCK_8X8] << TX_UNIT_WIDE_LOG2) >> 1;
const BLOCK_SIZE bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(mbmi->sb_type, plane));
const BLOCK_SIZE bsize = get_plane_block_size(mbmi->sb_type, plane);
const TX_SIZE mb_tx_size = mbmi->inter_tx_size[tx_row_idx][tx_col_idx];
tx_size = (plane->plane_type == PLANE_TYPE_UV)
? uv_txsize_lookup[bsize][mb_tx_size][0][0]
......@@ -1978,9 +1959,6 @@ typedef enum EDGE_DIR { VERT_EDGE = 0, HORZ_EDGE = 1, NUM_EDGE_DIRS } EDGE_DIR;
static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES_ALL] = {
// mask for vertical edges filtering
{
2 - 1, // BLOCK_2X2
2 - 1, // BLOCK_2X4
4 - 1, // BLOCK_4X2
4 - 1, // BLOCK_4X4
4 - 1, // BLOCK_4X8
8 - 1, // BLOCK_8X4
......@@ -2012,9 +1990,6 @@ static const uint32_t av1_prediction_masks[NUM_EDGE_DIRS][BLOCK_SIZES_ALL] = {
},
// mask for horizontal edges filtering
{
2 - 1, // BLOCK_2X2
4 - 1, // BLOCK_2X4
2 - 1, // BLOCK_4X2
4 - 1, // BLOCK_4X4
8 - 1, // BLOCK_4X8
4 - 1, // BLOCK_8X4
......@@ -2133,8 +2108,7 @@ static TX_SIZE av1_get_transform_size(const MODE_INFO *const mi,
(blk_row * mi_size_high[BLOCK_8X8] << TX_UNIT_HIGH_LOG2) >> 1;
const int tx_col_idx =
(blk_col * mi_size_wide[BLOCK_8X8] << TX_UNIT_WIDE_LOG2) >> 1;
const BLOCK_SIZE bsize =
AOMMAX(BLOCK_4X4, ss_size_lookup[sb_type][scale_horz][scale_vert]);
const BLOCK_SIZE bsize = ss_size_lookup[sb_type][scale_horz][scale_vert];
const TX_SIZE mb_tx_size = mbmi->inter_tx_size[tx_row_idx][tx_col_idx];
assert(mb_tx_size < TX_SIZES_ALL);
......
......@@ -34,8 +34,7 @@ void av1_foreach_transformed_block_in_plane(
// 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8
// transform size varies per plane, look it up in a common way.
const TX_SIZE tx_size = av1_get_tx_size(plane, xd);
const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const uint8_t txw_unit = tx_size_wide_unit[tx_size];
const uint8_t txh_unit = tx_size_high_unit[tx_size];
const int step = txw_unit * txh_unit;
......@@ -137,8 +136,7 @@ void av1_reset_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col,
nplanes = 1 + (MAX_MB_PLANE - 1) * chroma_ref;
for (i = 0; i < nplanes; i++) {
struct macroblockd_plane *const pd = &xd->plane[i];
const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(bsize, pd));
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const int txs_wide = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
const int txs_high = block_size_high[plane_bsize] >> tx_size_high_log2[0];
memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * txs_wide);
......
......@@ -892,9 +892,6 @@ static INLINE int get_ext_tx_types(TX_SIZE tx_size, BLOCK_SIZE bs, int is_inter,
static INLINE int is_rect_tx_allowed_bsize(BLOCK_SIZE bsize) {
static const char LUT[BLOCK_SIZES_ALL] = {
0, // BLOCK_2X2
0, // BLOCK_2X4
0, // BLOCK_4X2
0, // BLOCK_4X4
1, // BLOCK_4X8
1, // BLOCK_8X4
......@@ -1171,8 +1168,7 @@ static INLINE TX_SIZE av1_get_uv_tx_size(const MB_MODE_INFO *mbmi,
const struct macroblockd_plane *pd) {
#if CONFIG_CFL
if (!is_inter_block(mbmi) && mbmi->uv_mode == UV_CFL_PRED) {
const BLOCK_SIZE plane_bsize =
AOMMAX(BLOCK_4X4, get_plane_block_size(mbmi->sb_type, pd));
const BLOCK_SIZE plane_bsize = get_plane_block_size(mbmi->sb_type, pd);
assert(plane_bsize < BLOCK_SIZES_ALL);
return max_txsize_rect_lookup[0][plane_bsize];
}
......
......@@ -483,7 +483,6 @@ void cfl_store_block(MACROBLOCKD *const xd, BLOCK_SIZE bsize, TX_SIZE tx_size) {
struct macroblockd_plane *const pd = &xd->plane[AOM_PLANE_Y];
int row = 0;
int col = 0;
bsize = AOMMAX(BLOCK_4X4, bsize);
assert(is_cfl_allowed(&xd->mi[0]->mbmi));
if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) {
......
......@@ -16,9 +16,8 @@
static INLINE int is_cfl_allowed(const MB_MODE_INFO *mbmi) {
const BLOCK_SIZE bsize = mbmi->sb_type;
assert(bsize >= BLOCK_4X4); // Intra luma partitions can't be < 4X4
assert(bsize < BLOCK_SIZES_ALL);
return (bsize >= BLOCK_4X4) && (bsize <= CFL_MAX_BLOCK_SIZE);
return bsize <= CFL_MAX_BLOCK_SIZE;
}
static INLINE int get_scaled_luma_q0(int alpha_q3, int16_t pred_buf_q3) {
......
......@@ -28,323 +28,167 @@ extern "C" {
// Log 2 conversion lookup tables for block width and height
static const uint8_t b_width_log2_lookup[BLOCK_SIZES_ALL] = {
0,
0,
0,
0,
0,
1,
1,
1,
2,
2,
2,
3,
3,
3,
4,
4,
IF_EXT_PARTITION(4, 5, 5) 0,
2,
1,
3,
2,
4,
IF_EXT_PARTITION(3, 5)
0, 0,
1, 1,
1, 2,
2, 2,
3, 3,
3, 4,
4, IF_EXT_PARTITION(4, 5, 5) 0,
2, 1,
3, 2,
4, IF_EXT_PARTITION(3, 5)
};
static const uint8_t b_height_log2_lookup[BLOCK_SIZES_ALL] = {
0,
0,
0,
0,
1,
0,
1,
2,
1,
2,
3,
2,
3,
4,
3,
4,
IF_EXT_PARTITION(5, 4, 5) 2,
0,
3,
1,
4,
2,
IF_EXT_PARTITION(5, 3)
0, 1,
0, 1,
2, 1,
2, 3,
2, 3,
4, 3,
4, IF_EXT_PARTITION(5, 4, 5) 2,
0, 3,
1, 4,
2, IF_EXT_PARTITION(5, 3)
};
// Log 2 conversion lookup tables for modeinfo width and height
static const uint8_t mi_width_log2_lookup[BLOCK_SIZES_ALL] = {
0,
0,
0,
0,
0,
1,
1,
1,
2,
2,
2,
3,
3,
3,
4,
4,
IF_EXT_PARTITION(4, 5, 5) 0,
2,
1,
3,
2,
4,
IF_EXT_PARTITION(3, 5)
0, 0,
1, 1,
1, 2,
2, 2,
3, 3,
3, 4,
4, IF_EXT_PARTITION(4, 5, 5) 0,
2, 1,
3, 2,
4, IF_EXT_PARTITION(3, 5)
};
static const uint8_t mi_height_log2_lookup[BLOCK_SIZES_ALL] = {
0,
0,
0,
0,
1,
0,
1,
2,
1,
2,
3,
2,
3,
4,
3,
4,
IF_EXT_PARTITION(5, 4, 5) 2,
0,
3,
1,
4,
2,
IF_EXT_PARTITION(5, 3)
0, 1,
0, 1,
2, 1,
2, 3,
2, 3,
4, 3,
4, IF_EXT_PARTITION(5, 4, 5) 2,
0, 3,
1, 4,
2, IF_EXT_PARTITION(5, 3)
};
/* clang-format off */
static const uint8_t mi_size_wide[BLOCK_SIZES_ALL] = {
1, 1, 1, 1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16,
1, 1, 2, 2, 2, 4, 4, 4, 8, 8, 8, 16, 16,
IF_EXT_PARTITION(16, 32, 32) 1, 4, 2, 8, 4, 16, IF_EXT_PARTITION(8, 32)
};
static const uint8_t mi_size_high[BLOCK_SIZES_ALL] = {
1, 1, 1, 1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16,
1, 2, 1, 2, 4, 2, 4, 8, 4, 8, 16, 8, 16,
IF_EXT_PARTITION(32, 16, 32) 4, 1, 8, 2, 16, 4, IF_EXT_PARTITION(32, 8)
};
/* clang-format on */
// Width/height lookup tables in units of various block sizes
static const uint8_t block_size_wide[BLOCK_SIZES_ALL] = {
2,
2,
4,
4,
4,
8,
8,
8,
16,
16,
16,
32,
32,
32,
64,
64,
IF_EXT_PARTITION(64, 128, 128) 4,
16,
8,
32,
16,
64,
IF_EXT_PARTITION(32, 128)
4, 4,
8, 8,
8, 16,
16, 16,
32, 32,
32, 64,
64, IF_EXT_PARTITION(64, 128, 128) 4,
16, 8,
32, 16,
64, IF_EXT_PARTITION(32, 128)
};
static const uint8_t block_size_high[BLOCK_SIZES_ALL] = {
2,
4,
2,
4,
8,
4,
8,
16,
8,
16,
32,
16,
32,
64,
32,
64,
IF_EXT_PARTITION(128, 64, 128) 16,
4,
32,
8,
64,
16,
IF_EXT_PARTITION(128, 32)
4, 8,
4, 8,
16, 8,
16, 32,
16, 32,
64, 32,
64, IF_EXT_PARTITION(128, 64, 128) 16,
4, 32,
8, 64,
16, IF_EXT_PARTITION(128, 32)
};
static const uint8_t num_4x4_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
1,
1,
1,
1,
1,
2,
2,
2,
4,
4,
4,
8,
8,
8,
16,
16,
IF_EXT_PARTITION(16, 32, 32) 1,
4,
2,
8,
4,
16,
IF_EXT_PARTITION(8, 32)
1, 1,
2, 2,
2, 4,
4, 4,
8, 8,
8, 16,
16, IF_EXT_PARTITION(16, 32, 32) 1,
4, 2,
8, 4,
16, IF_EXT_PARTITION(8, 32)
};
static const uint8_t num_4x4_blocks_high_lookup[BLOCK_SIZES_ALL] = {
1,
1,
1,
1,
2,
1,
2,
4,
2,
4,
8,
4,
8,
16,
8,
16,
IF_EXT_PARTITION(32, 16, 32) 4,
1,
8,
2,
16,
4,
IF_EXT_PARTITION(32, 8)
1, 2,
1, 2,
4, 2,
4, 8,
4, 8,
16, 8,
16, IF_EXT_PARTITION(32, 16, 32) 4,
1, 8,
2, 16,
4, IF_EXT_PARTITION(32, 8)
};
static const uint8_t num_8x8_blocks_wide_lookup[BLOCK_SIZES_ALL] = {
1,
1,
1,
1,
1,
1,
1,
1,
2,
2,
2,
4,
4,
4,
8,
8,
IF_EXT_PARTITION(8, 16, 16) 1,
2,
1,
4,
2,
8,
IF_EXT_PARTITION(4, 16)
1, 1,
1, 1,
1, 2,
2, 2,
4, 4,
4, 8,
8, IF_EXT_PARTITION(8, 16, 16) 1,
2, 1,
4, 2,
8, IF_EXT_PARTITION(4, 16)
};
static const uint8_t num_8x8_blocks_high_lookup[BLOCK_SIZES_ALL] = {
1,
1,
1,
1,
1,
1,
1,
2,
1,
2,
4,
2,
4,
8,
4,
8,
IF_EXT_PARTITION(16, 8, 16) 2,
1,
4,
1,
8,
2,
IF_EXT_PARTITION(16, 4)
1, 1,
1, 1,
2, 1,
2, 4,
2, 4,
8, 4,
8, IF_EXT_PARTITION(16, 8, 16) 2,
1, 4,
1, 8,
2, IF_EXT_PARTITION(16, 4)
};
// AOMMIN(3, AOMMIN(b_width_log2(bsize), b_height_log2(bsize)))
static const uint8_t size_group_lookup[BLOCK_SIZES_ALL] = {
0,
0,
0,
0,
0,
0,
1,
1,
1,
2,
2,
2,
3,
3,
3,
3,
IF_EXT_PARTITION(3, 3, 3) 0,
0,
1,
1,
2,
2,
IF_EXT_PARTITION(3, 3)
0, 0,
0, 1,
1, 1,
2, 2,
2, 3,
3, 3,
3, IF_EXT_PARTITION(3, 3, 3) 0,
0, 1,
1, 2,
2, IF_EXT_PARTITION(3, 3)
};
static const uint8_t num_pels_log2_lookup[BLOCK_SIZES_ALL] = {
2,
3,
3,
4,
5,
5,
6,
7,
7,
8,
9,
9,
10,
11,
11,
12,
IF_EXT_PARTITION(13, 13, 14) 6,
6,
8,
8,
10,
10,
IF_EXT_PARTITION(12, 12)
4, 5,
5, 6,
7, 7,
8, 9,
9, 10,
11, 11,
12, IF_EXT_PARTITION(13, 13, 14) 6,
6, 8,
8, 10,
10, IF_EXT_PARTITION(12, 12)
};
/* clang-format off */
......@@ -355,8 +199,6 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] =
#endif // CONFIG_EXT_PARTITION_TYPES
{
{ // PARTITION_NONE
// 2X2, 2X4, 4X2,
BLOCK_2X2, BLOCK_2X4, BLOCK_4X2,
// 4X4
BLOCK_4X4,
// 4X8, 8X4, 8X8
......@@ -380,10 +222,8 @@ static const BLOCK_SIZE subsize_lookup[PARTITION_TYPES][BLOCK_SIZES_ALL] =
BLOCK_32X128, BLOCK_128X32
#endif // CONFIG_EXT_PARTITION
}, { // PARTITION_HORZ
// 2X2, 2X4, 4X2,
BLOCK_INVALID, BLOCK_INVALID, BLOCK_INVALID,
// 4X4
BLOCK_4X2,
BLOCK_INVALID,