Further normalization of Vizier parameters.
authorPaul Wilkins <paulwilkins@google.com>
Tue, 20 Apr 2021 16:26:22 +0000 (17:26 +0100)
committerPaul Wilkins <paulwilkins@google.com>
Tue, 20 Apr 2021 16:51:05 +0000 (17:51 +0100)
Further changes to normalize the Vizier command line parameters.
The intent is that the default behavior for any given parameter
is signaled by the value 1.0 (expressed on the command line as a
rational).

The final values used in the two pass code are obtained by multiplying
the passed in factors by a default values if use_vizier_rc_params is 1.
Where  use_vizier_rc_params is 0 the values are explicitly set to
the defaults.

This patch also changes the default value of each parameter to 1.0
even if not set explicitly. This should ensure safe /default behavior
if the user sets use_vizier_rc_params to 1 but does not set all the
the individual parameters.

Change-Id: Ied08b3c22df18f42f446a4cc9363473cad097f69

vp8/vp8_cx_iface.c
vp9/encoder/vp9_firstpass.c
vp9/encoder/vp9_firstpass.h
vp9/vp9_cx_iface.c
vpx/vpx_encoder.h
vpxenc.c

index 872710f..6e12e38 100644 (file)
@@ -260,15 +260,15 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
   // The range below shall be further tuned.
   RANGE_CHECK(cfg, use_vizier_rc_params, 0, 1);
   RANGE_CHECK(cfg, active_wq_factor.den, 1, 1000);
-  RANGE_CHECK(cfg, base_err_per_mb.den, 1, 1000);
+  RANGE_CHECK(cfg, err_per_mb_factor.den, 1, 1000);
   RANGE_CHECK(cfg, sr_default_decay_limit.den, 1, 1000);
   RANGE_CHECK(cfg, sr_diff_factor.den, 1, 1000);
-  RANGE_CHECK(cfg, kf_err_per_mb.den, 1, 1000);
-  RANGE_CHECK(cfg, kf_frame_min_boost.den, 1, 1000);
-  RANGE_CHECK(cfg, kf_frame_max_boost_subs.den, 1, 1000);
-  RANGE_CHECK(cfg, kf_max_total_boost.den, 1, 1000);
-  RANGE_CHECK(cfg, gf_max_total_boost.den, 1, 1000);
-  RANGE_CHECK(cfg, gf_frame_max_boost.den, 1, 1000);
+  RANGE_CHECK(cfg, kf_err_per_mb_factor.den, 1, 1000);
+  RANGE_CHECK(cfg, kf_frame_min_boost_factor.den, 1, 1000);
+  RANGE_CHECK(cfg, kf_frame_max_boost_subs_factor.den, 1, 1000);
+  RANGE_CHECK(cfg, kf_max_total_boost_factor.den, 1, 1000);
+  RANGE_CHECK(cfg, gf_max_total_boost_factor.den, 1, 1000);
+  RANGE_CHECK(cfg, gf_frame_max_boost_factor.den, 1, 1000);
   RANGE_CHECK(cfg, zm_factor.den, 1, 1000);
   RANGE_CHECK(cfg, rd_mult_inter_qp_fac.den, 1, 1000);
   RANGE_CHECK(cfg, rd_mult_arf_qp_fac.den, 1, 1000);
@@ -1307,18 +1307,18 @@ static vpx_codec_enc_cfg_map_t vp8e_usage_cfg_map[] = {
         { 0 },    /* layer_target_bitrate */
         0,        /* temporal_layering_mode */
         0,        /* use_vizier_rc_params */
-        { 0, 1 }, /* active_wq_factor */
-        { 0, 1 }, /* base_err_per_mb */
-        { 0, 1 }, /* sr_default_decay_limit */
-        { 0, 1 }, /* sr_diff_factor */
-        { 0, 1 }, /* kf_err_per_mb */
-        { 0, 1 }, /* kf_frame_min_boost */
-        { 0, 1 }, /* kf_frame_max_boost_first */
-        { 0, 1 }, /* kf_frame_max_boost_subs */
-        { 0, 1 }, /* kf_max_total_boost */
-        { 0, 1 }, /* gf_max_total_boost */
-        { 0, 1 }, /* gf_frame_max_boost */
-        { 0, 1 }, /* zm_factor */
+        { 1, 1 }, /* active_wq_factor */
+        { 1, 1 }, /* err_per_mb_factor */
+        { 1, 1 }, /* sr_default_decay_limit */
+        { 1, 1 }, /* sr_diff_factor */
+        { 1, 1 }, /* kf_err_per_mb_factor */
+        { 1, 1 }, /* kf_frame_min_boost_factor */
+        { 1, 1 }, /* kf_frame_max_boost_first_factor */
+        { 1, 1 }, /* kf_frame_max_boost_subs_factor */
+        { 1, 1 }, /* kf_max_total_boost_factor */
+        { 1, 1 }, /* gf_max_total_boost_factor */
+        { 1, 1 }, /* gf_frame_max_boost_factor */
+        { 1, 1 }, /* zm_factor */
         { 1, 1 }, /* rd_mult_inter_qp_fac */
         { 1, 1 }, /* rd_mult_arf_qp_fac */
         { 1, 1 }, /* rd_mult_key_qp_fac */
index 76ef119..a4717ad 100644 (file)
@@ -1878,8 +1878,7 @@ static double get_prediction_decay_rate(const TWO_PASS *const twopass,
                                         const FIRSTPASS_STATS *frame_stats) {
   const double sr_decay_rate = get_sr_decay_rate(twopass, frame_stats);
   double zero_motion_factor =
-      twopass->zm_factor * DEFAULT_ZM_FACTOR *
-      (frame_stats->pcnt_inter - frame_stats->pcnt_motion);
+      twopass->zm_factor * (frame_stats->pcnt_inter - frame_stats->pcnt_motion);
 
   // Clamp value to range 0.0 to 1.0
   // This should happen anyway if input values are sensibly clamped but checked
@@ -1981,7 +1980,7 @@ static double calc_frame_boost(const FRAME_INFO *frame_info,
   const double active_area = calculate_active_area(frame_info, this_frame);
 
   // Underlying boost factor is based on inter error ratio.
-  frame_boost = (twopass->base_err_per_mb * active_area) /
+  frame_boost = (twopass->err_per_mb * active_area) /
                 DOUBLE_DIVIDE_CHECK(this_frame->coded_error);
 
   // Small adjustment for cases where there is a zoom out
@@ -2027,7 +2026,7 @@ static double calc_kf_frame_boost(VP9_COMP *cpi,
   // This value is in line with the minimum per frame boost in the alt_ref
   // boost calculation.
   frame_boost =
-      ((frame_boost + twopass->kf_frame_min_boost) * boost_q_correction);
+      (frame_boost + twopass->kf_frame_min_boost) * boost_q_correction;
 
   // Maximum allowed boost this frame. May be different for first vs subsequent
   // key frames.
@@ -2861,7 +2860,7 @@ static void define_gf_group(VP9_COMP *cpi, int gf_start_show_idx) {
     const int arf_boost =
         compute_arf_boost(frame_info, twopass, gld_show_idx, f_frames, b_frames,
                           avg_inter_frame_qindex);
-    rc->gfu_boost = VPXMIN(twopass->gf_max_total_boost, arf_boost);
+    rc->gfu_boost = VPXMIN((int)twopass->gf_max_total_boost, arf_boost);
     rc->source_alt_ref_pending = 0;
   }
 
@@ -3429,12 +3428,12 @@ static void find_next_key_frame(VP9_COMP *cpi, int kf_show_idx) {
   // Special case for static / slide show content but dont apply
   // if the kf group is very short.
   if ((zero_motion_accumulator > 0.99) && (rc->frames_to_key > 8)) {
-    rc->kf_boost = twopass->kf_max_total_boost;
+    rc->kf_boost = (int)(twopass->kf_max_total_boost);
   } else {
     // Apply various clamps for min and max oost
     rc->kf_boost = VPXMAX((int)boost_score, (rc->frames_to_key * 3));
     rc->kf_boost = VPXMAX(rc->kf_boost, MIN_KF_TOT_BOOST);
-    rc->kf_boost = VPXMIN(rc->kf_boost, twopass->kf_max_total_boost);
+    rc->kf_boost = VPXMIN(rc->kf_boost, (int)(twopass->kf_max_total_boost));
   }
 
   // Work out how many bits to allocate for the key frame itself.
@@ -3492,32 +3491,56 @@ static int is_skippable_frame(const VP9_COMP *cpi) {
 // Configure image size specific vizier parameters.
 // Later these will be set via additional command line options
 static void init_vizier_params(TWO_PASS *const twopass, int screen_area) {
-  // When |use_vizier_rc_params| is 1, we expect the rc parameters have been
-  // initialized by the pass in values.
-  // Be careful that parameters below are only initialized to 0, if we do not
-  // pass values to them. It is desired to take care of each parameter when
-  // using |use_vizier_rc_params|.
-  if (twopass->use_vizier_rc_params) return;
-
-  // When |use_vizier_rc_params| is 0, use defaults for now.
-  twopass->active_wq_factor = AV_WQ_FACTOR;
-  twopass->base_err_per_mb = BASELINE_ERR_PER_MB;
-  twopass->sr_default_decay_limit = DEFAULT_DECAY_LIMIT;
-  twopass->sr_diff_factor = 1.0;
-  twopass->gf_frame_max_boost = GF_MAX_FRAME_BOOST;
-  twopass->gf_max_total_boost = MAX_GF_BOOST;
-  if (screen_area < 1280 * 720) {
-    twopass->kf_err_per_mb = 2000.0;
-  } else if (screen_area < 1920 * 1080) {
-    twopass->kf_err_per_mb = 500.0;
+  // When |use_vizier_rc_params| is 1, we expect the rc parameters below to
+  // have been initialised on the command line as adjustment factors such
+  // that a factor of 1.0 will match the default behavior when
+  // |use_vizier_rc_params| is 0
+  if (twopass->use_vizier_rc_params) {
+    twopass->active_wq_factor *= AV_WQ_FACTOR;
+    twopass->err_per_mb *= BASELINE_ERR_PER_MB;
+    twopass->sr_default_decay_limit *= DEFAULT_DECAY_LIMIT;
+    twopass->sr_diff_factor *= 1.0;
+    twopass->gf_frame_max_boost *= GF_MAX_FRAME_BOOST;
+    twopass->gf_max_total_boost *= MAX_GF_BOOST;
+    twopass->kf_frame_min_boost *= KF_MIN_FRAME_BOOST;
+    twopass->kf_frame_max_boost_first *= KF_MAX_FRAME_BOOST;
+    twopass->kf_frame_max_boost_subs *= KF_MAX_FRAME_BOOST;
+    twopass->kf_max_total_boost *= MAX_KF_TOT_BOOST;
+    twopass->zm_factor *= DEFAULT_ZM_FACTOR;
+
+    // Correction for the fact that the kf_err_per_mb_factor default is
+    // already different for different video formats and ensures that a passed
+    // in value of 1.0 on the vizier command line will still match the current
+    // default.
+    if (screen_area < 1280 * 720) {
+      twopass->kf_err_per_mb *= 2000.0;
+    } else if (screen_area < 1920 * 1080) {
+      twopass->kf_err_per_mb *= 500.0;
+    } else {
+      twopass->kf_err_per_mb *= 250.0;
+    }
   } else {
-    twopass->kf_err_per_mb = 250.0;
+    // When |use_vizier_rc_params| is 0, use defaults.
+    twopass->active_wq_factor = AV_WQ_FACTOR;
+    twopass->err_per_mb = BASELINE_ERR_PER_MB;
+    twopass->sr_default_decay_limit = DEFAULT_DECAY_LIMIT;
+    twopass->sr_diff_factor = 1.0;
+    twopass->gf_frame_max_boost = GF_MAX_FRAME_BOOST;
+    twopass->gf_max_total_boost = MAX_GF_BOOST;
+    twopass->kf_frame_min_boost = KF_MIN_FRAME_BOOST;
+    twopass->kf_frame_max_boost_first = KF_MAX_FRAME_BOOST;
+    twopass->kf_frame_max_boost_subs = KF_MAX_FRAME_BOOST;
+    twopass->kf_max_total_boost = MAX_KF_TOT_BOOST;
+    twopass->zm_factor = DEFAULT_ZM_FACTOR;
+
+    if (screen_area < 1280 * 720) {
+      twopass->kf_err_per_mb = 2000.0;
+    } else if (screen_area < 1920 * 1080) {
+      twopass->kf_err_per_mb = 500.0;
+    } else {
+      twopass->kf_err_per_mb = 250.0;
+    }
   }
-  twopass->kf_frame_min_boost = KF_MIN_FRAME_BOOST;
-  twopass->kf_frame_max_boost_first = KF_MAX_FRAME_BOOST;
-  twopass->kf_frame_max_boost_subs = twopass->kf_frame_max_boost_first;
-  twopass->kf_max_total_boost = MAX_KF_TOT_BOOST;
-  twopass->zm_factor = 1.0;
 }
 
 void vp9_rc_get_second_pass_params(VP9_COMP *cpi) {
index 1418b67..cdbcb52 100644 (file)
@@ -228,15 +228,15 @@ typedef struct {
   // by default values.
   int use_vizier_rc_params;
   double active_wq_factor;
-  double base_err_per_mb;
+  double err_per_mb;
   double sr_default_decay_limit;
   double sr_diff_factor;
   double kf_err_per_mb;
   double kf_frame_min_boost;
   double kf_frame_max_boost_first;  // Max for first kf in a chunk.
   double kf_frame_max_boost_subs;   // Max for subsequent mid chunk kfs.
-  int kf_max_total_boost;
-  int gf_max_total_boost;
+  double kf_max_total_boost;
+  double gf_max_total_boost;
   double gf_frame_max_boost;
   double zm_factor;
 } TWO_PASS;
index c2ca215..c700620 100644 (file)
@@ -352,15 +352,15 @@ static vpx_codec_err_t validate_config(vpx_codec_alg_priv_t *ctx,
   // The range below shall be further tuned.
   RANGE_CHECK(cfg, use_vizier_rc_params, 0, 1);
   RANGE_CHECK(cfg, active_wq_factor.den, 1, 1000);
-  RANGE_CHECK(cfg, base_err_per_mb.den, 1, 1000);
+  RANGE_CHECK(cfg, err_per_mb_factor.den, 1, 1000);
   RANGE_CHECK(cfg, sr_default_decay_limit.den, 1, 1000);
   RANGE_CHECK(cfg, sr_diff_factor.den, 1, 1000);
-  RANGE_CHECK(cfg, kf_err_per_mb.den, 1, 1000);
-  RANGE_CHECK(cfg, kf_frame_min_boost.den, 1, 1000);
-  RANGE_CHECK(cfg, kf_frame_max_boost_subs.den, 1, 1000);
-  RANGE_CHECK(cfg, kf_max_total_boost.den, 1, 1000);
-  RANGE_CHECK(cfg, gf_max_total_boost.den, 1, 1000);
-  RANGE_CHECK(cfg, gf_frame_max_boost.den, 1, 1000);
+  RANGE_CHECK(cfg, kf_err_per_mb_factor.den, 1, 1000);
+  RANGE_CHECK(cfg, kf_frame_min_boost_factor.den, 1, 1000);
+  RANGE_CHECK(cfg, kf_frame_max_boost_subs_factor.den, 1, 1000);
+  RANGE_CHECK(cfg, kf_max_total_boost_factor.den, 1, 1000);
+  RANGE_CHECK(cfg, gf_max_total_boost_factor.den, 1, 1000);
+  RANGE_CHECK(cfg, gf_frame_max_boost_factor.den, 1, 1000);
   RANGE_CHECK(cfg, zm_factor.den, 1, 1000);
   RANGE_CHECK(cfg, rd_mult_inter_qp_fac.den, 1, 1000);
   RANGE_CHECK(cfg, rd_mult_arf_qp_fac.den, 1, 1000);
@@ -662,31 +662,35 @@ static vpx_codec_err_t set_twopass_params_from_config(
   if (cpi == NULL) return VPX_CODEC_ERROR;
 
   cpi->twopass.use_vizier_rc_params = cfg->use_vizier_rc_params;
+
+  // The values set here are factors that will be applied to default values
+  // to get the final value used in the two pass code. 1.0 will hence
+  // match the default behaviour when not using passed in values.
   cpi->twopass.active_wq_factor =
       (double)cfg->active_wq_factor.num / (double)cfg->active_wq_factor.den;
-  cpi->twopass.base_err_per_mb =
-      (double)cfg->base_err_per_mb.num / (double)cfg->base_err_per_mb.den;
+  cpi->twopass.err_per_mb =
+      (double)cfg->err_per_mb_factor.num / (double)cfg->err_per_mb_factor.den;
   cpi->twopass.sr_default_decay_limit =
       (double)cfg->sr_default_decay_limit.num /
       (double)cfg->sr_default_decay_limit.den;
   cpi->twopass.sr_diff_factor =
       (double)cfg->sr_diff_factor.num / (double)cfg->sr_diff_factor.den;
-  cpi->twopass.kf_err_per_mb =
-      (double)cfg->kf_err_per_mb.num / (double)cfg->kf_err_per_mb.den;
-  cpi->twopass.kf_frame_min_boost =
-      (double)cfg->kf_frame_min_boost.num / (double)cfg->kf_frame_min_boost.den;
+  cpi->twopass.kf_err_per_mb = (double)cfg->kf_err_per_mb_factor.num /
+                               (double)cfg->kf_err_per_mb_factor.den;
+  cpi->twopass.kf_frame_min_boost = (double)cfg->kf_frame_min_boost_factor.num /
+                                    (double)cfg->kf_frame_min_boost_factor.den;
   cpi->twopass.kf_frame_max_boost_first =
-      (double)cfg->kf_frame_max_boost_first.num /
-      (double)cfg->kf_frame_max_boost_first.den;
+      (double)cfg->kf_frame_max_boost_first_factor.num /
+      (double)cfg->kf_frame_max_boost_first_factor.den;
   cpi->twopass.kf_frame_max_boost_subs =
-      (double)cfg->kf_frame_max_boost_subs.num /
-      (double)cfg->kf_frame_max_boost_subs.den;
-  cpi->twopass.kf_max_total_boost = (int)((double)cfg->kf_max_total_boost.num /
-                                          (double)cfg->kf_max_total_boost.den);
-  cpi->twopass.gf_max_total_boost = (int)((double)cfg->gf_max_total_boost.num /
-                                          (double)cfg->gf_max_total_boost.den);
-  cpi->twopass.gf_frame_max_boost =
-      (double)cfg->gf_frame_max_boost.num / (double)cfg->gf_frame_max_boost.den;
+      (double)cfg->kf_frame_max_boost_subs_factor.num /
+      (double)cfg->kf_frame_max_boost_subs_factor.den;
+  cpi->twopass.kf_max_total_boost = (double)cfg->kf_max_total_boost_factor.num /
+                                    (double)cfg->kf_max_total_boost_factor.den;
+  cpi->twopass.gf_max_total_boost = (double)cfg->gf_max_total_boost_factor.num /
+                                    (double)cfg->gf_max_total_boost_factor.den;
+  cpi->twopass.gf_frame_max_boost = (double)cfg->gf_frame_max_boost_factor.num /
+                                    (double)cfg->gf_frame_max_boost_factor.den;
   cpi->twopass.zm_factor =
       (double)cfg->zm_factor.num / (double)cfg->zm_factor.den;
   cpi->rd_ctrl.rd_mult_inter_qp_fac = (double)cfg->rd_mult_inter_qp_fac.num /
@@ -1956,18 +1960,18 @@ static vpx_codec_enc_cfg_map_t encoder_usage_cfg_map[] = {
         { 0 },     // layer_taget_bitrate
         0,         // temporal_layering_mode
         0,         // use_vizier_rc_params
-        { 0, 1 },  // active_wq_factor
-        { 0, 1 },  // base_err_per_mb
-        { 0, 1 },  // sr_default_decay_limit
-        { 0, 1 },  // sr_diff_factor
-        { 0, 1 },  // kf_err_per_mb
-        { 0, 1 },  // kf_frame_min_boost
-        { 0, 1 },  // kf_frame_max_boost_first
-        { 0, 1 },  // kf_frame_max_boost_subs
-        { 0, 1 },  // kf_max_total_boost
-        { 0, 1 },  // gf_max_total_boost
-        { 0, 1 },  // gf_frame_max_boost
-        { 0, 1 },  // zm_factor
+        { 1, 1 },  // active_wq_factor
+        { 1, 1 },  // err_per_mb_factor
+        { 1, 1 },  // sr_default_decay_limit
+        { 1, 1 },  // sr_diff_factor
+        { 1, 1 },  // kf_err_per_mb_factor
+        { 1, 1 },  // kf_frame_min_boost_factor
+        { 1, 1 },  // kf_frame_max_boost_first_factor
+        { 1, 1 },  // kf_frame_max_boost_subs_factor
+        { 1, 1 },  // kf_max_total_boost_factor
+        { 1, 1 },  // gf_max_total_boost_factor
+        { 1, 1 },  // gf_frame_max_boost_factor
+        { 1, 1 },  // zm_factor
         { 1, 1 },  // rd_mult_inter_qp_fac
         { 1, 1 },  // rd_mult_arf_qp_fac
         { 1, 1 },  // rd_mult_key_qp_fac
index 255cb69..d62d9ee 100644 (file)
@@ -709,14 +709,14 @@ typedef struct vpx_codec_enc_cfg {
    */
   vpx_rational_t active_wq_factor;
 
-  /*!\brief Base error per macroblock.
+  /*!\brief Error per macroblock adjustment factor.
    *
    * Rate control parameters, set from external experiment results.
    * Only when |use_vizier_rc_params| is set to 1, the pass in value will be
    * used. Otherwise, the default value is used.
    *
    */
-  vpx_rational_t base_err_per_mb;
+  vpx_rational_t err_per_mb_factor;
 
   /*!\brief Second reference default decay limit.
    *
@@ -736,68 +736,69 @@ typedef struct vpx_codec_enc_cfg {
    */
   vpx_rational_t sr_diff_factor;
 
-  /*!\brief Keyframe error per macroblock.
+  /*!\brief Keyframe error per macroblock adjustment factor.
    *
    * Rate control parameters, set from external experiment results.
    * Only when |use_vizier_rc_params| is set to 1, the pass in value will be
    * used. Otherwise, the default value is used.
    *
    */
-  vpx_rational_t kf_err_per_mb;
+  vpx_rational_t kf_err_per_mb_factor;
 
-  /*!\brief Keyframe minimum boost.
+  /*!\brief Keyframe minimum boost adjustment factor.
    *
    * Rate control parameters, set from external experiment results.
    * Only when |use_vizier_rc_params| is set to 1, the pass in value will be
    * used. Otherwise, the default value is used.
    *
    */
-  vpx_rational_t kf_frame_min_boost;
+  vpx_rational_t kf_frame_min_boost_factor;
 
-  /*!\brief Keyframe maximum boost, for the first keyframe in a chunk.
+  /*!\brief Keyframe maximum boost adjustment factor, for the first keyframe
+   * in a chunk.
    *
    * Rate control parameters, set from external experiment results.
    * Only when |use_vizier_rc_params| is set to 1, the pass in value will be
    * used. Otherwise, the default value is used.
    *
    */
-  vpx_rational_t kf_frame_max_boost_first;
+  vpx_rational_t kf_frame_max_boost_first_factor;
 
-  /*!\brief Keyframe maximum boost, for subsequent keyframes.
+  /*!\brief Keyframe maximum boost adjustment factor, for subsequent keyframes.
    *
    * Rate control parameters, set from external experiment results.
    * Only when |use_vizier_rc_params| is set to 1, the pass in value will be
    * used. Otherwise, the default value is used.
    *
    */
-  vpx_rational_t kf_frame_max_boost_subs;
+  vpx_rational_t kf_frame_max_boost_subs_factor;
 
-  /*!\brief Keyframe maximum total boost.
+  /*!\brief Keyframe maximum total boost adjustment factor.
    *
    * Rate control parameters, set from external experiment results.
    * Only when |use_vizier_rc_params| is set to 1, the pass in value will be
    * used. Otherwise, the default value is used.
    *
    */
-  vpx_rational_t kf_max_total_boost;
+  vpx_rational_t kf_max_total_boost_factor;
 
-  /*!\brief Golden frame maximum total boost.
+  /*!\brief Golden frame maximum total boost adjustment factor.
    *
    * Rate control parameters, set from external experiment results.
    * Only when |use_vizier_rc_params| is set to 1, the pass in value will be
    * used. Otherwise, the default value is used.
    *
    */
-  vpx_rational_t gf_max_total_boost;
+  vpx_rational_t gf_max_total_boost_factor;
 
-  /*!\brief Golden frame maximum boost.
+  /*!\brief Golden frame maximum boost adjustment factor.
    *
    * Rate control parameters, set from external experiment results.
    * Only when |use_vizier_rc_params| is set to 1, the pass in value will be
    * used. Otherwise, the default value is used.
    *
    */
-  vpx_rational_t gf_frame_max_boost;
+  vpx_rational_t gf_frame_max_boost_factor;
 
   /*!\brief Zero motion power factor.
    *
index 1a2b4a9..276ee9b 100644 (file)
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -292,46 +292,52 @@ static const arg_def_t use_vizier_rc_params =
     ARG_DEF(NULL, "use-vizier-rc-params", 1, "Use vizier rc params");
 static const arg_def_t active_wq_factor =
     ARG_DEF(NULL, "active-wq-factor", 1, "Active worst quality factor");
-static const arg_def_t base_err_per_mb =
-    ARG_DEF(NULL, "base-err-per-mb", 1, "Base error per macroblock");
+static const arg_def_t err_per_mb_factor =
+    ARG_DEF(NULL, "err-per-mb-factor", 1, "Error per macroblock factor");
 static const arg_def_t sr_default_decay_limit = ARG_DEF(
     NULL, "sr-default-decay-limit", 1, "Second reference default decay limit");
 static const arg_def_t sr_diff_factor =
     ARG_DEF(NULL, "sr-diff-factor", 1, "Second reference diff factor");
-static const arg_def_t kf_err_per_mb =
-    ARG_DEF(NULL, "kf-err-per-mb", 1, "Keyframe error per macroblock");
-static const arg_def_t kf_frame_min_boost =
-    ARG_DEF(NULL, "kf-frame-min-boost", 1, "Keyframe min boost");
-static const arg_def_t kf_frame_max_boost_first = ARG_DEF(
-    NULL, "kf-frame-max-boost-first", 1, "Max for the first keyframe boost");
-static const arg_def_t kf_frame_max_boost_subs = ARG_DEF(
-    NULL, "kf-frame-max-boost-subs", 1, "Max for subsequent keyframe boost");
-static const arg_def_t kf_max_total_boost =
-    ARG_DEF(NULL, "kf-max-total-boost", 1, "Keyframe max total boost");
-static const arg_def_t gf_max_total_boost =
-    ARG_DEF(NULL, "gf-max-total-boost", 1, "Golden frame max total boost");
-static const arg_def_t gf_frame_max_boost =
-    ARG_DEF(NULL, "gf-frame-max-boost", 1, "Golden frame max boost");
+static const arg_def_t kf_err_per_mb_factor = ARG_DEF(
+    NULL, "kf-err-per-mb-factor", 1, "Keyframe error per macroblock factor");
+static const arg_def_t kf_frame_min_boost_factor =
+    ARG_DEF(NULL, "kf-frame-min-boost-factor", 1, "Keyframe min boost");
+static const arg_def_t kf_frame_max_boost_first_factor =
+    ARG_DEF(NULL, "kf-frame-max-boost-first-factor", 1,
+            "Max keyframe boost adjustment factor for first frame");
+static const arg_def_t kf_frame_max_boost_subs_factor =
+    ARG_DEF(NULL, "kf-frame-max-boost-subs-factor", 1,
+            "Max boost adjustment factor for subsequent KFs");
+static const arg_def_t kf_max_total_boost_factor = ARG_DEF(
+    NULL, "kf-max-total-boost-factor", 1, "Keyframe max total boost factor");
+static const arg_def_t gf_max_total_boost_factor =
+    ARG_DEF(NULL, "gf-max-total-boost-factor", 1,
+            "Golden frame max total boost factor");
+static const arg_def_t gf_frame_max_boost_factor =
+    ARG_DEF(NULL, "gf-frame-max-boost-factor", 1,
+            "Golden frame max per frame boost factor");
 static const arg_def_t zm_factor =
     ARG_DEF(NULL, "zm-factor", 1, "Zero motion power factor");
 static const arg_def_t rd_mult_inter_qp_fac =
-    ARG_DEF(NULL, "rd-mult-inter-qp-fac", 1, "RD multiplier for inter frames");
+    ARG_DEF(NULL, "rd-mult-inter-qp-fac", 1,
+            "RD multiplier adjustment for inter frames");
 static const arg_def_t rd_mult_arf_qp_fac =
-    ARG_DEF(NULL, "rd-mult-arf-qp-fac", 1, "RD multiplier for alt-ref frames");
-static const arg_def_t rd_mult_key_qp_fac =
-    ARG_DEF(NULL, "rd-mult-key-qp-fac", 1, "RD multiplier for key frames");
+    ARG_DEF(NULL, "rd-mult-arf-qp-fac", 1,
+            "RD multiplier adjustment for alt-ref frames");
+static const arg_def_t rd_mult_key_qp_fac = ARG_DEF(
+    NULL, "rd-mult-key-qp-fac", 1, "RD multiplier adjustment for key frames");
 static const arg_def_t *vizier_rc_args[] = { &use_vizier_rc_params,
                                              &active_wq_factor,
-                                             &base_err_per_mb,
+                                             &err_per_mb_factor,
                                              &sr_default_decay_limit,
                                              &sr_diff_factor,
-                                             &kf_err_per_mb,
-                                             &kf_frame_min_boost,
-                                             &kf_frame_max_boost_first,
-                                             &kf_frame_max_boost_subs,
-                                             &kf_max_total_boost,
-                                             &gf_max_total_boost,
-                                             &gf_frame_max_boost,
+                                             &kf_err_per_mb_factor,
+                                             &kf_frame_min_boost_factor,
+                                             &kf_frame_max_boost_first_factor,
+                                             &kf_frame_max_boost_subs_factor,
+                                             &kf_max_total_boost_factor,
+                                             &gf_max_total_boost_factor,
+                                             &gf_frame_max_boost_factor,
                                              &zm_factor,
                                              &rd_mult_inter_qp_fac,
                                              &rd_mult_arf_qp_fac,
@@ -1042,26 +1048,26 @@ static int parse_stream_params(struct VpxEncoderConfig *global,
       config->cfg.use_vizier_rc_params = arg_parse_int(&arg);
     } else if (arg_match(&arg, &active_wq_factor, argi)) {
       config->cfg.active_wq_factor = arg_parse_rational(&arg);
-    } else if (arg_match(&arg, &base_err_per_mb, argi)) {
-      config->cfg.base_err_per_mb = arg_parse_rational(&arg);
+    } else if (arg_match(&arg, &err_per_mb_factor, argi)) {
+      config->cfg.err_per_mb_factor = arg_parse_rational(&arg);
     } else if (arg_match(&arg, &sr_default_decay_limit, argi)) {
       config->cfg.sr_default_decay_limit = arg_parse_rational(&arg);
     } else if (arg_match(&arg, &sr_diff_factor, argi)) {
       config->cfg.sr_diff_factor = arg_parse_rational(&arg);
-    } else if (arg_match(&arg, &kf_err_per_mb, argi)) {
-      config->cfg.kf_err_per_mb = arg_parse_rational(&arg);
-    } else if (arg_match(&arg, &kf_frame_min_boost, argi)) {
-      config->cfg.kf_frame_min_boost = arg_parse_rational(&arg);
-    } else if (arg_match(&arg, &kf_frame_max_boost_first, argi)) {
-      config->cfg.kf_frame_max_boost_first = arg_parse_rational(&arg);
-    } else if (arg_match(&arg, &kf_frame_max_boost_subs, argi)) {
-      config->cfg.kf_frame_max_boost_subs = arg_parse_rational(&arg);
-    } else if (arg_match(&arg, &kf_max_total_boost, argi)) {
-      config->cfg.kf_max_total_boost = arg_parse_rational(&arg);
-    } else if (arg_match(&arg, &gf_max_total_boost, argi)) {
-      config->cfg.gf_max_total_boost = arg_parse_rational(&arg);
-    } else if (arg_match(&arg, &gf_frame_max_boost, argi)) {
-      config->cfg.gf_frame_max_boost = arg_parse_rational(&arg);
+    } else if (arg_match(&arg, &kf_err_per_mb_factor, argi)) {
+      config->cfg.kf_err_per_mb_factor = arg_parse_rational(&arg);
+    } else if (arg_match(&arg, &kf_frame_min_boost_factor, argi)) {
+      config->cfg.kf_frame_min_boost_factor = arg_parse_rational(&arg);
+    } else if (arg_match(&arg, &kf_frame_max_boost_first_factor, argi)) {
+      config->cfg.kf_frame_max_boost_first_factor = arg_parse_rational(&arg);
+    } else if (arg_match(&arg, &kf_frame_max_boost_subs_factor, argi)) {
+      config->cfg.kf_frame_max_boost_subs_factor = arg_parse_rational(&arg);
+    } else if (arg_match(&arg, &kf_max_total_boost_factor, argi)) {
+      config->cfg.kf_max_total_boost_factor = arg_parse_rational(&arg);
+    } else if (arg_match(&arg, &gf_max_total_boost_factor, argi)) {
+      config->cfg.gf_max_total_boost_factor = arg_parse_rational(&arg);
+    } else if (arg_match(&arg, &gf_frame_max_boost_factor, argi)) {
+      config->cfg.gf_frame_max_boost_factor = arg_parse_rational(&arg);
     } else if (arg_match(&arg, &zm_factor, argi)) {
       config->cfg.zm_factor = arg_parse_rational(&arg);
     } else if (arg_match(&arg, &rd_mult_inter_qp_fac, argi)) {