tor-browser

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

reverb_frequency_response.h (1830B)


      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_FREQUENCY_RESPONSE_H_
     12 #define MODULES_AUDIO_PROCESSING_AEC3_REVERB_FREQUENCY_RESPONSE_H_
     13 
     14 #include <array>
     15 #include <optional>
     16 #include <vector>
     17 
     18 #include "api/array_view.h"
     19 #include "modules/audio_processing/aec3/aec3_common.h"
     20 
     21 namespace webrtc {
     22 
     23 // Class for updating the frequency response for the reverb.
     24 class ReverbFrequencyResponse {
     25 public:
     26  explicit ReverbFrequencyResponse(
     27      bool use_conservative_tail_frequency_response);
     28  ~ReverbFrequencyResponse();
     29 
     30  // Updates the frequency response estimate of the reverb.
     31  void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>&
     32                  frequency_response,
     33              int filter_delay_blocks,
     34              const std::optional<float>& linear_filter_quality,
     35              bool stationary_block);
     36 
     37  // Returns the estimated frequency response for the reverb.
     38  ArrayView<const float> FrequencyResponse() const { return tail_response_; }
     39 
     40 private:
     41  void Update(const std::vector<std::array<float, kFftLengthBy2Plus1>>&
     42                  frequency_response,
     43              int filter_delay_blocks,
     44              float linear_filter_quality);
     45 
     46  const bool use_conservative_tail_frequency_response_;
     47  float average_decay_ = 0.f;
     48  std::array<float, kFftLengthBy2Plus1> tail_response_;
     49 };
     50 
     51 }  // namespace webrtc
     52 
     53 #endif  // MODULES_AUDIO_PROCESSING_AEC3_REVERB_FREQUENCY_RESPONSE_H_