How to implement 2D FFT of an image matrix using 1D FFT simulink HDL Coder blocks?

36 views (last 30 days)
Hello, I'm trying to find the logic for implementation of 2D FFT using the 'HDL optimized FFT' block for my project. I assume that I have to use RAM for internal storage between the two FFT computations. But I cannot find a definite answer anywhere.
Also, is there any HDL supported block that can convert 2D to 1D? (Vision HDL toolbox is not available at our Uni)?
I'm fairly new to Simulink and HDL coder and any help is highly appreciated. Thank you. Regards, Bharathi

Answers (1)

David Brinkmeier
David Brinkmeier on 11 Nov 2018
Edited: David Brinkmeier on 11 Nov 2018
Multi-dimensional FFT operation is just consecutive FFT along each dimension of your array. If you look at the documentation of fftn you can see the operation is just n-nested Sums (see fftn_doc).
Following this reasoning, here are three equivalent methods to do 2D-FFTs:
M = rand(16,16);
fftn_variant0 = fftn(M);
fftn_variant1 = fft(fft(M, [], 1), [], 2);
fftn_variant2 = M;
for p = 1:length(size(M))
fftn_variant2 = fft(fftn_variant2,[],p);
end
isequal(fftn_variant0,fftn_variant1,fftn_variant2)
As you will see, isequal returns 'true'. I don't know about the simulink blocks, but maybe you can use this information to implement the calculation you need.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!