diff options
author | Scott LaVarnway <slavarnway@google.com> | 2016-01-20 12:19:27 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2016-01-20 12:19:27 +0000 |
commit | a7e0b1ea0169c28bea4a11727bab54ee0d6f26ce (patch) | |
tree | a4fa9939916715254c9cf608f6db43c70cc9e6c1 /vp9/encoder | |
parent | 3277d481ebe1cfa8f14006245554cf5745f9a257 (diff) | |
parent | 5232326716af469eafa6d98fba64f8154c69d9f8 (diff) | |
download | libvpx-a7e0b1ea0169c28bea4a11727bab54ee0d6f26ce.tar libvpx-a7e0b1ea0169c28bea4a11727bab54ee0d6f26ce.tar.gz libvpx-a7e0b1ea0169c28bea4a11727bab54ee0d6f26ce.tar.bz2 libvpx-a7e0b1ea0169c28bea4a11727bab54ee0d6f26ce.zip |
Merge "VP9: Eliminate MB_MODE_INFO"
Diffstat (limited to 'vp9/encoder')
-rw-r--r-- | vp9/encoder/vp9_aq_cyclicrefresh.c | 50 | ||||
-rw-r--r-- | vp9/encoder/vp9_aq_cyclicrefresh.h | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_bitstream.c | 66 | ||||
-rw-r--r-- | vp9/encoder/vp9_denoiser.c | 38 | ||||
-rw-r--r-- | vp9/encoder/vp9_denoiser.h | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodeframe.c | 287 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodemb.c | 18 | ||||
-rw-r--r-- | vp9/encoder/vp9_encodemv.c | 19 | ||||
-rw-r--r-- | vp9/encoder/vp9_encoder.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_firstpass.c | 20 | ||||
-rw-r--r-- | vp9/encoder/vp9_mbgraph.c | 12 | ||||
-rw-r--r-- | vp9/encoder/vp9_mcomp.c | 6 | ||||
-rw-r--r-- | vp9/encoder/vp9_pickmode.c | 207 | ||||
-rw-r--r-- | vp9/encoder/vp9_quantize.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_rd.c | 4 | ||||
-rw-r--r-- | vp9/encoder/vp9_rdopt.c | 358 | ||||
-rw-r--r-- | vp9/encoder/vp9_segmentation.c | 10 | ||||
-rw-r--r-- | vp9/encoder/vp9_temporal_filter.c | 2 | ||||
-rw-r--r-- | vp9/encoder/vp9_tokenize.c | 12 |
19 files changed, 555 insertions, 564 deletions
diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.c b/vp9/encoder/vp9_aq_cyclicrefresh.c index 63db214d1..873fe0aac 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.c +++ b/vp9/encoder/vp9_aq_cyclicrefresh.c @@ -85,11 +85,11 @@ static int apply_cyclic_refresh_bitrate(const VP9_COMMON *cm, // size of the coding block (i.e., below min_block size rejected), coding // mode, and rate/distortion. static int candidate_refresh_aq(const CYCLIC_REFRESH *cr, - const MB_MODE_INFO *mbmi, + const MODE_INFO *mi, int64_t rate, int64_t dist, int bsize) { - MV mv = mbmi->mv[0].as_mv; + MV mv = mi->mv[0].as_mv; // Reject the block for lower-qp coding if projected distortion // is above the threshold, and any of the following is true: // 1) mode uses large mv @@ -98,12 +98,12 @@ static int candidate_refresh_aq(const CYCLIC_REFRESH *cr, if (dist > cr->thresh_dist_sb && (mv.row > cr->motion_thresh || mv.row < -cr->motion_thresh || mv.col > cr->motion_thresh || mv.col < -cr->motion_thresh || - !is_inter_block(mbmi))) + !is_inter_block(mi))) return CR_SEGMENT_ID_BASE; else if (bsize >= BLOCK_16X16 && rate < cr->thresh_rate_sb && - is_inter_block(mbmi) && - mbmi->mv[0].as_int == 0 && + is_inter_block(mi) && + mi->mv[0].as_int == 0 && cr->rate_boost_fac > 10) // More aggressive delta-q for bigger blocks with zero motion. return CR_SEGMENT_ID_BOOST2; @@ -186,7 +186,7 @@ int vp9_cyclic_refresh_rc_bits_per_mb(const VP9_COMP *cpi, int i, // check if we should reset the segment_id, and update the cyclic_refresh map // and segmentation map. void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi, - MB_MODE_INFO *const mbmi, + MODE_INFO *const mi, int mi_row, int mi_col, BLOCK_SIZE bsize, int64_t rate, @@ -200,7 +200,7 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi, const int xmis = VPXMIN(cm->mi_cols - mi_col, bw); const int ymis = VPXMIN(cm->mi_rows - mi_row, bh); const int block_index = mi_row * cm->mi_cols + mi_col; - int refresh_this_block = candidate_refresh_aq(cr, mbmi, rate, dist, bsize); + int refresh_this_block = candidate_refresh_aq(cr, mi, rate, dist, bsize); // Default is to not update the refresh map. int new_map_value = cr->map[block_index]; int x = 0; int y = 0; @@ -221,18 +221,18 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi, // If this block is labeled for refresh, check if we should reset the // segment_id. - if (cyclic_refresh_segment_id_boosted(mbmi->segment_id)) { - mbmi->segment_id = refresh_this_block; + if (cyclic_refresh_segment_id_boosted(mi->segment_id)) { + mi->segment_id = refresh_this_block; // Reset segment_id if it will be skipped. if (skip) - mbmi->segment_id = CR_SEGMENT_ID_BASE; + mi->segment_id = CR_SEGMENT_ID_BASE; } // Update the cyclic refresh map, to be used for setting segmentation map // for the next frame. If the block will be refreshed this frame, mark it // as clean. The magnitude of the -ve influences how long before we consider // it for refresh again. - if (cyclic_refresh_segment_id_boosted(mbmi->segment_id)) { + if (cyclic_refresh_segment_id_boosted(mi->segment_id)) { new_map_value = -cr->time_for_refresh; } else if (refresh_this_block) { // Else if it is accepted as candidate for refresh, and has not already @@ -251,17 +251,17 @@ void vp9_cyclic_refresh_update_segment(VP9_COMP *const cpi, for (x = 0; x < xmis; x++) { int map_offset = block_index + y * cm->mi_cols + x; cr->map[map_offset] = new_map_value; - cpi->segmentation_map[map_offset] = mbmi->segment_id; + cpi->segmentation_map[map_offset] = mi->segment_id; } } void vp9_cyclic_refresh_update_sb_postencode(VP9_COMP *const cpi, - const MB_MODE_INFO *const mbmi, + const MODE_INFO *const mi, int mi_row, int mi_col, BLOCK_SIZE bsize) { const VP9_COMMON *const cm = &cpi->common; CYCLIC_REFRESH *const cr = cpi->cyclic_refresh; - MV mv = mbmi->mv[0].as_mv; + MV mv = mi->mv[0].as_mv; const int bw = num_8x8_blocks_wide_lookup[bsize]; const int bh = num_8x8_blocks_high_lookup[bsize]; const int xmis = VPXMIN(cm->mi_cols - mi_col, bw); @@ -275,18 +275,18 @@ void vp9_cyclic_refresh_update_sb_postencode(VP9_COMP *const cpi, // don't update the map for them. For cases where motion is non-zero or // the reference frame isn't the previous frame, the previous value in // the map for this spatial location is not entirely correct. - if ((!is_inter_block(mbmi) || !mbmi->skip) && - mbmi->segment_id <= CR_SEGMENT_ID_BOOST2) { + if ((!is_inter_block(mi) || !mi->skip) && + mi->segment_id <= CR_SEGMENT_ID_BOOST2) { cr->last_coded_q_map[map_offset] = clamp( - cm->base_qindex + cr->qindex_delta[mbmi->segment_id], 0, MAXQ); - } else if (is_inter_block(mbmi) && mbmi->skip && - mbmi->segment_id <= CR_SEGMENT_ID_BOOST2) { + cm->base_qindex + cr->qindex_delta[mi->segment_id], 0, MAXQ); + } else if (is_inter_block(mi) && mi->skip && + mi->segment_id <= CR_SEGMENT_ID_BOOST2) { cr->last_coded_q_map[map_offset] = VPXMIN( - clamp(cm->base_qindex + cr->qindex_delta[mbmi->segment_id], + clamp(cm->base_qindex + cr->qindex_delta[mi->segment_id], 0, MAXQ), cr->last_coded_q_map[map_offset]); // Update the consecutive zero/low_mv count. - if (is_inter_block(mbmi) && (abs(mv.row) < 8 && abs(mv.col) < 8)) { + if (is_inter_block(mi) && (abs(mv.row) < 8 && abs(mv.col) < 8)) { if (cr->consec_zero_mv[map_offset] < 255) cr->consec_zero_mv[map_offset]++; } else { @@ -347,10 +347,10 @@ void vp9_cyclic_refresh_check_golden_update(VP9_COMP *const cpi) { for (mi_row = 0; mi_row < rows; mi_row++) { for (mi_col = 0; mi_col < cols; mi_col++) { - int16_t abs_mvr = mi[0]->mbmi.mv[0].as_mv.row >= 0 ? - mi[0]->mbmi.mv[0].as_mv.row : -1 * mi[0]->mbmi.mv[0].as_mv.row; - int16_t abs_mvc = mi[0]->mbmi.mv[0].as_mv.col >= 0 ? - mi[0]->mbmi.mv[0].as_mv.col : -1 * mi[0]->mbmi.mv[0].as_mv.col; + int16_t abs_mvr = mi[0]->mv[0].as_mv.row >= 0 ? + mi[0]->mv[0].as_mv.row : -1 * mi[0]->mv[0].as_mv.row; + int16_t abs_mvc = mi[0]->mv[0].as_mv.col >= 0 ? + mi[0]->mv[0].as_mv.col : -1 * mi[0]->mv[0].as_mv.col; // Calculate the motion of the background. if (abs_mvr <= 16 && abs_mvc <= 16) { diff --git a/vp9/encoder/vp9_aq_cyclicrefresh.h b/vp9/encoder/vp9_aq_cyclicrefresh.h index edf0a973e..095b9283f 100644 --- a/vp9/encoder/vp9_aq_cyclicrefresh.h +++ b/vp9/encoder/vp9_aq_cyclicrefresh.h @@ -93,13 +93,13 @@ int vp9_cyclic_refresh_rc_bits_per_mb(const struct VP9_COMP *cpi, int i, // check if we should reset the segment_id, and update the cyclic_refresh map // and segmentation map. void vp9_cyclic_refresh_update_segment(struct VP9_COMP *const cpi, - MB_MODE_INFO *const mbmi, + MODE_INFO *const mi, int mi_row, int mi_col, BLOCK_SIZE bsize, int64_t rate, int64_t dist, int skip, struct macroblock_plane *const p); void vp9_cyclic_refresh_update_sb_postencode(struct VP9_COMP *const cpi, - const MB_MODE_INFO *const mbmi, + const MODE_INFO *const mi, int mi_row, int mi_col, BLOCK_SIZE bsize); diff --git a/vp9/encoder/vp9_bitstream.c b/vp9/encoder/vp9_bitstream.c index 1a14ea9aa..5600ed458 100644 --- a/vp9/encoder/vp9_bitstream.c +++ b/vp9/encoder/vp9_bitstream.c @@ -79,8 +79,8 @@ static void prob_diff_update(const vpx_tree_index *tree, static void write_selected_tx_size(const VP9_COMMON *cm, const MACROBLOCKD *xd, vpx_writer *w) { - TX_SIZE tx_size = xd->mi[0]->mbmi.tx_size; - BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; + TX_SIZE tx_size = xd->mi[0]->tx_size; + BLOCK_SIZE bsize = xd->mi[0]->sb_type; const TX_SIZE max_tx_size = max_txsize_lookup[bsize]; const vpx_prob *const tx_probs = get_tx_probs2(max_tx_size, xd, &cm->fc->tx_probs); @@ -97,7 +97,7 @@ static int write_skip(const VP9_COMMON *cm, const MACROBLOCKD *xd, if (segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)) { return 1; } else { - const int skip = mi->mbmi.skip; + const int skip = mi->skip; vpx_write(w, skip, vp9_get_skip_prob(cm, xd)); return skip; } @@ -194,15 +194,15 @@ static void write_segment_id(vpx_writer *w, const struct segmentation *seg, // This function encodes the reference frame static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd, vpx_writer *w) { - const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; - const int is_compound = has_second_ref(mbmi); - const int segment_id = mbmi->segment_id; + const MODE_INFO *const mi = xd->mi[0]; + const int is_compound = has_second_ref(mi); + const int segment_id = mi->segment_id; // If segment level coding of this signal is disabled... // or the segment allows multiple reference frame options if (segfeature_active(&cm->seg, segment_id, SEG_LVL_REF_FRAME)) { assert(!is_compound); - assert(mbmi->ref_frame[0] == + assert(mi->ref_frame[0] == get_segdata(&cm->seg, segment_id, SEG_LVL_REF_FRAME)); } else { // does the feature use compound prediction or not @@ -214,13 +214,13 @@ static void write_ref_frames(const VP9_COMMON *cm, const MACROBLOCKD *xd, } if (is_compound) { - vpx_write(w, mbmi->ref_frame[0] == GOLDEN_FRAME, + vpx_write(w, mi->ref_frame[0] == GOLDEN_FRAME, vp9_get_pred_prob_comp_ref_p(cm, xd)); } else { - const int bit0 = mbmi->ref_frame[0] != LAST_FRAME; + const int bit0 = mi->ref_frame[0] != LAST_FRAME; vpx_write(w, bit0, vp9_get_pred_prob_single_ref_p1(cm, xd)); if (bit0) { - const int bit1 = mbmi->ref_frame[0] != GOLDEN_FRAME; + const int bit1 = mi->ref_frame[0] != GOLDEN_FRAME; vpx_write(w, bit1, vp9_get_pred_prob_single_ref_p2(cm, xd)); } } @@ -234,19 +234,18 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, const MACROBLOCK *const x = &cpi->td.mb; const MACROBLOCKD *const xd = &x->e_mbd; const struct segmentation *const seg = &cm->seg; - const MB_MODE_INFO *const mbmi = &mi->mbmi; const MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; - const PREDICTION_MODE mode = mbmi->mode; - const int segment_id = mbmi->segment_id; - const BLOCK_SIZE bsize = mbmi->sb_type; + const PREDICTION_MODE mode = mi->mode; + const int segment_id = mi->segment_id; + const BLOCK_SIZE bsize = mi->sb_type; const int allow_hp = cm->allow_high_precision_mv; - const int is_inter = is_inter_block(mbmi); - const int is_compound = has_second_ref(mbmi); + const int is_inter = is_inter_block(mi); + const int is_compound = has_second_ref(mi); int skip, ref; if (seg->update_map) { if (seg->temporal_update) { - const int pred_flag = mbmi->seg_id_predicted; + const int pred_flag = mi->seg_id_predicted; vpx_prob pred_prob = vp9_get_pred_prob_seg_id(seg, xd); vpx_write(w, pred_flag, pred_prob); if (!pred_flag) @@ -280,9 +279,9 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, } } } - write_intra_mode(w, mbmi->uv_mode, cm->fc->uv_mode_prob[mode]); + write_intra_mode(w, mi->uv_mode, cm->fc->uv_mode_prob[mode]); } else { - const int mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]]; + const int mode_ctx = mbmi_ext->mode_context[mi->ref_frame[0]]; const vpx_prob *const inter_probs = cm->fc->inter_mode_probs[mode_ctx]; write_ref_frames(cm, xd, w); @@ -297,10 +296,10 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, const int ctx = vp9_get_pred_context_switchable_interp(xd); vp9_write_token(w, vp9_switchable_interp_tree, cm->fc->switchable_interp_prob[ctx], - &switchable_interp_encodings[mbmi->interp_filter]); - ++cpi->interp_filter_selected[0][mbmi->interp_filter]; + &switchable_interp_encodings[mi->interp_filter]); + ++cpi->interp_filter_selected[0][mi->interp_filter]; } else { - assert(mbmi->interp_filter == cm->interp_filter); + assert(mi->interp_filter == cm->interp_filter); } if (bsize < BLOCK_8X8) { @@ -315,7 +314,7 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, if (b_mode == NEWMV) { for (ref = 0; ref < 1 + is_compound; ++ref) vp9_encode_mv(cpi, w, &mi->bmi[j].as_mv[ref].as_mv, - &mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0].as_mv, + &mbmi_ext->ref_mvs[mi->ref_frame[ref]][0].as_mv, nmvc, allow_hp); } } @@ -323,8 +322,8 @@ static void pack_inter_mode_mvs(VP9_COMP *cpi, const MODE_INFO *mi, } else { if (mode == NEWMV) { for (ref = 0; ref < 1 + is_compound; ++ref) - vp9_encode_mv(cpi, w, &mbmi->mv[ref].as_mv, - &mbmi_ext->ref_mvs[mbmi->ref_frame[ref]][0].as_mv, nmvc, + vp9_encode_mv(cpi, w, &mi->mv[ref].as_mv, + &mbmi_ext->ref_mvs[mi->ref_frame[ref]][0].as_mv, nmvc, allow_hp); } } @@ -337,19 +336,18 @@ static void write_mb_modes_kf(const VP9_COMMON *cm, const MACROBLOCKD *xd, const MODE_INFO *const mi = mi_8x8[0]; const MODE_INFO *const above_mi = xd->above_mi; const MODE_INFO *const left_mi = xd->left_mi; - const MB_MODE_INFO *const mbmi = &mi->mbmi; - const BLOCK_SIZE bsize = mbmi->sb_type; + const BLOCK_SIZE bsize = mi->sb_type; if (seg->update_map) - write_segment_id(w, seg, mbmi->segment_id); + write_segment_id(w, seg, mi->segment_id); - write_skip(cm, xd, mbmi->segment_id, mi, w); + write_skip(cm, xd, mi->segment_id, mi, w); if (bsize >= BLOCK_8X8 && cm->tx_mode == TX_MODE_SELECT) write_selected_tx_size(cm, xd, w); if (bsize >= BLOCK_8X8) { - write_intra_mode(w, mbmi->mode, get_y_mode_probs(mi, above_mi, left_mi, 0)); + write_intra_mode(w, mi->mode, get_y_mode_probs(mi, above_mi, left_mi, 0)); } else { const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize]; const int num_4x4_h = num_4x4_blocks_high_lookup[bsize]; @@ -364,7 +362,7 @@ static void write_mb_modes_kf(const VP9_COMMON *cm, const MACROBLOCKD *xd, } } - write_intra_mode(w, mbmi->uv_mode, vp9_kf_uv_mode_prob[mbmi->mode]); + write_intra_mode(w, mi->uv_mode, vp9_kf_uv_mode_prob[mi->mode]); } static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile, @@ -382,8 +380,8 @@ static void write_modes_b(VP9_COMP *cpi, const TileInfo *const tile, (mi_row * cm->mi_cols + mi_col); set_mi_row_col(xd, tile, - mi_row, num_8x8_blocks_high_lookup[m->mbmi.sb_type], - mi_col, num_8x8_blocks_wide_lookup[m->mbmi.sb_type], + mi_row, num_8x8_blocks_high_lookup[m->sb_type], + mi_col, num_8x8_blocks_wide_lookup[m->sb_type], cm->mi_rows, cm->mi_cols); if (frame_is_intra_only(cm)) { write_mb_modes_kf(cm, xd, xd->mi, w); @@ -435,7 +433,7 @@ static void write_modes_sb(VP9_COMP *cpi, m = cm->mi_grid_visible[mi_row * cm->mi_stride + mi_col]; - partition = partition_lookup[bsl][m->mbmi.sb_type]; + partition = partition_lookup[bsl][m->sb_type]; write_partition(cm, xd, bs, mi_row, mi_col, partition, bsize, w); subsize = get_subsize(bsize, partition); if (subsize < BLOCK_8X8) { diff --git a/vp9/encoder/vp9_denoiser.c b/vp9/encoder/vp9_denoiser.c index 37ee3237e..3280e7361 100644 --- a/vp9/encoder/vp9_denoiser.c +++ b/vp9/encoder/vp9_denoiser.c @@ -200,8 +200,8 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser, int sse_diff = ctx->zeromv_sse - ctx->newmv_sse; MV_REFERENCE_FRAME frame; MACROBLOCKD *filter_mbd = &mb->e_mbd; - MB_MODE_INFO *mbmi = &filter_mbd->mi[0]->mbmi; - MB_MODE_INFO saved_mbmi; + MODE_INFO *mi = filter_mbd->mi[0]; + MODE_INFO saved_mi; int i, j; struct buf_2d saved_dst[MAX_MB_PLANE]; struct buf_2d saved_pre[MAX_MB_PLANE][2]; // 2 pre buffers @@ -210,7 +210,7 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser, mv_row = ctx->best_sse_mv.as_mv.row; frame = ctx->best_reference_frame; - saved_mbmi = *mbmi; + saved_mi = *mi; if (is_skin && motion_magnitude > 0) return COPY_BLOCK; @@ -219,9 +219,9 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser, // difference in sum-squared-error, use it. if (frame != INTRA_FRAME && sse_diff > sse_diff_thresh(bs, increase_denoising, motion_magnitude)) { - mbmi->ref_frame[0] = ctx->best_reference_frame; - mbmi->mode = ctx->best_sse_inter_mode; - mbmi->mv[0] = ctx->best_sse_mv; + mi->ref_frame[0] = ctx->best_reference_frame; + mi->mode = ctx->best_sse_inter_mode; + mi->mv[0] = ctx->best_sse_mv; } else { // Otherwise, use the zero reference frame. frame = ctx->best_zeromv_reference_frame; @@ -233,9 +233,9 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser, frame = LAST_FRAME; ctx->newmv_sse = ctx->zeromv_lastref_sse; } - mbmi->ref_frame[0] = frame; - mbmi->mode = ZEROMV; - mbmi->mv[0].as_int = 0; + mi->ref_frame[0] = frame; + mi->mode = ZEROMV; + mi->mv[0].as_int = 0; ctx->best_sse_inter_mode = ZEROMV; ctx->best_sse_mv.as_int = 0; *zeromv_filter = 1; @@ -243,13 +243,13 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser, if (ctx->newmv_sse > sse_thresh(bs, increase_denoising)) { // Restore everything to its original state - *mbmi = saved_mbmi; + *mi = saved_mi; return COPY_BLOCK; } if (motion_magnitude > (noise_motion_thresh(bs, increase_denoising) << 3)) { // Restore everything to its original state - *mbmi = saved_mbmi; + *mi = saved_mi; return COPY_BLOCK; } @@ -302,7 +302,7 @@ static VP9_DENOISER_DECISION perform_motion_compensation(VP9_DENOISER *denoiser, vp9_build_inter_predictors_sby(filter_mbd, mv_row, mv_col, bs); // Restore everything to its original state - *mbmi = saved_mbmi; + *mi = saved_mi; for (i = 0; i < MAX_MB_PLANE; ++i) { for (j = 0; j < 2; ++j) { filter_mbd->plane[i].pre[j] = saved_pre[i][j]; @@ -461,22 +461,22 @@ void vp9_denoiser_reset_frame_stats(PICK_MODE_CONTEXT *ctx) { ctx->zeromv_lastref_sse = UINT_MAX; } -void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi, unsigned int sse, +void vp9_denoiser_update_frame_stats(MODE_INFO *mi, unsigned int sse, PREDICTION_MODE mode, PICK_MODE_CONTEXT *ctx) { // TODO(tkopp): Use both MVs if possible - if (mbmi->mv[0].as_int == 0 && sse < ctx->zeromv_sse) { + if (mi->mv[0].as_int == 0 && sse < ctx->zeromv_sse) { ctx->zeromv_sse = sse; - ctx->best_zeromv_reference_frame = mbmi->ref_frame[0]; - if (mbmi->ref_frame[0] == LAST_FRAME) + ctx->best_zeromv_reference_frame = mi->ref_frame[0]; + if (mi->ref_frame[0] == LAST_FRAME) ctx->zeromv_lastref_sse = sse; } - if (mbmi->mv[0].as_int != 0 && sse < ctx->newmv_sse) { + if (mi->mv[0].as_int != 0 && sse < ctx->newmv_sse) { ctx->newmv_sse = sse; ctx->best_sse_inter_mode = mode; - ctx->best_sse_mv = mbmi->mv[0]; - ctx->best_reference_frame = mbmi->ref_frame[0]; + ctx->best_sse_mv = mi->mv[0]; + ctx->best_reference_frame = mi->ref_frame[0]; } } diff --git a/vp9/encoder/vp9_denoiser.h b/vp9/encoder/vp9_denoiser.h index d07056b45..12dd5b5fa 100644 --- a/vp9/encoder/vp9_denoiser.h +++ b/vp9/encoder/vp9_denoiser.h @@ -60,7 +60,7 @@ void vp9_denoiser_denoise(VP9_DENOISER *denoiser, MACROBLOCK *mb, void vp9_denoiser_reset_frame_stats(PICK_MODE_CONTEXT *ctx); -void vp9_denoiser_update_frame_stats(MB_MODE_INFO *mbmi, +void vp9_denoiser_update_frame_stats(MODE_INFO *mi, unsigned int sse, PREDICTION_MODE mode, PICK_MODE_CONTEXT *ctx); diff --git a/vp9/encoder/vp9_encodeframe.c b/vp9/encoder/vp9_encodeframe.c index 6e999ca5e..6deac7ae9 100644 --- a/vp9/encoder/vp9_encodeframe.c +++ b/vp9/encoder/vp9_encodeframe.c @@ -187,7 +187,7 @@ static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile, BLOCK_SIZE bsize) { VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *mbmi; + MODE_INFO *mi; const int mi_width = num_8x8_blocks_wide_lookup[bsize]; const int mi_height = num_8x8_blocks_high_lookup[bsize]; const struct segmentation *const seg = &cm->seg; @@ -196,7 +196,7 @@ static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile, set_mode_info_offsets(cm, x, xd, mi_row, mi_col); - mbmi = &xd->mi[0]->mbmi; + mi = xd->mi[0]; // Set up destination pointers. vp9_setup_dst_planes(xd->plane, get_frame_new_buffer(cm), mi_row, mi_col); @@ -226,13 +226,13 @@ static void set_offsets(VP9_COMP *cpi, const TileInfo *const tile, cpi->oxcf.aq_mode != EQUATOR360_AQ) { const uint8_t *const map = seg->update_map ? cpi->segmentation_map : cm->last_frame_seg_map; - mbmi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); + mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); } vp9_init_plane_quantizers(cpi, x); - x->encode_breakout = cpi->segment_encode_breakout[mbmi->segment_id]; + x->encode_breakout = cpi->segment_encode_breakout[mi->segment_id]; } else { - mbmi->segment_id = 0; + mi->segment_id = 0; x->encode_breakout = cpi->encode_breakout; } @@ -260,7 +260,7 @@ static void set_block_size(VP9_COMP * const cpi, BLOCK_SIZE bsize) { if (cpi->common.mi_cols > mi_col && cpi->common.mi_rows > mi_row) { set_mode_info_offsets(&cpi->common, x, xd, mi_row, mi_col); - xd->mi[0]->mbmi.sb_type = bsize; + xd->mi[0]->sb_type = bsize; } } @@ -718,7 +718,7 @@ static int choose_partitioning(VP9_COMP *cpi, // In the case of spatial/temporal scalable coding, the assumption here is // that the temporal reference frame will always be of type LAST_FRAME. // TODO(marpan): If that assumption is broken, we need to revisit this code. - MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; + MODE_INFO *mi = xd->mi[0]; unsigned int uv_sad; const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, LAST_FRAME); @@ -749,21 +749,21 @@ static int choose_partitioning(VP9_COMP *cpi, vp9_setup_pre_planes(xd, 0, yv12, mi_row, mi_col, &cm->frame_refs[LAST_FRAME - 1].sf); - mbmi->ref_frame[0] = LAST_FRAME; - mbmi->ref_frame[1] = NONE; - mbmi->sb_type = BLOCK_64X64; - mbmi->mv[0].as_int = 0; - mbmi->interp_filter = BILINEAR; + mi->ref_frame[0] = LAST_FRAME; + mi->ref_frame[1] = NONE; + mi->sb_type = BLOCK_64X64; + mi->mv[0].as_int = 0; + mi->interp_filter = BILINEAR; y_sad = vp9_int_pro_motion_estimation(cpi, x, bsize, mi_row, mi_col); if (y_sad_g < y_sad) { vp9_setup_pre_planes(xd, 0, yv12_g, mi_row, mi_col, &cm->frame_refs[GOLDEN_FRAME - 1].sf); - mbmi->ref_frame[0] = GOLDEN_FRAME; - mbmi->mv[0].as_int = 0; + mi->ref_frame[0] = GOLDEN_FRAME; + mi->mv[0].as_int = 0; y_sad = y_sad_g; } else { - x->pred_mv[LAST_FRAME] = mbmi->mv[0].as_mv; + x->pred_mv[LAST_FRAME] = mi->mv[0].as_mv; } vp9_build_inter_predictors_sb(xd, mi_row, mi_col, BLOCK_64X64); @@ -1012,11 +1012,11 @@ static void update_state(VP9_COMP *cpi, ThreadData *td, struct macroblock_plane *const p = x->plane; struct macroblockd_plane *const pd = xd->plane; MODE_INFO *mi = &ctx->mic; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const xdmi = xd->mi[0]; MODE_INFO *mi_addr = xd->mi[0]; const struct segmentation *const seg = &cm->seg; - const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type]; - const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type]; + const int bw = num_8x8_blocks_wide_lookup[mi->sb_type]; + const int bh = num_8x8_blocks_high_lookup[mi->sb_type]; const int x_mis = VPXMIN(bw, cm->mi_cols - mi_col); const int y_mis = VPXMIN(bh, cm->mi_rows - mi_row); MV_REF *const frame_mvs = @@ -1028,7 +1028,7 @@ static void update_state(VP9_COMP *cpi, ThreadData *td, const int mi_height = num_8x8_blocks_high_lookup[bsize]; int max_plane; - assert(mi->mbmi.sb_type == bsize); + assert(mi->sb_type == bsize); *mi_addr = *mi; *x->mbmi_ext = ctx->mbmi_ext; @@ -1039,19 +1039,19 @@ static void update_state(VP9_COMP *cpi, ThreadData *td, if (cpi->oxcf.aq_mode == COMPLEXITY_AQ) { const uint8_t *const map = seg->update_map ? cpi->segmentation_map : cm->last_frame_seg_map; - mi_addr->mbmi.segment_id = + mi_addr->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); } // Else for cyclic refresh mode update the segment map, set the segment id // and then update the quantizer. if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) { - vp9_cyclic_refresh_update_segment(cpi, &xd->mi[0]->mbmi, mi_row, + vp9_cyclic_refresh_update_segment(cpi, xd->mi[0], mi_row, mi_col, bsize, ctx->rate, ctx->dist, x->skip, p); } } - max_plane = is_inter_block(mbmi) ? MAX_MB_PLANE : 1; + max_plane = is_inter_block(xdmi) ? MAX_MB_PLANE : 1; for (i = 0; i < max_plane; ++i) { p[i].coeff = ctx->coeff_pbuf[i][1]; p[i].qcoeff = ctx->qcoeff_pbuf[i][1]; @@ -1078,13 +1078,13 @@ static void update_state(VP9_COMP *cpi, ThreadData *td, if (cpi->oxcf.aq_mode) vp9_init_plane_quantizers(cpi, x); - if (is_inter_block(mbmi) && mbmi->sb_type < BLOCK_8X8) { - mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int; - mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int; + if (is_inter_block(xdmi) && xdmi->sb_type < BLOCK_8X8) { + xdmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int; + xdmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int; } x->skip = ctx->skip; - memcpy(x->zcoeff_blk[mbmi->tx_size], ctx->zcoeff_blk, + memcpy(x->zcoeff_blk[xdmi->tx_size], ctx->zcoeff_blk, sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk); if (!output_enabled) @@ -1111,12 +1111,12 @@ static void update_state(VP9_COMP *cpi, ThreadData *td, } #endif if (!frame_is_intra_only(cm)) { - if (is_inter_block(mbmi)) { + if (is_inter_block(xdmi)) { vp9_update_mv_count(td); if (cm->interp_filter == SWITCHABLE) { const int ctx = vp9_get_pred_context_switchable_interp(xd); - ++td->counts->switchable_interp[ctx][mbmi->interp_filter]; + ++td->counts->switchable_interp[ctx][xdmi->interp_filter]; } } @@ -1132,10 +1132,10 @@ static void update_state(VP9_COMP *cpi, ThreadData *td, MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols; for (w = 0; w < x_mis; ++w) { MV_REF *const mv = frame_mv + w; - mv->ref_frame[0] = mi->mbmi.ref_frame[0]; - mv->ref_frame[1] = mi->mbmi.ref_frame[1]; - mv->mv[0].as_int = mi->mbmi.mv[0].as_int; - mv->mv[1].as_int = mi->mbmi.mv[1].as_int; + mv->ref_frame[0] = mi->ref_frame[0]; + mv->ref_frame[1] = mi->ref_frame[1]; + mv->mv[0].as_int = mi->mv[0].as_int; + mv->mv[1].as_int = mi->mv[1].as_int; } } } @@ -1158,26 +1158,26 @@ void vp9_setup_src_planes(MACROBLOCK *x, const YV12_BUFFER_CONFIG *src, static void set_mode_info_seg_skip(MACROBLOCK *x, TX_MODE tx_mode, RD_COST *rd_cost, BLOCK_SIZE bsize) { MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; INTERP_FILTER filter_ref; if (xd->up_available) - filter_ref = xd->mi[-xd->mi_stride]->mbmi.interp_filter; + filter_ref = xd->mi[-xd->mi_stride]->interp_filter; else if (xd->left_available) - filter_ref = xd->mi[-1]->mbmi.interp_filter; + filter_ref = xd->mi[-1]->interp_filter; else filter_ref = EIGHTTAP; - mbmi->sb_type = bsize; - mbmi->mode = ZEROMV; - mbmi->tx_size = + mi->sb_type = bsize; + mi->mode = ZEROMV; + mi->tx_size = VPXMIN(max_txsize_lookup[bsize], tx_mode_to_biggest_tx_size[tx_mode]); - mbmi->skip = 1; - mbmi->uv_mode = DC_PRED; - mbmi->ref_frame[0] = LAST_FRAME; - mbmi->ref_frame[1] = NONE; - mbmi->mv[0].as_int = 0; - mbmi->interp_filter = filter_ref; + mi->skip = 1; + mi->uv_mode = DC_PRED; + mi->ref_frame[0] = LAST_FRAME; + mi->ref_frame[1] = NONE; + mi->mv[0].as_int = 0; + mi->interp_filter = filter_ref; xd->mi[0]->bmi[0].as_mv[0].as_int = 0; x->skip = 1; @@ -1206,7 +1206,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, VP9_COMMON *const cm = &cpi->common; TileInfo *const tile_info = &tile_data->tile_info; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *mbmi; + MODE_INFO *mi; struct macroblock_plane *const p = x->plane; struct macroblockd_plane *const pd = xd->plane; const AQ_MODE aq_mode = cpi->oxcf.aq_mode; @@ -1218,8 +1218,8 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, x->use_lp32x32fdct = 1; set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize); - mbmi = &xd->mi[0]->mbmi; - mbmi->sb_type = bsize; + mi = xd->mi[0]; + mi->sb_type = bsize; for (i = 0; i < MAX_MB_PLANE; ++i) { p[i].coeff = ctx->coeff_pbuf[i][0]; @@ -1233,7 +1233,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, x->skip_recode = 0; // Set to zero to make sure we do not use the previous encoded frame stats - mbmi->skip = 0; + mi->skip = 0; #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { @@ -1258,24 +1258,24 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, if (cm->frame_type == KEY_FRAME || cpi->refresh_alt_ref_frame || (cpi->refresh_golden_frame && !cpi->rc.is_src_frame_alt_ref)) { - mbmi->segment_id = vp9_vaq_segment_id(energy); + mi->segment_id = vp9_vaq_segment_id(energy); } else { const uint8_t *const map = cm->seg.update_map ? cpi->segmentation_map : cm->last_frame_seg_map; - mbmi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); + mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); } - x->rdmult = set_segment_rdmult(cpi, x, mbmi->segment_id); + x->rdmult = set_segment_rdmult(cpi, x, mi->segment_id); } else if (aq_mode == EQUATOR360_AQ) { if (cm->frame_type == KEY_FRAME) { - mbmi->segment_id = vp9_360aq_segment_id(mi_row, cm->mi_rows); + mi->segment_id = vp9_360aq_segment_id(mi_row, cm->mi_rows); } else { const uint8_t *const map = cm->seg.update_map ? cpi->segmentation_map : cm->last_frame_seg_map; - mbmi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); + mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); } - x->rdmult = set_segment_rdmult(cpi, x, mbmi->segment_id); + x->rdmult = set_segment_rdmult(cpi, x, mi->segment_id); } else if (aq_mode == COMPLEXITY_AQ) { - x->rdmult = set_segment_rdmult(cpi, x, mbmi->segment_id); + x->rdmult = set_segment_rdmult(cpi, x, mi->segment_id); } else if (aq_mode == CYCLIC_REFRESH_AQ) { const uint8_t *const map = cm->seg.update_map ? cpi->segmentation_map : cm->last_frame_seg_map; @@ -1291,7 +1291,7 @@ static void rd_pick_sb_modes(VP9_COMP *cpi, vp9_rd_pick_intra_mode_sb(cpi, x, rd_cost, bsize, ctx, best_rd); } else { if (bsize >= BLOCK_8X8) { - if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) + if (segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_SKIP)) vp9_rd_pick_inter_mode_sb_seg_skip(cpi, tile_data, x, rd_cost, bsize, ctx, best_rd); else @@ -1328,14 +1328,13 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) { const MACROBLOCK *x = &td->mb; const MACROBLOCKD *const xd = &x->e_mbd; const MODE_INFO *const mi = xd->mi[0]; - const MB_MODE_INFO *const mbmi = &mi->mbmi; const MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; - const BLOCK_SIZE bsize = mbmi->sb_type; + const BLOCK_SIZE bsize = mi->sb_type; if (!frame_is_intra_only(cm)) { FRAME_COUNTS *const counts = td->counts; - const int inter_block = is_inter_block(mbmi); - const int seg_ref_active = segfeature_active(&cm->seg, mbmi->segment_id, + const int inter_block = is_inter_block(mi); + const int seg_ref_active = segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_REF_FRAME); if (!seg_ref_active) { counts->intra_inter[vp9_get_intra_inter_context(xd)][inter_block]++; @@ -1343,12 +1342,12 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) { // reference frame allowed for the segment so exclude it from // the reference frame counts used to work out probabilities. if (inter_block) { - const MV_REFERENCE_FRAME ref0 = mbmi->ref_frame[0]; + const MV_REFERENCE_FRAME ref0 = mi->ref_frame[0]; if (cm->reference_mode == REFERENCE_MODE_SELECT) counts->comp_inter[vp9_get_reference_mode_context(cm, xd)] - [has_second_ref(mbmi)]++; + [has_second_ref(mi)]++; - if (has_second_ref(mbmi)) { + if (has_second_ref(mi)) { counts->comp_ref[vp9_get_pred_context_comp_ref_p(cm, xd)] [ref0 == GOLDEN_FRAME]++; } else { @@ -1361,10 +1360,10 @@ static void update_stats(VP9_COMMON *cm, ThreadData *td) { } } if (inter_block && - !segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) { - const int mode_ctx = mbmi_ext->mode_context[mbmi->ref_frame[0]]; + !segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_SKIP)) { + const int mode_ctx = mbmi_ext->mode_context[mi->ref_frame[0]]; if (bsize >= BLOCK_8X8) { - const PREDICTION_MODE mode = mbmi->mode; + const PREDICTION_MODE mode = mi->mode; ++counts->inter_mode[mode_ctx][INTER_OFFSET(mode)]; } else { const int num_4x4_w = num_4x4_blocks_wide_lookup[bsize]; @@ -1566,7 +1565,7 @@ static void set_partial_b64x64_partition(MODE_INFO *mi, int mis, for (c = 0; c < MI_BLOCK_SIZE; c += bw) { const int index = r * mis + c; mi_8x8[index] = mi + index; - mi_8x8[index]->mbmi.sb_type = find_partition_size(bsize, + mi_8x8[index]->sb_type = find_partition_size(bsize, row8x8_remaining - r, col8x8_remaining - c, &bh, &bw); } } @@ -1598,7 +1597,7 @@ static void set_fixed_partitioning(VP9_COMP *cpi, const TileInfo *const tile, for (block_col = 0; block_col < MI_BLOCK_SIZE; block_col += bw) { int index = block_row * mis + block_col; mi_8x8[index] = mi_upper_left + index; - mi_8x8[index]->mbmi.sb_type = bsize; + mi_8x8[index]->sb_type = bsize; } } } else { @@ -1663,7 +1662,7 @@ static void set_source_var_based_partition(VP9_COMP *cpi, index = b_mi_row * mis + b_mi_col; mi_8x8[index] = mi_upper_left + index; - mi_8x8[index]->mbmi.sb_type = BLOCK_16X16; + mi_8x8[index]->sb_type = BLOCK_16X16; // TODO(yunqingwang): If d16[j].var is very large, use 8x8 partition // size to further improve quality. @@ -1685,7 +1684,7 @@ static void set_source_var_based_partition(VP9_COMP *cpi, index = coord_lookup[i*4].row * mis + coord_lookup[i*4].col; mi_8x8[index] = mi_upper_left + index; - mi_8x8[index]->mbmi.sb_type = BLOCK_32X32; + mi_8x8[index]->sb_type = BLOCK_32X32; } } @@ -1697,7 +1696,7 @@ static void set_source_var_based_partition(VP9_COMP *cpi, // Use 64x64 partition if (is_larger_better) { mi_8x8[0] = mi_upper_left; - mi_8x8[0]->mbmi.sb_type = BLOCK_64X64; + mi_8x8[0]->sb_type = BLOCK_64X64; } } } else { // partial in-image SB64 @@ -1715,11 +1714,10 @@ static void update_state_rt(VP9_COMP *cpi, ThreadData *td, MACROBLOCK *const x = &td->mb; MACROBLOCKD *const xd = &x->e_mbd; MODE_INFO *const mi = xd->mi[0]; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; struct macroblock_plane *const p = x->plane; const struct segmentation *const seg = &cm->seg; - const int bw = num_8x8_blocks_wide_lookup[mi->mbmi.sb_type]; - const int bh = num_8x8_blocks_high_lookup[mi->mbmi.sb_type]; + const int bw = num_8x8_blocks_wide_lookup[mi->sb_type]; + const int bh = num_8x8_blocks_high_lookup[mi->sb_type]; const int x_mis = VPXMIN(bw, cm->mi_cols - mi_col); const int y_mis = VPXMIN(bh, cm->mi_rows - mi_row); @@ -1734,25 +1732,25 @@ static void update_state_rt(VP9_COMP *cpi, ThreadData *td, cpi->oxcf.aq_mode == EQUATOR360_AQ) { const uint8_t *const map = seg->update_map ? cpi->segmentation_map : cm->last_frame_seg_map; - mbmi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); + mi->segment_id = get_segment_id(cm, map, bsize, mi_row, mi_col); } else { // Setting segmentation map for cyclic_refresh. - vp9_cyclic_refresh_update_segment(cpi, mbmi, mi_row, mi_col, bsize, + vp9_cyclic_refresh_update_segment(cpi, mi, mi_row, mi_col, bsize, ctx->rate, ctx->dist, x->skip, p); } vp9_init_plane_quantizers(cpi, x); } - if (is_inter_block(mbmi)) { + if (is_inter_block(mi)) { vp9_update_mv_count(td); if (cm->interp_filter == SWITCHABLE) { const int pred_ctx = vp9_get_pred_context_switchable_interp(xd); - ++td->counts->switchable_interp[pred_ctx][mbmi->interp_filter]; + ++td->counts->switchable_interp[pred_ctx][mi->interp_filter]; } - if (mbmi->sb_type < BLOCK_8X8) { - mbmi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int; - mbmi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int; + if (mi->sb_type < BLOCK_8X8) { + mi->mv[0].as_int = mi->bmi[3].as_mv[0].as_int; + mi->mv[1].as_int = mi->bmi[3].as_mv[1].as_int; } } @@ -1765,16 +1763,16 @@ static void update_state_rt(VP9_COMP *cpi, ThreadData *td, MV_REF *const frame_mv = frame_mvs + h * cm->mi_cols; for (w = 0; w < x_mis; ++w) { MV_REF *const mv = frame_mv + w; - mv->ref_frame[0] = mi->mbmi.ref_frame[0]; - mv->ref_frame[1] = mi->mbmi.ref_frame[1]; - mv->mv[0].as_int = mi->mbmi.mv[0].as_int; - mv->mv[1].as_int = mi->mbmi.mv[1].as_int; + mv->ref_frame[0] = mi->ref_frame[0]; + mv->ref_frame[1] = mi->ref_frame[1]; + mv->mv[0].as_int = mi->mv[0].as_int; + mv->mv[1].as_int = mi->mv[1].as_int; } } } x->skip = ctx->skip; - x->skip_txfm[0] = mbmi->segment_id ? 0 : ctx->skip_txfm[0]; + x->skip_txfm[0] = mi->segment_id ? 0 : ctx->skip_txfm[0]; } static void encode_b_rt(VP9_COMP *cpi, ThreadData *td, @@ -1814,7 +1812,7 @@ static void encode_sb_rt(VP9_COMP *cpi, ThreadData *td, const int idx_str = xd->mi_stride * mi_row + mi_col; MODE_INFO ** mi_8x8 = cm->mi_grid_visible + idx_str; ctx = partition_plane_context(xd, mi_row, mi_col, bsize); - subsize = mi_8x8[0]->mbmi.sb_type; + subsize = mi_8x8[0]->sb_type; } else { ctx = 0; subsize = BLOCK_4X4; @@ -1889,7 +1887,7 @@ static void rd_use_partition(VP9_COMP *cpi, RD_COST last_part_rdc, none_rdc, chosen_rdc; BLOCK_SIZE sub_subsize = BLOCK_4X4; int splits_below = 0; - BLOCK_SIZE bs_type = mi_8x8[0]->mbmi.sb_type; + BLOCK_SIZE bs_type = mi_8x8[0]->sb_type; int do_partition_search = 1; PICK_MODE_CONTEXT *ctx = &pc_tree->none; @@ -1924,7 +1922,7 @@ static void rd_use_partition(VP9_COMP *cpi, for (i = 0; i < 4; i++) { int jj = i >> 1, ii = i & 0x01; MODE_INFO *this_mi = mi_8x8[jj * bss * mis + ii * bss]; - if (this_mi && this_mi->mbmi.sb_type >= sub_subsize) { + if (this_mi && this_mi->sb_type >= sub_subsize) { splits_below = 0; } } @@ -1948,7 +1946,7 @@ static void rd_use_partition(VP9_COMP *cpi, } restore_context(x, mi_row, mi_col, a, l, sa, sl, bsize); - mi_8x8[0]->mbmi.sb_type = bs_type; + mi_8x8[0]->sb_type = bs_type; pc_tree->partitioning = partition; } } @@ -2106,7 +2104,7 @@ static void rd_use_partition(VP9_COMP *cpi, // If last_part is better set the partitioning to that. if (last_part_rdc.rdcost < chosen_rdc.rdcost) { - mi_8x8[0]->mbmi.sb_type = bsize; + mi_8x8[0]->sb_type = bsize; if (bsize >= BLOCK_8X8) pc_tree->partitioning = partition; chosen_rdc = last_part_rdc; @@ -2172,7 +2170,7 @@ static void get_sb_partition_size_range(MACROBLOCKD *xd, MODE_INFO **mi_8x8, for (i = 0; i < sb_height_in_blocks; ++i) { for (j = 0; j < sb_width_in_blocks; ++j) { MODE_INFO *mi = mi_8x8[index+j]; - BLOCK_SIZE sb_type = mi ? mi->mbmi.sb_type : 0; + BLOCK_SIZE sb_type = mi ? mi->sb_type : 0; bs_hist[sb_type]++; *min_block_size = VPXMIN(*min_block_size, sb_type); *max_block_size = VPXMAX(*max_block_size, sb_type); @@ -2288,7 +2286,7 @@ static void set_partition_range(VP9_COMMON *cm, MACROBLOCKD *xd, for (idy = 0; idy < mi_height; ++idy) { for (idx = 0; idx < mi_width; ++idx) { mi = prev_mi[idy * cm->mi_stride + idx]; - bs = mi ? mi->mbmi.sb_type : bsize; + bs = mi ? mi->sb_type : bsize; min_size = VPXMIN(min_size, bs); max_size = VPXMAX(max_size, bs); } @@ -2298,7 +2296,7 @@ static void set_partition_range(VP9_COMMON *cm, MACROBLOCKD *xd, if (xd->left_available) { for (idy = 0; idy < mi_height; ++idy) { mi = xd->mi[idy * cm->mi_stride - 1]; - bs = mi ? mi->mbmi.sb_type : bsize; + bs = mi ? mi->sb_type : bsize; min_size = VPXMIN(min_size, bs); max_size = VPXMAX(max_size, bs); } @@ -2307,7 +2305,7 @@ static void set_partition_range(VP9_COMMON *cm, MACROBLOCKD *xd, if (xd->up_available) { for (idx = 0; idx < mi_width; ++idx) { mi = xd->mi[idx - cm->mi_stride]; - bs = mi ? mi->mbmi.sb_type : bsize; + bs = mi ? mi->sb_type : bsize; min_size = VPXMIN(min_size, bs); max_size = VPXMAX(max_size, bs); } @@ -2625,7 +2623,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, i = 4; if (cpi->sf.adaptive_pred_interp_filter && partition_none_allowed) pc_tree->leaf_split[0]->pred_interp_filter = - ctx->mic.mbmi.interp_filter; + ctx->mic.interp_filter; rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize, pc_tree->leaf_split[0], best_rdc.rdcost); if (sum_rdc.rate == INT_MAX) @@ -2696,7 +2694,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 && partition_none_allowed) pc_tree->horizontal[0].pred_interp_filter = - ctx->mic.mbmi.interp_filter; + ctx->mic.interp_filter; rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize, &pc_tree->horizontal[0], best_rdc.rdcost); @@ -2711,7 +2709,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 && partition_none_allowed) pc_tree->horizontal[1].pred_interp_filter = - ctx->mic.mbmi.interp_filter; + ctx->mic.interp_filter; rd_pick_sb_modes(cpi, tile_data, x, mi_row + mi_step, mi_col, &this_rdc, subsize, &pc_tree->horizontal[1], best_rdc.rdcost - sum_rdc.rdcost); @@ -2749,7 +2747,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 && partition_none_allowed) pc_tree->vertical[0].pred_interp_filter = - ctx->mic.mbmi.interp_filter; + ctx->mic.interp_filter; rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize, &pc_tree->vertical[0], best_rdc.rdcost); if (sum_rdc.rdcost < best_rdc.rdcost && mi_col + mi_step < cm->mi_cols && @@ -2763,7 +2761,7 @@ static void rd_pick_partition(VP9_COMP *cpi, ThreadData *td, if (cpi->sf.adaptive_pred_interp_filter && bsize == BLOCK_8X8 && partition_none_allowed) pc_tree->vertical[1].pred_interp_filter = - ctx->mic.mbmi.interp_filter; + ctx->mic.interp_filter; rd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col + mi_step, &this_rdc, subsize, &pc_tree->vertical[1], best_rdc.rdcost - sum_rdc.rdcost); @@ -2935,8 +2933,8 @@ static void reset_skip_tx_size(VP9_COMMON *cm, TX_SIZE max_tx_size) { for (mi_row = 0; mi_row < cm->mi_rows; ++mi_row, mi_ptr += mis) { for (mi_col = 0; mi_col < cm->mi_cols; ++mi_col) { - if (mi_ptr[mi_col]->mbmi.tx_size > max_tx_size) - mi_ptr[mi_col]->mbmi.tx_size = max_tx_size; + if (mi_ptr[mi_col]->tx_size > max_tx_size) + mi_ptr[mi_col]->tx_size = max_tx_size; } } } @@ -2983,18 +2981,18 @@ static void nonrd_pick_sb_modes(VP9_COMP *cpi, VP9_COMMON *const cm = &cpi->common; TileInfo *const tile_info = &tile_data->tile_info; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *mbmi; + MODE_INFO *mi; set_offsets(cpi, tile_info, x, mi_row, mi_col, bsize); - mbmi = &xd->mi[0]->mbmi; - mbmi->sb_type = bsize; + mi = xd->mi[0]; + mi->sb_type = bsize; if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->seg.enabled) - if (cyclic_refresh_segment_id_boosted(mbmi->segment_id)) + if (cyclic_refresh_segment_id_boosted(mi->segment_id)) x->rdmult = vp9_cyclic_refresh_get_rdmult(cpi->cyclic_refresh); if (cm->frame_type == KEY_FRAME) hybrid_intra_mode_search(cpi, x, rd_cost, bsize, ctx); - else if (segfeature_active(&cm->seg, mbmi->segment_id, SEG_LVL_SKIP)) + else if (segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_SKIP)) set_mode_info_seg_skip(x, cm->tx_mode, rd_cost, bsize); else if (bsize >= BLOCK_8X8) vp9_pick_inter_mode(cpi, x, tile_data, mi_row, mi_col, @@ -3154,7 +3152,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td, if (partition_none_allowed) { nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &this_rdc, bsize, ctx); - ctx->mic.mbmi = xd->mi[0]->mbmi; + ctx->mic = *xd->mi[0]; ctx->mbmi_ext = *x->mbmi_ext; ctx->skip_txfm[0] = x->skip_txfm[0]; ctx->skip = x->skip; @@ -3237,7 +3235,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td, nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize, &pc_tree->horizontal[0]); - pc_tree->horizontal[0].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->horizontal[0].mic = *xd->mi[0]; pc_tree->horizontal[0].mbmi_ext = *x->mbmi_ext; pc_tree->horizontal[0].skip_txfm[0] = x->skip_txfm[0]; pc_tree->horizontal[0].skip = x->skip; @@ -3249,7 +3247,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td, &this_rdc, subsize, &pc_tree->horizontal[1]); - pc_tree->horizontal[1].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->horizontal[1].mic = *xd->mi[0]; pc_tree->horizontal[1].mbmi_ext = *x->mbmi_ext; pc_tree->horizontal[1].skip_txfm[0] = x->skip_txfm[0]; pc_tree->horizontal[1].skip = x->skip; @@ -3282,7 +3280,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td, pc_tree->vertical[0].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, &sum_rdc, subsize, &pc_tree->vertical[0]); - pc_tree->vertical[0].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->vertical[0].mic = *xd->mi[0]; pc_tree->vertical[0].mbmi_ext = *x->mbmi_ext; pc_tree->vertical[0].skip_txfm[0] = x->skip_txfm[0]; pc_tree->vertical[0].skip = x->skip; @@ -3293,7 +3291,7 @@ static void nonrd_pick_partition(VP9_COMP *cpi, ThreadData *td, nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col + ms, &this_rdc, subsize, &pc_tree->vertical[1]); - pc_tree->vertical[1].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->vertical[1].mic = *xd->mi[0]; pc_tree->vertical[1].mbmi_ext = *x->mbmi_ext; pc_tree->vertical[1].skip_txfm[0] = x->skip_txfm[0]; pc_tree->vertical[1].skip = x->skip; @@ -3365,7 +3363,7 @@ static void nonrd_select_partition(VP9_COMP *cpi, if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; - subsize = (bsize >= BLOCK_8X8) ? mi[0]->mbmi.sb_type : BLOCK_4X4; + subsize = (bsize >= BLOCK_8X8) ? mi[0]->sb_type : BLOCK_4X4; partition = partition_lookup[bsl][subsize]; if (bsize == BLOCK_32X32 && subsize == BLOCK_32X32) { @@ -3390,7 +3388,7 @@ static void nonrd_select_partition(VP9_COMP *cpi, pc_tree->none.pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, rd_cost, subsize, &pc_tree->none); - pc_tree->none.mic.mbmi = xd->mi[0]->mbmi; + pc_tree->none.mic = *xd->mi[0]; pc_tree->none.mbmi_ext = *x->mbmi_ext; pc_tree->none.skip_txfm[0] = x->skip_txfm[0]; pc_tree->none.skip = x->skip; @@ -3399,7 +3397,7 @@ static void nonrd_select_partition(VP9_COMP *cpi, pc_tree->vertical[0].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, rd_cost, subsize, &pc_tree->vertical[0]); - pc_tree->vertical[0].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->vertical[0].mic = *xd->mi[0]; pc_tree->vertical[0].mbmi_ext = *x->mbmi_ext; pc_tree->vertical[0].skip_txfm[0] = x->skip_txfm[0]; pc_tree->vertical[0].skip = x->skip; @@ -3407,7 +3405,7 @@ static void nonrd_select_partition(VP9_COMP *cpi, pc_tree->vertical[1].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col + hbs, &this_rdc, subsize, &pc_tree->vertical[1]); - pc_tree->vertical[1].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->vertical[1].mic = *xd->mi[0]; pc_tree->vertical[1].mbmi_ext = *x->mbmi_ext; pc_tree->vertical[1].skip_txfm[0] = x->skip_txfm[0]; pc_tree->vertical[1].skip = x->skip; @@ -3422,7 +3420,7 @@ static void nonrd_select_partition(VP9_COMP *cpi, pc_tree->horizontal[0].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, rd_cost, subsize, &pc_tree->horizontal[0]); - pc_tree->horizontal[0].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->horizontal[0].mic = *xd->mi[0]; pc_tree->horizontal[0].mbmi_ext = *x->mbmi_ext; pc_tree->horizontal[0].skip_txfm[0] = x->skip_txfm[0]; pc_tree->horizontal[0].skip = x->skip; @@ -3430,7 +3428,7 @@ static void nonrd_select_partition(VP9_COMP *cpi, pc_tree->horizontal[1].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row + hbs, mi_col, &this_rdc, subsize, &pc_tree->horizontal[1]); - pc_tree->horizontal[1].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->horizontal[1].mic = *xd->mi[0]; pc_tree->horizontal[1].mbmi_ext = *x->mbmi_ext; pc_tree->horizontal[1].skip_txfm[0] = x->skip_txfm[0]; pc_tree->horizontal[1].skip = x->skip; @@ -3502,7 +3500,7 @@ static void nonrd_use_partition(VP9_COMP *cpi, if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; - subsize = (bsize >= BLOCK_8X8) ? mi[0]->mbmi.sb_type : BLOCK_4X4; + subsize = (bsize >= BLOCK_8X8) ? mi[0]->sb_type : BLOCK_4X4; partition = partition_lookup[bsl][subsize]; if (output_enabled && bsize != BLOCK_4X4) { @@ -3515,7 +3513,7 @@ static void nonrd_use_partition(VP9_COMP *cpi, pc_tree->none.pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, dummy_cost, subsize, &pc_tree->none); - pc_tree->none.mic.mbmi = xd->mi[0]->mbmi; + pc_tree->none.mic = *xd->mi[0]; pc_tree->none.mbmi_ext = *x->mbmi_ext; pc_tree->none.skip_txfm[0] = x->skip_txfm[0]; pc_tree->none.skip = x->skip; @@ -3526,7 +3524,7 @@ static void nonrd_use_partition(VP9_COMP *cpi, pc_tree->vertical[0].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, dummy_cost, subsize, &pc_tree->vertical[0]); - pc_tree->vertical[0].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->vertical[0].mic = *xd->mi[0]; pc_tree->vertical[0].mbmi_ext = *x->mbmi_ext; pc_tree->vertical[0].skip_txfm[0] = x->skip_txfm[0]; pc_tree->vertical[0].skip = x->skip; @@ -3536,7 +3534,7 @@ static void nonrd_use_partition(VP9_COMP *cpi, pc_tree->vertical[1].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col + hbs, dummy_cost, subsize, &pc_tree->vertical[1]); - pc_tree->vertical[1].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->vertical[1].mic = *xd->mi[0]; pc_tree->vertical[1].mbmi_ext = *x->mbmi_ext; pc_tree->vertical[1].skip_txfm[0] = x->skip_txfm[0]; pc_tree->vertical[1].skip = x->skip; @@ -3548,7 +3546,7 @@ static void nonrd_use_partition(VP9_COMP *cpi, pc_tree->horizontal[0].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row, mi_col, dummy_cost, subsize, &pc_tree->horizontal[0]); - pc_tree->horizontal[0].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->horizontal[0].mic = *xd->mi[0]; pc_tree->horizontal[0].mbmi_ext = *x->mbmi_ext; pc_tree->horizontal[0].skip_txfm[0] = x->skip_txfm[0]; pc_tree->horizontal[0].skip = x->skip; @@ -3559,7 +3557,7 @@ static void nonrd_use_partition(VP9_COMP *cpi, pc_tree->horizontal[1].pred_pixel_ready = 1; nonrd_pick_sb_modes(cpi, tile_data, x, mi_row + hbs, mi_col, dummy_cost, subsize, &pc_tree->horizontal[1]); - pc_tree->horizontal[1].mic.mbmi = xd->mi[0]->mbmi; + pc_tree->horizontal[1].mic = *xd->mi[0]; pc_tree->horizontal[1].mbmi_ext = *x->mbmi_ext; pc_tree->horizontal[1].skip_txfm[0] = x->skip_txfm[0]; pc_tree->horizontal[1].skip = x->skip; @@ -3666,7 +3664,7 @@ static void encode_nonrd_sb_row(VP9_COMP *cpi, case REFERENCE_PARTITION: set_offsets(cpi, tile_info, x, mi_row, mi_col, BLOCK_64X64); if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && cm->seg.enabled && - xd->mi[0]->mbmi.segment_id) { + xd->mi[0]->segment_id) { // Use lower max_partition_size for low resoultions. if (cm->width <= 352 && cm->height <= 288) x->max_partition_size = BLOCK_32X32; @@ -4176,9 +4174,9 @@ void vp9_encode_frame(VP9_COMP *cpi) { } static void sum_intra_stats(FRAME_COUNTS *counts, const MODE_INFO *mi) { - const PREDICTION_MODE y_mode = mi->mbmi.mode; - const PREDICTION_MODE uv_mode = mi->mbmi.uv_mode; - const BLOCK_SIZE bsize = mi->mbmi.sb_type; + const PREDICTION_MODE y_mode = mi->mode; + const PREDICTION_MODE uv_mode = mi->uv_mode; + const BLOCK_SIZE bsize = mi->sb_type; if (bsize < BLOCK_8X8) { int idx, idy; @@ -4203,14 +4201,13 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td, MACROBLOCKD *const xd = &x->e_mbd; MODE_INFO **mi_8x8 = xd->mi; MODE_INFO *mi = mi_8x8[0]; - MB_MODE_INFO *mbmi = &mi->mbmi; - const int seg_skip = segfeature_active(&cm->seg, mbmi->segment_id, + const int seg_skip = segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_SKIP); const int mis = cm->mi_stride; const int mi_width = num_8x8_blocks_wide_lookup[bsize]; const int mi_height = num_8x8_blocks_high_lookup[bsize]; - x->skip_recode = !x->select_tx_size && mbmi->sb_type >= BLOCK_8X8 && + x->skip_recode = !x->select_tx_size && mi->sb_type >= BLOCK_8X8 && cpi->oxcf.aq_mode != COMPLEXITY_AQ && cpi->oxcf.aq_mode != CYCLIC_REFRESH_AQ && cpi->sf.allow_skip_recode; @@ -4227,9 +4224,9 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td, if (x->skip_encode) return; - if (!is_inter_block(mbmi)) { + if (!is_inter_block(mi)) { int plane; - mbmi->skip = 1; + mi->skip = 1; for (plane = 0; plane < MAX_MB_PLANE; ++plane) vp9_encode_intra_block_plane(x, VPXMAX(bsize, BLOCK_8X8), plane); if (output_enabled) @@ -4237,11 +4234,11 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td, vp9_tokenize_sb(cpi, td, t, !output_enabled, VPXMAX(bsize, BLOCK_8X8)); } else { int ref; - const int is_compound = has_second_ref(mbmi); - set_ref_ptrs(cm, xd, mbmi->ref_frame[0], mbmi->ref_frame[1]); + const int is_compound = has_second_ref(mi); + set_ref_ptrs(cm, xd, mi->ref_frame[0], mi->ref_frame[1]); for (ref = 0; ref < 1 + is_compound; ++ref) { YV12_BUFFER_CONFIG *cfg = get_ref_frame_buffer(cpi, - mbmi->ref_frame[ref]); + mi->ref_frame[ref]); assert(cfg != NULL); vp9_setup_pre_planes(xd, ref, cfg, mi_row, mi_col, &xd->block_refs[ref]->sf); @@ -4259,29 +4256,29 @@ static void encode_superblock(VP9_COMP *cpi, ThreadData *td, if (output_enabled) { if (cm->tx_mode == TX_MODE_SELECT && - mbmi->sb_type >= BLOCK_8X8 && - !(is_inter_block(mbmi) && (mbmi->skip || seg_skip))) { + mi->sb_type >= BLOCK_8X8 && + !(is_inter_block(mi) && (mi->skip || seg_skip))) { ++get_tx_counts(max_txsize_lookup[bsize], get_tx_size_context(xd), - &td->counts->tx)[mbmi->tx_size]; + &td->counts->tx)[mi->tx_size]; } else { int x, y; TX_SIZE tx_size; // The new intra coding scheme requires no change of transform size - if (is_inter_block(&mi->mbmi)) { + if (is_inter_block(mi)) { tx_size = VPXMIN(tx_mode_to_biggest_tx_size[cm->tx_mode], max_txsize_lookup[bsize]); } else { - tx_size = (bsize >= BLOCK_8X8) ? mbmi->tx_size : TX_4X4; + tx_size = (bsize >= BLOCK_8X8) ? mi->tx_size : TX_4X4; } for (y = 0; y < mi_height; y++) for (x = 0; x < mi_width; x++) if (mi_col + x < cm->mi_cols && mi_row + y < cm->mi_rows) - mi_8x8[mis * y + x]->mbmi.tx_size = tx_size; + mi_8x8[mis * y + x]->tx_size = tx_size; } - ++td->counts->tx.tx_totals[mbmi->tx_size]; - ++td->counts->tx.tx_totals[get_uv_tx_size(mbmi, &xd->plane[1])]; + ++td->counts->tx.tx_totals[mi->tx_size]; + ++td->counts->tx.tx_totals[get_uv_tx_size(mi, &xd->plane[1])]; if (cm->seg.enabled && cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ) - vp9_cyclic_refresh_update_sb_postencode(cpi, mbmi, mi_row, mi_col, bsize); + vp9_cyclic_refresh_update_sb_postencode(cpi, mi, mi_row, mi_col, bsize); } } diff --git a/vp9/encoder/vp9_encodemb.c b/vp9/encoder/vp9_encodemb.c index 3c6a9283c..42e265287 100644 --- a/vp9/encoder/vp9_encodemb.c +++ b/vp9/encoder/vp9_encodemb.c @@ -91,7 +91,7 @@ static int optimize_b(MACROBLOCK *mb, int plane, int block, MACROBLOCKD *const xd = &mb->e_mbd; struct macroblock_plane *const p = &mb->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane]; - const int ref = is_inter_block(&xd->mi[0]->mbmi); + const int ref = is_inter_block(xd->mi[0]); vp9_token_state tokens[1025][2]; unsigned best_index[1025][2]; uint8_t token_cache[1024]; @@ -736,11 +736,11 @@ void vp9_encode_sby_pass1(MACROBLOCK *x, BLOCK_SIZE bsize) { void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) { MACROBLOCKD *const xd = &x->e_mbd; struct optimize_ctx ctx; - MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; - struct encode_b_args arg = {x, &ctx, &mbmi->skip}; + MODE_INFO *mi = xd->mi[0]; + struct encode_b_args arg = {x, &ctx, &mi->skip}; int plane; - mbmi->skip = 1; + mi->skip = 1; if (x->skip) return; @@ -751,7 +751,7 @@ void vp9_encode_sb(MACROBLOCK *x, BLOCK_SIZE bsize) { if (x->optimize && (!x->skip_recode || !x->skip_optimize)) { const struct macroblockd_plane* const pd = &xd->plane[plane]; - const TX_SIZE tx_size = plane ? get_uv_tx_size(mbmi, pd) : mbmi->tx_size; + const TX_SIZE tx_size = plane ? get_uv_tx_size(mi, pd) : mi->tx_size; vp9_get_entropy_contexts(bsize, tx_size, pd, ctx.ta[plane], ctx.tl[plane]); } @@ -766,7 +766,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->mi[0]->mbmi; + MODE_INFO *mi = xd->mi[0]; struct macroblock_plane *const p = &x->plane[plane]; struct macroblockd_plane *const pd = &xd->plane[plane]; tran_low_t *coeff = BLOCK_OFFSET(p->coeff, block); @@ -791,9 +791,9 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, if (tx_size == TX_4X4) { tx_type = get_tx_type_4x4(get_plane_type(plane), xd, block); scan_order = &vp9_scan_orders[TX_4X4][tx_type]; - mode = plane == 0 ? get_y_mode(xd->mi[0], block) : mbmi->uv_mode; + mode = plane == 0 ? get_y_mode(xd->mi[0], block) : mi->uv_mode; } else { - mode = plane == 0 ? mbmi->mode : mbmi->uv_mode; + mode = plane == 0 ? mi->mode : mi->uv_mode; if (tx_size == TX_32X32) { scan_order = &vp9_default_scan_orders[TX_32X32]; } else { @@ -968,7 +968,7 @@ void vp9_encode_block_intra(int plane, int block, BLOCK_SIZE plane_bsize, void vp9_encode_intra_block_plane(MACROBLOCK *x, BLOCK_SIZE bsize, int plane) { const MACROBLOCKD *const xd = &x->e_mbd; - struct encode_b_args arg = {x, NULL, &xd->mi[0]->mbmi.skip}; + struct encode_b_args arg = {x, NULL, &xd->mi[0]->skip}; vp9_foreach_transformed_block_in_plane(xd, bsize, plane, vp9_encode_block_intra, &arg); diff --git a/vp9/encoder/vp9_encodemv.c b/vp9/encoder/vp9_encodemv.c index 3bcd6a3b6..f31ada919 100644 --- a/vp9/encoder/vp9_encodemv.c +++ b/vp9/encoder/vp9_encodemv.c @@ -230,13 +230,13 @@ void vp9_build_nmv_cost_table(int *mvjoint, int *mvcost[2], build_nmv_component_cost_table(mvcost[1], &ctx->comps[1], usehp); } -static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext, +static void inc_mvs(const MODE_INFO *mi, const MB_MODE_INFO_EXT *mbmi_ext, const int_mv mvs[2], nmv_context_counts *counts) { int i; - for (i = 0; i < 1 + has_second_ref(mbmi); ++i) { - const MV *ref = &mbmi_ext->ref_mvs[mbmi->ref_frame[i]][0].as_mv; + for (i = 0; i < 1 + has_second_ref(mi); ++i) { + const MV *ref = &mbmi_ext->ref_mvs[mi->ref_frame[i]][0].as_mv; const MV diff = {mvs[i].as_mv.row - ref->row, mvs[i].as_mv.col - ref->col}; vp9_inc_mv(&diff, counts); @@ -246,24 +246,23 @@ static void inc_mvs(const MB_MODE_INFO *mbmi, const MB_MODE_INFO_EXT *mbmi_ext, void vp9_update_mv_count(ThreadData *td) { const MACROBLOCKD *xd = &td->mb.e_mbd; const MODE_INFO *mi = xd->mi[0]; - const MB_MODE_INFO *const mbmi = &mi->mbmi; const MB_MODE_INFO_EXT *mbmi_ext = td->mb.mbmi_ext; - if (mbmi->sb_type < BLOCK_8X8) { - const int num_4x4_w = num_4x4_blocks_wide_lookup[mbmi->sb_type]; - const int num_4x4_h = num_4x4_blocks_high_lookup[mbmi->sb_type]; + if (mi->sb_type < BLOCK_8X8) { + const int num_4x4_w = num_4x4_blocks_wide_lookup[mi->sb_type]; + const int num_4x4_h = num_4x4_blocks_high_lookup[mi->sb_type]; int idx, idy; for (idy = 0; idy < 2; idy += num_4x4_h) { for (idx = 0; idx < 2; idx += num_4x4_w) { const int i = idy * 2 + idx; if (mi->bmi[i].as_mode == NEWMV) - inc_mvs(mbmi, mbmi_ext, mi->bmi[i].as_mv, &td->counts->mv); + inc_mvs(mi, mbmi_ext, mi->bmi[i].as_mv, &td->counts->mv); } } } else { - if (mbmi->mode == NEWMV) - inc_mvs(mbmi, mbmi_ext, mbmi->mv, &td->counts->mv); + if (mi->mode == NEWMV) + inc_mvs(mi, mbmi_ext, mi->mv, &td->counts->mv); } } diff --git a/vp9/encoder/vp9_encoder.c b/vp9/encoder/vp9_encoder.c index 609344dcd..039ed3347 100644 --- a/vp9/encoder/vp9_encoder.c +++ b/vp9/encoder/vp9_encoder.c @@ -609,7 +609,7 @@ static void update_reference_segmentation_map(VP9_COMP *cpi) { MODE_INFO **mi_8x8 = mi_8x8_ptr; uint8_t *cache = cache_ptr; for (col = 0; col < cm->mi_cols; col++, mi_8x8++, cache++) - cache[0] = mi_8x8[0]->mbmi.segment_id; + cache[0] = mi_8x8[0]->segment_id; mi_8x8_ptr += cm->mi_stride; cache_ptr += cm->mi_cols; } diff --git a/vp9/encoder/vp9_firstpass.c b/vp9/encoder/vp9_firstpass.c index 30738b52d..5c49a549b 100644 --- a/vp9/encoder/vp9_firstpass.c +++ b/vp9/encoder/vp9_firstpass.c @@ -396,7 +396,7 @@ static void first_pass_motion_search(VP9_COMP *cpi, MACROBLOCK *x, MV tmp_mv = {0, 0}; MV ref_mv_full = {ref_mv->row >> 3, ref_mv->col >> 3}; int num00, tmp_err, n; - const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; + const BLOCK_SIZE bsize = xd->mi[0]->sb_type; vp9_variance_fn_ptr_t v_fn_ptr = cpi->fn_ptr[bsize]; const int new_mv_mode_penalty = NEW_MV_MODE_PENALTY; @@ -663,8 +663,8 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) { xd->plane[1].dst.buf = new_yv12->u_buffer + recon_uvoffset; xd->plane[2].dst.buf = new_yv12->v_buffer + recon_uvoffset; xd->left_available = (mb_col != 0); - xd->mi[0]->mbmi.sb_type = bsize; - xd->mi[0]->mbmi.ref_frame[0] = INTRA_FRAME; + xd->mi[0]->sb_type = bsize; + xd->mi[0]->ref_frame[0] = INTRA_FRAME; set_mi_row_col(xd, &tile, mb_row << 1, num_8x8_blocks_high_lookup[bsize], mb_col << 1, num_8x8_blocks_wide_lookup[bsize], @@ -672,8 +672,8 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) { // Do intra 16x16 prediction. x->skip_encode = 0; - xd->mi[0]->mbmi.mode = DC_PRED; - xd->mi[0]->mbmi.tx_size = use_dc_pred ? + xd->mi[0]->mode = DC_PRED; + xd->mi[0]->tx_size = use_dc_pred ? (bsize >= BLOCK_16X16 ? TX_16X16 : TX_8X8) : TX_4X4; vp9_encode_intra_block_plane(x, bsize, 0); this_error = vpx_get_mb_ss(x->plane[0].src_diff); @@ -897,11 +897,11 @@ void vp9_first_pass(VP9_COMP *cpi, const struct lookahead_entry *source) { mv.row *= 8; mv.col *= 8; this_error = motion_error; - xd->mi[0]->mbmi.mode = NEWMV; - xd->mi[0]->mbmi.mv[0].as_mv = mv; - xd->mi[0]->mbmi.tx_size = TX_4X4; - xd->mi[0]->mbmi.ref_frame[0] = LAST_FRAME; - xd->mi[0]->mbmi.ref_frame[1] = NONE; + xd->mi[0]->mode = NEWMV; + xd->mi[0]->mv[0].as_mv = mv; + xd->mi[0]->tx_size = TX_4X4; + xd->mi[0]->ref_frame[0] = LAST_FRAME; + xd->mi[0]->ref_frame[1] = NONE; vp9_build_inter_predictors_sby(xd, mb_row << 1, mb_col << 1, bsize); vp9_encode_sby_pass1(x, bsize); sum_mvr += mv.row; diff --git a/vp9/encoder/vp9_mbgraph.c b/vp9/encoder/vp9_mbgraph.c index 41b6d1954..7ce86b45d 100644 --- a/vp9/encoder/vp9_mbgraph.c +++ b/vp9/encoder/vp9_mbgraph.c @@ -69,8 +69,8 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi, &distortion, &sse, NULL, 0, 0); } - xd->mi[0]->mbmi.mode = NEWMV; - xd->mi[0]->mbmi.mv[0].as_mv = *dst_mv; + xd->mi[0]->mode = NEWMV; + xd->mi[0]->mv[0].as_mv = *dst_mv; vp9_build_inter_predictors_sby(xd, mb_row, mb_col, BLOCK_16X16); @@ -147,7 +147,7 @@ static int find_best_16x16_intra(VP9_COMP *cpi, PREDICTION_MODE *pbest_mode) { for (mode = DC_PRED; mode <= TM_PRED; mode++) { unsigned int err; - xd->mi[0]->mbmi.mode = mode; + xd->mi[0]->mode = mode; vp9_predict_intra_block(xd, 2, TX_16X16, mode, x->plane[0].src.buf, x->plane[0].src.stride, xd->plane[0].dst.buf, xd->plane[0].dst.stride, @@ -254,9 +254,9 @@ static void update_mbgraph_frame_stats(VP9_COMP *cpi, xd->plane[0].pre[0].stride = buf->y_stride; xd->plane[1].dst.stride = buf->uv_stride; xd->mi[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; + mi_local.sb_type = BLOCK_16X16; + mi_local.ref_frame[0] = LAST_FRAME; + mi_local.ref_frame[1] = NONE; for (mb_row = 0; mb_row < cm->mb_rows; mb_row++) { MV gld_left_mv = gld_top_mv; diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c index eab07bccb..84ef1b43e 100644 --- a/vp9/encoder/vp9_mcomp.c +++ b/vp9/encoder/vp9_mcomp.c @@ -1825,7 +1825,7 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize, int mi_row, int mi_col) { MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; + MODE_INFO *mi = xd->mi[0]; struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0, 0}}; DECLARE_ALIGNED(16, int16_t, hbuf[128]); DECLARE_ALIGNED(16, int16_t, vbuf[128]); @@ -1839,12 +1839,12 @@ unsigned int vp9_int_pro_motion_estimation(const VP9_COMP *cpi, MACROBLOCK *x, const int src_stride = x->plane[0].src.stride; const int ref_stride = xd->plane[0].pre[0].stride; uint8_t const *ref_buf, *src_buf; - MV *tmp_mv = &xd->mi[0]->mbmi.mv[0].as_mv; + MV *tmp_mv = &xd->mi[0]->mv[0].as_mv; unsigned int best_sad, tmp_sad, this_sad[4]; MV this_mv; const int norm_factor = 3 + (bw >> 5); const YV12_BUFFER_CONFIG *scaled_ref_frame = - vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[0]); + vp9_get_scaled_ref_frame(cpi, mi->ref_frame[0]); if (scaled_ref_frame) { int i; diff --git a/vp9/encoder/vp9_pickmode.c b/vp9/encoder/vp9_pickmode.c index 4880ff680..d00e6b965 100644 --- a/vp9/encoder/vp9_pickmode.c +++ b/vp9/encoder/vp9_pickmode.c @@ -49,7 +49,7 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCK *x, const int *ref_sign_bias = cm->ref_frame_sign_bias; int i, refmv_count = 0; - const POSITION *const mv_ref_search = mv_ref_blocks[mi->mbmi.sb_type]; + const POSITION *const mv_ref_search = mv_ref_blocks[mi->sb_type]; int different_ref_found = 0; int context_counter = 0; @@ -66,12 +66,11 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCK *x, if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) { const MODE_INFO *const candidate_mi = xd->mi[mv_ref->col + mv_ref->row * xd->mi_stride]; - const MB_MODE_INFO *const candidate = &candidate_mi->mbmi; // Keep counts for entropy encoding. - context_counter += mode_2_counter[candidate->mode]; + context_counter += mode_2_counter[candidate_mi->mode]; different_ref_found = 1; - if (candidate->ref_frame[0] == ref_frame) + if (candidate_mi->ref_frame[0] == ref_frame) ADD_MV_REF_LIST(get_sub_block_mv(candidate_mi, 0, mv_ref->col, -1), refmv_count, mv_ref_list, Done); } @@ -85,12 +84,12 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCK *x, for (; i < MVREF_NEIGHBOURS && !refmv_count; ++i) { const POSITION *const mv_ref = &mv_ref_search[i]; if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) { - const MB_MODE_INFO *const candidate = &xd->mi[mv_ref->col + mv_ref->row * - xd->mi_stride]->mbmi; + const MODE_INFO *const candidate_mi = xd->mi[mv_ref->col + mv_ref->row * + xd->mi_stride]; different_ref_found = 1; - if (candidate->ref_frame[0] == ref_frame) - ADD_MV_REF_LIST(candidate->mv[0], refmv_count, mv_ref_list, Done); + if (candidate_mi->ref_frame[0] == ref_frame) + ADD_MV_REF_LIST(candidate_mi->mv[0], refmv_count, mv_ref_list, Done); } } @@ -101,11 +100,11 @@ static int mv_refs_rt(const VP9_COMMON *cm, const MACROBLOCK *x, for (i = 0; i < MVREF_NEIGHBOURS; ++i) { const POSITION *mv_ref = &mv_ref_search[i]; if (is_inside(tile, mi_col, mi_row, cm->mi_rows, mv_ref)) { - const MB_MODE_INFO *const candidate = &xd->mi[mv_ref->col + mv_ref->row - * xd->mi_stride]->mbmi; + const MODE_INFO *const candidate_mi = xd->mi[mv_ref->col + mv_ref->row + * xd->mi_stride]; // If the candidate is INTRA we don't want to consider its mv. - IF_DIFF_REF_FRAME_ADD_MV(candidate, ref_frame, ref_sign_bias, + IF_DIFF_REF_FRAME_ADD_MV(candidate_mi, ref_frame, ref_sign_bias, refmv_count, mv_ref_list, Done); } } @@ -127,12 +126,12 @@ static int combined_motion_search(VP9_COMP *cpi, MACROBLOCK *x, int_mv *tmp_mv, int *rate_mv, int64_t best_rd_sofar) { MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; + MODE_INFO *mi = xd->mi[0]; struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0, 0}}; const int step_param = cpi->sf.mv.fullpel_search_step_param; const int sadpb = x->sadperbit16; MV mvp_full; - const int ref = mbmi->ref_frame[0]; + const int ref = mi->ref_frame[0]; const MV ref_mv = x->mbmi_ext->ref_mvs[ref][0].as_mv; int dis; int rate_mode; @@ -300,7 +299,7 @@ static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize, tx_size = TX_8X8; if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && - cyclic_refresh_segment_id_boosted(xd->mi[0]->mbmi.segment_id)) + cyclic_refresh_segment_id_boosted(xd->mi[0]->segment_id)) tx_size = TX_8X8; else if (tx_size > TX_16X16) tx_size = TX_16X16; @@ -310,7 +309,7 @@ static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize, } assert(tx_size >= TX_8X8); - xd->mi[0]->mbmi.tx_size = tx_size; + xd->mi[0]->tx_size = tx_size; // Evaluate if the partition block is a skippable block in Y plane. { @@ -379,7 +378,7 @@ static void model_rd_for_sb_y_large(VP9_COMP *cpi, BLOCK_SIZE bsize, for (i = 1; i <= 2; i++) { struct macroblock_plane *const p = &x->plane[i]; struct macroblockd_plane *const pd = &xd->plane[i]; - const TX_SIZE uv_tx_size = get_uv_tx_size(&xd->mi[0]->mbmi, pd); + const TX_SIZE uv_tx_size = get_uv_tx_size(xd->mi[0], pd); const BLOCK_SIZE unit_size = txsize_to_bsize[uv_tx_size]; const BLOCK_SIZE uv_bsize = get_plane_block_size(bsize, pd); const int uv_bw = b_width_log2_lookup[uv_bsize]; @@ -475,19 +474,19 @@ static void model_rd_for_sb_y(VP9_COMP *cpi, BLOCK_SIZE bsize, if (cpi->common.tx_mode == TX_MODE_SELECT) { if (sse > (var << 2)) - xd->mi[0]->mbmi.tx_size = + xd->mi[0]->tx_size = VPXMIN(max_txsize_lookup[bsize], tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); else - xd->mi[0]->mbmi.tx_size = TX_8X8; + xd->mi[0]->tx_size = TX_8X8; if (cpi->oxcf.aq_mode == CYCLIC_REFRESH_AQ && - cyclic_refresh_segment_id_boosted(xd->mi[0]->mbmi.segment_id)) - xd->mi[0]->mbmi.tx_size = TX_8X8; - else if (xd->mi[0]->mbmi.tx_size > TX_16X16) - xd->mi[0]->mbmi.tx_size = TX_16X16; + cyclic_refresh_segment_id_boosted(xd->mi[0]->segment_id)) + xd->mi[0]->tx_size = TX_8X8; + else if (xd->mi[0]->tx_size > TX_16X16) + xd->mi[0]->tx_size = TX_16X16; } else { - xd->mi[0]->mbmi.tx_size = + xd->mi[0]->tx_size = VPXMIN(max_txsize_lookup[bsize], tx_mode_to_biggest_tx_size[cpi->common.tx_mode]); } @@ -495,7 +494,7 @@ static void model_rd_for_sb_y(VP9_COMP *cpi, BLOCK_SIZE bsize, // Evaluate if the partition block is a skippable block in Y plane. { const BLOCK_SIZE unit_size = - txsize_to_bsize[xd->mi[0]->mbmi.tx_size]; + txsize_to_bsize[xd->mi[0]->tx_size]; const unsigned int num_blk_log2 = (b_width_log2_lookup[bsize] - b_width_log2_lookup[unit_size]) + (b_height_log2_lookup[bsize] - b_height_log2_lookup[unit_size]); @@ -779,7 +778,7 @@ static void encode_breakout_test(VP9_COMP *cpi, MACROBLOCK *x, struct buf_2d yv12_mb[][MAX_MB_PLANE], int *rate, int64_t *dist) { MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; const BLOCK_SIZE uv_size = get_plane_block_size(bsize, &xd->plane[1]); unsigned int var = var_y, sse = sse_y; // Skipping threshold for ac. @@ -787,10 +786,10 @@ static void encode_breakout_test(VP9_COMP *cpi, MACROBLOCK *x, // Skipping threshold for dc. unsigned int thresh_dc; int motion_low = 1; - if (mbmi->mv[0].as_mv.row > 64 || - mbmi->mv[0].as_mv.row < -64 || - mbmi->mv[0].as_mv.col > 64 || - mbmi->mv[0].as_mv.col < -64) + if (mi->mv[0].as_mv.row > 64 || + mi->mv[0].as_mv.row < -64 || + mi->mv[0].as_mv.col > 64 || + mi->mv[0].as_mv.col < -64) motion_low = 0; if (x->encode_breakout > 0 && motion_low == 1) { // Set a maximum for threshold to avoid big PSNR loss in low bit rate @@ -981,7 +980,7 @@ static INLINE void update_thresh_freq_fact(VP9_COMP *cpi, void vp9_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT *ctx) { MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; RD_COST this_rdc, best_rdc; PREDICTION_MODE this_mode; struct estimate_block_intra_args args = { cpi, x, DC_PRED, 0, 0 }; @@ -1000,9 +999,9 @@ void vp9_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost, vp9_rd_cost_reset(&best_rdc); vp9_rd_cost_reset(&this_rdc); - mbmi->ref_frame[0] = INTRA_FRAME; - mbmi->mv[0].as_int = INVALID_MV; - mbmi->uv_mode = DC_PRED; + mi->ref_frame[0] = INTRA_FRAME; + mi->mv[0].as_int = INVALID_MV; + mi->uv_mode = DC_PRED; memset(x->skip_txfm, 0, sizeof(x->skip_txfm)); // Change the limit of this loop to add other intra prediction @@ -1011,7 +1010,7 @@ void vp9_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost, args.mode = this_mode; args.rate = 0; args.dist = 0; - mbmi->tx_size = intra_tx_size; + mi->tx_size = intra_tx_size; vp9_foreach_transformed_block_in_plane(xd, bsize, 0, estimate_block_intra, &args); this_rdc.rate = args.rate; @@ -1022,7 +1021,7 @@ void vp9_pick_intra_mode(VP9_COMP *cpi, MACROBLOCK *x, RD_COST *rd_cost, if (this_rdc.rdcost < best_rdc.rdcost) { best_rdc = this_rdc; - mbmi->mode = this_mode; + mi->mode = this_mode; } } @@ -1097,7 +1096,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, const SVC *const svc = &cpi->svc; TileInfo *const tile_info = &tile_data->tile_info; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; struct macroblockd_plane *const pd = &xd->plane[0]; PREDICTION_MODE best_mode = ZEROMV; MV_REFERENCE_FRAME ref_frame, best_ref_frame = LAST_FRAME; @@ -1116,7 +1115,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, const int intra_cost_penalty = set_intra_cost_penalty(cpi, bsize); const int64_t inter_mode_thresh = RDCOST(x->rdmult, x->rddiv, intra_cost_penalty, 0); - const int *const rd_threshes = cpi->rd.threshes[mbmi->segment_id][bsize]; + const int *const rd_threshes = cpi->rd.threshes[mi->segment_id][bsize]; const int *const rd_thresh_freq_fact = tile_data->thresh_freq_fact[bsize]; INTERP_FILTER filter_ref; const int bsl = mi_width_log2_lookup[bsize]; @@ -1174,20 +1173,20 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, x->skip = 0; if (xd->up_available) - filter_ref = xd->mi[-xd->mi_stride]->mbmi.interp_filter; + filter_ref = xd->mi[-xd->mi_stride]->interp_filter; else if (xd->left_available) - filter_ref = xd->mi[-1]->mbmi.interp_filter; + filter_ref = xd->mi[-1]->interp_filter; else filter_ref = cm->interp_filter; // initialize mode decisions vp9_rd_cost_reset(&best_rdc); vp9_rd_cost_reset(rd_cost); - mbmi->sb_type = bsize; - mbmi->ref_frame[0] = NONE; - mbmi->ref_frame[1] = NONE; - mbmi->tx_size = VPXMIN(max_txsize_lookup[bsize], - tx_mode_to_biggest_tx_size[cm->tx_mode]); + mi->sb_type = bsize; + mi->ref_frame[0] = NONE; + mi->ref_frame[1] = NONE; + mi->tx_size = VPXMIN(max_txsize_lookup[bsize], + tx_mode_to_biggest_tx_size[cm->tx_mode]); #if CONFIG_VP9_TEMPORAL_DENOISING vp9_denoiser_reset_frame_stats(ctx); @@ -1289,7 +1288,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, for (i = 0; i < MAX_MB_PLANE; i++) xd->plane[i].pre[0] = yv12_mb[ref_frame][i]; - mbmi->ref_frame[0] = ref_frame; + mi->ref_frame[0] = ref_frame; set_ref_ptrs(cm, xd, ref_frame, NONE); mode_index = mode_idx[ref_frame][INTER_OFFSET(this_mode)]; @@ -1314,7 +1313,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if (tmp_sad + (num_pels_log2_lookup[bsize] << 4) > best_pred_sad) continue; - frame_mv[NEWMV][ref_frame].as_int = mbmi->mv[0].as_int; + frame_mv[NEWMV][ref_frame].as_int = mi->mv[0].as_int; rate_mv = vp9_mv_bit_cost(&frame_mv[NEWMV][ref_frame].as_mv, &x->mbmi_ext->ref_mvs[ref_frame][0].as_mv, x->nmvjointcost, x->mvcost, MV_COST_WEIGHT); @@ -1369,8 +1368,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, frame_mv[NEARESTMV][ref_frame].as_int) continue; - mbmi->mode = this_mode; - mbmi->mv[0].as_int = frame_mv[this_mode][ref_frame].as_int; + mi->mode = this_mode; + mi->mv[0].as_int = frame_mv[this_mode][ref_frame].as_int; // Search for the best prediction filter type, when the resulting // motion vector is at sub-pixel accuracy level for luma component, i.e., @@ -1388,7 +1387,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if ((this_mode == NEWMV || filter_ref == SWITCHABLE) && pred_filter_search && (ref_frame == LAST_FRAME || (ref_frame == GOLDEN_FRAME && cpi->use_svc)) - && (((mbmi->mv[0].as_mv.row | mbmi->mv[0].as_mv.col) & 0x07) != 0)) { + && (((mi->mv[0].as_mv.row | mi->mv[0].as_mv.col) & 0x07) != 0)) { int pf_rate[3]; int64_t pf_dist[3]; unsigned int pf_var[3]; @@ -1400,13 +1399,13 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, for (filter = EIGHTTAP; filter <= EIGHTTAP_SMOOTH; ++filter) { int64_t cost; - mbmi->interp_filter = filter; + mi->interp_filter = filter; vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize); model_rd_for_sb_y(cpi, bsize, x, xd, &pf_rate[filter], &pf_dist[filter], &pf_var[filter], &pf_sse[filter]); pf_rate[filter] += vp9_get_switchable_rate(cpi, xd); cost = RDCOST(x->rdmult, x->rddiv, pf_rate[filter], pf_dist[filter]); - pf_tx_size[filter] = mbmi->tx_size; + pf_tx_size[filter] = mi->tx_size; if (cost < best_cost) { best_filter = filter; best_cost = cost; @@ -1430,8 +1429,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if (reuse_inter_pred && this_mode_pred != current_pred) free_pred_buffer(current_pred); - mbmi->interp_filter = best_filter; - mbmi->tx_size = pf_tx_size[best_filter]; + mi->interp_filter = best_filter; + mi->tx_size = pf_tx_size[best_filter]; this_rdc.rate = pf_rate[best_filter]; this_rdc.dist = pf_dist[best_filter]; var_y = pf_var[best_filter]; @@ -1442,12 +1441,12 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, pd->dst.stride = this_mode_pred->stride; } } else { - mbmi->interp_filter = (filter_ref == SWITCHABLE) ? EIGHTTAP : filter_ref; + mi->interp_filter = (filter_ref == SWITCHABLE) ? EIGHTTAP : filter_ref; vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize); // For large partition blocks, extra testing is done. if (bsize > BLOCK_32X32 && - !cyclic_refresh_segment_id_boosted(xd->mi[0]->mbmi.segment_id) && + !cyclic_refresh_segment_id_boosted(xd->mi[0]->segment_id) && cm->base_qindex) { model_rd_for_sb_y_large(cpi, bsize, x, xd, &this_rdc.rate, &this_rdc.dist, &var_y, &sse_y, mi_row, mi_col, @@ -1461,7 +1460,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if (!this_early_term) { this_sse = (int64_t)sse_y; block_yrd(cpi, x, &this_rdc.rate, &this_rdc.dist, &is_skippable, - &this_sse, 0, bsize, VPXMIN(mbmi->tx_size, TX_16X16)); + &this_sse, 0, bsize, VPXMIN(mi->tx_size, TX_16X16)); x->skip_txfm[0] = is_skippable; if (is_skippable) { this_rdc.rate = vp9_cost_bit(vp9_get_skip_prob(cm, xd), 1); @@ -1477,7 +1476,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, } if (cm->interp_filter == SWITCHABLE) { - if ((mbmi->mv[0].as_mv.row | mbmi->mv[0].as_mv.col) & 0x07) + if ((mi->mv[0].as_mv.row | mi->mv[0].as_mv.col) & 0x07) this_rdc.rate += vp9_get_switchable_rate(cpi, xd); } } else { @@ -1548,7 +1547,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, #if CONFIG_VP9_TEMPORAL_DENOISING if (cpi->oxcf.noise_sensitivity > 0) { - vp9_denoiser_update_frame_stats(mbmi, sse_y, this_mode, ctx); + vp9_denoiser_update_frame_stats(mi, sse_y, this_mode, ctx); // Keep track of zero_last cost. if (ref_frame == LAST_FRAME && frame_mv[this_mode][ref_frame].as_int == 0) zero_last_cost_orig = this_rdc.rdcost; @@ -1560,8 +1559,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if (this_rdc.rdcost < best_rdc.rdcost || x->skip) { best_rdc = this_rdc; best_mode = this_mode; - best_pred_filter = mbmi->interp_filter; - best_tx_size = mbmi->tx_size; + best_pred_filter = mi->interp_filter; + best_tx_size = mi->tx_size; best_ref_frame = ref_frame; best_mode_skip_txfm = x->skip_txfm[0]; best_early_term = this_early_term; @@ -1586,12 +1585,12 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, } } - mbmi->mode = best_mode; - mbmi->interp_filter = best_pred_filter; - mbmi->tx_size = best_tx_size; - mbmi->ref_frame[0] = best_ref_frame; - mbmi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int; - xd->mi[0]->bmi[0].as_mv[0].as_int = mbmi->mv[0].as_int; + mi->mode = best_mode; + mi->interp_filter = best_pred_filter; + mi->tx_size = best_tx_size; + mi->ref_frame[0] = best_ref_frame; + mi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int; + xd->mi[0]->bmi[0].as_mv[0].as_int = mi->mv[0].as_int; x->skip_txfm[0] = best_mode_skip_txfm; // Perform intra prediction search, if the best SAD is above a certain @@ -1642,12 +1641,12 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, rd_thresh_freq_fact[mode_index])) continue; - mbmi->mode = this_mode; - mbmi->ref_frame[0] = INTRA_FRAME; + mi->mode = this_mode; + mi->ref_frame[0] = INTRA_FRAME; args.mode = this_mode; args.rate = 0; args.dist = 0; - mbmi->tx_size = intra_tx_size; + mi->tx_size = intra_tx_size; vp9_foreach_transformed_block_in_plane(xd, bsize, 0, estimate_block_intra, &args); // Inter and intra RD will mismatch in scale for non-screen content. @@ -1670,29 +1669,29 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if (this_rdc.rdcost < best_rdc.rdcost) { best_rdc = this_rdc; best_mode = this_mode; - best_intra_tx_size = mbmi->tx_size; + best_intra_tx_size = mi->tx_size; best_ref_frame = INTRA_FRAME; - mbmi->uv_mode = this_mode; - mbmi->mv[0].as_int = INVALID_MV; + mi->uv_mode = this_mode; + mi->mv[0].as_int = INVALID_MV; best_mode_skip_txfm = x->skip_txfm[0]; } } // Reset mb_mode_info to the best inter mode. if (best_ref_frame != INTRA_FRAME) { - mbmi->tx_size = best_tx_size; + mi->tx_size = best_tx_size; } else { - mbmi->tx_size = best_intra_tx_size; + mi->tx_size = best_intra_tx_size; } } pd->dst = orig_dst; - mbmi->mode = best_mode; - mbmi->ref_frame[0] = best_ref_frame; + mi->mode = best_mode; + mi->ref_frame[0] = best_ref_frame; x->skip_txfm[0] = best_mode_skip_txfm; if (reuse_inter_pred && best_pred != NULL) { - if (best_pred->data != orig_dst.buf && is_inter_mode(mbmi->mode)) { + if (best_pred->data != orig_dst.buf && is_inter_mode(mi->mode)) { #if CONFIG_VP9_HIGHBITDEPTH if (cm->use_highbitdepth) vpx_highbd_convolve_copy(best_pred->data, best_pred->stride, @@ -1727,11 +1726,11 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, // Check if we should pick ZEROMV on denoised signal. int rate = 0; int64_t dist = 0; - mbmi->mode = ZEROMV; - mbmi->ref_frame[0] = LAST_FRAME; - mbmi->ref_frame[1] = NONE; - mbmi->mv[0].as_int = 0; - mbmi->interp_filter = EIGHTTAP; + mi->mode = ZEROMV; + mi->ref_frame[0] = LAST_FRAME; + mi->ref_frame[1] = NONE; + mi->mv[0].as_int = 0; + mi->interp_filter = EIGHTTAP; xd->plane[0].pre[0] = yv12_mb[LAST_FRAME][0]; vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize); model_rd_for_sb_y(cpi, bsize, x, xd, &rate, &dist, &var_y, &sse_y); @@ -1744,19 +1743,19 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, // is lower than best_ref mode (on original source). if (this_rdc.rdcost > best_rdc.rdcost) { this_rdc = best_rdc; - mbmi->mode = best_mode; - mbmi->ref_frame[0] = best_ref_frame; - mbmi->interp_filter = best_pred_filter; + mi->mode = best_mode; + mi->ref_frame[0] = best_ref_frame; + mi->interp_filter = best_pred_filter; if (best_ref_frame == INTRA_FRAME) - mbmi->mv[0].as_int = INVALID_MV; + mi->mv[0].as_int = INVALID_MV; else if (best_ref_frame == GOLDEN_FRAME) { - mbmi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int; + mi->mv[0].as_int = frame_mv[best_mode][best_ref_frame].as_int; if (reuse_inter_pred) { xd->plane[0].pre[0] = yv12_mb[GOLDEN_FRAME][0]; vp9_build_inter_predictors_sby(xd, mi_row, mi_col, bsize); } } - mbmi->tx_size = best_tx_size; + mi->tx_size = best_tx_size; x->skip_txfm[0] = best_mode_skip_txfm; } else { best_ref_frame = LAST_FRAME; @@ -1767,7 +1766,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, #endif if (cpi->sf.adaptive_rd_thresh) { - THR_MODES best_mode_idx = mode_idx[best_ref_frame][mode_offset(mbmi->mode)]; + THR_MODES best_mode_idx = mode_idx[best_ref_frame][mode_offset(mi->mode)]; if (best_ref_frame == INTRA_FRAME) { // Only consider the modes that are included in the intra_mode_list. @@ -1801,12 +1800,12 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, VP9_COMMON *const cm = &cpi->common; SPEED_FEATURES *const sf = &cpi->sf; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; const struct segmentation *const seg = &cm->seg; MV_REFERENCE_FRAME ref_frame, second_ref_frame = NONE; MV_REFERENCE_FRAME best_ref_frame = NONE; - unsigned char segment_id = mbmi->segment_id; + unsigned char segment_id = mi->segment_id; struct buf_2d yv12_mb[4][MAX_MB_PLANE]; static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, VP9_ALT_FLAG }; @@ -1841,13 +1840,13 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, } } - mbmi->sb_type = bsize; - mbmi->tx_size = TX_4X4; - mbmi->uv_mode = DC_PRED; - mbmi->ref_frame[0] = LAST_FRAME; - mbmi->ref_frame[1] = NONE; - mbmi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP - : cm->interp_filter; + mi->sb_type = bsize; + mi->tx_size = TX_4X4; + mi->uv_mode = DC_PRED; + mi->ref_frame[0] = LAST_FRAME; + mi->ref_frame[1] = NONE; + mi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP + : cm->interp_filter; for (ref_frame = LAST_FRAME; ref_frame <= GOLDEN_FRAME; ++ref_frame) { int64_t this_rd = 0; @@ -1875,7 +1874,7 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, get_segdata(seg, segment_id, SEG_LVL_REF_FRAME) != (int)ref_frame) continue; - mbmi->ref_frame[0] = ref_frame; + mi->ref_frame[0] = ref_frame; x->skip = 0; set_ref_ptrs(cm, xd, ref_frame, second_ref_frame); @@ -1992,7 +1991,7 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, &xd->block_refs[0]->sf, 4 * num_4x4_blocks_wide, 4 * num_4x4_blocks_high, 0, - vp9_filter_kernels[mbmi->interp_filter], + vp9_filter_kernels[mi->interp_filter], MV_PRECISION_Q3, mi_col * MI_SIZE + 4 * (i & 0x01), mi_row * MI_SIZE + 4 * (i >> 1), xd->bd); @@ -2004,7 +2003,7 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, &xd->block_refs[0]->sf, 4 * num_4x4_blocks_wide, 4 * num_4x4_blocks_high, 0, - vp9_filter_kernels[mbmi->interp_filter], + vp9_filter_kernels[mi->interp_filter], MV_PRECISION_Q3, mi_col * MI_SIZE + 4 * (i & 0x01), mi_row * MI_SIZE + 4 * (i >> 1)); @@ -2046,8 +2045,8 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, } } // reference frames - mbmi->tx_size = TX_4X4; - mbmi->ref_frame[0] = best_ref_frame; + mi->tx_size = TX_4X4; + mi->ref_frame[0] = best_ref_frame; for (idy = 0; idy < 2; idy += num_4x4_blocks_high) { for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) { const int block = idy * 2 + idx; @@ -2058,7 +2057,7 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x, xd->mi[0]->bmi[block + 2] = bsi[best_ref_frame][block]; } } - mbmi->mode = xd->mi[0]->bmi[3].as_mode; + mi->mode = xd->mi[0]->bmi[3].as_mode; ctx->mic = *(xd->mi[0]); ctx->mbmi_ext = *x->mbmi_ext; ctx->skip_txfm[0] = SKIP_TXFM_NONE; diff --git a/vp9/encoder/vp9_quantize.c b/vp9/encoder/vp9_quantize.c index cb3e21a56..980a49f0a 100644 --- a/vp9/encoder/vp9_quantize.c +++ b/vp9/encoder/vp9_quantize.c @@ -308,7 +308,7 @@ void vp9_init_plane_quantizers(VP9_COMP *cpi, MACROBLOCK *x) { const VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &x->e_mbd; QUANTS *const quants = &cpi->quants; - const int segment_id = xd->mi[0]->mbmi.segment_id; + const int segment_id = xd->mi[0]->segment_id; const int qindex = vp9_get_qindex(&cm->seg, segment_id, cm->base_qindex); const int rdmult = vp9_compute_rd_mult(cpi, qindex + cm->y_dc_delta_q); int i; diff --git a/vp9/encoder/vp9_rd.c b/vp9/encoder/vp9_rd.c index eda774376..679f6d6e0 100644 --- a/vp9/encoder/vp9_rd.c +++ b/vp9/encoder/vp9_rd.c @@ -557,10 +557,10 @@ 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) { - const MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + const MODE_INFO *const mi = xd->mi[0]; const int ctx = vp9_get_pred_context_switchable_interp(xd); return SWITCHABLE_INTERP_RATE_FACTOR * - cpi->switchable_interp_costs[ctx][mbmi->interp_filter]; + cpi->switchable_interp_costs[ctx][mi->interp_filter]; } void vp9_set_rd_speed_thresholds(VP9_COMP *cpi) { diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c index 8ab4c8b35..c48b4ecc5 100644 --- a/vp9/encoder/vp9_rdopt.c +++ b/vp9/encoder/vp9_rdopt.c @@ -165,7 +165,7 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize, int i; int64_t rate_sum = 0; int64_t dist_sum = 0; - const int ref = xd->mi[0]->mbmi.ref_frame[0]; + const int ref = xd->mi[0]->ref_frame[0]; unsigned int sse; unsigned int var = 0; unsigned int sum_sse = 0; @@ -361,14 +361,14 @@ static int cost_coeffs(MACROBLOCK *x, const int16_t *scan, const int16_t *nb, int use_fast_coef_costing) { MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; + MODE_INFO *mi = xd->mi[0]; const struct macroblock_plane *p = &x->plane[plane]; const PLANE_TYPE type = get_plane_type(plane); const int16_t *band_count = &band_counts[tx_size][1]; const int eob = p->eobs[block]; const tran_low_t *const qcoeff = BLOCK_OFFSET(p->qcoeff, block); unsigned int (*token_costs)[2][COEFF_CONTEXTS][ENTROPY_TOKENS] = - x->token_costs[tx_size][type][is_inter_block(mbmi)]; + x->token_costs[tx_size][type][is_inter_block(mi)]; uint8_t token_cache[32 * 32]; int pt = combine_entropy_contexts(*A, *L); int c, cost; @@ -379,8 +379,8 @@ static int cost_coeffs(MACROBLOCK *x, #endif // Check for consistency of tx_size with mode info - assert(type == PLANE_TYPE_Y ? mbmi->tx_size == tx_size : - get_uv_tx_size(mbmi, &xd->plane[plane]) == tx_size); + assert(type == PLANE_TYPE_Y ? mi->tx_size == tx_size : + get_uv_tx_size(mi, &xd->plane[plane]) == tx_size); if (eob == 0) { // single eob token @@ -461,7 +461,7 @@ static void dist_block(MACROBLOCK *x, int plane, int block, TX_SIZE tx_size, #endif // CONFIG_VP9_HIGHBITDEPTH *out_sse = this_sse >> shift; - if (x->skip_encode && !is_inter_block(&xd->mi[0]->mbmi)) { + if (x->skip_encode && !is_inter_block(xd->mi[0])) { // TODO(jingning): tune the model to better capture the distortion. int64_t p = (pd->dequant[1] * pd->dequant[1] * (1 << ss_txfrm_size)) >> @@ -491,7 +491,7 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize, struct rdcost_block_args *args = arg; MACROBLOCK *const x = args->x; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; int64_t rd1, rd2, rd; int rate; int64_t dist; @@ -500,8 +500,8 @@ static void block_rd_txfm(int plane, int block, BLOCK_SIZE plane_bsize, if (args->exit_early) return; - if (!is_inter_block(mbmi)) { - struct encode_b_args arg = {x, NULL, &mbmi->skip}; + if (!is_inter_block(mi)) { + struct encode_b_args arg = {x, NULL, &mi->skip}; vp9_encode_block_intra(plane, block, plane_bsize, tx_size, &arg); dist_block(x, plane, block, tx_size, &dist, &sse); } else if (max_txsize_lookup[plane_bsize] == tx_size) { @@ -588,7 +588,7 @@ static void txfm_rd_in_plane(MACROBLOCK *x, args.skippable = 1; if (plane == 0) - xd->mi[0]->mbmi.tx_size = tx_size; + xd->mi[0]->tx_size = tx_size; vp9_get_entropy_contexts(bsize, tx_size, pd, args.t_above, args.t_left); @@ -618,13 +618,13 @@ static void choose_largest_tx_size(VP9_COMP *cpi, MACROBLOCK *x, VP9_COMMON *const cm = &cpi->common; const TX_SIZE largest_tx_size = tx_mode_to_biggest_tx_size[cm->tx_mode]; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; - mbmi->tx_size = VPXMIN(max_tx_size, largest_tx_size); + mi->tx_size = VPXMIN(max_tx_size, largest_tx_size); txfm_rd_in_plane(x, rate, distortion, skip, sse, ref_best_rd, 0, bs, - mbmi->tx_size, cpi->sf.use_fast_coef_costing); + mi->tx_size, cpi->sf.use_fast_coef_costing); } static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x, @@ -637,7 +637,7 @@ static void choose_tx_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->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; vpx_prob skip_prob = vp9_get_skip_prob(cm, xd); int r[TX_SIZES][2], s[TX_SIZES]; int64_t d[TX_SIZES], sse[TX_SIZES]; @@ -684,7 +684,7 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x, if (d[n] == INT64_MAX || r[n][0] == INT_MAX) { rd[n][0] = rd[n][1] = INT64_MAX; } else if (s[n]) { - if (is_inter_block(mbmi)) { + if (is_inter_block(mi)) { rd[n][0] = rd[n][1] = RDCOST(x->rdmult, x->rddiv, s1, sse[n]); r[n][1] -= r_tx_size; } else { @@ -696,7 +696,7 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x, rd[n][1] = RDCOST(x->rdmult, x->rddiv, r[n][1] + s0, d[n]); } - if (is_inter_block(mbmi) && !xd->lossless && !s[n] && sse[n] != INT64_MAX) { + if (is_inter_block(mi) && !xd->lossless && !s[n] && sse[n] != INT64_MAX) { rd[n][0] = VPXMIN(rd[n][0], RDCOST(x->rdmult, x->rddiv, s1, sse[n])); rd[n][1] = VPXMIN(rd[n][1], RDCOST(x->rdmult, x->rddiv, s1, sse[n])); } @@ -713,12 +713,12 @@ static void choose_tx_size_from_rd(VP9_COMP *cpi, MACROBLOCK *x, best_rd = rd[n][1]; } } - mbmi->tx_size = best_tx; + mi->tx_size = best_tx; - *distortion = d[mbmi->tx_size]; - *rate = r[mbmi->tx_size][cm->tx_mode == TX_MODE_SELECT]; - *skip = s[mbmi->tx_size]; - *psse = sse[mbmi->tx_size]; + *distortion = d[mi->tx_size]; + *rate = r[mi->tx_size][cm->tx_mode == TX_MODE_SELECT]; + *skip = s[mi->tx_size]; + *psse = sse[mi->tx_size]; } static void super_block_yrd(VP9_COMP *cpi, MACROBLOCK *x, int *rate, @@ -729,7 +729,7 @@ static void super_block_yrd(VP9_COMP *cpi, MACROBLOCK *x, int *rate, int64_t sse; int64_t *ret_sse = psse ? psse : &sse; - assert(bs == xd->mi[0]->mbmi.sb_type); + assert(bs == xd->mi[0]->sb_type); if (cpi->sf.tx_size_search_method == USE_LARGESTALL || xd->lossless) { choose_largest_tx_size(cpi, x, rate, distortion, skip, ret_sse, ref_best_rd, @@ -790,7 +790,7 @@ static int64_t rd_pick_intra4x4block(VP9_COMP *cpi, MACROBLOCK *x, memcpy(ta, a, sizeof(ta)); memcpy(tl, l, sizeof(tl)); - xd->mi[0]->mbmi.tx_size = TX_4X4; + xd->mi[0]->tx_size = TX_4X4; #if CONFIG_VP9_HIGHBITDEPTH if (xd->cur_buf->flags & YV12_FLAG_HIGHBITDEPTH) { @@ -1005,7 +1005,7 @@ static int64_t rd_pick_intra_sub_8x8_y_mode(VP9_COMP *cpi, MACROBLOCK *mb, MODE_INFO *const mic = xd->mi[0]; const MODE_INFO *above_mi = xd->above_mi; const MODE_INFO *left_mi = xd->left_mi; - const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; + const BLOCK_SIZE bsize = xd->mi[0]->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; @@ -1058,7 +1058,7 @@ static int64_t rd_pick_intra_sub_8x8_y_mode(VP9_COMP *cpi, MACROBLOCK *mb, *rate = cost; *rate_y = tot_rate_y; *distortion = total_distortion; - mic->mbmi.mode = mic->bmi[3].as_mode; + mic->mode = mic->bmi[3].as_mode; return RDCOST(mb->rdmult, mb->rddiv, cost, total_distortion); } @@ -1095,7 +1095,7 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, break; } - mic->mbmi.mode = mode; + mic->mode = mode; super_block_yrd(cpi, x, &this_rate_tokenonly, &this_distortion, &s, NULL, bsize, best_rd); @@ -1109,7 +1109,7 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, if (this_rd < best_rd) { mode_selected = mode; best_rd = this_rd; - best_tx = mic->mbmi.tx_size; + best_tx = mic->tx_size; *rate = this_rate; *rate_tokenonly = this_rate_tokenonly; *distortion = this_distortion; @@ -1117,8 +1117,8 @@ static int64_t rd_pick_intra_sby_mode(VP9_COMP *cpi, MACROBLOCK *x, } } - mic->mbmi.mode = mode_selected; - mic->mbmi.tx_size = best_tx; + mic->mode = mode_selected; + mic->tx_size = best_tx; return best_rd; } @@ -1130,8 +1130,8 @@ static int super_block_uvrd(const VP9_COMP *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->mi[0]->mbmi; - const TX_SIZE uv_tx_size = get_uv_tx_size(mbmi, &xd->plane[1]); + MODE_INFO *const mi = xd->mi[0]; + const TX_SIZE uv_tx_size = get_uv_tx_size(mi, &xd->plane[1]); int plane; int pnrate = 0, pnskip = 1; int64_t pndist = 0, pnsse = 0; @@ -1140,7 +1140,7 @@ static int super_block_uvrd(const VP9_COMP *cpi, MACROBLOCK *x, if (ref_best_rd < 0) is_cost_valid = 0; - if (is_inter_block(mbmi) && is_cost_valid) { + if (is_inter_block(mi) && is_cost_valid) { int plane; for (plane = 1; plane < MAX_MB_PLANE; ++plane) vp9_subtract_plane(x, bsize, plane); @@ -1193,14 +1193,14 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x, if (!(cpi->sf.intra_uv_mode_mask[max_tx_size] & (1 << mode))) continue; - xd->mi[0]->mbmi.uv_mode = mode; + xd->mi[0]->uv_mode = mode; if (!super_block_uvrd(cpi, x, &this_rate_tokenonly, &this_distortion, &s, &this_sse, bsize, best_rd)) continue; this_rate = this_rate_tokenonly + cpi->intra_uv_mode_cost[cpi->common.frame_type] - [xd->mi[0]->mbmi.mode][mode]; + [xd->mi[0]->mode][mode]; this_rd = RDCOST(x->rdmult, x->rddiv, this_rate, this_distortion); if (this_rd < best_rd) { @@ -1215,7 +1215,7 @@ static int64_t rd_pick_intra_sbuv_mode(VP9_COMP *cpi, MACROBLOCK *x, } } - xd->mi[0]->mbmi.uv_mode = mode_selected; + xd->mi[0]->uv_mode = mode_selected; return best_rd; } @@ -1226,13 +1226,13 @@ static int64_t rd_sbuv_dcpred(const VP9_COMP *cpi, MACROBLOCK *x, const VP9_COMMON *cm = &cpi->common; int64_t unused; - x->e_mbd.mi[0]->mbmi.uv_mode = DC_PRED; + x->e_mbd.mi[0]->uv_mode = DC_PRED; memset(x->skip_txfm, SKIP_TXFM_NONE, sizeof(x->skip_txfm)); super_block_uvrd(cpi, x, rate_tokenonly, distortion, skippable, &unused, bsize, INT64_MAX); *rate = *rate_tokenonly + cpi->intra_uv_mode_cost[cm->frame_type] - [x->e_mbd.mi[0]->mbmi.mode][DC_PRED]; + [x->e_mbd.mi[0]->mode][DC_PRED]; return RDCOST(x->rdmult, x->rddiv, *rate, *distortion); } @@ -1254,7 +1254,7 @@ static void choose_intra_uv_mode(VP9_COMP *cpi, MACROBLOCK *const x, rate_uv, rate_uv_tokenonly, dist_uv, skip_uv, bsize < BLOCK_8X8 ? BLOCK_8X8 : bsize, max_tx_size); } - *mode_uv = x->e_mbd.mi[0]->mbmi.uv_mode; + *mode_uv = x->e_mbd.mi[0]->uv_mode; } static int cost_mv_ref(const VP9_COMP *cpi, PREDICTION_MODE mode, @@ -1270,31 +1270,30 @@ static int set_and_cost_bmi_mvs(VP9_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *xd, int_mv seg_mvs[MAX_REF_FRAMES], int_mv *best_ref_mv[2], const int *mvjcost, int *mvcost[2]) { - MODE_INFO *const mic = xd->mi[0]; - const MB_MODE_INFO *const mbmi = &mic->mbmi; + MODE_INFO *const mi = xd->mi[0]; const MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; int thismvcost = 0; int idx, idy; - const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mbmi->sb_type]; - const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[mbmi->sb_type]; - const int is_compound = has_second_ref(mbmi); + const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup[mi->sb_type]; + const int num_4x4_blocks_high = num_4x4_blocks_high_lookup[mi->sb_type]; + const int is_compound = has_second_ref(mi); switch (mode) { case NEWMV: - this_mv[0].as_int = seg_mvs[mbmi->ref_frame[0]].as_int; + this_mv[0].as_int = seg_mvs[mi->ref_frame[0]].as_int; thismvcost += vp9_mv_bit_cost(&this_mv[0].as_mv, &best_ref_mv[0]->as_mv, mvjcost, mvcost, MV_COST_WEIGHT_SUB); if (is_compound) { - this_mv[1].as_int = seg_mvs[mbmi->ref_frame[1]].as_int; + this_mv[1].as_int = seg_mvs[mi->ref_frame[1]].as_int; thismvcost += vp9_mv_bit_cost(&this_mv[1].as_mv, &best_ref_mv[1]->as_mv, mvjcost, mvcost, MV_COST_WEIGHT_SUB); } break; case NEARMV: case NEARESTMV: - this_mv[0].as_int = frame_mv[mode][mbmi->ref_frame[0]].as_int; + this_mv[0].as_int = frame_mv[mode][mi->ref_frame[0]].as_int; if (is_compound) - this_mv[1].as_int = frame_mv[mode][mbmi->ref_frame[1]].as_int; + this_mv[1].as_int = frame_mv[mode][mi->ref_frame[1]].as_int; break; case ZEROMV: this_mv[0].as_int = 0; @@ -1305,17 +1304,17 @@ static int set_and_cost_bmi_mvs(VP9_COMP *cpi, MACROBLOCK *x, MACROBLOCKD *xd, break; } - mic->bmi[i].as_mv[0].as_int = this_mv[0].as_int; + mi->bmi[i].as_mv[0].as_int = this_mv[0].as_int; if (is_compound) - mic->bmi[i].as_mv[1].as_int = this_mv[1].as_int; + mi->bmi[i].as_mv[1].as_int = this_mv[1].as_int; - mic->bmi[i].as_mode = mode; + mi->bmi[i].as_mode = mode; for (idy = 0; idy < num_4x4_blocks_high; ++idy) for (idx = 0; idx < num_4x4_blocks_wide; ++idx) - memmove(&mic->bmi[i + idy * 2 + idx], &mic->bmi[i], sizeof(mic->bmi[i])); + memmove(&mi->bmi[i + idy * 2 + idx], &mi->bmi[i], sizeof(mi->bmi[i])); - return cost_mv_ref(cpi, mode, mbmi_ext->mode_context[mbmi->ref_frame[0]]) + + return cost_mv_ref(cpi, mode, mbmi_ext->mode_context[mi->ref_frame[0]]) + thismvcost; } @@ -1333,7 +1332,7 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi, struct macroblockd_plane *const pd = &xd->plane[0]; struct macroblock_plane *const p = &x->plane[0]; MODE_INFO *const mi = xd->mi[0]; - const BLOCK_SIZE plane_bsize = get_plane_block_size(mi->mbmi.sb_type, pd); + const BLOCK_SIZE plane_bsize = get_plane_block_size(mi->sb_type, pd); const int width = 4 * num_4x4_blocks_wide_lookup[plane_bsize]; const int height = 4 * num_4x4_blocks_high_lookup[plane_bsize]; int idx, idy; @@ -1345,8 +1344,8 @@ static int64_t encode_inter_mb_segment(VP9_COMP *cpi, int64_t thisdistortion = 0, thissse = 0; int thisrate = 0, ref; const scan_order *so = &vp9_default_scan_orders[TX_4X4]; - const int is_compound = has_second_ref(&mi->mbmi); - const InterpKernel *kernel = vp9_filter_kernels[mi->mbmi.interp_filter]; + const int is_compound = has_second_ref(mi); + const InterpKernel *kernel = vp9_filter_kernels[mi->interp_filter]; for (ref = 0; ref < 1 + is_compound; ++ref) { const int bw = b_width_log2_lookup[BLOCK_8X8]; @@ -1484,7 +1483,7 @@ static INLINE int mv_check_bounds(const MACROBLOCK *x, const MV *mv) { } static INLINE void mi_buf_shift(MACROBLOCK *x, int i) { - MB_MODE_INFO *const mbmi = &x->e_mbd.mi[0]->mbmi; + MODE_INFO *const mi = x->e_mbd.mi[0]; struct macroblock_plane *const p = &x->plane[0]; struct macroblockd_plane *const pd = &x->e_mbd.plane[0]; @@ -1493,17 +1492,17 @@ static INLINE void mi_buf_shift(MACROBLOCK *x, int i) { assert(((intptr_t)pd->pre[0].buf & 0x7) == 0); pd->pre[0].buf = &pd->pre[0].buf[vp9_raster_block_offset(BLOCK_8X8, i, pd->pre[0].stride)]; - if (has_second_ref(mbmi)) + if (has_second_ref(mi)) pd->pre[1].buf = &pd->pre[1].buf[vp9_raster_block_offset(BLOCK_8X8, i, pd->pre[1].stride)]; } static INLINE void mi_buf_restore(MACROBLOCK *x, struct buf_2d orig_src, struct buf_2d orig_pre[2]) { - MB_MODE_INFO *mbmi = &x->e_mbd.mi[0]->mbmi; + MODE_INFO *mi = x->e_mbd.mi[0]; x->plane[0].src = orig_src; x->e_mbd.plane[0].pre[0] = orig_pre[0]; - if (has_second_ref(mbmi)) + if (has_second_ref(mi)) x->e_mbd.plane[0].pre[1] = orig_pre[1]; } @@ -1558,20 +1557,20 @@ static void joint_motion_search(VP9_COMP *cpi, MACROBLOCK *x, const int pw = 4 * num_4x4_blocks_wide_lookup[bsize]; const int ph = 4 * num_4x4_blocks_high_lookup[bsize]; MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; - const int refs[2] = {mbmi->ref_frame[0], - mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1]}; + MODE_INFO *mi = xd->mi[0]; + const int refs[2] = {mi->ref_frame[0], + mi->ref_frame[1] < 0 ? 0 : mi->ref_frame[1]}; int_mv ref_mv[2]; int ite, ref; - const InterpKernel *kernel = vp9_filter_kernels[mbmi->interp_filter]; + const InterpKernel *kernel = vp9_filter_kernels[mi->interp_filter]; struct scale_factors sf; // Do joint motion search in compound mode to get more accurate mv. struct buf_2d backup_yv12[2][MAX_MB_PLANE]; int last_besterr[2] = {INT_MAX, INT_MAX}; const YV12_BUFFER_CONFIG *const scaled_ref_frame[2] = { - vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[0]), - vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[1]) + vp9_get_scaled_ref_frame(cpi, mi->ref_frame[0]), + vp9_get_scaled_ref_frame(cpi, mi->ref_frame[1]) }; // Prediction buffer from second frame. @@ -1747,7 +1746,6 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, BEST_SEG_INFO *bsi = bsi_buf + filter_idx; MACROBLOCKD *xd = &x->e_mbd; MODE_INFO *mi = xd->mi[0]; - MB_MODE_INFO *mbmi = &mi->mbmi; int mode_idx; int k, br = 0, idx, idy; int64_t bd = 0, block_sse = 0; @@ -1759,13 +1757,13 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, int64_t this_segment_rd = 0; int label_mv_thresh; int segmentyrate = 0; - const BLOCK_SIZE bsize = mbmi->sb_type; + const BLOCK_SIZE bsize = mi->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]; ENTROPY_CONTEXT t_above[2], t_left[2]; int subpelmv = 1, have_ref = 0; SPEED_FEATURES *const sf = &cpi->sf; - const int has_second_rf = has_second_ref(mbmi); + const int has_second_rf = has_second_ref(mi); const int inter_mode_mask = sf->inter_mode_mask[bsize]; MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; @@ -1802,7 +1800,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, int ref; for (ref = 0; ref < 1 + has_second_rf; ++ref) { - const MV_REFERENCE_FRAME frame = mbmi->ref_frame[ref]; + const MV_REFERENCE_FRAME frame = mi->ref_frame[ref]; frame_mv[ZEROMV][frame].as_int = 0; vp9_append_sub8x8_mvs_for_idx(cm, xd, i, ref, mi_row, mi_col, &frame_mv[NEARESTMV][frame], @@ -1821,7 +1819,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, continue; if (!check_best_zero_mv(cpi, mbmi_ext->mode_context, frame_mv, - this_mode, mbmi->ref_frame)) + this_mode, mi->ref_frame)) continue; memcpy(orig_pre, pd->pre, sizeof(orig_pre)); @@ -1832,7 +1830,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, // motion search for newmv (single predictor case only) if (!has_second_rf && this_mode == NEWMV && - seg_mvs[i][mbmi->ref_frame[0]].as_int == INVALID_MV) { + seg_mvs[i][mi->ref_frame[0]].as_int == INVALID_MV) { MV *const new_mv = &mode_mv[NEWMV][0].as_mv; int step_param = 0; int bestsme = INT_MAX; @@ -1855,7 +1853,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, } } if (i == 0) - max_mv = x->max_mv_context[mbmi->ref_frame[0]]; + max_mv = x->max_mv_context[mi->ref_frame[0]]; else max_mv = VPXMAX(abs(bsi->mvp.as_mv.row), abs(bsi->mvp.as_mv.col)) >> 3; @@ -1874,8 +1872,8 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, mvp_full.col = bsi->mvp.as_mv.col >> 3; if (sf->adaptive_motion_search) { - mvp_full.row = x->pred_mv[mbmi->ref_frame[0]].row >> 3; - mvp_full.col = x->pred_mv[mbmi->ref_frame[0]].col >> 3; + mvp_full.row = x->pred_mv[mi->ref_frame[0]].row >> 3; + mvp_full.col = x->pred_mv[mi->ref_frame[0]].col >> 3; step_param = VPXMAX(step_param, 8); } @@ -1903,28 +1901,28 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, cond_cost_list(cpi, cost_list), x->nmvjointcost, x->mvcost, &distortion, - &x->pred_sse[mbmi->ref_frame[0]], + &x->pred_sse[mi->ref_frame[0]], NULL, 0, 0); // save motion search result for use in compound prediction - seg_mvs[i][mbmi->ref_frame[0]].as_mv = *new_mv; + seg_mvs[i][mi->ref_frame[0]].as_mv = *new_mv; } if (sf->adaptive_motion_search) - x->pred_mv[mbmi->ref_frame[0]] = *new_mv; + x->pred_mv[mi->ref_frame[0]] = *new_mv; // restore src pointers mi_buf_restore(x, orig_src, orig_pre); } if (has_second_rf) { - if (seg_mvs[i][mbmi->ref_frame[1]].as_int == INVALID_MV || - seg_mvs[i][mbmi->ref_frame[0]].as_int == INVALID_MV) + if (seg_mvs[i][mi->ref_frame[1]].as_int == INVALID_MV || + seg_mvs[i][mi->ref_frame[0]].as_int == INVALID_MV) continue; } if (has_second_rf && this_mode == NEWMV && - mbmi->interp_filter == EIGHTTAP) { + mi->interp_filter == EIGHTTAP) { // adjust src pointers mi_buf_shift(x, i); if (sf->comp_inter_joint_search_thresh <= bsize) { @@ -1932,10 +1930,10 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, joint_motion_search(cpi, x, bsize, frame_mv[this_mode], mi_row, mi_col, seg_mvs[i], &rate_mv); - seg_mvs[i][mbmi->ref_frame[0]].as_int = - frame_mv[this_mode][mbmi->ref_frame[0]].as_int; - seg_mvs[i][mbmi->ref_frame[1]].as_int = - frame_mv[this_mode][mbmi->ref_frame[1]].as_int; + seg_mvs[i][mi->ref_frame[0]].as_int = + frame_mv[this_mode][mi->ref_frame[0]].as_int; + seg_mvs[i][mi->ref_frame[1]].as_int = + frame_mv[this_mode][mi->ref_frame[1]].as_int; } // restore src pointers mi_buf_restore(x, orig_src, orig_pre); @@ -2077,7 +2075,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, for (i = 0; i < 4; i++) { mode_idx = INTER_OFFSET(bsi->modes[i]); mi->bmi[i].as_mv[0].as_int = bsi->rdstat[i][mode_idx].mvs[0].as_int; - if (has_second_ref(mbmi)) + if (has_second_ref(mi)) mi->bmi[i].as_mv[1].as_int = bsi->rdstat[i][mode_idx].mvs[1].as_int; x->plane[0].eobs[i] = bsi->rdstat[i][mode_idx].eobs; mi->bmi[i].as_mode = bsi->modes[i]; @@ -2091,7 +2089,7 @@ static int64_t rd_pick_best_sub8x8_mode(VP9_COMP *cpi, MACROBLOCK *x, *returnyrate = bsi->segment_yrate; *skippable = vp9_is_skippable_in_plane(x, BLOCK_8X8, 0); *psse = bsi->sse; - mbmi->mode = bsi->modes[3]; + mi->mode = bsi->modes[3]; return bsi->segment_rd; } @@ -2223,13 +2221,13 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, int_mv *tmp_mv, int *rate_mv) { MACROBLOCKD *xd = &x->e_mbd; const VP9_COMMON *cm = &cpi->common; - MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; + MODE_INFO *mi = xd->mi[0]; struct buf_2d backup_yv12[MAX_MB_PLANE] = {{0, 0}}; int bestsme = INT_MAX; int step_param; int sadpb = x->sadperbit16; MV mvp_full; - int ref = mbmi->ref_frame[0]; + int ref = mi->ref_frame[0]; MV ref_mv = x->mbmi_ext->ref_mvs[ref][0].as_mv; int tmp_col_min = x->mv_col_min; @@ -2395,14 +2393,14 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, int64_t filter_cache[]) { VP9_COMMON *cm = &cpi->common; MACROBLOCKD *xd = &x->e_mbd; - MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; + MODE_INFO *mi = xd->mi[0]; MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; - const int is_comp_pred = has_second_ref(mbmi); - const int this_mode = mbmi->mode; + const int is_comp_pred = has_second_ref(mi); + const int this_mode = mi->mode; int_mv *frame_mv = mode_mv[this_mode]; int i; - int refs[2] = { mbmi->ref_frame[0], - (mbmi->ref_frame[1] < 0 ? 0 : mbmi->ref_frame[1]) }; + int refs[2] = { mi->ref_frame[0], + (mi->ref_frame[1] < 0 ? 0 : mi->ref_frame[1]) }; int_mv cur_mv[2]; #if CONFIG_VP9_HIGHBITDEPTH DECLARE_ALIGNED(16, uint16_t, tmp_buf16[MAX_MB_PLANE * 64 * 64]); @@ -2441,9 +2439,9 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if (pred_filter_search) { INTERP_FILTER af = SWITCHABLE, lf = SWITCHABLE; if (xd->up_available) - af = xd->mi[-xd->mi_stride]->mbmi.interp_filter; + af = xd->mi[-xd->mi_stride]->interp_filter; if (xd->left_available) - lf = xd->mi[-1]->mbmi.interp_filter; + lf = xd->mi[-1]->interp_filter; if ((this_mode != NEWMV) || (af == lf)) best_filter = af; @@ -2511,7 +2509,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if (mv_check_bounds(x, &cur_mv[i].as_mv)) return INT64_MAX; - mbmi->mv[i].as_int = cur_mv[i].as_int; + mi->mv[i].as_int = cur_mv[i].as_int; } // do first prediction into the destination buffer. Do the next @@ -2541,14 +2539,14 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, } if (RDCOST(x->rdmult, x->rddiv, *rate2, 0) > ref_best_rd && - mbmi->mode != NEARESTMV) + mi->mode != NEARESTMV) return INT64_MAX; pred_exists = 0; // Are all MVs integer pel for Y and UV - intpel_mv = !mv_has_subpel(&mbmi->mv[0].as_mv); + intpel_mv = !mv_has_subpel(&mi->mv[0].as_mv); if (is_comp_pred) - intpel_mv &= !mv_has_subpel(&mbmi->mv[1].as_mv); + intpel_mv &= !mv_has_subpel(&mi->mv[1].as_mv); // Search for best switchable filter by checking the variance of // pred error irrespective of whether the filter will be used @@ -2569,7 +2567,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, int tmp_skip_sb = 0; int64_t tmp_skip_sse = INT64_MAX; - mbmi->interp_filter = i; + mi->interp_filter = i; rs = vp9_get_switchable_rate(cpi, xd); rs_rd = RDCOST(x->rdmult, x->rddiv, rs, 0); @@ -2594,7 +2592,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if ((cm->interp_filter == SWITCHABLE && (!i || best_needs_copy)) || (cm->interp_filter != SWITCHABLE && - (cm->interp_filter == mbmi->interp_filter || + (cm->interp_filter == mi->interp_filter || (i == 0 && intpel_mv)))) { restore_dst_buf(xd, orig_dst, orig_dst_stride); } else { @@ -2631,14 +2629,14 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, if (newbest) { best_rd = rd; - best_filter = mbmi->interp_filter; + best_filter = mi->interp_filter; if (cm->interp_filter == SWITCHABLE && i && !intpel_mv) best_needs_copy = !best_needs_copy; } if ((cm->interp_filter == SWITCHABLE && newbest) || (cm->interp_filter != SWITCHABLE && - cm->interp_filter == mbmi->interp_filter)) { + cm->interp_filter == mi->interp_filter)) { pred_exists = 1; tmp_rd = best_rd; @@ -2652,7 +2650,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, } } // Set the appropriate filter - mbmi->interp_filter = cm->interp_filter != SWITCHABLE ? + mi->interp_filter = cm->interp_filter != SWITCHABLE ? cm->interp_filter : best_filter; rs = cm->interp_filter == SWITCHABLE ? vp9_get_switchable_rate(cpi, xd) : 0; @@ -2680,7 +2678,7 @@ static int64_t handle_inter_mode(VP9_COMP *cpi, MACROBLOCK *x, } if (!is_comp_pred) - single_filter[this_mode][refs[0]] = mbmi->interp_filter; + single_filter[this_mode][refs[0]] = mi->interp_filter; if (cpi->sf.adaptive_mode_search) if (is_comp_pred) @@ -2767,8 +2765,8 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, TX_SIZE max_uv_tx_size; x->skip_encode = 0; ctx->skip = 0; - xd->mi[0]->mbmi.ref_frame[0] = INTRA_FRAME; - xd->mi[0]->mbmi.ref_frame[1] = NONE; + xd->mi[0]->ref_frame[0] = INTRA_FRAME; + xd->mi[0]->ref_frame[1] = NONE; if (bsize >= BLOCK_8X8) { if (rd_pick_intra_sby_mode(cpi, x, &rate_y, &rate_y_tokenonly, @@ -2785,7 +2783,7 @@ void vp9_rd_pick_intra_mode_sb(VP9_COMP *cpi, MACROBLOCK *x, return; } } - max_uv_tx_size = get_uv_tx_size_impl(xd->mi[0]->mbmi.tx_size, bsize, + max_uv_tx_size = get_uv_tx_size_impl(xd->mi[0]->tx_size, bsize, pd[1].subsampling_x, pd[1].subsampling_y); rd_pick_intra_sbuv_mode(cpi, x, ctx, &rate_uv, &rate_uv_tokenonly, @@ -2949,12 +2947,12 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, RD_OPT *const rd_opt = &cpi->rd; SPEED_FEATURES *const sf = &cpi->sf; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; MB_MODE_INFO_EXT *const mbmi_ext = x->mbmi_ext; const struct segmentation *const seg = &cm->seg; PREDICTION_MODE this_mode; MV_REFERENCE_FRAME ref_frame, second_ref_frame; - unsigned char segment_id = mbmi->segment_id; + unsigned char segment_id = mi->segment_id; int comp_pred, i, k; int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES]; struct buf_2d yv12_mb[4][MAX_MB_PLANE]; @@ -2968,7 +2966,7 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, int64_t best_pred_rd[REFERENCE_MODES]; int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS]; int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; - MB_MODE_INFO best_mbmode; + MODE_INFO best_mbmode; int best_mode_skippable = 0; int midx, best_mode_index = -1; unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES]; @@ -3186,7 +3184,7 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, const int bsl = mi_width_log2_lookup[bsize]; int cb_partition_search_ctrl = (((mi_row + mi_col) >> bsl) + get_chessboard_index(cm->current_video_frame)) & 0x1; - MB_MODE_INFO *ref_mbmi; + MODE_INFO *ref_mi; int const_motion = 1; int skip_ref_frame = !cb_partition_search_ctrl; MV_REFERENCE_FRAME rf = NONE; @@ -3194,26 +3192,26 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, ref_mv.as_int = INVALID_MV; if ((mi_row - 1) >= tile_info->mi_row_start) { - ref_mv = xd->mi[-xd->mi_stride]->mbmi.mv[0]; - rf = xd->mi[-xd->mi_stride]->mbmi.ref_frame[0]; + ref_mv = xd->mi[-xd->mi_stride]->mv[0]; + rf = xd->mi[-xd->mi_stride]->ref_frame[0]; for (i = 0; i < mi_width; ++i) { - ref_mbmi = &xd->mi[-xd->mi_stride + i]->mbmi; - const_motion &= (ref_mv.as_int == ref_mbmi->mv[0].as_int) && - (ref_frame == ref_mbmi->ref_frame[0]); - skip_ref_frame &= (rf == ref_mbmi->ref_frame[0]); + ref_mi = xd->mi[-xd->mi_stride + i]; + const_motion &= (ref_mv.as_int == ref_mi->mv[0].as_int) && + (ref_frame == ref_mi->ref_frame[0]); + skip_ref_frame &= (rf == ref_mi->ref_frame[0]); } } if ((mi_col - 1) >= tile_info->mi_col_start) { if (ref_mv.as_int == INVALID_MV) - ref_mv = xd->mi[-1]->mbmi.mv[0]; + ref_mv = xd->mi[-1]->mv[0]; if (rf == NONE) - rf = xd->mi[-1]->mbmi.ref_frame[0]; + rf = xd->mi[-1]->ref_frame[0]; for (i = 0; i < mi_height; ++i) { - ref_mbmi = &xd->mi[i * xd->mi_stride - 1]->mbmi; - const_motion &= (ref_mv.as_int == ref_mbmi->mv[0].as_int) && - (ref_frame == ref_mbmi->ref_frame[0]); - skip_ref_frame &= (rf == ref_mbmi->ref_frame[0]); + ref_mi = xd->mi[i * xd->mi_stride - 1]; + const_motion &= (ref_mv.as_int == ref_mi->mv[0].as_int) && + (ref_frame == ref_mi->ref_frame[0]); + skip_ref_frame &= (rf == ref_mi->ref_frame[0]); } } @@ -3284,15 +3282,15 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, continue; } - mbmi->mode = this_mode; - mbmi->uv_mode = DC_PRED; - mbmi->ref_frame[0] = ref_frame; - mbmi->ref_frame[1] = second_ref_frame; + mi->mode = this_mode; + mi->uv_mode = DC_PRED; + mi->ref_frame[0] = ref_frame; + mi->ref_frame[1] = second_ref_frame; // Evaluate all sub-pel filters irrespective of whether we can use // them for this frame. - mbmi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP + mi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP : cm->interp_filter; - mbmi->mv[0].as_int = mbmi->mv[1].as_int = 0; + mi->mv[0].as_int = mi->mv[1].as_int = 0; x->skip = 0; set_ref_ptrs(cm, xd, ref_frame, second_ref_frame); @@ -3313,7 +3311,7 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, if (rate_y == INT_MAX) continue; - uv_tx = get_uv_tx_size_impl(mbmi->tx_size, bsize, pd->subsampling_x, + uv_tx = get_uv_tx_size_impl(mi->tx_size, bsize, pd->subsampling_x, pd->subsampling_y); if (rate_uv_intra[uv_tx] == INT_MAX) { choose_intra_uv_mode(cpi, x, ctx, bsize, uv_tx, @@ -3324,9 +3322,9 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, rate_uv = rate_uv_tokenonly[uv_tx]; distortion_uv = dist_uv[uv_tx]; skippable = skippable && skip_uv[uv_tx]; - mbmi->uv_mode = mode_uv[uv_tx]; + mi->uv_mode = mode_uv[uv_tx]; - rate2 = rate_y + cpi->mbmode_cost[mbmi->mode] + rate_uv_intra[uv_tx]; + rate2 = rate_y + cpi->mbmode_cost[mi->mode] + rate_uv_intra[uv_tx]; if (this_mode != DC_PRED && this_mode != TM_PRED) rate2 += intra_cost_penalty; distortion2 = distortion_y + distortion_uv; @@ -3394,7 +3392,7 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, // Keep record of best intra rd if (this_rd < best_intra_rd) { best_intra_rd = this_rd; - best_intra_mode = mbmi->mode; + best_intra_mode = mi->mode; } } @@ -3414,7 +3412,7 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, if (ref_frame == INTRA_FRAME) { /* required for left and above block mv */ - mbmi->mv[0].as_int = 0; + mi->mv[0].as_int = 0; max_plane = 1; } else { best_pred_sse = x->pred_sse[ref_frame]; @@ -3424,13 +3422,13 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, rd_cost->dist = distortion2; rd_cost->rdcost = this_rd; best_rd = this_rd; - best_mbmode = *mbmi; + best_mbmode = *mi; best_skip2 = this_skip2; best_mode_skippable = skippable; if (!x->select_tx_size) swap_block_ptr(x, ctx, 1, 0, 0, max_plane); - memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mbmi->tx_size], + memcpy(ctx->zcoeff_blk, x->zcoeff_blk[mi->tx_size], sizeof(ctx->zcoeff_blk[0]) * ctx->num_4x4_blk); // TODO(debargha): enhance this test with a better distortion prediction @@ -3546,8 +3544,8 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, // Do Intra UV best rd mode selection if best mode choice above was intra. if (best_mbmode.ref_frame[0] == INTRA_FRAME) { TX_SIZE uv_tx_size; - *mbmi = best_mbmode; - uv_tx_size = get_uv_tx_size(mbmi, &xd->plane[1]); + *mi = best_mbmode; + uv_tx_size = get_uv_tx_size(mi, &xd->plane[1]); rd_pick_intra_sbuv_mode(cpi, x, ctx, &rate_uv_intra[uv_tx_size], &rate_uv_tokenonly[uv_tx_size], &dist_uv[uv_tx_size], @@ -3566,7 +3564,7 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, sf->adaptive_rd_thresh, bsize, best_mode_index); // macroblock modes - *mbmi = best_mbmode; + *mi = best_mbmode; x->skip |= best_skip2; for (i = 0; i < REFERENCE_MODES; ++i) { @@ -3596,7 +3594,7 @@ void vp9_rd_pick_inter_mode_sb(VP9_COMP *cpi, if (!x->skip && !x->select_tx_size) { int has_high_freq_coeff = 0; int plane; - int max_plane = is_inter_block(&xd->mi[0]->mbmi) + int max_plane = is_inter_block(xd->mi[0]) ? MAX_MB_PLANE : 1; for (plane = 0; plane < max_plane; ++plane) { x->plane[plane].eobs = ctx->eobs_pbuf[plane][1]; @@ -3626,8 +3624,8 @@ void vp9_rd_pick_inter_mode_sb_seg_skip(VP9_COMP *cpi, int64_t best_rd_so_far) { VP9_COMMON *const cm = &cpi->common; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; - unsigned char segment_id = mbmi->segment_id; + MODE_INFO *const mi = xd->mi[0]; + unsigned char segment_id = mi->segment_id; const int comp_pred = 0; int i; int64_t best_pred_diff[REFERENCE_MODES]; @@ -3653,11 +3651,11 @@ void vp9_rd_pick_inter_mode_sb_seg_skip(VP9_COMP *cpi, assert(segfeature_active(&cm->seg, segment_id, SEG_LVL_SKIP)); - mbmi->mode = ZEROMV; - mbmi->uv_mode = DC_PRED; - mbmi->ref_frame[0] = LAST_FRAME; - mbmi->ref_frame[1] = NONE; - mbmi->mv[0].as_int = 0; + mi->mode = ZEROMV; + mi->uv_mode = DC_PRED; + mi->ref_frame[0] = LAST_FRAME; + mi->ref_frame[1] = NONE; + mi->mv[0].as_int = 0; x->skip = 1; if (cm->interp_filter != BILINEAR) { @@ -3667,21 +3665,21 @@ void vp9_rd_pick_inter_mode_sb_seg_skip(VP9_COMP *cpi, int rs; int best_rs = INT_MAX; for (i = 0; i < SWITCHABLE_FILTERS; ++i) { - mbmi->interp_filter = i; + mi->interp_filter = i; rs = vp9_get_switchable_rate(cpi, xd); if (rs < best_rs) { best_rs = rs; - best_filter = mbmi->interp_filter; + best_filter = mi->interp_filter; } } } } // Set the appropriate filter if (cm->interp_filter == SWITCHABLE) { - mbmi->interp_filter = best_filter; + mi->interp_filter = best_filter; rate2 += vp9_get_switchable_rate(cpi, xd); } else { - mbmi->interp_filter = cm->interp_filter; + mi->interp_filter = cm->interp_filter; } if (cm->reference_mode == REFERENCE_MODE_SELECT) @@ -3703,7 +3701,7 @@ void vp9_rd_pick_inter_mode_sb_seg_skip(VP9_COMP *cpi, } assert((cm->interp_filter == SWITCHABLE) || - (cm->interp_filter == mbmi->interp_filter)); + (cm->interp_filter == mi->interp_filter)); vp9_update_rd_thresh_fact(tile_data->thresh_freq_fact, cpi->sf.adaptive_rd_thresh, bsize, THR_ZEROMV); @@ -3729,10 +3727,10 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, RD_OPT *const rd_opt = &cpi->rd; SPEED_FEATURES *const sf = &cpi->sf; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; const struct segmentation *const seg = &cm->seg; MV_REFERENCE_FRAME ref_frame, second_ref_frame; - unsigned char segment_id = mbmi->segment_id; + unsigned char segment_id = mi->segment_id; int comp_pred, i; int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES]; struct buf_2d yv12_mb[4][MAX_MB_PLANE]; @@ -3744,7 +3742,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, int64_t best_pred_rd[REFERENCE_MODES]; int64_t best_filter_rd[SWITCHABLE_FILTER_CONTEXTS]; int64_t best_filter_diff[SWITCHABLE_FILTER_CONTEXTS]; - MB_MODE_INFO best_mbmode; + MODE_INFO best_mbmode; int ref_index, best_ref_index = 0; unsigned int ref_costs_single[MAX_REF_FRAMES], ref_costs_comp[MAX_REF_FRAMES]; vpx_prob comp_mode_p; @@ -3903,14 +3901,14 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, continue; } - mbmi->tx_size = TX_4X4; - mbmi->uv_mode = DC_PRED; - mbmi->ref_frame[0] = ref_frame; - mbmi->ref_frame[1] = second_ref_frame; + mi->tx_size = TX_4X4; + mi->uv_mode = DC_PRED; + mi->ref_frame[0] = ref_frame; + mi->ref_frame[1] = second_ref_frame; // Evaluate all sub-pel filters irrespective of whether we can use // them for this frame. - mbmi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP - : cm->interp_filter; + mi->interp_filter = cm->interp_filter == SWITCHABLE ? EIGHTTAP + : cm->interp_filter; x->skip = 0; set_ref_ptrs(cm, xd, ref_frame, second_ref_frame); @@ -3941,7 +3939,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, rate_uv = rate_uv_tokenonly; distortion2 += dist_uv; distortion_uv = dist_uv; - mbmi->uv_mode = mode_uv; + mi->uv_mode = mode_uv; } else { int rate; int64_t distortion; @@ -3954,7 +3952,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, int_mv *second_ref = comp_pred ? &x->mbmi_ext->ref_mvs[second_ref_frame][0] : NULL; b_mode_info tmp_best_bmodes[16]; - MB_MODE_INFO tmp_best_mbmode; + MODE_INFO tmp_best_mbmode; BEST_SEG_INFO bsi[SWITCHABLE_FILTERS]; int pred_exists = 0; int uv_skippable; @@ -3963,8 +3961,8 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, int ref; for (ref = 0; ref < 2; ++ref) { - scaled_ref_frame[ref] = mbmi->ref_frame[ref] > INTRA_FRAME ? - vp9_get_scaled_ref_frame(cpi, mbmi->ref_frame[ref]) : NULL; + scaled_ref_frame[ref] = mi->ref_frame[ref] > INTRA_FRAME ? + vp9_get_scaled_ref_frame(cpi, mi->ref_frame[ref]) : NULL; if (scaled_ref_frame[ref]) { int i; @@ -4003,7 +4001,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, int newbest, rs; int64_t rs_rd; MB_MODE_INFO_EXT *mbmi_ext = x->mbmi_ext; - mbmi->interp_filter = switchable_filter_index; + mi->interp_filter = switchable_filter_index; tmp_rd = rd_pick_best_sub8x8_mode(cpi, x, &mbmi_ext->ref_mvs[ref_frame][0], second_ref, best_yrd, &rate, @@ -4027,11 +4025,11 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, newbest = (tmp_rd < tmp_best_rd); if (newbest) { - tmp_best_filter = mbmi->interp_filter; + tmp_best_filter = mi->interp_filter; tmp_best_rd = tmp_rd; } if ((newbest && cm->interp_filter == SWITCHABLE) || - (mbmi->interp_filter == cm->interp_filter && + (mi->interp_filter == cm->interp_filter && cm->interp_filter != SWITCHABLE)) { tmp_best_rdu = tmp_rd; tmp_best_rate = rate; @@ -4039,7 +4037,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, tmp_best_distortion = distortion; tmp_best_sse = total_sse; tmp_best_skippable = skippable; - tmp_best_mbmode = *mbmi; + tmp_best_mbmode = *mi; for (i = 0; i < 4; i++) { tmp_best_bmodes[i] = xd->mi[0]->bmi[i]; x->zcoeff_blk[TX_4X4][i] = !x->plane[0].eobs[i]; @@ -4051,7 +4049,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, if (tmp_best_rdu / 2 > best_rd) { // skip searching the other filters if the first is // already substantially larger than the best so far - tmp_best_filter = mbmi->interp_filter; + tmp_best_filter = mi->interp_filter; tmp_best_rdu = INT64_MAX; break; } @@ -4064,8 +4062,8 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, if (tmp_best_rdu == INT64_MAX && pred_exists) continue; - mbmi->interp_filter = (cm->interp_filter == SWITCHABLE ? - tmp_best_filter : cm->interp_filter); + mi->interp_filter = (cm->interp_filter == SWITCHABLE ? + tmp_best_filter : cm->interp_filter); if (!pred_exists) { // Handles the special case when a filter that is not in the // switchable list (bilinear, 6-tap) is indicated at the frame level @@ -4083,7 +4081,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, rate_y = tmp_best_ratey; distortion = tmp_best_distortion; skippable = tmp_best_skippable; - *mbmi = tmp_best_mbmode; + *mi = tmp_best_mbmode; for (i = 0; i < 4; i++) xd->mi[0]->bmi[i] = tmp_best_bmodes[i]; } @@ -4193,7 +4191,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, if (ref_frame == INTRA_FRAME) { /* required for left and above block mv */ - mbmi->mv[0].as_int = 0; + mi->mv[0].as_int = 0; max_plane = 1; } @@ -4203,7 +4201,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, best_rd = this_rd; best_yrd = best_rd - RDCOST(x->rdmult, x->rddiv, rate_uv, distortion_uv); - best_mbmode = *mbmi; + best_mbmode = *mi; best_skip2 = this_skip2; if (!x->select_tx_size) swap_block_ptr(x, ctx, 1, 0, 0, max_plane); @@ -4301,7 +4299,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, if (sf->use_uv_intra_rd_estimate) { // Do Intra UV best rd mode selection if best mode choice above was intra. if (best_mbmode.ref_frame[0] == INTRA_FRAME) { - *mbmi = best_mbmode; + *mi = best_mbmode; rd_pick_intra_sbuv_mode(cpi, x, ctx, &rate_uv_intra, &rate_uv_tokenonly, &dist_uv, @@ -4325,7 +4323,7 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, sf->adaptive_rd_thresh, bsize, best_ref_index); // macroblock modes - *mbmi = best_mbmode; + *mi = best_mbmode; x->skip |= best_skip2; if (!is_inter_block(&best_mbmode)) { for (i = 0; i < 4; i++) @@ -4334,8 +4332,8 @@ void vp9_rd_pick_inter_mode_sub8x8(VP9_COMP *cpi, for (i = 0; i < 4; ++i) memcpy(&xd->mi[0]->bmi[i], &best_bmodes[i], sizeof(b_mode_info)); - mbmi->mv[0].as_int = xd->mi[0]->bmi[3].as_mv[0].as_int; - mbmi->mv[1].as_int = xd->mi[0]->bmi[3].as_mv[1].as_int; + mi->mv[0].as_int = xd->mi[0]->bmi[3].as_mv[0].as_int; + mi->mv[1].as_int = xd->mi[0]->bmi[3].as_mv[1].as_int; } for (i = 0; i < REFERENCE_MODES; ++i) { diff --git a/vp9/encoder/vp9_segmentation.c b/vp9/encoder/vp9_segmentation.c index c5c50a244..5a0a23d48 100644 --- a/vp9/encoder/vp9_segmentation.c +++ b/vp9/encoder/vp9_segmentation.c @@ -118,7 +118,7 @@ static void count_segs(const VP9_COMMON *cm, MACROBLOCKD *xd, return; xd->mi = mi; - segment_id = xd->mi[0]->mbmi.segment_id; + segment_id = xd->mi[0]->segment_id; set_mi_row_col(xd, tile, mi_row, bh, mi_col, bw, cm->mi_rows, cm->mi_cols); @@ -127,7 +127,7 @@ static void count_segs(const VP9_COMMON *cm, MACROBLOCKD *xd, // Temporal prediction not allowed on key frames if (cm->frame_type != KEY_FRAME) { - const BLOCK_SIZE bsize = xd->mi[0]->mbmi.sb_type; + const BLOCK_SIZE bsize = xd->mi[0]->sb_type; // Test to see if the segment id matches the predicted value. const int pred_segment_id = get_segment_id(cm, cm->last_frame_seg_map, bsize, mi_row, mi_col); @@ -136,7 +136,7 @@ static void count_segs(const VP9_COMMON *cm, MACROBLOCKD *xd, // Store the prediction status for this mb and update counts // as appropriate - xd->mi[0]->mbmi.seg_id_predicted = pred_flag; + xd->mi[0]->seg_id_predicted = pred_flag; temporal_predictor_count[pred_context][pred_flag]++; // Update the "unpredicted" segment count @@ -159,8 +159,8 @@ static void count_segs_sb(const VP9_COMMON *cm, MACROBLOCKD *xd, if (mi_row >= cm->mi_rows || mi_col >= cm->mi_cols) return; - bw = num_8x8_blocks_wide_lookup[mi[0]->mbmi.sb_type]; - bh = num_8x8_blocks_high_lookup[mi[0]->mbmi.sb_type]; + bw = num_8x8_blocks_wide_lookup[mi[0]->sb_type]; + bh = num_8x8_blocks_high_lookup[mi[0]->sb_type]; if (bw == bs && bh == bs) { count_segs(cm, xd, tile, mi, no_pred_segcounts, temporal_predictor_count, diff --git a/vp9/encoder/vp9_temporal_filter.c b/vp9/encoder/vp9_temporal_filter.c index 015dbc0ca..82f566b13 100644 --- a/vp9/encoder/vp9_temporal_filter.c +++ b/vp9/encoder/vp9_temporal_filter.c @@ -46,7 +46,7 @@ static void temporal_filter_predictors_mb_c(MACROBLOCKD *xd, const int which_mv = 0; const MV mv = { mv_row, mv_col }; const InterpKernel *const kernel = - vp9_filter_kernels[xd->mi[0]->mbmi.interp_filter]; + vp9_filter_kernels[xd->mi[0]->interp_filter]; enum mv_precision mv_precision_uv; int uv_stride; diff --git a/vp9/encoder/vp9_tokenize.c b/vp9/encoder/vp9_tokenize.c index 9ac80483a..666f68a15 100644 --- a/vp9/encoder/vp9_tokenize.c +++ b/vp9/encoder/vp9_tokenize.c @@ -468,17 +468,17 @@ static void tokenize_b(int plane, int block, BLOCK_SIZE plane_bsize, uint8_t token_cache[32 * 32]; struct macroblock_plane *p = &x->plane[plane]; struct macroblockd_plane *pd = &xd->plane[plane]; - MB_MODE_INFO *mbmi = &xd->mi[0]->mbmi; + MODE_INFO *mi = xd->mi[0]; int pt; /* near block/prev token context index */ int c; TOKENEXTRA *t = *tp; /* store tokens starting here */ int eob = p->eobs[block]; const PLANE_TYPE type = get_plane_type(plane); const tran_low_t *qcoeff = BLOCK_OFFSET(p->qcoeff, block); - const int segment_id = mbmi->segment_id; + const int segment_id = mi->segment_id; const int16_t *scan, *nb; const scan_order *so; - const int ref = is_inter_block(mbmi); + const int ref = is_inter_block(mi); unsigned int (*const counts)[COEFF_CONTEXTS][ENTROPY_TOKENS] = td->rd_counts.coef_counts[tx_size][type][ref]; vpx_prob (*const coef_probs)[COEFF_CONTEXTS][UNCONSTRAINED_NODES] = @@ -585,12 +585,12 @@ void vp9_tokenize_sb(VP9_COMP *cpi, ThreadData *td, TOKENEXTRA **t, VP9_COMMON *const cm = &cpi->common; MACROBLOCK *const x = &td->mb; MACROBLOCKD *const xd = &x->e_mbd; - MB_MODE_INFO *const mbmi = &xd->mi[0]->mbmi; + MODE_INFO *const mi = xd->mi[0]; const int ctx = vp9_get_skip_context(xd); - const int skip_inc = !segfeature_active(&cm->seg, mbmi->segment_id, + const int skip_inc = !segfeature_active(&cm->seg, mi->segment_id, SEG_LVL_SKIP); struct tokenize_b_args arg = {cpi, td, t}; - if (mbmi->skip) { + if (mi->skip) { if (!dry_run) td->counts->skip[ctx][1] += skip_inc; reset_skip_context(xd, bsize); |