| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 if (std::find(blocks_with_echo_path_changes.begin(), | 61 if (std::find(blocks_with_echo_path_changes.begin(), |
| 62 blocks_with_echo_path_changes.end(), | 62 blocks_with_echo_path_changes.end(), |
| 63 k) != blocks_with_echo_path_changes.end()) { | 63 k) != blocks_with_echo_path_changes.end()) { |
| 64 subtractor.HandleEchoPathChange(EchoPathVariability(true, true)); | 64 subtractor.HandleEchoPathChange(EchoPathVariability(true, true)); |
| 65 } | 65 } |
| 66 subtractor.Process(render_buffer, y, render_signal_analyzer, aec_state, | 66 subtractor.Process(render_buffer, y, render_signal_analyzer, aec_state, |
| 67 &output); | 67 &output); |
| 68 | 68 |
| 69 aec_state.HandleEchoPathChange(EchoPathVariability(false, false)); | 69 aec_state.HandleEchoPathChange(EchoPathVariability(false, false)); |
| 70 aec_state.Update(subtractor.FilterFrequencyResponse(), | 70 aec_state.Update(subtractor.FilterFrequencyResponse(), |
| 71 subtractor.FilterImpulseResponse(), |
| 71 rtc::Optional<size_t>(delay_samples / kBlockSize), | 72 rtc::Optional<size_t>(delay_samples / kBlockSize), |
| 72 render_buffer, E2_main, Y2, x[0], false); | 73 render_buffer, E2_main, Y2, x[0], output.s_main, false); |
| 73 } | 74 } |
| 74 | 75 |
| 75 const float output_power = std::inner_product( | 76 const float output_power = std::inner_product( |
| 76 output.e_main.begin(), output.e_main.end(), output.e_main.begin(), 0.f); | 77 output.e_main.begin(), output.e_main.end(), output.e_main.begin(), 0.f); |
| 77 const float y_power = std::inner_product(y.begin(), y.end(), y.begin(), 0.f); | 78 const float y_power = std::inner_product(y.begin(), y.end(), y.begin(), 0.f); |
| 78 if (y_power == 0.f) { | 79 if (y_power == 0.f) { |
| 79 ADD_FAILURE(); | 80 ADD_FAILURE(); |
| 80 return -1.0; | 81 return -1.0; |
| 81 } | 82 } |
| 82 return output_power / y_power; | 83 return output_power / y_power; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 for (size_t delay_samples : {0, 64, 150, 200, 301}) { | 163 for (size_t delay_samples : {0, 64, 150, 200, 301}) { |
| 163 SCOPED_TRACE(ProduceDebugText(delay_samples)); | 164 SCOPED_TRACE(ProduceDebugText(delay_samples)); |
| 164 | 165 |
| 165 float echo_to_nearend_power = RunSubtractorTest( | 166 float echo_to_nearend_power = RunSubtractorTest( |
| 166 100, delay_samples, false, blocks_with_echo_path_changes); | 167 100, delay_samples, false, blocks_with_echo_path_changes); |
| 167 EXPECT_NEAR(1.f, echo_to_nearend_power, 0.0000001f); | 168 EXPECT_NEAR(1.f, echo_to_nearend_power, 0.0000001f); |
| 168 } | 169 } |
| 169 } | 170 } |
| 170 | 171 |
| 171 } // namespace webrtc | 172 } // namespace webrtc |
| OLD | NEW |