summaryrefslogtreecommitdiff
path: root/vp9/encoder/vp9_rdopt.c
diff options
context:
space:
mode:
authorHui Su <huisu@google.com>2018-08-06 18:01:25 -0700
committerHui Su <huisu@google.com>2018-08-07 11:10:57 -0700
commit763c9e08dd9fd7aa3acca3bf3a89a7c36d640050 (patch)
treedce4d5d2b9f5f8d52e8a8d35cc83bb3a103831b9 /vp9/encoder/vp9_rdopt.c
parent1907d91c42e25b9bc78d0f7c04963109bb3e4d8f (diff)
downloadlibvpx-763c9e08dd9fd7aa3acca3bf3a89a7c36d640050.tar
libvpx-763c9e08dd9fd7aa3acca3bf3a89a7c36d640050.tar.gz
libvpx-763c9e08dd9fd7aa3acca3bf3a89a7c36d640050.tar.bz2
libvpx-763c9e08dd9fd7aa3acca3bf3a89a7c36d640050.zip
Add enhanced_full_pixel_motion_search feature
Do some extra full pixel search to improve motion vector quality. Currently it is enabled for speed 1 only; disabled for real time mode. Coding gain for speed 1: avg_psnr ovr_psnr ssim lowres -0.23% -0.23% -0.35% midres -0.33% -0.35% -0.38% hdres -0.28% -0.29% -0.28% Tested encoding time over 10 HD sequences. Overall speed overhead is 1.5% for QP=30; 0.6 % for QP=40. Change-Id: Ic2ea4d78c4979de9d5090c9d7c702944f155f8af
Diffstat (limited to 'vp9/encoder/vp9_rdopt.c')
-rw-r--r--vp9/encoder/vp9_rdopt.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/vp9/encoder/vp9_rdopt.c b/vp9/encoder/vp9_rdopt.c
index 4005f85b1..b20d57332 100644
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -2409,6 +2409,31 @@ static void single_motion_search(VP9_COMP *cpi, MACROBLOCK *x, BLOCK_SIZE bsize,
cpi, x, bsize, &mvp_full, step_param, cpi->sf.mv.search_method, sadpb,
cond_cost_list(cpi, cost_list), &ref_mv, &tmp_mv->as_mv, INT_MAX, 1);
+ if (cpi->sf.enhanced_full_pixel_motion_search) {
+ if (x->mv_best_ref_index[ref] == 2) {
+ const int diff_row = ((int)pred_mv[0].row - pred_mv[2].row) >> 3;
+ const int diff_col = ((int)pred_mv[0].col - pred_mv[2].col) >> 3;
+ const int diff_sse = diff_row * diff_row + diff_col * diff_col;
+ // If pred_mv[0] and pred_mv[2] are very different, also search around
+ // pred_mv[0].
+ if (diff_sse > 10) {
+ int this_me;
+ MV this_mv;
+ mvp_full = pred_mv[0];
+ mvp_full.col >>= 3;
+ mvp_full.row >>= 3;
+ this_me = vp9_full_pixel_search(cpi, x, bsize, &mvp_full, step_param,
+ cpi->sf.mv.search_method, sadpb,
+ cond_cost_list(cpi, cost_list), &ref_mv,
+ &this_mv, INT_MAX, 1);
+ if (this_me < bestsme) {
+ tmp_mv->as_mv = this_mv;
+ bestsme = this_me;
+ }
+ }
+ }
+ }
+
x->mv_limits = tmp_mv_limits;
if (bestsme < INT_MAX) {