 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Markus Guest
|
Posted: Mon Nov 06, 2006 1:28 am Post subject: Sourcecode 2D-FFT |
|
|
Hallo,
I am looking for a sourcecode of a 2 dimensional
FFT. But not with an included DLL. I want to
have real Code. Does anybody know where I can get
such Code?
Yours,
Markus |
|
| Back to top |
|
 |
John Herbster Guest
|
Posted: Mon Nov 06, 2006 3:18 am Post subject: Re: Sourcecode 2D-FFT |
|
|
"Markus" <warenhandel (AT) gmx (DOT) de> wrote
| Quote: | I am looking for source code of a 2 dimensional
FFT. But not with an included DLL. I want to
have real code. ...
|
Markus,
You ought to be able to find the source code for
the procedure HARM from the old IBM Scientific
Subroutine Library somewhere. You might have
to translate it from the original Fortran. As I recall,
it would do one, two, or three dimensions.
Rgds, JohnH |
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Mon Nov 06, 2006 5:12 am Post subject: Re: Sourcecode 2D-FFT |
|
|
Hi Markus,
I wrote a complex FFT routine that can also be used for 2D:
http://www.simdesign.nl/fft.html
Note this is free software but I provide *no* support. I would recommend to
read this book:
http://www.dspguide.com/
(free online PDF version is available)
For 2D FFT it is very convenient to use the complex version. Also, my FFT
routine is "mixed radix" meaning it can be used on other dimensions than
powers of 2.
You do a 2D FFT by first doing a 1D FFT on all rows (scanlines), then a 1D
FFT on all columns. I actually have a 2D FFT component as well but it's part
of my image processing lib that I don't sell. It also uses above.
Nils Haeck
www.simdesign.nl
"Markus" <warenhandel (AT) gmx (DOT) de> schreef in bericht
news:454e3b61$1 (AT) newsgroups (DOT) borland.com...
| Quote: | Hallo,
I am looking for a sourcecode of a 2 dimensional
FFT. But not with an included DLL. I want to
have real Code. Does anybody know where I can get
such Code?
Yours,
Markus |
|
|
| Back to top |
|
 |
Markus Guest
|
Posted: Mon Nov 06, 2006 4:47 pm Post subject: Re: Sourcecode 2D-FFT |
|
|
"Nils Haeck"
Hi Nils,
Thank you very much for your Info and the Code.
| Quote: | You do a 2D FFT by first doing a 1D FFT on all rows (scanlines), then a 1D
FFT on all columns.
|
The second FFT on the coloumns on the original Data or
on the Data from the first FFT on the rows?
Yours,
Markus |
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Mon Nov 06, 2006 10:44 pm Post subject: Re: Sourcecode 2D-FFT |
|
|
| Quote: | The second FFT on the coloumns on the original Data or
on the Data from the first FFT on the rows?
|
On the result of the first operation :)
Nils |
|
| Back to top |
|
 |
Markus Guest
|
Posted: Mon Nov 06, 2006 11:39 pm Post subject: Re: Sourcecode 2D-FFT |
|
|
"Nils Haeck"
| Quote: | The second FFT on the coloumns on the original Data or
on the Data from the first FFT on the rows?
On the result of the first operation
|
ah. Thx. Thats what I needed to know =) |
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Tue Nov 07, 2006 2:00 am Post subject: Re: Sourcecode 2D-FFT |
|
|
Actually it doesn't matter if you do rows first, then columns, or columns
first, then rows. The result will be the same (except for small roundoff
errors). It's one of the mathematical properties of a 2D FFT.
Nils |
|
| Back to top |
|
 |
Jens Gruschel Guest
|
Posted: Tue Nov 14, 2006 2:34 am Post subject: Re: Sourcecode 2D-FFT |
|
|
Quite interesting. I once wrote an FFT for sound wave data, but it only
works for dimensions which are a power of two (for sound processing this
usually is ok). I just try to understand what's required for other
dimensions... :-)
--
Jens Gruschel
http://www.pegtop.net |
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Tue Nov 14, 2006 3:31 am Post subject: Re: Sourcecode 2D-FFT |
|
|
| Quote: | Quite interesting. I once wrote an FFT for sound wave data, but it only
works for dimensions which are a power of two (for sound processing this
usually is ok). I just try to understand what's required for other
dimensions...
|
Are you confusing dimensions and data set size?
Sound is usally 1D. But with mixed-radix FFT you can do data set sizes of
e.g. 10000 instead of 1024. It works because it splits up the data set into
it's factors, and has "optimized" code for the lower factors, e.g. 10000
would be split up in 10 * 10 * 10 * 10. Each factor 10 is then split up in 2
* 5. Etc.
The shit hits the fan though if you try to do series with lengths of e.g.
1023, or any large prime, since it can't be split up into factors, and thus
it resorts to a very lengthy operation of the standard discrete fourier
transform.
Btw, the complex FFT can help for sound, because in complex 1D FFT you
transform a real and imaginary part of a complex number. You can fill the
left channel in the real part, the right channel in the imag part, and then
for the price of 1 you can do stereo FFT :)
Nils |
|
| Back to top |
|
 |
Jens Gruschel Guest
|
Posted: Tue Nov 14, 2006 3:53 am Post subject: Re: Sourcecode 2D-FFT |
|
|
| Quote: | Are you confusing dimensions and data set size?
|
Yes :-)
| Quote: | The shit hits the fan though if you try to do series with lengths of e.g.
1023, or any large prime, since it can't be split up into factors, and thus
it resorts to a very lengthy operation of the standard discrete fourier
transform.
|
I see.
| Quote: | Btw, the complex FFT can help for sound, because in complex 1D FFT you
transform a real and imaginary part of a complex number. You can fill the
left channel in the real part, the right channel in the imag part, and then
for the price of 1 you can do stereo FFT
|
Very neat idea. I'll add that to my class (and post it here if anyone is
interested). However I have one more question: the result of such a
"stereo FFT" cannot be separated again, it's the combined result of both
channels, or am I wrong?
--
Jens Gruschel
http://www.pegtop.net |
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Tue Nov 14, 2006 4:25 am Post subject: Re: Sourcecode 2D-FFT |
|
|
| Quote: | Very neat idea. I'll add that to my class (and post it here if anyone is
interested). However I have one more question: the result of such a
"stereo FFT" cannot be separated again, it's the combined result of both
channels, or am I wrong?
|
No, it *can* be separated, otherwise what would it bring But.. don't ask
me how. You can find very good info in the book "Scientists and engineers
guide to digital signal processing", with example code. You can download all
relevant chapters as PDF for free.
http://www.dspguide.com/pdfbook.htm
Kind regards,
Nils |
|
| Back to top |
|
 |
Jens Gruschel Guest
|
Posted: Tue Nov 14, 2006 4:33 am Post subject: Re: Sourcecode 2D-FFT |
|
|
| Quote: | No, it *can* be separated, otherwise what would it bring But.. don't ask
me how.
|
Well, I'll try that later. For now I don't need it, since I only
required it for some simple spectrum analyzis (for example for my
Smoodoo screensaver to detect the beat). Now I realize that my unit is
not that flexible. However I posted the current version to
b.p.attachments (wave spectrum analyzer).
| Quote: | You can find very good info in the book "Scientists and engineers
guide to digital signal processing", with example code. You can download all
relevant chapters as PDF for free.
http://www.dspguide.com/pdfbook.htm
|
Yes, I already looked at it (and added the book to my Amazon wish list).
Seems like I have to look at it again...
--
Jens Gruschel
http://www.pegtop.net |
|
| Back to top |
|
 |
John Herbster Guest
|
Posted: Tue Nov 14, 2006 6:32 am Post subject: Re: Sourcecode 2D-FFT |
|
|
"Nils Haeck" <bla (AT) bla (DOT) com> wrote
| Quote: | ... But with mixed-radix FFT you can do data set sizes of
e.g. 10000 instead of 1024. It works because it splits up
the data set into it's factors, and has "optimized" code for
the lower factors, e.g. 10000 would be split up in 10 * 10
* 10 * 10. Each factor 10 is then split up in 2 * 5. Etc.
|
I call that a Glassman FFT, after one for the guys who first came
up with the idea or the code.
http://www.google.com/search?hl=en&q=Glassman+FFT
--JohnH |
|
| Back to top |
|
 |
Nils Haeck Guest
|
Posted: Tue Nov 14, 2006 8:13 am Post subject: Re: Sourcecode 2D-FFT |
|
|
Exactly, I did indeed use old Fortran files I found in some library and
translated them to Delphi, probably the ones mentioned in the link I put
in some optimizations for 2x5=10 and 2x8=4x4 which I found somewhere else.
It's probably not yet most optimized as it could be, this one would benefit
a lot from SSE, unrolling and such.
Nils |
|
| Back to top |
|
 |
Nils Haeck Guest
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|