Index: webrtc/modules/audio_processing/aec3/down_sampler_4khz.h |
diff --git a/webrtc/modules/audio_processing/aec3/down_sampler_4khz.h b/webrtc/modules/audio_processing/aec3/down_sampler_4khz.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..4eac67b84dc6f8dc8d1d15fb47ade34b905719b2 |
--- /dev/null |
+++ b/webrtc/modules/audio_processing/aec3/down_sampler_4khz.h |
@@ -0,0 +1,39 @@ |
+/* |
+ * 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_DOWN_SAMPLER_4KHZ_H_ |
+#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_DOWN_SAMPLER_4KHZ_H_ |
+ |
+#include "webrtc/base/array_view.h" |
+#include "webrtc/base/constructormagic.h" |
+#include "webrtc/modules/audio_processing/aec3/cascaded_biquad_filter.h" |
+ |
+namespace webrtc { |
+ |
+// Provides downsampling functionality to a 4 kHz rate. |
+class DownSampler4kHz { |
+ public: |
+ explicit DownSampler4kHz(int sample_rate_hz_); |
aleloi
2017/01/27 15:37:47
I suggest adding a comment that sample_rate_hz_ is
peah-webrtc
2017/02/02 14:04:47
Done.
|
+ |
+ // Downsamples the signal. |
aleloi
2017/01/27 15:37:47
I think assumptions about frame size should be doc
peah-webrtc
2017/02/02 14:04:46
I agree. This is a big drawback with ArrayView and
aleloi
2017/02/03 15:46:48
SGTM! Great that fixed-size array could be used!
peah-webrtc
2017/02/06 11:25:38
:-)
|
+ void DownSample(rtc::ArrayView<const float> in, rtc::ArrayView<float> out); |
+ |
+ // Returns the downsampling factor applied in the downsampler. |
+ int GetDownSamplingFactor() const { return down_sampling_factor_; } |
+ |
+ private: |
+ const int down_sampling_factor_; |
+ CascadedBiQuadFilter low_pass_filter_; |
+ |
+ RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(DownSampler4kHz); |
+}; |
+} // namespace webrtc |
+ |
+#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_DOWN_SAMPLER_4KHZ_H_ |