Skip to content

Commit

Permalink
debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Jan 25, 2024
1 parent d2f47a6 commit 78044e7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion demo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function test(mats)
frame = @view mat[:, :, i]
imfilter!(r_noncached, f2, frame, kernel)
imfilter!(r_cached, f1, frame, kernel)
@show f1[1, 1], f2[1, 1]
@show f1[1:2, 1:2] f2[1:2, 1:2]
all(f1 .≈ f2) || error("f1 !≈ f2")
end
return
Expand Down
15 changes: 11 additions & 4 deletions src/imfilter.jl
Original file line number Diff line number Diff line change
Expand Up @@ -872,15 +872,22 @@ function planned_fft(A::AbstractArray{T,N},
end

function filtfft(A, krn, planned_rfft1::Function, planned_rfft2::Function, planned_irfft::Function)
B = planned_rfft1(A)
complex(B) .*= conj!(complex(planned_rfft2(krn)))
return real(planned_irfft(complex(B)))
B = complex(planned_rfft1(A)) * FFTW.AbstractFFTs.to1(A)
_B = rfft(A)
@show B[1:4] _B[1:4]
B .*= conj!(complex(planned_rfft2(krn)))
out = irfft(B, length(axes(A, 1)))
@show complex(B)[1:2,1:2] axes(complex(B)) out[1:2,1:2]
return out
# return real(planned_irfft(complex(B)))
end
filtfft(A, krn, ::Nothing, ::Nothing, ::Nothing) = filtfft(A, krn)
function filtfft(A, krn)
B = rfft(A)
B .*= conj!(rfft(krn))
irfft(B, length(axes(A, 1)))
out = irfft(B, length(axes(A, 1)))
@show B[1:2,1:2] axes(B) out[1:2,1:2]
return out
end
function filtfft(A::AbstractArray{C}, krn) where {C<:Colorant}
Av, dims = channelview_dims(A)
Expand Down

0 comments on commit 78044e7

Please sign in to comment.