Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4)

Side by Side Diff: webrtc/modules/audio_processing/level_controller/level_controller.h

Issue 2283793002: Revert of Added functionality for specifying the initial signal level to use for the gain estimation (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2016 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 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 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 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 20 matching lines...) Expand all
31 31
32 class LevelController { 32 class LevelController {
33 public: 33 public:
34 LevelController(); 34 LevelController();
35 ~LevelController(); 35 ~LevelController();
36 36
37 void Initialize(int sample_rate_hz); 37 void Initialize(int sample_rate_hz);
38 void Process(AudioBuffer* audio); 38 void Process(AudioBuffer* audio);
39 float GetLastGain() { return last_gain_; } 39 float GetLastGain() { return last_gain_; }
40 40
41 // Sets the initial peak level to use inside the level controller in order
42 // to compute the signal gain. The unit for the peak level is dBFS and
43 // the allowed range is [-100, 0].
44 void SetInitialLevel(float level);
45
46 private: 41 private:
47 class Metrics { 42 class Metrics {
48 public: 43 public:
49 Metrics() { Initialize(AudioProcessing::kSampleRate48kHz); } 44 Metrics() { Initialize(AudioProcessing::kSampleRate48kHz); }
50 void Initialize(int sample_rate_hz); 45 void Initialize(int sample_rate_hz);
51 void Update(float peak_level, float noise_level, float gain); 46 void Update(float peak_level, float noise_level, float gain);
52 47
53 private: 48 private:
54 void Reset(); 49 void Reset();
55 50
(...skipping 13 matching lines...) Expand all
69 SignalClassifier signal_classifier_; 64 SignalClassifier signal_classifier_;
70 NoiseLevelEstimator noise_level_estimator_; 65 NoiseLevelEstimator noise_level_estimator_;
71 PeakLevelEstimator peak_level_estimator_; 66 PeakLevelEstimator peak_level_estimator_;
72 SaturatingGainEstimator saturating_gain_estimator_; 67 SaturatingGainEstimator saturating_gain_estimator_;
73 Metrics metrics_; 68 Metrics metrics_;
74 rtc::Optional<int> sample_rate_hz_; 69 rtc::Optional<int> sample_rate_hz_;
75 static int instance_count_; 70 static int instance_count_;
76 float dc_level_[2]; 71 float dc_level_[2];
77 float dc_forgetting_factor_; 72 float dc_forgetting_factor_;
78 float last_gain_; 73 float last_gain_;
79 bool gain_jumpstart_ = false;
80 74
81 RTC_DISALLOW_COPY_AND_ASSIGN(LevelController); 75 RTC_DISALLOW_COPY_AND_ASSIGN(LevelController);
82 }; 76 };
83 77
84 } // namespace webrtc 78 } // namespace webrtc
85 79
86 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_LEVEL_CONTROLLER_H_ 80 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_LEVEL_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698