Add SSE2 support for Windows.
The previous defines controlling SSE2 use assumed GCC. To fix this: - Import a chunk of defines to typedefs.h from Chrome's build_config.h, primarily to get WEBRTC_ARCH_X86_FAMILY. - Add a check derived from WebP to define WEBRTC_USE_SSE2. - Modify cpu_features.cc to work with MSVC. This code is borrowed from chrome/src/base/cpu.cc. - Change AEC defines to use WEBRTC_USE_SSE2. - Remove disable_sse2 check from aec.gyp. This is handled by WEBRTC_USE_SSE2. (Also remove a bit of unused code from aec_core.h) Review URL: http://webrtc-codereview.appspot.com/95008 git-svn-id: http://webrtc.googlecode.com/svn/trunk@299 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@@ -29,20 +29,14 @@
|
||||
'sources': [
|
||||
'../interface/echo_cancellation.h',
|
||||
'echo_cancellation.c',
|
||||
'aec_core.h',
|
||||
'aec_core.c',
|
||||
'aec_core_sse2.c',
|
||||
'aec_rdft.h',
|
||||
'aec_rdft.c',
|
||||
'aec_core.h',
|
||||
'resampler.c',
|
||||
'aec_rdft_sse2.c',
|
||||
'resampler.h',
|
||||
],
|
||||
'conditions': [
|
||||
['disable_sse2 == 0 and (target_arch == "ia32" or target_arch == "x64")', {
|
||||
'sources': [
|
||||
'aec_core_sse2.c',
|
||||
'aec_rdft_sse2.c',
|
||||
],
|
||||
}],
|
||||
'resampler.c',
|
||||
],
|
||||
},
|
||||
],
|
||||
|
||||
@@ -468,7 +468,7 @@ int WebRtcAec_InitAec(aec_t *aec, int sampFreq)
|
||||
WebRtcAec_FilterAdaptation = FilterAdaptation;
|
||||
WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppress;
|
||||
if (WebRtc_GetCPUInfo(kSSE2)) {
|
||||
#if defined(__SSE2__)
|
||||
#if defined(WEBRTC_USE_SSE2)
|
||||
WebRtcAec_InitAec_SSE2();
|
||||
#endif
|
||||
}
|
||||
@@ -561,8 +561,8 @@ void WebRtcAec_ProcessFrame(aec_t *aec, const short *farend,
|
||||
}
|
||||
|
||||
static void ProcessBlock(aec_t *aec, const short *farend,
|
||||
const short *nearend, const short *nearendH,
|
||||
short *output, short *outputH)
|
||||
const short *nearend, const short *nearendH,
|
||||
short *output, short *outputH)
|
||||
{
|
||||
int i;
|
||||
float d[PART_LEN], y[PART_LEN], e[PART_LEN], dH[PART_LEN];
|
||||
@@ -601,7 +601,6 @@ static void ProcessBlock(aec_t *aec, const short *farend,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
memcpy(fft, aec->xBuf, sizeof(float) * PART_LEN2);
|
||||
memcpy(aec->dBuf + PART_LEN, d, sizeof(float) * PART_LEN);
|
||||
// For H band
|
||||
|
||||
@@ -16,8 +16,9 @@
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_SOURCE_AEC_CORE_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include "typedefs.h"
|
||||
|
||||
#include "signal_processing_library.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
//#define G167 // for running G167 tests
|
||||
//#define UNCONSTR // time-unconstrained filter
|
||||
@@ -92,21 +93,13 @@ typedef struct {
|
||||
float dMinPow[PART_LEN1];
|
||||
float dInitMinPow[PART_LEN1];
|
||||
float *noisePow;
|
||||
#ifdef FFTW
|
||||
float fftR[PART_LEN2];
|
||||
fftw_complex fftC[PART_LEN2];
|
||||
fftw_plan fftPlan, ifftPlan;
|
||||
|
||||
fftw_complex xfBuf[NR_PART * PART_LEN1];
|
||||
fftw_complex wfBuf[NR_PART * PART_LEN1];
|
||||
fftw_complex sde[PART_LEN1];
|
||||
#else
|
||||
float xfBuf[2][NR_PART * PART_LEN1]; // farend fft buffer
|
||||
float wfBuf[2][NR_PART * PART_LEN1]; // filter fft
|
||||
complex_t sde[PART_LEN1]; // cross-psd of nearend and error
|
||||
complex_t sxd[PART_LEN1]; // cross-psd of farend and nearend
|
||||
complex_t xfwBuf[NR_PART * PART_LEN1]; // farend windowed fft buffer
|
||||
#endif
|
||||
|
||||
float sx[PART_LEN1], sd[PART_LEN1], se[PART_LEN1]; // far, near and error psd
|
||||
float hNs[PART_LEN1];
|
||||
float hNlFbMin, hNlFbLocalMin;
|
||||
@@ -169,8 +162,6 @@ typedef void (*WebRtcAec_FilterFar_t)(aec_t *aec, float yf[2][PART_LEN1]);
|
||||
extern WebRtcAec_FilterFar_t WebRtcAec_FilterFar;
|
||||
typedef void (*WebRtcAec_ScaleErrorSignal_t)(aec_t *aec, float ef[2][PART_LEN1]);
|
||||
extern WebRtcAec_ScaleErrorSignal_t WebRtcAec_ScaleErrorSignal;
|
||||
#define IP_LEN PART_LEN // this must be at least ceil(2 + sqrt(PART_LEN))
|
||||
#define W_LEN PART_LEN
|
||||
typedef void (*WebRtcAec_FilterAdaptation_t)
|
||||
(aec_t *aec, float *fft, float ef[2][PART_LEN1]);
|
||||
extern WebRtcAec_FilterAdaptation_t WebRtcAec_FilterAdaptation;
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
* The core AEC algorithm, SSE2 version of speed-critical functions.
|
||||
*/
|
||||
|
||||
#if defined(__SSE2__)
|
||||
#include "typedefs.h"
|
||||
|
||||
#if defined(WEBRTC_USE_SSE2)
|
||||
#include <emmintrin.h>
|
||||
#include <math.h>
|
||||
|
||||
@@ -210,14 +212,6 @@ static void FilterAdaptationSSE2(aec_t *aec, float *fft, float ef[2][PART_LEN1])
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER /* visual c++ */
|
||||
# define ALIGN16_BEG __declspec(align(16))
|
||||
# define ALIGN16_END
|
||||
#else /* gcc or icc */
|
||||
# define ALIGN16_BEG
|
||||
# define ALIGN16_END __attribute__((aligned(16)))
|
||||
#endif
|
||||
|
||||
static __m128 mm_pow_ps(__m128 a, __m128 b)
|
||||
{
|
||||
// a^b = exp2(b * log2(a))
|
||||
@@ -432,4 +426,4 @@ void WebRtcAec_InitAec_SSE2(void) {
|
||||
WebRtcAec_OverdriveAndSuppress = OverdriveAndSuppressSSE2;
|
||||
}
|
||||
|
||||
#endif //__SSE2__
|
||||
#endif // WEBRTC_USE_SSE2
|
||||
|
||||
@@ -19,10 +19,12 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#include "aec_rdft.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "aec_rdft.h"
|
||||
#include "system_wrappers/interface/cpu_features_wrapper.h"
|
||||
#include "typedefs.h"
|
||||
|
||||
// constants shared by all paths (C, SSE2).
|
||||
float rdft_w[64];
|
||||
@@ -571,7 +573,7 @@ void aec_rdft_init(void) {
|
||||
rftfsub_128 = rftfsub_128_C;
|
||||
rftbsub_128 = rftbsub_128_C;
|
||||
if (WebRtc_GetCPUInfo(kSSE2)) {
|
||||
#if defined(__SSE2__)
|
||||
#if defined(WEBRTC_USE_SSE2)
|
||||
aec_rdft_init_sse2();
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_SOURCE_AEC_RDFT_H_
|
||||
#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_SOURCE_AEC_RDFT_H_
|
||||
|
||||
#ifdef _MSC_VER /* visual c++ */
|
||||
# define ALIGN16_BEG __declspec(align(16))
|
||||
# define ALIGN16_END
|
||||
@@ -40,3 +43,5 @@ void aec_rdft_init(void);
|
||||
void aec_rdft_init_sse2(void);
|
||||
void aec_rdft_forward_128(float *a);
|
||||
void aec_rdft_inverse_128(float *a);
|
||||
|
||||
#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC_MAIN_SOURCE_AEC_RDFT_H_
|
||||
|
||||
@@ -8,7 +8,9 @@
|
||||
* be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
|
||||
#if defined(__SSE2__)
|
||||
#include "typedefs.h"
|
||||
|
||||
#if defined(WEBRTC_USE_SSE2)
|
||||
#include <emmintrin.h>
|
||||
|
||||
#include "aec_rdft.h"
|
||||
@@ -261,4 +263,4 @@ void aec_rdft_init_sse2(void) {
|
||||
rftbsub_128 = rftbsub_128_SSE2;
|
||||
}
|
||||
|
||||
#endif // __SSE2__
|
||||
#endif // WEBRTC_USE_SS2
|
||||
|
||||
Reference in New Issue
Block a user