diff --git a/src/layer/inversespectrogram.cpp b/src/layer/inversespectrogram.cpp index 83cbbf3b86f..e561af9a81a 100644 --- a/src/layer/inversespectrogram.cpp +++ b/src/layer/inversespectrogram.cpp @@ -54,7 +54,7 @@ int InverseSpectrogram::load_param(const ParamDict& pd) // hann window for (int i = 0; i < winlen; i++) { - *p++ = 0.5f * (1 - cos(2 * 3.1415927f * i / winlen)); + *p++ = 0.5f * (1 - cosf(2 * 3.1415927f * i / winlen)); } } if (window_type == 2) @@ -62,7 +62,7 @@ int InverseSpectrogram::load_param(const ParamDict& pd) // hamming window for (int i = 0; i < winlen; i++) { - *p++ = 0.54f - 0.46f * cos(2 * 3.1415927f * i / winlen); + *p++ = 0.54f - 0.46f * cosf(2 * 3.1415927f * i / winlen); } } for (int i = 0; i < n_fft - winlen - (n_fft - winlen) / 2; i++) @@ -173,8 +173,8 @@ int InverseSpectrogram::forward(const Mat& bottom_blob, Mat& top_blob, const Opt { double angle = 2 * 3.1415927f * i * k / n_fft; - re += sp.row(k)[0] * cos(angle) - sp.row(k)[1] * sin(angle); - im += sp.row(k)[0] * sin(angle) + sp.row(k)[1] * cos(angle); + re += sp.row(k)[0] * cosf(angle) - sp.row(k)[1] * sinf(angle); + im += sp.row(k)[0] * sinf(angle) + sp.row(k)[1] * cosf(angle); } re /= n_fft; diff --git a/src/layer/spectrogram.cpp b/src/layer/spectrogram.cpp index d52a2715f24..8fc38be6846 100644 --- a/src/layer/spectrogram.cpp +++ b/src/layer/spectrogram.cpp @@ -56,7 +56,7 @@ int Spectrogram::load_param(const ParamDict& pd) // hann window for (int i = 0; i < winlen; i++) { - *p++ = 0.5f * (1 - cos(2 * 3.1415927f * i / winlen)); + *p++ = 0.5f * (1 - cosf(2 * 3.1415927f * i / winlen)); } } if (window_type == 2) @@ -64,7 +64,7 @@ int Spectrogram::load_param(const ParamDict& pd) // hamming window for (int i = 0; i < winlen; i++) { - *p++ = 0.54f - 0.46f * cos(2 * 3.1415927f * i / winlen); + *p++ = 0.54f - 0.46f * cosf(2 * 3.1415927f * i / winlen); } } for (int i = 0; i < n_fft - winlen - (n_fft - winlen) / 2; i++) @@ -146,8 +146,8 @@ int Spectrogram::forward(const Mat& bottom_blob, Mat& top_blob, const Option& op // dft double angle = 2 * 3.1415927f * i * k / n_fft; - re += v * cos(angle); // + imag * sin(angle); - im -= v * sin(angle); // + imag * cos(angle); + re += v * cosf(angle); // + imag * sinf(angle); + im -= v * sinf(angle); // + imag * cosf(angle); } if (normalized == 1)