Logo Search packages:      
Sourcecode: qsstv version File versions  Download package

void fft::initFFT ( unsigned int  fftLength  ) 

must be called before performing any FFT

Definition at line 70 of file fft.cpp.

References deleteBuffers().

{
      unsigned int i;
      int temp;
      int mask;
      deleteBuffers();
      h=contentsRect().height();
  w=contentsRect().width();
      FFTArray=new QPointArray(w);
      points = fftLength;
      arMag=new uint[fftLength/2];
      fftTempArray=new float[fftLength/2];
      for (i = 0; i <points/2; i++)
            {
                  arMag[i]=0;
                  fftTempArray[i]=0;
            }
      oBuffer=new double[fftLength];

/*
*  FFT size is only half the number of data points
*  The full FFT output can be reconstructed from this FFT's output.
*  (This optimization can be made since the data is real.)
*/
      

      if((sineTable=new double[points])==NULL)
            {
                  QMessageBox::critical( 0,"FFT","Not enough memory for sineTable" );
      return;
            }
      if((bitReversed=new short[points/2])==NULL)
      {
            QMessageBox::critical( 0, "FFT","Not enough memory for bitReversed" );
      return;
      }

      for(i=0;i<points/2;i++)
      {
      temp=0;
      for(mask=points/4;mask>0;mask >>= 1)
         temp=(temp >> 1) + (i&mask ? points/2 : 0);

      bitReversed[i]=temp;
      }

      for(i=0;i<points/2;i++)
            {
      register double s,c;
      s=-sin((2*M_PI*i)/points);
      c=-cos((2*M_PI*i)/points);
      sineTable[bitReversed[i]  ]=s;
      sineTable[bitReversed[i]+1]=c;
      }
      span=(points*FFTSPAN)/isamplingrate;
  im=new QImage(w,h,32);      

}


Generated by  Doxygen 1.6.0   Back to index