| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
#ifndef MODULES_AUDIO_PROCESSING_AGC2_LIMITER_H_ |
| 12 |
#define MODULES_AUDIO_PROCESSING_AGC2_LIMITER_H_ |
| 13 |
|
| 14 |
#include <string> |
| 15 |
#include <vector> |
| 16 |
|
| 17 |
#include "modules/audio_processing/agc2/fixed_digital_level_estimator.h" |
| 18 |
#include "modules/audio_processing/agc2/interpolated_gain_curve.h" |
| 19 |
#include "modules/audio_processing/include/audio_frame_view.h" |
| 20 |
#include "rtc_base/constructor_magic.h" |
| 21 |
|
| 22 |
namespace webrtc { |
| 23 |
class ApmDataDumper; |
| 24 |
|
| 25 |
class Limiter { |
| 26 |
public: |
| 27 |
Limiter(size_t sample_rate_hz, |
| 28 |
ApmDataDumper* apm_data_dumper, |
| 29 |
const std::string& histogram_name_prefix); |
| 30 |
Limiter(const Limiter& limiter) = delete; |
| 31 |
Limiter& operator=(const Limiter& limiter) = delete; |
| 32 |
~Limiter(); |
| 33 |
|
| 34 |
|
| 35 |
void Process(AudioFrameView<float> signal); |
| 36 |
InterpolatedGainCurve::Stats GetGainCurveStats() const; |
| 37 |
|
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
void SetSampleRate(size_t sample_rate_hz); |
| 44 |
|
| 45 |
|
| 46 |
void Reset(); |
| 47 |
|
| 48 |
float LastAudioLevel() const; |
| 49 |
|
| 50 |
private: |
| 51 |
const InterpolatedGainCurve interp_gain_curve_; |
| 52 |
FixedDigitalLevelEstimator level_estimator_; |
| 53 |
ApmDataDumper* const apm_data_dumper_ = nullptr; |
| 54 |
|
| 55 |
|
| 56 |
std::array<float, kSubFramesInFrame + 1> scaling_factors_ = {}; |
| 57 |
std::array<float, kMaximalNumberOfSamplesPerChannel> |
| 58 |
per_sample_scaling_factors_ = {}; |
| 59 |
float last_scaling_factor_ = 1.f; |
| 60 |
}; |
| 61 |
|
| 62 |
} |
| 63 |
|
| 64 |
#endif |