Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 |
| 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 11 #ifndef WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
| 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 12 #define WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
| 13 | 13 |
| 14 // MSVC++ requires this to be set before any other includes to get M_PI. | 14 // MSVC++ requires this to be set before any other includes to get M_PI. |
| 15 #define _USE_MATH_DEFINES | 15 #define _USE_MATH_DEFINES |
| 16 | 16 |
| 17 #include <math.h> | 17 #include <math.h> |
| 18 #include <stddef.h> // size_t | 18 #include <stddef.h> // size_t |
| 19 #include <stdio.h> // FILE | 19 #include <stdio.h> // FILE |
| 20 #include <string.h> | |
| 20 #include <vector> | 21 #include <vector> |
| 21 | 22 |
| 22 #include "webrtc/modules/audio_processing/beamformer/array_util.h" | 23 #include "webrtc/modules/audio_processing/beamformer/array_util.h" |
| 23 #include "webrtc/modules/audio_processing/include/config.h" | 24 #include "webrtc/modules/audio_processing/include/config.h" |
| 24 #include "webrtc/rtc_base/arraysize.h" | 25 #include "webrtc/rtc_base/arraysize.h" |
| 25 #include "webrtc/rtc_base/platform_file.h" | 26 #include "webrtc/rtc_base/platform_file.h" |
| 26 #include "webrtc/rtc_base/refcount.h" | 27 #include "webrtc/rtc_base/refcount.h" |
| 27 #include "webrtc/typedefs.h" | 28 #include "webrtc/typedefs.h" |
| 28 | 29 |
| 29 namespace webrtc { | 30 namespace webrtc { |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 | 261 |
| 261 struct HighPassFilter { | 262 struct HighPassFilter { |
| 262 bool enabled = false; | 263 bool enabled = false; |
| 263 } high_pass_filter; | 264 } high_pass_filter; |
| 264 | 265 |
| 265 // Enables the next generation AEC functionality. This feature replaces the | 266 // Enables the next generation AEC functionality. This feature replaces the |
| 266 // standard methods for echo removal in the AEC. | 267 // standard methods for echo removal in the AEC. |
| 267 // The functionality is not yet activated in the code and turning this on | 268 // The functionality is not yet activated in the code and turning this on |
| 268 // does not yet have the desired behavior. | 269 // does not yet have the desired behavior. |
| 269 struct EchoCanceller3 { | 270 struct EchoCanceller3 { |
| 271 struct Param { | |
| 272 struct Erle { | |
| 273 float min = 1.f; | |
| 274 float max_l = 8.f; | |
| 275 float max_h = 1.5f; | |
| 276 } erle; | |
| 277 | |
| 278 struct EpStrength { | |
| 279 float lf = 100.f; | |
| 280 float mf = 1000.f; | |
| 281 float hf = 5000.f; | |
| 282 float default_len = 0.7f; | |
| 283 } ep_strength; | |
| 284 | |
| 285 struct Mask { | |
| 286 float m1 = 0.01f; | |
| 287 float m2 = 0.001f; | |
| 288 float m3 = 0.01f; | |
| 289 float m4 = 0.1f; | |
| 290 } gain_mask; | |
| 291 | |
| 292 struct EchoAudibility { | |
| 293 float low_render_limit = 192.f; | |
| 294 float normal_render_limit = 64.f; | |
| 295 } echo_audibility; | |
| 296 | |
| 297 struct GainUpdates { | |
| 298 struct GainChanges { | |
| 299 float max_inc; | |
| 300 float max_dec; | |
| 301 float rate_inc; | |
| 302 float rate_dec; | |
| 303 float min_inc; | |
| 304 float min_dec; | |
| 305 }; | |
| 306 | |
| 307 GainChanges low_noise = {8.f, 8.f, 2.f, 2.f, 4.f, 4.f}; | |
| 308 GainChanges normal = {4.f, 4.f, 2.f, 2.f, 1.2f, 2.f}; | |
| 309 GainChanges saturation = {1.2f, 1.2f, 1.5f, 1.5f, 1.f, 1.f}; | |
| 310 | |
| 311 float floor_first_increase = 0.001f; | |
| 312 } gain_updates; | |
| 313 } param; | |
| 270 bool enabled = false; | 314 bool enabled = false; |
| 271 } echo_canceller3; | 315 } echo_canceller3; |
| 272 | 316 |
| 273 // Enables the next generation AGC functionality. This feature replaces the | 317 // Enables the next generation AGC functionality. This feature replaces the |
| 274 // standard methods of gain control in the previous AGC. | 318 // standard methods of gain control in the previous AGC. |
| 275 // The functionality is not yet activated in the code and turning this on | 319 // The functionality is not yet activated in the code and turning this on |
| 276 // does not yet have the desired behavior. | 320 // does not yet have the desired behavior. |
| 277 struct GainController2 { | 321 struct GainController2 { |
| 278 bool enabled = false; | 322 bool enabled = false; |
| 279 } gain_controller2; | 323 } gain_controller2; |
| 324 | |
| 325 // Explicit copy assignment implementation to avoid issues with memory | |
| 326 // sanitizer complaints in case of self-assignment. | |
| 327 #if RTC_HAS_MSAN | |
| 328 Config& operator=(const Config& config) { | |
| 329 if (this != &config) { | |
| 330 memcpy(this, &config, sizeof(*this)); | |
| 331 } | |
| 332 return *this; | |
| 333 } | |
| 334 #endif | |
|
kwiberg-webrtc
2017/08/24 17:46:39
If we're lucky, you can do
#else
static_asser
| |
| 280 }; | 335 }; |
| 281 | 336 |
| 282 // TODO(mgraczyk): Remove once all methods that use ChannelLayout are gone. | 337 // TODO(mgraczyk): Remove once all methods that use ChannelLayout are gone. |
| 283 enum ChannelLayout { | 338 enum ChannelLayout { |
| 284 kMono, | 339 kMono, |
| 285 // Left, right. | 340 // Left, right. |
| 286 kStereo, | 341 kStereo, |
| 287 // Mono, keyboard, and mic. | 342 // Mono, keyboard, and mic. |
| 288 kMonoAndKeyboard, | 343 kMonoAndKeyboard, |
| 289 // Left, right, keyboard, and mic. | 344 // Left, right, keyboard, and mic. |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1071 // This does not impact the size of frames passed to |ProcessStream()|. | 1126 // This does not impact the size of frames passed to |ProcessStream()|. |
| 1072 virtual int set_frame_size_ms(int size) = 0; | 1127 virtual int set_frame_size_ms(int size) = 0; |
| 1073 virtual int frame_size_ms() const = 0; | 1128 virtual int frame_size_ms() const = 0; |
| 1074 | 1129 |
| 1075 protected: | 1130 protected: |
| 1076 virtual ~VoiceDetection() {} | 1131 virtual ~VoiceDetection() {} |
| 1077 }; | 1132 }; |
| 1078 } // namespace webrtc | 1133 } // namespace webrtc |
| 1079 | 1134 |
| 1080 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ | 1135 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ |
| OLD | NEW |