blob: 3ccd292f0824c5e695e3c503485a7dc41c804967 [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>
Gustaf Ullbergee84d392019-09-10 09:36:43 +020015#include <vector>
peah21920892017-02-08 05:08:56 -080016
Mirko Bonadei92ea95e2017-09-15 06:47:31 +020017#include "api/array_view.h"
18#include "modules/audio_processing/aec3/aec3_common.h"
Per Åhgren0aefbf02019-08-23 21:29:17 +020019#include "modules/audio_processing/utility/cascaded_biquad_filter.h"
Steve Anton10542f22019-01-11 09:11:00 -080020#include "rtc_base/constructor_magic.h"
peah21920892017-02-08 05:08:56 -080021
22namespace webrtc {
23
Per Åhgren38e2d952017-11-17 14:54:28 +010024// Provides functionality for decimating a signal.
25class Decimator {
peah21920892017-02-08 05:08:56 -080026 public:
Per Åhgren38e2d952017-11-17 14:54:28 +010027 explicit Decimator(size_t down_sampling_factor);
peah21920892017-02-08 05:08:56 -080028
29 // Downsamples the signal.
Per Åhgren6a05bb12019-12-03 11:24:59 +010030 void Decimate(rtc::ArrayView<const float> in, rtc::ArrayView<float> out);
peah21920892017-02-08 05:08:56 -080031
32 private:
Per Åhgren38e2d952017-11-17 14:54:28 +010033 const size_t down_sampling_factor_;
Gustaf Ullberg78b1c4a2018-05-25 10:12:58 +020034 CascadedBiQuadFilter anti_aliasing_filter_;
35 CascadedBiQuadFilter noise_reduction_filter_;
peah21920892017-02-08 05:08:56 -080036
Per Åhgren38e2d952017-11-17 14:54:28 +010037 RTC_DISALLOW_COPY_AND_ASSIGN(Decimator);
peah21920892017-02-08 05:08:56 -080038};
39} // namespace webrtc
40
Per Åhgren38e2d952017-11-17 14:54:28 +010041#endif // MODULES_AUDIO_PROCESSING_AEC3_DECIMATOR_H_