peah | ca4cac7 | 2016-06-29 22:26:12 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016 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 WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_PEAK_LEVEL_ESTIMATOR_H_ |
| 12 | #define WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_PEAK_LEVEL_ESTIMATOR_H_ |
| 13 | |
| 14 | #include "webrtc/base/constructormagic.h" |
peah | c19f312 | 2016-10-07 21:54:10 | [diff] [blame] | 15 | #include "webrtc/modules/audio_processing/level_controller/level_controller_constants.h" |
peah | ca4cac7 | 2016-06-29 22:26:12 | [diff] [blame] | 16 | #include "webrtc/modules/audio_processing/level_controller/signal_classifier.h" |
| 17 | |
| 18 | namespace webrtc { |
| 19 | |
| 20 | class PeakLevelEstimator { |
| 21 | public: |
peah | c19f312 | 2016-10-07 21:54:10 | [diff] [blame] | 22 | explicit PeakLevelEstimator(float initial_peak_level_dbfs); |
peah | ca4cac7 | 2016-06-29 22:26:12 | [diff] [blame] | 23 | ~PeakLevelEstimator(); |
peah | c19f312 | 2016-10-07 21:54:10 | [diff] [blame] | 24 | void Initialize(float initial_peak_level_dbfs); |
peah | ca4cac7 | 2016-06-29 22:26:12 | [diff] [blame] | 25 | float Analyze(SignalClassifier::SignalType signal_type, |
| 26 | float frame_peak_level); |
peah | ca4cac7 | 2016-06-29 22:26:12 | [diff] [blame] | 27 | private: |
| 28 | float peak_level_; |
| 29 | int hold_counter_; |
peah | b59ff89 | 2016-06-30 16:19:32 | [diff] [blame] | 30 | bool initialization_phase_; |
peah | ca4cac7 | 2016-06-29 22:26:12 | [diff] [blame] | 31 | |
peah | c19f312 | 2016-10-07 21:54:10 | [diff] [blame] | 32 | RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(PeakLevelEstimator); |
peah | ca4cac7 | 2016-06-29 22:26:12 | [diff] [blame] | 33 | }; |
| 34 | |
| 35 | } // namespace webrtc |
| 36 | |
| 37 | #endif // WEBRTC_MODULES_AUDIO_PROCESSING_LEVEL_CONTROLLER_PEAK_LEVEL_ESTIMATOR_H_ |