Restrict ARM-specific VP8/VP9/AV1 settings to mobile platforms
ARM-specific settings were intended to be used on mobile ARM devices which may not be powerful enough. But the settings were also applied to ARM-based Macs. This changes restricts ARM-specific settings to Android and iOS platforms. Bug: none Change-Id: I68764b4c0679db07399bba5923f4a6be89c5ad80 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/321861 Commit-Queue: Sergey Silkin <ssilkin@webrtc.org> Reviewed-by: Jerome Jiang <jianj@google.com> Reviewed-by: Erik Språng <sprang@webrtc.org> Cr-Commit-Position: refs/heads/main@{#40884}
This commit is contained in:
parent
f166fe245c
commit
a4b2b95f99
@ -41,6 +41,11 @@
|
|||||||
#include "third_party/libaom/source/libaom/aom/aom_encoder.h"
|
#include "third_party/libaom/source/libaom/aom/aom_encoder.h"
|
||||||
#include "third_party/libaom/source/libaom/aom/aomcx.h"
|
#include "third_party/libaom/source/libaom/aom/aomcx.h"
|
||||||
|
|
||||||
|
#if (defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64)) && \
|
||||||
|
(defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS))
|
||||||
|
#define MOBILE_ARM
|
||||||
|
#endif
|
||||||
|
|
||||||
#define SET_ENCODER_PARAM_OR_RETURN_ERROR(param_id, param_value) \
|
#define SET_ENCODER_PARAM_OR_RETURN_ERROR(param_id, param_value) \
|
||||||
do { \
|
do { \
|
||||||
if (!SetEncoderControlParameters(param_id, param_value)) { \
|
if (!SetEncoderControlParameters(param_id, param_value)) { \
|
||||||
@ -413,8 +418,7 @@ int LibaomAv1Encoder::NumberOfThreads(int width,
|
|||||||
return 2;
|
return 2;
|
||||||
} else {
|
} else {
|
||||||
// Use 2 threads for low res on ARM.
|
// Use 2 threads for low res on ARM.
|
||||||
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
|
#ifdef MOBILE_ARM
|
||||||
defined(WEBRTC_ANDROID)
|
|
||||||
if (width * height >= 320 * 180 && number_of_cores > 2) {
|
if (width * height >= 320 * 180 && number_of_cores > 2) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,6 +44,11 @@
|
|||||||
#include "third_party/libyuv/include/libyuv/scale.h"
|
#include "third_party/libyuv/include/libyuv/scale.h"
|
||||||
#include "vpx/vp8cx.h"
|
#include "vpx/vp8cx.h"
|
||||||
|
|
||||||
|
#if (defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64)) && \
|
||||||
|
(defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS))
|
||||||
|
#define MOBILE_ARM
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
namespace {
|
namespace {
|
||||||
#if defined(WEBRTC_IOS)
|
#if defined(WEBRTC_IOS)
|
||||||
@ -744,8 +749,7 @@ int LibvpxVp8Encoder::InitEncode(const VideoCodec* inst,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int LibvpxVp8Encoder::GetCpuSpeed(int width, int height) {
|
int LibvpxVp8Encoder::GetCpuSpeed(int width, int height) {
|
||||||
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
|
#ifdef MOBILE_ARM
|
||||||
defined(WEBRTC_ANDROID)
|
|
||||||
// On mobile platform, use a lower speed setting for lower resolutions for
|
// On mobile platform, use a lower speed setting for lower resolutions for
|
||||||
// CPUs with 4 or more cores.
|
// CPUs with 4 or more cores.
|
||||||
RTC_DCHECK_GT(number_of_cores_, 0);
|
RTC_DCHECK_GT(number_of_cores_, 0);
|
||||||
@ -850,12 +854,10 @@ int LibvpxVp8Encoder::InitAndSetControlSettings() {
|
|||||||
// for getting the denoised frame from the encoder and using that
|
// for getting the denoised frame from the encoder and using that
|
||||||
// when encoding lower resolution streams. Would it work with the
|
// when encoding lower resolution streams. Would it work with the
|
||||||
// multi-res encoding feature?
|
// multi-res encoding feature?
|
||||||
|
#ifdef MOBILE_ARM
|
||||||
denoiserState denoiser_state = kDenoiserOnYOnly;
|
denoiserState denoiser_state = kDenoiserOnYOnly;
|
||||||
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
|
|
||||||
defined(WEBRTC_ANDROID)
|
|
||||||
denoiser_state = kDenoiserOnYOnly;
|
|
||||||
#else
|
#else
|
||||||
denoiser_state = kDenoiserOnAdaptive;
|
denoiserState denoiser_state = kDenoiserOnAdaptive;
|
||||||
#endif
|
#endif
|
||||||
libvpx_->codec_control(
|
libvpx_->codec_control(
|
||||||
&encoders_[0], VP8E_SET_NOISE_SENSITIVITY,
|
&encoders_[0], VP8E_SET_NOISE_SENSITIVITY,
|
||||||
|
|||||||
@ -47,6 +47,11 @@
|
|||||||
#include "vpx/vp8cx.h"
|
#include "vpx/vp8cx.h"
|
||||||
#include "vpx/vpx_encoder.h"
|
#include "vpx/vpx_encoder.h"
|
||||||
|
|
||||||
|
#if (defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64)) && \
|
||||||
|
(defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS))
|
||||||
|
#define MOBILE_ARM
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace webrtc {
|
namespace webrtc {
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
@ -201,13 +206,12 @@ vpx_svc_ref_frame_config_t Vp9References(
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool AllowDenoising() {
|
bool AllowDenoising() {
|
||||||
// Do not enable the denoiser on ARM since optimization is pending.
|
#ifdef MOBILE_ARM
|
||||||
// Denoiser is on by default on other platforms.
|
// Keep the denoiser disabled on mobile ARM devices. It increases encode time
|
||||||
#if !defined(WEBRTC_ARCH_ARM) && !defined(WEBRTC_ARCH_ARM64) && \
|
// by up to 16%.
|
||||||
!defined(ANDROID)
|
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
return false;
|
||||||
|
#else
|
||||||
|
return true;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -766,9 +770,8 @@ int LibvpxVp9Encoder::NumberOfThreads(int width,
|
|||||||
} else if (width * height >= 640 * 360 && number_of_cores > 2) {
|
} else if (width * height >= 640 * 360 && number_of_cores > 2) {
|
||||||
return 2;
|
return 2;
|
||||||
} else {
|
} else {
|
||||||
// Use 2 threads for low res on ARM.
|
// Use 2 threads for low res on mobile ARM.
|
||||||
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || \
|
#ifdef MOBILE_ARM
|
||||||
defined(WEBRTC_ANDROID)
|
|
||||||
if (width * height >= 320 * 180 && number_of_cores > 2) {
|
if (width * height >= 320 * 180 && number_of_cores > 2) {
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
@ -1998,7 +2001,7 @@ LibvpxVp9Encoder::PerformanceFlags
|
|||||||
LibvpxVp9Encoder::GetDefaultPerformanceFlags() {
|
LibvpxVp9Encoder::GetDefaultPerformanceFlags() {
|
||||||
PerformanceFlags flags;
|
PerformanceFlags flags;
|
||||||
flags.use_per_layer_speed = true;
|
flags.use_per_layer_speed = true;
|
||||||
#if defined(WEBRTC_ARCH_ARM) || defined(WEBRTC_ARCH_ARM64) || defined(ANDROID)
|
#ifdef MOBILE_ARM
|
||||||
// Speed 8 on all layers for all resolutions.
|
// Speed 8 on all layers for all resolutions.
|
||||||
flags.settings_by_resolution[0] = {.base_layer_speed = 8,
|
flags.settings_by_resolution[0] = {.base_layer_speed = 8,
|
||||||
.high_layer_speed = 8,
|
.high_layer_speed = 8,
|
||||||
|
|||||||
@ -182,9 +182,7 @@ TEST(PCGenericDescriptorTest,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// VP9 2nd profile isn't supported on android arm and arm 64.
|
// VP9 2nd profile isn't supported on android arm and arm 64.
|
||||||
#if (defined(WEBRTC_ANDROID) && \
|
#if defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM)
|
||||||
(defined(WEBRTC_ARCH_ARM64) || defined(WEBRTC_ARCH_ARM))) || \
|
|
||||||
(defined(WEBRTC_IOS) && defined(WEBRTC_ARCH_ARM64))
|
|
||||||
#define MAYBE_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2 \
|
#define MAYBE_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2 \
|
||||||
DISABLED_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2
|
DISABLED_Pc_Generator_Net_Delay_0_0_Plr_0_VP9Profile2
|
||||||
#else
|
#else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user