From acf0d56f0bb2fc51508f07e38147044539138517 Mon Sep 17 00:00:00 2001 From: Guillaume Martres Date: Thu, 10 Oct 2013 12:11:44 -0700 Subject: [PATCH] Get rid of "this_mi", use "mi_8x8[0]" everywhere instead The only case where they were intentionally pointing to different structures was in mbgraph, and this didn't have the expected behavior because both of these pointers are used interchangeably through the code Change-Id: I979251782f90885fe962305bcc845bc05907f80c --- vp9/common/vp9_blockd.h | 9 ++-- vp9/common/vp9_findnearmv.c | 2 +- vp9/common/vp9_pred_common.c | 2 +- vp9/common/vp9_pred_common.h | 2 +- vp9/common/vp9_reconinter.c | 8 +-- vp9/decoder/vp9_decodemv.c | 6 +-- vp9/decoder/vp9_decodframe.c | 11 ++-- vp9/decoder/vp9_detokenize.c | 4 +- vp9/decoder/vp9_onyxd_if.c | 1 - vp9/encoder/vp9_bitstream.c | 3 +- vp9/encoder/vp9_encodeframe.c | 22 ++++---- vp9/encoder/vp9_encodemb.c | 8 +-- vp9/encoder/vp9_firstpass.c | 33 ++++++------ vp9/encoder/vp9_mbgraph.c | 4 +- vp9/encoder/vp9_onyx_if.c | 1 - vp9/encoder/vp9_quantize.c | 2 +- vp9/encoder/vp9_rdopt.c | 96 +++++++++++++++++----------------- vp9/encoder/vp9_segmentation.c | 3 +- vp9/encoder/vp9_tokenize.c | 4 +- 19 files changed, 107 insertions(+), 114 deletions(-) diff --git a/vp9/common/vp9_blockd.h b/vp9/common/vp9_blockd.h index 0538b37ac..e42e9f9ac 100644 --- a/vp9/common/vp9_blockd.h +++ b/vp9/common/vp9_blockd.h @@ -196,7 +196,6 @@ typedef struct macroblockd { struct scale_factors scale_factor[2]; MODE_INFO *last_mi; - MODE_INFO *this_mi; int mode_info_stride; MODE_INFO *mic_stream_ptr; @@ -311,7 +310,7 @@ extern const TX_TYPE mode2txfm_map[MB_MODE_COUNT]; static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type, const MACROBLOCKD *xd, int ib) { - const MODE_INFO *const mi = xd->this_mi; + const MODE_INFO *const mi = xd->mi_8x8[0]; const MB_MODE_INFO *const mbmi = &mi->mbmi; if (plane_type != PLANE_TYPE_Y_WITH_DC || @@ -326,13 +325,13 @@ static INLINE TX_TYPE get_tx_type_4x4(PLANE_TYPE plane_type, static INLINE TX_TYPE get_tx_type_8x8(PLANE_TYPE plane_type, const MACROBLOCKD *xd) { return plane_type == PLANE_TYPE_Y_WITH_DC ? - mode2txfm_map[xd->this_mi->mbmi.mode] : DCT_DCT; + mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] : DCT_DCT; } static INLINE TX_TYPE get_tx_type_16x16(PLANE_TYPE plane_type, const MACROBLOCKD *xd) { return plane_type == PLANE_TYPE_Y_WITH_DC ? - mode2txfm_map[xd->this_mi->mbmi.mode] : DCT_DCT; + mode2txfm_map[xd->mi_8x8[0]->mbmi.mode] : DCT_DCT; } static void setup_block_dptrs(MACROBLOCKD *xd, int ss_x, int ss_y) { @@ -381,7 +380,7 @@ static INLINE void foreach_transformed_block_in_plane( const MACROBLOCKD *const xd, BLOCK_SIZE bsize, int plane, foreach_transformed_block_visitor visit, void *arg) { const struct macroblockd_plane *const pd = &xd->plane[plane]; - const MB_MODE_INFO* mbmi = &xd->this_mi->mbmi; + const MB_MODE_INFO* mbmi = &xd->mi_8x8[0]->mbmi; // block and transform sizes, in number of 4x4 blocks log 2 ("*_b") // 4x4=0, 8x8=2, 16x16=4, 32x32=6, 64x64=8 // transform size varies per plane, look it up in a common way. diff --git a/vp9/common/vp9_findnearmv.c b/vp9/common/vp9_findnearmv.c index b0c0c57ae..ed9e9823e 100644 --- a/vp9/common/vp9_findnearmv.c +++ b/vp9/common/vp9_findnearmv.c @@ -43,7 +43,7 @@ void vp9_append_sub8x8_mvs_for_idx(VP9_COMMON *cm, MACROBLOCKD *xd, int mi_row, int mi_col) { int_mv dst_list[MAX_MV_REF_CANDIDATES]; int_mv mv_list[MAX_MV_REF_CANDIDATES]; - MODE_INFO *const mi = xd->this_mi; + MODE_INFO *const mi = xd->mi_8x8[0]; assert(ref_idx == 0 || ref_idx == 1); assert(MAX_MV_REF_CANDIDATES == 2); // makes code here slightly easier diff --git a/vp9/common/vp9_pred_common.c b/vp9/common/vp9_pred_common.c index e89683150..9453d02cd 100644 --- a/vp9/common/vp9_pred_common.c +++ b/vp9/common/vp9_pred_common.c @@ -389,7 +389,7 @@ unsigned char vp9_get_pred_context_tx_size(const MACROBLOCKD *xd) { } void vp9_set_pred_flag_seg_id(MACROBLOCKD *xd, uint8_t pred_flag) { - xd->this_mi->mbmi.seg_id_predicted = pred_flag; + xd->mi_8x8[0]->mbmi.seg_id_predicted = pred_flag; } int vp9_get_segment_id(VP9_COMMON *cm, const uint8_t *segment_ids, diff --git a/vp9/common/vp9_pred_common.h b/vp9/common/vp9_pred_common.h index 9230c4531..1fdd4da0e 100644 --- a/vp9/common/vp9_pred_common.h +++ b/vp9/common/vp9_pred_common.h @@ -49,7 +49,7 @@ static INLINE vp9_prob vp9_get_pred_prob_mbskip(const VP9_COMMON *cm, } static INLINE unsigned char vp9_get_pred_flag_mbskip(const MACROBLOCKD *xd) { - return xd->this_mi->mbmi.skip_coeff; + return xd->mi_8x8[0]->mbmi.skip_coeff; } unsigned char vp9_get_pred_context_switchable_interp(const MACROBLOCKD *xd); diff --git a/vp9/common/vp9_reconinter.c b/vp9/common/vp9_reconinter.c index 2fabe2ad9..6f16ac70a 100644 --- a/vp9/common/vp9_reconinter.c +++ b/vp9/common/vp9_reconinter.c @@ -23,8 +23,8 @@ void vp9_setup_interp_filters(MACROBLOCKD *xd, INTERPOLATIONFILTERTYPE mcomp_filter_type, VP9_COMMON *cm) { - if (xd->mi_8x8 && xd->this_mi) { - MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + if (xd->mi_8x8 && xd->mi_8x8[0]) { + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; set_scale_factors(xd, mbmi->ref_frame[0] - LAST_FRAME, mbmi->ref_frame[1] - LAST_FRAME, @@ -120,7 +120,7 @@ static void build_inter_predictors(int plane, int block, BLOCK_SIZE bsize, const int bh = plane_block_height(bsize, pd); const int x = 4 * (block & ((1 << bwl) - 1)); const int y = 4 * (block >> bwl); - const MODE_INFO *mi = xd->this_mi; + const MODE_INFO *mi = xd->mi_8x8[0]; const int is_compound = has_second_ref(&mi->mbmi); int ref; @@ -177,7 +177,7 @@ static INLINE void foreach_predicted_block_in_plane( const int bwl = b_width_log2(bsize) - xd->plane[plane].subsampling_x; const int bhl = b_height_log2(bsize) - xd->plane[plane].subsampling_y; - if (xd->this_mi->mbmi.sb_type < BLOCK_8X8) { + if (xd->mi_8x8[0]->mbmi.sb_type < BLOCK_8X8) { int i = 0, x, y; assert(bsize == BLOCK_8X8); for (y = 0; y < 1 << bhl; ++y) diff --git a/vp9/decoder/vp9_decodemv.c b/vp9/decoder/vp9_decodemv.c index cc9984ab3..6cf4f153b 100644 --- a/vp9/decoder/vp9_decodemv.c +++ b/vp9/decoder/vp9_decodemv.c @@ -111,7 +111,7 @@ static int read_intra_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col, vp9_reader *r) { MACROBLOCKD *const xd = &pbi->mb; struct segmentation *const seg = &pbi->common.seg; - const BLOCK_SIZE bsize = xd->this_mi->mbmi.sb_type; + const BLOCK_SIZE bsize = xd->mi_8x8[0]->mbmi.sb_type; int segment_id; if (!seg->enabled) @@ -130,7 +130,7 @@ static int read_inter_segment_id(VP9D_COMP *pbi, int mi_row, int mi_col, VP9_COMMON *const cm = &pbi->common; MACROBLOCKD *const xd = &pbi->mb; struct segmentation *const seg = &cm->seg; - const BLOCK_SIZE bsize = xd->this_mi->mbmi.sb_type; + const BLOCK_SIZE bsize = xd->mi_8x8[0]->mbmi.sb_type; int pred_segment_id, segment_id; if (!seg->enabled) @@ -661,7 +661,7 @@ void vp9_prepare_read_mode_info(VP9D_COMP* pbi, vp9_reader *r) { void vp9_read_mode_info(VP9D_COMP* pbi, int mi_row, int mi_col, vp9_reader *r) { VP9_COMMON *const cm = &pbi->common; MACROBLOCKD *const xd = &pbi->mb; - MODE_INFO *mi = xd->this_mi; + MODE_INFO *mi = xd->mi_8x8[0]; const BLOCK_SIZE bsize = mi->mbmi.sb_type; const int bw = 1 << mi_width_log2(bsize); const int bh = 1 << mi_height_log2(bsize); diff --git a/vp9/decoder/vp9_decodframe.c b/vp9/decoder/vp9_decodframe.c index bc5543826..adfa88cba 100644 --- a/vp9/decoder/vp9_decodframe.c +++ b/vp9/decoder/vp9_decodframe.c @@ -134,7 +134,7 @@ static void decode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, TX_SIZE tx_size, void *arg) { MACROBLOCKD* const xd = arg; struct macroblockd_plane *const pd = &xd->plane[plane]; - MODE_INFO *const mi = xd->this_mi; + MODE_INFO *const mi = xd->mi_8x8[0]; const int raster_block = txfrm_block_to_raster_block(plane_bsize, tx_size, block); uint8_t* const dst = raster_block_offset_uint8(plane_bsize, raster_block, @@ -158,7 +158,7 @@ static void decode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, static int decode_tokens(VP9D_COMP *pbi, BLOCK_SIZE bsize, vp9_reader *r) { VP9_COMMON *const cm = &pbi->common; MACROBLOCKD *const xd = &pbi->mb; - MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; if (mbmi->skip_coeff) { reset_skip_context(xd, bsize); @@ -187,9 +187,8 @@ static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE bsize, xd->prev_mi_8x8 = cm->prev_mi_grid_visible + offset; // we are using the mode info context stream here - xd->this_mi = xd->mi_8x8[0] = xd->mic_stream_ptr; - xd->this_mi->mbmi.sb_type = bsize; + xd->mi_8x8[0]->mbmi.sb_type = bsize; xd->mic_stream_ptr++; // Special case: if prev_mi is NULL, the previous mode info context @@ -209,7 +208,7 @@ static void set_offsets(VP9D_COMP *pbi, BLOCK_SIZE bsize, static void set_ref(VP9D_COMP *pbi, int i, int mi_row, int mi_col) { VP9_COMMON *const cm = &pbi->common; MACROBLOCKD *const xd = &pbi->mb; - MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; const int ref = mbmi->ref_frame[i] - LAST_FRAME; const YV12_BUFFER_CONFIG *cfg = &cm->yv12_fb[cm->active_ref_idx[ref]]; const struct scale_factors *sf = &cm->active_ref_scale[ref]; @@ -240,7 +239,7 @@ static void decode_modes_b(VP9D_COMP *pbi, int mi_row, int mi_col, bsize = BLOCK_8X8; // Has to be called after set_offsets - mbmi = &xd->this_mi->mbmi; + mbmi = &xd->mi_8x8[0]->mbmi; eobtotal = decode_tokens(pbi, bsize, r); if (!is_inter_block(mbmi)) { diff --git a/vp9/decoder/vp9_detokenize.c b/vp9/decoder/vp9_detokenize.c index efaedfcb3..07ec7fbce 100644 --- a/vp9/decoder/vp9_detokenize.c +++ b/vp9/decoder/vp9_detokenize.c @@ -91,7 +91,7 @@ static int decode_coefs(VP9_COMMON *cm, const MACROBLOCKD *xd, TX_SIZE tx_size, const int16_t *dq, int pt) { const FRAME_CONTEXT *const fc = &cm->fc; FRAME_COUNTS *const counts = &cm->counts; - const int ref = is_inter_block(&xd->this_mi->mbmi); + const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi); int band, c = 0; const vp9_prob (*coef_probs)[PREV_COEF_CONTEXTS][UNCONSTRAINED_NODES] = fc->coef_probs[tx_size][type][ref]; @@ -218,7 +218,7 @@ static void decode_block(int plane, int block, BLOCK_SIZE plane_bsize, MACROBLOCKD *xd = &arg->pbi->mb; struct segmentation *seg = &arg->pbi->common.seg; struct macroblockd_plane* pd = &xd->plane[plane]; - const int segment_id = xd->this_mi->mbmi.segment_id; + const int segment_id = xd->mi_8x8[0]->mbmi.segment_id; const int seg_eob = get_tx_eob(seg, segment_id, tx_size); int aoff, loff, eob, pt; diff --git a/vp9/decoder/vp9_onyxd_if.c b/vp9/decoder/vp9_onyxd_if.c index 255168429..bc7ced0ff 100644 --- a/vp9/decoder/vp9_onyxd_if.c +++ b/vp9/decoder/vp9_onyxd_if.c @@ -396,7 +396,6 @@ int vp9_receive_compressed_data(VP9D_PTR ptr, pbi->mb.mi_8x8 = cm->mi_grid_visible; pbi->mb.mi_8x8[0] = cm->mi; - pbi->mb.this_mi = cm->mi; cm->current_video_frame++; } diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index c73fb6529..bfac5a77d 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -353,7 +353,7 @@ static void encode_ref_frame(VP9_COMP *cpi, vp9_writer *bc) { VP9_COMMON *const cm = &cpi->common; MACROBLOCK *const x = &cpi->mb; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *mi = &xd->this_mi->mbmi; + MB_MODE_INFO *mi = &xd->mi_8x8[0]->mbmi; const int segment_id = mi->segment_id; int seg_ref_active = vp9_segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME); @@ -574,7 +574,6 @@ static void write_modes_b(VP9_COMP *cpi, MODE_INFO **mi_8x8, vp9_writer *bc, if (xd->ab_index > 0) return; - xd->this_mi = mi_8x8[0]; xd->mi_8x8 = mi_8x8; set_mi_row_col(&cpi->common, xd, diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 15a3a70e3..d76c23c0b 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -352,8 +352,8 @@ static void update_state(VP9_COMP *cpi, PICK_MODE_CONTEXT *ctx, MACROBLOCK *const x = &cpi->mb; MACROBLOCKD *const xd = &x->e_mbd; MODE_INFO *mi = &ctx->mic; - MB_MODE_INFO * const mbmi = &xd->this_mi->mbmi; - MODE_INFO *mi_addr = xd->this_mi; + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; + MODE_INFO *mi_addr = xd->mi_8x8[0]; int mb_mode_index = ctx->best_mode_index; const int mis = cm->mode_info_stride; @@ -497,9 +497,9 @@ static void set_offsets(VP9_COMP *cpi, int mi_row, int mi_col, // cannot be used. xd->last_mi = cm->prev_mi ? xd->prev_mi_8x8[0] : NULL; - xd->this_mi = xd->mi_8x8[0] = cm->mi + idx_str; + xd->mi_8x8[0] = cm->mi + idx_str; - mbmi = &xd->this_mi->mbmi; + mbmi = &xd->mi_8x8[0]->mbmi; // Set up destination pointers setup_dst_planes(xd, &cm->yv12_fb[dst_fb_idx], mi_row, mi_col); @@ -579,10 +579,10 @@ static void pick_sb_modes(VP9_COMP *cpi, int mi_row, int mi_col, } set_offsets(cpi, mi_row, mi_col, bsize); - xd->this_mi->mbmi.sb_type = bsize; + xd->mi_8x8[0]->mbmi.sb_type = bsize; // Set to zero to make sure we do not use the previous encoded frame stats - xd->this_mi->mbmi.skip_coeff = 0; + xd->mi_8x8[0]->mbmi.skip_coeff = 0; x->source_variance = get_sby_perpixel_variance(cpi, x, bsize); @@ -594,7 +594,7 @@ static void pick_sb_modes(VP9_COMP *cpi, int mi_row, int mi_col, energy = vp9_block_energy(cpi, x, bsize); } - xd->this_mi->mbmi.segment_id = vp9_vaq_segment_id(energy); + xd->mi_8x8[0]->mbmi.segment_id = vp9_vaq_segment_id(energy); rdmult_ratio = vp9_vaq_rdmult_ratio(energy); vp9_mb_init_quantizer(cpi, x); } @@ -627,7 +627,7 @@ static void update_stats(VP9_COMP *cpi) { VP9_COMMON *const cm = &cpi->common; MACROBLOCK *const x = &cpi->mb; MACROBLOCKD *const xd = &x->e_mbd; - MODE_INFO *mi = xd->this_mi; + MODE_INFO *mi = xd->mi_8x8[0]; MB_MODE_INFO *const mbmi = &mi->mbmi; if (!frame_is_intra_only(cm)) { @@ -1866,8 +1866,8 @@ static void init_encode_frame_mb_context(VP9_COMP *cpi) { setup_block_dptrs(&x->e_mbd, cm->subsampling_x, cm->subsampling_y); - xd->this_mi->mbmi.mode = DC_PRED; - xd->this_mi->mbmi.uv_mode = DC_PRED; + xd->mi_8x8[0]->mbmi.mode = DC_PRED; + xd->mi_8x8[0]->mbmi.uv_mode = DC_PRED; vp9_zero(cpi->y_mode_count); vp9_zero(cpi->y_uv_mode_count); @@ -1941,7 +1941,7 @@ static void encode_frame_internal(VP9_COMP *cpi) { xd->mi_8x8 = cm->mi_grid_visible; // required for vp9_frame_init_quantizer - xd->this_mi = xd->mi_8x8[0] = cm->mi; + xd->mi_8x8[0] = cm->mi; xd->mic_stream_ptr = cm->mi; xd->last_mi = cm->prev_mi; diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index b4e3c76cb..0a1367eb9 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -117,7 +117,7 @@ static void optimize_b(MACROBLOCK *mb, TX_SIZE tx_size) { MACROBLOCKD *const xd = &mb->e_mbd; struct macroblockd_plane *pd = &xd->plane[plane]; - const int ref = is_inter_block(&xd->this_mi->mbmi); + const int ref = is_inter_block(&xd->mi_8x8[0]->mbmi); vp9_token_state tokens[1025][2]; unsigned best_index[1025][2]; const int16_t *coeff_ptr = BLOCK_OFFSET(mb->plane[plane].coeff, block); @@ -331,7 +331,7 @@ static void optimize_init_b(int plane, BLOCK_SIZE bsize, 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]; - const MB_MODE_INFO *mbmi = &xd->this_mi->mbmi; + const MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi) : mbmi->tx_size; vp9_get_entropy_contexts(tx_size, args->ctx->ta[plane], args->ctx->tl[plane], @@ -494,7 +494,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, struct encode_b_args* const args = arg; MACROBLOCK *const x = args->x; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; struct macroblock_plane *const p = &x->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane]; int16_t *coeff = BLOCK_OFFSET(p->coeff, block); @@ -596,7 +596,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, scan = get_scan_4x4(tx_type); iscan = get_iscan_4x4(tx_type); if (mbmi->sb_type < BLOCK_8X8 && plane == 0) - mode = xd->this_mi->bmi[block].as_mode; + mode = xd->mi_8x8[0]->bmi[block].as_mode; else mode = plane == 0 ? mbmi->mode : mbmi->uv_mode; diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index aed7a95a5..d78804989 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -358,7 +358,7 @@ static void zz_motion_search(VP9_COMP *cpi, MACROBLOCK *x, // Set up pointers for this macro block recon buffer xd->plane[0].pre[0].buf = recon_buffer->y_buffer + recon_yoffset; - switch (xd->this_mi->mbmi.sb_type) { + switch (xd->mi_8x8[0]->mbmi.sb_type) { case BLOCK_8X8: vp9_mse8x8(x->plane[0].src.buf, x->plane[0].src.stride, xd->plane[0].pre[0].buf, xd->plane[0].pre[0].stride, @@ -397,7 +397,7 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x, int further_steps = (MAX_MVSEARCH_STEPS - 1) - step_param; int n; vp9_variance_fn_ptr_t v_fn_ptr = - cpi->fn_ptr[xd->this_mi->mbmi.sb_type]; + cpi->fn_ptr[xd->mi_8x8[0]->mbmi.sb_type]; int new_mv_mode_penalty = 256; int sr = 0; @@ -414,7 +414,7 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x, further_steps -= sr; // override the default variance function to use MSE - switch (xd->this_mi->mbmi.sb_type) { + switch (xd->mi_8x8[0]->mbmi.sb_type) { case BLOCK_8X8: v_fn_ptr.vf = vp9_mse8x8; break; @@ -518,7 +518,6 @@ void vp9_first_pass(VP9_COMP *cpi) { xd->mi_8x8 = cm->mi_grid_visible; // required for vp9_frame_init_quantizer - xd->this_mi = xd->mi_8x8[0] = cm->mi; xd->mic_stream_ptr = cm->mi; @@ -565,26 +564,26 @@ void vp9_first_pass(VP9_COMP *cpi) { if (mb_col * 2 + 1 < cm->mi_cols) { if (mb_row * 2 + 1 < cm->mi_rows) { - xd->this_mi->mbmi.sb_type = BLOCK_16X16; + xd->mi_8x8[0]->mbmi.sb_type = BLOCK_16X16; } else { - xd->this_mi->mbmi.sb_type = BLOCK_16X8; + xd->mi_8x8[0]->mbmi.sb_type = BLOCK_16X8; } } else { if (mb_row * 2 + 1 < cm->mi_rows) { - xd->this_mi->mbmi.sb_type = BLOCK_8X16; + xd->mi_8x8[0]->mbmi.sb_type = BLOCK_8X16; } else { - xd->this_mi->mbmi.sb_type = BLOCK_8X8; + xd->mi_8x8[0]->mbmi.sb_type = BLOCK_8X8; } } - xd->this_mi->mbmi.ref_frame[0] = INTRA_FRAME; + xd->mi_8x8[0]->mbmi.ref_frame[0] = INTRA_FRAME; set_mi_row_col(cm, xd, mb_row << 1, - 1 << mi_height_log2(xd->this_mi->mbmi.sb_type), + 1 << mi_height_log2(xd->mi_8x8[0]->mbmi.sb_type), mb_col << 1, - 1 << mi_width_log2(xd->this_mi->mbmi.sb_type)); + 1 << mi_width_log2(xd->mi_8x8[0]->mbmi.sb_type)); if (cpi->sf.variance_adaptive_quantization) { - int energy = vp9_block_energy(cpi, x, xd->this_mi->mbmi.sb_type); + int energy = vp9_block_energy(cpi, x, xd->mi_8x8[0]->mbmi.sb_type); error_weight = vp9_vaq_inv_q_ratio(energy); } @@ -690,13 +689,13 @@ void vp9_first_pass(VP9_COMP *cpi) { mv.as_mv.col *= 8; this_error = motion_error; vp9_set_mbmode_and_mvs(x, NEWMV, &mv); - xd->this_mi->mbmi.tx_size = TX_4X4; - xd->this_mi->mbmi.ref_frame[0] = LAST_FRAME; - xd->this_mi->mbmi.ref_frame[1] = NONE; + xd->mi_8x8[0]->mbmi.tx_size = TX_4X4; + xd->mi_8x8[0]->mbmi.ref_frame[0] = LAST_FRAME; + xd->mi_8x8[0]->mbmi.ref_frame[1] = NONE; vp9_build_inter_predictors_sby(xd, mb_row << 1, mb_col << 1, - xd->this_mi->mbmi.sb_type); - vp9_encode_sby(x, xd->this_mi->mbmi.sb_type); + xd->mi_8x8[0]->mbmi.sb_type); + vp9_encode_sby(x, xd->mi_8x8[0]->mbmi.sb_type); sum_mvr += mv.as_mv.row; sum_mvr_abs += abs(mv.as_mv.row); sum_mvc += mv.as_mv.col; diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c index e0c24a956..2f147a04e 100644 --- a/vp9/encoder/vp9_mbgraph.c +++ b/vp9/encoder/vp9_mbgraph.c @@ -149,7 +149,7 @@ static int find_best_16x16_intra(VP9_COMP *cpi, for (mode = DC_PRED; mode <= TM_PRED; mode++) { unsigned int err; - xd->this_mi->mbmi.mode = mode; + xd->mi_8x8[0]->mbmi.mode = mode; vp9_predict_intra_block(xd, 0, 2, TX_16X16, mode, x->plane[0].src.buf, x->plane[0].src.stride, xd->plane[0].dst.buf, xd->plane[0].dst.stride); @@ -258,7 +258,7 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi, xd->plane[0].dst.stride = buf->y_stride; xd->plane[0].pre[0].stride = buf->y_stride; xd->plane[1].dst.stride = buf->uv_stride; - xd->this_mi = &mi_local; + xd->mi_8x8[0] = &mi_local; mi_local.mbmi.sb_type = BLOCK_16X16; mi_local.mbmi.ref_frame[0] = LAST_FRAME; mi_local.mbmi.ref_frame[1] = NONE; diff --git a/vp9/encoder/vp9_onyx_if.c b/vp9/encoder/vp9_onyx_if.c index 74388d6c3..2b1caf4b7 100644 --- a/vp9/encoder/vp9_onyx_if.c +++ b/vp9/encoder/vp9_onyx_if.c @@ -3496,7 +3496,6 @@ static void encode_frame_to_data_rate(VP9_COMP *cpi, cpi->mb.e_mbd.mi_8x8 = cm->mi_grid_visible; cpi->mb.e_mbd.mi_8x8[0] = cm->mi; - cpi->mb.e_mbd.this_mi = cm->mi; // Don't increment frame counters if this was an altref buffer // update not a real frame diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c index 048a6e1eb..7ad8d1fb2 100644 --- a/vp9/encoder/vp9_quantize.c +++ b/vp9/encoder/vp9_quantize.c @@ -275,7 +275,7 @@ void vp9_mb_init_quantizer(VP9_COMP *cpi, MACROBLOCK *x) { VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *xd = &x->e_mbd; int zbin_extra; - int segment_id = xd->this_mi->mbmi.segment_id; + int segment_id = xd->mi_8x8[0]->mbmi.segment_id; const int qindex = vp9_get_qindex(&cpi->common.seg, segment_id, cpi->common.base_qindex); diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 56a080377..db94a5c56 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -489,7 +489,7 @@ static INLINE int cost_coeffs(MACROBLOCK *x, TX_SIZE tx_size, const int16_t *scan, const int16_t *nb) { MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; struct macroblockd_plane *pd = &xd->plane[plane]; const PLANE_TYPE type = pd->plane_type; const int16_t *band_count = &band_counts[tx_size][1]; @@ -567,7 +567,7 @@ static void dist_block(int plane, int block, TX_SIZE tx_size, void *arg) { args->sse = this_sse >> shift; if (x->skip_encode && - xd->this_mi->mbmi.ref_frame[0] == INTRA_FRAME) { + xd->mi_8x8[0]->mbmi.ref_frame[0] == INTRA_FRAME) { // TODO(jingning): tune the model to better capture the distortion. int64_t p = (pd->dequant[1] * pd->dequant[1] * (1 << ss_txfrm_size)) >> (shift + 2); @@ -599,7 +599,7 @@ static void block_yrd_txfm(int plane, int block, BLOCK_SIZE plane_bsize, if (args->skip) return; - if (!is_inter_block(&xd->this_mi->mbmi)) + if (!is_inter_block(&xd->mi_8x8[0]->mbmi)) vp9_encode_block_intra(plane, block, plane_bsize, tx_size, &encode_args); else vp9_xform_quant(plane, block, plane_bsize, tx_size, &encode_args); @@ -686,7 +686,7 @@ static void txfm_rd_in_plane(MACROBLOCK *x, init_rdcost_stack(x, tx_size, num_4x4_w, num_4x4_h, ref_best_rd, rd_stack); if (plane == 0) - xd->this_mi->mbmi.tx_size = tx_size; + xd->mi_8x8[0]->mbmi.tx_size = tx_size; vp9_get_entropy_contexts(tx_size, rd_stack->t_above, rd_stack->t_left, pd->above_context, pd->left_context, @@ -718,7 +718,7 @@ static void choose_largest_txfm_size(VP9_COMP *cpi, MACROBLOCK *x, const TX_SIZE max_tx_size = max_txsize_lookup[bs]; VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; if (max_tx_size == TX_32X32 && (cm->tx_mode == ALLOW_32X32 || cm->tx_mode == TX_MODE_SELECT)) { @@ -748,13 +748,13 @@ static void choose_txfm_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x, const TX_SIZE max_tx_size = max_txsize_lookup[bs]; VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; vp9_prob skip_prob = vp9_get_pred_prob_mbskip(cm, xd); int64_t rd[TX_SIZES][2]; int n, m; int s0, s1; - const vp9_prob *tx_probs = get_tx_probs2(xd, &cm->fc.tx_probs, xd->this_mi); + const vp9_prob *tx_probs = get_tx_probs2(xd, &cm->fc.tx_probs, xd->mi_8x8[0]); for (n = TX_4X4; n <= max_tx_size; n++) { r[n][1] = r[n][0]; @@ -851,7 +851,7 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x, const TX_SIZE max_tx_size = max_txsize_lookup[bs]; VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; vp9_prob skip_prob = vp9_get_pred_prob_mbskip(cm, xd); int64_t rd[TX_SIZES][2]; int n, m; @@ -859,7 +859,7 @@ static void choose_txfm_size_from_modelrd(VP9_COMP *cpi, MACROBLOCK *x, double scale_rd[TX_SIZES] = {1.73, 1.44, 1.20, 1.00}; // double scale_r[TX_SIZES] = {2.82, 2.00, 1.41, 1.00}; - const vp9_prob *tx_probs = get_tx_probs2(xd, &cm->fc.tx_probs, xd->this_mi); + const vp9_prob *tx_probs = get_tx_probs2(xd, &cm->fc.tx_probs, xd->mi_8x8[0]); // for (n = TX_4X4; n <= max_txfm_size; n++) // r[n][0] = (r[n][0] * scale_r[n]); @@ -944,7 +944,7 @@ static void super_block_yrd(VP9_COMP *cpi, int r[TX_SIZES][2], s[TX_SIZES]; int64_t d[TX_SIZES], sse[TX_SIZES]; MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; struct rdcost_block_args *rdcost_stack = &cpi->rdcost_stack; assert(bs == mbmi->sb_type); @@ -1054,7 +1054,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib, vpx_memcpy(ta, a, sizeof(ta)); vpx_memcpy(tl, l, sizeof(tl)); - xd->this_mi->mbmi.tx_size = TX_4X4; + xd->mi_8x8[0]->mbmi.tx_size = TX_4X4; for (mode = DC_PRED; mode <= TM_PRED; ++mode) { int64_t this_rd; @@ -1085,7 +1085,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, int ib, uint8_t *dst = dst_init + idx * 4 + idy * 4 * dst_stride; block = ib + idy * 2 + idx; - xd->this_mi->bmi[block].as_mode = mode; + xd->mi_8x8[0]->bmi[block].as_mode = mode; src_diff = raster_block_offset_int16(BLOCK_8X8, block, p->src_diff); coeff = BLOCK_OFFSET(x->plane[0].coeff, block); vp9_predict_intra_block(xd, block, 1, @@ -1161,10 +1161,10 @@ static int64_t rd_pick_intra_sub_8x8_y_mode(VP9_COMP * const cpi, int64_t best_rd) { int i, j; MACROBLOCKD *const xd = &mb->e_mbd; - MODE_INFO *const mic = xd->this_mi; + MODE_INFO *const mic = xd->mi_8x8[0]; const MODE_INFO *above_mi = xd->mi_8x8[-xd->mode_info_stride]; const MODE_INFO *left_mi = xd->mi_8x8[-1]; - const BLOCK_SIZE bsize = xd->this_mi->mbmi.sb_type; + const BLOCK_SIZE bsize = xd->mi_8x8[0]->mbmi.sb_type; const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[bsize]; const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[bsize]; int idx, idy; @@ -1235,7 +1235,7 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, MB_PREDICTION_MODE mode; MB_PREDICTION_MODE mode_selected = DC_PRED; MACROBLOCKD *const xd = &x->e_mbd; - MODE_INFO *const mic = xd->this_mi; + MODE_INFO *const mic = xd->mi_8x8[0]; int this_rate, this_rate_tokenonly, s; int64_t this_distortion, this_rd; TX_SIZE best_tx = TX_4X4; @@ -1305,7 +1305,7 @@ static void super_block_uvrd(VP9_COMP *const cpi, MACROBLOCK *x, int64_t *sse, BLOCK_SIZE bsize, int64_t ref_best_rd) { MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; TX_SIZE uv_txfm_size = get_uv_tx_size(mbmi); int plane; int pnrate = 0, pnskip = 1; @@ -1428,7 +1428,7 @@ static int cost_mv_ref(VP9_COMP *cpi, MB_PREDICTION_MODE mode, int mode_context) { MACROBLOCK *const x = &cpi->mb; MACROBLOCKD *const xd = &x->e_mbd; - const int segment_id = xd->this_mi->mbmi.segment_id; + const int segment_id = xd->mi_8x8[0]->mbmi.segment_id; // Don't account for mode here if segment skip is enabled. if (!vp9_segfeature_active(&cpi->common.seg, segment_id, SEG_LVL_SKIP)) { @@ -1464,7 +1464,7 @@ static int labels2mode(MACROBLOCK *x, int i, int_mv *second_best_ref_mv, int *mvjcost, int *mvcost[2], VP9_COMP *cpi) { MACROBLOCKD *const xd = &x->e_mbd; - MODE_INFO *const mic = xd->this_mi; + MODE_INFO *const mic = xd->mi_8x8[0]; MB_MODE_INFO *mbmi = &mic->mbmi; int cost = 0, thismvcost = 0; int idx, idy; @@ -1542,7 +1542,7 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi, MACROBLOCKD *xd = &x->e_mbd; struct macroblockd_plane *const pd = &xd->plane[0]; struct macroblock_plane *const p = &x->plane[0]; - MODE_INFO *const mi = xd->this_mi; + MODE_INFO *const mi = xd->mi_8x8[0]; const BLOCK_SIZE bsize = mi->mbmi.sb_type; const int width = plane_block_width(bsize, pd); const int height = plane_block_height(bsize, pd); @@ -2059,7 +2059,7 @@ static int64_t rd_pick_best_mbsegmentation(VP9_COMP *cpi, MACROBLOCK *x, int i; BEST_SEG_INFO *bsi = bsi_buf + filter_idx; MACROBLOCKD *xd = &x->e_mbd; - MODE_INFO *mi = xd->this_mi; + MODE_INFO *mi = xd->mi_8x8[0]; MB_MODE_INFO *mbmi = &mi->mbmi; int mode_idx; @@ -2105,7 +2105,7 @@ static void mv_pred(VP9_COMP *cpi, MACROBLOCK *x, uint8_t *ref_y_buffer, int ref_y_stride, int ref_frame, BLOCK_SIZE block_size ) { MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; int_mv this_mv; int i; int zero_seen = 0; @@ -2229,7 +2229,7 @@ static void store_coding_context(MACROBLOCK *x, PICK_MODE_CONTEXT *ctx, // restored if we decide to encode this way ctx->skip = x->skip; ctx->best_mode_index = mode_index; - ctx->mic = *xd->this_mi; + ctx->mic = *xd->mi_8x8[0]; ctx->best_ref_mv.as_int = ref_mv->as_int; ctx->second_best_ref_mv.as_int = second_ref_mv->as_int; @@ -2280,7 +2280,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x, VP9_COMMON *cm = &cpi->common; YV12_BUFFER_CONFIG *yv12 = &cm->yv12_fb[cpi->common.ref_frame_map[idx]]; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; // set up scaling factors scale[frame_type] = cpi->common.active_ref_scale[frame_type - 1]; @@ -2298,7 +2298,7 @@ static void setup_buffer_inter(VP9_COMP *cpi, MACROBLOCK *x, &scale[frame_type], &scale[frame_type]); // Gets an initial list of candidate vectors from neighbours and orders them - vp9_find_mv_refs(&cpi->common, xd, xd->this_mi, + vp9_find_mv_refs(&cpi->common, xd, xd->mi_8x8[0], xd->last_mi, frame_type, mbmi->ref_mvs[frame_type], mi_row, mi_col); @@ -2328,7 +2328,7 @@ static YV12_BUFFER_CONFIG *get_scaled_ref_frame(VP9_COMP *cpi, int ref_frame) { static INLINE int get_switchable_rate(const MACROBLOCK *x) { const MACROBLOCKD *const xd = &x->e_mbd; - const MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + const MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; const int ctx = vp9_get_pred_context_switchable_interp(xd); return SWITCHABLE_INTERP_RATE_FACTOR * x->switchable_interp_costs[ctx][mbmi->interp_filter]; @@ -2340,7 +2340,7 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, int_mv *tmp_mv, int *rate_mv) { MACROBLOCKD *xd = &x->e_mbd; VP9_COMMON *cm = &cpi->common; - MB_MODE_INFO *mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0}}; int bestsme = INT_MAX; int further_steps, step_param; @@ -2479,7 +2479,7 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x, int *rate_mv) { int pw = 4 << b_width_log2(bsize), ph = 4 << b_height_log2(bsize); MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; int refs[2] = { mbmi->ref_frame[0], (mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1]) }; int_mv ref_mv[2]; @@ -2644,7 +2644,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, const int64_t ref_best_rd) { VP9_COMMON *cm = &cpi->common; MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; const int is_comp_pred = has_second_ref(mbmi); const int num_refs = is_comp_pred ? 2 : 1; const int this_mode = mbmi->mode; @@ -2690,7 +2690,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, single_motion_search(cpi, x, bsize, mi_row, mi_col, &tmp_mv, &rate_mv); *rate2 += rate_mv; frame_mv[refs[0]].as_int = - xd->this_mi->bmi[0].as_mv[0].as_int = tmp_mv.as_int; + xd->mi_8x8[0]->bmi[0].as_mv[0].as_int = tmp_mv.as_int; single_newmv[refs[0]].as_int = tmp_mv.as_int; } } @@ -3054,7 +3054,7 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, int64_t dist_y = 0, dist_uv = 0, tx_cache[TX_MODES] = { 0 }; x->skip_encode = 0; ctx->skip = 0; - xd->this_mi->mbmi.ref_frame[0] = INTRA_FRAME; + xd->mi_8x8[0]->mbmi.ref_frame[0] = INTRA_FRAME; if (bsize >= BLOCK_8X8) { if (rd_pick_intra_sby_mode(cpi, x, &rate_y, &rate_y_tokenonly, &dist_y, &y_skip, bsize, tx_cache, @@ -3094,7 +3094,7 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, } } - ctx->mic = *xd->this_mi; + ctx->mic = *xd->mi_8x8[0]; } int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, @@ -3106,7 +3106,7 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, int64_t best_rd_so_far) { VP9_COMMON *cm = &cpi->common; MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; const struct segmentation *seg = &cm->seg; const BLOCK_SIZE block_size = get_plane_block_size(bsize, &xd->plane[0]); MB_PREDICTION_MODE this_mode; @@ -3537,15 +3537,15 @@ int64_t vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, } // Keep record of best intra rd - if (xd->this_mi->mbmi.ref_frame[0] == INTRA_FRAME && - is_intra_mode(xd->this_mi->mbmi.mode) && + if (xd->mi_8x8[0]->mbmi.ref_frame[0] == INTRA_FRAME && + is_intra_mode(xd->mi_8x8[0]->mbmi.mode) && this_rd < best_intra_rd) { best_intra_rd = this_rd; - best_intra_mode = xd->this_mi->mbmi.mode; + best_intra_mode = xd->mi_8x8[0]->mbmi.mode; } // Keep record of best inter rd with single reference - if (xd->this_mi->mbmi.ref_frame[0] > INTRA_FRAME && - xd->this_mi->mbmi.ref_frame[1] == NONE && + if (xd->mi_8x8[0]->mbmi.ref_frame[0] > INTRA_FRAME && + xd->mi_8x8[0]->mbmi.ref_frame[1] == NONE && !mode_excluded && this_rd < best_inter_rd) { best_inter_rd = this_rd; @@ -3804,7 +3804,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, int64_t best_rd_so_far) { VP9_COMMON *cm = &cpi->common; MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; const struct segmentation *seg = &cm->seg; const BLOCK_SIZE block_size = get_plane_block_size(bsize, &xd->plane[0]); MV_REFERENCE_FRAME ref_frame, second_ref_frame; @@ -4093,7 +4093,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, cpi->rd_thresh_sub8x8[segment_id][bsize][THR_ALTR]; this_rd_thresh = (ref_frame == GOLDEN_FRAME) ? cpi->rd_thresh_sub8x8[segment_id][bsize][THR_GOLD] : this_rd_thresh; - xd->this_mi->mbmi.tx_size = TX_4X4; + xd->mi_8x8[0]->mbmi.tx_size = TX_4X4; cpi->rd_filter_cache[SWITCHABLE_FILTERS] = INT64_MAX; if (cm->mcomp_filter_type != BILINEAR) { @@ -4148,7 +4148,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, tmp_best_skippable = skippable; tmp_best_mbmode = *mbmi; for (i = 0; i < 4; i++) - tmp_best_bmodes[i] = xd->this_mi->bmi[i]; + tmp_best_bmodes[i] = xd->mi_8x8[0]->bmi[i]; pred_exists = 1; if (switchable_filter_index == 0 && cpi->sf.use_rd_breakout && @@ -4199,7 +4199,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, skippable = tmp_best_skippable; *mbmi = tmp_best_mbmode; for (i = 0; i < 4; i++) - xd->this_mi->bmi[i] = tmp_best_bmodes[i]; + xd->mi_8x8[0]->bmi[i] = tmp_best_bmodes[i]; } rate2 += rate; @@ -4292,8 +4292,8 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, } // Keep record of best inter rd with single reference - if (xd->this_mi->mbmi.ref_frame[0] > INTRA_FRAME && - xd->this_mi->mbmi.ref_frame[1] == NONE && + if (xd->mi_8x8[0]->mbmi.ref_frame[0] > INTRA_FRAME && + xd->mi_8x8[0]->mbmi.ref_frame[1] == NONE && !mode_excluded && this_rd < best_inter_rd) { best_inter_rd = this_rd; @@ -4329,7 +4329,7 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, sizeof(ctx->zcoeff_blk)); for (i = 0; i < 4; i++) - best_bmodes[i] = xd->this_mi->bmi[i]; + best_bmodes[i] = xd->mi_8x8[0]->bmi[i]; // TODO(debargha): enhance this test with a better distortion prediction // based on qp, activity mask and history @@ -4480,13 +4480,13 @@ int64_t vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, x->skip |= best_skip2; if (best_mbmode.ref_frame[0] == INTRA_FRAME) { for (i = 0; i < 4; i++) - xd->this_mi->bmi[i].as_mode = best_bmodes[i].as_mode; + xd->mi_8x8[0]->bmi[i].as_mode = best_bmodes[i].as_mode; } else { for (i = 0; i < 4; ++i) - vpx_memcpy(&xd->this_mi->bmi[i], &best_bmodes[i], sizeof(b_mode_info)); + vpx_memcpy(&xd->mi_8x8[0]->bmi[i], &best_bmodes[i], sizeof(b_mode_info)); - mbmi->mv[0].as_int = xd->this_mi->bmi[3].as_mv[0].as_int; - mbmi->mv[1].as_int = xd->this_mi->bmi[3].as_mv[1].as_int; + mbmi->mv[0].as_int = xd->mi_8x8[0]->bmi[3].as_mv[0].as_int; + mbmi->mv[1].as_int = xd->mi_8x8[0]->bmi[3].as_mv[1].as_int; } for (i = 0; i < NB_PREDICTION_TYPES; ++i) { diff --git a/vp9/encoder/vp9_segmentation.c b/vp9/encoder/vp9_segmentation.c index 5137d367b..72e6be1e8 100644 --- a/vp9/encoder/vp9_segmentation.c +++ b/vp9/encoder/vp9_segmentation.c @@ -129,9 +129,8 @@ static void count_segs(VP9_COMP *cpi, MODE_INFO **mi_8x8, if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; - segment_id = mi_8x8[0]->mbmi.segment_id; xd->mi_8x8 = mi_8x8; - xd->this_mi = mi_8x8[0]; + segment_id = xd->mi_8x8[0]->mbmi.segment_id; set_mi_row_col(cm, xd, mi_row, bh, mi_col, bw); diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index 08745b01a..746e9731b 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -108,7 +108,7 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, MACROBLOCKD *xd = args->xd; TOKENEXTRA **tp = args->tp; struct macroblockd_plane *pd = &xd->plane[plane]; - MB_MODE_INFO *mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *mbmi = &xd->mi_8x8[0]->mbmi; int pt; /* near block/prev token context index */ int c = 0, rc = 0; TOKENEXTRA *t = *tp; /* store tokens starting here */ @@ -200,7 +200,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; - MB_MODE_INFO *const mbmi = &xd->this_mi->mbmi; + MB_MODE_INFO *const mbmi = &xd->mi_8x8[0]->mbmi; TOKENEXTRA *t_backup = *t; const int mb_skip_context = vp9_get_pred_context_mbskip(xd); const int skip_inc = !vp9_segfeature_active(&cm->seg, mbmi->segment_id, -- 2.40.0