loop vectorization speedup x4 for rec ISM core

This commit is contained in:
zymon 2023-08-01 15:29:47 +02:00
parent 937fce822f
commit 38ed515170
2 changed files with 4 additions and 2 deletions

View file

@ -6,6 +6,7 @@ version = "0.2.0"
[deps] [deps]
DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2" DSP = "717857b8-e6f2-59f4-9121-6e50c889abd2"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
LoopVectorization = "bdcacae8-1622-11e9-2a5c-532679323890"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182" StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"

View file

@ -196,10 +196,11 @@ function ISM_RectangularRoom_core!(
i_e = min(floor(Int, (τ + Wd / 2) * fs) + 1, Nh) # end i_e = min(floor(Int, (τ + Wd / 2) * fs) + 1, Nh) # end
# Insert yet another impulse into transfer function # Insert yet another impulse into transfer function
for i i_s:i_e @turbo for i i_s:i_e
t = (i - 1) / fs - τ # time signature t = (i - 1) / fs - τ # time signature
w = 0.5 * (1.0 + cos(2π * t / Wd)) # Hann window w = 0.5 * (1.0 + cos(2π * t / Wd)) # Hann window
h[i] += w * A * sinc(fs * t) # sinc x = π * fs * t + eps()
h[i] += w * A * sin(x)/x
end end
end end
end end