# scaling

Started by June 20, 2011
Hi,

I have a basic question regarding fixed point scaling.
Suppose I have frame based DSP system and
I want to scale each frame such that it is in the appropriate
range for the fft module to work with.
How do I compute this value from the samples of a frame?

Thanks,

> I have a basic question regarding fixed point scaling.
> Suppose I have frame based DSP system and
> I want to scale each frame such that it is in the appropriate
> range for the fft module to work with.
> How do I compute this value from the samples of a frame?

Think of the worst case: if you take an N-pt FFT of a perfect sine wave, then you
get "max frequency content" at one bin, or a magnitude of Nx the original sine wave
peak-to-peak amplitude. If you're applying a window beforehand (or zero-filling),
then the scale factor is less than N.

With fixed point calculations, it may be better to run the FFT and implicitly carry
forward the 1/N scale factor. In that case you need extra bits in your fixed-point
word length, for example if data input is 16-bit and your FFT size is 256, then you
need 24-bit words.

-Jeff
Usually one defines the mantissa and exponent of the fixed point
representation of a signal so that it's components are in the range [-1, 1].
To scale the signal to a (possibly) different exponent to prevent fixed
point over/under flows when using an FFT algorithm you'll first need to
determine what exponent that FFT algorithm is capable of working with.
KISSFFT, a very popular C implementation of the FFT, requires your exponent
to be equal to ceiling( log2(SIZE_OF_FFT) ). So, if you're performing a 512
pt. FFT you will use a 9 bit exponent. If you're performing a 2048 bit FFT
you'll use an 11 pt. exponent. If you're performing a 167 pt. FFT you'll
use an 8 pt. exponent. Make sense?
Hope that helps,
-Brant

On Thu, Jun 16, 2011 at 3:50 PM, milad wrote:

> **
> Hi,
>
> I have a basic question regarding fixed point scaling.
> Suppose I have frame based DSP system and
> I want to scale each frame such that it is in the appropriate
> range for the fft module to work with.
> How do I compute this value from the samples of a frame?
>
> Thanks,