[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 451
  • Last Modified:

FFT 1D & 2D code with fixed point math..

Hi there,
I'm trying to code Fast Fourier Transform here..
Yup.. I can get the code from some internet site..
But those code seems to use float data type.. Which takes longer time to be executed on non floating-point h/w processor..
I just wonder.. maybe some of you or some people has already code this?
And could you point me the code?
or share the code with me?
or any suggestion?

Regards,

-ari-
0
wayud
Asked:
wayud
  • 5
  • 2
  • 2
  • +1
1 Solution
 
AlexVirochovskyCommented:
You can find code of FFT in many URL.
For example http://www.dc.ee/Files/Programm.C
BUT: all codes use sin/cos and log (of course). Next depend not from code, but from translator: how translator realyze this operation? If with help
of floating point(and you computer without fp processor) will be used simulation, that slows down computation.
Of course , you can use you own cos/sin and log(but to write code, that works
faster that standart: not easy task).

 
0
 
3rsrichardCommented:
You can improve the speed of most FFT algorithms by a careful adjustment of the sequence of math operations and good use of pointers.
Make sure it does the fastest math first, ie never do x = c*a + b*a make sure it does x = (c+b)*a.
Make sure it doesn't shuffle stuff between arrays for no good reason, and make sure it doesn't have to do wasteful address calculations, like don't do y[2n+1] = z[2n+1] figure out
the index first also figure out if your compiler does pointer+offset faster than array[index].
If you don't need great resolution (which you wouldn't get with integer) don't use sin and cos repeatedly, try a lookup table.
0
 
AlexVirochovskyCommented:
wayud, what do you think about me and
3rsrichard comments?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
ozoCommented:
You could also do integer FFTs using roots of unity in the ring of integers modulo 2^n+1 instead of roots of unity in the complex ring
0
 
wayudAuthor Commented:
Thank you guys,
for your comment...
I've read a book about perform fixed point mathmatic on non floating-point processor..
It is by using 16-bit integer data type for all data..
then perform shift operation to adjust the result..
And also we have to use lookup table (which is also integer data type) instead of using sin& cos function in the code..
Alex, I don't understand what you mean by translator, and then simulation?
Thank 3rsrichard,.. yes.. I have done that..
ozo, I don't understand what you mean..
roots of unity in the ring of integers? it sounds too mathmatical for me..
0
 
AlexVirochovskyCommented:
>>Alex, I don't understand what you mean by translator, and then simulation?

Usually,for making float computation
every translator(VC,BC,gcc,...) may use 2 ways:
1. Using floating coprocessor(and in this case it is fast)
2. Using simulation of floating computation without co-processor(and it is more slow).
Every function as cos, sin, lg,.. computes as summ of sequence by some formula with some accuraticy(depends from type of data: float,double, long double).
I means, that you can rewrite  such functions(say mycos, mysin,...), but
it is not easy task .
0
 
3rsrichardCommented:
And, I recalled, there is an incremental version of FFT.  For instruments like signal analysers you don't have to do all the math at once, but get to spread it out over time.
I haven't looked at it in a looong time.
0
 
AlexVirochovskyCommented:
wayud???
0
 
AlexVirochovskyCommented:
By you silence, i hope, that my and
3rsrichard comments help you.

To 3rsrichard : if I get PTS, I 'll send you same summ.
Alex
0
 
wayudAuthor Commented:
Answer accepted
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 2
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now