blob: 9dd6b19473d584c04f2f0c93e3d6cb9e8fac1cb1 [file] [log] [blame]
peah21920892017-02-08 05:08:56 -08001/*
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 Åhgren38e2d952017-11-17 14:54:28 +010011#ifndef MODULES_AUDIO_PROCESSING_AEC3_DECIMATOR_H_
12#define MODULES_AUDIO_PROCESSING_AEC3_DECIMATOR_H_
peah21920892017-02-08 05:08:56 -080013
14#include <array>
15
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020016#include "api/array_view.h"
17#include "modules/audio_processing/aec3/aec3_common.h"
Per Åhgren0aefbf02019-08-23 21:29:17 +020018#include "modules/audio_processing/utility/cascaded_biquad_filter.h"
Steve Anton10542f22019-01-11 09:11:00 -080019#include "rtc_base/constructor_magic.h"
peah21920892017-02-08 05:08:56 -080020
21namespace webrtc {
22
Per Åhgren38e2d952017-11-17 14:54:28 +010023// Provides functionality for decimating a signal.
24class Decimator {
peah21920892017-02-08 05:08:56 -080025 public:
Per Åhgren38e2d952017-11-17 14:54:28 +010026 explicit Decimator(size_t down_sampling_factor);
peah21920892017-02-08 05:08:56 -080027
28 // Downsamples the signal.
peahcf02cf12017-04-05 14:18:07 -070029 void Decimate(rtc::ArrayView<const float> in, rtc::ArrayView<float> out);
peah21920892017-02-08 05:08:56 -080030
31 private:
Per Åhgren38e2d952017-11-17 14:54:28 +010032 const size_t down_sampling_factor_;
Gustaf Ullberg78b1c4a2018-05-25 10:12:58 +020033 CascadedBiQuadFilter anti_aliasing_filter_;
34 CascadedBiQuadFilter noise_reduction_filter_;
peah21920892017-02-08 05:08:56 -080035
Per Åhgren38e2d952017-11-17 14:54:28 +010036 RTC_DISALLOW_COPY_AND_ASSIGN(Decimator);
peah21920892017-02-08 05:08:56 -080037};
38} // namespace webrtc
39
Per Åhgren38e2d952017-11-17 14:54:28 +010040#endif // MODULES_AUDIO_PROCESSING_AEC3_DECIMATOR_H_