Skip to content

Commit

Permalink
perf(dsp): use conv for simple filt as it is much faster on complex s…
Browse files Browse the repository at this point in the history
…ignals
  • Loading branch information
mchitre committed Jul 24, 2024
1 parent b5ac0f6 commit a9a968e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/dsp.jl
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,11 @@ function pll(x::AbstractVecOrMat, fc=0.0, bandwidth=1e-3; fs=framerate(x))
signal(y, fs)
end

sfilt(f::AbstractVector{<:Number}, x::AbstractVector) = signal(filt(f, samples(x)), framerate(x))
function sfilt(f::AbstractVector{<:Number}, x::AbstractVector)
= samples(x)
signal(conv(f, x̄)[eachindex(x̄)], framerate(x))
end

sfilt(f::AbstractVector{<:Number}, x::AbstractVector, si) = signal(filt(f, samples(x), si), framerate(x))
sfilt(b::AbstractVector{<:Number}, a::Union{Number,AbstractVector}, x::AbstractVector) = signal(filt(b, a, samples(x)), framerate(x))
sfilt(b::AbstractVector{<:Number}, a::Union{Number,AbstractVector}, x::AbstractVector, si) = signal(filt(b, a, samples(x), si), framerate(x))
Expand Down

0 comments on commit a9a968e

Please sign in to comment.