LCOV - code coverage report
Current view: top level - media/webrtc/trunk/webrtc/modules/audio_coding/neteq - accelerate.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 6 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 (c) 2012 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_CODING_NETEQ_ACCELERATE_H_
      12             : #define WEBRTC_MODULES_AUDIO_CODING_NETEQ_ACCELERATE_H_
      13             : 
      14             : #include <assert.h>
      15             : 
      16             : #include "webrtc/base/constructormagic.h"
      17             : #include "webrtc/modules/audio_coding/neteq/audio_multi_vector.h"
      18             : #include "webrtc/modules/audio_coding/neteq/time_stretch.h"
      19             : #include "webrtc/typedefs.h"
      20             : 
      21             : namespace webrtc {
      22             : 
      23             : // Forward declarations.
      24             : class BackgroundNoise;
      25             : 
      26             : // This class implements the Accelerate operation. Most of the work is done
      27             : // in the base class TimeStretch, which is shared with the PreemptiveExpand
      28             : // operation. In the Accelerate class, the operations that are specific to
      29             : // Accelerate are implemented.
      30           0 : class Accelerate : public TimeStretch {
      31             :  public:
      32           0 :   Accelerate(int sample_rate_hz, size_t num_channels,
      33             :              const BackgroundNoise& background_noise)
      34           0 :       : TimeStretch(sample_rate_hz, num_channels, background_noise) {
      35           0 :   }
      36             : 
      37             :   // This method performs the actual Accelerate operation. The samples are
      38             :   // read from |input|, of length |input_length| elements, and are written to
      39             :   // |output|. The number of samples removed through time-stretching is
      40             :   // is provided in the output |length_change_samples|. The method returns
      41             :   // the outcome of the operation as an enumerator value. If |fast_accelerate|
      42             :   // is true, the algorithm will relax the requirements on finding strong
      43             :   // correlations, and may remove multiple pitch periods if possible.
      44             :   ReturnCodes Process(const int16_t* input,
      45             :                       size_t input_length,
      46             :                       bool fast_accelerate,
      47             :                       AudioMultiVector* output,
      48             :                       size_t* length_change_samples);
      49             : 
      50             :  protected:
      51             :   // Sets the parameters |best_correlation| and |peak_index| to suitable
      52             :   // values when the signal contains no active speech.
      53             :   void SetParametersForPassiveSpeech(size_t len,
      54             :                                      int16_t* best_correlation,
      55             :                                      size_t* peak_index) const override;
      56             : 
      57             :   // Checks the criteria for performing the time-stretching operation and,
      58             :   // if possible, performs the time-stretching.
      59             :   ReturnCodes CheckCriteriaAndStretch(const int16_t* input,
      60             :                                       size_t input_length,
      61             :                                       size_t peak_index,
      62             :                                       int16_t best_correlation,
      63             :                                       bool active_speech,
      64             :                                       bool fast_mode,
      65             :                                       AudioMultiVector* output) const override;
      66             : 
      67             :  private:
      68             :   RTC_DISALLOW_COPY_AND_ASSIGN(Accelerate);
      69             : };
      70             : 
      71             : struct AccelerateFactory {
      72           0 :   AccelerateFactory() {}
      73           0 :   virtual ~AccelerateFactory() {}
      74             : 
      75             :   virtual Accelerate* Create(int sample_rate_hz,
      76             :                              size_t num_channels,
      77             :                              const BackgroundNoise& background_noise) const;
      78             : };
      79             : 
      80             : }  // namespace webrtc
      81             : #endif  // WEBRTC_MODULES_AUDIO_CODING_NETEQ_ACCELERATE_H_

Generated by: LCOV version 1.13