ISM rectangular post-filter refactor
This commit is contained in:
parent
a9200e1106
commit
f0c2574ff4
2 changed files with 7 additions and 20 deletions
14
src/ISM.jl
14
src/ISM.jl
|
@ -39,16 +39,6 @@ function ISM(
|
||||||
h = zeros(config.N)
|
h = zeros(config.N)
|
||||||
# TODO: h = zeros(T, config.N)
|
# TODO: h = zeros(T, config.N)
|
||||||
ISM!(h, tx, rx, room, config)
|
ISM!(h, tx, rx, room, config)
|
||||||
|
|
||||||
if config.hp
|
|
||||||
return AllenBerkley_highpass100(h, config.fs)
|
|
||||||
# TODO: Tego nie ma w ISM!
|
|
||||||
# TODO: Zmień to na funkcie operującą na zaalokowanym już h
|
|
||||||
# AllenBerkley_highpass100!(h, config.fs)
|
|
||||||
# return h
|
|
||||||
else
|
|
||||||
return h
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,16 +148,16 @@ function ISM!(
|
||||||
room::RectangularRoom,
|
room::RectangularRoom,
|
||||||
config::ISMConfig;
|
config::ISMConfig;
|
||||||
) where {T<:AbstractFloat}
|
) where {T<:AbstractFloat}
|
||||||
|
|
||||||
# Impulse parameters
|
# Impulse parameters
|
||||||
Δt = 1 / config.fs
|
Δt = 1 / config.fs
|
||||||
ω = 2π / config.Wd
|
ω = 2π / config.Wd
|
||||||
twid = π * config.fs
|
twid = π * config.fs
|
||||||
|
|
||||||
for image_source ∈ image_source_generator(tx, rx, room, config)
|
for image_source ∈ image_source_generator(tx, rx, room, config)
|
||||||
image_source |> isnothing && continue
|
image_source |> isnothing && continue
|
||||||
A, τ, _, _ = image_source
|
A, τ, _, _ = image_source
|
||||||
insert_impuse!(h, A, τ, config.Wd, config.fs, Δt, twid, ω, config.N)
|
insert_impuse!(h, A, τ, config.Wd, config.fs, Δt, twid, ω, config.N)
|
||||||
end
|
end
|
||||||
|
config.hp && AllenBerkley_highpass100!(h, config.fs)
|
||||||
|
return h
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
13
src/utils.jl
13
src/utils.jl
|
@ -35,29 +35,26 @@ function Sabine_RT60(T60, L::Tuple, c)
|
||||||
sqrt(1-α)
|
sqrt(1-α)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
b = [1, -B1, -B2]
|
b = [1, -B1, -B2]
|
||||||
a = [1, A1, R1]
|
a = [1, A1, R1]
|
||||||
"""
|
"""
|
||||||
function AllenBerkley_highpass100(x, fs)
|
function AllenBerkley_highpass100!(x, fs)
|
||||||
o = x .* 0
|
|
||||||
Y = zeros(3)
|
Y = zeros(3)
|
||||||
|
|
||||||
W = 2π*100/fs
|
W = 2π / fs * 100
|
||||||
|
|
||||||
R1 = exp(-W)
|
R1 = exp(-W)
|
||||||
B1 = 2*R1*cos(W)
|
B1 = 2*R1*cos(W)
|
||||||
B2 = -R1 * R1
|
B2 = -R1 * R1
|
||||||
A1 = -(1+R1)
|
A1 = -(1+R1)
|
||||||
|
|
||||||
for i = eachindex(x)
|
for i = eachindex(x)
|
||||||
Y[3] = Y[2]
|
Y[3] = Y[2]
|
||||||
Y[2] = Y[1]
|
Y[2] = Y[1]
|
||||||
Y[1] = B2*Y[3] + B1*Y[2] + x[i]
|
Y[1] = B2*Y[3] + B1*Y[2] + x[i]
|
||||||
o[i] = Y[1] + A1*Y[2] + R1*Y[3]
|
x[i] = Y[1] + A1*Y[2] + R1*Y[3]
|
||||||
end
|
end
|
||||||
|
|
||||||
return o
|
return x
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue