Add ClippingPredictor config in AudioProcessing config
Bug: webrtc:12774
Change-Id: Id8cdb6b5499a22cbca40d424cf936f81c1e7d8d7
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/221104
Reviewed-by: Minyue Li <minyue@webrtc.org>
Commit-Queue: Hanna Silen <silen@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#34204}
diff --git a/modules/audio_processing/include/audio_processing.h b/modules/audio_processing/include/audio_processing.h
index 6622097..1f3c19c 100644
--- a/modules/audio_processing/include/audio_processing.h
+++ b/modules/audio_processing/include/audio_processing.h
@@ -343,6 +343,37 @@
// Time in frames to wait after a clipping event before checking again.
// Limited to values higher than 0.
int clipped_wait_frames = 300;
+
+ // Enables clipping prediction functionality.
+ struct ClippingPredictor {
+ bool enabled = false;
+ enum Mode {
+ // Sets clipping prediction for clipping event prediction with fixed
+ // step estimation.
+ kClippingEventPrediction,
+ // Sets clipping prediction for clipped peak estimation with
+ // adaptive step estimation.
+ kAdaptiveStepClippingPeakPrediction,
+ // Sets clipping prediction for clipped peak estimation with fixed
+ // step estimation.
+ kFixedStepClippingPeakPrediction,
+ };
+ Mode mode = kClippingEventPrediction;
+ // Number of frames in the sliding analysis window. Limited to values
+ // higher than zero.
+ int window_length = 5;
+ // Number of frames in the sliding reference window. Limited to values
+ // higher than zero.
+ 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|.
+ int reference_window_delay = 5;
+ // Clipping predictor ste estimation threshold (dB).
+ float clipping_threshold = -1.0f;
+ // Crest factor drop threshold (dB).
+ float crest_factor_margin = 3.0f;
+ } clipping_predictor;
} analog_gain_controller;
} gain_controller1;