shithub: libvpx

Download patch

ref: a2f7619860660c3245c3b725e41c4f41f7a99d79
parent: ac12f3926bce33c0ef3725a853a71c8753d970ad
parent: 0d8723f8d5372eaaadfb5373a3b9d35e2c78c42d
author: Deb Mukherjee <[email protected]>
date: Wed Aug 21 09:58:49 EDT 2013

Merge "Make "good" quality 2-pass vpxenc encoding default"

--- a/test/encode_test_driver.cc
+++ b/test/encode_test_driver.cc
@@ -158,7 +158,7 @@
     Decoder* const decoder = codec_->CreateDecoder(dec_cfg, 0);
     bool again;
     for (again = true, video->Begin(); again; video->Next()) {
-      again = video->img() != NULL;
+      again = (video->img() != NULL);
 
       PreEncodeFrameHook(video);
       PreEncodeFrameHook(video, encoder);
--- a/test/error_resilience_test.cc
+++ b/test/error_resilience_test.cc
@@ -62,7 +62,7 @@
     if (droppable_nframes_ > 0 &&
         (cfg_.g_pass == VPX_RC_LAST_PASS || cfg_.g_pass == VPX_RC_ONE_PASS)) {
       for (unsigned int i = 0; i < droppable_nframes_; ++i) {
-        if (droppable_frames_[i] == nframes_) {
+        if (droppable_frames_[i] == video->frame()) {
           std::cout << "             Encoding droppable frame: "
                     << droppable_frames_[i] << "\n";
           frame_flags_ |= (VP8_EFLAG_NO_UPD_LAST |
@@ -148,7 +148,7 @@
   const vpx_rational timebase = { 33333333, 1000000000 };
   cfg_.g_timebase = timebase;
   cfg_.rc_target_bitrate = 2000;
-  cfg_.g_lag_in_frames = 25;
+  cfg_.g_lag_in_frames = 10;
 
   init_flags_ = VPX_CODEC_USE_PSNR;
 
@@ -179,6 +179,9 @@
   const vpx_rational timebase = { 33333333, 1000000000 };
   cfg_.g_timebase = timebase;
   cfg_.rc_target_bitrate = 500;
+  // FIXME(debargha): Fix this to work for any lag.
+  // Currently this test only works for lag = 0
+  cfg_.g_lag_in_frames = 0;
 
   init_flags_ = VPX_CODEC_USE_PSNR;
 
--- a/vp9/vp9_cx_iface.c
+++ b/vp9/vp9_cx_iface.c
@@ -51,14 +51,14 @@
     {
       NULL,
       0,                          /* cpu_used      */
-      0,                          /* enable_auto_alt_ref */
+      1,                          /* enable_auto_alt_ref */
       0,                          /* noise_sensitivity */
       0,                          /* Sharpness */
       0,                          /* static_thresh */
       0,                          /* tile_columns */
       0,                          /* tile_rows */
-      0,                          /* arnr_max_frames */
-      3,                          /* arnr_strength */
+      7,                          /* arnr_max_frames */
+      5,                          /* arnr_strength */
       3,                          /* arnr_type*/
       0,                          /* experimental mode */
       0,                          /* tuning*/
@@ -411,21 +411,20 @@
 #define MAP(id, var) case id: var = CAST(id, args); break;
 
   switch (ctrl_id) {
-      MAP(VP8E_SET_CPUUSED,               xcfg.cpu_used);
-      MAP(VP8E_SET_ENABLEAUTOALTREF,      xcfg.enable_auto_alt_ref);
-      MAP(VP8E_SET_NOISE_SENSITIVITY,     xcfg.noise_sensitivity);
-      MAP(VP8E_SET_SHARPNESS,             xcfg.Sharpness);
-      MAP(VP8E_SET_STATIC_THRESHOLD,      xcfg.static_thresh);
-      MAP(VP9E_SET_TILE_COLUMNS,          xcfg.tile_columns);
-      MAP(VP9E_SET_TILE_ROWS,             xcfg.tile_rows);
-
-      MAP(VP8E_SET_ARNR_MAXFRAMES,        xcfg.arnr_max_frames);
-      MAP(VP8E_SET_ARNR_STRENGTH,        xcfg.arnr_strength);
-      MAP(VP8E_SET_ARNR_TYPE,        xcfg.arnr_type);
-      MAP(VP8E_SET_TUNING,                xcfg.tuning);
-      MAP(VP8E_SET_CQ_LEVEL,              xcfg.cq_level);
-      MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT, xcfg.rc_max_intra_bitrate_pct);
-      MAP(VP9E_SET_LOSSLESS,              xcfg.lossless);
+      MAP(VP8E_SET_CPUUSED,                 xcfg.cpu_used);
+      MAP(VP8E_SET_ENABLEAUTOALTREF,        xcfg.enable_auto_alt_ref);
+      MAP(VP8E_SET_NOISE_SENSITIVITY,       xcfg.noise_sensitivity);
+      MAP(VP8E_SET_SHARPNESS,               xcfg.Sharpness);
+      MAP(VP8E_SET_STATIC_THRESHOLD,        xcfg.static_thresh);
+      MAP(VP9E_SET_TILE_COLUMNS,            xcfg.tile_columns);
+      MAP(VP9E_SET_TILE_ROWS,               xcfg.tile_rows);
+      MAP(VP8E_SET_ARNR_MAXFRAMES,          xcfg.arnr_max_frames);
+      MAP(VP8E_SET_ARNR_STRENGTH,           xcfg.arnr_strength);
+      MAP(VP8E_SET_ARNR_TYPE,               xcfg.arnr_type);
+      MAP(VP8E_SET_TUNING,                  xcfg.tuning);
+      MAP(VP8E_SET_CQ_LEVEL,                xcfg.cq_level);
+      MAP(VP8E_SET_MAX_INTRA_BITRATE_PCT,   xcfg.rc_max_intra_bitrate_pct);
+      MAP(VP9E_SET_LOSSLESS,                xcfg.lossless);
       MAP(VP9E_SET_FRAME_PARALLEL_DECODING, xcfg.frame_parallel_decoding_mode);
   }
 
@@ -1026,8 +1025,8 @@
   {VP8E_GET_LAST_QUANTIZER,           get_param},
   {VP8E_GET_LAST_QUANTIZER_64,        get_param},
   {VP8E_SET_ARNR_MAXFRAMES,           set_param},
-  {VP8E_SET_ARNR_STRENGTH,           set_param},
-  {VP8E_SET_ARNR_TYPE,           set_param},
+  {VP8E_SET_ARNR_STRENGTH,            set_param},
+  {VP8E_SET_ARNR_TYPE,                set_param},
   {VP8E_SET_TUNING,                   set_param},
   {VP8E_SET_CQ_LEVEL,                 set_param},
   {VP8E_SET_MAX_INTRA_BITRATE_PCT,    set_param},
@@ -1053,7 +1052,7 @@
 
       VPX_RC_ONE_PASS,    /* g_pass */
 
-      0,                  /* g_lag_in_frames */
+      25,                 /* g_lag_in_frames */
 
       0,                  /* rc_dropframe_thresh */
       0,                  /* rc_resize_allowed */
@@ -1065,7 +1064,7 @@
       {0},                /* rc_twopass_stats_in */
 #endif
       256,                /* rc_target_bandwidth */
-      4,                  /* rc_min_quantizer */
+      0,                  /* rc_min_quantizer */
       63,                 /* rc_max_quantizer */
       100,                /* rc_undershoot_pct */
       100,                /* rc_overshoot_pct */
@@ -1076,7 +1075,7 @@
 
       50,                 /* rc_two_pass_vbrbias  */
       0,                  /* rc_two_pass_vbrmin_section */
-      400,                /* rc_two_pass_vbrmax_section */
+      2000,               /* rc_two_pass_vbrmax_section */
 
       /* keyframing settings (kf) */
       VPX_KF_AUTO,        /* g_kfmode*/
--- a/vpxenc.c
+++ b/vpxenc.c
@@ -1688,8 +1688,10 @@
   /* Initialize default parameters */
   memset(global, 0, sizeof(*global));
   global->codec = codecs;
-  global->passes = 1;
+  global->passes = 0;
   global->use_i420 = 1;
+  /* Assign default deadline to good quality */
+  global->deadline = VPX_DL_GOOD_QUALITY;
 
   for (argi = argj = argv; (*argj = *argi); argi += arg.argv_step) {
     arg.argv_step = 1;
@@ -1761,6 +1763,11 @@
   }
 
   /* Validate global config */
+  if (global->passes == 0) {
+    // Make default VP9 passes = 2 until there is a better quality 1-pass
+    // encoder
+    global->passes = (global->codec->iface == vpx_codec_vp9_cx ? 2 : 1);
+  }
 
   if (global->pass) {
     /* DWIM: Assume the user meant passes=2 if pass=2 is specified */