vp9: Skip computation of best_sad for newmv, unless needed.
For non-rd pickmode: best_pred_sad, computed for NEWMV-last, is only used for skipping golden non-zero modes. Add condition to avoid this computation if not used (i.e, if golden nonzero modes are not used). And remove code for computing best_pred_sad for NEWMV-golden, since that sad is not used. No change in behavior; small speed gain (~1%) for svc encodes. Change-Id: Ic2cbdef6c4e9a233a57c0db0eeac8ad5fcead366
This commit is contained in:
parent
f80d8011a0
commit
bedf1c3af6
@ -1323,6 +1323,7 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
int ref_frame_cost[MAX_REF_FRAMES];
|
||||
int svc_force_zero_mode[3] = {0};
|
||||
int perform_intra_pred = 1;
|
||||
int use_golden_nonzeromv = 1;
|
||||
#if CONFIG_VP9_TEMPORAL_DENOISING
|
||||
VP9_PICKMODE_CTX_DEN ctx_den;
|
||||
int64_t zero_last_cost_orig = INT64_MAX;
|
||||
@ -1409,6 +1410,10 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
}
|
||||
}
|
||||
|
||||
if (!((cpi->ref_frame_flags & flag_list[GOLDEN_FRAME]) &&
|
||||
!svc_force_zero_mode[GOLDEN_FRAME - 1]))
|
||||
use_golden_nonzeromv = 0;
|
||||
|
||||
for (ref_frame = LAST_FRAME; ref_frame <= usable_ref_frame; ++ref_frame) {
|
||||
find_predictors(cpi, x, ref_frame, frame_mv, const_motion,
|
||||
&ref_frame_skip_mask, flag_list, tile_data, mi_row, mi_col,
|
||||
@ -1543,7 +1548,8 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
}
|
||||
}
|
||||
|
||||
if (this_mode == NEWMV && ref_frame == LAST_FRAME &&
|
||||
if (use_golden_nonzeromv &&
|
||||
this_mode == NEWMV && ref_frame == LAST_FRAME &&
|
||||
frame_mv[NEWMV][LAST_FRAME].as_int != INVALID_MV) {
|
||||
const int pre_stride = xd->plane[0].pre[0].stride;
|
||||
const uint8_t * const pre_buf = xd->plane[0].pre[0].buf +
|
||||
@ -1555,21 +1561,6 @@ void vp9_pick_inter_mode(VP9_COMP *cpi, MACROBLOCK *x,
|
||||
x->pred_mv_sad[LAST_FRAME] = best_pred_sad;
|
||||
}
|
||||
|
||||
if (cpi->use_svc) {
|
||||
if (this_mode == NEWMV && ref_frame == GOLDEN_FRAME &&
|
||||
frame_mv[NEWMV][GOLDEN_FRAME].as_int != INVALID_MV) {
|
||||
const int pre_stride = xd->plane[0].pre[0].stride;
|
||||
const uint8_t * const pre_buf = xd->plane[0].pre[0].buf +
|
||||
(frame_mv[NEWMV][GOLDEN_FRAME].as_mv.row >> 3) * pre_stride +
|
||||
(frame_mv[NEWMV][GOLDEN_FRAME].as_mv.col >> 3);
|
||||
best_pred_sad = cpi->fn_ptr[bsize].sdf(x->plane[0].src.buf,
|
||||
x->plane[0].src.stride,
|
||||
pre_buf, pre_stride);
|
||||
x->pred_mv_sad[GOLDEN_FRAME] = best_pred_sad;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (this_mode != NEARESTMV &&
|
||||
frame_mv[this_mode][ref_frame].as_int ==
|
||||
frame_mv[NEARESTMV][ref_frame].as_int)
|
||||
|
Loading…
Reference in New Issue
Block a user