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

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

Issue 2784023002: Major AEC3 render pipeline changes (Closed)
Patch Set: Disabled one more DEATH test that caused issues due to bug on bots Created 3 years, 8 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/power_echo_model_unittest.cc
diff --git a/webrtc/modules/audio_processing/aec3/power_echo_model_unittest.cc b/webrtc/modules/audio_processing/aec3/power_echo_model_unittest.cc
index 019be60389e5db1ce9f34e7e1a6895a0760a3864..f3c3634cb7bc7f9b976ae5c5c0211815c2c6f2ca 100644
--- a/webrtc/modules/audio_processing/aec3/power_echo_model_unittest.cc
+++ b/webrtc/modules/audio_processing/aec3/power_echo_model_unittest.cc
@@ -24,16 +24,6 @@
#include "webrtc/test/gtest.h"
namespace webrtc {
-namespace {
-
-std::string ProduceDebugText(size_t delay, bool known_delay) {
- std::ostringstream ss;
- ss << "True delay: " << delay;
- ss << ", Delay known: " << (known_delay ? "true" : "false");
- return ss.str();
-}
-
-} // namespace
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
@@ -42,92 +32,14 @@ TEST(PowerEchoModel, NullEstimateEchoOutput) {
PowerEchoModel model;
std::array<float, kFftLengthBy2Plus1> Y2;
AecState aec_state;
- FftBuffer X_buffer(Aec3Optimization::kNone, model.MinFarendBufferLength(),
- std::vector<size_t>(1, model.MinFarendBufferLength()));
+ RenderBuffer X_buffer(Aec3Optimization::kNone, 3,
+ model.MinFarendBufferLength(),
+ std::vector<size_t>(1, model.MinFarendBufferLength()));
EXPECT_DEATH(model.EstimateEcho(X_buffer, Y2, aec_state, nullptr), "");
}
#endif
-TEST(PowerEchoModel, BasicSetup) {
- PowerEchoModel model;
- Random random_generator(42U);
- AecState aec_state;
- Aec3Fft fft;
- std::array<float, kFftLengthBy2Plus1> Y2;
- std::array<float, kFftLengthBy2Plus1> S2;
- std::array<float, kFftLengthBy2Plus1> E2_main;
- std::array<float, kFftLengthBy2Plus1> E2_shadow;
- std::array<float, kBlockSize> x_old;
- std::array<float, kBlockSize> y;
- std::vector<float> x(kBlockSize, 0.f);
- FftData X;
- FftData Y;
- x_old.fill(0.f);
-
- FftBuffer X_buffer(Aec3Optimization::kNone, model.MinFarendBufferLength(),
- std::vector<size_t>(1, model.MinFarendBufferLength()));
-
- for (size_t delay_samples : {0, 64, 301}) {
- DelayBuffer<float> delay_buffer(delay_samples);
- auto model_applier = [&](int num_iterations, float y_scale,
- bool known_delay) {
- for (int k = 0; k < num_iterations; ++k) {
- RandomizeSampleVector(&random_generator, x);
- delay_buffer.Delay(x, y);
- std::for_each(y.begin(), y.end(), [&](float& a) { a *= y_scale; });
-
- fft.PaddedFft(x, x_old, &X);
- X_buffer.Insert(X);
-
- fft.ZeroPaddedFft(y, &Y);
- Y.Spectrum(Aec3Optimization::kNone, &Y2);
-
- aec_state.Update(std::vector<std::array<float, kFftLengthBy2Plus1>>(
- 10, std::array<float, kFftLengthBy2Plus1>()),
- known_delay ? rtc::Optional<size_t>(delay_samples)
- : rtc::Optional<size_t>(),
- X_buffer, E2_main, E2_shadow, Y2, x,
- EchoPathVariability(false, false), false);
-
- model.EstimateEcho(X_buffer, Y2, aec_state, &S2);
- }
- };
-
- for (int j = 0; j < 2; ++j) {
- bool known_delay = j == 0;
- SCOPED_TRACE(ProduceDebugText(delay_samples, known_delay));
- // Verify that the echo path estimates converges downwards to a fairly
- // tight bound estimate.
- model_applier(600, 1.f, known_delay);
- for (size_t k = 1; k < S2.size() - 1; ++k) {
- EXPECT_LE(Y2[k], 2.f * S2[k]);
- }
-
- // Verify that stronger echo paths are detected immediately.
- model_applier(100, 10.f, known_delay);
- for (size_t k = 1; k < S2.size() - 1; ++k) {
- EXPECT_LE(Y2[k], 5.f * S2[k]);
- }
-
- // Verify that there is a delay until a weaker echo path is detected.
- model_applier(50, 100.f, known_delay);
- model_applier(50, 1.f, known_delay);
- for (size_t k = 1; k < S2.size() - 1; ++k) {
- EXPECT_LE(100.f * Y2[k], S2[k]);
- }
-
- // Verify that an echo path change causes the echo path estimate to be
- // reset.
- model_applier(600, 0.1f, known_delay);
- model.HandleEchoPathChange(EchoPathVariability(true, false));
- model_applier(50, 0.1f, known_delay);
- for (size_t k = 1; k < S2.size() - 1; ++k) {
- EXPECT_LE(10.f * Y2[k], S2[k]);
- }
- }
- }
-}
} // namespace webrtc
« no previous file with comments | « webrtc/modules/audio_processing/aec3/power_echo_model.cc ('k') | webrtc/modules/audio_processing/aec3/render_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698