blob: c31552d38a7aefa9e31e53b8287a5464ffd78e3c [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.
Gustaf Ullbergee84d392019-09-10 09:36:43 +020030 void Decimate(const std::vector<std::vector<float>>& in,
31 bool downmix,
32 rtc::ArrayView<float> out);
peah21920892017-02-08 05:08:56 -080033
34 private:
Per Åhgren38e2d952017-11-17 14:54:28 +010035 const size_t down_sampling_factor_;
Gustaf Ullberg78b1c4a2018-05-25 10:12:58 +020036 CascadedBiQuadFilter anti_aliasing_filter_;
37 CascadedBiQuadFilter noise_reduction_filter_;
peah21920892017-02-08 05:08:56 -080038
Per Åhgren38e2d952017-11-17 14:54:28 +010039 RTC_DISALLOW_COPY_AND_ASSIGN(Decimator);
peah21920892017-02-08 05:08:56 -080040};
41} // namespace webrtc
42
Per Åhgren38e2d952017-11-17 14:54:28 +010043#endif // MODULES_AUDIO_PROCESSING_AEC3_DECIMATOR_H_