]> granicus.if.org Git - libvpx/commitdiff
Replacing cpu_used with speed in VP9_CONFIG.
authorDmitry Kovalev <dkovalev@google.com>
Thu, 17 Apr 2014 01:31:42 +0000 (18:31 -0700)
committerDmitry Kovalev <dkovalev@google.com>
Thu, 17 Apr 2014 01:31:42 +0000 (18:31 -0700)
Change-Id: I86b85b5c11388e84a48f8936330c0d920df5d1f0

vp9/encoder/vp9_firstpass.c
vp9/encoder/vp9_mbgraph.c
vp9/encoder/vp9_onyx_if.c
vp9/encoder/vp9_onyx_int.h
vp9/encoder/vp9_rdopt.c
vp9/encoder/vp9_speed_features.c
vp9/encoder/vp9_temporal_filter.c
vp9/vp9_cx_iface.c

index 37f9cc6796e6ed99e76831b03485027b13a64480..4415543e7c8b0449f62691226e090efa5ae8609b 100644 (file)
@@ -911,7 +911,7 @@ static int get_twopass_worst_quality(const VP9_COMP *cpi,
     const int num_mbs = cpi->common.MBs;
     const double section_err = stats->coded_error / stats->count;
     const double err_per_mb = section_err / num_mbs;
-    const double speed_term = 1.0 + 0.04 * cpi->speed;
+    const double speed_term = 1.0 + 0.04 * cpi->oxcf.speed;
     const int target_norm_bits_per_mb = ((uint64_t)section_target_bandwidth <<
                                             BPER_MB_NORMBITS) / num_mbs;
     int q;
index a9da7283abc5e1728843c06302414326d4e40b7e..2f63a13a08b0a8e3d649440b625237c0d50f6b68 100644 (file)
@@ -38,8 +38,8 @@ static unsigned int do_16x16_motion_iteration(VP9_COMP *cpi,
 
   // Further step/diamond searches as necessary
   int step_param = cpi->sf.reduce_first_step_size +
-      (cpi->speed < 8 ? (cpi->speed > 5 ? 1 : 0) : 2);
-  step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
+                       (cpi->oxcf.speed > 5 ? 1 : 0);
+  step_param = MIN(step_param, cpi->sf.max_step_search_steps - 2);
 
   vp9_set_mv_search_range(x, ref_mv);
 
index 8a94cf34014b4c92587e2d2f157feb28dc05099d..986230b949b4aab911abda9b0d5bb8b25aa908a5 100644 (file)
@@ -705,14 +705,10 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9_CONFIG *oxcf) {
 
   cpi->oxcf = *oxcf;
 
-  if (cpi->oxcf.cpu_used == -6)
-    cpi->oxcf.play_alternate = 0;
-
   switch (cpi->oxcf.mode) {
       // Real time and one pass deprecated in test code base
     case ONE_PASS_GOOD:
       cpi->pass = 0;
-      cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
       break;
 
     case ONE_PASS_BEST:
@@ -725,7 +721,6 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9_CONFIG *oxcf) {
 
     case TWO_PASS_SECOND_GOOD:
       cpi->pass = 2;
-      cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
       break;
 
     case TWO_PASS_SECOND_BEST:
@@ -734,6 +729,7 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9_CONFIG *oxcf) {
 
     case REALTIME:
       cpi->pass = 0;
+      cpi->oxcf.play_alternate = 0;
       break;
   }
 
@@ -833,8 +829,6 @@ void vp9_change_config(struct VP9_COMP *cpi, const VP9_CONFIG *oxcf) {
                                            (int)cpi->oxcf.target_bandwidth);
   }
 
-  cpi->speed = abs(cpi->oxcf.cpu_used);
-
 #if CONFIG_MULTIPLE_ARF
   vp9_zero(cpi->alt_ref_source);
 #else
index 08287cb792526130cd9bf3533e31371812774447..54d76149a56383dc2877392c638d7babd0787d45 100644 (file)
@@ -196,7 +196,7 @@ typedef struct VP9_CONFIG {
 
   int noise_sensitivity;  // pre processing blur: recommendation 0
   int sharpness;  // sharpening output: recommendation 0:
-  int cpu_used;
+  int speed;
   unsigned int rc_max_intra_bitrate_pct;
 
   MODE mode;
@@ -402,10 +402,6 @@ typedef struct VP9_COMP {
   int mbgraph_n_frames;             // number of frames filled in the above
   int static_mb_pct;                // % forced skip mbs by segmentation
 
-  // for real time encoding
-  int speed;
-
-  int cpu_used;
   int pass;
 
   int ref_frame_flags;
index 5d53aaaa22c11cfd612e43ccc76b1b1a3d0c5e06..8766de66a89f10cb2cef933b776dadbba2edcb18 100644 (file)
@@ -451,7 +451,7 @@ static void model_rd_for_sb(VP9_COMP *cpi, BLOCK_SIZE bsize,
       x->pred_sse[ref] = sse;
 
     // Fast approximate the modelling function.
-    if (cpi->speed > 4) {
+    if (cpi->oxcf.speed > 4) {
       int64_t rate;
       int64_t dist;
       int64_t square_error = sse;
index 6e0effae3976eea1e4a0748dd96515eaa75359fb..f79ded5f98d0a11957783e1fcea5e54a42214763 100644 (file)
@@ -289,7 +289,6 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
   SPEED_FEATURES *const sf = &cpi->sf;
   VP9_COMMON *const cm = &cpi->common;
   const VP9_CONFIG *const oxcf = &cpi->oxcf;
-  const int speed = cpi->speed < 0 ? -cpi->speed : cpi->speed;
   int i;
 
   // best quality defaults
@@ -360,10 +359,10 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
     case TWO_PASS_FIRST:
     case ONE_PASS_GOOD:
     case TWO_PASS_SECOND_GOOD:
-      set_good_speed_feature(cpi, cm, sf, speed);
+      set_good_speed_feature(cpi, cm, sf, oxcf->speed);
       break;
     case REALTIME:
-      set_rt_speed_feature(cm, sf, speed);
+      set_rt_speed_feature(cm, sf, oxcf->speed);
       break;
   }
 
index 0410273545ead154ae308003cc3f82752a28578b..c98c9d41587cab82e6750a0bd6a88c1767b6c53f 100644 (file)
@@ -151,12 +151,8 @@ static int temporal_filter_find_matching_mb_c(VP9_COMP *cpi,
   xd->plane[0].pre[0].buf = frame_ptr_buf;
   xd->plane[0].pre[0].stride = stride;
 
-  // Further step/diamond searches as necessary
-  if (cpi->speed < 8)
-    step_param = cpi->sf.reduce_first_step_size + ((cpi->speed > 5) ? 1 : 0);
-  else
-    step_param = cpi->sf.reduce_first_step_size + 2;
-  step_param = MIN(step_param, (cpi->sf.max_step_search_steps - 2));
+  step_param = cpi->sf.reduce_first_step_size + (cpi->oxcf.speed > 5 ? 1 : 0);
+  step_param = MIN(step_param, cpi->sf.max_step_search_steps - 2);
 
   /*cpi->sf.search_method == HEX*/
   // Ignore mv costing by sending NULL pointer instead of cost arrays
index 95b3500c77f790d4cfcaf6fe146aff82ebe45804..87d4bb7c1ac3d1ca16449e2f669d84af28088a79 100644 (file)
@@ -356,7 +356,7 @@ static vpx_codec_err_t set_encoder_config(
 
   oxcf->key_freq               = cfg->kf_max_dist;
 
-  oxcf->cpu_used               =  extra_cfg->cpu_used;
+  oxcf->speed                  =  clamp(abs(extra_cfg->cpu_used), 0, 7);
   oxcf->encode_breakout        =  extra_cfg->static_thresh;
   oxcf->play_alternate         =  extra_cfg->enable_auto_alt_ref;
   oxcf->noise_sensitivity      =  extra_cfg->noise_sensitivity;