Debian Codegraph @

Xpjproject/third_party/webrtc_aec3/src/modules/audio_processing/agc2/gain_applier.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_GAIN_APPLIER_H_
12 #define MODULES_AUDIO_PROCESSING_AGC2_GAIN_APPLIER_H_
13
14 #include <stddef.h>
15
16 #include "modules/audio_processing/include/audio_frame_view.h"
17
18 namespace webrtc {
19 class GainApplier {
20 public:
21 GainApplier(bool hard_clip_samples, float initial_gain_factor);
22
23 void ApplyGain(AudioFrameView<float> signal);
24 void SetGainFactor(float gain_factor);
25 float GetGainFactor() const { return current_gain_factor_; }
26
27 private:
28 void Initialize(size_t samples_per_channel);
29
30 // Whether to clip samples after gain is applied. If 'true', result
31 // will fit in FloatS16 range.
32 const bool hard_clip_samples_;
33 float last_gain_factor_;
34
35 // If this value is not equal to 'last_gain_factor', gain will be
36 // ramped from 'last_gain_factor_' to this value during the next
37 // 'ApplyGain'.
38 float current_gain_factor_;
39 int samples_per_channel_ = -1;
40 float inverse_samples_per_channel_ = -1.f;
41 };
42 } // namespace webrtc
43
44 #endif // MODULES_AUDIO_PROCESSING_AGC2_GAIN_APPLIER_H_