summaryrefslogtreecommitdiffstats
path: root/remoting/base
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-20 22:20:09 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-20 22:20:09 +0000
commitc5fa81d49d8485b323ac083333c285b1507598f1 (patch)
treefd262272e51af03175e029e586fa5cbd0ff2a7f8 /remoting/base
parent5950f5716a2b5b074d2762185fca7f42885bac06 (diff)
downloadchromium_src-c5fa81d49d8485b323ac083333c285b1507598f1.zip
chromium_src-c5fa81d49d8485b323ac083333c285b1507598f1.tar.gz
chromium_src-c5fa81d49d8485b323ac083333c285b1507598f1.tar.bz2
Update VP8 encode options to speed up encoding for remoting
More details changes made in this patch: g_profile: 1 -> 2 Will use a more simplified profile similar to H264 base profile g_threads: 1 -> 2 Use 2 threads for encoding, it was always intended to do this but disabled before due to a bug in libvpx cpuused: 13->16 Disable half pixel motion vector and use simple loop filtering Quality for static pictures will stay roughly the same but encoding time will be halved for the most common scenario. Quality of motion picture will suffer with this patch, but not by a large factor due to the fact that we were using real time encoding mode already. So This really trims the parts that we don't need. BUG=None TEST=None Review URL: http://codereview.chromium.org/7084013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@89743 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base')
-rw-r--r--remoting/base/encoder_vp8.cc22
1 files changed, 19 insertions, 3 deletions
diff --git a/remoting/base/encoder_vp8.cc b/remoting/base/encoder_vp8.cc
index 0bba179..aa2a3d7 100644
--- a/remoting/base/encoder_vp8.cc
+++ b/remoting/base/encoder_vp8.cc
@@ -99,14 +99,20 @@ bool EncoderVp8::Init(const gfx::Size& size) {
active_map_height_ = (size.height() + kMacroBlockSize - 1) / kMacroBlockSize;
active_map_.reset(new uint8[active_map_width_ * active_map_height_]);
- // TODO(hclam): Tune the parameters to better suit the application.
config.rc_target_bitrate = size.width() * size.height() *
config.rc_target_bitrate / config.g_w / config.g_h;
config.g_w = size.width();
config.g_h = size.height();
config.g_pass = VPX_RC_ONE_PASS;
- config.g_profile = 1;
- config.g_threads = 1;
+
+ // Value of 2 means using the real time profile. This is basically a
+ // redundant option since we explicitly select real time mode when doing
+ // encoding.
+ config.g_profile = 2;
+
+ // Using 2 threads would give a great boost in performance in most systems
+ // while hurting single core systems just a little bit.
+ config.g_threads = 2;
config.rc_min_quantizer = 20;
config.rc_max_quantizer = 30;
config.g_timebase.num = 1;
@@ -114,6 +120,16 @@ bool EncoderVp8::Init(const gfx::Size& size) {
if (vpx_codec_enc_init(codec_.get(), algo, &config, 0))
return false;
+
+ // Value of 16 will have the smallest CPU load. This turns off subpixel
+ // motion search.
+ if (vpx_codec_control(codec_.get(), VP8E_SET_CPUUSED, 16))
+ return false;
+
+ // Use the lowest level of noise sensitivity so as to spend less time
+ // on motion estimation and inter-prediction mode.
+ if (vpx_codec_control(codec_.get(), VP8E_SET_NOISE_SENSITIVITY, 0))
+ return false;
return true;
}