www.pudn.com > kiss_fft_v1_2_5.zip > benchkiss.c


#include 
#include 
#include 
#include 
#include "kiss_fft.h"

#include "pstats.h"


int main(int argc,char ** argv)
{
    int nfft=1024;
    int isinverse=0;
    int numffts=1000,i;
    kiss_fft_cpx * buf;
    kiss_fft_cpx * bufout;
    kiss_fft_cfg st;

    while (1) {
      int c = getopt (argc, argv, "n:ix:");
      if (c == -1)
        break;
      switch (c) {
      case 'n':
        nfft = atoi (optarg);
        if (nfft != kiss_fft_next_fast_size(nfft) ) {
            int ng = kiss_fft_next_fast_size(nfft);
            fprintf(stderr,"warning: %d might be a better choice for speed than %d\n",ng,nfft);
        }
        break;
      case 'x':
        numffts = atoi (optarg);
        break;
      case 'i':
        isinverse = 1;
        break;
      }
    }
#ifdef USE_SIMD        
    buf=(kiss_fft_cpx*)memalign(sizeof(kiss_fft_cpx),sizeof(kiss_fft_cpx) * nfft);
    bufout=(kiss_fft_cpx*)memalign(sizeof(kiss_fft_cpx),sizeof(kiss_fft_cpx) * nfft);

    numffts /= 4;
    fprintf(stderr,"since SIMD implementation does 4 ffts at a time, numffts is being reduced to %d\n",numffts);
#else
    buf=(kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx) * nfft);
    bufout=(kiss_fft_cpx*)malloc(sizeof(kiss_fft_cpx) * nfft);
#endif

    for (i=0;i