Commit 511da8cb authored by Geza Lore's avatar Geza Lore

Rename MI_BLOCK_SIZE and MI_MASK macros.

Rename MI_BLOCK_SIZE.* -> MAX_MIB_SIZE.* (MIB is for MI Block).
Rename MI_MASK.* -> MAX_MIB_MASK.*

There are no functional changes.

This is in preparation for coding the superblock size at the frame
level, which will require some of these constants to become variables.
The new names better reflect future semantics, and hence make the code
clearer.

Change-Id: Iee08d97554cf4cc16a5dc166a3ffd1ab91529992
parent 615482af
......@@ -166,7 +166,7 @@ typedef struct {
#if CONFIG_VAR_TX
// TODO(jingning): This effectively assigned a separate entry for each
// 8x8 block. Apparently it takes much more space than needed.
TX_SIZE inter_tx_size[MI_BLOCK_SIZE][MI_BLOCK_SIZE];
TX_SIZE inter_tx_size[MAX_MIB_SIZE][MAX_MIB_SIZE];
#endif
int8_t skip;
int8_t has_no_coeffs;
......@@ -315,15 +315,15 @@ typedef struct macroblockd {
const YV12_BUFFER_CONFIG *cur_buf;
ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
ENTROPY_CONTEXT left_context[MAX_MB_PLANE][2 * MI_BLOCK_SIZE];
ENTROPY_CONTEXT left_context[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
PARTITION_CONTEXT *above_seg_context;
PARTITION_CONTEXT left_seg_context[MI_BLOCK_SIZE];
PARTITION_CONTEXT left_seg_context[MAX_MIB_SIZE];
#if CONFIG_VAR_TX
TXFM_CONTEXT *above_txfm_context;
TXFM_CONTEXT *left_txfm_context;
TXFM_CONTEXT left_txfm_context_buffer[MI_BLOCK_SIZE];
TXFM_CONTEXT left_txfm_context_buffer[MAX_MIB_SIZE];
TX_SIZE max_tx_size;
#if CONFIG_SUPERTX
......
......@@ -20,23 +20,26 @@ extern "C" {
#undef MAX_SB_SIZE
// Pixels per max superblock size
#if CONFIG_EXT_PARTITION
# define MAX_SB_SIZE_LOG2 7
#else
# define MAX_SB_SIZE_LOG2 6
#endif // CONFIG_EXT_PARTITION
#define MAX_SB_SIZE (1 << MAX_SB_SIZE_LOG2)
#define MAX_SB_SIZE (1 << MAX_SB_SIZE_LOG2)
#define MAX_SB_SQUARE (MAX_SB_SIZE * MAX_SB_SIZE)
#define MI_SIZE_LOG2 3
#define MI_SIZE (1 << MI_SIZE_LOG2) // pixels per mi-unit
// Pixels per Mode Info (MI) unit
#define MI_SIZE_LOG2 3
#define MI_SIZE (1 << MI_SIZE_LOG2)
#define MI_BLOCK_SIZE_LOG2 (MAX_SB_SIZE_LOG2 - MI_SIZE_LOG2)
#define MI_BLOCK_SIZE (1 << MI_BLOCK_SIZE_LOG2) // mi-units per max block
// MI-units per max superblock (MI Block - MIB)
#define MAX_MIB_SIZE_LOG2 (MAX_SB_SIZE_LOG2 - MI_SIZE_LOG2)
#define MAX_MIB_SIZE (1 << MAX_MIB_SIZE_LOG2)
#define MI_MASK (MI_BLOCK_SIZE - 1)
#define MI_MASK_2 (MI_BLOCK_SIZE * 2 - 1)
// Mask to extract MI offset within max MIB
#define MAX_MIB_MASK (MAX_MIB_SIZE - 1)
#define MAX_MIB_MASK_2 (MAX_MIB_SIZE * 2 - 1)
#if CONFIG_EXT_TILE
# define MAX_TILE_ROWS 1024
......
......@@ -867,10 +867,10 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
const int shift_32_uv[] = {0, 2, 8, 10};
const int shift_16_uv[] = {0, 1, 4, 5};
int i;
const int max_rows = (mi_row + MI_BLOCK_SIZE > cm->mi_rows ?
cm->mi_rows - mi_row : MI_BLOCK_SIZE);
const int max_cols = (mi_col + MI_BLOCK_SIZE > cm->mi_cols ?
cm->mi_cols - mi_col : MI_BLOCK_SIZE);
const int max_rows = (mi_row + MAX_MIB_SIZE > cm->mi_rows ?
cm->mi_rows - mi_row : MAX_MIB_SIZE);
const int max_cols = (mi_col + MAX_MIB_SIZE > cm->mi_cols ?
cm->mi_cols - mi_col : MAX_MIB_SIZE);
#if CONFIG_EXT_PARTITION
assert(0 && "Not yet updated");
#endif // CONFIG_EXT_PARTITION
......@@ -1044,14 +1044,14 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
lfm->above_uv[TX_4X4] &= ~above_border_uv;
// We do some special edge handling.
if (mi_row + MI_BLOCK_SIZE > cm->mi_rows) {
if (mi_row + MAX_MIB_SIZE > cm->mi_rows) {
const uint64_t rows = cm->mi_rows - mi_row;
// Each pixel inside the border gets a 1,
const uint64_t mask_y =
(((uint64_t) 1 << (rows << MI_BLOCK_SIZE_LOG2)) - 1);
(((uint64_t) 1 << (rows << MAX_MIB_SIZE_LOG2)) - 1);
const uint16_t mask_uv =
(((uint16_t) 1 << (((rows + 1) >> 1) << (MI_BLOCK_SIZE_LOG2 - 1))) - 1);
(((uint16_t) 1 << (((rows + 1) >> 1) << (MAX_MIB_SIZE_LOG2 - 1))) - 1);
// Remove values completely outside our border.
for (i = 0; i < TX_32X32; i++) {
......@@ -1075,7 +1075,7 @@ void vp10_setup_mask(VP10_COMMON *const cm, const int mi_row, const int mi_col,
}
}
if (mi_col + MI_BLOCK_SIZE > cm->mi_cols) {
if (mi_col + MAX_MIB_SIZE > cm->mi_cols) {
const uint64_t columns = cm->mi_cols - mi_col;
// Each pixel inside the border gets a 1, the multiply copies the border
......@@ -1219,21 +1219,21 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
const int row_step_stride = cm->mi_stride * row_step;
struct buf_2d *const dst = &plane->dst;
uint8_t* const dst0 = dst->buf;
unsigned int mask_16x16[MI_BLOCK_SIZE] = {0};
unsigned int mask_8x8[MI_BLOCK_SIZE] = {0};
unsigned int mask_4x4[MI_BLOCK_SIZE] = {0};
unsigned int mask_4x4_int[MI_BLOCK_SIZE] = {0};
uint8_t lfl[MI_BLOCK_SIZE * MI_BLOCK_SIZE];
unsigned int mask_16x16[MAX_MIB_SIZE] = {0};
unsigned int mask_8x8[MAX_MIB_SIZE] = {0};
unsigned int mask_4x4[MAX_MIB_SIZE] = {0};
unsigned int mask_4x4_int[MAX_MIB_SIZE] = {0};
uint8_t lfl[MAX_MIB_SIZE * MAX_MIB_SIZE];
int r, c;
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
unsigned int mask_16x16_c = 0;
unsigned int mask_8x8_c = 0;
unsigned int mask_4x4_c = 0;
unsigned int border_mask;
// Determine the vertical edges that need filtering
for (c = 0; c < MI_BLOCK_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
for (c = 0; c < MAX_MIB_SIZE && mi_col + c < cm->mi_cols; c += col_step) {
const MODE_INFO *mi = mi_8x8[c];
const MB_MODE_INFO *mbmi = &mi[0].mbmi;
const BLOCK_SIZE sb_type = mbmi->sb_type;
......@@ -1267,7 +1267,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
int tx_size_mask = 0;
// Filter level can vary per MI
if (!(lfl[(r << MI_BLOCK_SIZE_LOG2) + (c >> ss_x)] =
if (!(lfl[(r << MAX_MIB_SIZE_LOG2) + (c >> ss_x)] =
get_filter_level(&cm->lf_info, mbmi)))
continue;
......@@ -1288,10 +1288,10 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
tx_size_r = VPXMIN(tx_size,
cm->above_txfm_context[mi_col + c]);
tx_size_c = VPXMIN(tx_size,
cm->left_txfm_context[(mi_row + r) & MI_MASK]);
cm->left_txfm_context[(mi_row + r) & MAX_MIB_MASK]);
cm->above_txfm_context[mi_col + c] = tx_size;
cm->left_txfm_context[(mi_row + r) & MI_MASK] = tx_size;
cm->left_txfm_context[(mi_row + r) & MAX_MIB_MASK] = tx_size;
#endif
// Build masks based on the transform size of each block
......@@ -1365,7 +1365,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
mask_8x8_c & border_mask,
mask_4x4_c & border_mask,
mask_4x4_int[r],
&cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2],
&cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2],
(int)cm->bit_depth);
} else {
filter_selectively_vert(dst->buf, dst->stride,
......@@ -1373,7 +1373,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
mask_8x8_c & border_mask,
mask_4x4_c & border_mask,
mask_4x4_int[r],
&cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]);
&cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]);
}
#else
filter_selectively_vert(dst->buf, dst->stride,
......@@ -1381,7 +1381,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
mask_8x8_c & border_mask,
mask_4x4_c & border_mask,
mask_4x4_int[r],
&cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]);
&cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]);
#endif // CONFIG_VP9_HIGHBITDEPTH
dst->buf += 8 * dst->stride;
mi_8x8 += row_step_stride;
......@@ -1389,7 +1389,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
// Now do horizontal pass
dst->buf = dst0;
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += row_step) {
const int skip_border_4x4_r = ss_y && mi_row + r == cm->mi_rows - 1;
const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int[r];
......@@ -1415,7 +1415,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
mask_8x8_r,
mask_4x4_r,
mask_4x4_int_r,
&cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2],
&cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2],
(int)cm->bit_depth);
} else {
filter_selectively_horiz(dst->buf, dst->stride,
......@@ -1423,7 +1423,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
mask_8x8_r,
mask_4x4_r,
mask_4x4_int_r,
&cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]);
&cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]);
}
#else
filter_selectively_horiz(dst->buf, dst->stride,
......@@ -1431,7 +1431,7 @@ void vp10_filter_block_plane_non420(VP10_COMMON *cm,
mask_8x8_r,
mask_4x4_r,
mask_4x4_int_r,
&cm->lf_info, &lfl[r << MI_BLOCK_SIZE_LOG2]);
&cm->lf_info, &lfl[r << MAX_MIB_SIZE_LOG2]);
#endif // CONFIG_VP9_HIGHBITDEPTH
dst->buf += 8 * dst->stride;
}
......@@ -1452,7 +1452,7 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm,
assert(plane->subsampling_x == 0 && plane->subsampling_y == 0);
// Vertical pass: do 2 rows at one time
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) {
for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += 2) {
unsigned int mask_16x16_l = mask_16x16 & 0xffff;
unsigned int mask_8x8_l = mask_8x8 & 0xffff;
unsigned int mask_4x4_l = mask_4x4 & 0xffff;
......@@ -1464,18 +1464,18 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm,
highbd_filter_selectively_vert_row2(
plane->subsampling_x, CONVERT_TO_SHORTPTR(dst->buf), dst->stride,
mask_16x16_l, mask_8x8_l, mask_4x4_l, mask_4x4_int_l, &cm->lf_info,
&lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2], (int)cm->bit_depth);
&lfm->lfl_y[r << MAX_MIB_SIZE_LOG2], (int)cm->bit_depth);
} else {
filter_selectively_vert_row2(
plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l,
mask_4x4_l, mask_4x4_int_l, &cm->lf_info,
&lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2]);
&lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]);
}
#else
filter_selectively_vert_row2(
plane->subsampling_x, dst->buf, dst->stride, mask_16x16_l, mask_8x8_l,
mask_4x4_l, mask_4x4_int_l, &cm->lf_info,
&lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2]);
&lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]);
#endif // CONFIG_VP9_HIGHBITDEPTH
dst->buf += 16 * dst->stride;
mask_16x16 >>= 16;
......@@ -1491,7 +1491,7 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm,
mask_4x4 = lfm->above_y[TX_4X4];
mask_4x4_int = lfm->int_4x4_y;
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r++) {
for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r++) {
unsigned int mask_16x16_r;
unsigned int mask_8x8_r;
unsigned int mask_4x4_r;
......@@ -1511,17 +1511,17 @@ void vp10_filter_block_plane_ss00(VP10_COMMON *const cm,
highbd_filter_selectively_horiz(
CONVERT_TO_SHORTPTR(dst->buf), dst->stride, mask_16x16_r, mask_8x8_r,
mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info,
&lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2],
&lfm->lfl_y[r << MAX_MIB_SIZE_LOG2],
(int)cm->bit_depth);
} else {
filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r,
mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info,
&lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2]);
&lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]);
}
#else
filter_selectively_horiz(dst->buf, dst->stride, mask_16x16_r, mask_8x8_r,
mask_4x4_r, mask_4x4_int & 0xff, &cm->lf_info,
&lfm->lfl_y[r << MI_BLOCK_SIZE_LOG2]);
&lfm->lfl_y[r << MAX_MIB_SIZE_LOG2]);
#endif // CONFIG_VP9_HIGHBITDEPTH
dst->buf += 8 * dst->stride;
......@@ -1548,13 +1548,13 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm,
assert(plane->subsampling_x == 1 && plane->subsampling_y == 1);
// Vertical pass: do 2 rows at one time
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 4) {
for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += 4) {
if (plane->plane_type == 1) {
for (c = 0; c < (MI_BLOCK_SIZE >> 1); c++) {
for (c = 0; c < (MAX_MIB_SIZE >> 1); c++) {
lfm->lfl_uv[(r << 1) + c] =
lfm->lfl_y[(r << MI_BLOCK_SIZE_LOG2) + (c << 1)];
lfm->lfl_y[(r << MAX_MIB_SIZE_LOG2) + (c << 1)];
lfm->lfl_uv[((r + 2) << 1) + c] =
lfm->lfl_y[((r + 2) << MI_BLOCK_SIZE_LOG2) + (c << 1)];
lfm->lfl_y[((r + 2) << MAX_MIB_SIZE_LOG2) + (c << 1)];
}
}
......@@ -1599,7 +1599,7 @@ void vp10_filter_block_plane_ss11(VP10_COMMON *const cm,
mask_4x4 = lfm->above_uv[TX_4X4];
mask_4x4_int = lfm->above_int_4x4_uv;
for (r = 0; r < MI_BLOCK_SIZE && mi_row + r < cm->mi_rows; r += 2) {
for (r = 0; r < MAX_MIB_SIZE && mi_row + r < cm->mi_rows; r += 2) {
const int skip_border_4x4_r = mi_row + r == cm->mi_rows - 1;
const unsigned int mask_4x4_int_r =
skip_border_4x4_r ? 0 : (mask_4x4_int & 0xf);
......@@ -1653,12 +1653,12 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
# if CONFIG_VAR_TX
memset(cm->above_txfm_context, TX_SIZES, cm->mi_cols);
# endif // CONFIG_VAR_TX
for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) {
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
# if CONFIG_VAR_TX
memset(cm->left_txfm_context, TX_SIZES, MI_BLOCK_SIZE);
memset(cm->left_txfm_context, TX_SIZES, MAX_MIB_SIZE);
# endif // CONFIG_VAR_TX
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
int plane;
vp10_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
......@@ -1683,9 +1683,9 @@ void vp10_loop_filter_rows(YV12_BUFFER_CONFIG *frame_buffer,
else
path = LF_PATH_SLOW;
for (mi_row = start; mi_row < stop; mi_row += MI_BLOCK_SIZE) {
for (mi_row = start; mi_row < stop; mi_row += MAX_MIB_SIZE) {
MODE_INFO **mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
int plane;
vp10_setup_dst_planes(planes, frame_buffer, mi_row, mi_col);
......
......@@ -84,8 +84,8 @@ typedef struct {
uint16_t above_uv[TX_SIZES];
uint16_t left_int_4x4_uv;
uint16_t above_int_4x4_uv;
uint8_t lfl_y[MI_BLOCK_SIZE * MI_BLOCK_SIZE];
uint8_t lfl_uv[MI_BLOCK_SIZE / 2 * MI_BLOCK_SIZE / 2];
uint8_t lfl_y[MAX_MIB_SIZE * MAX_MIB_SIZE];
uint8_t lfl_uv[MAX_MIB_SIZE / 2 * MAX_MIB_SIZE / 2];
} LOOP_FILTER_MASK;
/* assorted loopfilter functions which get used elsewhere */
......
......@@ -356,8 +356,8 @@ void vp10_mfqe(VP10_COMMON *cm) {
// Last decoded frame and will store the MFQE result.
YV12_BUFFER_CONFIG *dest = &cm->post_proc_buffer;
// Loop through each super block.
for (mi_row = 0; mi_row < cm->mi_rows; mi_row += MI_BLOCK_SIZE) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) {
for (mi_row = 0; mi_row < cm->mi_rows; mi_row += MAX_MIB_SIZE) {
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
MODE_INFO *mi;
MODE_INFO *mi_local = cm->mi + (mi_row * cm->mi_stride + mi_col);
// Motion Info in last frame.
......
......@@ -260,7 +260,7 @@ static int has_top_right(const MACROBLOCKD *xd,
// For each 4x4 group of blocks, when the bottom right is decoded the blocks
// to the right have not been decoded therefore the bottom right does
// not have a top right
while (bs < MI_BLOCK_SIZE) {
while (bs < MAX_MIB_SIZE) {
if (mi_col & bs) {
if ((mi_col & (2 * bs)) && (mi_row & (2 * bs))) {
has_tr = 0;
......
......@@ -332,7 +332,7 @@ typedef struct VP10Common {
ENTROPY_CONTEXT *above_context[MAX_MB_PLANE];
#if CONFIG_VAR_TX
TXFM_CONTEXT *above_txfm_context;
TXFM_CONTEXT left_txfm_context[MI_BLOCK_SIZE];
TXFM_CONTEXT left_txfm_context[MAX_MIB_SIZE];
#endif
int above_context_alloc_cols;
......@@ -408,7 +408,7 @@ static INLINE void ref_cnt_fb(RefCntBuffer *bufs, int *idx, int new_idx) {
}
static INLINE int mi_cols_aligned_to_sb(int n_mis) {
return ALIGN_POWER_OF_TWO(n_mis, MI_BLOCK_SIZE_LOG2);
return ALIGN_POWER_OF_TWO(n_mis, MAX_MIB_SIZE_LOG2);
}
static INLINE int frame_is_intra_only(const VP10_COMMON *const cm) {
......@@ -440,7 +440,7 @@ static INLINE void vp10_init_macroblockd(VP10_COMMON *cm, MACROBLOCKD *xd,
static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) {
const int above_idx = mi_col * 2;
const int left_idx = (mi_row * 2) & MI_MASK_2;
const int left_idx = (mi_row * 2) & MAX_MIB_MASK_2;
int i;
for (i = 0; i < MAX_MB_PLANE; ++i) {
struct macroblockd_plane *const pd = &xd->plane[i];
......@@ -451,7 +451,7 @@ static INLINE void set_skip_context(MACROBLOCKD *xd, int mi_row, int mi_col) {
static INLINE int calc_mi_size(int len) {
// len is in mi units.
return len + MI_BLOCK_SIZE;
return len + MAX_MIB_SIZE;
}
static INLINE void set_mi_row_col(MACROBLOCKD *xd, const TileInfo *const tile,
......@@ -517,7 +517,8 @@ static INLINE void update_partition_context(MACROBLOCKD *xd,
BLOCK_SIZE subsize,
BLOCK_SIZE bsize) {
PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col;
PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK);
PARTITION_CONTEXT *const left_ctx =
xd->left_seg_context + (mi_row & MAX_MIB_MASK);
#if CONFIG_EXT_PARTITION_TYPES
const int bw = num_8x8_blocks_wide_lookup[bsize];
......@@ -581,7 +582,8 @@ static INLINE int partition_plane_context(const MACROBLOCKD *xd,
int mi_row, int mi_col,
BLOCK_SIZE bsize) {
const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col;
const PARTITION_CONTEXT *left_ctx = xd->left_seg_context + (mi_row & MI_MASK);
const PARTITION_CONTEXT *left_ctx =
xd->left_seg_context + (mi_row & MAX_MIB_MASK);
const int bsl = mi_width_log2_lookup[bsize];
int above = (*above_ctx >> bsl) & 1 , left = (*left_ctx >> bsl) & 1;
......
......@@ -272,21 +272,19 @@ static int vp10_has_right(BLOCK_SIZE bsize, int mi_row, int mi_col,
if (x + step < w)
return 1;
mi_row = (mi_row & MI_MASK) >> hl;
mi_col = (mi_col & MI_MASK) >> wl;
mi_row = (mi_row & MAX_MIB_MASK) >> hl;
mi_col = (mi_col & MAX_MIB_MASK) >> wl;
// If top row of coding unit
if (mi_row == 0)
return 1;
// If rightmost column of coding unit
if (((mi_col + 1) << wl) >= MI_BLOCK_SIZE)
if (((mi_col + 1) << wl) >= MAX_MIB_SIZE)
return 0;
my_order =
order[((mi_row + 0) << (MI_BLOCK_SIZE_LOG2 - wl)) + mi_col + 0];
tr_order =
order[((mi_row - 1) << (MI_BLOCK_SIZE_LOG2 - wl)) + mi_col + 1];
my_order = order[((mi_row + 0) << (MAX_MIB_SIZE_LOG2 - wl)) + mi_col + 0];
tr_order = order[((mi_row - 1) << (MAX_MIB_SIZE_LOG2 - wl)) + mi_col + 1];
return my_order > tr_order;
} else {
......@@ -315,17 +313,17 @@ static int vp10_has_bottom(BLOCK_SIZE bsize, int mi_row, int mi_col,
if (y + step < h)
return 1;
mi_row = (mi_row & MI_MASK) >> hl;
mi_col = (mi_col & MI_MASK) >> wl;
mi_row = (mi_row & MAX_MIB_MASK) >> hl;
mi_col = (mi_col & MAX_MIB_MASK) >> wl;
if (mi_col == 0)
return (mi_row << (hl + !ss_y)) + y + step < (MI_BLOCK_SIZE << !ss_y);
return (mi_row << (hl + !ss_y)) + y + step < (MAX_MIB_SIZE << !ss_y);
if (((mi_row + 1) << hl) >= MI_BLOCK_SIZE)
if (((mi_row + 1) << hl) >= MAX_MIB_SIZE)
return 0;
my_order = order[((mi_row + 0) << (MI_BLOCK_SIZE_LOG2 - wl)) + mi_col + 0];
bl_order = order[((mi_row + 1) << (MI_BLOCK_SIZE_LOG2 - wl)) + mi_col - 1];
my_order = order[((mi_row + 0) << (MAX_MIB_SIZE_LOG2 - wl)) + mi_col + 0];
bl_order = order[((mi_row + 1) << (MAX_MIB_SIZE_LOG2 - wl)) + mi_col - 1];
return bl_order < my_order;
}
......
......@@ -94,7 +94,7 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
int start, int stop, int y_only,
VP9LfSync *const lf_sync) {
const int num_planes = y_only ? 1 : MAX_MB_PLANE;
const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MI_BLOCK_SIZE_LOG2;
const int sb_cols = mi_cols_aligned_to_sb(cm->mi_cols) >> MAX_MIB_SIZE_LOG2;
int mi_row, mi_col;
#if !CONFIG_EXT_PARTITION_TYPES
enum lf_path path;
......@@ -116,12 +116,12 @@ void thread_loop_filter_rows(const YV12_BUFFER_CONFIG *const frame_buffer,
#endif // CONFIG_EXT_PARTITION
for (mi_row = start; mi_row < stop;
mi_row += lf_sync->num_workers * MI_BLOCK_SIZE) {
mi_row += lf_sync->num_workers * MAX_MIB_SIZE) {
MODE_INFO **const mi = cm->mi_grid_visible + mi_row * cm->mi_stride;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MI_BLOCK_SIZE) {
const int r = mi_row >> MI_BLOCK_SIZE_LOG2;
const int c = mi_col >> MI_BLOCK_SIZE_LOG2;
for (mi_col = 0; mi_col < cm->mi_cols; mi_col += MAX_MIB_SIZE) {
const int r = mi_row >> MAX_MIB_SIZE_LOG2;
const int c = mi_col >> MAX_MIB_SIZE_LOG2;
int plane;
sync_read(lf_sync, r, c);
......@@ -175,7 +175,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame,
VP9LfSync *lf_sync) {
const VPxWorkerInterface *const winterface = vpx_get_worker_interface();
// Number of superblock rows and cols
const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MI_BLOCK_SIZE_LOG2;
const int sb_rows = mi_cols_aligned_to_sb(cm->mi_rows) >> MAX_MIB_SIZE_LOG2;
// Decoder may allocate more threads than number of tiles based on user's
// input.
const int tile_cols = cm->tile_cols;
......@@ -215,7 +215,7 @@ static void loop_filter_rows_mt(YV12_BUFFER_CONFIG *frame,
// Loopfilter data
vp10_loop_filter_data_reset(lf_data, frame, cm, planes);
lf_data->start = start + i * MI_BLOCK_SIZE;
lf_data->start = start + i * MAX_MIB_SIZE;
lf_data->stop = stop;
lf_data->y_only = y_only;
......
......@@ -50,7 +50,7 @@ static int get_max_log2_tile_cols(const int sb64_cols) {
void vp10_get_tile_n_bits(int mi_cols,
int *min_log2_tile_cols, int *max_log2_tile_cols) {
const int sb64_cols = mi_cols_aligned_to_sb(mi_cols) >> MI_BLOCK_SIZE_LOG2;
const int sb64_cols = mi_cols_aligned_to_sb(mi_cols) >> MAX_MIB_SIZE_LOG2;
*min_log2_tile_cols = get_min_log2_tile_cols(sb64_cols);
*max_log2_tile_cols = get_max_log2_tile_cols(sb64_cols);
assert(*min_log2_tile_cols <= *max_log2_tile_cols);
......
......@@ -1094,7 +1094,8 @@ static void set_param_topblock(VP10_COMMON *const cm, MACROBLOCKD *const xd,
}
#if CONFIG_VAR_TX
xd->above_txfm_context = cm->above_txfm_context + mi_col;
xd->left_txfm_context = xd->left_txfm_context_buffer + (mi_row & MI_MASK);
xd->left_txfm_context =
xd->left_txfm_context_buffer + (mi_row & MAX_MIB_MASK);
set_txfm_ctx(xd->left_txfm_context, xd->mi[0]->mbmi.tx_size, bh);
set_txfm_ctx(xd->above_txfm_context, xd->mi[0]->mbmi.tx_size, bw);
#endif
......@@ -2014,7 +2015,8 @@ static INLINE int dec_partition_plane_context(const MACROBLOCKD *xd,
int mi_row, int mi_col,
int bsl) {
const PARTITION_CONTEXT *above_ctx = xd->above_seg_context + mi_col;
const PARTITION_CONTEXT *left_ctx = xd->left_seg_context + (mi_row & MI_MASK);
const PARTITION_CONTEXT *left_ctx =
xd->left_seg_context + (mi_row & MAX_MIB_MASK);
int above = (*above_ctx >> bsl) & 1 , left = (*left_ctx >> bsl) & 1;
// assert(bsl >= 0);
......@@ -2028,7 +2030,8 @@ static INLINE void dec_update_partition_context(MACROBLOCKD *xd,
BLOCK_SIZE subsize,
int bw) {
PARTITION_CONTEXT *const above_ctx = xd->above_seg_context + mi_col;
PARTITION_CONTEXT *const left_ctx = xd->left_seg_context + (mi_row & MI_MASK);
PARTITION_CONTEXT *const left_ctx =
xd->left_seg_context + (mi_row & MAX_MIB_MASK);
// update the partition context at the end notes. set partition bits
// of block sizes larger than the current one to be one, and partition
......@@ -2902,8 +2905,8 @@ static void setup_tile_info(VP10Decoder *const pbi,
cm->tile_width = vpx_rb_read_literal(rb, 6) + 1; // in [1, 64]
cm->tile_height = vpx_rb_read_literal(rb, 6) + 1; // in [1, 64]
cm->tile_width = cm->tile_width << MI_BLOCK_SIZE_LOG2;
cm->tile_height = cm->tile_height << MI_BLOCK_SIZE_LOG2;
cm->tile_width = cm->tile_width << MAX_MIB_SIZE_LOG2;
cm->tile_height = cm->tile_height << MAX_MIB_SIZE_LOG2;
cm->tile_width = VPXMIN(cm->tile_width, cm->mi_cols);
cm->tile_height = VPXMIN(cm->tile_height, cm->mi_rows);
......@@ -3265,13 +3268,13 @@ static const uint8_t *decode_tiles(VP10Decoder *pbi,
vp10_zero_above_context(cm, tile_info.mi_col_start, tile_info.mi_col_end);
for (mi_row = tile_info.mi_row_start; mi_row < tile_info.mi_row_end;
mi_row += MI_BLOCK_SIZE) {
mi_row += MAX_MIB_SIZE) {
int mi_col;
vp10_zero_left_context(&td->xd);
for (mi_col = tile_info.mi_col_start; mi_col < tile_info.mi_col_end;
mi_col += MI_BLOCK_SIZE) {
mi_col += MAX_MIB_SIZE) {
decode_partition(pbi, &td->xd,
#if CONFIG_SUPERTX
0,
......@@ -3307,8 +3310,8 @@ static const uint8_t *decode_tiles(VP10Decoder *pbi,
// Loopfilter one tile row.
if (cm->lf.filter_level && !cm->skip_loop_filter) {
LFWorkerData *const lf_data = (LFWorkerData*)pbi->lf_worker.data1;
const int lf_start = VPXMAX(0, tile_info.mi_row_start - MI_BLOCK_SIZE);
const int lf_end = tile_info.mi_row_end - MI_BLOCK_SIZE;
const int lf_start = VPXMAX(0, tile_info.mi_row_start - MAX_MIB_SIZE);
const int lf_end = tile_info.mi_row_end - MAX_MIB_SIZE;
// Delay the loopfilter if the first tile row is only
// a single superblock high.
......@@ -3332,7 +3335,7 @@ static const uint8_t *decode_tiles(VP10Decoder *pbi,
// After loopfiltering, the last 7 row pixels in each superblock row may
// still be changed by the longest loopfilter of the next superblock row.
if (cm->frame_parallel_decode)
vp10_frameworker_broadcast(pbi->cur_buf, mi_row << MI_BLOCK_SIZE_LOG2);
vp10_frameworker_broadcast(pbi->cur_buf, mi_row << MAX_MIB_SIZE_LOG2);
#endif // !CONFIG_VAR_TX
}
......@@ -3382,11 +3385,11 @@ static int tile_worker_hook(TileWorkerData *const tile_data,
vp10_zero_above_context(&pbi->common, tile->mi_col_start, tile->mi_col_end);
for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end;
mi_row += MI_BLOCK_SIZE) {
mi_row += MAX_MIB_SIZE) {
vp10_zero_left_context(&tile_data->xd);
for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
mi_col += MI_BLOCK_SIZE) {
mi_col += MAX_MIB_SIZE) {
decode_partition(pbi, &tile_data->xd,
#if CONFIG_SUPERTX
0,
......
......@@ -232,8 +232,8 @@ static void read_tx_size_inter(VP10_COMMON *cm, MACROBLOCKD *xd,
int ctx = txfm_partition_context(xd->above_txfm_context + tx_col,
xd->left_txfm_context + tx_row,
tx_size);
TX_SIZE (*const inter_tx_size)[MI_BLOCK_SIZE] =
(TX_SIZE (*)[MI_BLOCK_SIZE])&mbmi->inter_tx_size[tx_row][tx_col];
TX_SIZE (*const inter_tx_size)[MAX_MIB_SIZE] =
(TX_SIZE (*)[MAX_MIB_SIZE])&mbmi->inter_tx_size[tx_row][tx_col];