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

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

Issue 2644123002: Adding full initial version of delay estimation functionality in echo canceller 3 (Closed)
Patch Set: Created 3 years, 11 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
(Empty)
1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 *
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
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_CORRELATOR_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_CORRELATOR_H_
13
14 #include <memory>
15 #include <vector>
16
17 #include "webrtc/base/constructormagic.h"
18 #include "webrtc/base/optional.h"
19 #include "webrtc/modules/audio_processing/logging/apm_data_dumper.h"
hlundin-webrtc 2017/02/01 08:30:00 Fwd declare instead.
peah-webrtc 2017/02/02 14:04:45 Done.
20
21 namespace webrtc {
22
23 // Produces recursively updated cross-correlation estimates for several signal
24 // shifts where the intra-shift spacing is uniform.
25 class Correlator {
26 public:
27 // Stores properties for the lag estimate corresponding to a particular signal
28 // shift.
29 struct LagEstimate {
30 LagEstimate() {}
hlundin-webrtc 2017/02/01 08:30:00 Is this needed? If so, = default.
peah-webrtc 2017/02/02 14:04:45 Done.
31 void Set(float accuracy, bool reliable, size_t lag, bool updated) {
hlundin-webrtc 2017/02/01 08:30:00 You could probably just as well have a ctor that s
peah-webrtc 2017/02/02 14:04:45 Done.
32 this->accuracy = accuracy;
33 this->reliable = reliable;
34 this->lag = lag;
35 this->updated = updated;
36 }
37
38 float accuracy = 0.f;
39 bool reliable = false;
40 size_t lag = 0;
41 bool updated = false;
42 };
43
44 Correlator(ApmDataDumper* data_dumper,
45 size_t window_size_sub_blocks,
46 size_t num_alignment_shifts,
47 size_t alignment_shift_sub_blocks);
48
49 ~Correlator();
50
51 // Updates the correlation with the values in x and y.
hlundin-webrtc 2017/02/01 08:30:00 No x and y in parameter list.
peah-webrtc 2017/02/02 14:04:45 Done.
52 void Update(rtc::ArrayView<const float> render,
hlundin-webrtc 2017/02/01 08:30:00 This class seems to be agnostic of the concepts re
peah-webrtc 2017/02/02 14:04:45 It is not in that it requires a certain causality
hlundin-webrtc 2017/02/06 09:13:18 Acknowledged.
peah-webrtc 2017/02/06 11:25:38 Acknowledged.
53 rtc::ArrayView<const float> capture);
54
55 // Returns the current lag estimates.
56 rtc::ArrayView<const Correlator::LagEstimate> GetLagEstimates() const {
57 return lag_estimates_;
58 }
59
60 // Returns the number of lag estimates produced using the shifted signals.
61 size_t NumLagEstimates() const { return correlations_.size(); }
62
63 private:
64 // Provides buffer with a related index.
65 struct IndexedBuffer {
66 public:
hlundin-webrtc 2017/02/01 08:30:01 public not needed in struct.
peah-webrtc 2017/02/02 14:04:45 Done.
67 explicit IndexedBuffer(size_t size);
68 ~IndexedBuffer();
69
70 std::vector<float> data;
71 int index = 0;
72 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(IndexedBuffer);
73 };
74
75 ApmDataDumper* const data_dumper_;
76 const size_t correlator_intra_lag_shift_;
77 std::vector<std::vector<float>> correlations_;
78 std::vector<LagEstimate> lag_estimates_;
79 IndexedBuffer render_buffer_;
80
81 RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Correlator);
82 };
83
84 } // namespace webrtc
85
86 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_AEC3_CORRELATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698