Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2014 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 15 matching lines...) Expand all Loading... | |
| 26 #include "webrtc/base/checks.h" | 26 #include "webrtc/base/checks.h" |
| 27 #include "webrtc/common_audio/vad/include/webrtc_vad.h" | 27 #include "webrtc/common_audio/vad/include/webrtc_vad.h" |
| 28 #include "webrtc/common_audio/window_generator.h" | 28 #include "webrtc/common_audio/window_generator.h" |
| 29 | 29 |
| 30 using std::complex; | 30 using std::complex; |
| 31 using std::max; | 31 using std::max; |
| 32 using std::min; | 32 using std::min; |
| 33 | 33 |
| 34 namespace webrtc { | 34 namespace webrtc { |
| 35 | 35 |
| 36 const int IntelligibilityEnhancer::kErbResolution = 2; | |
| 37 const int IntelligibilityEnhancer::kWindowSizeMs = 2; | 36 const int IntelligibilityEnhancer::kWindowSizeMs = 2; |
| 38 const int IntelligibilityEnhancer::kChunkSizeMs = 10; // Size provided by APM. | 37 const int IntelligibilityEnhancer::kChunkSizeMs = 10; // Size provided by APM. |
| 39 const int IntelligibilityEnhancer::kAnalyzeRate = 800; | 38 const int IntelligibilityEnhancer::kAnalyzeRate = 800; |
| 40 const int IntelligibilityEnhancer::kVarianceRate = 2; | 39 const int IntelligibilityEnhancer::kVarianceRate = 2; |
| 41 const float IntelligibilityEnhancer::kClipFreq = 200.0f; | 40 const float IntelligibilityEnhancer::kClipFreq = 200.0f; |
| 42 const float IntelligibilityEnhancer::kConfigRho = 0.02f; | 41 const float IntelligibilityEnhancer::kConfigRho = 0.02f; |
| 43 const float IntelligibilityEnhancer::kKbdAlpha = 1.5f; | 42 const float IntelligibilityEnhancer::kKbdAlpha = 1.5f; |
| 44 | 43 |
| 45 // To disable gain update smoothing, set gain limit to be VERY high. | 44 // To disable gain update smoothing, set gain limit to be VERY high. |
| 46 // TODO(ekmeyerson): Add option to disable gain smoothing altogether | 45 // TODO(ekmeyerson): Add option to disable gain smoothing altogether |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 127 } | 126 } |
| 128 | 127 |
| 129 // Assumes all rho equal. | 128 // Assumes all rho equal. |
| 130 for (int i = 0; i < bank_size_; ++i) { | 129 for (int i = 0; i < bank_size_; ++i) { |
| 131 rho_[i] = kConfigRho * kConfigRho; | 130 rho_[i] = kConfigRho * kConfigRho; |
| 132 } | 131 } |
| 133 | 132 |
| 134 float freqs_khz = kClipFreq / 1000.0f; | 133 float freqs_khz = kClipFreq / 1000.0f; |
| 135 int erb_index = static_cast<int>(ceilf( | 134 int erb_index = static_cast<int>(ceilf( |
| 136 11.17f * logf((freqs_khz + 0.312f) / (freqs_khz + 14.6575f)) + 43.0f)); | 135 11.17f * logf((freqs_khz + 0.312f) / (freqs_khz + 14.6575f)) + 43.0f)); |
| 137 start_freq_ = max(1, erb_index * kErbResolution); | 136 start_freq_ = std::max(1, erb_index * erb_resolution); |
|
Peter Kasting
2015/07/10 18:48:46
It seemed strange to use the passed-in resolution
| |
| 138 | 137 |
| 139 WindowGenerator::KaiserBesselDerived(kKbdAlpha, window_size_, | 138 WindowGenerator::KaiserBesselDerived(kKbdAlpha, window_size_, |
| 140 kbd_window_.get()); | 139 kbd_window_.get()); |
| 141 render_mangler_.reset(new LappedTransform( | 140 render_mangler_.reset(new LappedTransform( |
| 142 channels_, channels_, chunk_length_, kbd_window_.get(), window_size_, | 141 channels_, channels_, chunk_length_, kbd_window_.get(), window_size_, |
| 143 window_size_ / 2, &render_callback_)); | 142 window_size_ / 2, &render_callback_)); |
| 144 capture_mangler_.reset(new LappedTransform( | 143 capture_mangler_.reset(new LappedTransform( |
| 145 channels_, channels_, chunk_length_, kbd_window_.get(), window_size_, | 144 channels_, channels_, chunk_length_, kbd_window_.get(), window_size_, |
| 146 window_size_ / 2, &capture_callback_)); | 145 window_size_ / 2, &capture_callback_)); |
| 147 } | 146 } |
| (...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 int length) { | 396 int length) { |
| 398 float ret = 0.0f; | 397 float ret = 0.0f; |
| 399 | 398 |
| 400 for (int i = 0; i < length; ++i) { | 399 for (int i = 0; i < length; ++i) { |
| 401 ret = fmaf(a[i], b[i], ret); | 400 ret = fmaf(a[i], b[i], ret); |
| 402 } | 401 } |
| 403 return ret; | 402 return ret; |
| 404 } | 403 } |
| 405 | 404 |
| 406 } // namespace webrtc | 405 } // namespace webrtc |
| OLD | NEW |