DSPRelated.com
Forums

FFT Different APIs Returning Different Results

Started by Raeldor November 15, 2010
Hi All,

I prototyped a piece of code using FFTW and it works great and I'm now
trying to port it to the iPhone.  The iPhone has it's own DSP library
written by Apple which they say is 5x faster than the best
competitor.  However, when I pass the same data (exactly) into their
routine I get a different result set (though interestingly if I graph
the data they look similar).

My question is... should all FFT implementations return the same
results not withstanding a little rounding?  Or can the results vary
so dramatically?  The values coming back from the Apple library are
about 2x those of FFTW.

Thanks
Ray
On Nov 15, 8:22&#4294967295;pm, Raeldor <rael...@gmail.com> wrote:
> Hi All, > > I prototyped a piece of code using FFTW and it works great and I'm now > trying to port it to the iPhone. &#4294967295;The iPhone has it's own DSP library > written by Apple which they say is 5x faster than the best > competitor. &#4294967295;However, when I pass the same data (exactly) into their > routine I get a different result set (though interestingly if I graph > the data they look similar). > > My question is... should all FFT implementations return the same > results not withstanding a little rounding? &#4294967295;Or can the results vary > so dramatically? &#4294967295;The values coming back from the Apple library are > about 2x those of FFTW. > > Thanks > Ray
Check the documentation. Different FFTs use different scalings. John
On Nov 15, 5:40&#4294967295;pm, John <sampson...@gmail.com> wrote:
> On Nov 15, 8:22&#4294967295;pm, Raeldor <rael...@gmail.com> wrote: > > > > > > > > > > > Hi All, > > > I prototyped a piece of code using FFTW and it works great and I'm now > > trying to port it to the iPhone. &#4294967295;The iPhone has it's own DSP library > > written by Apple which they say is 5x faster than the best > > competitor. &#4294967295;However, when I pass the same data (exactly) into their > > routine I get a different result set (though interestingly if I graph > > the data they look similar). > > > My question is... should all FFT implementations return the same > > results not withstanding a little rounding? &#4294967295;Or can the results vary > > so dramatically? &#4294967295;The values coming back from the Apple library are > > about 2x those of FFTW. > > > Thanks > > Ray > > Check the documentation. Different FFTs use different scalings. > > John
You were absolutely right. It was scaling. The results from analyzing the frequencies come out to be the same. Odd I expected this to be based on a standard formula so the result would be the same.
On Nov 16, 3:57&#4294967295;pm, Raeldor <rael...@gmail.com> wrote:
> On Nov 15, 5:40&#4294967295;pm, John <sampson...@gmail.com> wrote: > > > > > On Nov 15, 8:22&#4294967295;pm, Raeldor <rael...@gmail.com> wrote: > > > > Hi All, > > > > I prototyped a piece of code using FFTW and it works great and I'm now > > > trying to port it to the iPhone. &#4294967295;The iPhone has it's own DSP library > > > written by Apple which they say is 5x faster than the best > > > competitor. &#4294967295;However, when I pass the same data (exactly) into their > > > routine I get a different result set (though interestingly if I graph > > > the data they look similar). > > > > My question is... should all FFT implementations return the same > > > results not withstanding a little rounding? &#4294967295;Or can the results vary > > > so dramatically? &#4294967295;The values coming back from the Apple library are > > > about 2x those of FFTW. > > > > Thanks > > > Ray > > > Check the documentation. Different FFTs use different scalings. > > > John > > You were absolutely right. &#4294967295;It was scaling. &#4294967295;The results from > analyzing the frequencies come out to be the same. &#4294967295;Odd I expected > this to be based on a standard formula so the result would be the same.
There is no standard formula for an FFT. It is all smoke and mirrors. Chris ======================= Chris Bore BORES Signal Processing www.bores.com
On Nov 17, 4:00=A0am, Chris Bore <chris.b...@gmail.com> wrote:
> On Nov 16, 3:57=A0pm, Raeldor <rael...@gmail.com> wrote: > > > > > > > > > > > On Nov 15, 5:40=A0pm, John <sampson...@gmail.com> wrote: > > > > On Nov 15, 8:22=A0pm, Raeldor <rael...@gmail.com> wrote: > > > > > Hi All, > > > > > I prototyped a piece of code using FFTW and it works great and I'm =
now
> > > > trying to port it to the iPhone. =A0The iPhone has it's own DSP lib=
rary
> > > > written by Apple which they say is 5x faster than the best > > > > competitor. =A0However, when I pass the same data (exactly) into th=
eir
> > > > routine I get a different result set (though interestingly if I gra=
ph
> > > > the data they look similar). > > > > > My question is... should all FFT implementations return the same > > > > results not withstanding a little rounding? =A0Or can the results v=
ary
> > > > so dramatically? =A0The values coming back from the Apple library a=
re
> > > > about 2x those of FFTW. > > > > > Thanks > > > > Ray > > > > Check the documentation. Different FFTs use different scalings. > > > > John > > > You were absolutely right. =A0It was scaling. =A0The results from > > analyzing the frequencies come out to be the same. =A0Odd I expected > > this to be based on a standard formula so the result would be the same. > > There is no standard formula for an FFT. It is all smoke and mirrors. > > Chris > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > Chris Bore > BORES Signal Processingwww.bores.com
Out of curiosity, did you benchmark FFTW against Apple's DSP library? I'm curious as to whether the claim of "5x faster" is actually legit.