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

Posted on 2000-05-10
Last Modified: 2008-03-17
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?


Question by:wayud
  • 5
  • 2
  • 2
  • +1
LVL 14

Expert Comment

ID: 2798824
You can find code of FFT in many URL.
For example
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).


Expert Comment

ID: 2800228
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.
LVL 14

Expert Comment

ID: 2811744
wayud, what do you think about me and
3rsrichard comments?
LVL 84

Expert Comment

ID: 2812468
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

Author Comment

ID: 2813040
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..
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

LVL 14

Expert Comment

ID: 2813074
>>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 .

Expert Comment

ID: 2814661
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.
LVL 14

Expert Comment

ID: 2826754
LVL 14

Accepted Solution

AlexVirochovsky earned 150 total points
ID: 2881925
By you silence, i hope, that my and
3rsrichard comments help you.

To 3rsrichard : if I get PTS, I 'll send you same summ.

Author Comment

ID: 2884766
Answer accepted

Featured Post

Too many email signature changes to deal with?

Are you constantly being asked to update your organization's email signatures? Do they take up too much of your time? Wouldn't you love to be able to manage all signatures from one central location, easily design them and deploy them quickly to users. Well, you can!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
memory mapped I/O query 6 142
Trouble linking program with -lcrypt 3 142
Problem to show menu 5 87
Windows Updates failing due to Diskpart not configured correctly 8 106
An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now