OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 E2_main.fill(1.f * 10000.f * 10000.f); | 107 E2_main.fill(1.f * 10000.f * 10000.f); |
108 Y2.fill(10.f * E2_main[0]); | 108 Y2.fill(10.f * E2_main[0]); |
109 for (size_t k = 0; k < 1000; ++k) { | 109 for (size_t k = 0; k < 1000; ++k) { |
110 state.Update(converged_filter_frequency_response, rtc::Optional<size_t>(2), | 110 state.Update(converged_filter_frequency_response, rtc::Optional<size_t>(2), |
111 render_buffer, E2_main, Y2, x[0], false); | 111 render_buffer, E2_main, Y2, x[0], false); |
112 } | 112 } |
113 ASSERT_TRUE(state.UsableLinearEstimate()); | 113 ASSERT_TRUE(state.UsableLinearEstimate()); |
114 { | 114 { |
115 const auto& erle = state.Erle(); | 115 const auto& erle = state.Erle(); |
116 EXPECT_EQ(erle[0], erle[1]); | 116 EXPECT_EQ(erle[0], erle[1]); |
117 for (size_t k = 1; k < erle.size() - 1; ++k) { | 117 constexpr size_t kLowFrequencyLimit = 32; |
| 118 for (size_t k = 1; k < kLowFrequencyLimit; ++k) { |
118 EXPECT_NEAR(k % 2 == 0 ? 8.f : 1.f, erle[k], 0.1); | 119 EXPECT_NEAR(k % 2 == 0 ? 8.f : 1.f, erle[k], 0.1); |
119 } | 120 } |
| 121 for (size_t k = kLowFrequencyLimit; k < erle.size() - 1; ++k) { |
| 122 EXPECT_NEAR(k % 2 == 0 ? 1.5f : 1.f, erle[k], 0.1); |
| 123 } |
120 EXPECT_EQ(erle[erle.size() - 2], erle[erle.size() - 1]); | 124 EXPECT_EQ(erle[erle.size() - 2], erle[erle.size() - 1]); |
121 } | 125 } |
122 | 126 |
123 E2_main.fill(1.f * 10000.f * 10000.f); | 127 E2_main.fill(1.f * 10000.f * 10000.f); |
124 Y2.fill(5.f * E2_main[0]); | 128 Y2.fill(5.f * E2_main[0]); |
125 for (size_t k = 0; k < 1000; ++k) { | 129 for (size_t k = 0; k < 1000; ++k) { |
126 state.Update(converged_filter_frequency_response, rtc::Optional<size_t>(2), | 130 state.Update(converged_filter_frequency_response, rtc::Optional<size_t>(2), |
127 render_buffer, E2_main, Y2, x[0], false); | 131 render_buffer, E2_main, Y2, x[0], false); |
128 } | 132 } |
129 | 133 |
130 ASSERT_TRUE(state.UsableLinearEstimate()); | 134 ASSERT_TRUE(state.UsableLinearEstimate()); |
131 { | 135 { |
132 const auto& erle = state.Erle(); | 136 const auto& erle = state.Erle(); |
133 EXPECT_EQ(erle[0], erle[1]); | 137 EXPECT_EQ(erle[0], erle[1]); |
134 for (size_t k = 1; k < erle.size() - 1; ++k) { | 138 constexpr size_t kLowFrequencyLimit = 32; |
| 139 for (size_t k = 1; k < kLowFrequencyLimit; ++k) { |
135 EXPECT_NEAR(k % 2 == 0 ? 5.f : 1.f, erle[k], 0.1); | 140 EXPECT_NEAR(k % 2 == 0 ? 5.f : 1.f, erle[k], 0.1); |
136 } | 141 } |
| 142 for (size_t k = kLowFrequencyLimit; k < erle.size() - 1; ++k) { |
| 143 EXPECT_NEAR(k % 2 == 0 ? 1.5f : 1.f, erle[k], 0.1); |
| 144 } |
137 EXPECT_EQ(erle[erle.size() - 2], erle[erle.size() - 1]); | 145 EXPECT_EQ(erle[erle.size() - 2], erle[erle.size() - 1]); |
138 } | 146 } |
139 } | 147 } |
140 | 148 |
141 // Verifies the a non-significant delay is correctly identified. | 149 // Verifies the a non-significant delay is correctly identified. |
142 TEST(AecState, NonSignificantDelay) { | 150 TEST(AecState, NonSignificantDelay) { |
143 AecState state; | 151 AecState state; |
144 RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 30, | 152 RenderBuffer render_buffer(Aec3Optimization::kNone, 3, 30, |
145 std::vector<size_t>(1, 30)); | 153 std::vector<size_t>(1, 30)); |
146 std::array<float, kFftLengthBy2Plus1> E2_main; | 154 std::array<float, kFftLengthBy2Plus1> E2_main; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 | 229 |
222 // Verify that the externally reported delay is properly unset when it is no | 230 // Verify that the externally reported delay is properly unset when it is no |
223 // longer present. | 231 // longer present. |
224 state.HandleEchoPathChange(EchoPathVariability(false, false)); | 232 state.HandleEchoPathChange(EchoPathVariability(false, false)); |
225 state.Update(frequency_response, rtc::Optional<size_t>(), render_buffer, | 233 state.Update(frequency_response, rtc::Optional<size_t>(), render_buffer, |
226 E2_main, Y2, x, false); | 234 E2_main, Y2, x, false); |
227 EXPECT_FALSE(state.ExternalDelay()); | 235 EXPECT_FALSE(state.ExternalDelay()); |
228 } | 236 } |
229 | 237 |
230 } // namespace webrtc | 238 } // namespace webrtc |
OLD | NEW |