tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

agc2_common.h (2423B)


      1 /*
      2 *  Copyright (c) 2018 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 MODULES_AUDIO_PROCESSING_AGC2_AGC2_COMMON_H_
     12 #define MODULES_AUDIO_PROCESSING_AGC2_AGC2_COMMON_H_
     13 
     14 namespace webrtc {
     15 
     16 constexpr float kMinFloatS16Value = -32768.0f;
     17 constexpr float kMaxFloatS16Value = 32767.0f;
     18 constexpr float kMaxAbsFloatS16Value = 32768.0f;
     19 
     20 // Minimum audio level in dBFS scale for S16 samples.
     21 constexpr float kMinLevelDbfs = -90.31f;
     22 
     23 constexpr int kFrameDurationMs = 10;
     24 constexpr int kSubFramesInFrame = 20;
     25 constexpr int kMaximalNumberOfSamplesPerChannel = 480;
     26 
     27 // Adaptive digital gain applier settings.
     28 
     29 // At what limiter levels should we start decreasing the adaptive digital gain.
     30 constexpr float kLimiterThresholdForAgcGainDbfs = -1.0f;
     31 
     32 // Number of milliseconds to wait to periodically reset the VAD.
     33 constexpr int kVadResetPeriodMs = 1500;
     34 
     35 // Speech probability threshold to detect speech activity.
     36 constexpr float kVadConfidenceThreshold = 0.95f;
     37 
     38 // Minimum number of adjacent speech frames having a sufficiently high speech
     39 // probability to reliably detect speech activity.
     40 constexpr int kAdjacentSpeechFramesThreshold = 12;
     41 
     42 // Number of milliseconds of speech frames to observe to make the estimator
     43 // confident.
     44 constexpr float kLevelEstimatorTimeToConfidenceMs = 400;
     45 constexpr float kLevelEstimatorLeakFactor =
     46    1.0f - 1.0f / kLevelEstimatorTimeToConfidenceMs;
     47 
     48 // Saturation Protector settings.
     49 constexpr float kSaturationProtectorInitialHeadroomDb = 20.0f;
     50 constexpr int kSaturationProtectorBufferSize = 4;
     51 
     52 // Number of interpolation points for each region of the limiter.
     53 // These values have been tuned to limit the interpolated gain curve error given
     54 // the limiter parameters and allowing a maximum error of +/- 32768^-1.
     55 constexpr int kInterpolatedGainCurveKneePoints = 22;
     56 constexpr int kInterpolatedGainCurveBeyondKneePoints = 10;
     57 constexpr int kInterpolatedGainCurveTotalPoints =
     58    kInterpolatedGainCurveKneePoints + kInterpolatedGainCurveBeyondKneePoints;
     59 
     60 }  // namespace webrtc
     61 
     62 #endif  // MODULES_AUDIO_PROCESSING_AGC2_AGC2_COMMON_H_