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 13 matching lines...) Expand all Loading... |
24 #include <numeric> | 24 #include <numeric> |
25 | 25 |
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 namespace webrtc { | 30 namespace webrtc { |
31 | 31 |
32 namespace { | 32 namespace { |
33 | 33 |
34 const int kErbResolution = 2; | |
35 const int kWindowSizeMs = 2; | 34 const int kWindowSizeMs = 2; |
36 const int kChunkSizeMs = 10; // Size provided by APM. | 35 const int kChunkSizeMs = 10; // Size provided by APM. |
37 const float kClipFreq = 200.0f; | 36 const float kClipFreq = 200.0f; |
38 const float kConfigRho = 0.02f; // Default production and interpretation SNR. | 37 const float kConfigRho = 0.02f; // Default production and interpretation SNR. |
39 const float kKbdAlpha = 1.5f; | 38 const float kKbdAlpha = 1.5f; |
40 const float kLambdaBot = -1.0f; // Extreme values in bisection | 39 const float kLambdaBot = -1.0f; // Extreme values in bisection |
41 const float kLambdaTop = -10e-18f; // search for lamda. | 40 const float kLambdaTop = -10e-18f; // search for lamda. |
42 | 41 |
43 } // namespace | 42 } // namespace |
44 | 43 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 124 } |
126 | 125 |
127 // Assumes all rho equal. | 126 // Assumes all rho equal. |
128 for (int i = 0; i < bank_size_; ++i) { | 127 for (int i = 0; i < bank_size_; ++i) { |
129 rho_[i] = kConfigRho * kConfigRho; | 128 rho_[i] = kConfigRho * kConfigRho; |
130 } | 129 } |
131 | 130 |
132 float freqs_khz = kClipFreq / 1000.0f; | 131 float freqs_khz = kClipFreq / 1000.0f; |
133 int erb_index = static_cast<int>(ceilf( | 132 int erb_index = static_cast<int>(ceilf( |
134 11.17f * logf((freqs_khz + 0.312f) / (freqs_khz + 14.6575f)) + 43.0f)); | 133 11.17f * logf((freqs_khz + 0.312f) / (freqs_khz + 14.6575f)) + 43.0f)); |
135 start_freq_ = max(1, erb_index * kErbResolution); | 134 start_freq_ = std::max(1, erb_index * erb_resolution); |
136 | 135 |
137 WindowGenerator::KaiserBesselDerived(kKbdAlpha, window_size_, | 136 WindowGenerator::KaiserBesselDerived(kKbdAlpha, window_size_, |
138 kbd_window_.get()); | 137 kbd_window_.get()); |
139 render_mangler_.reset(new LappedTransform( | 138 render_mangler_.reset(new LappedTransform( |
140 channels_, channels_, chunk_length_, kbd_window_.get(), window_size_, | 139 channels_, channels_, chunk_length_, kbd_window_.get(), window_size_, |
141 window_size_ / 2, &render_callback_)); | 140 window_size_ / 2, &render_callback_)); |
142 capture_mangler_.reset(new LappedTransform( | 141 capture_mangler_.reset(new LappedTransform( |
143 channels_, channels_, chunk_length_, kbd_window_.get(), window_size_, | 142 channels_, channels_, chunk_length_, kbd_window_.get(), window_size_, |
144 window_size_ / 2, &capture_callback_)); | 143 window_size_ / 2, &capture_callback_)); |
145 } | 144 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 int length) { | 400 int length) { |
402 float ret = 0.0f; | 401 float ret = 0.0f; |
403 | 402 |
404 for (int i = 0; i < length; ++i) { | 403 for (int i = 0; i < length; ++i) { |
405 ret = fmaf(a[i], b[i], ret); | 404 ret = fmaf(a[i], b[i], ret); |
406 } | 405 } |
407 return ret; | 406 return ret; |
408 } | 407 } |
409 | 408 |
410 } // namespace webrtc | 409 } // namespace webrtc |
OLD | NEW |