tor-browser

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

neural_feature_extractor.h (1632B)


      1 /*
      2 *  Copyright (c) 2025 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_NEURAL_FEATURE_EXTRACTOR_H_
     12 #define MODULES_AUDIO_PROCESSING_AEC3_NEURAL_FEATURE_EXTRACTOR_H_
     13 
     14 #include <vector>
     15 
     16 #include "api/array_view.h"
     17 #include "third_party/pffft/src/pffft.h"
     18 namespace webrtc {
     19 
     20 class FeatureExtractor {
     21 public:
     22  virtual ~FeatureExtractor() = default;
     23  virtual void PushFeaturesToModelInput(std::vector<float>& frame,
     24                                        ArrayView<float> input) = 0;
     25 };
     26 
     27 class TimeDomainFeatureExtractor : public FeatureExtractor {
     28  void PushFeaturesToModelInput(std::vector<float>& frame,
     29                                ArrayView<float> input) override;
     30 };
     31 
     32 class FrequencyDomainFeatureExtractor : public FeatureExtractor {
     33 public:
     34  explicit FrequencyDomainFeatureExtractor(int step_size);
     35  ~FrequencyDomainFeatureExtractor();
     36  void PushFeaturesToModelInput(std::vector<float>& frame,
     37                                ArrayView<float> input) override;
     38 
     39 private:
     40  const int step_size_;
     41  const int frame_size_;
     42  const std::vector<float> sqrt_hanning_;
     43  float* const data_;
     44  float* const spectrum_;
     45  PFFFT_Setup* pffft_setup_;
     46 };
     47 
     48 }  // namespace webrtc
     49 #endif  // MODULES_AUDIO_PROCESSING_AEC3_NEURAL_FEATURE_EXTRACTOR_H_