Separate num_8x8 table use case from mode_info table
Separate the use cases of number of 8x8 blocks from those of
mode_info array. This allows the mode_info array processing to be
scaled to 4x4 resolution.
Change-Id: Iab78f2540355ce7658d9ea21e902a86f71148d8f
diff --git a/av1/encoder/aq_complexity.c b/av1/encoder/aq_complexity.c
index 5c4a5e3..cb15ff8 100644
--- a/av1/encoder/aq_complexity.c
+++ b/av1/encoder/aq_complexity.c
@@ -116,8 +116,8 @@
const AV1_COMMON *const cm = &cpi->common;
const int mi_offset = mi_row * cm->mi_cols + mi_col;
- const int xmis = AOMMIN(cm->mi_cols - mi_col, num_8x8_blocks_wide_lookup[bs]);
- const int ymis = AOMMIN(cm->mi_rows - mi_row, num_8x8_blocks_high_lookup[bs]);
+ const int xmis = AOMMIN(cm->mi_cols - mi_col, mi_size_wide[bs]);
+ const int ymis = AOMMIN(cm->mi_rows - mi_row, mi_size_high[bs]);
int x, y;
int i;
unsigned char segment;
diff --git a/av1/encoder/aq_cyclicrefresh.c b/av1/encoder/aq_cyclicrefresh.c
index bcf11a7..e41c608 100644
--- a/av1/encoder/aq_cyclicrefresh.c
+++ b/av1/encoder/aq_cyclicrefresh.c
@@ -215,8 +215,8 @@
int64_t rate, int64_t dist, int skip) {
const AV1_COMMON *const cm = &cpi->common;
CYCLIC_REFRESH *const cr = cpi->cyclic_refresh;
- const int bw = num_8x8_blocks_wide_lookup[bsize];
- const int bh = num_8x8_blocks_high_lookup[bsize];
+ const int bw = mi_size_wide[bsize];
+ const int bh = mi_size_high[bsize];
const int xmis = AOMMIN(cm->mi_cols - mi_col, bw);
const int ymis = AOMMIN(cm->mi_rows - mi_row, bh);
const int block_index = mi_row * cm->mi_cols + mi_col;
diff --git a/av1/encoder/aq_variance.c b/av1/encoder/aq_variance.c
index 01528ec..2048940 100644
--- a/av1/encoder/aq_variance.c
+++ b/av1/encoder/aq_variance.c
@@ -151,8 +151,8 @@
(xd->mb_to_bottom_edge < 0) ? ((-xd->mb_to_bottom_edge) >> 3) : 0;
if (right_overflow || bottom_overflow) {
- const int bw = 8 * num_8x8_blocks_wide_lookup[bs] - right_overflow;
- const int bh = 8 * num_8x8_blocks_high_lookup[bs] - bottom_overflow;
+ const int bw = 8 * mi_size_wide[bs] - right_overflow;
+ const int bh = 8 * mi_size_high[bs] - bottom_overflow;
int avg;
#if CONFIG_AOM_HIGHBITDEPTH
if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) {
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index e64414d..92afa69 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1811,8 +1811,8 @@
assert(m->mbmi.sb_type <= cm->sb_size);
- bh = num_8x8_blocks_high_lookup[m->mbmi.sb_type];
- bw = num_8x8_blocks_wide_lookup[m->mbmi.sb_type];
+ bh = mi_size_high[m->mbmi.sb_type];
+ bw = mi_size_wide[m->mbmi.sb_type];
cpi->td.mb.mbmi_ext = cpi->mbmi_ext_base + (mi_row * cm->mi_cols + mi_col);
@@ -2189,7 +2189,7 @@
int mi_row, int mi_col, BLOCK_SIZE bsize) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->td.mb.e_mbd;
- const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2;
+ const int hbs = mi_size_wide[bsize] / 2;
const PARTITION_TYPE partition = get_partition(cm, mi_row, mi_col, bsize);
const BLOCK_SIZE subsize = get_subsize(bsize, partition);
#if CONFIG_SUPERTX
@@ -4013,7 +4013,7 @@
aom_wb_write_literal(wb, cm->frame_context_idx, FRAME_CONTEXTS_LOG2);
- assert(cm->mib_size == num_8x8_blocks_wide_lookup[cm->sb_size]);
+ assert(cm->mib_size == mi_size_wide[cm->sb_size]);
assert(cm->mib_size == 1 << cm->mib_size_log2);
#if CONFIG_EXT_PARTITION
assert(cm->sb_size == BLOCK_128X128 || cm->sb_size == BLOCK_64X64);
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index 7e39cc5..a274f72 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -264,8 +264,8 @@
int mi_col, BLOCK_SIZE bsize) {
const AV1_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
- const int mi_width = num_8x8_blocks_wide_lookup[bsize];
- const int mi_height = num_8x8_blocks_high_lookup[bsize];
+ const int mi_width = mi_size_wide[bsize];
+ const int mi_height = mi_size_high[bsize];
const int bwl = b_width_log2_lookup[AOMMAX(bsize, BLOCK_8X8)];
const int bhl = b_height_log2_lookup[AOMMAX(bsize, BLOCK_8X8)];
@@ -438,8 +438,8 @@
int mi_col, const int64_t *const threshold,
const BLOCK_SIZE *const bsize_min) {
AV1_COMMON *const cm = &cpi->common;
- const int hbw = num_8x8_blocks_wide_lookup[vt->bsize] / 2;
- const int hbh = num_8x8_blocks_high_lookup[vt->bsize] / 2;
+ const int hbw = mi_size_wide[vt->bsize] / 2;
+ const int hbh = mi_size_high[vt->bsize] / 2;
const int has_cols = mi_col + hbw < cm->mi_cols;
const int has_rows = mi_row + hbh < cm->mi_rows;
@@ -827,8 +827,8 @@
const uint8_t *ref;
int src_stride;
int ref_stride;
- int pixels_wide = 8 * num_8x8_blocks_wide_lookup[cm->sb_size];
- int pixels_high = 8 * num_8x8_blocks_high_lookup[cm->sb_size];
+ int pixels_wide = MI_SIZE * mi_size_wide[cm->sb_size];
+ int pixels_high = MI_SIZE * mi_size_high[cm->sb_size];
int64_t thresholds[5] = {
cpi->vbp_thresholds[0], cpi->vbp_thresholds[1], cpi->vbp_thresholds[2],
cpi->vbp_thresholds[3], cpi->vbp_thresholds[4],
@@ -1028,16 +1028,16 @@
MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi;
MODE_INFO *mi_addr = xd->mi[0];
const struct segmentation *const seg = &cm->seg;
- const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type];
- const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type];
+ const int bw = mi_size_wide[mi->mbmi.sb_type];
+ const int bh = mi_size_high[mi->mbmi.sb_type];
const int x_mis = AOMMIN(bw, cm->mi_cols - mi_col);
const int y_mis = AOMMIN(bh, cm->mi_rows - mi_row);
MV_REF *const frame_mvs = cm->cur_frame->mvs + mi_row * cm->mi_cols + mi_col;
int w, h;
const int mis = cm->mi_stride;
- const int mi_width = num_8x8_blocks_wide_lookup[bsize];
- const int mi_height = num_8x8_blocks_high_lookup[bsize];
+ const int mi_width = mi_size_wide[bsize];
+ const int mi_height = mi_size_high[bsize];
#if CONFIG_REF_MV
int8_t rf_type;
@@ -2131,10 +2131,12 @@
BLOCK_SIZE bsize) {
MACROBLOCKD *xd = &x->e_mbd;
int p;
- const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
- const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
- int mi_width = num_8x8_blocks_wide_lookup[bsize];
- int mi_height = num_8x8_blocks_high_lookup[bsize];
+ const int num_4x4_blocks_wide =
+ block_size_wide[bsize] >> tx_size_wide_log2[0];
+ const int num_4x4_blocks_high =
+ block_size_high[bsize] >> tx_size_high_log2[0];
+ int mi_width = mi_size_wide[bsize];
+ int mi_height = mi_size_high[bsize];
for (p = 0; p < MAX_MB_PLANE; p++) {
memcpy(xd->above_context[p] + ((mi_col * 2) >> xd->plane[p].subsampling_x),
ctx->a + num_4x4_blocks_wide * p,
@@ -2171,10 +2173,12 @@
BLOCK_SIZE bsize) {
const MACROBLOCKD *xd = &x->e_mbd;
int p;
- const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
- const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize];
- int mi_width = num_8x8_blocks_wide_lookup[bsize];
- int mi_height = num_8x8_blocks_high_lookup[bsize];
+ const int num_4x4_blocks_wide =
+ block_size_wide[bsize] >> tx_size_wide_log2[0];
+ const int num_4x4_blocks_high =
+ block_size_high[bsize] >> tx_size_high_log2[0];
+ int mi_width = mi_size_wide[bsize];
+ int mi_height = mi_size_high[bsize];
// buffer the above/left context information of the block in search.
for (p = 0; p < MAX_MB_PLANE; ++p) {
@@ -2238,7 +2242,7 @@
MACROBLOCKD *const xd = &x->e_mbd;
const int ctx = partition_plane_context(xd, mi_row, mi_col, bsize);
- const int hbs = num_8x8_blocks_wide_lookup[bsize] / 2;
+ const int hbs = mi_size_wide[bsize] / 2;
const PARTITION_TYPE partition = pc_tree->partitioning;
const BLOCK_SIZE subsize = get_subsize(bsize, partition);
#if CONFIG_EXT_PARTITION_TYPES
@@ -2450,8 +2454,8 @@
return AOMMIN(bsize, BLOCK_8X8);
} else {
for (; bsize > 0; bsize -= 3) {
- *bh = num_8x8_blocks_high_lookup[bsize];
- *bw = num_8x8_blocks_wide_lookup[bsize];
+ *bh = mi_size_high[bsize];
+ *bw = mi_size_wide[bsize];
if ((*bh <= rows_left) && (*bw <= cols_left)) {
break;
}
@@ -2491,8 +2495,8 @@
const int mi_cols_remaining = tile->mi_col_end - mi_col;
int block_row, block_col;
MODE_INFO *const mi_upper_left = cm->mi + mi_row * cm->mi_stride + mi_col;
- int bh = num_8x8_blocks_high_lookup[bsize];
- int bw = num_8x8_blocks_wide_lookup[bsize];
+ int bh = mi_size_high[bsize];
+ int bw = mi_size_wide[bsize];
assert((mi_rows_remaining > 0) && (mi_cols_remaining > 0));
@@ -2525,7 +2529,7 @@
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
- const int bs = num_8x8_blocks_wide_lookup[bsize];
+ const int bs = mi_size_wide[bsize];
const int hbs = bs / 2;
int i;
const int pl = partition_plane_context(xd, mi_row, mi_col, bsize);
@@ -3077,8 +3081,8 @@
int mi_col, BLOCK_SIZE bsize,
BLOCK_SIZE *const min_bs,
BLOCK_SIZE *const max_bs) {
- const int mi_width = num_8x8_blocks_wide_lookup[bsize];
- const int mi_height = num_8x8_blocks_high_lookup[bsize];
+ const int mi_width = mi_size_wide[bsize];
+ const int mi_height = mi_size_high[bsize];
int idx, idy;
const int idx_str = cm->mi_stride * mi_row + mi_col;
@@ -3424,7 +3428,7 @@
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &td->mb;
MACROBLOCKD *const xd = &x->e_mbd;
- const int mi_step = num_8x8_blocks_wide_lookup[bsize] / 2;
+ const int mi_step = mi_size_wide[bsize] / 2;
RD_SEARCH_MACROBLOCK_CONTEXT x_ctx;
const TOKENEXTRA *const tp_orig = *tp;
PICK_MODE_CONTEXT *ctx_none = &pc_tree->none;
@@ -3506,8 +3510,7 @@
#endif // NDEBUG
#endif // CONFIG_VAR_TX
- assert(num_8x8_blocks_wide_lookup[bsize] ==
- num_8x8_blocks_high_lookup[bsize]);
+ assert(mi_size_wide[bsize] == mi_size_high[bsize]);
av1_rd_cost_init(&this_rdc);
av1_rd_cost_init(&sum_rdc);
@@ -5440,8 +5443,8 @@
const int seg_skip =
segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP);
const int mis = cm->mi_stride;
- const int mi_width = num_8x8_blocks_wide_lookup[bsize];
- const int mi_height = num_8x8_blocks_high_lookup[bsize];
+ const int mi_width = mi_size_wide[bsize];
+ const int mi_height = mi_size_high[bsize];
const int is_inter = is_inter_block(mbmi);
x->use_lp32x32fdct = cpi->sf.use_lp32x32fdct;
diff --git a/av1/encoder/firstpass.c b/av1/encoder/firstpass.c
index f066b46..968677d 100644
--- a/av1/encoder/firstpass.c
+++ b/av1/encoder/firstpass.c
@@ -617,9 +617,8 @@
xd->left_available = (mb_col != 0);
xd->mi[0]->mbmi.sb_type = bsize;
xd->mi[0]->mbmi.ref_frame[0] = INTRA_FRAME;
- set_mi_row_col(xd, &tile, mb_row << 1, num_8x8_blocks_high_lookup[bsize],
- mb_col << 1, num_8x8_blocks_wide_lookup[bsize],
- cm->mi_rows, cm->mi_cols);
+ set_mi_row_col(xd, &tile, mb_row << 1, mi_size_high[bsize], mb_col << 1,
+ mi_size_wide[bsize], cm->mi_rows, cm->mi_cols);
set_plane_n4(xd, num_8x8_blocks_wide_lookup[bsize],
num_8x8_blocks_high_lookup[bsize],
mi_width_log2_lookup[bsize], mi_height_log2_lookup[bsize]);
diff --git a/av1/encoder/segmentation.c b/av1/encoder/segmentation.c
index 828b31c..b291b29 100644
--- a/av1/encoder/segmentation.c
+++ b/av1/encoder/segmentation.c
@@ -160,7 +160,7 @@
unsigned *t_unpred_seg_counts, int mi_row, int mi_col,
BLOCK_SIZE bsize) {
const int mis = cm->mi_stride;
- const int bs = num_8x8_blocks_wide_lookup[bsize], hbs = bs / 2;
+ const int bs = mi_size_wide[bsize], hbs = bs / 2;
#if CONFIG_EXT_PARTITION_TYPES
PARTITION_TYPE partition;
#else
@@ -252,8 +252,8 @@
default: assert(0);
}
#else
- bw = num_8x8_blocks_wide_lookup[mi[0]->mbmi.sb_type];
- bh = num_8x8_blocks_high_lookup[mi[0]->mbmi.sb_type];
+ bw = mi_size_wide[mi[0]->mbmi.sb_type];
+ bh = mi_size_high[mi[0]->mbmi.sb_type];
if (bw == bs && bh == bs) {
count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count,