OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. | |
hlundin-webrtc
2017/01/13 09:06:22
2017
ivoc
2017/01/13 12:12:29
Oops, good point.
| |
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_ECHO_DETECTOR_LIKELIHOOD_AGGREGATOR_H_ | |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_LIKELIHOOD_AGGREGATOR_H_ | |
13 | |
14 #include <vector> | |
15 | |
16 namespace webrtc { | |
17 | |
18 // This class keeps a sliding window of past echo likelihood values, and can | |
19 // calculate the maximum. | |
20 class LikelihoodAggregator { | |
the sun
2017/01/13 12:15:57
Rename to e.g. MovingMax or SlidingMax to
1. Avoid
ivoc
2017/01/13 13:24:23
Great suggestion, done.
| |
21 public: | |
22 explicit LikelihoodAggregator(size_t window_size); | |
hlundin-webrtc
2017/01/13 09:06:22
What is the unit of the window size? Please, appen
ivoc
2017/01/13 12:12:29
There's one likelihood value per frame (10 ms of a
the sun
2017/01/13 12:15:57
How does that matter here?
hlundin-webrtc
2017/01/13 13:38:32
Maybe it doesn't. I was biased by our offline disc
| |
23 ~LikelihoodAggregator(); | |
24 | |
25 // Add a new likelihood to the buffer. This will automatically remove the | |
26 // oldest likelihood value from the buffer. | |
27 void Update(float value); | |
the sun
2017/01/13 12:15:57
Update() to me sounds like it would do some comput
ivoc
2017/01/13 13:24:23
In the new implementation it actually does a bit m
| |
28 // Return the maximum likelihood value in the buffer. | |
29 float max() const; | |
30 // Fill the buffer with zeros. | |
31 void Clear(); | |
32 | |
33 private: | |
34 // The most recent echo likelihood values are stored in a rotating buffer. | |
35 std::vector<float> recent_values_; | |
the sun
2017/01/13 12:15:57
Given that the size is 1000 elements in this use c
ivoc
2017/01/13 13:24:23
I initially thought so too, but it has now come to
| |
36 // Where to insert the next element in the rotating buffer. | |
37 int insertion_index_ = 0; | |
hlundin-webrtc
2017/01/13 09:06:22
size_t
ivoc
2017/01/13 12:12:29
Done.
| |
38 }; | |
39 | |
40 } // namespace webrtc | |
41 | |
42 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_LIKELIHOOD_AGGREGATOR_H _ | |
OLD | NEW |