Merge "Use less tmp motion vectors in vp9_pick_inter_mode_sub8x8"

This commit is contained in:
Jingning Han 2015-01-02 10:00:45 -08:00 committed by Gerrit Code Review
commit 59cfaa538e

View File

@ -961,7 +961,6 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
MV_REFERENCE_FRAME ref_frame, second_ref_frame = NONE; MV_REFERENCE_FRAME ref_frame, second_ref_frame = NONE;
MV_REFERENCE_FRAME best_ref_frame = NONE; MV_REFERENCE_FRAME best_ref_frame = NONE;
unsigned char segment_id = mbmi->segment_id; unsigned char segment_id = mbmi->segment_id;
int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES];
struct buf_2d yv12_mb[4][MAX_MB_PLANE]; struct buf_2d yv12_mb[4][MAX_MB_PLANE];
static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG, static const int flag_list[4] = { 0, VP9_LAST_FLAG, VP9_GOLD_FLAG,
VP9_ALT_FLAG }; VP9_ALT_FLAG };
@ -976,28 +975,24 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
ctx->pred_pixel_ready = 0; ctx->pred_pixel_ready = 0;
for (ref_frame = LAST_FRAME; ref_frame <= GOLDEN_FRAME; ref_frame++) { for (ref_frame = LAST_FRAME; ref_frame <= GOLDEN_FRAME; ref_frame++) {
x->pred_mv_sad[ref_frame] = INT_MAX; int_mv dummy_mv[2];
frame_mv[NEWMV][ref_frame].as_int = INVALID_MV; x->pred_mv_sad[ref_frame] = INT_MAX;
frame_mv[ZEROMV][ref_frame].as_int = 0;
if (cpi->ref_frame_flags & flag_list[ref_frame]) { if (cpi->ref_frame_flags & flag_list[ref_frame]) {
const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, ref_frame); const YV12_BUFFER_CONFIG *yv12 = get_ref_frame_buffer(cpi, ref_frame);
int_mv *const candidates = mbmi->ref_mvs[ref_frame]; int_mv *const candidates = mbmi->ref_mvs[ref_frame];
const struct scale_factors *const sf = const struct scale_factors *const sf =
&cm->frame_refs[ref_frame - 1].sf; &cm->frame_refs[ref_frame - 1].sf;
vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col, vp9_setup_pred_block(xd, yv12_mb[ref_frame], yv12, mi_row, mi_col,
sf, sf); sf, sf);
vp9_find_mv_refs(cm, xd, tile_info, xd->mi[0].src_mi, ref_frame, vp9_find_mv_refs(cm, xd, tile_info, xd->mi[0].src_mi, ref_frame,
candidates, mi_row, mi_col); candidates, mi_row, mi_col);
vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates, vp9_find_best_ref_mvs(xd, cm->allow_high_precision_mv, candidates,
&frame_mv[NEARESTMV][ref_frame], &dummy_mv[0], &dummy_mv[1]);
&frame_mv[NEARMV][ref_frame]); } else {
} else { ref_frame_skip_mask |= (1 << ref_frame);
ref_frame_skip_mask |= (1 << ref_frame); }
}
frame_mv[NEWMV][ref_frame].as_int = INVALID_MV;
frame_mv[ZEROMV][ref_frame].as_int = 0;
} }
mbmi->sb_type = bsize; mbmi->sb_type = bsize;
@ -1037,7 +1032,7 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
for (idy = 0; idy < 2; idy += num_4x4_blocks_high) { for (idy = 0; idy < 2; idy += num_4x4_blocks_high) {
for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) { for (idx = 0; idx < 2; idx += num_4x4_blocks_wide) {
int_mv frame_mv[MB_MODE_COUNT][MAX_REF_FRAMES]; int_mv b_mv[MB_MODE_COUNT];
int64_t b_best_rd = INT64_MAX; int64_t b_best_rd = INT64_MAX;
const int i = idy * 2 + idx; const int i = idy * 2 + idx;
PREDICTION_MODE this_mode; PREDICTION_MODE this_mode;
@ -1063,15 +1058,14 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
&pd->pre[0].buf[vp9_raster_block_offset(BLOCK_8X8, &pd->pre[0].buf[vp9_raster_block_offset(BLOCK_8X8,
i, pd->pre[0].stride)]; i, pd->pre[0].stride)];
frame_mv[ZEROMV][ref_frame].as_int = 0; b_mv[ZEROMV].as_int = 0;
frame_mv[NEWMV][ref_frame].as_int = INVALID_MV; b_mv[NEWMV].as_int = INVALID_MV;
vp9_append_sub8x8_mvs_for_idx(cm, xd, tile_info, i, 0, mi_row, mi_col, vp9_append_sub8x8_mvs_for_idx(cm, xd, tile_info, i, 0, mi_row, mi_col,
&frame_mv[NEARESTMV][ref_frame], &b_mv[NEARESTMV],
&frame_mv[NEARMV][ref_frame]); &b_mv[NEARMV]);
for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) { for (this_mode = NEARESTMV; this_mode <= NEWMV; ++this_mode) {
xd->mi[0].bmi[i].as_mv[0].as_int = xd->mi[0].bmi[i].as_mv[0].as_int = b_mv[this_mode].as_int;
frame_mv[this_mode][ref_frame].as_int;
if (this_mode == NEWMV) { if (this_mode == NEWMV) {
const int step_param = cpi->sf.mv.fullpel_search_step_param; const int step_param = cpi->sf.mv.fullpel_search_step_param;
@ -1085,8 +1079,8 @@ void vp9_pick_inter_mode_sub8x8(VP9_COMP *cpi, MACROBLOCK *x,
int dummy_dist; int dummy_dist;
if (i == 0) { if (i == 0) {
mvp_full.row = frame_mv[NEARESTMV][ref_frame].as_mv.row >> 3; mvp_full.row = b_mv[NEARESTMV].as_mv.row >> 3;
mvp_full.col = frame_mv[NEARESTMV][ref_frame].as_mv.col >> 3; mvp_full.col = b_mv[NEARESTMV].as_mv.col >> 3;
} else { } else {
mvp_full.row = xd->mi[0].bmi[0].as_mv[0].as_mv.row >> 3; mvp_full.row = xd->mi[0].bmi[0].as_mv[0].as_mv.row >> 3;
mvp_full.col = xd->mi[0].bmi[0].as_mv[0].as_mv.col >> 3; mvp_full.col = xd->mi[0].bmi[0].as_mv[0].as_mv.col >> 3;