Av1 wrapper: only use speed 6 on cores > 2

Bug: None
Change-Id: Iacddfbca1d2579c3a397339a1c18008a10238348
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/176463
Reviewed-by: Marco Paniconi <marpan@webrtc.org>
Commit-Queue: Jerome Jiang <jianj@google.com>
Cr-Commit-Position: refs/heads/master@{#31436}
This commit is contained in:
Jerome Jiang
2020-06-03 18:18:21 -07:00
committed by Commit Bot
parent 0fd55cc715
commit 6813767e52

View File

@ -50,10 +50,10 @@ constexpr float kMinimumFrameRate = 1.0;
// Only positive speeds, range for real-time coding currently is: 6 - 8.
// Lower means slower/better quality, higher means fastest/lower quality.
int GetCpuSpeed(int width, int height) {
int GetCpuSpeed(int width, int height, int number_of_cores) {
// For smaller resolutions, use lower speed setting (get some coding gain at
// the cost of increased encoding complexity).
if (width * height <= 320 * 180)
if (number_of_cores > 2 && width * height <= 320 * 180)
return 6;
else if (width * height >= 1280 * 720)
return 8;
@ -214,8 +214,9 @@ int LibaomAv1Encoder::InitEncode(const VideoCodec* codec_settings,
inited_ = true;
// Set control parameters
ret = aom_codec_control(&ctx_, AOME_SET_CPUUSED,
GetCpuSpeed(cfg_.g_w, cfg_.g_h));
ret = aom_codec_control(
&ctx_, AOME_SET_CPUUSED,
GetCpuSpeed(cfg_.g_w, cfg_.g_h, settings.number_of_cores));
if (ret != AOM_CODEC_OK) {
RTC_LOG(LS_WARNING) << "LibaomAv1Encoder::EncodeInit returned " << ret
<< " on control AV1E_SET_CPUUSED.";