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
......
This diff is collapsed.
......@@ -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];
if (xd->mb_to_bottom_edge < 0)
max_blocks_high += xd->mb_to_bottom_edge >> 5;
......@@ -1157,7 +1157,7 @@ static int read_is_inter_block(VP10_COMMON *const cm, MACROBLOCKD *const xd,
static void fpm_sync(void *const data, int mi_row) {
VP10Decoder *const pbi = (VP10Decoder *)data;
vp10_frameworker_wait(pbi->frame_worker_owner, pbi->common.prev_frame,
mi_row << MI_BLOCK_SIZE_LOG2);
mi_row << MAX_MIB_SIZE_LOG2);
}
static void read_inter_block_mode_info(VP10Decoder *const pbi,
......@@ -1592,7 +1592,8 @@ static void read_inter_frame_mode_info(VP10Decoder *const pbi,
#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);
if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT &&
!mbmi->skip && inter_block) {
const TX_SIZE max_tx_size = max_txsize_lookup[bsize];
......
......@@ -388,8 +388,8 @@ static void cyclic_refresh_update_map(VP10_COMP *const cpi) {
int i, block_count, bl_index, sb_rows, sb_cols, sbs_in_frame;
int xmis, ymis, x, y;
memset(seg_map, CR_SEGMENT_ID_BASE, cm->mi_rows * cm->mi_cols);
sb_cols = (cm->mi_cols + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE;
sb_rows = (cm->mi_rows + MI_BLOCK_SIZE - 1) / MI_BLOCK_SIZE;
sb_cols = (cm->mi_cols + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE;
sb_rows = (cm->mi_rows + MAX_MIB_SIZE - 1) / MAX_MIB_SIZE;
sbs_in_frame = sb_cols * sb_rows;
// Number of target blocks to get the q delta (segment 1).
block_count = cr->percent_refresh * cm->mi_rows * cm->mi_cols / 100;
......@@ -404,8 +404,8 @@ static void cyclic_refresh_update_map(VP10_COMP *const cpi) {
// Get the mi_row/mi_col corresponding to superblock index i.
int sb_row_index = (i / sb_cols);
int sb_col_index = i - sb_row_index * sb_cols;
int mi_row = sb_row_index * MI_BLOCK_SIZE;
int mi_col = sb_col_index * MI_BLOCK_SIZE;
int mi_row = sb_row_index * MAX_MIB_SIZE;
int mi_col = sb_col_index * MAX_MIB_SIZE;
int qindex_thresh =
cpi->oxcf.content == VP9E_CONTENT_SCREEN
? vp10_get_qindex(&cm->seg, CR_SEGMENT_ID_BOOST2, cm->base_qindex)
......
......@@ -1514,7 +1514,8 @@ static void write_modes_b(VP10_COMP *cpi, const TileInfo *const tile,
} else {
#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);
#endif
pack_inter_mode_mvs(cpi, m,
#if CONFIG_SUPERTX
......@@ -1852,10 +1853,10 @@ static void write_modes(VP10_COMP *const cpi,
vp10_zero_above_context(cm, mi_col_start, mi_col_end);
for (mi_row = mi_row_start; mi_row < mi_row_end; mi_row += MI_BLOCK_SIZE) {
for (mi_row = mi_row_start; mi_row < mi_row_end; mi_row += MAX_MIB_SIZE) {
vp10_zero_left_context(xd);
for (mi_col = mi_col_start; mi_col < mi_col_end; mi_col += MI_BLOCK_SIZE) {
for (mi_col = mi_col_start; mi_col < mi_col_end; mi_col += MAX_MIB_SIZE) {
write_modes_sb_wrapper(cpi, tile, w, ans, tok, tok_end, 0,
mi_row, mi_col, BLOCK_LARGEST);
}
......@@ -2551,9 +2552,9 @@ static void write_tile_info(VP10_COMMON *const cm,
#if CONFIG_EXT_TILE
// TODO(geza.lore): Dependent on CU_SIZE
const int tile_width =
mi_cols_aligned_to_sb(cm->tile_width) >> MI_BLOCK_SIZE_LOG2;
mi_cols_aligned_to_sb(cm->tile_width) >> MAX_MIB_SIZE_LOG2;
const int tile_height =
mi_cols_aligned_to_sb(cm->tile_height) >> MI_BLOCK_SIZE_LOG2;
mi_cols_aligned_to_sb(cm->tile_height) >> MAX_MIB_SIZE_LOG2;
assert(tile_width > 0 && tile_width <= 64);
assert(tile_height > 0 && tile_height <= 64);
......
......@@ -140,11 +140,11 @@ struct macroblock {
// Notes transform blocks where no coefficents are coded.
// Set during mode selection. Read during block encoding.
uint8_t zcoeff_blk[TX_SIZES][MI_BLOCK_SIZE * MI_BLOCK_SIZE * 4];
uint8_t zcoeff_blk[TX_SIZES][MAX_MIB_SIZE * MAX_MIB_SIZE * 4];
#if CONFIG_VAR_TX
uint8_t blk_skip[MAX_MB_PLANE][MI_BLOCK_SIZE * MI_BLOCK_SIZE * 4];
uint8_t blk_skip[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 4];
#if CONFIG_REF_MV
uint8_t blk_skip_drl[MAX_MB_PLANE][MI_BLOCK_SIZE * MI_BLOCK_SIZE * 4];
uint8_t blk_skip_drl[MAX_MB_PLANE][MAX_MIB_SIZE * MAX_MIB_SIZE * 4];
#endif
#endif
......
......@@ -276,7 +276,8 @@ static void set_offsets(VP10_COMP *cpi, const TileInfo *const tile,
#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);
xd->max_tx_size = max_txsize_lookup[bsize];
#endif
......@@ -2146,15 +2147,15 @@ static void update_stats(VP10_COMMON *cm, ThreadData *td
}
typedef struct {
ENTROPY_CONTEXT a[2 * MI_BLOCK_SIZE * MAX_MB_PLANE];
ENTROPY_CONTEXT l[2 * MI_BLOCK_SIZE * MAX_MB_PLANE];
PARTITION_CONTEXT sa[MI_BLOCK_SIZE];
PARTITION_CONTEXT sl[MI_BLOCK_SIZE];
ENTROPY_CONTEXT a[2 * MAX_MIB_SIZE * MAX_MB_PLANE];
ENTROPY_CONTEXT l[2 * MAX_MIB_SIZE * MAX_MB_PLANE];
PARTITION_CONTEXT sa[MAX_MIB_SIZE];
PARTITION_CONTEXT sl[MAX_MIB_SIZE];
#if CONFIG_VAR_TX
TXFM_CONTEXT *p_ta;
TXFM_CONTEXT *p_tl;
TXFM_CONTEXT ta[MI_BLOCK_SIZE];
TXFM_CONTEXT tl[MI_BLOCK_SIZE];
TXFM_CONTEXT ta[MAX_MIB_SIZE];
TXFM_CONTEXT tl[MAX_MIB_SIZE];
#endif
} RD_SEARCH_MACROBLOCK_CONTEXT;
......@@ -2175,14 +2176,14 @@ static void restore_context(MACROBLOCK *x,
xd->plane[p].subsampling_x);
memcpy(
xd->left_context[p]
+ ((mi_row & MI_MASK) * 2 >> xd->plane[p].subsampling_y),
+ ((mi_row & MAX_MIB_MASK) * 2 >> xd->plane[p].subsampling_y),
ctx->l + num_4x4_blocks_high * p,
(sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >>
xd->plane[p].subsampling_y);
}
memcpy(xd->above_seg_context + mi_col, ctx->sa,
sizeof(*xd->above_seg_context) * mi_width);
memcpy(xd->left_seg_context + (mi_row & MI_MASK), ctx->sl,
memcpy(xd->left_seg_context + (mi_row & MAX_MIB_MASK), ctx->sl,
sizeof(xd->left_seg_context[0]) * mi_height);
#if CONFIG_VAR_TX
xd->above_txfm_context = ctx->p_ta;
......@@ -2214,13 +2215,13 @@ static void save_context(const MACROBLOCK *x,
memcpy(
ctx->l + num_4x4_blocks_high * p,
xd->left_context[p]
+ ((mi_row & MI_MASK) * 2 >> xd->plane[p].subsampling_y),
+ ((mi_row & MAX_MIB_MASK) * 2 >> xd->plane[p].subsampling_y),
(sizeof(ENTROPY_CONTEXT) * num_4x4_blocks_high) >>
xd->plane[p].subsampling_y);
}
memcpy(ctx->sa, xd->above_seg_context + mi_col,
sizeof(*xd->above_seg_context) * mi_width);
memcpy(ctx->sl, xd->left_seg_context + (mi_row & MI_MASK),
memcpy(ctx->sl, xd->left_seg_context + (mi_row & MAX_MIB_MASK),
sizeof(xd->left_seg_context[0]) * mi_height);
#if CONFIG_VAR_TX
memcpy(ctx->ta, xd->above_txfm_context,
......@@ -2518,9 +2519,9 @@ static void set_partial_b64x64_partition(MODE_INFO *mi, int mis,
BLOCK_SIZE bsize, MODE_INFO **mi_8x8) {
int bh = bh_in;
int r, c;
for (r = 0; r < MI_BLOCK_SIZE; r += bh) {
for (r = 0; r < MAX_MIB_SIZE; r += bh) {
int bw = bw_in;
for (c = 0; c < MI_BLOCK_SIZE; c += bw) {
for (c = 0; c < MAX_MIB_SIZE; c += bw) {
const int index = r * mis + c;
mi_8x8[index] = mi + index;
mi_8x8[index]->mbmi.sb_type = find_partition_size(bsize,
......@@ -2549,10 +2550,10 @@ static void set_fixed_partitioning(VP10_COMP *cpi, const TileInfo *const tile,
assert((row8x8_remaining > 0) && (col8x8_remaining > 0));
// Apply the requested partition size to the SB64 if it is all "in image"
if ((col8x8_remaining >= MI_BLOCK_SIZE) &&
(row8x8_remaining >= MI_BLOCK_SIZE)) {
for (block_row = 0; block_row < MI_BLOCK_SIZE; block_row += bh) {
for (block_col = 0; block_col < MI_BLOCK_SIZE; block_col += bw) {
if ((col8x8_remaining >= MAX_MIB_SIZE) &&
(row8x8_remaining >= MAX_MIB_SIZE)) {
for (block_row = 0; block_row < MAX_MIB_SIZE; block_row += bh) {
for (block_col = 0; block_col < MAX_MIB_SIZE; block_col += bw) {
int index = block_row * mis + block_col;
mi_8x8[index] = mi_upper_left + index;
mi_8x8[index]->mbmi.sb_type = bsize;
......@@ -2621,7 +2622,8 @@ static void rd_use_partition(VP10_COMP *cpi,
#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);
#endif
save_context(x, &x_ctx, mi_row, mi_col, bsize);
......@@ -3013,8 +3015,8 @@ static void get_sb_partition_size_range(MACROBLOCKD *xd, MODE_INFO **mi_8x8,
BLOCK_SIZE *min_block_size,
BLOCK_SIZE *max_block_size,
int bs_hist[BLOCK_SIZES]) {
int sb_width_in_blocks = MI_BLOCK_SIZE;
int sb_height_in_blocks = MI_BLOCK_SIZE;
int sb_width_in_blocks = MAX_MIB_SIZE;
int sb_height_in_blocks = MAX_MIB_SIZE;
int i, j;
int index = 0;
......@@ -3065,13 +3067,13 @@ static void rd_auto_partition_range(VP10_COMP *cpi, const TileInfo *const tile,
}
// Find the min and max partition sizes used in the left SB64
if (left_in_image) {
MODE_INFO **left_sb64_mi = &mi[-MI_BLOCK_SIZE];
MODE_INFO **left_sb64_mi = &mi[-MAX_MIB_SIZE];
get_sb_partition_size_range(xd, left_sb64_mi, &min_size, &max_size,
bs_hist);
}
// Find the min and max partition sizes used in the above SB64.
if (above_in_image) {
MODE_INFO **above_sb64_mi = &mi[-xd->mi_stride * MI_BLOCK_SIZE];
MODE_INFO **above_sb64_mi = &mi[-xd->mi_stride * MAX_MIB_SIZE];
get_sb_partition_size_range(xd, above_sb64_mi, &min_size, &max_size,
bs_hist);
}
......@@ -3508,7 +3510,8 @@ static void rd_pick_partition(VP10_COMP *cpi, ThreadData *td,
#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);
#endif
save_context(x, &x_ctx, mi_row, mi_col, bsize);
......@@ -4239,7 +4242,7 @@ static void encode_rd_sb_row(VP10_COMP *cpi,
// Code each SB in the row
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) {
const struct segmentation *const seg = &cm->seg;
int dummy_rate;
int64_t dummy_dist;
......@@ -4476,7 +4479,7 @@ void vp10_encode_tile(VP10_COMP *cpi, ThreadData *td,
td->mb.ex_search_count_ptr = &td->rd_counts.ex_search_count;
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) {
encode_rd_sb_row(cpi, td, this_tile, mi_row, &tok);
}
......@@ -4848,7 +4851,8 @@ static void tx_partition_count_update(VP10_COMMON *cm,
int idx, idy;
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);
for (idy = 0; idy < mi_height; idy += bh)
for (idx = 0; idx < mi_width; idx += bh)
......@@ -4913,7 +4917,8 @@ static void tx_partition_set_contexts(VP10_COMMON *cm,
int idx, idy;
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);
for (idy = 0; idy < mi_height; idy += bh)
for (idx = 0; idx < mi_width; idx += bh)
......@@ -6112,8 +6117,8 @@ static void rd_supertx_sb(VP10_COMP *cpi, ThreadData *td,
sse_uv = 0;
for (plane = 1; plane < MAX_MB_PLANE; ++plane) {
#if CONFIG_VAR_TX
ENTROPY_CONTEXT ctxa[2 * MI_BLOCK_SIZE];
ENTROPY_CONTEXT ctxl[2 * MI_BLOCK_SIZE];
ENTROPY_CONTEXT ctxa[2 * MAX_MIB_SIZE];
ENTROPY_CONTEXT ctxl[2 * MAX_MIB_SIZE];
const struct macroblockd_plane *const pd = &xd->plane[plane];
int coeff_ctx = 1;
......@@ -6157,8 +6162,8 @@ static void rd_supertx_sb(VP10_COMP *cpi, ThreadData *td,
#endif // CONFIG_EXT_TX
for (tx_type = DCT_DCT; tx_type < TX_TYPES; ++tx_type) {
#if CONFIG_VAR_TX
ENTROPY_CONTEXT ctxa[2 * MI_BLOCK_SIZE];
ENTROPY_CONTEXT ctxl[2 * MI_BLOCK_SIZE];
ENTROPY_CONTEXT ctxa[2 * MAX_MIB_SIZE];
ENTROPY_CONTEXT ctxl[2 * MAX_MIB_SIZE];
const struct macroblockd_plane *const pd = &xd->plane[0];
int coeff_ctx = 1;
#endif // CONFIG_VAR_TX
......
......@@ -29,8 +29,8 @@
#include "vp10/encoder/tokenize.h"
struct optimize_ctx {
ENTROPY_CONTEXT ta[MAX_MB_PLANE][2 * MI_BLOCK_SIZE];
ENTROPY_CONTEXT tl[MAX_MB_PLANE][2 * MI_BLOCK_SIZE];
ENTROPY_CONTEXT ta[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
ENTROPY_CONTEXT tl[MAX_MB_PLANE][2 * MAX_MIB_SIZE];
};
void vp10_subtract_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) {
......
......@@ -789,8 +789,8 @@ void vp10_new_framerate(VP10_COMP *cpi, double framerate) {
static void set_tile_limits(VP10_COMP *cpi) {
VP10_COMMON *const cm = &cpi->common;
#if CONFIG_EXT_TILE
cm->tile_width = clamp(cpi->oxcf.tile_columns, 1, 64) << MI_BLOCK_SIZE_LOG2;
cm->tile_height = clamp(cpi->oxcf.tile_rows, 1, 64) << MI_BLOCK_SIZE_LOG2;
cm->tile_width = clamp(cpi->oxcf.tile_columns, 1, 64) << MAX_MIB_SIZE_LOG2;
cm->tile_height = clamp(cpi->oxcf.tile_rows, 1, 64) << MAX_MIB_SIZE_LOG2;
cm->tile_width = VPXMIN(cm->tile_width, cm->mi_cols);
cm->tile_height = VPXMIN(cm->tile_height, cm->mi_rows);
......
......@@ -563,8 +563,8 @@ void vp10_model_rd_from_var_lapndz(unsigned int var, unsigned int n_log2,
void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
const struct macroblockd_plane *pd,
ENTROPY_CONTEXT t_above[2 * MI_BLOCK_SIZE],
ENTROPY_CONTEXT t_left[2 * MI_BLOCK_SIZE]) {
ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE],
ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]) {
const BLOCK_SIZE plane_bsize = get_plane_block_size(bsize, pd);
const int num_4x4_w = num_4x4_blocks_wide_lookup[plane_bsize];
const int num_4x4_h = num_4x4_blocks_high_lookup[plane_bsize];
......
......@@ -330,8 +330,8 @@ void vp10_set_mvcost(MACROBLOCK *x, MV_REFERENCE_FRAME ref_frame);
void vp10_get_entropy_contexts(BLOCK_SIZE bsize, TX_SIZE tx_size,
const struct macroblockd_plane *pd,
ENTROPY_CONTEXT t_above[2 * MI_BLOCK_SIZE],
ENTROPY_CONTEXT t_left[2 * MI_BLOCK_SIZE]);
ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE],
ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE]);
void vp10_set_rd_speed_thresholds(struct VP10_COMP *cpi);
......
......@@ -102,8 +102,8 @@ typedef struct {
struct rdcost_block_args {
const VP10_COMP *cpi;
MACROBLOCK *x;
ENTROPY_CONTEXT t_above[2 * MI_BLOCK_SIZE];
ENTROPY_CONTEXT t_left[2 * MI_BLOCK_SIZE];
ENTROPY_CONTEXT t_above[2 * MAX_MIB_SIZE];
ENTROPY_CONTEXT t_left[2 * MAX_MIB_SIZE];
int this_rate;
int64_t this_dist;
int64_t this_sse;
......@@ -2957,8 +2957,8 @@ static void select_tx_block(const VP10_COMP *cpi, MACROBLOCK *x,
struct macroblockd_plane *const pd = &xd->plane[plane];
const int tx_row = blk_row >> (1 - pd->subsampling_y);
const int tx_col = blk_col >> (1 - pd->subsampling_x);