| 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 #include "webrtc/modules/audio_processing/aec3/echo_path_delay_estimator.h" | 10 #include "webrtc/modules/audio_processing/aec3/echo_path_delay_estimator.h" |
| 11 | 11 |
| 12 #include <algorithm> | 12 #include <algorithm> |
| 13 #include <array> | 13 #include <array> |
| 14 | 14 |
| 15 #include "webrtc/base/checks.h" | 15 #include "webrtc/base/checks.h" |
| 16 #include "webrtc/modules/audio_processing/aec3/aec3_constants.h" | 16 #include "webrtc/modules/audio_processing/aec3/aec3_common.h" |
| 17 #include "webrtc/modules/audio_processing/include/audio_processing.h" | 17 #include "webrtc/modules/audio_processing/include/audio_processing.h" |
| 18 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" | 18 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h" |
| 19 | 19 |
| 20 namespace webrtc { | 20 namespace webrtc { |
| 21 | 21 |
| 22 namespace { | 22 namespace { |
| 23 | 23 |
| 24 constexpr size_t kNumMatchedFilters = 4; | 24 constexpr size_t kNumMatchedFilters = 4; |
| 25 constexpr size_t kMatchedFilterWindowSizeSubBlocks = 32; | 25 constexpr size_t kMatchedFilterWindowSizeSubBlocks = 32; |
| 26 constexpr size_t kMatchedFilterAlignmentShiftSizeSubBlocks = | 26 constexpr size_t kMatchedFilterAlignmentShiftSizeSubBlocks = |
| 27 kMatchedFilterWindowSizeSubBlocks * 3 / 4; | 27 kMatchedFilterWindowSizeSubBlocks * 3 / 4; |
| 28 | 28 |
| 29 constexpr int kDownSamplingFactor = 4; | 29 constexpr int kDownSamplingFactor = 4; |
| 30 } // namespace | 30 } // namespace |
| 31 | 31 |
| 32 EchoPathDelayEstimator::EchoPathDelayEstimator(ApmDataDumper* data_dumper) | 32 EchoPathDelayEstimator::EchoPathDelayEstimator(ApmDataDumper* data_dumper) |
| 33 : data_dumper_(data_dumper), | 33 : data_dumper_(data_dumper), |
| 34 matched_filter_(data_dumper_, | 34 matched_filter_(data_dumper_, |
| 35 DetectOptimization(), |
| 35 kMatchedFilterWindowSizeSubBlocks, | 36 kMatchedFilterWindowSizeSubBlocks, |
| 36 kNumMatchedFilters, | 37 kNumMatchedFilters, |
| 37 kMatchedFilterAlignmentShiftSizeSubBlocks), | 38 kMatchedFilterAlignmentShiftSizeSubBlocks), |
| 38 matched_filter_lag_aggregator_(data_dumper_, | 39 matched_filter_lag_aggregator_(data_dumper_, |
| 39 matched_filter_.NumLagEstimates()) { | 40 matched_filter_.NumLagEstimates()) { |
| 40 RTC_DCHECK(data_dumper); | 41 RTC_DCHECK(data_dumper); |
| 41 } | 42 } |
| 42 | 43 |
| 43 EchoPathDelayEstimator::~EchoPathDelayEstimator() = default; | 44 EchoPathDelayEstimator::~EchoPathDelayEstimator() = default; |
| 44 | 45 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 70 | 71 |
| 71 // Return the detected delay in samples as the aggregated matched filter lag | 72 // Return the detected delay in samples as the aggregated matched filter lag |
| 72 // compensated by the down sampling factor for the signal being correlated. | 73 // compensated by the down sampling factor for the signal being correlated. |
| 73 return aggregated_matched_filter_lag | 74 return aggregated_matched_filter_lag |
| 74 ? rtc::Optional<size_t>(*aggregated_matched_filter_lag * | 75 ? rtc::Optional<size_t>(*aggregated_matched_filter_lag * |
| 75 kDownSamplingFactor) | 76 kDownSamplingFactor) |
| 76 : rtc::Optional<size_t>(); | 77 : rtc::Optional<size_t>(); |
| 77 } | 78 } |
| 78 | 79 |
| 79 } // namespace webrtc | 80 } // namespace webrtc |
| OLD | NEW |