OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include "webrtc/modules/audio_processing/aec3/aec3_fft.h" | 11 #include "webrtc/modules/audio_processing/aec3/aec3_fft.h" |
12 | 12 |
13 #include <algorithm> | 13 #include <algorithm> |
14 | 14 |
15 #include "webrtc/rtc_base/checks.h" | 15 #include "webrtc/base/checks.h" |
16 | 16 |
17 namespace webrtc { | 17 namespace webrtc { |
18 | 18 |
19 // TODO(peah): Change x to be std::array once the rest of the code allows this. | 19 // TODO(peah): Change x to be std::array once the rest of the code allows this. |
20 void Aec3Fft::ZeroPaddedFft(rtc::ArrayView<const float> x, FftData* X) const { | 20 void Aec3Fft::ZeroPaddedFft(rtc::ArrayView<const float> x, FftData* X) const { |
21 RTC_DCHECK(X); | 21 RTC_DCHECK(X); |
22 RTC_DCHECK_EQ(kFftLengthBy2, x.size()); | 22 RTC_DCHECK_EQ(kFftLengthBy2, x.size()); |
23 std::array<float, kFftLength> fft; | 23 std::array<float, kFftLength> fft; |
24 std::fill(fft.begin(), fft.begin() + kFftLengthBy2, 0.f); | 24 std::fill(fft.begin(), fft.begin() + kFftLengthBy2, 0.f); |
25 std::copy(x.begin(), x.end(), fft.begin() + kFftLengthBy2); | 25 std::copy(x.begin(), x.end(), fft.begin() + kFftLengthBy2); |
26 Fft(&fft, X); | 26 Fft(&fft, X); |
27 } | 27 } |
28 | 28 |
29 void Aec3Fft::PaddedFft(rtc::ArrayView<const float> x, | 29 void Aec3Fft::PaddedFft(rtc::ArrayView<const float> x, |
30 rtc::ArrayView<float> x_old, | 30 rtc::ArrayView<float> x_old, |
31 FftData* X) const { | 31 FftData* X) const { |
32 RTC_DCHECK(X); | 32 RTC_DCHECK(X); |
33 RTC_DCHECK_EQ(kFftLengthBy2, x.size()); | 33 RTC_DCHECK_EQ(kFftLengthBy2, x.size()); |
34 RTC_DCHECK_EQ(kFftLengthBy2, x_old.size()); | 34 RTC_DCHECK_EQ(kFftLengthBy2, x_old.size()); |
35 std::array<float, kFftLength> fft; | 35 std::array<float, kFftLength> fft; |
36 std::copy(x_old.begin(), x_old.end(), fft.begin()); | 36 std::copy(x_old.begin(), x_old.end(), fft.begin()); |
37 std::copy(x.begin(), x.end(), fft.begin() + x_old.size()); | 37 std::copy(x.begin(), x.end(), fft.begin() + x_old.size()); |
38 std::copy(x.begin(), x.end(), x_old.begin()); | 38 std::copy(x.begin(), x.end(), x_old.begin()); |
39 Fft(&fft, X); | 39 Fft(&fft, X); |
40 } | 40 } |
41 | 41 |
42 } // namespace webrtc | 42 } // namespace webrtc |
OLD | NEW |