From e305d956c0717a28ca88cd8547e5b310dfa74594 Mon Sep 17 00:00:00 2001 From: pasko Date: Tue, 17 May 2016 10:56:40 -0700 Subject: [PATCH] Remove runtime NEON detection Chrome does not detect NEON instruction set at runtime in WebRTC code starting with M50, which is now in Stable. Remove support for runtime detection for simplicity. The only remaining piece of Chrome that will continue to depend on runtime detection is /net, where devices with _broken_ neon support are also detected, and it is not configurable via GYP/GN. BUG=522035 NOPRESUBMIT=true Review-Url: https://codereview.webrtc.org/1955413003 Cr-Commit-Position: refs/heads/master@{#12778} --- webrtc/BUILD.gn | 2 -- webrtc/build/common.gypi | 5 +---- webrtc/build/webrtc.gni | 3 +-- webrtc/common_audio/fir_filter.cc | 7 ------ .../common_audio/resampler/sinc_resampler.cc | 6 ----- .../common_audio/resampler/sinc_resampler.h | 2 +- .../include/signal_processing_library.h | 22 +++++++++---------- .../common_audio/signal_processing/spl_init.c | 15 ++++--------- .../codecs/isac/fix/source/codec.h | 4 ++-- .../codecs/isac/fix/source/entropy_coding.h | 2 +- .../isac/fix/source/filterbank_internal.h | 2 +- .../isac/fix/source/filterbanks_unittest.cc | 6 +---- .../isac/fix/source/filters_unittest.cc | 6 +---- .../codecs/isac/fix/source/isacfix.c | 8 ++----- .../isac/fix/source/pitch_estimator_c.c | 2 -- .../isac/fix/source/transform_unittest.cc | 12 ++-------- .../modules/audio_processing/aec/aec_core.cc | 4 ---- .../modules/audio_processing/aec/aec_core.h | 2 +- .../modules/audio_processing/aec/aec_rdft.cc | 4 ---- .../modules/audio_processing/aec/aec_rdft.h | 2 +- .../audio_processing/aecm/aecm_core.cc | 10 ++------- .../modules/audio_processing/aecm/aecm_core.h | 2 +- webrtc/modules/audio_processing/ns/nsx_core.c | 13 ++++------- webrtc/modules/audio_processing/ns/nsx_core.h | 2 +- .../video_processing/util/denoiser_filter.cc | 8 ------- webrtc/typedefs.h | 3 +-- 26 files changed, 38 insertions(+), 116 deletions(-) diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn index 3a2556b917..01fa042af3 100644 --- a/webrtc/BUILD.gn +++ b/webrtc/BUILD.gn @@ -137,8 +137,6 @@ config("common_config") { defines += [ "WEBRTC_ARCH_ARM_V7" ] if (arm_use_neon) { defines += [ "WEBRTC_HAS_NEON" ] - } else if (arm_optionally_use_neon) { - defines += [ "WEBRTC_DETECT_NEON" ] } } } diff --git a/webrtc/build/common.gypi b/webrtc/build/common.gypi index 17c9959288..26acf4b5e2 100644 --- a/webrtc/build/common.gypi +++ b/webrtc/build/common.gypi @@ -221,7 +221,7 @@ ['target_arch=="arm" or target_arch=="arm64" or target_arch=="mipsel"', { 'prefer_fixed_point%': 1, }], - ['(target_arch=="arm" and (arm_neon==1 or arm_neon_optional==1)) or target_arch=="arm64"', { + ['(target_arch=="arm" and arm_neon==1) or target_arch=="arm64"', { 'build_with_neon%': 1, }], ['OS!="ios" and (target_arch!="arm" or arm_version>=7) and target_arch!="mips64el"', { @@ -352,9 +352,6 @@ ['arm_neon==1', { 'defines': ['WEBRTC_HAS_NEON',], }], - ['arm_neon==0 and arm_neon_optional==1', { - 'defines': ['WEBRTC_DETECT_NEON',], - }], ], }], ], diff --git a/webrtc/build/webrtc.gni b/webrtc/build/webrtc.gni index cef6651356..788e60824c 100644 --- a/webrtc/build/webrtc.gni +++ b/webrtc/build/webrtc.gni @@ -85,8 +85,7 @@ declare_args() { # Determines whether NEON code will be built. rtc_build_with_neon = - (current_cpu == "arm" && (arm_use_neon || arm_optionally_use_neon)) || - current_cpu == "arm64" + (current_cpu == "arm" && arm_use_neon) || current_cpu == "arm64" # Enable this to use HW H.264 encoder/decoder on iOS PeerConnections. # Enabling this may break interop with Android clients that support H264. diff --git a/webrtc/common_audio/fir_filter.cc b/webrtc/common_audio/fir_filter.cc index 13a2237dae..ed1f1bbfb8 100644 --- a/webrtc/common_audio/fir_filter.cc +++ b/webrtc/common_audio/fir_filter.cc @@ -61,13 +61,6 @@ FIRFilter* FIRFilter::Create(const float* coefficients, #elif defined(WEBRTC_HAS_NEON) filter = new FIRFilterNEON(coefficients, coefficients_length, max_input_length); -#elif defined(WEBRTC_DETECT_NEON) - if (WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) { - filter = - new FIRFilterNEON(coefficients, coefficients_length, max_input_length); - } else { - filter = new FIRFilterC(coefficients, coefficients_length); - } #else filter = new FIRFilterC(coefficients, coefficients_length); #endif diff --git a/webrtc/common_audio/resampler/sinc_resampler.cc b/webrtc/common_audio/resampler/sinc_resampler.cc index 69ac2208cf..c8bc15a362 100644 --- a/webrtc/common_audio/resampler/sinc_resampler.cc +++ b/webrtc/common_audio/resampler/sinc_resampler.cc @@ -136,12 +136,6 @@ void SincResampler::InitializeCPUSpecificFeatures() { #elif defined(WEBRTC_HAS_NEON) #define CONVOLVE_FUNC Convolve_NEON void SincResampler::InitializeCPUSpecificFeatures() {} -#elif defined(WEBRTC_DETECT_NEON) -#define CONVOLVE_FUNC convolve_proc_ -void SincResampler::InitializeCPUSpecificFeatures() { - convolve_proc_ = WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON ? - Convolve_NEON : Convolve_C; -} #else // Unknown architecture. #define CONVOLVE_FUNC Convolve_C diff --git a/webrtc/common_audio/resampler/sinc_resampler.h b/webrtc/common_audio/resampler/sinc_resampler.h index d8ea6df72f..ecfd64c0a6 100644 --- a/webrtc/common_audio/resampler/sinc_resampler.h +++ b/webrtc/common_audio/resampler/sinc_resampler.h @@ -107,7 +107,7 @@ class SincResampler { static float Convolve_SSE(const float* input_ptr, const float* k1, const float* k2, double kernel_interpolation_factor); -#elif defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) +#elif defined(WEBRTC_HAS_NEON) static float Convolve_NEON(const float* input_ptr, const float* k1, const float* k2, double kernel_interpolation_factor); diff --git a/webrtc/common_audio/signal_processing/include/signal_processing_library.h b/webrtc/common_audio/signal_processing/include/signal_processing_library.h index 2e96883e6d..19379bf084 100644 --- a/webrtc/common_audio/signal_processing/include/signal_processing_library.h +++ b/webrtc/common_audio/signal_processing/include/signal_processing_library.h @@ -106,10 +106,8 @@ extern "C" { // Initialize SPL. Currently it contains only function pointer initialization. // If the underlying platform is known to be ARM-Neon (WEBRTC_HAS_NEON defined), -// the pointers will be assigned to code optimized for Neon; otherwise -// if run-time Neon detection (WEBRTC_DETECT_NEON) is enabled, the pointers -// will be assigned to either Neon code or generic C code; otherwise, generic C -// code will be assigned. +// the pointers will be assigned to code optimized for Neon; otherwise, generic +// C code will be assigned. // Note that this function MUST be called in any application that uses SPL // functions. void WebRtcSpl_Init(); @@ -153,7 +151,7 @@ void WebRtcSpl_ZerosArrayW32(int32_t* vector, typedef int16_t (*MaxAbsValueW16)(const int16_t* vector, size_t length); extern MaxAbsValueW16 WebRtcSpl_MaxAbsValueW16; int16_t WebRtcSpl_MaxAbsValueW16C(const int16_t* vector, size_t length); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) int16_t WebRtcSpl_MaxAbsValueW16Neon(const int16_t* vector, size_t length); #endif #if defined(MIPS32_LE) @@ -170,7 +168,7 @@ int16_t WebRtcSpl_MaxAbsValueW16_mips(const int16_t* vector, size_t length); typedef int32_t (*MaxAbsValueW32)(const int32_t* vector, size_t length); extern MaxAbsValueW32 WebRtcSpl_MaxAbsValueW32; int32_t WebRtcSpl_MaxAbsValueW32C(const int32_t* vector, size_t length); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) int32_t WebRtcSpl_MaxAbsValueW32Neon(const int32_t* vector, size_t length); #endif #if defined(MIPS_DSP_R1_LE) @@ -187,7 +185,7 @@ int32_t WebRtcSpl_MaxAbsValueW32_mips(const int32_t* vector, size_t length); typedef int16_t (*MaxValueW16)(const int16_t* vector, size_t length); extern MaxValueW16 WebRtcSpl_MaxValueW16; int16_t WebRtcSpl_MaxValueW16C(const int16_t* vector, size_t length); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) int16_t WebRtcSpl_MaxValueW16Neon(const int16_t* vector, size_t length); #endif #if defined(MIPS32_LE) @@ -204,7 +202,7 @@ int16_t WebRtcSpl_MaxValueW16_mips(const int16_t* vector, size_t length); typedef int32_t (*MaxValueW32)(const int32_t* vector, size_t length); extern MaxValueW32 WebRtcSpl_MaxValueW32; int32_t WebRtcSpl_MaxValueW32C(const int32_t* vector, size_t length); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) int32_t WebRtcSpl_MaxValueW32Neon(const int32_t* vector, size_t length); #endif #if defined(MIPS32_LE) @@ -221,7 +219,7 @@ int32_t WebRtcSpl_MaxValueW32_mips(const int32_t* vector, size_t length); typedef int16_t (*MinValueW16)(const int16_t* vector, size_t length); extern MinValueW16 WebRtcSpl_MinValueW16; int16_t WebRtcSpl_MinValueW16C(const int16_t* vector, size_t length); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) int16_t WebRtcSpl_MinValueW16Neon(const int16_t* vector, size_t length); #endif #if defined(MIPS32_LE) @@ -238,7 +236,7 @@ int16_t WebRtcSpl_MinValueW16_mips(const int16_t* vector, size_t length); typedef int32_t (*MinValueW32)(const int32_t* vector, size_t length); extern MinValueW32 WebRtcSpl_MinValueW32; int32_t WebRtcSpl_MinValueW32C(const int32_t* vector, size_t length); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) int32_t WebRtcSpl_MinValueW32Neon(const int32_t* vector, size_t length); #endif #if defined(MIPS32_LE) @@ -531,7 +529,7 @@ void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation, size_t dim_cross_correlation, int right_shifts, int step_seq2); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) void WebRtcSpl_CrossCorrelationNeon(int32_t* cross_correlation, const int16_t* seq1, const int16_t* seq2, @@ -698,7 +696,7 @@ int WebRtcSpl_DownsampleFastC(const int16_t* data_in, size_t coefficients_length, int factor, size_t delay); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in, size_t data_in_length, int16_t* data_out, diff --git a/webrtc/common_audio/signal_processing/spl_init.c b/webrtc/common_audio/signal_processing/spl_init.c index fdab038399..c9c4e659cf 100644 --- a/webrtc/common_audio/signal_processing/spl_init.c +++ b/webrtc/common_audio/signal_processing/spl_init.c @@ -28,8 +28,7 @@ CrossCorrelation WebRtcSpl_CrossCorrelation; DownsampleFast WebRtcSpl_DownsampleFast; ScaleAndAddVectorsWithRound WebRtcSpl_ScaleAndAddVectorsWithRound; -#if (defined(WEBRTC_DETECT_NEON) || !defined(WEBRTC_HAS_NEON)) && \ - !defined(MIPS32_LE) +#if (!defined(WEBRTC_HAS_NEON)) && !defined(MIPS32_LE) /* Initialize function pointers to the generic C version. */ static void InitPointersToC() { WebRtcSpl_MaxAbsValueW16 = WebRtcSpl_MaxAbsValueW16C; @@ -45,7 +44,7 @@ static void InitPointersToC() { } #endif -#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) /* Initialize function pointers to the Neon version. */ static void InitPointersToNeon() { WebRtcSpl_MaxAbsValueW16 = WebRtcSpl_MaxAbsValueW16Neon; @@ -84,19 +83,13 @@ static void InitPointersToMIPS() { #endif static void InitFunctionPointers(void) { -#if defined(WEBRTC_DETECT_NEON) - if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { - InitPointersToNeon(); - } else { - InitPointersToC(); - } -#elif defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) InitPointersToNeon(); #elif defined(MIPS32_LE) InitPointersToMIPS(); #else InitPointersToC(); -#endif /* WEBRTC_DETECT_NEON */ +#endif /* WEBRTC_HAS_NEON */ } #if defined(WEBRTC_POSIX) diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h index fdbb2fcb0d..001a04f39b 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h @@ -90,7 +90,7 @@ void WebRtcIsacfix_Spec2TimeC(int16_t* inreQ7, int32_t* outre1Q16, int32_t* outre2Q16); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) void WebRtcIsacfix_Time2SpecNeon(int16_t* inre1Q9, int16_t* inre2Q9, int16_t* outre, @@ -174,7 +174,7 @@ void WebRtcIsacfix_FilterMaLoopC(int16_t input0, int32_t* ptr1, int32_t* ptr2); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) int WebRtcIsacfix_AutocorrNeon(int32_t* __restrict r, const int16_t* __restrict x, int16_t N, diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h index 2c8c923cd3..1b87d0ea55 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/entropy_coding.h @@ -147,7 +147,7 @@ void WebRtcIsacfix_MatrixProduct2C(const int16_t matrix0[], const int matrix0_index_factor, const int matrix0_index_step); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) void WebRtcIsacfix_MatrixProduct1Neon(const int16_t matrix0[], const int32_t matrix1[], int32_t matrix_product[], diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h index 0e67e300ac..d488339b31 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbank_internal.h @@ -60,7 +60,7 @@ void WebRtcIsacfix_AllpassFilter2FixDec16C( int32_t *filter_state_ch1, int32_t *filter_state_ch2); -#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) void WebRtcIsacfix_AllpassFilter2FixDec16Neon( int16_t *data_ch1, int16_t *data_ch2, diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc index 0ec115414b..4b03181e45 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filterbanks_unittest.cc @@ -64,11 +64,7 @@ class FilterBanksTest : public testing::Test { TEST_F(FilterBanksTest, AllpassFilter2FixDec16Test) { CalculateResidualEnergyTester(WebRtcIsacfix_AllpassFilter2FixDec16C); -#ifdef WEBRTC_DETECT_NEON - if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { - CalculateResidualEnergyTester(WebRtcIsacfix_AllpassFilter2FixDec16Neon); - } -#elif defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) CalculateResidualEnergyTester(WebRtcIsacfix_AllpassFilter2FixDec16Neon); #endif } diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc b/webrtc/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc index 5cce1e9f0b..3ed57788a1 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/filters_unittest.cc @@ -59,11 +59,7 @@ class FiltersTest : public testing::Test { TEST_F(FiltersTest, AutocorrFixTest) { FiltersTester(WebRtcIsacfix_AutocorrC); -#ifdef WEBRTC_DETECT_NEON - if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { - FiltersTester(WebRtcIsacfix_AutocorrNeon); - } -#elif defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) FiltersTester(WebRtcIsacfix_AutocorrNeon); #endif } diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c index aba3aa0c0b..e7905ae81f 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c @@ -201,7 +201,7 @@ int16_t WebRtcIsacfix_FreeInternal(ISACFIX_MainStruct *ISAC_main_inst) * This function initializes function pointers for ARM Neon platform. */ -#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) static void WebRtcIsacfix_InitNeon(void) { WebRtcIsacfix_AutocorrFix = WebRtcIsacfix_AutocorrNeon; WebRtcIsacfix_FilterMaLoopFix = WebRtcIsacfix_FilterMaLoopNeon; @@ -253,11 +253,7 @@ static void InitFunctionPointers(void) { WebRtcIsacfix_MatrixProduct1 = WebRtcIsacfix_MatrixProduct1C; WebRtcIsacfix_MatrixProduct2 = WebRtcIsacfix_MatrixProduct2C; -#ifdef WEBRTC_DETECT_NEON - if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { - WebRtcIsacfix_InitNeon(); - } -#elif defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) WebRtcIsacfix_InitNeon(); #endif diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator_c.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator_c.c index 18377dd370..0d881e8044 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator_c.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator_c.c @@ -57,8 +57,6 @@ void WebRtcIsacfix_PCorr2Q32(const int16_t* in, int32_t* logcorQ8) { ysum32 += in[PITCH_CORR_LEN2 + k - 1] * in[PITCH_CORR_LEN2 + k - 1] >> scaling; - // TODO(zhongwei.yao): Move this function into a separate NEON code file so - // that WEBRTC_DETECT_NEON could take advantage of it. #ifdef WEBRTC_HAS_NEON { int32_t vbuff[4]; diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc b/webrtc/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc index 58d890011f..c5cc87ffce 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/transform_unittest.cc @@ -179,22 +179,14 @@ class TransformTest : public testing::Test { TEST_F(TransformTest, Time2SpecTest) { Time2SpecTester(WebRtcIsacfix_Time2SpecC); -#ifdef WEBRTC_DETECT_NEON - if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { - Time2SpecTester(WebRtcIsacfix_Time2SpecNeon); - } -#elif defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) Time2SpecTester(WebRtcIsacfix_Time2SpecNeon); #endif } TEST_F(TransformTest, Spec2TimeTest) { Spec2TimeTester(WebRtcIsacfix_Spec2TimeC); -#ifdef WEBRTC_DETECT_NEON - if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { - Spec2TimeTester(WebRtcIsacfix_Spec2TimeNeon); - } -#elif defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) Spec2TimeTester(WebRtcIsacfix_Spec2TimeNeon); #endif } diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc index b463597aba..2cb6dd2ce7 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.cc +++ b/webrtc/modules/audio_processing/aec/aec_core.cc @@ -1486,10 +1486,6 @@ AecCore* WebRtcAec_CreateAec(int instance_count) { #if defined(WEBRTC_HAS_NEON) WebRtcAec_InitAec_neon(); -#elif defined(WEBRTC_DETECT_NEON) - if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { - WebRtcAec_InitAec_neon(); - } #endif aec_rdft_init(); diff --git a/webrtc/modules/audio_processing/aec/aec_core.h b/webrtc/modules/audio_processing/aec/aec_core.h index 668b484195..1ab2020186 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.h +++ b/webrtc/modules/audio_processing/aec/aec_core.h @@ -239,7 +239,7 @@ void WebRtcAec_InitAec_SSE2(void); #if defined(MIPS_FPU_LE) void WebRtcAec_InitAec_mips(void); #endif -#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) void WebRtcAec_InitAec_neon(void); #endif diff --git a/webrtc/modules/audio_processing/aec/aec_rdft.cc b/webrtc/modules/audio_processing/aec/aec_rdft.cc index 03efc103ea..690fe9f34f 100644 --- a/webrtc/modules/audio_processing/aec/aec_rdft.cc +++ b/webrtc/modules/audio_processing/aec/aec_rdft.cc @@ -581,9 +581,5 @@ void aec_rdft_init(void) { #endif #if defined(WEBRTC_HAS_NEON) aec_rdft_init_neon(); -#elif defined(WEBRTC_DETECT_NEON) - if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { - aec_rdft_init_neon(); - } #endif } diff --git a/webrtc/modules/audio_processing/aec/aec_rdft.h b/webrtc/modules/audio_processing/aec/aec_rdft.h index 18eb7a5c3f..d83eb27d83 100644 --- a/webrtc/modules/audio_processing/aec/aec_rdft.h +++ b/webrtc/modules/audio_processing/aec/aec_rdft.h @@ -54,7 +54,7 @@ void aec_rdft_inverse_128(float* a); #if defined(MIPS_FPU_LE) void aec_rdft_init_mips(void); #endif -#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) void aec_rdft_init_neon(void); #endif diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.cc b/webrtc/modules/audio_processing/aecm/aecm_core.cc index efaa7f0a8f..a17220dbd7 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core.cc +++ b/webrtc/modules/audio_processing/aecm/aecm_core.cc @@ -365,7 +365,7 @@ static void ResetAdaptiveChannelC(AecmCore* aecm) { } // Initialize function pointers for ARM Neon platform. -#if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) static void WebRtcAecm_InitNeon(void) { WebRtcAecm_StoreAdaptiveChannel = WebRtcAecm_StoreAdaptiveChannelNeon; @@ -512,13 +512,7 @@ int WebRtcAecm_InitCore(AecmCore* const aecm, int samplingFreq) { WebRtcAecm_StoreAdaptiveChannel = StoreAdaptiveChannelC; WebRtcAecm_ResetAdaptiveChannel = ResetAdaptiveChannelC; -#ifdef WEBRTC_DETECT_NEON - uint64_t features = WebRtc_GetCPUFeaturesARM(); - if ((features & kCPUFeatureNEON) != 0) - { - WebRtcAecm_InitNeon(); - } -#elif defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) WebRtcAecm_InitNeon(); #endif diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.h b/webrtc/modules/audio_processing/aecm/aecm_core.h index 421a8365c2..33d80889aa 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core.h +++ b/webrtc/modules/audio_processing/aecm/aecm_core.h @@ -402,7 +402,7 @@ extern ResetAdaptiveChannel WebRtcAecm_ResetAdaptiveChannel; // For the above function pointers, functions for generic platforms are declared // and defined as static in file aecm_core.c, while those for ARM Neon platforms // are declared below and defined in file aecm_core_neon.c. -#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) void WebRtcAecm_CalcLinearEnergiesNeon(AecmCore* aecm, const uint16_t* far_spectrum, int32_t* echo_est, diff --git a/webrtc/modules/audio_processing/ns/nsx_core.c b/webrtc/modules/audio_processing/ns/nsx_core.c index 25f16d26ab..94b6449776 100644 --- a/webrtc/modules/audio_processing/ns/nsx_core.c +++ b/webrtc/modules/audio_processing/ns/nsx_core.c @@ -19,7 +19,7 @@ #include "webrtc/modules/audio_processing/ns/nsx_core.h" #include "webrtc/system_wrappers/include/cpu_features_wrapper.h" -#if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) /* Tables are defined in ARM assembly files. */ extern const int16_t WebRtcNsx_kLogTable[9]; extern const int16_t WebRtcNsx_kCounterDiv[201]; @@ -65,7 +65,7 @@ static const int16_t WebRtcNsx_kLogTableFrac[256] = { 237, 238, 238, 239, 240, 241, 241, 242, 243, 244, 244, 245, 246, 247, 247, 248, 249, 249, 250, 251, 252, 252, 253, 254, 255, 255 }; -#endif // WEBRTC_DETECT_NEON || WEBRTC_HAS_NEON +#endif // WEBRTC_HAS_NEON // Skip first frequency bins during estimation. (0 <= value < 64) static const size_t kStartBand = 5; @@ -557,7 +557,7 @@ AnalysisUpdate WebRtcNsx_AnalysisUpdate; Denormalize WebRtcNsx_Denormalize; NormalizeRealBuffer WebRtcNsx_NormalizeRealBuffer; -#if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) // Initialize function pointers for ARM Neon platform. static void WebRtcNsx_InitNeon(void) { WebRtcNsx_NoiseEstimation = WebRtcNsx_NoiseEstimationNeon; @@ -762,12 +762,7 @@ int32_t WebRtcNsx_InitCore(NoiseSuppressionFixedC* inst, uint32_t fs) { WebRtcNsx_Denormalize = DenormalizeC; WebRtcNsx_NormalizeRealBuffer = NormalizeRealBufferC; -#ifdef WEBRTC_DETECT_NEON - uint64_t features = WebRtc_GetCPUFeaturesARM(); - if ((features & kCPUFeatureNEON) != 0) { - WebRtcNsx_InitNeon(); - } -#elif defined(WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) WebRtcNsx_InitNeon(); #endif diff --git a/webrtc/modules/audio_processing/ns/nsx_core.h b/webrtc/modules/audio_processing/ns/nsx_core.h index f463dbbe1a..d1754f31ea 100644 --- a/webrtc/modules/audio_processing/ns/nsx_core.h +++ b/webrtc/modules/audio_processing/ns/nsx_core.h @@ -215,7 +215,7 @@ void WebRtcNsx_SpeechNoiseProb(NoiseSuppressionFixedC* inst, uint32_t* priorLocSnr, uint32_t* postLocSnr); -#if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON) +#if defined(WEBRTC_HAS_NEON) // For the above function pointers, functions for generic platforms are declared // and defined as static in file nsx_core.c, while those for ARM Neon platforms // are declared below and defined in file nsx_core_neon.c. diff --git a/webrtc/modules/video_processing/util/denoiser_filter.cc b/webrtc/modules/video_processing/util/denoiser_filter.cc index b111a0e412..376dec74a3 100644 --- a/webrtc/modules/video_processing/util/denoiser_filter.cc +++ b/webrtc/modules/video_processing/util/denoiser_filter.cc @@ -45,14 +45,6 @@ std::unique_ptr DenoiserFilter::Create( filter.reset(new DenoiserFilterNEON()); if (cpu_type != nullptr) *cpu_type = CPU_NEON; -#elif defined(WEBRTC_DETECT_NEON) - if (WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) { - filter.reset(new DenoiserFilterNEON()); - if (cpu_type != nullptr) - *cpu_type = CPU_NEON; - } else { - filter.reset(new DenoiserFilterC()); - } #else filter.reset(new DenoiserFilterC()); #endif diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h index 6a3f441e22..e65b77a65f 100644 --- a/webrtc/typedefs.h +++ b/webrtc/typedefs.h @@ -57,8 +57,7 @@ // TODO(zhongwei.yao): WEBRTC_CPU_DETECTION is only used in one place; we should // probably just remove it. -#if (defined(WEBRTC_ARCH_X86_FAMILY) && !defined(__SSE2__)) || \ - defined(WEBRTC_DETECT_NEON) +#if (defined(WEBRTC_ARCH_X86_FAMILY) && !defined(__SSE2__)) #define WEBRTC_CPU_DETECTION #endif