From 42b37ac95a9faf49548495c0116ebcb0fc67e80a Mon Sep 17 00:00:00 2001 From: xiaying Date: Tue, 31 Dec 2024 16:05:48 +0800 Subject: [PATCH] MNN:Bugfix: Fix compile bug for windows --- source/backend/cpu/CPUStft.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/backend/cpu/CPUStft.cpp b/source/backend/cpu/CPUStft.cpp index 41b42a28d..fc24b6b4c 100644 --- a/source/backend/cpu/CPUStft.cpp +++ b/source/backend/cpu/CPUStft.cpp @@ -11,6 +11,7 @@ #define M_PI 3.141592654 #endif #include +#include #include "backend/cpu/CPUStft.hpp" #include "backend/cpu/CPUBackend.hpp" #include "core/Concurrency.h" @@ -27,10 +28,10 @@ static void MNNDftAbs(const float* input, const float* window, float* output, fl float real_sum = 0.f, imag_sum = 0.f; for (int n = 0; n < nfft; ++n) { float angle = 2 * M_PI * k * n / nfft; - real_sum += buffer[n] * std::cos(angle); - imag_sum -= buffer[n] * std::sin(angle); + real_sum += buffer[n] * cosf(angle); + imag_sum -= buffer[n] * sinf(angle); } - output[k] = std::sqrt(real_sum * real_sum + imag_sum * imag_sum); + output[k] = sqrtf(real_sum * real_sum + imag_sum * imag_sum); } }