xref: /aosp_15_r20/external/webrtc/modules/audio_processing/agc2/noise_level_estimator.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2016 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_AGC2_NOISE_LEVEL_ESTIMATOR_H_
12 #define MODULES_AUDIO_PROCESSING_AGC2_NOISE_LEVEL_ESTIMATOR_H_
13 
14 #include <memory>
15 
16 #include "modules/audio_processing/include/audio_frame_view.h"
17 
18 namespace webrtc {
19 class ApmDataDumper;
20 
21 // Noise level estimator interface.
22 class NoiseLevelEstimator {
23  public:
24   virtual ~NoiseLevelEstimator() = default;
25   // Analyzes a 10 ms `frame`, updates the noise level estimation and returns
26   // the value for the latter in dBFS.
27   virtual float Analyze(const AudioFrameView<const float>& frame) = 0;
28 };
29 
30 // Creates a noise level estimator based on noise floor detection.
31 std::unique_ptr<NoiseLevelEstimator> CreateNoiseFloorEstimator(
32     ApmDataDumper* data_dumper);
33 
34 }  // namespace webrtc
35 
36 #endif  // MODULES_AUDIO_PROCESSING_AGC2_NOISE_LEVEL_ESTIMATOR_H_
37