Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(911)

Unified Diff: webrtc/modules/audio_processing/aec3/comfort_noise_generator.h

Issue 2678423005: Finalization of the first version of EchoCanceller 3 (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webrtc/modules/audio_processing/aec3/comfort_noise_generator.h
diff --git a/webrtc/modules/audio_processing/aec3/comfort_noise_generator.h b/webrtc/modules/audio_processing/aec3/comfort_noise_generator.h
new file mode 100644
index 0000000000000000000000000000000000000000..1a9d75d60ae283e69c45484bbdf1495b9dae45d8
--- /dev/null
+++ b/webrtc/modules/audio_processing/aec3/comfort_noise_generator.h
@@ -0,0 +1,54 @@
+/*
+ * 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_COMFORT_NOISE_GENERATOR_H_
+#define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_COMFORT_NOISE_GENERATOR_H_
+
+#include <stdio.h>
ivoc 2017/02/10 13:52:33 Is this needed? For the uin32_t you could use stdi
peah-webrtc 2017/02/20 07:37:15 Done.
+#include <memory>
+#include <vector>
ivoc 2017/02/10 13:52:34 Can be removed
peah-webrtc 2017/02/20 07:37:15 Done.
+
+#include "webrtc/base/array_view.h"
ivoc 2017/02/10 13:52:34 Looks like ArrayView is not used in this header, b
peah-webrtc 2017/02/20 07:37:15 I prefer array as it will give a compile-time warn
ivoc 2017/02/21 17:26:01 Ok, sounds good.
peah-webrtc 2017/02/21 23:00:39 Acknowledged.
+#include "webrtc/base/constructormagic.h"
+#include "webrtc/modules/audio_processing/aec3/aec3_constants.h"
+#include "webrtc/modules/audio_processing/aec3/fft_data.h"
+#include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
ivoc 2017/02/10 13:52:34 Is this used?
peah-webrtc 2017/02/20 07:37:15 Done.
+
+namespace webrtc {
+
+// Generates the comfort noise.
+class ComfortNoiseGenerator {
+ public:
+ ComfortNoiseGenerator();
+ ~ComfortNoiseGenerator();
+
+ // Computes the comfort noise.
+ void Compute(const std::array<float, kFftLengthBy2Plus1>& capture_spectrum,
ivoc 2017/02/10 13:52:34 #include <array> is missing.
peah-webrtc 2017/02/20 07:37:15 Done.
+ FftData* lower_band_noise,
+ FftData* upper_band_noise);
+
+ // Returns the estimate of the background noise spectrum.
+ const std::array<float, kFftLengthBy2Plus1>& NoiseSpectrum() const {
+ return N2_;
+ }
+
+ private:
+ uint32_t seed_;
+ std::unique_ptr<std::array<float, kFftLengthBy2Plus1>> N2_initial_;
+ std::array<float, kFftLengthBy2Plus1> Y2_smoothed_;
+ std::array<float, kFftLengthBy2Plus1> N2_;
+ int N2_counter_ = 0;
+
+ RTC_DISALLOW_COPY_AND_ASSIGN(ComfortNoiseGenerator);
+};
+
+} // namespace webrtc
+
+#endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_COMFORT_NOISE_GENERATOR_H_

Powered by Google App Engine
This is Rietveld 408576698