diff --git a/webrtc/BUILD.gn b/webrtc/BUILD.gn index 2c1fafbaef..45b05b64e4 100644 --- a/webrtc/BUILD.gn +++ b/webrtc/BUILD.gn @@ -113,13 +113,8 @@ config("common_config") { } if (current_cpu == "arm64") { - defines += [ "WEBRTC_ARCH_ARM" ] - # TODO(zhongwei) Defining an unique WEBRTC_NEON and - # distinguishing ARMv7 NEON and ARM64 NEON by - # WEBRTC_ARCH_ARM_V7 and WEBRTC_ARCH_ARM64 should be better. - - # This macro is used to distinguish ARMv7 NEON and ARM64 NEON - defines += [ "WEBRTC_ARCH_ARM64_NEON" ] + defines += [ "WEBRTC_ARCH_ARM64" ] + defines += [ "WEBRTC_HAS_NEON" ] } if (current_cpu == "arm") { @@ -127,9 +122,9 @@ config("common_config") { if (arm_version >= 7) { defines += [ "WEBRTC_ARCH_ARM_V7" ] if (arm_use_neon) { - defines += [ "WEBRTC_ARCH_ARM_NEON" ] - } else if (is_android) { - defines += [ "WEBRTC_DETECT_ARM_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 e1ef419bf2..863d63b8ad 100644 --- a/webrtc/build/common.gypi +++ b/webrtc/build/common.gypi @@ -260,13 +260,8 @@ }], ['target_arch=="arm64"', { 'defines': [ - 'WEBRTC_ARCH_ARM', - # TODO(zhongwei) Defining an unique WEBRTC_NEON and - # distinguishing ARMv7 NEON and ARM64 NEON by - # WEBRTC_ARCH_ARM_V7 and WEBRTC_ARCH_ARM64 should be better. - - # This macro is used to distinguish ARMv7 NEON and ARM64 NEON - 'WEBRTC_ARCH_ARM64_NEON', + 'WEBRTC_ARCH_ARM64', + 'WEBRTC_HAS_NEON', ], }], ['target_arch=="arm"', { @@ -278,10 +273,10 @@ 'defines': ['WEBRTC_ARCH_ARM_V7',], 'conditions': [ ['arm_neon==1', { - 'defines': ['WEBRTC_ARCH_ARM_NEON',], + 'defines': ['WEBRTC_HAS_NEON',], }], - ['arm_neon==0 and OS=="android"', { - 'defines': ['WEBRTC_DETECT_ARM_NEON',], + ['arm_neon==0 and arm_neon_optional==1', { + 'defines': ['WEBRTC_DETECT_NEON',], }], ], }], diff --git a/webrtc/common_audio/fir_filter.cc b/webrtc/common_audio/fir_filter.cc index c651235410..1c5548dcdc 100644 --- a/webrtc/common_audio/fir_filter.cc +++ b/webrtc/common_audio/fir_filter.cc @@ -57,19 +57,16 @@ FIRFilter* FIRFilter::Create(const float* coefficients, filter = new FIRFilterC(coefficients, coefficients_length); } #endif -#elif defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON) -#if defined(WEBRTC_ARCH_ARM_NEON) +#elif defined(WEBRTC_HAS_NEON) filter = new FIRFilterNEON(coefficients, coefficients_length, max_input_length); -#else - // ARM CPU detection required. +#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); } -#endif #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 0e18ac55e2..1c259c5337 100644 --- a/webrtc/common_audio/resampler/sinc_resampler.cc +++ b/webrtc/common_audio/resampler/sinc_resampler.cc @@ -128,20 +128,15 @@ void SincResampler::InitializeCPUSpecificFeatures() { convolve_proc_ = WebRtc_GetCPUInfo(kSSE2) ? Convolve_SSE : Convolve_C; } #endif -#elif defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON) -#if defined(WEBRTC_ARCH_ARM_NEON) +#elif defined(WEBRTC_HAS_NEON) #define CONVOLVE_FUNC Convolve_NEON void SincResampler::InitializeCPUSpecificFeatures() {} -#else -// ARM CPU detection required. Function will be set by -// InitializeCPUSpecificFeatures(). +#elif defined(WEBRTC_DETECT_NEON) #define CONVOLVE_FUNC convolve_proc_ - void SincResampler::InitializeCPUSpecificFeatures() { convolve_proc_ = WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON ? Convolve_NEON : Convolve_C; } -#endif #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 be84a99624..9ad7895bca 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_ARCH_ARM_V7) || defined(WEBRTC_ARCH_ARM64_NEON) +#elif defined(WEBRTC_DETECT_NEON) || 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 7014fa1df5..745715dcea 100644 --- a/webrtc/common_audio/signal_processing/include/signal_processing_library.h +++ b/webrtc/common_audio/signal_processing/include/signal_processing_library.h @@ -105,9 +105,9 @@ extern "C" { #include "webrtc/common_audio/signal_processing/include/spl_inl.h" // Initialize SPL. Currently it contains only function pointer initialization. -// If the underlying platform is known to be ARM-Neon (WEBRTC_ARCH_ARM_NEON -// defined), the pointers will be assigned to code optimized for Neon; otherwise -// if run-time Neon detection (WEBRTC_DETECT_ARM_NEON) is enabled, the pointers +// 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. // Note that this function MUST be called in any application that uses SPL @@ -154,8 +154,7 @@ void WebRtcSpl_ZerosArrayW32(int32_t* vector, typedef int16_t (*MaxAbsValueW16)(const int16_t* vector, int length); extern MaxAbsValueW16 WebRtcSpl_MaxAbsValueW16; int16_t WebRtcSpl_MaxAbsValueW16C(const int16_t* vector, int length); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) int16_t WebRtcSpl_MaxAbsValueW16Neon(const int16_t* vector, int length); #endif #if defined(MIPS32_LE) @@ -173,8 +172,7 @@ int16_t WebRtcSpl_MaxAbsValueW16_mips(const int16_t* vector, int length); typedef int32_t (*MaxAbsValueW32)(const int32_t* vector, int length); extern MaxAbsValueW32 WebRtcSpl_MaxAbsValueW32; int32_t WebRtcSpl_MaxAbsValueW32C(const int32_t* vector, int length); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) int32_t WebRtcSpl_MaxAbsValueW32Neon(const int32_t* vector, int length); #endif #if defined(MIPS_DSP_R1_LE) @@ -194,8 +192,7 @@ int32_t WebRtcSpl_MaxAbsValueW32_mips(const int32_t* vector, int length); typedef int16_t (*MaxValueW16)(const int16_t* vector, int length); extern MaxValueW16 WebRtcSpl_MaxValueW16; int16_t WebRtcSpl_MaxValueW16C(const int16_t* vector, int length); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) int16_t WebRtcSpl_MaxValueW16Neon(const int16_t* vector, int length); #endif #if defined(MIPS32_LE) @@ -215,8 +212,7 @@ int16_t WebRtcSpl_MaxValueW16_mips(const int16_t* vector, int length); typedef int32_t (*MaxValueW32)(const int32_t* vector, int length); extern MaxValueW32 WebRtcSpl_MaxValueW32; int32_t WebRtcSpl_MaxValueW32C(const int32_t* vector, int length); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) int32_t WebRtcSpl_MaxValueW32Neon(const int32_t* vector, int length); #endif #if defined(MIPS32_LE) @@ -236,8 +232,7 @@ int32_t WebRtcSpl_MaxValueW32_mips(const int32_t* vector, int length); typedef int16_t (*MinValueW16)(const int16_t* vector, int length); extern MinValueW16 WebRtcSpl_MinValueW16; int16_t WebRtcSpl_MinValueW16C(const int16_t* vector, int length); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) int16_t WebRtcSpl_MinValueW16Neon(const int16_t* vector, int length); #endif #if defined(MIPS32_LE) @@ -257,8 +252,7 @@ int16_t WebRtcSpl_MinValueW16_mips(const int16_t* vector, int length); typedef int32_t (*MinValueW32)(const int32_t* vector, int length); extern MinValueW32 WebRtcSpl_MinValueW32; int32_t WebRtcSpl_MinValueW32C(const int32_t* vector, int length); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) int32_t WebRtcSpl_MinValueW32Neon(const int32_t* vector, int length); #endif #if defined(MIPS32_LE) @@ -558,8 +552,7 @@ void WebRtcSpl_CrossCorrelationC(int32_t* cross_correlation, int16_t dim_cross_correlation, int16_t right_shifts, int16_t step_seq2); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) void WebRtcSpl_CrossCorrelationNeon(int32_t* cross_correlation, const int16_t* seq1, const int16_t* seq2, @@ -724,8 +717,7 @@ int WebRtcSpl_DownsampleFastC(const int16_t* data_in, int coefficients_length, int factor, int delay); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) int WebRtcSpl_DownsampleFastNeon(const int16_t* data_in, int 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 0a493796cb..73c2039eae 100644 --- a/webrtc/common_audio/signal_processing/spl_init.c +++ b/webrtc/common_audio/signal_processing/spl_init.c @@ -28,8 +28,8 @@ CrossCorrelation WebRtcSpl_CrossCorrelation; DownsampleFast WebRtcSpl_DownsampleFast; ScaleAndAddVectorsWithRound WebRtcSpl_ScaleAndAddVectorsWithRound; -#if (defined(WEBRTC_DETECT_ARM_NEON) || !defined(WEBRTC_ARCH_ARM_NEON)) && \ - !defined(MIPS32_LE) && !defined(WEBRTC_ARCH_ARM64_NEON) +#if (defined(WEBRTC_DETECT_NEON) || !defined(WEBRTC_HAS_NEON)) && \ + !defined(MIPS32_LE) /* Initialize function pointers to the generic C version. */ static void InitPointersToC() { WebRtcSpl_MaxAbsValueW16 = WebRtcSpl_MaxAbsValueW16C; @@ -45,8 +45,7 @@ static void InitPointersToC() { } #endif -#if defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) /* Initialize function pointers to the Neon version. */ static void InitPointersToNeon() { WebRtcSpl_MaxAbsValueW16 = WebRtcSpl_MaxAbsValueW16Neon; @@ -57,8 +56,6 @@ static void InitPointersToNeon() { WebRtcSpl_MinValueW32 = WebRtcSpl_MinValueW32Neon; WebRtcSpl_CrossCorrelation = WebRtcSpl_CrossCorrelationNeon; WebRtcSpl_DownsampleFast = WebRtcSpl_DownsampleFastNeon; - /* TODO(henrik.lundin): re-enable NEON when the crash from bug 3243 is - understood. */ WebRtcSpl_ScaleAndAddVectorsWithRound = WebRtcSpl_ScaleAndAddVectorsWithRoundC; } @@ -87,19 +84,19 @@ static void InitPointersToMIPS() { #endif static void InitFunctionPointers(void) { -#if defined(WEBRTC_DETECT_ARM_NEON) +#if defined(WEBRTC_DETECT_NEON) if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { InitPointersToNeon(); } else { InitPointersToC(); } -#elif defined(WEBRTC_ARCH_ARM_NEON) || defined(WEBRTC_ARCH_ARM64_NEON) +#elif defined(WEBRTC_HAS_NEON) InitPointersToNeon(); #elif defined(MIPS32_LE) InitPointersToMIPS(); #else InitPointersToC(); -#endif /* WEBRTC_DETECT_ARM_NEON */ +#endif /* WEBRTC_DETECT_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 cf1266a626..8ecbd14bc2 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/codec.h @@ -90,8 +90,7 @@ void WebRtcIsacfix_Spec2TimeC(int16_t* inreQ7, int32_t* outre1Q16, int32_t* outre2Q16); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (defined WEBRTC_HAS_NEON) void WebRtcIsacfix_Time2SpecNeon(int16_t* inre1Q9, int16_t* inre2Q9, int16_t* outre, @@ -175,8 +174,7 @@ void WebRtcIsacfix_FilterMaLoopC(int16_t input0, int32_t* ptr1, int32_t* ptr2); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (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 63fe61fc78..ec20c71f74 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,8 +147,7 @@ void WebRtcIsacfix_MatrixProduct2C(const int16_t matrix0[], const int matrix0_index_factor, const int matrix0_index_step); -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON) || (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 fb042dee7b..d6153e09fc 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 @@ -63,9 +63,8 @@ void WebRtcIsacfix_AllpassFilter2FixDec16C( // Disable AllpassFilter2FixDec16Neon function due to a clang bug. // Refer more details at: // https://code.google.com/p/webrtc/issues/detail?id=4567 -#if !(defined __clang__) -#if (defined WEBRTC_DETECT_ARM_NEON) || (defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if !defined(__clang__) || !defined(WEBRTC_ARCH_ARM64) +#if (defined WEBRTC_DETECT_NEON) || (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 79a590ff24..8ef05e897b 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 @@ -68,12 +68,12 @@ TEST_F(FilterBanksTest, AllpassFilter2FixDec16Test) { // Disable AllpassFilter2FixDec16Neon function due to a clang bug. // Refer more details at: // https://code.google.com/p/webrtc/issues/detail?id=4567 -#if !(defined __clang__) -#ifdef WEBRTC_DETECT_ARM_NEON +#if !(defined __clang__) || !defined(WEBRTC_ARCH_ARM64) +#ifdef WEBRTC_DETECT_NEON if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { CalculateResidualEnergyTester(WebRtcIsacfix_AllpassFilter2FixDec16Neon); } -#elif defined(WEBRTC_ARCH_ARM_NEON) +#elif defined(WEBRTC_HAS_NEON) CalculateResidualEnergyTester(WebRtcIsacfix_AllpassFilter2FixDec16Neon); #endif #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 4ea4dabc55..de1140be4d 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,11 @@ class FiltersTest : public testing::Test { TEST_F(FiltersTest, AutocorrFixTest) { FiltersTester(WebRtcIsacfix_AutocorrC); -#ifdef WEBRTC_DETECT_ARM_NEON +#ifdef WEBRTC_DETECT_NEON if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { FiltersTester(WebRtcIsacfix_AutocorrNeon); } -#elif defined(WEBRTC_ARCH_ARM_NEON) +#elif 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 2fba3e68d2..f8abc8a0bd 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.c @@ -198,8 +198,7 @@ int16_t WebRtcIsacfix_FreeInternal(ISACFIX_MainStruct *ISAC_main_inst) * This function initializes function pointers for ARM Neon platform. */ -#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON) || \ - (defined WEBRTC_ARCH_ARM64_NEON) +#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) static void WebRtcIsacfix_InitNeon(void) { WebRtcIsacfix_AutocorrFix = WebRtcIsacfix_AutocorrNeon; WebRtcIsacfix_FilterMaLoopFix = WebRtcIsacfix_FilterMaLoopNeon; @@ -208,7 +207,7 @@ static void WebRtcIsacfix_InitNeon(void) { // Disable AllpassFilter2FixDec16Neon function due to a clang bug. // Refer more details at: // https://code.google.com/p/webrtc/issues/detail?id=4567 -#if !(defined __clang__) +#if !defined(__clang__) || !defined(WEBRTC_ARCH_ARM64) WebRtcIsacfix_AllpassFilter2FixDec16 = WebRtcIsacfix_AllpassFilter2FixDec16Neon; #endif @@ -334,11 +333,11 @@ int16_t WebRtcIsacfix_EncoderInit(ISACFIX_MainStruct *ISAC_main_inst, WebRtcIsacfix_MatrixProduct1 = WebRtcIsacfix_MatrixProduct1C; WebRtcIsacfix_MatrixProduct2 = WebRtcIsacfix_MatrixProduct2C; -#ifdef WEBRTC_DETECT_ARM_NEON +#ifdef WEBRTC_DETECT_NEON if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { WebRtcIsacfix_InitNeon(); } -#elif defined(WEBRTC_ARCH_ARM_NEON) || defined(WEBRTC_ARCH_ARM64_NEON) +#elif defined(WEBRTC_HAS_NEON) WebRtcIsacfix_InitNeon(); #endif diff --git a/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c b/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c index 8018a120aa..c4024987de 100644 --- a/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c +++ b/webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.c @@ -9,11 +9,6 @@ */ #include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h" - -#ifdef WEBRTC_ARCH_ARM_NEON -#include -#endif - #include "webrtc/common_audio/signal_processing/include/signal_processing_library.h" #include "webrtc/system_wrappers/interface/compile_assert_c.h" 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 81bdff5e4f..362bc1acee 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 @@ -10,7 +10,7 @@ #include "webrtc/modules/audio_coding/codecs/isac/fix/source/pitch_estimator.h" -#ifdef WEBRTC_ARCH_ARM_NEON +#ifdef WEBRTC_HAS_NEON #include #endif @@ -56,7 +56,10 @@ void WebRtcIsacfix_PCorr2Q32(const int16_t* in, int32_t* logcorQ8) { ysum32 -= in[k - 1] * in[k - 1] >> scaling; ysum32 += in[PITCH_CORR_LEN2 + k - 1] * in[PITCH_CORR_LEN2 + k - 1] >> scaling; -#ifdef WEBRTC_ARCH_ARM_NEON + + // 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]; int32x4_t int_32x4_sum = vmovq_n_s32(0); 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 855b5feafd..dd5ab3290c 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 @@ -175,22 +175,22 @@ class TransformTest : public testing::Test { TEST_F(TransformTest, Time2SpecTest) { Time2SpecTester(WebRtcIsacfix_Time2SpecC); -#ifdef WEBRTC_DETECT_ARM_NEON +#ifdef WEBRTC_DETECT_NEON if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { Time2SpecTester(WebRtcIsacfix_Time2SpecNeon); } -#elif defined(WEBRTC_ARCH_ARM_NEON) +#elif defined(WEBRTC_HAS_NEON) Time2SpecTester(WebRtcIsacfix_Time2SpecNeon); #endif } TEST_F(TransformTest, Spec2TimeTest) { Spec2TimeTester(WebRtcIsacfix_Spec2TimeC); -#ifdef WEBRTC_DETECT_ARM_NEON +#ifdef WEBRTC_DETECT_NEON if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { Spec2TimeTester(WebRtcIsacfix_Spec2TimeNeon); } -#elif defined(WEBRTC_ARCH_ARM_NEON) +#elif defined(WEBRTC_HAS_NEON) Spec2TimeTester(WebRtcIsacfix_Spec2TimeNeon); #endif } diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc index 283595ee41..80ce082be5 100644 --- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc +++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest.cc @@ -555,7 +555,7 @@ class AcmReceiverBitExactness : public ::testing::Test { }; // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_8kHzOutput DISABLED_8kHzOutput #else #define MAYBE_8kHzOutput 8kHzOutput @@ -568,7 +568,7 @@ TEST_F(AcmReceiverBitExactness, MAYBE_8kHzOutput) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_16kHzOutput DISABLED_16kHzOutput #else #define MAYBE_16kHzOutput 16kHzOutput @@ -581,7 +581,7 @@ TEST_F(AcmReceiverBitExactness, MAYBE_16kHzOutput) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_32kHzOutput DISABLED_32kHzOutput #else #define MAYBE_32kHzOutput 32kHzOutput @@ -594,7 +594,7 @@ TEST_F(AcmReceiverBitExactness, MAYBE_32kHzOutput) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_48kHzOutput DISABLED_48kHzOutput #else #define MAYBE_48kHzOutput 48kHzOutput @@ -760,7 +760,7 @@ class AcmSenderBitExactness : public ::testing::Test, }; // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_IsacWb30ms DISABLED_IsacWb30ms #else #define MAYBE_IsacWb30ms IsacWb30ms @@ -780,7 +780,7 @@ TEST_F(AcmSenderBitExactness, MAYBE_IsacWb30ms) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_IsacWb60ms DISABLED_IsacWb60ms #else #define MAYBE_IsacWb60ms IsacWb60ms @@ -944,7 +944,7 @@ TEST_F(AcmSenderBitExactness, DISABLED_ON_ANDROID(G722_stereo_20ms)) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_Opus_stereo_20ms DISABLED_Opus_stereo_20ms #else #define MAYBE_Opus_stereo_20ms Opus_stereo_20ms diff --git a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc index c218c2bf38..929439ff77 100644 --- a/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc +++ b/webrtc/modules/audio_coding/main/acm2/audio_coding_module_unittest_oldapi.cc @@ -750,7 +750,7 @@ class AcmReceiverBitExactnessOldApi : public ::testing::Test { }; // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_8kHzOutput DISABLED_8kHzOutput #else #define MAYBE_8kHzOutput 8kHzOutput @@ -763,7 +763,7 @@ TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_8kHzOutput) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_16kHzOutput DISABLED_16kHzOutput #else #define MAYBE_16kHzOutput 16kHzOutput @@ -776,7 +776,7 @@ TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_16kHzOutput) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_32kHzOutput DISABLED_32kHzOutput #else #define MAYBE_32kHzOutput 32kHzOutput @@ -789,7 +789,7 @@ TEST_F(AcmReceiverBitExactnessOldApi, MAYBE_32kHzOutput) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_48kHzOutput DISABLED_48kHzOutput #else #define MAYBE_48kHzOutput 48kHzOutput @@ -976,7 +976,7 @@ class AcmSenderBitExactnessOldApi : public ::testing::Test, }; // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_IsacWb30ms DISABLED_IsacWb30ms #else #define MAYBE_IsacWb30ms IsacWb30ms @@ -996,7 +996,7 @@ TEST_F(AcmSenderBitExactnessOldApi, MAYBE_IsacWb30ms) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_IsacWb60ms DISABLED_IsacWb60ms #else #define MAYBE_IsacWb60ms IsacWb60ms @@ -1151,7 +1151,7 @@ TEST_F(AcmSenderBitExactnessOldApi, DISABLED_ON_ANDROID(G722_stereo_20ms)) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_Opus_stereo_20ms DISABLED_Opus_stereo_20ms #else #define MAYBE_Opus_stereo_20ms Opus_stereo_20ms @@ -1171,7 +1171,7 @@ TEST_F(AcmSenderBitExactnessOldApi, MAYBE_Opus_stereo_20ms) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4199 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_Opus_stereo_20ms_voip DISABLED_Opus_stereo_20ms_voip #else #define MAYBE_Opus_stereo_20ms_voip Opus_stereo_20ms_voip diff --git a/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc b/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc index 334a2fc4ba..1850807783 100644 --- a/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc +++ b/webrtc/modules/audio_coding/neteq/audio_decoder_unittest.cc @@ -538,7 +538,7 @@ TEST_F(AudioDecoderIsacSwbTest, EncodeDecode) { } // Fails Android ARM64. https://code.google.com/p/webrtc/issues/detail?id=4198 -#if defined(WEBRTC_ANDROID) && defined(__aarch64__) +#if defined(WEBRTC_ANDROID) && defined(WEBRTC_ARCH_ARM64) #define MAYBE_EncodeDecode DISABLED_EncodeDecode #else #define MAYBE_EncodeDecode EncodeDecode diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c index 4d59956dc8..374647d2d9 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.c +++ b/webrtc/modules/audio_processing/aec/aec_core.c @@ -1458,9 +1458,9 @@ int WebRtcAec_CreateAec(AecCore** aecInst) { WebRtcAec_InitAec_mips(); #endif -#if defined(WEBRTC_ARCH_ARM_NEON) +#if defined(WEBRTC_HAS_NEON) WebRtcAec_InitAec_neon(); -#elif defined(WEBRTC_DETECT_ARM_NEON) +#elif defined(WEBRTC_DETECT_NEON) if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { WebRtcAec_InitAec_neon(); } diff --git a/webrtc/modules/audio_processing/aec/aec_core.h b/webrtc/modules/audio_processing/aec/aec_core.h index cc9e81b443..d9335e322d 100644 --- a/webrtc/modules/audio_processing/aec/aec_core.h +++ b/webrtc/modules/audio_processing/aec/aec_core.h @@ -58,7 +58,7 @@ void WebRtcAec_InitAec_SSE2(void); #if defined(MIPS_FPU_LE) void WebRtcAec_InitAec_mips(void); #endif -#if defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON) +#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) void WebRtcAec_InitAec_neon(void); #endif diff --git a/webrtc/modules/audio_processing/aec/aec_core_neon.c b/webrtc/modules/audio_processing/aec/aec_core_neon.c index f8d0b2419b..9a677aaa67 100644 --- a/webrtc/modules/audio_processing/aec/aec_core_neon.c +++ b/webrtc/modules/audio_processing/aec/aec_core_neon.c @@ -78,7 +78,7 @@ static void FilterFarNEON(AecCore* aec, float yf[2][PART_LEN1]) { } // ARM64's arm_neon.h has already defined vdivq_f32 vsqrtq_f32. -#if !defined (WEBRTC_ARCH_ARM64_NEON) +#if !defined (WEBRTC_ARCH_ARM64) static float32x4_t vdivq_f32(float32x4_t a, float32x4_t b) { int i; float32x4_t x = vrecpeq_f32(b); @@ -120,7 +120,7 @@ static float32x4_t vsqrtq_f32(float32x4_t s) { // sqrt(s) = s * 1/sqrt(s) return vmulq_f32(s, x);; } -#endif // WEBRTC_ARCH_ARM64_NEON +#endif // WEBRTC_ARCH_ARM64 static void ScaleErrorSignalNEON(AecCore* aec, float ef[2][PART_LEN1]) { const float mu = aec->extended_filter_enabled ? kExtendedMu : aec->normal_mu; diff --git a/webrtc/modules/audio_processing/aec/aec_rdft.c b/webrtc/modules/audio_processing/aec/aec_rdft.c index 015617c937..2c3cff2df5 100644 --- a/webrtc/modules/audio_processing/aec/aec_rdft.c +++ b/webrtc/modules/audio_processing/aec/aec_rdft.c @@ -579,9 +579,9 @@ void aec_rdft_init(void) { #if defined(MIPS_FPU_LE) aec_rdft_init_mips(); #endif -#if defined(WEBRTC_ARCH_ARM_NEON) +#if defined(WEBRTC_HAS_NEON) aec_rdft_init_neon(); -#elif defined(WEBRTC_DETECT_ARM_NEON) +#elif defined(WEBRTC_DETECT_NEON) if ((WebRtc_GetCPUFeaturesARM() & kCPUFeatureNEON) != 0) { aec_rdft_init_neon(); } diff --git a/webrtc/modules/audio_processing/aec/aec_rdft.h b/webrtc/modules/audio_processing/aec/aec_rdft.h index 22f5dd1e89..18eb7a5c3f 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_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON) +#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) void aec_rdft_init_neon(void); #endif diff --git a/webrtc/modules/audio_processing/aecm/aecm_core.c b/webrtc/modules/audio_processing/aecm/aecm_core.c index 6741acba14..b124e30bcc 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core.c +++ b/webrtc/modules/audio_processing/aecm/aecm_core.c @@ -373,8 +373,7 @@ static void ResetAdaptiveChannelC(AecmCore* aecm) { } // Initialize function pointers for ARM Neon platform. -#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON || \ - defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON) static void WebRtcAecm_InitNeon(void) { WebRtcAecm_StoreAdaptiveChannel = WebRtcAecm_StoreAdaptiveChannelNeon; @@ -521,13 +520,13 @@ int WebRtcAecm_InitCore(AecmCore* const aecm, int samplingFreq) { WebRtcAecm_StoreAdaptiveChannel = StoreAdaptiveChannelC; WebRtcAecm_ResetAdaptiveChannel = ResetAdaptiveChannelC; -#ifdef WEBRTC_DETECT_ARM_NEON +#ifdef WEBRTC_DETECT_NEON uint64_t features = WebRtc_GetCPUFeaturesARM(); if ((features & kCPUFeatureNEON) != 0) { WebRtcAecm_InitNeon(); } -#elif defined(WEBRTC_ARCH_ARM_NEON) || defined(WEBRTC_ARCH_ARM64_NEON) +#elif 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 15614d67fa..5646e8f843 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core.h +++ b/webrtc/modules/audio_processing/aecm/aecm_core.h @@ -409,8 +409,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_ARM_NEON) || defined (WEBRTC_ARCH_ARM_NEON) || \ - defined (WEBRTC_ARCH_ARM64_NEON) +#if defined(WEBRTC_DETECT_NEON) || 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/aecm/aecm_core_c.c b/webrtc/modules/audio_processing/aecm/aecm_core_c.c index 3a06bb6690..eb2bd918c8 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core_c.c +++ b/webrtc/modules/audio_processing/aecm/aecm_core_c.c @@ -23,7 +23,7 @@ #include "webrtc/typedefs.h" // Square root of Hanning window in Q14. -#if defined(WEBRTC_DETECT_ARM_NEON) || defined(WEBRTC_ARCH_ARM_NEON) +#if defined(WEBRTC_DETECT_NEON) || defined(WEBRTC_HAS_NEON) // Table is defined in an ARM assembly file. extern const ALIGN8_BEG int16_t WebRtcAecm_kSqrtHanning[] ALIGN8_END; #else diff --git a/webrtc/modules/audio_processing/aecm/aecm_core_neon.c b/webrtc/modules/audio_processing/aecm/aecm_core_neon.c index 40c145a17e..1751fcf7ad 100644 --- a/webrtc/modules/audio_processing/aecm/aecm_core_neon.c +++ b/webrtc/modules/audio_processing/aecm/aecm_core_neon.c @@ -32,7 +32,7 @@ const ALIGN8_BEG int16_t WebRtcAecm_kSqrtHanning[] ALIGN8_END = { }; static inline void AddLanes(uint32_t* ptr, uint32x4_t v) { -#if defined(__aarch64__) +#if defined(WEBRTC_ARCH_ARM64) *(ptr) = vaddvq_u32(v); #else uint32x2_t tmp_v; diff --git a/webrtc/modules/audio_processing/ns/nsx_core.c b/webrtc/modules/audio_processing/ns/nsx_core.c index aa46d0867d..f6711b5be3 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/interface/cpu_features_wrapper.h" -#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON) +#if (defined WEBRTC_DETECT_NEON || 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_ARM_NEON || WEBRTC_ARCH_ARM_NEON +#endif // WEBRTC_DETECT_NEON || WEBRTC_HAS_NEON // Skip first frequency bins during estimation. (0 <= value < 64) static const int kStartBand = 5; @@ -557,8 +557,7 @@ AnalysisUpdate WebRtcNsx_AnalysisUpdate; Denormalize WebRtcNsx_Denormalize; NormalizeRealBuffer WebRtcNsx_NormalizeRealBuffer; -#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON || \ - defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON || defined WEBRTC_HAS_NEON) // Initialize function pointers for ARM Neon platform. static void WebRtcNsx_InitNeon(void) { WebRtcNsx_NoiseEstimation = WebRtcNsx_NoiseEstimationNeon; @@ -763,12 +762,12 @@ int32_t WebRtcNsx_InitCore(NoiseSuppressionFixedC* inst, uint32_t fs) { WebRtcNsx_Denormalize = DenormalizeC; WebRtcNsx_NormalizeRealBuffer = NormalizeRealBufferC; -#ifdef WEBRTC_DETECT_ARM_NEON +#ifdef WEBRTC_DETECT_NEON uint64_t features = WebRtc_GetCPUFeaturesARM(); if ((features & kCPUFeatureNEON) != 0) { WebRtcNsx_InitNeon(); } -#elif defined(WEBRTC_ARCH_ARM_NEON) || defined(WEBRTC_ARCH_ARM64_NEON) +#elif 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 8f0db6d016..33b9a32337 100644 --- a/webrtc/modules/audio_processing/ns/nsx_core.h +++ b/webrtc/modules/audio_processing/ns/nsx_core.h @@ -215,8 +215,7 @@ void WebRtcNsx_SpeechNoiseProb(NoiseSuppressionFixedC* inst, uint32_t* priorLocSnr, uint32_t* postLocSnr); -#if (defined WEBRTC_DETECT_ARM_NEON || defined WEBRTC_ARCH_ARM_NEON || \ - defined WEBRTC_ARCH_ARM64_NEON) +#if (defined WEBRTC_DETECT_NEON || 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/typedefs.h b/webrtc/typedefs.h index 8bcaa88f0e..3034c7e74a 100644 --- a/webrtc/typedefs.h +++ b/webrtc/typedefs.h @@ -55,8 +55,10 @@ #error Define either WEBRTC_ARCH_LITTLE_ENDIAN or WEBRTC_ARCH_BIG_ENDIAN #endif -#if (defined(WEBRTC_ARCH_X86_FAMILY) && !defined(__SSE2__)) || \ - (defined(WEBRTC_ARCH_ARM_V7) && !defined(WEBRTC_ARCH_ARM_NEON)) +// 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) #define WEBRTC_CPU_DETECTION #endif