aec3: Support AVX2/FMA intrinsics in AEC3

Bug: webrtc:11663
Change-Id: Ib75eb616ef0cb62698b0d96af7ebe42e93825222
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/179006
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Sam Zackrisson <saza@webrtc.org>
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#32023}
This commit is contained in:
Zhaoliang Ma
2020-08-31 10:20:47 +08:00
committed by Commit Bot
parent 090049c546
commit e537e9ca13
21 changed files with 945 additions and 19 deletions

View File

@ -19,7 +19,7 @@ namespace webrtc {
#if defined(WEBRTC_ARCH_X86_FAMILY)
// Verifies that the optimized methods are bitexact to their reference
// counterparts.
TEST(FftData, TestOptimizations) {
TEST(FftData, TestSse2Optimizations) {
if (WebRtc_GetCPUInfo(kSSE2) != 0) {
FftData x;
@ -39,6 +39,29 @@ TEST(FftData, TestOptimizations) {
EXPECT_EQ(spectrum, spectrum_sse2);
}
}
// Verifies that the optimized methods are bitexact to their reference
// counterparts.
TEST(FftData, TestAvx2Optimizations) {
if (WebRtc_GetCPUInfo(kAVX2) != 0) {
FftData x;
for (size_t k = 0; k < x.re.size(); ++k) {
x.re[k] = k + 1;
}
x.im[0] = x.im[x.im.size() - 1] = 0.f;
for (size_t k = 1; k < x.im.size() - 1; ++k) {
x.im[k] = 2.f * (k + 1);
}
std::array<float, kFftLengthBy2Plus1> spectrum;
std::array<float, kFftLengthBy2Plus1> spectrum_avx2;
x.Spectrum(Aec3Optimization::kNone, spectrum);
x.Spectrum(Aec3Optimization::kAvx2, spectrum_avx2);
EXPECT_EQ(spectrum, spectrum_avx2);
}
}
#endif
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)