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

Side by Side Diff: webrtc/modules/audio_processing/utility/block_fraction_calculator.h

Issue 1739993003: Adding fraction of filter divergence in AEC metrics. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: adding block_fraction_calculator and more Created 4 years, 8 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 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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698