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

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

Issue 2415403002: Introduced the new parameter setting scheme for activating the high-pass filter in APM (Closed)
Patch Set: Changes in response to reviewer comments Created 4 years, 1 month 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 // 192 //
193 // APM accepts only linear PCM audio data in chunks of 10 ms. The int16 193 // APM accepts only linear PCM audio data in chunks of 10 ms. The int16
194 // interfaces use interleaved data, while the float interfaces use deinterleaved 194 // interfaces use interleaved data, while the float interfaces use deinterleaved
195 // data. 195 // data.
196 // 196 //
197 // Usage example, omitting error checking: 197 // Usage example, omitting error checking:
198 // AudioProcessing* apm = AudioProcessing::Create(0); 198 // AudioProcessing* apm = AudioProcessing::Create(0);
199 // 199 //
200 // AudioProcessing::Config config; 200 // AudioProcessing::Config config;
201 // config.level_controller.enabled = true; 201 // config.level_controller.enabled = true;
202 // config.high_pass_filter.enabled = true;
202 // apm->ApplyConfig(config) 203 // apm->ApplyConfig(config)
203 // 204 //
204 // apm->high_pass_filter()->Enable(true);
205 //
206 // apm->echo_cancellation()->enable_drift_compensation(false); 205 // apm->echo_cancellation()->enable_drift_compensation(false);
207 // apm->echo_cancellation()->Enable(true); 206 // apm->echo_cancellation()->Enable(true);
208 // 207 //
209 // apm->noise_reduction()->set_level(kHighSuppression); 208 // apm->noise_reduction()->set_level(kHighSuppression);
210 // apm->noise_reduction()->Enable(true); 209 // apm->noise_reduction()->Enable(true);
211 // 210 //
212 // apm->gain_control()->set_analog_level_limits(0, 255); 211 // apm->gain_control()->set_analog_level_limits(0, 255);
213 // apm->gain_control()->set_mode(kAdaptiveAnalog); 212 // apm->gain_control()->set_mode(kAdaptiveAnalog);
214 // apm->gain_control()->Enable(true); 213 // apm->gain_control()->Enable(true);
215 // 214 //
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // the allowed range is [-100, 0]. 257 // the allowed range is [-100, 0].
259 float initial_peak_level_dbfs = -6.0206f; 258 float initial_peak_level_dbfs = -6.0206f;
260 } level_controller; 259 } level_controller;
261 struct ResidualEchoDetector { 260 struct ResidualEchoDetector {
262 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS) 261 #if defined(WEBRTC_ANDROID) || defined(WEBRTC_IOS)
263 bool enabled = false; 262 bool enabled = false;
264 #else 263 #else
265 bool enabled = true; 264 bool enabled = true;
266 #endif 265 #endif
267 } residual_echo_detector; 266 } residual_echo_detector;
267
268 struct HighPassFilter {
269 bool enabled = false;
270 } high_pass_filter;
268 }; 271 };
269 272
270 // TODO(mgraczyk): Remove once all methods that use ChannelLayout are gone. 273 // TODO(mgraczyk): Remove once all methods that use ChannelLayout are gone.
271 enum ChannelLayout { 274 enum ChannelLayout {
272 kMono, 275 kMono,
273 // Left, right. 276 // Left, right.
274 kStereo, 277 kStereo,
275 // Mono, keyboard, and mic. 278 // Mono, keyboard, and mic.
276 kMonoAndKeyboard, 279 kMonoAndKeyboard,
277 // Left, right, keyboard, and mic. 280 // Left, right, keyboard, and mic.
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
547 550
548 // TODO(ivoc): Make this pure virtual when all subclasses have been updated. 551 // TODO(ivoc): Make this pure virtual when all subclasses have been updated.
549 virtual AudioProcessingStatistics GetStatistics() const; 552 virtual AudioProcessingStatistics GetStatistics() const;
550 553
551 // These provide access to the component interfaces and should never return 554 // These provide access to the component interfaces and should never return
552 // NULL. The pointers will be valid for the lifetime of the APM instance. 555 // NULL. The pointers will be valid for the lifetime of the APM instance.
553 // The memory for these objects is entirely managed internally. 556 // The memory for these objects is entirely managed internally.
554 virtual EchoCancellation* echo_cancellation() const = 0; 557 virtual EchoCancellation* echo_cancellation() const = 0;
555 virtual EchoControlMobile* echo_control_mobile() const = 0; 558 virtual EchoControlMobile* echo_control_mobile() const = 0;
556 virtual GainControl* gain_control() const = 0; 559 virtual GainControl* gain_control() const = 0;
560 // TODO(peah): Deprecate this API call.
557 virtual HighPassFilter* high_pass_filter() const = 0; 561 virtual HighPassFilter* high_pass_filter() const = 0;
558 virtual LevelEstimator* level_estimator() const = 0; 562 virtual LevelEstimator* level_estimator() const = 0;
559 virtual NoiseSuppression* noise_suppression() const = 0; 563 virtual NoiseSuppression* noise_suppression() const = 0;
560 virtual VoiceDetection* voice_detection() const = 0; 564 virtual VoiceDetection* voice_detection() const = 0;
561 565
562 enum Error { 566 enum Error {
563 // Fatal errors. 567 // Fatal errors.
564 kNoError = 0, 568 kNoError = 0,
565 kUnspecifiedError = -1, 569 kUnspecifiedError = -1,
566 kCreationFailedError = -2, 570 kCreationFailedError = -2,
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 // signal reaches digital full-scale) in the current frame and the analog 957 // signal reaches digital full-scale) in the current frame and the analog
954 // level cannot be reduced. 958 // level cannot be reduced.
955 // 959 //
956 // This could be used as an indicator to reduce or disable analog mic gain at 960 // This could be used as an indicator to reduce or disable analog mic gain at
957 // the audio HAL. 961 // the audio HAL.
958 virtual bool stream_is_saturated() const = 0; 962 virtual bool stream_is_saturated() const = 0;
959 963
960 protected: 964 protected:
961 virtual ~GainControl() {} 965 virtual ~GainControl() {}
962 }; 966 };
963 967 // TODO(peah): Remove this interface.
964 // A filtering component which removes DC offset and low-frequency noise. 968 // A filtering component which removes DC offset and low-frequency noise.
965 // Recommended to be enabled on the client-side. 969 // Recommended to be enabled on the client-side.
966 class HighPassFilter { 970 class HighPassFilter {
967 public: 971 public:
968 virtual int Enable(bool enable) = 0; 972 virtual int Enable(bool enable) = 0;
969 virtual bool is_enabled() const = 0; 973 virtual bool is_enabled() const = 0;
970 974
971 protected:
972 virtual ~HighPassFilter() {} 975 virtual ~HighPassFilter() {}
973 }; 976 };
974 977
975 // An estimation component used to retrieve level metrics. 978 // An estimation component used to retrieve level metrics.
976 class LevelEstimator { 979 class LevelEstimator {
977 public: 980 public:
978 virtual int Enable(bool enable) = 0; 981 virtual int Enable(bool enable) = 0;
979 virtual bool is_enabled() const = 0; 982 virtual bool is_enabled() const = 0;
980 983
981 // Returns the root mean square (RMS) level in dBFs (decibels from digital 984 // Returns the root mean square (RMS) level in dBFs (decibels from digital
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
1072 // This does not impact the size of frames passed to |ProcessStream()|. 1075 // This does not impact the size of frames passed to |ProcessStream()|.
1073 virtual int set_frame_size_ms(int size) = 0; 1076 virtual int set_frame_size_ms(int size) = 0;
1074 virtual int frame_size_ms() const = 0; 1077 virtual int frame_size_ms() const = 0;
1075 1078
1076 protected: 1079 protected:
1077 virtual ~VoiceDetection() {} 1080 virtual ~VoiceDetection() {}
1078 }; 1081 };
1079 } // namespace webrtc 1082 } // namespace webrtc
1080 1083
1081 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ 1084 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698