From 4543697b37554df546d3583fd54a206558dea2b8 Mon Sep 17 00:00:00 2001 From: Gustaf Ullberg Date: Fri, 13 Nov 2020 14:30:30 +0100 Subject: [PATCH] Set range of GetLinearAecOutput to [-1, 1] MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The output of GetLinearAecOutput is changed to have the range [-1, 1] instead of [-2^15, 2^15] to be more similar to other Audio Processing Module API functions. The "--linear_aec_output" of audioproc_f has been tested for bit-exactness. Bug: webrtc:12185 Change-Id: Id50d93fcfaee5c239f3eb73f99d0bd3533319518 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/193062 Reviewed-by: Per Ã…hgren Commit-Queue: Gustaf Ullberg Cr-Commit-Position: refs/heads/master@{#32604} --- modules/audio_processing/audio_processing_impl.cc | 4 ++-- modules/audio_processing/test/audio_processing_simulator.cc | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/modules/audio_processing/audio_processing_impl.cc b/modules/audio_processing/audio_processing_impl.cc index 56d7073ae67..37112f08886 100644 --- a/modules/audio_processing/audio_processing_impl.cc +++ b/modules/audio_processing/audio_processing_impl.cc @@ -1476,8 +1476,8 @@ bool AudioProcessingImpl::GetLinearAecOutput( rtc::ArrayView channel_view = rtc::ArrayView(linear_aec_buffer->channels_const()[ch], linear_aec_buffer->num_frames()); - std::copy(channel_view.begin(), channel_view.end(), - linear_output[ch].begin()); + FloatS16ToFloat(channel_view.data(), channel_view.size(), + linear_output[ch].data()); } return true; } diff --git a/modules/audio_processing/test/audio_processing_simulator.cc b/modules/audio_processing/test/audio_processing_simulator.cc index 403c6ee6491..40ca7d11b05 100644 --- a/modules/audio_processing/test/audio_processing_simulator.cc +++ b/modules/audio_processing/test/audio_processing_simulator.cc @@ -59,7 +59,6 @@ EchoCanceller3Config ReadAec3ConfigFromJsonFile(const std::string& filename) { return cfg; } - std::string GetIndexedOutputWavFilename(const std::string& wav_name, int counter) { rtc::StringBuilder ss; @@ -260,8 +259,8 @@ void AudioProcessingSimulator::ProcessStream(bool fixed_interface) { for (size_t k = 0; k < linear_aec_output_buf_[0].size(); ++k) { for (size_t ch = 0; ch < linear_aec_output_buf_.size(); ++ch) { RTC_CHECK_EQ(linear_aec_output_buf_[ch].size(), 160); - linear_aec_output_file_writer_->WriteSamples( - &linear_aec_output_buf_[ch][k], 1); + float sample = FloatToFloatS16(linear_aec_output_buf_[ch][k]); + linear_aec_output_file_writer_->WriteSamples(&sample, 1); } } }