ref: 6906d218ddd1af97228a797f4558e402231d94f1
parent: 807885b5e01f0f00edba27b611b9a0cfd49b5796
author: Yunqing Wang <[email protected]>
date: Fri Nov 14 07:31:06 EST 2014
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
--- a/vp9/encoder/vp9_bitstream.c
+++ b/vp9/encoder/vp9_bitstream.c
@@ -238,7 +238,7 @@
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 @@
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 @@
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 @@
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,7 +1150,7 @@
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);
}
@@ -1157,7 +1157,7 @@
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;
--- a/vp9/encoder/vp9_encodeframe.c
+++ b/vp9/encoder/vp9_encodeframe.c
@@ -157,7 +157,7 @@
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_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 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 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 @@
#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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
#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 @@
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 @@
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 @@
}
}
- 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 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 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 @@
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 @@
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 @@
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 @@
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 @@
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 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 @@
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 @@
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;
--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -103,7 +103,7 @@
}
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 @@
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 @@
// 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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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);
--- a/vp9/encoder/vp9_encoder.h
+++ b/vp9/encoder/vp9_encoder.h
@@ -243,7 +243,7 @@
typedef struct VP9_COMP {
QUANTS quants;
- MACROBLOCK mb;
+ MACROBLOCK *mb;
VP9_COMMON common;
VP9EncoderConfig oxcf;
struct lookahead_ctx *lookahead;
--- a/vp9/encoder/vp9_firstpass.c
+++ b/vp9/encoder/vp9_firstpass.c
@@ -450,7 +450,7 @@
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;
--- a/vp9/encoder/vp9_mbgraph.c
+++ b/vp9/encoder/vp9_mbgraph.c
@@ -24,7 +24,7 @@
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 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_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 @@
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 @@
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 @@
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;
--- a/vp9/encoder/vp9_picklpf.c
+++ b/vp9/encoder/vp9_picklpf.c
@@ -38,7 +38,7 @@
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) {
--- a/vp9/encoder/vp9_quantize.c
+++ b/vp9/encoder/vp9_quantize.c
@@ -701,7 +701,7 @@
void vp9_frame_init_quantizer(VP9_COMP *cpi) {
cpi->zbin_mode_boost = 0;
- vp9_init_plane_quantizers(cpi, &cpi->mb);
+ vp9_init_plane_quantizers(cpi, cpi->mb);
}
void vp9_set_quantizer(VP9_COMMON *cm, int q) {
--- a/vp9/encoder/vp9_rd.c
+++ b/vp9/encoder/vp9_rd.c
@@ -208,23 +208,23 @@
#if CONFIG_VP9_HIGHBITDEPTH
switch (cpi->common.bit_depth) {
case VPX_BITS_8:
- cpi->mb.sadperbit16 = sad_per_bit16lut_8[qindex];
- cpi->mb.sadperbit4 = sad_per_bit4lut_8[qindex];
+ cpi->mb->sadperbit16 = sad_per_bit16lut_8[qindex];
+ cpi->mb->sadperbit4 = sad_per_bit4lut_8[qindex];
break;
case VPX_BITS_10:
- cpi->mb.sadperbit16 = sad_per_bit16lut_10[qindex];
- cpi->mb.sadperbit4 = sad_per_bit4lut_10[qindex];
+ cpi->mb->sadperbit16 = sad_per_bit16lut_10[qindex];
+ cpi->mb->sadperbit4 = sad_per_bit4lut_10[qindex];
break;
case VPX_BITS_12:
- cpi->mb.sadperbit16 = sad_per_bit16lut_12[qindex];
- cpi->mb.sadperbit4 = sad_per_bit4lut_12[qindex];
+ cpi->mb->sadperbit16 = sad_per_bit16lut_12[qindex];
+ cpi->mb->sadperbit4 = sad_per_bit4lut_12[qindex];
break;
default:
assert(0 && "bit_depth should be VPX_BITS_8, VPX_BITS_10 or VPX_BITS_12");
}
#else
- cpi->mb.sadperbit16 = sad_per_bit16lut_8[qindex];
- cpi->mb.sadperbit4 = sad_per_bit4lut_8[qindex];
+ cpi->mb->sadperbit16 = sad_per_bit16lut_8[qindex];
+ cpi->mb->sadperbit4 = sad_per_bit4lut_8[qindex];
#endif // CONFIG_VP9_HIGHBITDEPTH
}
@@ -262,7 +262,7 @@
void vp9_initialize_rd_consts(VP9_COMP *cpi) {
VP9_COMMON *const cm = &cpi->common;
- MACROBLOCK *const x = &cpi->mb;
+ MACROBLOCK *const x = cpi->mb;
RD_OPT *const rd = &cpi->rd;
int i;
@@ -525,7 +525,7 @@
}
int vp9_get_switchable_rate(const VP9_COMP *cpi) {
- const MACROBLOCKD *const xd = &cpi->mb.e_mbd;
+ const MACROBLOCKD *const xd = &cpi->mb->e_mbd;
const MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
const int ctx = vp9_get_pred_context_switchable_interp(xd);
return SWITCHABLE_INTERP_RATE_FACTOR *
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1225,7 +1225,7 @@
int *rate_uv, int *rate_uv_tokenonly,
int64_t *dist_uv, int *skip_uv,
PREDICTION_MODE *mode_uv) {
- MACROBLOCK *const x = &cpi->mb;
+ MACROBLOCK *const x = cpi->mb;
// Use an estimated rd for uv_intra based on DC_PRED if the
// appropriate speed flag is set.
--- a/vp9/encoder/vp9_segmentation.c
+++ b/vp9/encoder/vp9_segmentation.c
@@ -39,8 +39,8 @@
vpx_memcpy(seg->feature_data, feature_data, sizeof(seg->feature_data));
// TBD ?? Set the feature mask
- // vpx_memcpy(cpi->mb.e_mbd.segment_feature_mask, 0,
- // sizeof(cpi->mb.e_mbd.segment_feature_mask));
+ // vpx_memcpy(cpi->mb->e_mbd.segment_feature_mask, 0,
+ // sizeof(cpi->mb->e_mbd.segment_feature_mask));
}
void vp9_disable_segfeature(struct segmentation *seg, int segment_id,
SEG_LVL_FEATURES feature_id) {
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -482,7 +482,7 @@
cpi->find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned_evenmore;
}
- cpi->mb.optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1;
+ cpi->mb->optimize = sf->optimize_coefficients == 1 && oxcf->pass != 1;
if (!cpi->oxcf.frame_periodic_boost) {
sf->max_delta_qindex = 0;
--- a/vp9/encoder/vp9_temporal_filter.c
+++ b/vp9/encoder/vp9_temporal_filter.c
@@ -213,7 +213,7 @@
uint8_t *arf_frame_buf,
uint8_t *frame_ptr_buf,
int stride) {
- 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;
int step_param;
@@ -282,7 +282,7 @@
int mb_uv_offset = 0;
DECLARE_ALIGNED_ARRAY(16, unsigned int, accumulator, 16 * 16 * 3);
DECLARE_ALIGNED_ARRAY(16, uint16_t, count, 16 * 16 * 3);
- MACROBLOCKD *mbd = &cpi->mb.e_mbd;
+ MACROBLOCKD *mbd = &cpi->mb->e_mbd;
YV12_BUFFER_CONFIG *f = frames[alt_ref_index];
uint8_t *dst1, *dst2;
#if CONFIG_VP9_HIGHBITDEPTH
@@ -321,8 +321,8 @@
// 8 - VP9_INTERP_EXTEND.
// To keep the mv in play for both Y and UV planes the max that it
// can be on a border is therefore 16 - (2*VP9_INTERP_EXTEND+1).
- cpi->mb.mv_row_min = -((mb_row * 16) + (17 - 2 * VP9_INTERP_EXTEND));
- cpi->mb.mv_row_max = ((mb_rows - 1 - mb_row) * 16)
+ cpi->mb->mv_row_min = -((mb_row * 16) + (17 - 2 * VP9_INTERP_EXTEND));
+ cpi->mb->mv_row_max = ((mb_rows - 1 - mb_row) * 16)
+ (17 - 2 * VP9_INTERP_EXTEND);
for (mb_col = 0; mb_col < mb_cols; mb_col++) {
@@ -332,8 +332,8 @@
vpx_memset(accumulator, 0, 16 * 16 * 3 * sizeof(accumulator[0]));
vpx_memset(count, 0, 16 * 16 * 3 * sizeof(count[0]));
- cpi->mb.mv_col_min = -((mb_col * 16) + (17 - 2 * VP9_INTERP_EXTEND));
- cpi->mb.mv_col_max = ((mb_cols - 1 - mb_col) * 16)
+ cpi->mb->mv_col_min = -((mb_col * 16) + (17 - 2 * VP9_INTERP_EXTEND));
+ cpi->mb->mv_col_max = ((mb_cols - 1 - mb_col) * 16)
+ (17 - 2 * VP9_INTERP_EXTEND);
for (frame = 0; frame < frame_count; frame++) {
@@ -720,8 +720,8 @@
}
}
cm->mi = cm->mip + cm->mi_stride + 1;
- cpi->mb.e_mbd.mi = cm->mi;
- cpi->mb.e_mbd.mi[0].src_mi = &cpi->mb.e_mbd.mi[0];
+ cpi->mb->e_mbd.mi = cm->mi;
+ cpi->mb->e_mbd.mi[0].src_mi = &cpi->mb->e_mbd.mi[0];
} else {
// ARF is produced at the native frame size and resized when coded.
#if CONFIG_VP9_HIGHBITDEPTH
--- a/vp9/encoder/vp9_tokenize.c
+++ b/vp9/encoder/vp9_tokenize.c
@@ -252,7 +252,7 @@
TX_SIZE tx_size, void *arg) {
struct tokenize_b_args* const args = arg;
MACROBLOCKD *const xd = args->xd;
- struct macroblock_plane *p = &args->cpi->mb.plane[plane];
+ struct macroblock_plane *p = &args->cpi->mb->plane[plane];
struct macroblockd_plane *pd = &xd->plane[plane];
int aoff, loff;
txfrm_block_to_raster_xy(plane_bsize, tx_size, block, &aoff, &loff);
@@ -297,7 +297,7 @@
MACROBLOCKD *xd = args->xd;
TOKENEXTRA **tp = args->tp;
uint8_t token_cache[32 * 32];
- struct macroblock_plane *p = &cpi->mb.plane[plane];
+ struct macroblock_plane *p = &cpi->mb->plane[plane];
struct macroblockd_plane *pd = &xd->plane[plane];
MB_MODE_INFO *mbmi = &xd->mi[0].src_mi->mbmi;
int pt; /* near block/prev token context index */
@@ -424,7 +424,7 @@
void vp9_tokenize_sb(VP9_COMP *cpi, TOKENEXTRA **t, int dry_run,
BLOCK_SIZE bsize) {
VP9_COMMON *const cm = &cpi->common;
- MACROBLOCKD *const xd = &cpi->mb.e_mbd;
+ MACROBLOCKD *const xd = &cpi->mb->e_mbd;
MB_MODE_INFO *const mbmi = &xd->mi[0].src_mi->mbmi;
TOKENEXTRA *t_backup = *t;
const int ctx = vp9_get_skip_context(xd);