Chromium Code Reviews| Index: webrtc/modules/audio_processing/aec3/adaptive_fir_filter.h |
| diff --git a/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.h b/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c23ea5d2981e334758f4eed3cb667909414527c2 |
| --- /dev/null |
| +++ b/webrtc/modules/audio_processing/aec3/adaptive_fir_filter.h |
| @@ -0,0 +1,77 @@ |
| +/* |
| + * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
| + * |
| + * Use of this source code is governed by a BSD-style license |
| + * that can be found in the LICENSE file in the root of the source |
| + * tree. An additional intellectual property rights grant can be found |
| + * in the file PATENTS. All contributing project authors may |
| + * be found in the AUTHORS file in the root of the source tree. |
| + */ |
| + |
| +#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_ADAPTIVE_FIR_FILTER_H_ |
| +#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_ADAPTIVE_FIR_FILTER_H_ |
| + |
| +#include <array> |
| +#include <memory> |
| +#include <vector> |
| + |
| +#include "webrtc/base/array_view.h" |
| +#include "webrtc/base/constructormagic.h" |
| +#include "webrtc/modules/audio_processing/aec3/aec3_constants.h" |
| +#include "webrtc/modules/audio_processing/aec3/aec3_fft.h" |
| +#include "webrtc/modules/audio_processing/aec3/fft_buffer.h" |
| +#include "webrtc/modules/audio_processing/aec3/fft_data.h" |
| +#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" |
|
hlundin-webrtc
2017/02/13 21:36:59
Forward declare.
peah-webrtc
2017/02/20 07:37:14
That does not work, as the data dumper functionali
hlundin-webrtc
2017/02/21 09:40:03
Acknowledged.
peah-webrtc
2017/02/21 23:00:39
Acknowledged.
|
| + |
| +namespace webrtc { |
| + |
| +// Provides an frequency domain adaptive filter functionality. |
|
hlundin-webrtc
2017/02/13 21:37:00
an -> a
peah-webrtc
2017/02/20 07:37:14
Done.
|
| +class AdaptiveFirFilter { |
| + public: |
| + AdaptiveFirFilter(size_t size_partitions, |
| + bool use_filter_statistics, |
| + ApmDataDumper* data_dumper); |
| + ~AdaptiveFirFilter(); |
| + // Produces the output of the filter. |
|
hlundin-webrtc
2017/02/13 21:37:00
I wouldn't mind a blank line after each method dec
peah-webrtc
2017/02/20 07:37:14
Done.
|
| + void Filter(const FftBuffer& X_buffer, FftData* S) const; |
| + // Adapts the filter |
|
hlundin-webrtc
2017/02/13 21:37:00
.
peah-webrtc
2017/02/20 07:37:14
Done.
|
| + void Adapt(const FftBuffer& X_buffer, const FftData& G); |
| + // Handles echo path change. |
|
hlundin-webrtc
2017/02/13 21:36:59
Can you say something more?
peah-webrtc
2017/02/20 07:37:14
Done.
|
| + void HandleEchoPathChange(); |
| + // Returns the filter size. |
| + size_t SizePartitions() const { return H_.size(); } |
| + // Returns the filter based echo return loss |
|
hlundin-webrtc
2017/02/13 21:36:59
.
peah-webrtc
2017/02/20 07:37:14
Done.
|
| + const std::array<float, kFftLengthBy2Plus1>& Erl() const { |
|
hlundin-webrtc
2017/02/13 21:37:00
Oh, so this method and the next both go down in fl
peah-webrtc
2017/02/20 07:37:14
Done.
|
| + RTC_DCHECK(erl_); |
|
hlundin-webrtc
2017/02/13 21:36:59
Improve the death here by supplying an explanation
peah-webrtc
2017/02/20 07:37:14
Done.
|
| + return *erl_; |
| + } |
| + // Returns the frequency responses for the filter partitions. |
| + const std::vector<std::array<float, kFftLengthBy2Plus1>>& |
| + FilterFrequencyResponse() const { |
| + RTC_DCHECK(H2_); |
|
hlundin-webrtc
2017/02/13 21:37:00
Explain.
peah-webrtc
2017/02/20 07:37:14
Done.
|
| + return *H2_; |
| + } |
| + void DumpFilter(const char* name) { |
| + for (auto& H : H_) { |
| + data_dumper_->DumpRaw( |
| + name, rtc::ArrayView<const float>(H.re.data(), kFftLengthBy2)); |
| + data_dumper_->DumpRaw( |
| + name, rtc::ArrayView<const float>(H.im.data(), kFftLengthBy2)); |
| + } |
| + } |
| + |
| + private: |
| + ApmDataDumper* const data_dumper_; |
| + const Aec3Fft fft_; |
| + std::vector<FftData> H_; |
| + std::unique_ptr<std::vector<std::array<float, kFftLengthBy2Plus1>>> H2_; |
| + std::unique_ptr<std::array<float, kFftLengthBy2Plus1>> erl_; |
| + static int instance_index_; |
| + size_t partition_to_constrain_ = 0; |
| + |
| + RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(AdaptiveFirFilter); |
| +}; |
| + |
| +} // namespace webrtc |
| + |
| +#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_ADAPTIVE_FIR_FILTER_H_ |