/* * Copyright (c) 2003-2010, Mark Borgerding. All rights reserved. * This file is part of KISS FFT - https://github.com/mborgerding/kissfft * * SPDX-License-Identifier: BSD-3-Clause * See COPYING file for more information. */ #include "kiss_fftr.h" #include "_kiss_fft_guts.h" #include #include #include static double cputime(void) { struct tms t; times(&t); return (double)(t.tms_utime + t.tms_stime)/ sysconf(_SC_CLK_TCK) ; } static kiss_fft_scalar rand_scalar(void) { #ifdef USE_SIMD return _mm_set1_ps(rand()-RAND_MAX/2); #else kiss_fft_scalar s = (kiss_fft_scalar)(rand() -RAND_MAX/2); return s/2; #endif } static double snr_compare( kiss_fft_cpx * vec1,kiss_fft_cpx * vec2, int n) { int k; double sigpow=1e-10,noisepow=1e-10,err,snr,scale=0; #ifdef USE_SIMD float *fv1 = (float*)vec1; float *fv2 = (float*)vec2; for (k=0;k<8*n;++k) { sigpow += *fv1 * *fv1; err = *fv1 - *fv2; noisepow += err*err; ++fv1; ++fv2; } #else for (k=0;k1) nfft = atoi(argv[1]); kiss_fft_cpx cin[nfft]; kiss_fft_cpx cout[nfft]; kiss_fft_cpx sout[nfft]; kiss_fft_cfg kiss_fft_state; kiss_fftr_cfg kiss_fftr_state; kiss_fft_scalar rin[nfft+2]; kiss_fft_scalar rout[nfft+2]; kiss_fft_scalar zero; memset(&zero,0,sizeof(zero) ); // ugly way of setting short,int,float,double, or __m128 to zero srand(time(0)); for (i=0;i