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

Side by Side Diff: webrtc/modules/audio_processing/echo_detector/sliding_window_minimum.h

Issue 2419563003: Add algorithm for Residual Echo Detector. (Closed)
Patch Set: Added better handling of clock drift on render side. Created 4 years, 2 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) 2016 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_ECHO_DETECTOR_SLIDING_WINDOW_MINIMUM_H_
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_SLIDING_WINDOW_MINIMUM_H_
13
14 #include <vector>
15
16 namespace webrtc {
17
18 // This class determines the minimum value of the last entered N values in an
19 // efficient way: amortized O(1). The implementation is based on the method
20 // described in http://stackoverflow.com/a/17249084.
21 class SlidingWindowMinimum {
22 public:
23 explicit SlidingWindowMinimum(size_t window_size);
24 SlidingWindowMinimum(SlidingWindowMinimum&& other);
25 ~SlidingWindowMinimum();
26
27 // Add a new value.
28 void AddValue(size_t new_value);
29 // Get the minimum of the previous N added values.
30 size_t GetMinimum();
31
32 private:
33 // This is a circular buffer containing the previous values.
34 std::vector<size_t> values_;
35 // This is a circular buffer containing the previous "RL" values.
36 std::vector<size_t> right_to_left_min_;
37 // For storing the previous LR value.
38 size_t left_to_right_min_;
39 // Counter for tracking how far into the window we are.
40 size_t window_index_ = 0;
41 };
42
43 } // namespace webrtc
44
45 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_ECHO_DETECTOR_SLIDING_WINDOW_MINIMUM_ H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698