Index: webrtc/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc |
diff --git a/webrtc/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc b/webrtc/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc |
index ee4e44a3e7bf65b6e87293c71243b70bc34cdca2..82850f80d646c494163231e1c0a1ef3decf23ca9 100644 |
--- a/webrtc/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc |
+++ b/webrtc/modules/audio_processing/aec3/shadow_filter_update_gain_unittest.cc |
@@ -10,9 +10,6 @@ |
#include "webrtc/modules/audio_processing/aec3/shadow_filter_update_gain.h" |
-// TODO(peah): Reactivate once the next CL has landed. |
-#if 0 |
- |
#include <algorithm> |
#include <numeric> |
#include <string> |
@@ -37,20 +34,20 @@ void RunFilterUpdateTest(int num_blocks_to_process, |
std::array<float, kBlockSize>* y_last_block, |
FftData* G_last_block) { |
ApmDataDumper data_dumper(42); |
- AdaptiveFirFilter main_filter(9, true, DetectOptimization(), &data_dumper); |
- AdaptiveFirFilter shadow_filter(9, true, DetectOptimization(), &data_dumper); |
+ AdaptiveFirFilter main_filter(9, DetectOptimization(), &data_dumper); |
+ AdaptiveFirFilter shadow_filter(9, DetectOptimization(), &data_dumper); |
Aec3Fft fft; |
- FftBuffer X_buffer(Aec3Optimization::kNone, main_filter.SizePartitions(), |
- std::vector<size_t>(1, main_filter.SizePartitions())); |
+ RenderBuffer render_buffer( |
+ Aec3Optimization::kNone, 3, main_filter.SizePartitions(), |
+ std::vector<size_t>(1, main_filter.SizePartitions())); |
std::array<float, kBlockSize> x_old; |
x_old.fill(0.f); |
ShadowFilterUpdateGain shadow_gain; |
Random random_generator(42U); |
- std::vector<float> x(kBlockSize, 0.f); |
+ std::vector<std::vector<float>> x(3, std::vector<float>(kBlockSize, 0.f)); |
std::vector<float> y(kBlockSize, 0.f); |
AecState aec_state; |
RenderSignalAnalyzer render_signal_analyzer; |
- FftData X; |
std::array<float, kFftLength> s; |
FftData S; |
FftData G; |
@@ -67,14 +64,13 @@ void RunFilterUpdateTest(int num_blocks_to_process, |
k) != blocks_with_saturation.end(); |
// Create the render signal. |
- RandomizeSampleVector(&random_generator, x); |
- delay_buffer.Delay(x, y); |
- fft.PaddedFft(x, x_old, &X); |
- X_buffer.Insert(X); |
+ RandomizeSampleVector(&random_generator, x[0]); |
+ delay_buffer.Delay(x[0], y); |
+ render_buffer.Insert(x); |
render_signal_analyzer.Update( |
- X_buffer, rtc::Optional<size_t>(delay_samples / kBlockSize)); |
+ render_buffer, rtc::Optional<size_t>(delay_samples / kBlockSize)); |
- shadow_filter.Filter(X_buffer, &S); |
+ shadow_filter.Filter(render_buffer, &S); |
fft.Ifft(S, &s); |
std::transform(y.begin(), y.end(), s.begin() + kFftLengthBy2, |
e_shadow.begin(), |
@@ -84,9 +80,9 @@ void RunFilterUpdateTest(int num_blocks_to_process, |
}); |
fft.ZeroPaddedFft(e_shadow, &E_shadow); |
- shadow_gain.Compute(X_buffer, render_signal_analyzer, E_shadow, |
+ shadow_gain.Compute(render_buffer, render_signal_analyzer, E_shadow, |
shadow_filter.SizePartitions(), saturation, &G); |
- shadow_filter.Adapt(X_buffer, G); |
+ shadow_filter.Adapt(render_buffer, G); |
} |
std::copy(e_shadow.begin(), e_shadow.end(), e_last_block->begin()); |
@@ -108,11 +104,12 @@ std::string ProduceDebugText(size_t delay) { |
// Verifies that the check for non-null output gain parameter works. |
TEST(ShadowFilterUpdateGain, NullDataOutputGain) { |
ApmDataDumper data_dumper(42); |
- FftBuffer X_buffer(Aec3Optimization::kNone, 1, std::vector<size_t>(1, 1)); |
+ RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 1, |
+ std::vector<size_t>(1, 1)); |
RenderSignalAnalyzer analyzer; |
FftData E; |
ShadowFilterUpdateGain gain; |
- EXPECT_DEATH(gain.Compute(X_buffer, analyzer, E, 1, false, nullptr), ""); |
+ EXPECT_DEATH(gain.Compute(render_buffer, analyzer, E, 1, false, nullptr), ""); |
} |
#endif |
@@ -188,5 +185,3 @@ TEST(ShadowFilterUpdateGain, SaturationBehavior) { |
} |
} // namespace webrtc |
- |
-#endif |