From 70c9d2983b107e0c84cb8c2786c801b26cc881a7 Mon Sep 17 00:00:00 2001 From: Yunqing Wang Date: Wed, 19 Nov 2014 19:04:07 -0800 Subject: Revert "vp9_ethread: include a pointer to mb in VP9_COMP" This reverts commit 6906d218ddd1af97228a797f4558e402231d94f1. Another way will be used to handle mb struct. Change-Id: Ic1111a46b2b1ee00f8f9e3fcd4cf3eb6030b2dc4 --- vp9/encoder/vp9_bitstream.c | 12 +++---- vp9/encoder/vp9_encodeframe.c | 72 +++++++++++++++++++-------------------- vp9/encoder/vp9_encoder.c | 60 +++++++++++++++----------------- vp9/encoder/vp9_encoder.h | 2 +- vp9/encoder/vp9_firstpass.c | 2 +- vp9/encoder/vp9_mbgraph.c | 12 +++---- vp9/encoder/vp9_picklpf.c | 2 +- vp9/encoder/vp9_quantize.c | 2 +- vp9/encoder/vp9_rd.c | 20 +++++------ vp9/encoder/vp9_rdopt.c | 2 +- vp9/encoder/vp9_segmentation.c | 4 +-- vp9/encoder/vp9_speed_features.c | 2 +- vp9/encoder/vp9_temporal_filter.c | 16 ++++----- vp9/encoder/vp9_tokenize.c | 6 ++-- 14 files changed, 104 insertions(+), 110 deletions(-) diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 73ce78942..a3a761a7b 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -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; diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index f01f25f25..c8f658103 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -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; COUNTS *const counts = cpi->frame_counts; - 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; COUNTS *const counts = cpi->frame_counts; @@ -3677,7 +3677,7 @@ void vp9_encode_frame(VP9_COMP *cpi) { for (i = 0; i < TX_MODES; ++i) { int64_t pd = counts->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; } @@ -3781,7 +3781,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; diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 9ece2d352..e1022c452 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -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; @@ -255,9 +255,6 @@ 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); @@ -288,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])); @@ -316,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])); @@ -549,9 +546,6 @@ 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); { @@ -559,12 +553,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(cm, cpi); + vp9_setup_pc_tree(&cpi->common, 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); @@ -1278,7 +1272,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; @@ -1543,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 @@ -2045,7 +2039,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 @@ -2426,7 +2420,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; @@ -2691,7 +2685,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 && @@ -3738,15 +3732,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))) { @@ -3799,7 +3793,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); @@ -3824,7 +3818,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); diff --git a/vp9/encoder/vp9_encoder.h b/vp9/encoder/vp9_encoder.h index 85b606dc1..1e67316f0 100644 --- a/vp9/encoder/vp9_encoder.h +++ b/vp9/encoder/vp9_encoder.h @@ -250,7 +250,7 @@ typedef struct { typedef struct VP9_COMP { QUANTS quants; - MACROBLOCK *mb; + MACROBLOCK mb; VP9_COMMON common; VP9EncoderConfig oxcf; struct lookahead_ctx *lookahead; diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 3016dd6ac..e2ea5a6b8 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -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; diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c index 91e8e58d6..bd04c56a4 100644 --- a/vp9/encoder/vp9_mbgraph.c +++ b/vp9/encoder/vp9_mbgraph.c @@ -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; diff --git a/vp9/encoder/vp9_picklpf.c b/vp9/encoder/vp9_picklpf.c index e9c59d886..85984fd7e 100644 --- a/vp9/encoder/vp9_picklpf.c +++ b/vp9/encoder/vp9_picklpf.c @@ -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) { diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c index 442d712dd..ce0ae79a0 100644 --- a/vp9/encoder/vp9_quantize.c +++ b/vp9/encoder/vp9_quantize.c @@ -701,7 +701,7 @@ void vp9_update_zbin_extra(VP9_COMP *cpi, MACROBLOCK *x) { 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) { diff --git a/vp9/encoder/vp9_rd.c b/vp9/encoder/vp9_rd.c index a1ef337cc..4ed324a0e 100644 --- a/vp9/encoder/vp9_rd.c +++ b/vp9/encoder/vp9_rd.c @@ -208,23 +208,23 @@ void vp9_initialize_me_consts(VP9_COMP *cpi, int qindex) { #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 @@ static void set_block_thresholds(const VP9_COMMON *cm, RD_OPT *rd) { 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 @@ const YV12_BUFFER_CONFIG *vp9_get_scaled_ref_frame(const VP9_COMP *cpi, } 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 * diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 06df81082..882bac105 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -1225,7 +1225,7 @@ static void choose_intra_uv_mode(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx, 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. diff --git a/vp9/encoder/vp9_segmentation.c b/vp9/encoder/vp9_segmentation.c index 6484b8907..f1d51770a 100644 --- a/vp9/encoder/vp9_segmentation.c +++ b/vp9/encoder/vp9_segmentation.c @@ -39,8 +39,8 @@ void vp9_set_segment_data(struct segmentation *seg, 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) { diff --git a/vp9/encoder/vp9_speed_features.c b/vp9/encoder/vp9_speed_features.c index 126d14293..cb7dedd2e 100644 --- a/vp9/encoder/vp9_speed_features.c +++ b/vp9/encoder/vp9_speed_features.c @@ -480,7 +480,7 @@ void vp9_set_speed_features_framesize_independent(VP9_COMP *cpi) { 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; diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c index 6b1e323a7..5599227ce 100644 --- a/vp9/encoder/vp9_temporal_filter.c +++ b/vp9/encoder/vp9_temporal_filter.c @@ -213,7 +213,7 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi, 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 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi, 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 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi, // 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 @@ static void temporal_filter_iterate_c(VP9_COMP *cpi, 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 @@ void vp9_temporal_filter(VP9_COMP *cpi, int distance) { } } 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 diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index dfde60603..fa6b1d95c 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -252,7 +252,7 @@ static void set_entropy_context_b(int plane, int block, BLOCK_SIZE plane_bsize, 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 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, 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 @@ int vp9_has_high_freq_in_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { 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); -- cgit v1.2.3