tor-browser

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

suppression_params.cc (1587B)


      1 /*
      2 *  Copyright (c) 2019 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 "modules/audio_processing/ns/suppression_params.h"
     12 
     13 #include "modules/audio_processing/ns/ns_config.h"
     14 #include "rtc_base/checks.h"
     15 
     16 namespace webrtc {
     17 
     18 SuppressionParams::SuppressionParams(
     19    NsConfig::SuppressionLevel suppression_level) {
     20  switch (suppression_level) {
     21    case NsConfig::SuppressionLevel::k6dB:
     22      over_subtraction_factor = 1.f;
     23      // 6 dB attenuation.
     24      minimum_attenuating_gain = 0.5f;
     25      use_attenuation_adjustment = false;
     26      break;
     27    case NsConfig::SuppressionLevel::k12dB:
     28      over_subtraction_factor = 1.f;
     29      // 12 dB attenuation.
     30      minimum_attenuating_gain = 0.25f;
     31      use_attenuation_adjustment = true;
     32      break;
     33    case NsConfig::SuppressionLevel::k18dB:
     34      over_subtraction_factor = 1.1f;
     35      // 18 dB attenuation.
     36      minimum_attenuating_gain = 0.125f;
     37      use_attenuation_adjustment = true;
     38      break;
     39    case NsConfig::SuppressionLevel::k21dB:
     40      over_subtraction_factor = 1.25f;
     41      // 20.9 dB attenuation.
     42      minimum_attenuating_gain = 0.09f;
     43      use_attenuation_adjustment = true;
     44      break;
     45    default:
     46      RTC_DCHECK_NOTREACHED();
     47  }
     48 }
     49 
     50 }  // namespace webrtc