Commit 6906d218 authored by Yunqing Wang's avatar Yunqing Wang
Browse files

vp9_ethread: include a pointer to mb in VP9_COMP

Modified VP9_COMP struct to include MACROBLOCK *mb. This change
makes it feasible in multi-thread case to allocate a mb for each
thread.

Change-Id: I624d6d1aa9c132362200753e5d90b581b1738d6e
parent 807885b5
......@@ -238,7 +238,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi,
vp9_writer *w) {
VP9_COMMON *const cm = &cpi->common;
const nmv_context *nmvc = &cm->fc->nmvc;
const MACROBLOCK *const x = &cpi->mb;
const MACROBLOCK *const x = cpi->mb;
const MACROBLOCKD *const xd = &x->e_mbd;
const struct segmentation *const seg = &cm->seg;
const MB_MODE_INFO *const mbmi = &mi->mbmi;
......@@ -382,7 +382,7 @@ static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile,
const TOKENEXTRA *const tok_end,
int mi_row, int mi_col) {
const VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MACROBLOCKD *const xd = &cpi->mb->e_mbd;
MODE_INFO *m;
xd->mi = cm->mi + (mi_row * cm->mi_stride + mi_col);
......@@ -429,7 +429,7 @@ static void write_modes_sb(VP9_COMP *cpi,
TOKENEXTRA **tok, const TOKENEXTRA *const tok_end,
int mi_row, int mi_col, BLOCK_SIZE bsize) {
const VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MACROBLOCKD *const xd = &cpi->mb->e_mbd;
const int bsl = b_width_log2_lookup[bsize];
const int bs = (1 << bsl) / 4;
......@@ -489,7 +489,7 @@ static void write_modes(VP9_COMP *cpi,
for (mi_row = tile->mi_row_start; mi_row < tile->mi_row_end;
mi_row += MI_BLOCK_SIZE) {
vp9_zero(cpi->mb.e_mbd.left_seg_context);
vp9_zero(cpi->mb->e_mbd.left_seg_context);
for (mi_col = tile->mi_col_start; mi_col < tile->mi_col_end;
mi_col += MI_BLOCK_SIZE)
write_modes_sb(cpi, tile, w, tok, tok_end, mi_row, mi_col,
......@@ -1150,14 +1150,14 @@ static void write_uncompressed_header(VP9_COMP *cpi,
encode_loopfilter(&cm->lf, wb);
encode_quantization(cm, wb);
encode_segmentation(cm, &cpi->mb.e_mbd, wb);
encode_segmentation(cm, &cpi->mb->e_mbd, wb);
write_tile_info(cm, wb);
}
static size_t write_compressed_header(VP9_COMP *cpi, uint8_t *data) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MACROBLOCKD *const xd = &cpi->mb->e_mbd;
FRAME_CONTEXT *const fc = cm->fc;
vp9_writer header_bc;
......
......@@ -157,7 +157,7 @@ static unsigned int get_sby_perpixel_diff_variance(VP9_COMP *cpi,
static BLOCK_SIZE get_rd_var_based_fixed_partition(VP9_COMP *cpi,
int mi_row,
int mi_col) {
unsigned int var = get_sby_perpixel_diff_variance(cpi, &cpi->mb.plane[0].src,
unsigned int var = get_sby_perpixel_diff_variance(cpi, &cpi->mb->plane[0].src,
mi_row, mi_col,
BLOCK_64X64);
if (var < 8)
......@@ -173,7 +173,7 @@ static BLOCK_SIZE get_rd_var_based_fixed_partition(VP9_COMP *cpi,
static BLOCK_SIZE get_nonrd_var_based_fixed_partition(VP9_COMP *cpi,
int mi_row,
int mi_col) {
unsigned int var = get_sby_perpixel_diff_variance(cpi, &cpi->mb.plane[0].src,
unsigned int var = get_sby_perpixel_diff_variance(cpi, &cpi->mb->plane[0].src,
mi_row, mi_col,
BLOCK_64X64);
if (var < 4)
......@@ -197,7 +197,7 @@ static INLINE void set_modeinfo_offsets(VP9_COMMON *const cm,
static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile,
int mi_row, int mi_col, BLOCK_SIZE bsize) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi;
......@@ -266,7 +266,7 @@ static void set_block_size(VP9_COMP * const cpi,
int mi_row, int mi_col,
BLOCK_SIZE bsize) {
if (cpi->common.mi_cols > mi_col && cpi->common.mi_rows > mi_row) {
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MACROBLOCKD *const xd = &cpi->mb->e_mbd;
set_modeinfo_offsets(&cpi->common, xd, mi_row, mi_col);
xd->mi[0].src_mi->mbmi.sb_type = bsize;
duplicate_mode_info_in_sb(&cpi->common, xd, mi_row, mi_col, bsize);
......@@ -457,8 +457,8 @@ static void choose_partitioning(VP9_COMP *cpi,
const TileInfo *const tile,
int mi_row, int mi_col) {
VP9_COMMON * const cm = &cpi->common;
MACROBLOCK *x = &cpi->mb;
MACROBLOCKD *xd = &cpi->mb.e_mbd;
MACROBLOCK *x = cpi->mb;
MACROBLOCKD *xd = &cpi->mb->e_mbd;
int i, j, k;
v64x64 vt;
......@@ -603,7 +603,7 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
int i, x_idx, y;
VP9_COMMON *const cm = &cpi->common;
RD_OPT *const rd_opt = &cpi->rd;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
struct macroblock_plane *const p = x->plane;
struct macroblockd_plane *const pd = xd->plane;
......@@ -800,7 +800,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi,
int64_t best_rd) {
VP9_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi;
struct macroblock_plane *const p = x->plane;
......@@ -959,7 +959,7 @@ static void restore_context(VP9_COMP *cpi, int mi_row, int mi_col,
ENTROPY_CONTEXT l[16 * MAX_MB_PLANE],
PARTITION_CONTEXT sa[8], PARTITION_CONTEXT sl[8],
BLOCK_SIZE bsize) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
int p;
const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
......@@ -990,7 +990,7 @@ static void save_context(VP9_COMP *cpi, int mi_row, int mi_col,
ENTROPY_CONTEXT l[16 * MAX_MB_PLANE],
PARTITION_CONTEXT sa[8], PARTITION_CONTEXT sl[8],
BLOCK_SIZE bsize) {
const MACROBLOCK *const x = &cpi->mb;
const MACROBLOCK *const x = cpi->mb;
const MACROBLOCKD *const xd = &x->e_mbd;
int p;
const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize];
......@@ -1027,7 +1027,7 @@ static void encode_b(VP9_COMP *cpi, const TileInfo *const tile,
encode_superblock(cpi, tp, output_enabled, mi_row, mi_col, bsize, ctx);
if (output_enabled) {
update_stats(&cpi->common, &cpi->mb);
update_stats(&cpi->common, cpi->mb);
(*tp)->token = EOSB_TOKEN;
(*tp)++;
......@@ -1039,7 +1039,7 @@ static void encode_sb(VP9_COMP *cpi, const TileInfo *const tile,
int output_enabled, BLOCK_SIZE bsize,
PC_TREE *pc_tree) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4;
......@@ -1198,7 +1198,7 @@ static void set_source_var_based_partition(VP9_COMP *cpi,
MODE_INFO *mi_8x8,
int mi_row, int mi_col) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
const int mis = cm->mi_stride;
const int row8x8_remaining = tile->mi_row_end - mi_row;
const int col8x8_remaining = tile->mi_col_end - mi_col;
......@@ -1282,7 +1282,7 @@ static void set_source_var_based_partition(VP9_COMP *cpi,
static void update_state_rt(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx,
int mi_row, int mi_col, int bsize) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *const mi = xd->mi[0].src_mi;
MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
......@@ -1347,13 +1347,13 @@ static void encode_b_rt(VP9_COMP *cpi, const TileInfo *const tile,
#if CONFIG_VP9_TEMPORAL_DENOISING
if (cpi->oxcf.noise_sensitivity > 0 && output_enabled) {
vp9_denoiser_denoise(&cpi->denoiser, &cpi->mb, mi_row, mi_col,
vp9_denoiser_denoise(&cpi->denoiser, cpi->mb, mi_row, mi_col,
MAX(BLOCK_8X8, bsize), ctx);
}
#endif
encode_superblock(cpi, tp, output_enabled, mi_row, mi_col, bsize, ctx);
update_stats(&cpi->common, &cpi->mb);
update_stats(&cpi->common, cpi->mb);
(*tp)->token = EOSB_TOKEN;
(*tp)++;
......@@ -1364,7 +1364,7 @@ static void encode_sb_rt(VP9_COMP *cpi, const TileInfo *const tile,
int output_enabled, BLOCK_SIZE bsize,
PC_TREE *pc_tree) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4;
......@@ -1439,7 +1439,7 @@ static void rd_use_partition(VP9_COMP *cpi,
int do_recon, PC_TREE *pc_tree) {
VP9_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int mis = cm->mi_stride;
const int bsl = b_width_log2_lookup[bsize];
......@@ -1768,7 +1768,7 @@ static void rd_auto_partition_range(VP9_COMP *cpi, const TileInfo *const tile,
BLOCK_SIZE *min_block_size,
BLOCK_SIZE *max_block_size) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MACROBLOCKD *const xd = &cpi->mb->e_mbd;
MODE_INFO *mi = xd->mi[0].src_mi;
const int left_in_image = xd->left_available && mi[-1].src_mi;
const int above_in_image = xd->up_available && mi[-xd->mi_stride].src_mi;
......@@ -1864,7 +1864,7 @@ static void auto_partition_range(VP9_COMP *cpi, const TileInfo *const tile,
BLOCK_SIZE *min_block_size,
BLOCK_SIZE *max_block_size) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MACROBLOCKD *const xd = &cpi->mb->e_mbd;
MODE_INFO *mi_8x8 = xd->mi;
const int left_in_image = xd->left_available && mi_8x8[-1].src_mi;
const int above_in_image = xd->up_available &&
......@@ -2039,7 +2039,7 @@ static void rd_pick_partition(VP9_COMP *cpi,
int64_t best_rd, PC_TREE *pc_tree) {
VP9_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int mi_step = num_8x8_blocks_wide_lookup[bsize] / 2;
ENTROPY_CONTEXT l[16 * MAX_MB_PLANE], a[16 * MAX_MB_PLANE];
......@@ -2114,7 +2114,7 @@ static void rd_pick_partition(VP9_COMP *cpi,
#if CONFIG_FP_MB_STATS
if (cpi->use_fp_mb_stats) {
set_offsets(cpi, tile_info, mi_row, mi_col, bsize);
src_diff_var = get_sby_perpixel_diff_variance(cpi, &cpi->mb.plane[0].src,
src_diff_var = get_sby_perpixel_diff_variance(cpi, &cpi->mb->plane[0].src,
mi_row, mi_col, bsize);
}
#endif
......@@ -2244,7 +2244,7 @@ static void rd_pick_partition(VP9_COMP *cpi,
if (src_diff_var == UINT_MAX) {
set_offsets(cpi, tile_info, mi_row, mi_col, bsize);
src_diff_var = get_sby_perpixel_diff_variance(
cpi, &cpi->mb.plane[0].src, mi_row, mi_col, bsize);
cpi, &cpi->mb->plane[0].src, mi_row, mi_col, bsize);
}
if (src_diff_var < 8) {
do_split = 0;
......@@ -2456,7 +2456,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi,
TOKENEXTRA **tp) {
VP9_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MACROBLOCKD *const xd = &cpi->mb->e_mbd;
SPEED_FEATURES *const sf = &cpi->sf;
int mi_col;
......@@ -2487,10 +2487,10 @@ static void encode_rd_sb_row(VP9_COMP *cpi,
}
}
vp9_zero(cpi->mb.pred_mv);
vp9_zero(cpi->mb->pred_mv);
cpi->pc_root->index = 0;
cpi->mb.source_variance = UINT_MAX;
cpi->mb->source_variance = UINT_MAX;
if (sf->partition_search_type == FIXED_PARTITION) {
set_offsets(cpi, tile_info, mi_row, mi_col, BLOCK_64X64);
set_fixed_partitioning(cpi, tile_info, mi, mi_row, mi_col,
......@@ -2524,7 +2524,7 @@ static void encode_rd_sb_row(VP9_COMP *cpi,
}
static void init_encode_frame_mb_context(VP9_COMP *cpi) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
const int aligned_mi_cols = mi_cols_aligned_to_sb(cm->mi_cols);
......@@ -2579,7 +2579,7 @@ static MV_REFERENCE_FRAME get_frame_type(const VP9_COMP *cpi) {
}
static TX_MODE select_tx_mode(const VP9_COMP *cpi) {
if (cpi->mb.e_mbd.lossless)
if (cpi->mb->e_mbd.lossless)
return ONLY_4X4;
if (cpi->sf.tx_size_search_method == USE_LARGESTALL)
return ALLOW_32X32;
......@@ -2596,7 +2596,7 @@ static void nonrd_pick_sb_modes(VP9_COMP *cpi,
BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx) {
VP9_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MB_MODE_INFO *mbmi;
set_offsets(cpi, tile_info, mi_row, mi_col, bsize);
......@@ -2705,7 +2705,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi,
const VP9EncoderConfig *const oxcf = &cpi->oxcf;
VP9_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int ms = num_8x8_blocks_wide_lookup[bsize] / 2;
TOKENEXTRA *tp_orig = *tp;
......@@ -2964,7 +2964,7 @@ static void nonrd_select_partition(VP9_COMP *cpi,
RD_COST *rd_cost, PC_TREE *pc_tree) {
VP9_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4;
const int mis = cm->mi_stride;
......@@ -3092,7 +3092,7 @@ static void nonrd_use_partition(VP9_COMP *cpi,
RD_COST *rd_cost, PC_TREE *pc_tree) {
VP9_COMMON *const cm = &cpi->common;
TileInfo *tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const int bsl = b_width_log2_lookup[bsize], hbs = (1 << bsl) / 4;
const int mis = cm->mi_stride;
......@@ -3222,7 +3222,7 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi,
SPEED_FEATURES *const sf = &cpi->sf;
VP9_COMMON *const cm = &cpi->common;
TileInfo *const tile_info = &tile_data->tile_info;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
int mi_col;
......@@ -3492,7 +3492,7 @@ static int input_fpmb_stats(FIRSTPASS_MB_STATS *firstpass_mb_stats,
static void encode_frame_internal(VP9_COMP *cpi) {
SPEED_FEATURES *const sf = &cpi->sf;
RD_OPT *const rd_opt = &cpi->rd;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
......@@ -3675,7 +3675,7 @@ void vp9_encode_frame(VP9_COMP *cpi) {
for (i = 0; i < TX_MODES; ++i) {
int64_t pd = rd_opt->tx_select_diff[i];
if (i == TX_MODE_SELECT)
pd -= RDCOST(cpi->mb.rdmult, cpi->mb.rddiv, 2048 * (TX_SIZES - 1), 0);
pd -= RDCOST(cpi->mb->rdmult, cpi->mb->rddiv, 2048 * (TX_SIZES - 1), 0);
tx_thrs[i] = (tx_thrs[i] + (int)(pd / cm->MBs)) / 2;
}
......@@ -3779,7 +3779,7 @@ static void encode_superblock(VP9_COMP *cpi, TOKENEXTRA **t, int output_enabled,
int mi_row, int mi_col, BLOCK_SIZE bsize,
PICK_MODE_CONTEXT *ctx) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
MODE_INFO *mi_8x8 = xd->mi;
MODE_INFO *mi = mi_8x8;
......
......@@ -103,7 +103,7 @@ static INLINE void Scale2Ratio(VPX_SCALING mode, int *hr, int *hs) {
}
void vp9_set_high_precision_mv(VP9_COMP *cpi, int allow_high_precision_mv) {
MACROBLOCK *const mb = &cpi->mb;
MACROBLOCK *const mb = cpi->mb;
cpi->common.allow_high_precision_mv = allow_high_precision_mv;
if (cpi->common.allow_high_precision_mv) {
mb->mvcost = mb->nmvcost_hp;
......@@ -252,6 +252,9 @@ static void dealloc_compressor_data(VP9_COMP *cpi) {
vp9_free_pc_tree(cpi);
vpx_free(cpi->mb);
cpi->mb = NULL;
for (i = 0; i < cpi->svc.number_spatial_layers; ++i) {
LAYER_CONTEXT *const lc = &cpi->svc.layer_context[i];
vpx_free(lc->rc_twopass_stats_in.buf);
......@@ -282,7 +285,7 @@ static void save_coding_context(VP9_COMP *cpi) {
// restored with a call to vp9_restore_coding_context. These functions are
// intended for use in a re-code loop in vp9_compress_frame where the
// quantizer value is adjusted between loop iterations.
vp9_copy(cc->nmvjointcost, cpi->mb.nmvjointcost);
vp9_copy(cc->nmvjointcost, cpi->mb->nmvjointcost);
vpx_memcpy(cc->nmvcosts[0], cpi->nmvcosts[0],
MV_VALS * sizeof(*cpi->nmvcosts[0]));
......@@ -310,7 +313,7 @@ static void restore_coding_context(VP9_COMP *cpi) {
// Restore key state variables to the snapshot state stored in the
// previous call to vp9_save_coding_context.
vp9_copy(cpi->mb.nmvjointcost, cc->nmvjointcost);
vp9_copy(cpi->mb->nmvjointcost, cc->nmvjointcost);
vpx_memcpy(cpi->nmvcosts[0], cc->nmvcosts[0],
MV_VALS * sizeof(*cc->nmvcosts[0]));
......@@ -543,6 +546,9 @@ void vp9_alloc_compressor_data(VP9_COMP *cpi) {
vp9_alloc_context_buffers(cm, cm->width, cm->height);
vpx_free(cpi->mb);
CHECK_MEM_ERROR(cm, cpi->mb, vpx_calloc(1, sizeof(*cpi->mb)));
vpx_free(cpi->tok);
{
......@@ -550,12 +556,12 @@ void vp9_alloc_compressor_data(VP9_COMP *cpi) {
CHECK_MEM_ERROR(cm, cpi->tok, vpx_calloc(tokens, sizeof(*cpi->tok)));
}
vp9_setup_pc_tree(&cpi->common, cpi);
vp9_setup_pc_tree(cm, cpi);
}
static void update_frame_size(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MACROBLOCKD *const xd = &cpi->mb->e_mbd;
vp9_set_mb_mi(cm, cm->width, cm->height);
vp9_init_context_buffers(cm);
......@@ -1269,7 +1275,7 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9EncoderConfig *oxcf) {
cpi->oxcf = *oxcf;
#if CONFIG_VP9_HIGHBITDEPTH
cpi->mb.e_mbd.bd = (int)cm->bit_depth;
cpi->mb->e_mbd.bd = (int)cm->bit_depth;
#endif // CONFIG_VP9_HIGHBITDEPTH
rc->baseline_gf_interval = DEFAULT_GF_INTERVAL;
......@@ -1531,18 +1537,18 @@ VP9_COMP *vp9_create_compressor(VP9EncoderConfig *oxcf) {
cpi->first_time_stamp_ever = INT64_MAX;
cal_nmvjointsadcost(cpi->mb.nmvjointsadcost);
cpi->mb.nmvcost[0] = &cpi->nmvcosts[0][MV_MAX];
cpi->mb.nmvcost[1] = &cpi->nmvcosts[1][MV_MAX];
cpi->mb.nmvsadcost[0] = &cpi->nmvsadcosts[0][MV_MAX];
cpi->mb.nmvsadcost[1] = &cpi->nmvsadcosts[1][MV_MAX];
cal_nmvsadcosts(cpi->mb.nmvsadcost);
cal_nmvjointsadcost(cpi->mb->nmvjointsadcost);
cpi->mb->nmvcost[0] = &cpi->nmvcosts[0][MV_MAX];
cpi->mb->nmvcost[1] = &cpi->nmvcosts[1][MV_MAX];
cpi->mb->nmvsadcost[0] = &cpi->nmvsadcosts[0][MV_MAX];
cpi->mb->nmvsadcost[1] = &cpi->nmvsadcosts[1][MV_MAX];
cal_nmvsadcosts(cpi->mb->nmvsadcost);
cpi->mb.nmvcost_hp[0] = &cpi->nmvcosts_hp[0][MV_MAX];
cpi->mb.nmvcost_hp[1] = &cpi->nmvcosts_hp[1][MV_MAX];
cpi->mb.nmvsadcost_hp[0] = &cpi->nmvsadcosts_hp[0][MV_MAX];
cpi->mb.nmvsadcost_hp[1] = &cpi->nmvsadcosts_hp[1][MV_MAX];
cal_nmvsadcosts_hp(cpi->mb.nmvsadcost_hp);
cpi->mb->nmvcost_hp[0] = &cpi->nmvcosts_hp[0][MV_MAX];
cpi->mb->nmvcost_hp[1] = &cpi->nmvcosts_hp[1][MV_MAX];
cpi->mb->nmvsadcost_hp[0] = &cpi->nmvsadcosts_hp[0][MV_MAX];
cpi->mb->nmvsadcost_hp[1] = &cpi->nmvsadcosts_hp[1][MV_MAX];
cal_nmvsadcosts_hp(cpi->mb->nmvsadcost_hp);
#if CONFIG_VP9_TEMPORAL_DENOISING
#ifdef OUTPUT_YUV_DENOISED
......@@ -2041,7 +2047,7 @@ static void generate_psnr_packet(VP9_COMP *cpi) {
PSNR_STATS psnr;
#if CONFIG_VP9_HIGHBITDEPTH
calc_highbd_psnr(cpi->Source, cpi->common.frame_to_show, &psnr,
cpi->mb.e_mbd.bd, cpi->oxcf.input_bit_depth);
cpi->mb->e_mbd.bd, cpi->oxcf.input_bit_depth);
#else
calc_psnr(cpi->Source, cpi->common.frame_to_show, &psnr);
#endif
......@@ -2422,7 +2428,7 @@ void vp9_update_reference_frames(VP9_COMP *cpi) {
}
static void loopfilter_frame(VP9_COMP *cpi, VP9_COMMON *cm) {
MACROBLOCKD *xd = &cpi->mb.e_mbd;
MACROBLOCKD *xd = &cpi->mb->e_mbd;
struct loopfilter *lf = &cm->lf;
if (xd->lossless) {
lf->filter_level = 0;
......@@ -2687,7 +2693,7 @@ void set_frame_size(VP9_COMP *cpi) {
int ref_frame;
VP9_COMMON *const cm = &cpi->common;
const VP9EncoderConfig *const oxcf = &cpi->oxcf;
MACROBLOCKD *const xd = &cpi->mb.e_mbd;
MACROBLOCKD *const xd = &cpi->mb->e_mbd;
if (oxcf->pass == 2 &&
cm->current_video_frame == 0 &&
......@@ -3734,15 +3740,15 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
const int lossless = is_lossless_requested(oxcf);
#if CONFIG_VP9_HIGHBITDEPTH
if (cpi->oxcf.use_highbitdepth)
cpi->mb.fwd_txm4x4 = lossless ? vp9_highbd_fwht4x4 : vp9_highbd_fdct4x4;
cpi->mb->fwd_txm4x4 = lossless ? vp9_highbd_fwht4x4 : vp9_highbd_fdct4x4;
else
cpi->mb.fwd_txm4x4 = lossless ? vp9_fwht4x4 : vp9_fdct4x4;
cpi->mb.highbd_itxm_add = lossless ? vp9_highbd_iwht4x4_add :
cpi->mb->fwd_txm4x4 = lossless ? vp9_fwht4x4 : vp9_fdct4x4;
cpi->mb->highbd_itxm_add = lossless ? vp9_highbd_iwht4x4_add :
vp9_highbd_idct4x4_add;
#else
cpi->mb.fwd_txm4x4 = lossless ? vp9_fwht4x4 : vp9_fdct4x4;
cpi->mb->fwd_txm4x4 = lossless ? vp9_fwht4x4 : vp9_fdct4x4;
#endif // CONFIG_VP9_HIGHBITDEPTH
cpi->mb.itxm_add = lossless ? vp9_iwht4x4_add : vp9_idct4x4_add;
cpi->mb->itxm_add = lossless ? vp9_iwht4x4_add : vp9_idct4x4_add;
vp9_first_pass(cpi, source);
} else if (oxcf->pass == 2 &&
(!cpi->use_svc || is_two_pass_svc(cpi))) {
......@@ -3795,7 +3801,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
YV12_BUFFER_CONFIG *pp = &cm->post_proc_buffer;
PSNR_STATS psnr;
#if CONFIG_VP9_HIGHBITDEPTH
calc_highbd_psnr(orig, recon, &psnr, cpi->mb.e_mbd.bd,
calc_highbd_psnr(orig, recon, &psnr, cpi->mb->e_mbd.bd,
cpi->oxcf.input_bit_depth);
#else
calc_psnr(orig, recon, &psnr);
......@@ -3820,7 +3826,7 @@ int vp9_get_compressed_data(VP9_COMP *cpi, unsigned int *frame_flags,
vp9_clear_system_state();
#if CONFIG_VP9_HIGHBITDEPTH
calc_highbd_psnr(orig, pp, &psnr, cpi->mb.e_mbd.bd,
calc_highbd_psnr(orig, pp, &psnr, cpi->mb->e_mbd.bd,
cpi->oxcf.input_bit_depth);
#else
calc_psnr(orig, pp, &psnr2);
......
......@@ -243,7 +243,7 @@ typedef struct TileDataEnc {
typedef struct VP9_COMP {
QUANTS quants;
MACROBLOCK mb;
MACROBLOCK *mb;
VP9_COMMON common;
VP9EncoderConfig oxcf;
struct lookahead_ctx *lookahead;
......
......@@ -450,7 +450,7 @@ static void set_first_pass_params(VP9_COMP *cpi) {
void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) {
int mb_row, mb_col;
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
VP9_COMMON *const cm = &cpi->common;
MACROBLOCKD *const xd = &x->e_mbd;
TileInfo tile;
......
......@@ -24,7 +24,7 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
MV *dst_mv,
int mb_row,
int mb_col) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
const MV_SPEED_FEATURES *const mv_sf = &cpi->sf.mv;
const vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[BLOCK_16X16];
......@@ -80,7 +80,7 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
static int do_16x16_motion_search(VP9_COMP *cpi, const MV *ref_mv,
int_mv *dst_mv, int mb_row, int mb_col) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
unsigned int err, tmp_err;
MV tmp_mv;
......@@ -117,7 +117,7 @@ static int do_16x16_motion_search(VP9_COMP *cpi, const MV *ref_mv,
}
static int do_16x16_zerozero_search(VP9_COMP *cpi, int_mv *dst_mv) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
unsigned int err;
......@@ -131,7 +131,7 @@ static int do_16x16_zerozero_search(VP9_COMP *cpi, int_mv *dst_mv) {
return err;
}
static int find_best_16x16_intra(VP9_COMP *cpi, PREDICTION_MODE *pbest_mode) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
PREDICTION_MODE best_mode = -1, mode;
unsigned int best_err = INT_MAX;
......@@ -174,7 +174,7 @@ static void update_mbgraph_mb_stats
int mb_row,
int mb_col
) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
int intra_error;
VP9_COMMON *cm = &cpi->common;
......@@ -229,7 +229,7 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi,
YV12_BUFFER_CONFIG *buf,
YV12_BUFFER_CONFIG *golden_ref,
YV12_BUFFER_CONFIG *alt_ref) {
MACROBLOCK *const x = &cpi->mb;
MACROBLOCK *const x = cpi->mb;
MACROBLOCKD *const xd = &x->e_mbd;
VP9_COMMON *const cm = &cpi->common;
......
......@@ -38,7 +38,7 @@ static int try_filter_frame(const YV12_BUFFER_CONFIG *sd, VP9_COMP *const cpi,
VP9_COMMON *const cm = &cpi->common;
int filt_err;
vp9_loop_filter_frame(cm->frame_to_show, cm, &cpi->mb.e_mbd, filt_level, 1,
vp9_loop_filter_frame(cm->frame_to_show, cm, &cpi->mb->e_mbd, filt_level, 1,
partial_frame);
#if CONFIG_VP9_HIGHBITDEPTH
if (cm->use_highbitdepth) {
......