OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright (c) 2013 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 detection_buffer_.reset(new float[detection_length_]); | 117 detection_buffer_.reset(new float[detection_length_]); |
118 memset(detection_buffer_.get(), | 118 memset(detection_buffer_.get(), |
119 0, | 119 0, |
120 detection_length_ * sizeof(detection_buffer_[0])); | 120 detection_length_ * sizeof(detection_buffer_[0])); |
121 out_buffer_.reset(new float[analysis_length_ * num_channels_]); | 121 out_buffer_.reset(new float[analysis_length_ * num_channels_]); |
122 memset(out_buffer_.get(), | 122 memset(out_buffer_.get(), |
123 0, | 123 0, |
124 analysis_length_ * num_channels_ * sizeof(out_buffer_[0])); | 124 analysis_length_ * num_channels_ * sizeof(out_buffer_[0])); |
125 // ip[0] must be zero to trigger initialization using rdft(). | 125 // ip[0] must be zero to trigger initialization using rdft(). |
126 size_t ip_length = 2 + sqrtf(analysis_length_); | 126 size_t ip_length = 2 + sqrtf(analysis_length_); |
127 ip_.reset(new int[ip_length]()); | 127 ip_.reset(new size_t[ip_length]()); |
128 memset(ip_.get(), 0, ip_length * sizeof(ip_[0])); | 128 memset(ip_.get(), 0, ip_length * sizeof(ip_[0])); |
129 wfft_.reset(new float[complex_analysis_length_ - 1]); | 129 wfft_.reset(new float[complex_analysis_length_ - 1]); |
130 memset(wfft_.get(), 0, (complex_analysis_length_ - 1) * sizeof(wfft_[0])); | 130 memset(wfft_.get(), 0, (complex_analysis_length_ - 1) * sizeof(wfft_[0])); |
131 spectral_mean_.reset(new float[complex_analysis_length_ * num_channels_]); | 131 spectral_mean_.reset(new float[complex_analysis_length_ * num_channels_]); |
132 memset(spectral_mean_.get(), | 132 memset(spectral_mean_.get(), |
133 0, | 133 0, |
134 complex_analysis_length_ * num_channels_ * sizeof(spectral_mean_[0])); | 134 complex_analysis_length_ * num_channels_ * sizeof(spectral_mean_[0])); |
135 fft_buffer_.reset(new float[analysis_length_ + 2]); | 135 fft_buffer_.reset(new float[analysis_length_ + 2]); |
136 memset(fft_buffer_.get(), 0, (analysis_length_ + 2) * sizeof(fft_buffer_[0])); | 136 memset(fft_buffer_.get(), 0, (analysis_length_ + 2) * sizeof(fft_buffer_[0])); |
137 magnitudes_.reset(new float[complex_analysis_length_]); | 137 magnitudes_.reset(new float[complex_analysis_length_]); |
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 const float magnitude_ratio = new_magnitude / magnitudes_[i]; | 415 const float magnitude_ratio = new_magnitude / magnitudes_[i]; |
416 | 416 |
417 fft_buffer_[i * 2] *= magnitude_ratio; | 417 fft_buffer_[i * 2] *= magnitude_ratio; |
418 fft_buffer_[i * 2 + 1] *= magnitude_ratio; | 418 fft_buffer_[i * 2 + 1] *= magnitude_ratio; |
419 magnitudes_[i] = new_magnitude; | 419 magnitudes_[i] = new_magnitude; |
420 } | 420 } |
421 } | 421 } |
422 } | 422 } |
423 | 423 |
424 } // namespace webrtc | 424 } // namespace webrtc |
OLD | NEW |