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

Side by Side Diff: webrtc/modules/audio_processing/aec3/matched_filter.h

Issue 2678423005: Finalization of the first version of EchoCanceller 3 (Closed)
Patch Set: Fixed compilation error Created 3 years, 9 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 unified diff | Download patch
OLDNEW
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
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MATCHED_FILTER_H_ 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MATCHED_FILTER_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MATCHED_FILTER_H_ 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MATCHED_FILTER_H_
13 13
14 #include <array> 14 #include <array>
15 #include <memory> 15 #include <memory>
16 #include <vector> 16 #include <vector>
17 17
18 #include "webrtc/base/constructormagic.h" 18 #include "webrtc/base/constructormagic.h"
19 #include "webrtc/base/optional.h" 19 #include "webrtc/base/optional.h"
20 #include "webrtc/modules/audio_processing/aec3/aec3_constants.h" 20 #include "webrtc/modules/audio_processing/aec3/aec3_common.h"
21 21
22 namespace webrtc { 22 namespace webrtc {
23 namespace aec3 {
24
25 #if defined(WEBRTC_ARCH_X86_FAMILY)
26
27 // Filter core for the matched filter that is optimized for SSE2.
28 void MatchedFilterCore_SSE2(size_t x_start_index,
29 float x2_sum_threshold,
30 rtc::ArrayView<const float> x,
31 rtc::ArrayView<const float> y,
32 rtc::ArrayView<float> h,
33 bool* filters_updated,
34 float* error_sum);
35
36 #endif
37
38 // Filter core for the matched filter.
39 void MatchedFilterCore(size_t x_start_index,
40 float x2_sum_threshold,
41 rtc::ArrayView<const float> x,
42 rtc::ArrayView<const float> y,
43 rtc::ArrayView<float> h,
44 bool* filters_updated,
45 float* error_sum);
46
47 } // namespace aec3
23 48
24 class ApmDataDumper; 49 class ApmDataDumper;
25 50
26 // Produces recursively updated cross-correlation estimates for several signal 51 // Produces recursively updated cross-correlation estimates for several signal
27 // shifts where the intra-shift spacing is uniform. 52 // shifts where the intra-shift spacing is uniform.
28 class MatchedFilter { 53 class MatchedFilter {
29 public: 54 public:
30 // Stores properties for the lag estimate corresponding to a particular signal 55 // Stores properties for the lag estimate corresponding to a particular signal
31 // shift. 56 // shift.
32 struct LagEstimate { 57 struct LagEstimate {
33 LagEstimate() = default; 58 LagEstimate() = default;
34 LagEstimate(float accuracy, bool reliable, size_t lag, bool updated) 59 LagEstimate(float accuracy, bool reliable, size_t lag, bool updated)
35 : accuracy(accuracy), reliable(reliable), lag(lag), updated(updated) {} 60 : accuracy(accuracy), reliable(reliable), lag(lag), updated(updated) {}
36 61
37 float accuracy = 0.f; 62 float accuracy = 0.f;
38 bool reliable = false; 63 bool reliable = false;
39 size_t lag = 0; 64 size_t lag = 0;
40 bool updated = false; 65 bool updated = false;
41 }; 66 };
42 67
43 MatchedFilter(ApmDataDumper* data_dumper, 68 MatchedFilter(ApmDataDumper* data_dumper,
69 Aec3Optimization optimization,
44 size_t window_size_sub_blocks, 70 size_t window_size_sub_blocks,
45 int num_matched_filters, 71 int num_matched_filters,
46 size_t alignment_shift_sub_blocks); 72 size_t alignment_shift_sub_blocks);
47 73
48 ~MatchedFilter(); 74 ~MatchedFilter();
49 75
50 // Updates the correlation with the values in render and capture. 76 // Updates the correlation with the values in render and capture.
51 void Update(const std::array<float, kSubBlockSize>& render, 77 void Update(const std::array<float, kSubBlockSize>& render,
52 const std::array<float, kSubBlockSize>& capture); 78 const std::array<float, kSubBlockSize>& capture);
53 79
(...skipping 10 matching lines...) Expand all
64 struct IndexedBuffer { 90 struct IndexedBuffer {
65 explicit IndexedBuffer(size_t size); 91 explicit IndexedBuffer(size_t size);
66 ~IndexedBuffer(); 92 ~IndexedBuffer();
67 93
68 std::vector<float> data; 94 std::vector<float> data;
69 int index = 0; 95 int index = 0;
70 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedBuffer); 96 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedBuffer);
71 }; 97 };
72 98
73 ApmDataDumper* const data_dumper_; 99 ApmDataDumper* const data_dumper_;
100 const Aec3Optimization optimization_;
74 const size_t filter_intra_lag_shift_; 101 const size_t filter_intra_lag_shift_;
75 std::vector<std::vector<float>> filters_; 102 std::vector<std::vector<float>> filters_;
76 std::vector<LagEstimate> lag_estimates_; 103 std::vector<LagEstimate> lag_estimates_;
77 IndexedBuffer x_buffer_; 104 IndexedBuffer x_buffer_;
78 105
79 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MatchedFilter); 106 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(MatchedFilter);
80 }; 107 };
81 108
82 } // namespace webrtc 109 } // namespace webrtc
83 110
84 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MATCHED_FILTER_H_ 111 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_MATCHED_FILTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698