shithub: libvpx

Download patch

ref: 69b88df206d9b0814e9fced583c7777d1c30028d
parent: 1355af5c42ccd3c96b4c28d25594cb302672dcde
parent: 52549b4e78dba7116f5d6c91a785e65d32c570c9
author: Dmitry Kovalev <dkovalev@google.com>
date: Thu Apr 17 14:26:54 EDT 2014

Merge "Adding is_best_mode() function."

--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -372,9 +372,6 @@
     cache_ptr += cm->mi_cols;
   }
 }
-static int is_slowest_mode(int mode) {
-  return (mode == TWO_PASS_SECOND_BEST || mode == ONE_PASS_BEST);
-}
 
 static void set_rd_speed_thresholds(VP9_COMP *cpi) {
   int i;
@@ -382,7 +379,7 @@
 
   // Set baseline threshold values
   for (i = 0; i < MAX_MODES; ++i)
-    rd->thresh_mult[i] = is_slowest_mode(cpi->oxcf.mode) ? -500 : 0;
+    rd->thresh_mult[i] = is_best_mode(cpi->oxcf.mode) ? -500 : 0;
 
   rd->thresh_mult[THR_NEARESTMV] = 0;
   rd->thresh_mult[THR_NEARESTG] = 0;
@@ -464,7 +461,7 @@
   int i;
 
   for (i = 0; i < MAX_REFS; ++i)
-    rd->thresh_mult_sub8x8[i] = is_slowest_mode(cpi->oxcf.mode)  ? -500 : 0;
+    rd->thresh_mult_sub8x8[i] = is_best_mode(cpi->oxcf.mode)  ? -500 : 0;
 
   rd->thresh_mult_sub8x8[THR_LAST] += 2500;
   rd->thresh_mult_sub8x8[THR_GOLD] += 2500;
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -287,6 +287,9 @@
   vp8e_tuning tuning;
 } VP9_CONFIG;
 
+static INLINE int is_best_mode(MODE mode) {
+  return mode == ONE_PASS_BEST || mode == TWO_PASS_SECOND_BEST;
+}
 
 typedef struct RD_OPT {
   // Thresh_mult is used to set a threshold for the rd score. A higher value
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1820,8 +1820,7 @@
           if (best_rd < label_mv_thresh)
             break;
 
-          if (cpi->oxcf.mode != TWO_PASS_SECOND_BEST &&
-              cpi->oxcf.mode != ONE_PASS_BEST) {
+          if (!is_best_mode(cpi->oxcf.mode)) {
             // use previous block's result as next block's MV predictor.
             if (i > 0) {
               bsi->mvp.as_int = mi->bmi[i - 1].as_mv[0].as_int;
@@ -1897,8 +1896,7 @@
           }
 
           // Should we do a full search (best quality only)
-          if (cpi->oxcf.mode == ONE_PASS_BEST ||
-              cpi->oxcf.mode == TWO_PASS_SECOND_BEST) {
+          if (is_best_mode(cpi->oxcf.mode)) {
             int_mv *const best_mv = &mi->bmi[i].as_mv[0];
             /* Check if mvp_full is within the range. */
             clamp_mv(&mvp_full, x->mv_col_min, x->mv_col_max,