Code cleanup Change-Id: I395eca1acb3c7584d718027bdbfbdb3310010b6a
diff --git a/av1/encoder/mcomp.c b/av1/encoder/mcomp.c index ebe9e22..22c87a6 100644 --- a/av1/encoder/mcomp.c +++ b/av1/encoder/mcomp.c
@@ -2374,42 +2374,17 @@ var = full_pixel_diamond(cpi, x, mvp_full, step_param, error_per_bit, MAX_MVSEARCH_STEPS - 1 - step_param, 1, cost_list, fn_ptr, ref_mv, cfg); - - // Should we allow a follow on exhaustive search? - if (is_exhaustive_allowed(cpi, x)) { - int exhuastive_thr = sf->exhaustive_searches_thresh; - exhuastive_thr >>= - 10 - (mi_size_wide_log2[bsize] + mi_size_high_log2[bsize]); - - // Threshold variance for an exhaustive full search. - if (var > exhuastive_thr) { - int var_ex; - MV tmp_mv_ex; - var_ex = - full_pixel_exhaustive(cpi, x, &x->best_mv.as_mv, error_per_bit, - cost_list, fn_ptr, ref_mv, &tmp_mv_ex); - - if (var_ex < var) { - var = var_ex; - x->best_mv.as_mv = tmp_mv_ex; - } - } - } break; default: assert(0 && "Invalid search method."); } // Should we allow a follow on exhaustive search? - if (!run_mesh_search) { - if (method == NSTEP) { - if (is_exhaustive_allowed(cpi, x)) { - int exhuastive_thr = sf->exhaustive_searches_thresh; - exhuastive_thr >>= - 10 - (mi_size_wide_log2[bsize] + mi_size_high_log2[bsize]); - // Threshold variance for an exhaustive full search. - if (var > exhuastive_thr) run_mesh_search = 1; - } - } + if (!run_mesh_search && method == NSTEP && is_exhaustive_allowed(cpi, x)) { + int exhuastive_thr = sf->exhaustive_searches_thresh; + exhuastive_thr >>= + 10 - (mi_size_wide_log2[bsize] + mi_size_high_log2[bsize]); + // Threshold variance for an exhaustive full search. + if (var > exhuastive_thr) run_mesh_search = 1; } if (run_mesh_search) {
diff --git a/av1/encoder/rdopt.c b/av1/encoder/rdopt.c index e115ffc..4fb21e0 100644 --- a/av1/encoder/rdopt.c +++ b/av1/encoder/rdopt.c
@@ -6976,15 +6976,8 @@ MB_MODE_INFO *mbmi = xd->mi[0]; struct buf_2d backup_yv12[MAX_MB_PLANE] = { { 0, 0, 0, 0, 0 } }; int bestsme = INT_MAX; - int step_param; - int sadpb = x->sadperbit16; - MV mvp_full; - int ref = mbmi->ref_frame[ref_idx]; - MV ref_mv = av1_get_ref_mv(x, ref_idx).as_mv; - + const int ref = mbmi->ref_frame[ref_idx]; MvLimits tmp_mv_limits = x->mv_limits; - int cost_list[5]; - const YV12_BUFFER_CONFIG *scaled_ref_frame = av1_get_scaled_ref_frame(cpi, ref); @@ -7002,6 +6995,7 @@ // Work out the size of the first step in the mv step search. // 0 here is maximum length first step. 1 is AOMMAX >> 1 etc. + int step_param; if (cpi->sf.mv.auto_mv_step_size && cm->show_frame) { // Take the weighted average of the step_params based on the last frame's // max mv magnitude and that based on the best ref mvs of the current @@ -7050,10 +7044,12 @@ } } + const MV ref_mv = av1_get_ref_mv(x, ref_idx).as_mv; // Note: MV limits are modified here. Always restore the original values // after full-pixel motion search. av1_set_mv_search_range(&x->mv_limits, &ref_mv); + MV mvp_full; if (mbmi->motion_mode != SIMPLE_TRANSLATION) mvp_full = mbmi->mv[0].as_mv; else @@ -7062,8 +7058,9 @@ mvp_full.col >>= 3; mvp_full.row >>= 3; + const int sadpb = x->sadperbit16; + int cost_list[5]; x->best_mv.as_int = x->second_best_mv.as_int = INVALID_MV; - switch (mbmi->motion_mode) { case SIMPLE_TRANSLATION: bestsme = av1_full_pixel_search(