Solved

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

Posted on 2000-05-10
426 Views
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?

Regards,

-ari-
0
Question by:wayud
• 5
• 2
• 2
• +1
10 Comments

LVL 14

Expert Comment

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

LVL 3

Expert Comment

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

LVL 14

Expert Comment

wayud, what do you think about me and
3rsrichard comments?
0

LVL 84

Expert Comment

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

Author Comment

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

LVL 14

Expert Comment

>>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

LVL 3

Expert Comment

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

LVL 14

Expert Comment

wayud???
0

LVL 14

Accepted Solution

AlexVirochovsky earned 150 total points
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

Author Comment

Answer accepted
0

## Join & Write a Comment Already a member? Login.

### Suggested Solutions

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Windows programmers of the C/C++ variety, how many of you realise that since Window 9x Microsoft has been lying to you about what constitutes Unicode (http://en.wikipedia.org/wiki/Unicode)? They will have you believe that Unicode requires you to use…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.

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

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

#### Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!