1 /* 2 * Copyright (c) 2020 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #include "modules/audio_processing/aec3/adaptive_fir_filter_erl.h" 12 13 #include <immintrin.h> 14 15 namespace webrtc { 16 17 namespace aec3 { 18 19 // Computes and stores the echo return loss estimate of the filter, which is the 20 // sum of the partition frequency responses. ErlComputer_AVX2(const std::vector<std::array<float,kFftLengthBy2Plus1>> & H2,rtc::ArrayView<float> erl)21void ErlComputer_AVX2( 22 const std::vector<std::array<float, kFftLengthBy2Plus1>>& H2, 23 rtc::ArrayView<float> erl) { 24 std::fill(erl.begin(), erl.end(), 0.f); 25 for (auto& H2_j : H2) { 26 for (size_t k = 0; k < kFftLengthBy2; k += 8) { 27 const __m256 H2_j_k = _mm256_loadu_ps(&H2_j[k]); 28 __m256 erl_k = _mm256_loadu_ps(&erl[k]); 29 erl_k = _mm256_add_ps(erl_k, H2_j_k); 30 _mm256_storeu_ps(&erl[k], erl_k); 31 } 32 erl[kFftLengthBy2] += H2_j[kFftLengthBy2]; 33 } 34 } 35 36 } // namespace aec3 37 } // namespace webrtc 38