peah | 2192089 | 2017-02-08 05:08:56 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2017 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 | |
Per Åhgren | 38e2d95 | 2017-11-17 14:54:28 +0100 | [diff] [blame] | 11 | #ifndef MODULES_AUDIO_PROCESSING_AEC3_DECIMATOR_H_ |
| 12 | #define MODULES_AUDIO_PROCESSING_AEC3_DECIMATOR_H_ |
peah | 2192089 | 2017-02-08 05:08:56 -0800 | [diff] [blame] | 13 | |
| 14 | #include <array> |
| 15 | |
Mirko Bonadei | 92ea95e | 2017-09-15 06:47:31 +0200 | [diff] [blame] | 16 | #include "api/array_view.h" |
| 17 | #include "modules/audio_processing/aec3/aec3_common.h" |
Per Åhgren | 0aefbf0 | 2019-08-23 21:29:17 +0200 | [diff] [blame] | 18 | #include "modules/audio_processing/utility/cascaded_biquad_filter.h" |
Steve Anton | 10542f2 | 2019-01-11 09:11:00 -0800 | [diff] [blame] | 19 | #include "rtc_base/constructor_magic.h" |
peah | 2192089 | 2017-02-08 05:08:56 -0800 | [diff] [blame] | 20 | |
| 21 | namespace webrtc { |
| 22 | |
Per Åhgren | 38e2d95 | 2017-11-17 14:54:28 +0100 | [diff] [blame] | 23 | // Provides functionality for decimating a signal. |
| 24 | class Decimator { |
peah | 2192089 | 2017-02-08 05:08:56 -0800 | [diff] [blame] | 25 | public: |
Per Åhgren | 38e2d95 | 2017-11-17 14:54:28 +0100 | [diff] [blame] | 26 | explicit Decimator(size_t down_sampling_factor); |
peah | 2192089 | 2017-02-08 05:08:56 -0800 | [diff] [blame] | 27 | |
| 28 | // Downsamples the signal. |
peah | cf02cf1 | 2017-04-05 14:18:07 -0700 | [diff] [blame] | 29 | void Decimate(rtc::ArrayView<const float> in, rtc::ArrayView<float> out); |
peah | 2192089 | 2017-02-08 05:08:56 -0800 | [diff] [blame] | 30 | |
| 31 | private: |
Per Åhgren | 38e2d95 | 2017-11-17 14:54:28 +0100 | [diff] [blame] | 32 | const size_t down_sampling_factor_; |
Gustaf Ullberg | 78b1c4a | 2018-05-25 10:12:58 +0200 | [diff] [blame] | 33 | CascadedBiQuadFilter anti_aliasing_filter_; |
| 34 | CascadedBiQuadFilter noise_reduction_filter_; |
peah | 2192089 | 2017-02-08 05:08:56 -0800 | [diff] [blame] | 35 | |
Per Åhgren | 38e2d95 | 2017-11-17 14:54:28 +0100 | [diff] [blame] | 36 | RTC_DISALLOW_COPY_AND_ASSIGN(Decimator); |
peah | 2192089 | 2017-02-08 05:08:56 -0800 | [diff] [blame] | 37 | }; |
| 38 | } // namespace webrtc |
| 39 | |
Per Åhgren | 38e2d95 | 2017-11-17 14:54:28 +0100 | [diff] [blame] | 40 | #endif // MODULES_AUDIO_PROCESSING_AEC3_DECIMATOR_H_ |