From b13e54dddb034f880110d1d9828202fe14228961 Mon Sep 17 00:00:00 2001 From: zymon Date: Mon, 28 Aug 2023 15:56:36 +0200 Subject: [PATCH] SIMD instruction added --- Project.toml | 7 +++---- src/STFT.jl | 5 +++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Project.toml b/Project.toml index 161c00c..e5fcece 100644 --- a/Project.toml +++ b/Project.toml @@ -1,13 +1,12 @@ name = "STFT" uuid = "58bb99bf-048b-48b7-93e7-1cbf3ee61509" -authors = ["Szymon M. Woźniak"] -version = "1.0.1" +authors = ["Szymon M. Woźniak "] +version = "1.1.0" [deps] FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" - +LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890" [compat] - FFTW = "1.4" julia = "1.6" diff --git a/src/STFT.jl b/src/STFT.jl index 778070d..32c78a1 100644 --- a/src/STFT.jl +++ b/src/STFT.jl @@ -1,5 +1,6 @@ module STFT +using LoopVectorization using FFTW export stft, istft @@ -106,7 +107,7 @@ function analysis( N = N < W ? W : N # DFT size sc = zeros(T, N, S) # Allocate container for signal segments - for s ∈ 1:S, n ∈ 1:W # Slice the signal + @turbo for s ∈ 1:S, n ∈ 1:W # Slice the signal sc[n, s] = w[n] * x[(s-1)*H+n] end _fft(sc, 1) # Convert segments to frequency-domain @@ -229,7 +230,7 @@ function synthesis( xs = irfft(X, N, 1) # Convert segments to time-domain - for s ∈ 1:S + @turbo for s ∈ 1:S ss = (s-1)*H # Segment start for n = 1:W xn[ss+n] += xs[n, s] * w[n]