shithub: libvpx

Download patch

ref: 82331e000a8ce679db6c44e731d3ff5e90506370
parent: db14911ccb7e278357e76bfb3f1e7536b99bc889
author: hui su <[email protected]>
date: Sun Aug 16 14:21:56 EDT 2015

create vp10_arg_ctrl_map

Change-Id: Ibe49acb022f1d557ffccb91e7bd2558870ff1a0b

--- a/vpxenc.c
+++ b/vpxenc.c
@@ -443,7 +443,9 @@
 
 static const arg_def_t tune_content = ARG_DEF_ENUM(
     NULL, "tune-content", 1, "Tune content type", tune_content_enum);
+#endif
 
+#if CONFIG_VP9_ENCODER
 static const arg_def_t *vp9_args[] = {
   &cpu_used_vp9, &auto_altref, &sharpness, &static_thresh,
   &tile_cols, &tile_rows, &arnr_maxframes, &arnr_strength, &arnr_type,
@@ -469,6 +471,32 @@
 };
 #endif
 
+#if CONFIG_VP10_ENCODER
+static const arg_def_t *vp10_args[] = {
+  &cpu_used_vp9, &auto_altref, &sharpness, &static_thresh,
+  &tile_cols, &tile_rows, &arnr_maxframes, &arnr_strength, &arnr_type,
+  &tune_ssim, &cq_level, &max_intra_rate_pct, &max_inter_rate_pct,
+  &gf_cbr_boost_pct, &lossless,
+  &frame_parallel_decoding, &aq_mode, &frame_periodic_boost,
+  &noise_sens, &tune_content, &input_color_space,
+  &min_gf_interval, &max_gf_interval,
+  NULL
+};
+static const int vp10_arg_ctrl_map[] = {
+  VP8E_SET_CPUUSED, VP8E_SET_ENABLEAUTOALTREF,
+  VP8E_SET_SHARPNESS, VP8E_SET_STATIC_THRESHOLD,
+  VP9E_SET_TILE_COLUMNS, VP9E_SET_TILE_ROWS,
+  VP8E_SET_ARNR_MAXFRAMES, VP8E_SET_ARNR_STRENGTH, VP8E_SET_ARNR_TYPE,
+  VP8E_SET_TUNING, VP8E_SET_CQ_LEVEL, VP8E_SET_MAX_INTRA_BITRATE_PCT,
+  VP9E_SET_MAX_INTER_BITRATE_PCT, VP9E_SET_GF_CBR_BOOST_PCT,
+  VP9E_SET_LOSSLESS, VP9E_SET_FRAME_PARALLEL_DECODING, VP9E_SET_AQ_MODE,
+  VP9E_SET_FRAME_PERIODIC_BOOST, VP9E_SET_NOISE_SENSITIVITY,
+  VP9E_SET_TUNE_CONTENT, VP9E_SET_COLOR_SPACE,
+  VP9E_SET_MIN_GF_INTERVAL, VP9E_SET_MAX_GF_INTERVAL,
+  0
+};
+#endif
+
 static const arg_def_t *no_args[] = { NULL };
 
 void usage_exit(void) {
@@ -492,18 +520,14 @@
   fprintf(stderr, "\nVP8 Specific Options:\n");
   arg_show_usage(stderr, vp8_args);
 #endif
-#if CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER
-  // TODO(yaowu: split vp9 and vp10 option when necessary.
-  fprintf(stderr, "\n");
-  #if CONFIG_VP9_ENCODER
-    fprintf(stderr, "VP9 ");
-  #endif
-  #if CONFIG_VP10_ENCODER
-    fprintf(stderr, "VP10 ");
-  #endif
-  fprintf(stderr, "Specific Options:\n");
+#if CONFIG_VP9_ENCODER
+  fprintf(stderr, "\nVP9 Specific Options:\n");
   arg_show_usage(stderr, vp9_args);
 #endif
+#if CONFIG_VP10_ENCODER
+  fprintf(stderr, "\nVP10 Specific Options:\n");
+  arg_show_usage(stderr, vp10_args);
+#endif
   fprintf(stderr, "\nStream timebase (--timebase):\n"
           "  The desired precision of timestamps in the output, expressed\n"
           "  in fractional seconds. Default is 1/1000.\n");
@@ -749,14 +773,12 @@
 
 
 #define NELEMENTS(x) (sizeof(x)/sizeof(x[0]))
-#define MAX(x,y) ((x)>(y)?(x):(y))
-#if CONFIG_VP8_ENCODER && !(CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER)
-#define ARG_CTRL_CNT_MAX NELEMENTS(vp8_arg_ctrl_map)
-#elif !CONFIG_VP8_ENCODER && (CONFIG_VP9_ENCODER || CONFIG_VP10_ENCODER)
+#if CONFIG_VP10_ENCODER
+#define ARG_CTRL_CNT_MAX NELEMENTS(vp10_arg_ctrl_map)
+#elif CONFIG_VP9_ENCODER
 #define ARG_CTRL_CNT_MAX NELEMENTS(vp9_arg_ctrl_map)
 #else
-#define ARG_CTRL_CNT_MAX MAX(NELEMENTS(vp8_arg_ctrl_map), \
-                             NELEMENTS(vp9_arg_ctrl_map))
+#define ARG_CTRL_CNT_MAX NELEMENTS(vp8_arg_ctrl_map)
 #endif
 
 #if !CONFIG_WEBM_IO
@@ -1083,8 +1105,8 @@
   } else if (strcmp(global->codec->name, "vp10") == 0) {
     // TODO(jingning): Reuse VP9 specific encoder configuration parameters.
     // Consider to expand this set for VP10 encoder control.
-    ctrl_args = vp9_args;
-    ctrl_args_map = vp9_arg_ctrl_map;
+    ctrl_args = vp10_args;
+    ctrl_args_map = vp10_arg_ctrl_map;
 #endif
   }