tor-browser

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

histograms.h (1604B)


      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 #ifndef MODULES_AUDIO_PROCESSING_NS_HISTOGRAMS_H_
     12 #define MODULES_AUDIO_PROCESSING_NS_HISTOGRAMS_H_
     13 
     14 #include <array>
     15 
     16 #include "api/array_view.h"
     17 #include "modules/audio_processing/ns/signal_model.h"
     18 
     19 namespace webrtc {
     20 
     21 constexpr int kHistogramSize = 1000;
     22 
     23 // Class for handling the updating of histograms.
     24 class Histograms {
     25 public:
     26  Histograms();
     27  Histograms(const Histograms&) = delete;
     28  Histograms& operator=(const Histograms&) = delete;
     29 
     30  // Clears the histograms.
     31  void Clear();
     32 
     33  // Extracts thresholds for feature parameters and updates the corresponding
     34  // histogram.
     35  void Update(const SignalModel& features_);
     36 
     37  // Methods for accessing the histograms.
     38  ArrayView<const int, kHistogramSize> get_lrt() const { return lrt_; }
     39  ArrayView<const int, kHistogramSize> get_spectral_flatness() const {
     40    return spectral_flatness_;
     41  }
     42  ArrayView<const int, kHistogramSize> get_spectral_diff() const {
     43    return spectral_diff_;
     44  }
     45 
     46 private:
     47  std::array<int, kHistogramSize> lrt_;
     48  std::array<int, kHistogramSize> spectral_flatness_;
     49  std::array<int, kHistogramSize> spectral_diff_;
     50 };
     51 
     52 }  // namespace webrtc
     53 
     54 #endif  // MODULES_AUDIO_PROCESSING_NS_HISTOGRAMS_H_