tor-browser

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

reverb_model.h (1954B)


      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_AEC3_REVERB_MODEL_H_
     12 #define MODULES_AUDIO_PROCESSING_AEC3_REVERB_MODEL_H_
     13 
     14 #include <array>
     15 
     16 #include "api/array_view.h"
     17 #include "modules/audio_processing/aec3/aec3_common.h"
     18 
     19 namespace webrtc {
     20 
     21 // The ReverbModel class describes an exponential reverberant model
     22 // that can be applied over power spectrums.
     23 class ReverbModel {
     24 public:
     25  ReverbModel();
     26  ~ReverbModel();
     27 
     28  // Resets the state.
     29  void Reset();
     30 
     31  // Returns the reverb.
     32  ArrayView<const float, kFftLengthBy2Plus1> reverb() const { return reverb_; }
     33 
     34  // The methods UpdateReverbNoFreqShaping and UpdateReverb update the
     35  // estimate of the reverberation contribution to an input/output power
     36  // spectrum. Before applying the exponential reverberant model, the input
     37  // power spectrum is pre-scaled. Use the method UpdateReverb when a different
     38  // scaling should be applied per frequency and UpdateReverb_no_freq_shape if
     39  // the same scaling should be used for all the frequencies.
     40  void UpdateReverbNoFreqShaping(ArrayView<const float> power_spectrum,
     41                                 float power_spectrum_scaling,
     42                                 float reverb_decay);
     43 
     44  // Update the reverb based on new data.
     45  void UpdateReverb(ArrayView<const float> power_spectrum,
     46                    ArrayView<const float> power_spectrum_scaling,
     47                    float reverb_decay);
     48 
     49 private:
     50  std::array<float, kFftLengthBy2Plus1> reverb_;
     51 };
     52 
     53 }  // namespace webrtc
     54 
     55 #endif  // MODULES_AUDIO_PROCESSING_AEC3_REVERB_MODEL_H_