AGC analog ClippingPredictor refactoring 1/2

- ClippingPredictor API and docstring changes
- Unified ClippingPredictor factory function

Bug: webrtc:12774
Change-Id: Iafaddae52addc00eb790ac165bf407a4bdd1cb52
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221540
Reviewed-by: Hanna Silen <silen@webrtc.org>
Commit-Queue: Alessio Bazzica <alessiob@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34279}
This commit is contained in:
Alessio Bazzica
2021-06-11 12:37:54 +02:00
committed by WebRTC LUCI CQ
parent 1ff491b0bb
commit b237a87a25
5 changed files with 92 additions and 108 deletions

View File

@ -348,28 +348,21 @@ class RTC_EXPORT AudioProcessing : public rtc::RefCountInterface {
struct ClippingPredictor {
bool enabled = false;
enum Mode {
// Sets clipping prediction for clipping event prediction with fixed
// step estimation.
// Clipping event prediction mode with fixed step estimation.
kClippingEventPrediction,
// Sets clipping prediction for clipped peak estimation with
// adaptive step estimation.
// Clipped peak estimation mode with adaptive step estimation.
kAdaptiveStepClippingPeakPrediction,
// Sets clipping prediction for clipped peak estimation with fixed
// step estimation.
// Clipped peak estimation mode with fixed step estimation.
kFixedStepClippingPeakPrediction,
};
Mode mode = kClippingEventPrediction;
// Number of frames in the sliding analysis window. Limited to values
// higher than zero.
// Number of frames in the sliding analysis window.
int window_length = 5;
// Number of frames in the sliding reference window. Limited to values
// higher than zero.
// Number of frames in the sliding reference window.
int reference_window_length = 5;
// Number of frames the reference window is delayed. Limited to values
// zero and higher. An additional requirement:
// |window_length < reference_window_length + reference_window_delay|.
// Reference window delay (unit: number of frames).
int reference_window_delay = 5;
// Clipping predictor ste estimation threshold (dB).
// Clipping prediction threshold (dBFS).
float clipping_threshold = -1.0f;
// Crest factor drop threshold (dB).
float crest_factor_margin = 3.0f;