LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_processing/utility - block_mean_calculator.cc (source / functions) Hit Total Coverage
Test: output.info Lines: 0 23 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : #include "webrtc/modules/audio_processing/utility/block_mean_calculator.h"
      12             : 
      13             : #include "webrtc/base/checks.h"
      14             : 
      15             : namespace webrtc {
      16             : 
      17           0 : BlockMeanCalculator::BlockMeanCalculator(size_t block_length)
      18             :     : block_length_(block_length),
      19             :       count_(0),
      20             :       sum_(0.0),
      21           0 :       mean_(0.0) {
      22           0 :   RTC_DCHECK(block_length_ != 0);
      23           0 : }
      24             : 
      25           0 : void BlockMeanCalculator::Reset() {
      26           0 :   Clear();
      27           0 :   mean_ = 0.0;
      28           0 : }
      29             : 
      30           0 : void BlockMeanCalculator::AddValue(float value) {
      31           0 :   sum_ += value;
      32           0 :   ++count_;
      33           0 :   if (count_ == block_length_) {
      34           0 :     mean_ = sum_ / block_length_;
      35           0 :     Clear();
      36             :   }
      37           0 : }
      38             : 
      39           0 : bool BlockMeanCalculator::EndOfBlock() const {
      40           0 :   return count_ == 0;
      41             : }
      42             : 
      43           0 : float BlockMeanCalculator::GetLatestMean() const {
      44           0 :   return mean_;
      45             : }
      46             : 
      47             : // Flush all samples added.
      48           0 : void BlockMeanCalculator::Clear() {
      49           0 :   count_ = 0;
      50           0 :   sum_ = 0.0;
      51           0 : }
      52             : 
      53             : }  // namespace webrtc

Generated by: LCOV version 1.13