Adding FAST_COEFF_UPDATE enum.
authorDmitry Kovalev <dkovalev@google.com>
Fri, 4 Apr 2014 17:31:34 +0000 (10:31 -0700)
committerDmitry Kovalev <dkovalev@google.com>
Fri, 4 Apr 2014 17:31:34 +0000 (10:31 -0700)
Change-Id: I75ad328c6d719df81cc24f3ae21c152af4ebdacc

vp9/encoder/vp9_bitstream.c
vp9/encoder/vp9_speed_features.c
vp9/encoder/vp9_speed_features.h

index dbefe1e..4313418 100644 (file)
@@ -521,7 +521,7 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
   const int entropy_nodes_update = UNCONSTRAINED_NODES;
   int i, j, k, l, t;
   switch (cpi->sf.use_fast_coef_updates) {
-    case 0: {
+    case TWO_LOOP: {
       /* dry run to see if there is any udpate at all needed */
       int savings = 0;
       int update[2] = {0, 0};
@@ -596,14 +596,14 @@ static void update_coef_probs_common(vp9_writer* const bc, VP9_COMP *cpi,
       return;
     }
 
-    case 1:
-    case 2: {
+    case ONE_LOOP:
+    case ONE_LOOP_REDUCED: {
       const int prev_coef_contexts_to_update =
-          cpi->sf.use_fast_coef_updates == 2 ? COEFF_CONTEXTS >> 1
-                                             : COEFF_CONTEXTS;
+          cpi->sf.use_fast_coef_updates == ONE_LOOP_REDUCED ?
+              COEFF_CONTEXTS >> 1 : COEFF_CONTEXTS;
       const int coef_band_to_update =
-          cpi->sf.use_fast_coef_updates == 2 ? COEF_BANDS >> 1
-                                             : COEF_BANDS;
+          cpi->sf.use_fast_coef_updates == ONE_LOOP_REDUCED ?
+              COEF_BANDS >> 1 : COEF_BANDS;
       int updates = 0;
       int noupdates_before_first = 0;
       for (i = 0; i < PLANE_TYPES; ++i) {
index 7b983f9..9ca1b5e 100644 (file)
@@ -111,7 +111,7 @@ static void set_good_speed_feature(VP9_COMP *cpi,
 
     sf->adaptive_rd_thresh = 3;
     sf->mode_skip_start = 6;
-    sf->use_fast_coef_updates = 2;
+    sf->use_fast_coef_updates = ONE_LOOP_REDUCED;
     sf->use_fast_coef_costing = 1;
   }
   // Additions or changes for speed 3 and above
@@ -220,7 +220,7 @@ static void set_rt_speed_feature(VP9_COMMON *cm,
     sf->use_uv_intra_rd_estimate = 1;
     sf->skip_encode_sb = 1;
     sf->subpel_iters_per_step = 1;
-    sf->use_fast_coef_updates = 2;
+    sf->use_fast_coef_updates = ONE_LOOP_REDUCED;
     sf->adaptive_rd_thresh = 4;
     sf->mode_skip_start = 6;
     sf->allow_skip_recode = 0;
@@ -328,7 +328,7 @@ void vp9_set_speed_features(VP9_COMP *cpi) {
   sf->use_uv_intra_rd_estimate = 0;
   sf->allow_skip_recode = 0;
   sf->lpf_pick = LPF_PICK_FROM_FULL_IMAGE;
-  sf->use_fast_coef_updates = 0;
+  sf->use_fast_coef_updates = TWO_LOOP;
   sf->use_fast_coef_costing = 0;
   sf->mode_skip_start = MAX_MODES;  // Mode index at which mode skip mask set
   sf->use_nonrd_pick_mode = 0;
index 8260439..922f880 100644 (file)
@@ -113,6 +113,19 @@ typedef enum {
   VAR_BASED_PARTITION
 } PARTITION_SEARCH_TYPE;
 
+typedef enum {
+  // Does a dry run to see if any of the contexts need to be updated or not,
+  // before the final run.
+  TWO_LOOP = 0,
+
+  // No dry run conducted.
+  ONE_LOOP = 1,
+
+  // No dry run, also only half the coef contexts and bands are updated.
+  // The rest are not updated at all.
+  ONE_LOOP_REDUCED = 2
+} FAST_COEFF_UPDATE;
+
 typedef struct {
   // Frame level coding parameter update
   int frame_parameter_update;
@@ -291,7 +304,7 @@ typedef struct {
 
   // This feature limits the number of coefficients updates we actually do
   // by only looking at counts from 1/2 the bands.
-  int use_fast_coef_updates;  // 0: 2-loop, 1: 1-loop, 2: 1-loop reduced
+  FAST_COEFF_UPDATE use_fast_coef_updates;
 
   // This flag controls the use of non-RD mode decision.
   int use_nonrd_pick_mode;