Simplify code about block size calculation
Change-Id: I10c89610ed3cfa05e38de07476bfde33f51c042d
diff --git a/av1/common/blockd.c b/av1/common/blockd.c
index d29ed4c..9abd58a 100644
--- a/av1/common/blockd.c
+++ b/av1/common/blockd.c
@@ -71,8 +71,8 @@
struct macroblockd_plane *const pd = &xd->plane[i];
const BLOCK_SIZE plane_bsize =
get_plane_block_size(bsize, pd->subsampling_x, pd->subsampling_y);
- 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];
+ const int txs_wide = mi_size_wide[plane_bsize];
+ const int txs_high = mi_size_high[plane_bsize];
memset(pd->above_context, 0, sizeof(ENTROPY_CONTEXT) * txs_wide);
memset(pd->left_context, 0, sizeof(ENTROPY_CONTEXT) * txs_high);
}
diff --git a/av1/common/blockd.h b/av1/common/blockd.h
index 9b5bad2..85164ae 100644
--- a/av1/common/blockd.h
+++ b/av1/common/blockd.h
@@ -361,9 +361,9 @@
int mi_row, int tx_blk_col, int tx_blk_row,
int subsampling_x, int subsampling_y) {
*pixel_c = ((mi_col >> subsampling_x) << MI_SIZE_LOG2) +
- (tx_blk_col << tx_size_wide_log2[0]);
+ (tx_blk_col << MI_SIZE_LOG2);
*pixel_r = ((mi_row >> subsampling_y) << MI_SIZE_LOG2) +
- (tx_blk_row << tx_size_high_log2[0]);
+ (tx_blk_row << MI_SIZE_LOG2);
}
#endif
@@ -414,8 +414,7 @@
qm_val_t *seg_qmatrix[MAX_SEGMENTS][TX_SIZES_ALL];
} MACROBLOCKD_PLANE;
-#define BLOCK_OFFSET(i) \
- ((i) * (1 << (tx_size_wide_log2[0] + tx_size_high_log2[0])))
+#define BLOCK_OFFSET(i) ((i) << 4)
typedef struct {
DECLARE_ALIGNED(16, InterpKernel, vfilter);
diff --git a/av1/common/cfl.c b/av1/common/cfl.c
index db84ebb..171bfdd 100644
--- a/av1/common/cfl.c
+++ b/av1/common/cfl.c
@@ -327,7 +327,7 @@
int row, int col, TX_SIZE tx_size, int use_hbd) {
const int width = tx_size_wide[tx_size];
const int height = tx_size_high[tx_size];
- const int tx_off_log2 = tx_size_wide_log2[0];
+ const int tx_off_log2 = MI_SIZE_LOG2;
const int sub_x = cfl->subsampling_x;
const int sub_y = cfl->subsampling_y;
const int store_row = row << (tx_off_log2 - sub_y);
@@ -391,8 +391,7 @@
BLOCK_SIZE bsize) {
CFL_CTX *const cfl = &xd->cfl;
struct macroblockd_plane *const pd = &xd->plane[AOM_PLANE_Y];
- uint8_t *dst =
- &pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
+ uint8_t *dst = &pd->dst.buf[(row * pd->dst.stride + col) << MI_SIZE_LOG2];
if (block_size_high[bsize] == 4 || block_size_wide[bsize] == 4) {
// Only dimensions of size 4 can have an odd offset.
diff --git a/av1/common/onyxc_int.h b/av1/common/onyxc_int.h
index 2e68c0f..52b1052 100644
--- a/av1/common/onyxc_int.h
+++ b/av1/common/onyxc_int.h
@@ -1047,32 +1047,34 @@
int plane) {
assert(bsize < BLOCK_SIZES_ALL);
int max_blocks_wide = block_size_wide[bsize];
- const struct macroblockd_plane *const pd = &xd->plane[plane];
- if (xd->mb_to_right_edge < 0)
+ if (xd->mb_to_right_edge < 0) {
+ const struct macroblockd_plane *const pd = &xd->plane[plane];
max_blocks_wide += xd->mb_to_right_edge >> (3 + pd->subsampling_x);
+ }
// Scale the width in the transform block unit.
- return max_blocks_wide >> tx_size_wide_log2[0];
+ return max_blocks_wide >> MI_SIZE_LOG2;
}
static INLINE int max_block_high(const MACROBLOCKD *xd, BLOCK_SIZE bsize,
int plane) {
int max_blocks_high = block_size_high[bsize];
- const struct macroblockd_plane *const pd = &xd->plane[plane];
- if (xd->mb_to_bottom_edge < 0)
+ if (xd->mb_to_bottom_edge < 0) {
+ const struct macroblockd_plane *const pd = &xd->plane[plane];
max_blocks_high += xd->mb_to_bottom_edge >> (3 + pd->subsampling_y);
+ }
// Scale the height in the transform block unit.
- return max_blocks_high >> tx_size_high_log2[0];
+ return max_blocks_high >> MI_SIZE_LOG2;
}
static INLINE int max_intra_block_width(const MACROBLOCKD *xd,
BLOCK_SIZE plane_bsize, int plane,
TX_SIZE tx_size) {
const int max_blocks_wide = max_block_wide(xd, plane_bsize, plane)
- << tx_size_wide_log2[0];
+ << MI_SIZE_LOG2;
return ALIGN_POWER_OF_TWO(max_blocks_wide, tx_size_wide_log2[tx_size]);
}
@@ -1080,7 +1082,7 @@
BLOCK_SIZE plane_bsize, int plane,
TX_SIZE tx_size) {
const int max_blocks_high = max_block_high(xd, plane_bsize, plane)
- << tx_size_high_log2[0];
+ << MI_SIZE_LOG2;
return ALIGN_POWER_OF_TWO(max_blocks_high, tx_size_high_log2[tx_size]);
}
diff --git a/av1/common/reconintra.c b/av1/common/reconintra.c
index 6ee31fe..17dc762 100644
--- a/av1/common/reconintra.c
+++ b/av1/common/reconintra.c
@@ -198,7 +198,7 @@
int col_off, int ss_x, int ss_y) {
if (!top_available || !right_available) return 0;
- const int bw_unit = block_size_wide[bsize] >> tx_size_wide_log2[0];
+ const int bw_unit = mi_size_wide[bsize];
const int plane_bw_unit = AOMMAX(bw_unit >> ss_x, 1);
const int top_right_count_unit = tx_size_wide_unit[txsz];
@@ -405,7 +405,7 @@
// Bottom-left pixels are in the bottom-left block, which is not available.
return 0;
} else {
- const int bh_unit = block_size_high[bsize] >> tx_size_high_log2[0];
+ const int bh_unit = mi_size_high[bsize];
const int plane_bh_unit = AOMMAX(bh_unit >> ss_y, 1);
const int bottom_left_count_unit = tx_size_high_unit[txsz];
@@ -422,10 +422,9 @@
// and/or bottom-left superblocks. But only the left superblock is
// available, so check if all required pixels fall in that superblock.
if (blk_col_in_sb == 0) {
- const int blk_start_row_off = blk_row_in_sb
- << (bh_in_mi_log2 + MI_SIZE_LOG2 -
- tx_size_wide_log2[0]) >>
- ss_y;
+ const int blk_start_row_off =
+ blk_row_in_sb << (bh_in_mi_log2 + MI_SIZE_LOG2 - MI_SIZE_LOG2) >>
+ ss_y;
const int row_off_in_sb = blk_start_row_off + row_off;
const int sb_height_unit = sb_mi_size >> ss_y;
return row_off_in_sb + bottom_left_count_unit < sb_height_unit;
@@ -1565,8 +1564,8 @@
const MB_MODE_INFO *const mbmi = xd->mi[0];
const int txwpx = tx_size_wide[tx_size];
const int txhpx = tx_size_high[tx_size];
- const int x = col_off << tx_size_wide_log2[0];
- const int y = row_off << tx_size_high_log2[0];
+ const int x = col_off << MI_SIZE_LOG2;
+ const int y = row_off << MI_SIZE_LOG2;
if (use_palette) {
int r, c;
@@ -1662,8 +1661,7 @@
const MB_MODE_INFO *const mbmi = xd->mi[0];
struct macroblockd_plane *const pd = &xd->plane[plane];
const int dst_stride = pd->dst.stride;
- uint8_t *dst =
- &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
+ uint8_t *dst = &pd->dst.buf[(blk_row * dst_stride + blk_col) << MI_SIZE_LOG2];
const PREDICTION_MODE mode =
(plane == AOM_PLANE_Y) ? mbmi->mode : get_uv_mode(mbmi->uv_mode);
const int use_palette = mbmi->palette_mode_info.palette_size[plane != 0] > 0;
diff --git a/av1/decoder/decodeframe.c b/av1/decoder/decodeframe.c
index 61d4c13..693a9c8 100644
--- a/av1/decoder/decodeframe.c
+++ b/av1/decoder/decodeframe.c
@@ -228,8 +228,7 @@
// tx_type was read out in av1_read_coeffs_txb.
const TX_TYPE tx_type = av1_get_tx_type(xd, plane_type, row, col, tx_size,
cm->reduced_tx_set_used);
- uint8_t *dst =
- &pd->dst.buf[(row * pd->dst.stride + col) << tx_size_wide_log2[0]];
+ uint8_t *dst = &pd->dst.buf[(row * pd->dst.stride + col) << MI_SIZE_LOG2];
inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
cm->reduced_tx_set_used);
}
@@ -252,8 +251,7 @@
tx_size, cm->reduced_tx_set_used);
uint8_t *dst =
- &pd->dst
- .buf[(blk_row * pd->dst.stride + blk_col) << tx_size_wide_log2[0]];
+ &pd->dst.buf[(blk_row * pd->dst.stride + blk_col) << MI_SIZE_LOG2];
inverse_transform_block(xd, plane, tx_type, tx_size, dst, pd->dst.stride,
cm->reduced_tx_set_used);
#if CONFIG_MISMATCH_DEBUG
@@ -1171,10 +1169,8 @@
const int max_blocks_wide = max_block_wide(xd, bsize, 0);
const int max_blocks_high = max_block_high(xd, bsize, 0);
const BLOCK_SIZE max_unit_bsize = BLOCK_64X64;
- int mu_blocks_wide =
- block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
- int mu_blocks_high =
- block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
+ int mu_blocks_wide = mi_size_wide[max_unit_bsize];
+ int mu_blocks_high = mi_size_high[max_unit_bsize];
mu_blocks_wide = AOMMIN(max_blocks_wide, mu_blocks_wide);
mu_blocks_high = AOMMIN(max_blocks_high, mu_blocks_high);
@@ -1223,10 +1219,8 @@
assert(max_unit_bsize ==
get_plane_block_size(BLOCK_64X64, xd->plane[0].subsampling_x,
xd->plane[0].subsampling_y));
- int mu_blocks_wide =
- block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
- int mu_blocks_high =
- block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
+ int mu_blocks_wide = mi_size_wide[max_unit_bsize];
+ int mu_blocks_high = mi_size_high[max_unit_bsize];
mu_blocks_wide = AOMMIN(max_blocks_wide, mu_blocks_wide);
mu_blocks_high = AOMMIN(max_blocks_high, mu_blocks_high);
@@ -1435,8 +1429,8 @@
const TX_SIZE max_tx_size = max_txsize_rect_lookup[bsize];
const int bh = tx_size_high_unit[max_tx_size];
const int bw = tx_size_wide_unit[max_tx_size];
- const int width = block_size_wide[bsize] >> tx_size_wide_log2[0];
- const int height = block_size_high[bsize] >> tx_size_high_log2[0];
+ const int width = mi_size_wide[bsize];
+ const int height = mi_size_high[bsize];
for (int idy = 0; idy < height; idy += bh)
for (int idx = 0; idx < width; idx += bw)
diff --git a/av1/encoder/av1_fwd_txfm2d.c b/av1/encoder/av1_fwd_txfm2d.c
index 642728a..deae95f 100644
--- a/av1/encoder/av1_fwd_txfm2d.c
+++ b/av1/encoder/av1_fwd_txfm2d.c
@@ -416,8 +416,8 @@
set_flip_cfg(tx_type, cfg);
const TX_TYPE_1D tx_type_1d_col = vtx_tab[tx_type];
const TX_TYPE_1D tx_type_1d_row = htx_tab[tx_type];
- const int txw_idx = tx_size_wide_log2[tx_size] - tx_size_wide_log2[0];
- const int txh_idx = tx_size_high_log2[tx_size] - tx_size_high_log2[0];
+ const int txw_idx = get_txw_idx(tx_size);
+ const int txh_idx = get_txh_idx(tx_size);
cfg->shift = av1_fwd_txfm_shift_ls[tx_size];
cfg->cos_bit_col = av1_fwd_cos_bit_col[txw_idx][txh_idx];
cfg->cos_bit_row = av1_fwd_cos_bit_row[txw_idx][txh_idx];
diff --git a/av1/encoder/bitstream.c b/av1/encoder/bitstream.c
index 03d492e..59e2e7b 100644
--- a/av1/encoder/bitstream.c
+++ b/av1/encoder/bitstream.c
@@ -1401,12 +1401,10 @@
const int bkh = tx_size_high_unit[max_tx_size];
const BLOCK_SIZE max_unit_bsize =
get_plane_block_size(BLOCK_64X64, ss_x, ss_y);
- const int num_4x4_w = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
- const int num_4x4_h = block_size_high[plane_bsize] >> tx_size_high_log2[0];
- const int mu_blocks_wide =
- block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
- const int mu_blocks_high =
- block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
+ const int num_4x4_w = mi_size_wide[plane_bsize];
+ const int num_4x4_h = mi_size_high[plane_bsize];
+ const int mu_blocks_wide = mi_size_wide[max_unit_bsize];
+ const int mu_blocks_high = mi_size_high[max_unit_bsize];
const int unit_height = AOMMIN(mu_blocks_high + (row >> ss_y), num_4x4_h);
const int unit_width = AOMMIN(mu_blocks_wide + (col >> ss_x), num_4x4_w);
for (int blk_row = row >> ss_y; blk_row < unit_height; blk_row += bkh) {
@@ -1438,8 +1436,8 @@
int block[MAX_MB_PLANE] = { 0 };
assert(bsize == get_plane_block_size(bsize, xd->plane[0].subsampling_x,
xd->plane[0].subsampling_y));
- const int num_4x4_w = block_size_wide[bsize] >> tx_size_wide_log2[0];
- const int num_4x4_h = block_size_high[bsize] >> tx_size_high_log2[0];
+ const int num_4x4_w = mi_size_wide[bsize];
+ const int num_4x4_h = mi_size_high[bsize];
TOKEN_STATS token_stats;
init_token_stats(&token_stats);
@@ -1447,11 +1445,8 @@
assert(max_unit_bsize == get_plane_block_size(BLOCK_64X64,
xd->plane[0].subsampling_x,
xd->plane[0].subsampling_y));
- int mu_blocks_wide =
- block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
- int mu_blocks_high =
- block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
-
+ int mu_blocks_wide = mi_size_wide[max_unit_bsize];
+ int mu_blocks_high = mi_size_high[max_unit_bsize];
mu_blocks_wide = AOMMIN(num_4x4_w, mu_blocks_wide);
mu_blocks_high = AOMMIN(num_4x4_h, mu_blocks_high);
@@ -1533,8 +1528,8 @@
const TX_SIZE max_tx_size = get_vartx_max_txsize(xd, bsize, 0);
const int txbh = tx_size_high_unit[max_tx_size];
const int txbw = tx_size_wide_unit[max_tx_size];
- const int width = block_size_wide[bsize] >> tx_size_wide_log2[0];
- const int height = block_size_high[bsize] >> tx_size_high_log2[0];
+ const int width = mi_size_wide[bsize];
+ const int height = mi_size_high[bsize];
for (int idy = 0; idy < height; idy += txbh) {
for (int idx = 0; idx < width; idx += txbw) {
write_tx_size_vartx(xd, mbmi, max_tx_size, 0, idy, idx, w);
diff --git a/av1/encoder/encodeframe.c b/av1/encoder/encodeframe.c
index a1a5c48..4a02ea1 100644
--- a/av1/encoder/encodeframe.c
+++ b/av1/encoder/encodeframe.c
@@ -1473,10 +1473,8 @@
const int num_planes) {
MACROBLOCKD *xd = &x->e_mbd;
int p;
- 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];
+ const int num_4x4_blocks_wide = mi_size_wide[bsize];
+ const int num_4x4_blocks_high = mi_size_high[bsize];
int mi_width = mi_size_wide[bsize];
int mi_height = mi_size_high[bsize];
for (p = 0; p < num_planes; p++) {
@@ -1509,10 +1507,6 @@
const int num_planes) {
const MACROBLOCKD *xd = &x->e_mbd;
int p;
- 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];
@@ -1520,14 +1514,12 @@
for (p = 0; p < num_planes; ++p) {
int tx_col = mi_col;
int tx_row = mi_row & MAX_MIB_MASK;
- memcpy(ctx->a + num_4x4_blocks_wide * p,
+ memcpy(ctx->a + mi_width * p,
xd->above_context[p] + (tx_col >> xd->plane[p].subsampling_x),
- (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_wide) >>
- xd->plane[p].subsampling_x);
- memcpy(ctx->l + num_4x4_blocks_high * p,
+ (sizeof(ENTROPY_CONTEXT) * mi_width) >> xd->plane[p].subsampling_x);
+ memcpy(ctx->l + mi_height * p,
xd->left_context[p] + (tx_row >> xd->plane[p].subsampling_y),
- (sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >>
- xd->plane[p].subsampling_y);
+ (sizeof(ENTROPY_CONTEXT) * mi_height) >> xd->plane[p].subsampling_y);
}
memcpy(ctx->sa, xd->above_seg_context + mi_col,
sizeof(*xd->above_seg_context) * mi_width);
@@ -5597,8 +5589,8 @@
const AV1_COMMON *const cm, MACROBLOCK *x, BLOCK_SIZE plane_bsize,
int mi_row, int mi_col, FRAME_COUNTS *td_counts, uint8_t allow_update_cdf) {
MACROBLOCKD *xd = &x->e_mbd;
- const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
- const int mi_height = block_size_high[plane_bsize] >> tx_size_high_log2[0];
+ const int mi_width = mi_size_wide[plane_bsize];
+ const int mi_height = mi_size_high[plane_bsize];
const TX_SIZE max_tx_size = get_vartx_max_txsize(xd, plane_bsize, 0);
const int bh = tx_size_high_unit[max_tx_size];
const int bw = tx_size_wide_unit[max_tx_size];
@@ -5656,20 +5648,21 @@
MACROBLOCKD *xd,
BLOCK_SIZE plane_bsize,
int mi_row, int mi_col) {
- const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
- const int mi_height = block_size_high[plane_bsize] >> tx_size_high_log2[0];
+ const int mi_width = mi_size_wide[plane_bsize];
+ const int mi_height = mi_size_high[plane_bsize];
const TX_SIZE max_tx_size = get_vartx_max_txsize(xd, plane_bsize, 0);
const int bh = tx_size_high_unit[max_tx_size];
const int bw = tx_size_wide_unit[max_tx_size];
- int idx, idy;
xd->above_txfm_context = cm->above_txfm_context[xd->tile.tile_row] + mi_col;
xd->left_txfm_context =
xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
- for (idy = 0; idy < mi_height; idy += bh)
- for (idx = 0; idx < mi_width; idx += bw)
+ for (int idy = 0; idy < mi_height; idy += bh) {
+ for (int idx = 0; idx < mi_width; idx += bw) {
set_txfm_context(xd, max_tx_size, idy, idx);
+ }
+ }
}
static AOM_INLINE void encode_superblock(const AV1_COMP *const cpi,
diff --git a/av1/encoder/encodemb.c b/av1/encoder/encodemb.c
index f990c80..2575214 100644
--- a/av1/encoder/encodemb.c
+++ b/av1/encoder/encodemb.c
@@ -62,12 +62,10 @@
const int dst_stride = pd->dst.stride;
const int tx1d_width = tx_size_wide[tx_size];
const int tx1d_height = tx_size_high[tx_size];
- uint8_t *dst =
- &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
- uint8_t *src =
- &p->src.buf[(blk_row * src_stride + blk_col) << tx_size_wide_log2[0]];
+ uint8_t *dst = &pd->dst.buf[(blk_row * dst_stride + blk_col) << MI_SIZE_LOG2];
+ uint8_t *src = &p->src.buf[(blk_row * src_stride + blk_col) << MI_SIZE_LOG2];
int16_t *src_diff =
- &p->src_diff[(blk_row * diff_stride + blk_col) << tx_size_wide_log2[0]];
+ &p->src_diff[(blk_row * diff_stride + blk_col) << MI_SIZE_LOG2];
av1_subtract_block(xd, tx1d_height, tx1d_width, src_diff, diff_stride, src,
src_stride, dst, dst_stride);
}
@@ -139,7 +137,7 @@
const int diff_stride = block_size_wide[plane_bsize];
const int src_offset = (blk_row * diff_stride + blk_col);
- const int16_t *src_diff = &p->src_diff[src_offset << tx_size_wide_log2[0]];
+ const int16_t *src_diff = &p->src_diff[src_offset << MI_SIZE_LOG2];
av1_fwd_txfm(src_diff, coeff, diff_stride, txfm_param);
@@ -236,9 +234,8 @@
ENTROPY_CONTEXT *a, *l;
int dummy_rate_cost = 0;
- const int bw = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
- dst = &pd->dst
- .buf[(blk_row * pd->dst.stride + blk_col) << tx_size_wide_log2[0]];
+ const int bw = mi_size_wide[plane_bsize];
+ dst = &pd->dst.buf[(blk_row * pd->dst.stride + blk_col) << MI_SIZE_LOG2];
a = &args->ta[blk_col];
l = &args->tl[blk_row];
@@ -393,8 +390,8 @@
const int max_blocks_high = max_block_high(xd, plane_bsize, plane);
const BLOCK_SIZE max_unit_bsize =
get_plane_block_size(BLOCK_64X64, pd->subsampling_x, pd->subsampling_y);
- int mu_blocks_wide = block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
- int mu_blocks_high = block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
+ int mu_blocks_wide = mi_size_wide[max_unit_bsize];
+ int mu_blocks_high = mi_size_high[max_unit_bsize];
mu_blocks_wide = AOMMIN(max_blocks_wide, mu_blocks_wide);
mu_blocks_high = AOMMIN(max_blocks_high, mu_blocks_high);
@@ -448,8 +445,7 @@
tran_low_t *const dqcoeff = pd->dqcoeff + BLOCK_OFFSET(block);
uint8_t *dst;
- dst = &pd->dst
- .buf[(blk_row * pd->dst.stride + blk_col) << tx_size_wide_log2[0]];
+ dst = &pd->dst.buf[(blk_row * pd->dst.stride + blk_col) << MI_SIZE_LOG2];
TxfmParam txfm_param;
QUANT_PARAM quant_param;
@@ -508,12 +504,12 @@
const BLOCK_SIZE plane_bsize =
get_plane_block_size(bsize, subsampling_x, subsampling_y);
assert(plane_bsize < BLOCK_SIZES_ALL);
- const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
- const int mi_height = block_size_high[plane_bsize] >> tx_size_high_log2[0];
+ const int mi_width = mi_size_wide[plane_bsize];
+ const int mi_height = mi_size_high[plane_bsize];
const TX_SIZE max_tx_size = get_vartx_max_txsize(xd, plane_bsize, plane);
const BLOCK_SIZE txb_size = txsize_to_bsize[max_tx_size];
- const int bw = block_size_wide[txb_size] >> tx_size_wide_log2[0];
- const int bh = block_size_high[txb_size] >> tx_size_high_log2[0];
+ const int bw = mi_size_wide[txb_size];
+ const int bh = mi_size_high[txb_size];
int block = 0;
const int step =
tx_size_wide_unit[max_tx_size] * tx_size_high_unit[max_tx_size];
@@ -523,10 +519,8 @@
arg.tl = ctx.tl[plane];
const BLOCK_SIZE max_unit_bsize =
get_plane_block_size(BLOCK_64X64, subsampling_x, subsampling_y);
- int mu_blocks_wide =
- block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
- int mu_blocks_high =
- block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
+ int mu_blocks_wide = mi_size_wide[max_unit_bsize];
+ int mu_blocks_high = mi_size_high[max_unit_bsize];
mu_blocks_wide = AOMMIN(mi_width, mu_blocks_wide);
mu_blocks_high = AOMMIN(mi_height, mu_blocks_high);
@@ -574,14 +568,13 @@
PLANE_TYPE plane_type = get_plane_type(plane);
uint16_t *eob = &p->eobs[block];
const int dst_stride = pd->dst.stride;
- uint8_t *dst =
- &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
+ uint8_t *dst = &pd->dst.buf[(blk_row * dst_stride + blk_col) << MI_SIZE_LOG2];
int dummy_rate_cost = 0;
av1_predict_intra_block_facade(cm, xd, plane, blk_col, blk_row, tx_size);
TX_TYPE tx_type = DCT_DCT;
- const int bw = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
+ const int bw = mi_size_wide[plane_bsize];
if (plane == 0 && is_blk_skip(x, plane, blk_row * bw + blk_col)) {
*eob = 0;
p->txb_entropy_ctx[block] = 0;
diff --git a/av1/encoder/encodetxb.c b/av1/encoder/encodetxb.c
index cf2d64b..78deef5 100644
--- a/av1/encoder/encodetxb.c
+++ b/av1/encoder/encodetxb.c
@@ -657,8 +657,8 @@
const int max_blocks_wide = max_block_wide(xd, bsize, 0);
const int max_blocks_high = max_block_high(xd, bsize, 0);
const BLOCK_SIZE max_unit_bsize = BLOCK_64X64;
- int mu_blocks_wide = block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
- int mu_blocks_high = block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
+ int mu_blocks_wide = mi_size_wide[max_unit_bsize];
+ int mu_blocks_high = mi_size_high[max_unit_bsize];
mu_blocks_wide = AOMMIN(max_blocks_wide, mu_blocks_wide);
mu_blocks_high = AOMMIN(max_blocks_high, mu_blocks_high);
diff --git a/av1/encoder/rd.c b/av1/encoder/rd.c
index 949a825..392189a 100644
--- a/av1/encoder/rd.c
+++ b/av1/encoder/rd.c
@@ -980,8 +980,8 @@
const struct macroblockd_plane *pd,
ENTROPY_CONTEXT t_above[MAX_MIB_SIZE],
ENTROPY_CONTEXT t_left[MAX_MIB_SIZE]) {
- const int num_4x4_w = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
- const int num_4x4_h = block_size_high[plane_bsize] >> tx_size_high_log2[0];
+ const int num_4x4_w = mi_size_wide[plane_bsize];
+ const int num_4x4_h = mi_size_high[plane_bsize];
const ENTROPY_CONTEXT *const above = pd->above_context;
const ENTROPY_CONTEXT *const left = pd->left_context;
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c
index 5118fc0..636f6b3 100644
--- a/av1/encoder/rdopt.c
+++ b/av1/encoder/rdopt.c
@@ -2190,7 +2190,6 @@
const int txb_height = block_size_high[tx_bsize];
const int txb_width = block_size_wide[tx_bsize];
const struct macroblockd_plane *const pd = &xd->plane[plane];
- const int tx_unit_size = tx_size_wide_log2[0];
// TODO(aconverse@google.com): Investigate using crop_width/height here rather
// than the MI size
@@ -2201,7 +2200,7 @@
const int block_rows =
(xd->mb_to_bottom_edge >> (3 + pd->subsampling_y)) + block_height;
*visible_height =
- clamp(block_rows - (blk_row << tx_unit_size), 0, txb_height);
+ clamp(block_rows - (blk_row << MI_SIZE_LOG2), 0, txb_height);
}
if (height) *height = txb_height;
@@ -2212,7 +2211,7 @@
const int block_cols =
(xd->mb_to_right_edge >> (3 + pd->subsampling_x)) + block_width;
*visible_width =
- clamp(block_cols - (blk_col << tx_unit_size), 0, txb_width);
+ clamp(block_cols - (blk_col << MI_SIZE_LOG2), 0, txb_width);
}
if (width) *width = txb_width;
}
@@ -2266,17 +2265,15 @@
int txb_width = block_size_wide[tx_bsize];
if (x->using_dist_8x8 && plane == 0) {
const int src_stride = x->plane[plane].src.stride;
- const int src_idx = (blk_row * src_stride + blk_col)
- << tx_size_wide_log2[0];
- const int diff_idx = (blk_row * diff_stride + blk_col)
- << tx_size_wide_log2[0];
+ const int src_idx = (blk_row * src_stride + blk_col) << MI_SIZE_LOG2;
+ const int diff_idx = (blk_row * diff_stride + blk_col) << MI_SIZE_LOG2;
const uint8_t *src = &x->plane[plane].src.buf[src_idx];
return dist_8x8_diff(x, src, src_stride, diff + diff_idx, diff_stride,
txb_width, txb_height, visible_cols, visible_rows,
x->qindex);
}
#endif
- diff += ((blk_row * diff_stride + blk_col) << tx_size_wide_log2[0]);
+ diff += ((blk_row * diff_stride + blk_col) << MI_SIZE_LOG2);
uint64_t sse =
aom_sum_squares_2d_i16(diff, diff_stride, visible_cols, visible_rows);
if (block_mse_q8 != NULL) {
@@ -2342,8 +2339,7 @@
const TX_TYPE tx_type = av1_get_tx_type(xd, plane_type, blk_row, blk_col,
tx_size, reduced_tx_set);
const int dst_stride = pd->dst.stride;
- uint8_t *dst =
- &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
+ uint8_t *dst = &pd->dst.buf[(blk_row * dst_stride + blk_col) << MI_SIZE_LOG2];
av1_inverse_transform_block(xd, dqcoeff, plane, tx_type, tx_size, dst,
dst_stride, eob, reduced_tx_set);
}
@@ -2417,8 +2413,8 @@
const int src_stride = x->plane[plane].src.stride;
const int dst_stride = xd->plane[plane].dst.stride;
// Scale the transform block index to pixel unit.
- const int src_idx = (blk_row * src_stride + blk_col) << tx_size_wide_log2[0];
- const int dst_idx = (blk_row * dst_stride + blk_col) << tx_size_wide_log2[0];
+ const int src_idx = (blk_row * src_stride + blk_col) << MI_SIZE_LOG2;
+ const int dst_idx = (blk_row * dst_stride + blk_col) << MI_SIZE_LOG2;
const uint8_t *src = &x->plane[plane].src.buf[src_idx];
const uint8_t *dst = &xd->plane[plane].dst.buf[dst_idx];
const tran_low_t *dqcoeff = pd->dqcoeff + BLOCK_OFFSET(block);
@@ -2718,10 +2714,10 @@
const int src_stride = p->src.stride;
const uint8_t *const src =
- &p->src.buf[(blk_row * src_stride + blk_col) << tx_size_wide_log2[0]];
+ &p->src.buf[(blk_row * src_stride + blk_col) << MI_SIZE_LOG2];
const int dst_stride = pd->dst.stride;
const uint8_t *const dst =
- &pd->dst.buf[(blk_row * dst_stride + blk_col) << tx_size_wide_log2[0]];
+ &pd->dst.buf[(blk_row * dst_stride + blk_col) << MI_SIZE_LOG2];
unsigned int sse;
cpi->fn_ptr[tx_bsize].vf(src, src_stride, dst, dst_stride, &sse);
const double sse_norm = (double)sse / num_samples;
@@ -2734,7 +2730,7 @@
const int diff_stride = block_size_wide[plane_bsize];
const int16_t *const src_diff =
- &p->src_diff[(blk_row * diff_stride + blk_col) << tx_size_wide_log2[0]];
+ &p->src_diff[(blk_row * diff_stride + blk_col) << MI_SIZE_LOG2];
double sse_norm_arr[4], sad_norm_arr[4];
get_2x2_normalized_sses_and_sads(cpi, tx_bsize, src, src_stride, dst,
@@ -3740,8 +3736,7 @@
av1_set_txb_context(x, plane, block, tx_size, a, l);
const int blk_idx =
- blk_row * (block_size_wide[plane_bsize] >> tx_size_wide_log2[0]) +
- blk_col;
+ blk_row * (block_size_wide[plane_bsize] >> MI_SIZE_LOG2) + blk_col;
if (plane == 0)
set_blk_skip(x, plane, blk_idx, x->plane[plane].eobs[block] == 0);
@@ -3981,7 +3976,7 @@
}
static INLINE int bsize_to_num_blk(BLOCK_SIZE bsize) {
- int num_blk = 1 << (num_pels_log2_lookup[bsize] - 2 * tx_size_wide_log2[0]);
+ int num_blk = 1 << (num_pels_log2_lookup[bsize] - 2 * MI_SIZE_LOG2);
return num_blk;
}
@@ -5844,7 +5839,7 @@
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *const mbmi = xd->mi[0];
struct macroblock_plane *const p = &x->plane[0];
- const int bw = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
+ const int bw = mi_size_wide[plane_bsize];
no_split->rd = INT64_MAX;
no_split->txb_entropy_ctx = 0;
@@ -5970,7 +5965,7 @@
const int max_blocks_wide = max_block_wide(xd, plane_bsize, 0);
if (blk_row >= max_blocks_high || blk_col >= max_blocks_wide) return;
- const int bw = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
+ const int bw = mi_size_wide[plane_bsize];
MB_MODE_INFO *const mbmi = xd->mi[0];
const int ctx = txfm_partition_context(tx_above + blk_col, tx_left + blk_row,
mbmi->sb_type, tx_size);
@@ -6193,7 +6188,7 @@
rd_stats->zero_rate = zero_blk_rate;
tx_type_rd(cpi, x, tx_size, blk_row, blk_col, 0, block, plane_bsize,
&txb_ctx, rd_stats, ftxs_mode, ref_best_rd, NULL);
- const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
+ const int mi_width = mi_size_wide[plane_bsize];
if (RDCOST(x->rdmult, rd_stats->rate, rd_stats->dist) >=
RDCOST(x->rdmult, zero_blk_rate, rd_stats->sse) ||
rd_stats->skip == 1) {
diff --git a/av1/encoder/tokenize.c b/av1/encoder/tokenize.c
index ade1bc0..df2d04a 100644
--- a/av1/encoder/tokenize.c
+++ b/av1/encoder/tokenize.c
@@ -213,22 +213,20 @@
}
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, ss_x, ss_y);
assert(plane_bsize < BLOCK_SIZES_ALL);
- const int mi_width = block_size_wide[plane_bsize] >> tx_size_wide_log2[0];
- const int mi_height = block_size_high[plane_bsize] >> tx_size_high_log2[0];
+ const int mi_width = mi_size_wide[plane_bsize];
+ const int mi_height = mi_size_high[plane_bsize];
const TX_SIZE max_tx_size = get_vartx_max_txsize(xd, plane_bsize, plane);
const BLOCK_SIZE txb_size = txsize_to_bsize[max_tx_size];
- const int bw = block_size_wide[txb_size] >> tx_size_wide_log2[0];
- const int bh = block_size_high[txb_size] >> tx_size_high_log2[0];
+ const int bw = mi_size_wide[txb_size];
+ const int bh = mi_size_high[txb_size];
int block = 0;
const int step =
tx_size_wide_unit[max_tx_size] * tx_size_high_unit[max_tx_size];
const BLOCK_SIZE max_unit_bsize =
get_plane_block_size(BLOCK_64X64, ss_x, ss_y);
- int mu_blocks_wide =
- block_size_wide[max_unit_bsize] >> tx_size_wide_log2[0];
- int mu_blocks_high =
- block_size_high[max_unit_bsize] >> tx_size_high_log2[0];
+ int mu_blocks_wide = mi_size_wide[max_unit_bsize];
+ int mu_blocks_high = mi_size_high[max_unit_bsize];
mu_blocks_wide = AOMMIN(mi_width, mu_blocks_wide);
mu_blocks_high = AOMMIN(mi_height, mu_blocks_high);