Debian Codegraph @

Xpjproject/third_party/webrtc_aec3/src/modules/audio_processing/agc2/adaptive_agc.h

raw symbols SCIP
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_AGC2_ADAPTIVE_AGC_H_
12 #define MODULES_AUDIO_PROCESSING_AGC2_ADAPTIVE_AGC_H_
13
14 #include <memory>
15
16 #include "modules/audio_processing/agc2/adaptive_digital_gain_applier.h"
17 #include "modules/audio_processing/agc2/adaptive_mode_level_estimator.h"
18 #include "modules/audio_processing/agc2/noise_level_estimator.h"
19 #include "modules/audio_processing/agc2/saturation_protector.h"
20 #include "modules/audio_processing/agc2/vad_with_level.h"
21 #include "modules/audio_processing/include/audio_frame_view.h"
22 #include "modules/audio_processing/include/audio_processing.h"
23
24 namespace webrtc {
25 class ApmDataDumper;
26
27 // Adaptive digital gain controller.
28 // TODO(crbug.com/webrtc/7494): Unify with `AdaptiveDigitalGainApplier`.
29 class AdaptiveAgc {
30 public:
31 explicit AdaptiveAgc(ApmDataDumper* apm_data_dumper);
32 // TODO(crbug.com/webrtc/7494): Remove ctor above.
33 AdaptiveAgc(
34 ApmDataDumper* apm_data_dumper,
35 const AudioProcessing::Config::GainController2::AdaptiveDigital& config);
36 ~AdaptiveAgc();
37
38 // Analyzes `frame` and applies a digital adaptive gain to it. Takes into
39 // account the envelope measured by the limiter.
40 // TODO(crbug.com/webrtc/7494): Make the class depend on the limiter.
41 void Process(AudioFrameView<float> frame, float limiter_envelope);
42
43 // Handles a gain change applied to the input signal (e.g., analog gain).
44 void HandleInputGainChange();
45
46 private:
47 AdaptiveModeLevelEstimator speech_level_estimator_;
48 VadLevelAnalyzer vad_;
49 AdaptiveDigitalGainApplier gain_controller_;
50 ApmDataDumper* const apm_data_dumper_;
51 std::unique_ptr<NoiseLevelEstimator> noise_level_estimator_;
52 std::unique_ptr<SaturationProtector> saturation_protector_;
53 };
54
55 } // namespace webrtc
56
57 #endif // MODULES_AUDIO_PROCESSING_AGC2_ADAPTIVE_AGC_H_