Created
May 31, 2015 09:34
-
-
Save r9y9/b48df9ac2f396d6897c9 to your computer and use it in GitHub Desktop.
D4Cのメモリ違反をとりあえずfix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53c53 | |
< double *waveform) { | |
--- | |
> double *waveform, int waveform_length) { | |
66c66,68 | |
< for (int i = 0; i <= half_window_length * 2; ++i) | |
--- | |
> int upper_bound = half_window_length * 2 > waveform_length - 1 ? | |
> waveform_length - 1 : half_window_length * 2; | |
> for (int i = 0; i <= upper_bound; ++i) | |
71c73 | |
< for (int i = 0; i <= half_window_length * 2; ++i) { | |
--- | |
> for (int i = 0; i <= upper_bound; ++i) { | |
76c78 | |
< for (int i = 0; i <= half_window_length * 2; ++i) | |
--- | |
> for (int i = 0; i <= upper_bound; ++i) | |
92,93c94,95 | |
< GetWindowedWaveform(x, x_length, fs, current_f0, | |
< temporal_position, world::kBlackman, 4.0, forward_real_fft->waveform); | |
--- | |
> GetWindowedWaveform(x, x_length, fs, current_f0, temporal_position, | |
> world::kBlackman, 4.0, forward_real_fft->waveform, fft_size); | |
95c97,99 | |
< for (int i = 0; i <= matlab_round(2.0 * fs / current_f0) * 2; ++i) | |
--- | |
> int upper_bound = matlab_round(2.0 * fs / current_f0) * 2 > fft_size-1 | |
> ? fft_size-1 : matlab_round(2.0 * fs / current_f0) * 2; | |
> for (int i = 0; i <= upper_bound; ++i) { | |
97c101,102 | |
< for (int i = 0; i <= matlab_round(2.0 * fs / current_f0) * 2; ++i) | |
--- | |
> } | |
> for (int i = 0; i <= upper_bound; ++i) { | |
98a104 | |
> } | |
151c157 | |
< temporal_position, world::kHanning, 4.0, forward_real_fft->waveform); | |
--- | |
> temporal_position, world::kHanning, 4.0, forward_real_fft->waveform, fft_size); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment