SIMD instruction added

This commit is contained in:
zymon 2023-08-28 15:56:36 +02:00
parent 89dcd1bc92
commit b13e54dddb
2 changed files with 6 additions and 6 deletions

View file

@ -1,13 +1,12 @@
name = "STFT" name = "STFT"
uuid = "58bb99bf-048b-48b7-93e7-1cbf3ee61509" uuid = "58bb99bf-048b-48b7-93e7-1cbf3ee61509"
authors = ["Szymon M. Woźniak"] authors = ["Szymon M. Woźniak <s@zymon.org>"]
version = "1.0.1" version = "1.1.0"
[deps] [deps]
FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341" FFTW = "7a1cc6ca-52ef-59f5-83cd-3a7055c09341"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
[compat] [compat]
FFTW = "1.4" FFTW = "1.4"
julia = "1.6" julia = "1.6"

View file

@ -1,5 +1,6 @@
module STFT module STFT
using LoopVectorization
using FFTW using FFTW
export stft, istft export stft, istft
@ -106,7 +107,7 @@ function analysis(
N = N < W ? W : N # DFT size N = N < W ? W : N # DFT size
sc = zeros(T, N, S) # Allocate container for signal segments 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] sc[n, s] = w[n] * x[(s-1)*H+n]
end end
_fft(sc, 1) # Convert segments to frequency-domain _fft(sc, 1) # Convert segments to frequency-domain
@ -229,7 +230,7 @@ function synthesis(
xs = irfft(X, N, 1) # Convert segments to time-domain 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 ss = (s-1)*H # Segment start
for n = 1:W for n = 1:W
xn[ss+n] += xs[n, s] * w[n] xn[ss+n] += xs[n, s] * w[n]