shithub: libvpx

Download patch

ref: dc35b40a6775bd5362299607ff6af4efbd6a568a
parent: c2ac7da981839ef47314ad4de3404e9e71799963
parent: cd1fbc67f9eb50246e4df490af64b1fc25fc04c8
author: Dmitry Kovalev <[email protected]>
date: Fri Aug 15 11:31:43 EDT 2014

Merge "Simplifying vp9_set_speed_features() function."

--- a/vp9/encoder/vp9_encoder.c
+++ b/vp9/encoder/vp9_encoder.c
@@ -1013,10 +1013,6 @@
       vp9_sub_pixel_avg_variance4x4,
       vp9_sad4x4x3, vp9_sad4x4x8, vp9_sad4x4x4d)
 
-  cpi->full_search_sad = vp9_full_search_sad;
-  cpi->diamond_search_sad = vp9_diamond_search_sad;
-  cpi->refining_search_sad = vp9_refining_search_sad;
-
   /* vp9_init_quantizer() is first called here. Add check in
    * vp9_frame_init_quantizer() so that vp9_init_quantizer is only
    * called later when needed. This will avoid unnecessary calls of
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -390,20 +390,18 @@
   sf->recode_tolerance = 25;
   sf->default_interp_filter = SWITCHABLE;
 
-  switch (oxcf->mode) {
-    case ONE_PASS_BEST:
-    case TWO_PASS_SECOND_BEST:  // This is the best quality mode.
-      cpi->diamond_search_sad = vp9_full_range_search;
-      break;
-    case TWO_PASS_FIRST:
-    case ONE_PASS_GOOD:
-    case TWO_PASS_SECOND_GOOD:
+  if (oxcf->mode == REALTIME) {
+    set_rt_speed_feature(cpi, sf, oxcf->speed, oxcf->content);
+  } else {
+    if (!is_best_mode(oxcf->mode))
       set_good_speed_feature(cpi, cm, sf, oxcf->speed);
-      break;
-    case REALTIME:
-      set_rt_speed_feature(cpi, sf, oxcf->speed, oxcf->content);
-      break;
   }
+
+  cpi->full_search_sad = vp9_full_search_sad;
+  cpi->diamond_search_sad = is_best_mode(oxcf->mode) ? vp9_full_range_search
+                                                     : vp9_diamond_search_sad;
+  cpi->refining_search_sad = vp9_refining_search_sad;
+
 
   // Slow quant, dct and trellis not worthwhile for first pass
   // so make sure they are always turned off.