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

Unified Diff: webrtc/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc

Issue 2974583004: Transparency improvements in the echo canceller 3 (Closed)
Patch Set: Corrected wrong echo estimate vector in unittest Created 3 years, 5 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/adaptive_fir_filter_unittest.cc
diff --git a/webrtc/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc b/webrtc/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
index 474174c2ee915d00eefd28d1574a077146c6d4cf..32b20a4950444232a04d55f25cb00c10d92a2c18 100644
--- a/webrtc/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
+++ b/webrtc/modules/audio_processing/aec3/adaptive_fir_filter_unittest.cc
@@ -308,7 +308,8 @@ TEST(AdaptiveFirFilter, FilterAndAdapt) {
AecState aec_state(0.f);
RenderSignalAnalyzer render_signal_analyzer;
std::vector<float> e(kBlockSize, 0.f);
- std::array<float, kFftLength> s;
+ std::array<float, kFftLength> s_scratch;
+ std::array<float, kBlockSize> s;
FftData S;
FftData G;
FftData E;
@@ -348,20 +349,24 @@ TEST(AdaptiveFirFilter, FilterAndAdapt) {
render_signal_analyzer.Update(render_buffer, aec_state.FilterDelay());
filter.Filter(render_buffer, &S);
- fft.Ifft(S, &s);
- std::transform(y.begin(), y.end(), s.begin() + kFftLengthBy2, e.begin(),
+ fft.Ifft(S, &s_scratch);
+ std::transform(y.begin(), y.end(), s_scratch.begin() + kFftLengthBy2,
+ e.begin(),
[&](float a, float b) { return a - b * kScale; });
std::for_each(e.begin(), e.end(),
[](float& a) { a = rtc::SafeClamp(a, -32768.f, 32767.f); });
fft.ZeroPaddedFft(e, &E);
+ for (size_t k = 0; k < kBlockSize; ++k) {
+ s[k] = kScale * s_scratch[k + kFftLengthBy2];
+ }
gain.Compute(render_buffer, render_signal_analyzer, E,
filter.SizePartitions(), false, &G);
filter.Adapt(render_buffer, G);
aec_state.HandleEchoPathChange(EchoPathVariability(false, false));
aec_state.Update(filter.FilterFrequencyResponse(),
- rtc::Optional<size_t>(), render_buffer, E2_main, Y2,
- x[0], false);
+ filter.FilterImpulseResponse(), rtc::Optional<size_t>(),
+ render_buffer, E2_main, Y2, x[0], s, false);
}
// Verify that the filter is able to perform well.
EXPECT_LT(1000 * std::inner_product(e.begin(), e.end(), e.begin(), 0.f),
« no previous file with comments | « webrtc/modules/audio_processing/aec3/adaptive_fir_filter.cc ('k') | webrtc/modules/audio_processing/aec3/aec3_common.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698