Add field trial for vp8 cpu speed configuration for arm.
Bug: none Change-Id: I90c2475a229a1f10016e2ad84029e19b5a4f9966 Reviewed-on: https://webrtc-review.googlesource.com/c/107340 Commit-Queue: Åsa Persson <asapersson@webrtc.org> Reviewed-by: Stefan Holmer <stefan@webrtc.org> Reviewed-by: Rasmus Brandt <brandtr@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25484}
This commit is contained in:
@ -142,6 +142,7 @@ LibvpxVp8Encoder::LibvpxVp8Encoder()
|
||||
|
||||
LibvpxVp8Encoder::LibvpxVp8Encoder(std::unique_ptr<LibvpxInterface> interface)
|
||||
: libvpx_(std::move(interface)),
|
||||
experimental_cpu_speed_config_arm_(CpuSpeedExperiment::GetConfigs()),
|
||||
encoded_complete_callback_(nullptr),
|
||||
inited_(false),
|
||||
timestamp_(0),
|
||||
@ -432,10 +433,10 @@ int LibvpxVp8Encoder::InitEncode(const VideoCodec* inst,
|
||||
}
|
||||
cpu_speed_default_ = cpu_speed_[0];
|
||||
// Set encoding complexity (cpu_speed) based on resolution and/or platform.
|
||||
cpu_speed_[0] = SetCpuSpeed(inst->width, inst->height);
|
||||
cpu_speed_[0] = GetCpuSpeed(inst->width, inst->height);
|
||||
for (int i = 1; i < number_of_streams; ++i) {
|
||||
cpu_speed_[i] =
|
||||
SetCpuSpeed(inst->simulcastStream[number_of_streams - 1 - i].width,
|
||||
GetCpuSpeed(inst->simulcastStream[number_of_streams - 1 - i].width,
|
||||
inst->simulcastStream[number_of_streams - 1 - i].height);
|
||||
}
|
||||
configurations_[0].g_w = inst->width;
|
||||
@ -507,7 +508,7 @@ int LibvpxVp8Encoder::InitEncode(const VideoCodec* inst,
|
||||
return InitAndSetControlSettings();
|
||||
}
|
||||
|
||||
int LibvpxVp8Encoder::SetCpuSpeed(int width, int height) {
|
||||
int LibvpxVp8Encoder::GetCpuSpeed(int width, int height) {
|
||||
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
|
||||
defined(WEBRTC_ANDROID)
|
||||
// On mobile platform, use a lower speed setting for lower resolutions for
|
||||
@ -516,6 +517,11 @@ int LibvpxVp8Encoder::SetCpuSpeed(int width, int height) {
|
||||
if (number_of_cores_ <= 3)
|
||||
return -12;
|
||||
|
||||
if (experimental_cpu_speed_config_arm_) {
|
||||
return CpuSpeedExperiment::GetValue(width * height,
|
||||
*experimental_cpu_speed_config_arm_);
|
||||
}
|
||||
|
||||
if (width * height <= 352 * 288)
|
||||
return -8;
|
||||
else if (width * height <= 640 * 480)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include "modules/video_coding/codecs/vp8/include/vp8.h"
|
||||
#include "modules/video_coding/codecs/vp8/libvpx_interface.h"
|
||||
#include "modules/video_coding/include/video_codec_interface.h"
|
||||
#include "rtc_base/experiments/cpu_speed_experiment.h"
|
||||
|
||||
#include "vpx/vp8cx.h"
|
||||
#include "vpx/vpx_encoder.h"
|
||||
@ -61,8 +62,8 @@ class LibvpxVp8Encoder : public VideoEncoder {
|
||||
private:
|
||||
void SetupTemporalLayers(const VideoCodec& codec);
|
||||
|
||||
// Set the cpu_speed setting for encoder based on resolution and/or platform.
|
||||
int SetCpuSpeed(int width, int height);
|
||||
// Get the cpu_speed setting for encoder based on resolution and/or platform.
|
||||
int GetCpuSpeed(int width, int height);
|
||||
|
||||
// Determine number of encoder threads to use.
|
||||
int NumberOfThreads(int width, int height, int number_of_cores);
|
||||
@ -87,6 +88,9 @@ class LibvpxVp8Encoder : public VideoEncoder {
|
||||
|
||||
const std::unique_ptr<LibvpxInterface> libvpx_;
|
||||
|
||||
const absl::optional<std::vector<CpuSpeedExperiment::Config>>
|
||||
experimental_cpu_speed_config_arm_;
|
||||
|
||||
EncodedImageCallback* encoded_complete_callback_;
|
||||
VideoCodec codec_;
|
||||
bool inited_;
|
||||
|
Reference in New Issue
Block a user