vp8_impl.cc: Adjust cpu speed setting for arm for devices with 4 or more cores.

CIF or less: -12 -> -8
VGA: -12 -> -10

BUG=webrtc:6634

Review-Url: https://codereview.webrtc.org/2463033002
Cr-Commit-Position: refs/heads/master@{#14873}
This commit is contained in:
asapersson
2016-11-01 04:08:22 -07:00
committed by Commit bot
parent 91d96aabc7
commit 384e731455
2 changed files with 15 additions and 3 deletions

View File

@ -118,6 +118,7 @@ VP8EncoderImpl::VP8EncoderImpl()
feedback_mode_(false),
qp_max_(56), // Setting for max quantizer.
cpu_speed_default_(-6),
number_of_cores_(0),
rc_max_intra_target_(0),
token_partitions_(VP8_ONE_TOKENPARTITION),
down_scale_requested_(false),
@ -357,6 +358,7 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
feedback_mode_ = inst->VP8().feedbackModeOn;
number_of_cores_ = number_of_cores;
timestamp_ = 0;
codec_ = *inst;
rate_allocator_.reset(new SimulcastRateAllocator(codec_));
@ -567,9 +569,18 @@ int VP8EncoderImpl::InitEncode(const VideoCodec* inst,
int VP8EncoderImpl::SetCpuSpeed(int width, int height) {
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID)
// On mobile platform, always set to -12 to leverage between cpu usage
// and video quality.
return -12;
// On mobile platform, use a lower speed setting for lower resolutions for
// CPUs with 4 or more cores.
RTC_DCHECK_GT(number_of_cores_, 0);
if (number_of_cores_ <= 3)
return -12;
if (width * height <= 352 * 288)
return -8;
else if (width * height <= 640 * 480)
return -10;
else
return -12;
#else
// For non-ARM, increase encoding complexity (i.e., use lower speed setting)
// if resolution is below CIF. Otherwise, keep the default/user setting

View File

@ -100,6 +100,7 @@ class VP8EncoderImpl : public VP8Encoder {
bool feedback_mode_;
int qp_max_;
int cpu_speed_default_;
int number_of_cores_;
uint32_t rc_max_intra_target_;
int token_partitions_;
ReferencePictureSelection rps_;