shithub: libvpx

Download patch

ref: 617a367c54826718ed055cdc3f789660c08b55f9
parent: 003376fc8b6930ba65ee5a35f2f579fdc3307465
parent: f3739f905226bfaa8e0e1eb7ce16b1adc86f3895
author: Dmitry Kovalev <dkovalev@google.com>
date: Tue Apr 15 18:59:37 EDT 2014

Merge "Consistent mode names."

--- a/vp9/encoder/vp9_onyx_if.c
+++ b/vp9/encoder/vp9_onyx_if.c
@@ -376,7 +376,7 @@
   }
 }
 static int is_slowest_mode(int mode) {
-  return (mode == MODE_SECONDPASS_BEST || mode == MODE_BESTQUALITY);
+  return (mode == TWO_PASS_SECOND_BEST || mode == ONE_PASS_BEST);
 }
 
 static void set_rd_speed_thresholds(VP9_COMP *cpi) {
@@ -670,7 +670,7 @@
   if ((cpi->svc.number_temporal_layers > 1 &&
       cpi->oxcf.end_usage == USAGE_STREAM_FROM_SERVER) ||
       (cpi->svc.number_spatial_layers > 1 &&
-      cpi->oxcf.mode == MODE_SECONDPASS_BEST)) {
+      cpi->oxcf.mode == TWO_PASS_SECOND_BEST)) {
     vp9_init_layer_context(cpi);
   }
 
@@ -710,29 +710,29 @@
 
   switch (cpi->oxcf.mode) {
       // Real time and one pass deprecated in test code base
-    case MODE_GOODQUALITY:
+    case ONE_PASS_GOOD:
       cpi->pass = 0;
       cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
       break;
 
-    case MODE_BESTQUALITY:
+    case ONE_PASS_BEST:
       cpi->pass = 0;
       break;
 
-    case MODE_FIRSTPASS:
+    case TWO_PASS_FIRST:
       cpi->pass = 1;
       break;
 
-    case MODE_SECONDPASS:
+    case TWO_PASS_SECOND_GOOD:
       cpi->pass = 2;
       cpi->oxcf.cpu_used = clamp(cpi->oxcf.cpu_used, -5, 5);
       break;
 
-    case MODE_SECONDPASS_BEST:
+    case TWO_PASS_SECOND_BEST:
       cpi->pass = 2;
       break;
 
-    case MODE_REALTIME:
+    case REALTIME:
       cpi->pass = 0;
       break;
   }
--- a/vp9/encoder/vp9_onyx_int.h
+++ b/vp9/encoder/vp9_onyx_int.h
@@ -142,33 +142,33 @@
   // Good Quality Fast Encoding. The encoder balances quality with the
   // amount of time it takes to encode the output. (speed setting
   // controls how fast)
-  MODE_GOODQUALITY = 1,
+  ONE_PASS_GOOD = 1,
 
   // One Pass - Best Quality. The encoder places priority on the
   // quality of the output over encoding speed. The output is compressed
   // at the highest possible quality. This option takes the longest
   // amount of time to encode. (speed setting ignored)
-  MODE_BESTQUALITY = 2,
+  ONE_PASS_BEST = 2,
 
   // Two Pass - First Pass. The encoder generates a file of statistics
   // for use in the second encoding pass. (speed setting controls how fast)
-  MODE_FIRSTPASS = 3,
+  TWO_PASS_FIRST = 3,
 
   // Two Pass - Second Pass. The encoder uses the statistics that were
   // generated in the first encoding pass to create the compressed
   // output. (speed setting controls how fast)
-  MODE_SECONDPASS = 4,
+  TWO_PASS_SECOND_GOOD = 4,
 
   // Two Pass - Second Pass Best.  The encoder uses the statistics that
   // were generated in the first encoding pass to create the compressed
   // output using the highest possible quality, and taking a
   // longer amount of time to encode. (speed setting ignored)
-  MODE_SECONDPASS_BEST = 5,
+  TWO_PASS_SECOND_BEST = 5,
 
   // Realtime/Live Encoding. This mode is optimized for realtime
   // encoding (for example, capturing a television signal or feed from
   // a live camera). (speed setting controls how fast)
-  MODE_REALTIME = 6,
+  REALTIME = 6,
 } MODE;
 
 typedef enum {
--- a/vp9/encoder/vp9_rdopt.c
+++ b/vp9/encoder/vp9_rdopt.c
@@ -1806,8 +1806,8 @@
           if (best_rd < label_mv_thresh)
             break;
 
-          if (cpi->oxcf.mode != MODE_SECONDPASS_BEST &&
-              cpi->oxcf.mode != MODE_BESTQUALITY) {
+          if (cpi->oxcf.mode != TWO_PASS_SECOND_BEST &&
+              cpi->oxcf.mode != ONE_PASS_BEST) {
             // 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;
@@ -1883,8 +1883,8 @@
           }
 
           // Should we do a full search (best quality only)
-          if (cpi->oxcf.mode == MODE_BESTQUALITY ||
-              cpi->oxcf.mode == MODE_SECONDPASS_BEST) {
+          if (cpi->oxcf.mode == ONE_PASS_BEST ||
+              cpi->oxcf.mode == TWO_PASS_SECOND_BEST) {
             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,
--- a/vp9/encoder/vp9_speed_features.c
+++ b/vp9/encoder/vp9_speed_features.c
@@ -353,16 +353,16 @@
   sf->recode_tolerance = 25;
 
   switch (oxcf->mode) {
-    case MODE_BESTQUALITY:
-    case MODE_SECONDPASS_BEST:  // This is the best quality 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 MODE_FIRSTPASS:
-    case MODE_GOODQUALITY:
-    case MODE_SECONDPASS:
+    case TWO_PASS_FIRST:
+    case ONE_PASS_GOOD:
+    case TWO_PASS_SECOND_GOOD:
       set_good_speed_feature(cpi, cm, sf, speed);
       break;
-    case MODE_REALTIME:
+    case REALTIME:
       set_rt_speed_feature(cm, sf, speed);
       break;
   }
@@ -385,7 +385,7 @@
 
   cpi->mb.optimize = sf->optimize_coefficients == 1 && cpi->pass != 1;
 
-  if (cpi->encode_breakout && oxcf->mode == MODE_REALTIME &&
+  if (cpi->encode_breakout && oxcf->mode == REALTIME &&
       sf->encode_breakout_thresh > cpi->encode_breakout)
     cpi->encode_breakout = sf->encode_breakout_thresh;
 
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -305,13 +305,13 @@
 
   switch (cfg->g_pass) {
     case VPX_RC_ONE_PASS:
-      oxcf->mode = MODE_GOODQUALITY;
+      oxcf->mode = ONE_PASS_GOOD;
       break;
     case VPX_RC_FIRST_PASS:
-      oxcf->mode = MODE_FIRSTPASS;
+      oxcf->mode = TWO_PASS_FIRST;
       break;
     case VPX_RC_LAST_PASS:
-      oxcf->mode = MODE_SECONDPASS_BEST;
+      oxcf->mode = TWO_PASS_SECOND_BEST;
       break;
   }
 
@@ -603,7 +603,7 @@
                                     unsigned long duration,
                                     unsigned long deadline) {
   // Use best quality mode if no deadline is given.
-  MODE new_qc = MODE_BESTQUALITY;
+  MODE new_qc = ONE_PASS_BEST;
 
   if (deadline) {
     // Convert duration parameter from stream timebase to microseconds
@@ -613,14 +613,14 @@
 
     // If the deadline is more that the duration this frame is to be shown,
     // use good quality mode. Otherwise use realtime mode.
-    new_qc = (deadline > duration_us) ? MODE_GOODQUALITY : MODE_REALTIME;
+    new_qc = (deadline > duration_us) ? ONE_PASS_GOOD : REALTIME;
   }
 
   if (ctx->cfg.g_pass == VPX_RC_FIRST_PASS)
-    new_qc = MODE_FIRSTPASS;
+    new_qc = TWO_PASS_FIRST;
   else if (ctx->cfg.g_pass == VPX_RC_LAST_PASS)
-    new_qc = (new_qc == MODE_BESTQUALITY) ? MODE_SECONDPASS_BEST
-                                          : MODE_SECONDPASS;
+    new_qc = (new_qc == ONE_PASS_BEST) ? TWO_PASS_SECOND_BEST
+                                          : TWO_PASS_SECOND_GOOD;
 
   if (ctx->oxcf.mode != new_qc) {
     ctx->oxcf.mode = new_qc;