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

Unified Diff: webrtc/modules/audio_processing/test/audio_processing_simulator.cc

Issue 2486763002: Add support to audioproc_f for running the residual echo detector and producing an echo likelihood … (Closed)
Patch Set: Initial version Created 4 years, 1 month 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/test/audio_processing_simulator.cc
diff --git a/webrtc/modules/audio_processing/test/audio_processing_simulator.cc b/webrtc/modules/audio_processing/test/audio_processing_simulator.cc
index 778b347091d82a9270a2904e8c4d329061df60c2..89667223ee471d07cb8fb4b15e61aa1f45b53afa 100644
--- a/webrtc/modules/audio_processing/test/audio_processing_simulator.cc
+++ b/webrtc/modules/audio_processing/test/audio_processing_simulator.cc
@@ -61,9 +61,30 @@ void CopyToAudioFrame(const ChannelBuffer<float>& src, AudioFrame* dest) {
AudioProcessingSimulator::AudioProcessingSimulator(
const SimulationSettings& settings)
- : settings_(settings) {}
+ : settings_(settings) {
+ if (settings_.red_graph_output_filename &&
+ settings_.red_graph_output_filename->size() > 0) {
+ residual_echo_likelihood_graph_.open(*settings_.red_graph_output_filename);
+ residual_echo_likelihood_graph_ << "import numpy as np" << std::endl
peah-webrtc 2016/11/10 10:47:10 Would it be possible to abstract this printout int
ivoc 2016/11/10 15:36:08 Ok, done.
+ << "import matplotlib.pyplot as plt"
+ << std::endl
+ << "y = np.array([";
+ }
+}
-AudioProcessingSimulator::~AudioProcessingSimulator() = default;
+AudioProcessingSimulator::~AudioProcessingSimulator() {
+ if (residual_echo_likelihood_graph_.is_open()) {
+ residual_echo_likelihood_graph_ << "])" << std::endl
peah-webrtc 2016/11/10 10:47:09 Would it be possible to abstract this printout int
ivoc 2016/11/10 15:36:08 Done.
+ << "x = np.arange(len(y))*.01" << std::endl
+ << "plt.plot(x, y)" << std::endl
+ << "plt.ylabel('Echo likelihood')"
+ << std::endl
+ << "plt.xlabel('Time (s)')" << std::endl
+ << "plt.ylim([0,1])" << std::endl
+ << "plt.show()" << std::endl;
+ residual_echo_likelihood_graph_.close();
+ }
+}
AudioProcessingSimulator::ScopedTimer::~ScopedTimer() {
int64_t interval = rtc::TimeNanos() - start_time_;
@@ -90,6 +111,11 @@ void AudioProcessingSimulator::ProcessStream(bool fixed_interface) {
buffer_writer_->Write(*out_buf_);
}
+ if (residual_echo_likelihood_graph_.is_open()) {
+ auto stats = ap_->GetStatistics();
+ residual_echo_likelihood_graph_ << stats.residual_echo_likelihood << ", ";
+ }
+
++num_process_stream_calls_;
}
@@ -245,6 +271,9 @@ void AudioProcessingSimulator::CreateAudioProcessor() {
!settings_.use_extended_filter || *settings_.use_extended_filter));
config.Set<DelayAgnostic>(new DelayAgnostic(!settings_.use_delay_agnostic ||
*settings_.use_delay_agnostic));
+ if (settings_.use_red) {
+ apm_config.residual_echo_detector.enabled = *settings_.use_red;
+ }
ap_.reset(AudioProcessing::Create(config));
RTC_CHECK(ap_);

Powered by Google App Engine
This is Rietveld 408576698