diff --git a/webrtc/common_audio/resampler/sinc_resampler.cc b/webrtc/common_audio/resampler/sinc_resampler.cc index 94e18a822b..5029934684 100644 --- a/webrtc/common_audio/resampler/sinc_resampler.cc +++ b/webrtc/common_audio/resampler/sinc_resampler.cc @@ -114,13 +114,12 @@ static double SincScaleFactor(double io_ratio) { } // If we know the minimum architecture at compile time, avoid CPU detection. -// iOS lies about its architecture, so we also need to exclude it here. -#if defined(WEBRTC_ARCH_X86_FAMILY) && !defined(WEBRTC_IOS) -#if defined(__SSE__) +#if defined(WEBRTC_ARCH_X86_FAMILY) +#if defined(__SSE2__) #define CONVOLVE_FUNC Convolve_SSE void SincResampler::InitializeCPUSpecificFeatures() {} #else -// X86 CPU detection required. Function will be set by +// x86 CPU detection required. Function will be set by // InitializeCPUSpecificFeatures(). // TODO(dalecurtis): Once Chrome moves to an SSE baseline this can be removed. #define CONVOLVE_FUNC convolve_proc_ @@ -134,7 +133,7 @@ void SincResampler::InitializeCPUSpecificFeatures() { #define CONVOLVE_FUNC Convolve_NEON void SincResampler::InitializeCPUSpecificFeatures() {} #else -// NEON CPU detection required. Function will be set by +// ARM CPU detection required. Function will be set by // InitializeCPUSpecificFeatures(). #define CONVOLVE_FUNC convolve_proc_ @@ -165,12 +164,12 @@ SincResampler::SincResampler(double io_sample_rate_ratio, AlignedMalloc(sizeof(float) * kKernelStorageSize, 16))), input_buffer_(static_cast( AlignedMalloc(sizeof(float) * input_buffer_size_, 16))), -#if defined(WEBRTC_RESAMPLER_CPU_DETECTION) +#if defined(WEBRTC_CPU_DETECTION) convolve_proc_(NULL), #endif r1_(input_buffer_.get()), r2_(input_buffer_.get() + kKernelSize / 2) { -#if defined(WEBRTC_RESAMPLER_CPU_DETECTION) +#if defined(WEBRTC_CPU_DETECTION) InitializeCPUSpecificFeatures(); assert(convolve_proc_); #endif diff --git a/webrtc/common_audio/resampler/sinc_resampler.h b/webrtc/common_audio/resampler/sinc_resampler.h index bdfefdcb86..8f4d079c09 100644 --- a/webrtc/common_audio/resampler/sinc_resampler.h +++ b/webrtc/common_audio/resampler/sinc_resampler.h @@ -20,13 +20,6 @@ #include "webrtc/test/testsupport/gtest_prod_util.h" #include "webrtc/typedefs.h" -#if (defined(WEBRTC_ARCH_X86_FAMILY) && !defined(WEBRTC_IOS) && \ - !defined(__SSE__)) || \ - (defined(WEBRTC_ARCH_ARM_V7) && !defined(WEBRTC_ARCH_ARM_NEON)) -// Convenience define. -#define WEBRTC_RESAMPLER_CPU_DETECTION -#endif - namespace webrtc { // Callback class for providing more data into the resampler. Expects |frames| @@ -106,9 +99,8 @@ class SincResampler { void InitializeCPUSpecificFeatures(); // Compute convolution of |k1| and |k2| over |input_ptr|, resultant sums are - // linearly interpolated using |kernel_interpolation_factor|. On x86, the - // underlying implementation is chosen at run time based on SSE support. On - // ARM, NEON support is chosen at compile time based on compilation flags. + // linearly interpolated using |kernel_interpolation_factor|. On x86 and ARM + // the underlying implementation is chosen at run time. static float Convolve_C(const float* input_ptr, const float* k1, const float* k2, double kernel_interpolation_factor); #if defined(WEBRTC_ARCH_X86_FAMILY) @@ -157,7 +149,7 @@ class SincResampler { // TODO(ajm): Move to using a global static which must only be initialized // once by the user. We're not doing this initially, because we don't have // e.g. a LazyInstance helper in webrtc. -#if defined(WEBRTC_RESAMPLER_CPU_DETECTION) +#if defined(WEBRTC_CPU_DETECTION) typedef float (*ConvolveProc)(const float*, const float*, const float*, double); ConvolveProc convolve_proc_; diff --git a/webrtc/typedefs.h b/webrtc/typedefs.h index 3e3144e858..fc43c9af93 100644 --- a/webrtc/typedefs.h +++ b/webrtc/typedefs.h @@ -60,8 +60,9 @@ #error Define either WEBRTC_ARCH_LITTLE_ENDIAN or WEBRTC_ARCH_BIG_ENDIAN #endif -#if defined(__SSE2__) || defined(_MSC_VER) -#define WEBRTC_USE_SSE2 +#if (defined(WEBRTC_ARCH_X86_FAMILY) && !defined(__SSE2__)) || \ + (defined(WEBRTC_ARCH_ARM_V7) && !defined(WEBRTC_ARCH_ARM_NEON)) +#define WEBRTC_CPU_DETECTION #endif #if !defined(_MSC_VER)