OLD | NEW |
---|---|
(Empty) | |
1 /* | |
2 * Copyright 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_UTILITY_BLOCK_FRACTION_CALCULATOR_H_ | |
12 #define WEBRTC_MODULES_AUDIO_PROCESSING_UTILITY_BLOCK_FRACTION_CALCULATOR_H_ | |
13 | |
14 #include <stddef.h> | |
15 | |
16 #include "webrtc/base/constructormagic.h" | |
17 | |
18 namespace webrtc { | |
19 | |
20 // BlockFractionCalculator calculates the fraction of the occurrence of an event | |
21 // in a block. The fraction is updated at the end of every block. | |
22 class BlockFractionCalculator { | |
peah-webrtc
2016/04/06 11:01:10
Please make this local toaec_core.cc instead.
peah-webrtc
2016/04/06 11:01:10
I think it is better if you name the class in a mo
minyue-webrtc
2016/04/06 13:35:37
ok
| |
23 public: | |
24 explicit BlockFractionCalculator(size_t block_length); | |
25 | |
26 // Reset. | |
27 void Reset(); | |
28 | |
29 // Add one observation. |occurred| is true if the event of interest happened, | |
30 // false otherwise. | |
31 void AddObservation(bool occurred); | |
32 | |
33 // Return the latest fraction. | |
34 float GetLatestFraction() const; | |
35 | |
36 private: | |
37 // Clear all values added. | |
38 void Clear(); | |
39 | |
40 const size_t block_length_; | |
41 size_t count_; | |
42 size_t occurrence_; | |
43 float fraction_; | |
44 | |
45 RTC_DISALLOW_COPY_AND_ASSIGN(BlockFractionCalculator); | |
46 }; | |
47 | |
48 } // namespace webrtc | |
49 | |
50 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_UTILITY_BLOCK_FRACTION_CALCULATOR_H_ | |
OLD | NEW |