Reply by Dave Martindale August 18, 20032003-08-18
vinoda@suvistas.com (Vinod) writes:
>I have a FFT implementation in single precision floating point. The >requirement now is to Implement a short version of the FFT using the >FFT already available
>the algorithm would be: >1. Convert the short(16-bit int) valued samples to single precision >float >2. Call the available float FFT function >3. Convert back the float results to short
Are you sure you want to do this? While your input samples may fit nicely in 16 bits with adequate precision, you'll probably find that the Fourier transform coefficients span a much larger range of magnitudes. The DC term of the Fourier transform is the mean of the input values (or the sum, depending on where you do your division by N), while many of the high-frequency coefficients are likely to be very small. Trying to fit them all into 16 bits with a single common scale factor may lose all the significant bits of the smaller coefficients. I'd suggest taking some typical data, doing a FFT, and then looking at the range of coefficient amplitudes you get. If 16 bits loses too much precision, the simplest method is to just leave the FFT in floating point. The input can still be 16 bit integer. If you don't have space (the output is now 4 times the size of the input), you might consider storing the FFT by taking the logarithm of each coefficient and then scaling that to fit in 16 bits. Or use a 16-bit floating point representation.
>What scaling algorithm should be used in the input conversion >(short2float) to enable the FFT to be input a higher dynamic range >signal?
No scaling necessary. The full dynamic range of the 16-bit integer input is a tiny fraction of the available range of 32-bit floating point. Dave
Reply by Vladimir Vassilevsky August 16, 20032003-08-16
Hello Vinod,

While converting your int input to float, you should downscale it by
dividing by the number of FFT points. Or you may do the same downscaling
at the output conversion.


Vladimir Vassilevsky, Ph.D.

DSP and Mixed Signal Design Consultant

http://www.abvolt.com


Vinod wrote:
> > I have a FFT implementation in single precision floating point. The > requirement now is to Implement a short version of the FFT using the > FFT already available > > the algorithm would be: > > 1. Convert the short(16-bit int) valued samples to single precision > float > 2. Call the available float FFT function > 3. Convert back the float results to short > > What scaling algorithm should be used in the input conversion > (short2float) to enable the FFT to be input a higher dynamic range > signal? > > With scaling on input samples, How should the output values be scaled? > > Many thanks in advance for your response, > > Vinod
Reply by Jerry Avins August 16, 20032003-08-16
Vinod wrote:
> > I have a FFT implementation in single precision floating point. The > requirement now is to Implement a short version of the FFT using the > FFT already available > > the algorithm would be: > > 1. Convert the short(16-bit int) valued samples to single precision > float > 2. Call the available float FFT function > 3. Convert back the float results to short > > What scaling algorithm should be used in the input conversion > (short2float) to enable the FFT to be input a higher dynamic range > signal? > > With scaling on input samples, How should the output values be scaled? > > Many thanks in advance for your response, > > Vinod
Conversion to FLOAT doesn't need scaling. That's what floating point does for you. Conversion back to SHORT should be so scaled that nothing overflows (at best) or is likely to overflow (if you have to decide before examining the data). A too aggressive defense against overflow costs bits on the low end that you probably will be sorry to lose. Jerry -- Engineering is the art of making what you want from things you can get. �����������������������������������������������������������������������
Reply by Vinod August 16, 20032003-08-16
I have a FFT implementation in single precision floating point. The
requirement now is to Implement a short version of the FFT using the
FFT already available

the algorithm would be:

1. Convert the short(16-bit int) valued samples to single precision
float
2. Call the available float FFT function
3. Convert back the float results to short

What scaling algorithm should be used in the input conversion
(short2float) to enable the FFT to be input a higher dynamic range
signal?

With scaling on input samples, How should the output values be scaled?

Many thanks in advance for your response,

Vinod