summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_mcomp.c
diff options
context:
space:
mode:
authorAngie Chiang <angiebird@google.com>2019-06-25 15:21:17 -0700
committerAngie Chiang <angiebird@google.com>2019-06-26 15:09:59 -0700
commit1a363a8cae8539e82f44028548bb8c1a4ae6bd60 (patch)
treec908735eef2c093897cc8ada79efcd32c3727faa /vp9/encoder/vp9_mcomp.c
parent5ab6039987847e60e621615fc135e198d5dc0ad8 (diff)
downloadlibvpx-1a363a8cae8539e82f44028548bb8c1a4ae6bd60.tar.gz
Speed up diamond_search_sad_new
The percentage of encoding time spent on diamond_search_sad_new reduces from 8% to 6% Change-Id: I1be55b957475d780974cc2e721f8c2d4d266e916
Diffstat (limited to 'vp9/encoder/vp9_mcomp.c')
-rw-r--r--vp9/encoder/vp9_mcomp.c46
1 files changed, 25 insertions, 21 deletions
diff --git a/vp9/encoder/vp9_mcomp.c b/vp9/encoder/vp9_mcomp.c
index 388f87040..52bcea55f 100644
--- a/vp9/encoder/vp9_mcomp.c
+++ b/vp9/encoder/vp9_mcomp.c
@@ -2149,18 +2149,20 @@ static double diamond_search_sad_new(const MACROBLOCK *x,
sad_array);
for (t = 0; t < 4; t++, i++) {
- const MV this_mv = { best_full_mv->row + ss_mv[i].row,
- best_full_mv->col + ss_mv[i].col };
- const double mv_dist = sad_array[t];
- const double mv_cost =
- vp9_nb_mvs_inconsistency(&this_mv, nb_full_mvs, full_mv_num) /
- (double)(1 << LOG2_PRECISION);
- double thissad = mv_dist + lambda * mv_cost;
- if (thissad < bestsad) {
- bestsad = thissad;
- *best_mv_dist = mv_dist;
- *best_mv_cost = mv_cost;
- best_site = i;
+ if (sad_array[t] < bestsad) {
+ const MV this_mv = { best_full_mv->row + ss_mv[i].row,
+ best_full_mv->col + ss_mv[i].col };
+ const double mv_dist = sad_array[t];
+ const double mv_cost =
+ vp9_nb_mvs_inconsistency(&this_mv, nb_full_mvs, full_mv_num) /
+ (double)(1 << LOG2_PRECISION);
+ double thissad = mv_dist + lambda * mv_cost;
+ if (thissad < bestsad) {
+ bestsad = thissad;
+ *best_mv_dist = mv_dist;
+ *best_mv_cost = mv_cost;
+ best_site = i;
+ }
}
}
}
@@ -2174,15 +2176,17 @@ static double diamond_search_sad_new(const MACROBLOCK *x,
const uint8_t *const check_here = ss_os[i] + best_address;
const double mv_dist =
fn_ptr->sdf(what, what_stride, check_here, in_what_stride);
- const double mv_cost =
- vp9_nb_mvs_inconsistency(&this_mv, nb_full_mvs, full_mv_num) /
- (double)(1 << LOG2_PRECISION);
- double thissad = mv_dist + lambda * mv_cost;
- if (thissad < bestsad) {
- bestsad = thissad;
- *best_mv_dist = mv_dist;
- *best_mv_cost = mv_cost;
- best_site = i;
+ if (mv_dist < bestsad) {
+ const double mv_cost =
+ vp9_nb_mvs_inconsistency(&this_mv, nb_full_mvs, full_mv_num) /
+ (double)(1 << LOG2_PRECISION);
+ double thissad = mv_dist + lambda * mv_cost;
+ if (thissad < bestsad) {
+ bestsad = thissad;
+ *best_mv_dist = mv_dist;
+ *best_mv_cost = mv_cost;
+ best_site = i;
+ }
}
}
i++;