mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-06-04 01:28:23 -04:00
compiles clean with lots of -W switches
This commit is contained in:
parent
624f8edfd3
commit
0fd8da731a
@ -1,3 +1,9 @@
|
|||||||
|
|
||||||
|
WARNINGS=-W -Wall -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return \
|
||||||
|
-Wcast-align -Wcast-qual -Wnested-externs -Wshadow -Wbad-function-cast \
|
||||||
|
-Wwrite-strings
|
||||||
|
|
||||||
|
|
||||||
ifeq "$(NFFT)" ""
|
ifeq "$(NFFT)" ""
|
||||||
NFFT=1800
|
NFFT=1800
|
||||||
endif
|
endif
|
||||||
@ -42,7 +48,7 @@ tools:
|
|||||||
# for x86 pentium+ machines , these flags work well
|
# for x86 pentium+ machines , these flags work well
|
||||||
#CFLAGS=-Wall -O3 -pedantic -march=pentiumpro -ffast-math -fomit-frame-pointer -I.. -I../tools
|
#CFLAGS=-Wall -O3 -pedantic -march=pentiumpro -ffast-math -fomit-frame-pointer -I.. -I../tools
|
||||||
# If the above flags do not work, try the following
|
# If the above flags do not work, try the following
|
||||||
CFLAGS=-Wall -O3 -I.. -I../tools
|
CFLAGS=-Wall -O3 -I.. -I../tools $(WARNINGS)
|
||||||
|
|
||||||
$(SELFTEST): $(SELFTESTSRC) $(SRCFILES)
|
$(SELFTEST): $(SELFTESTSRC) $(SRCFILES)
|
||||||
$(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) -lm $+
|
$(CC) -o $@ $(CFLAGS) $(TYPEFLAGS) -lm $+
|
||||||
|
@ -4,16 +4,19 @@
|
|||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include "pstats.h"
|
||||||
|
|
||||||
static struct tms tms_beg;
|
static struct tms tms_beg;
|
||||||
static struct tms tms_end;
|
static struct tms tms_end;
|
||||||
static int has_times = 0;
|
static int has_times = 0;
|
||||||
|
|
||||||
void pstats_init()
|
|
||||||
|
void pstats_init(void)
|
||||||
{
|
{
|
||||||
has_times = times(&tms_beg) != -1;
|
has_times = times(&tms_beg) != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void tms_report()
|
static void tms_report(void)
|
||||||
{
|
{
|
||||||
double cputime;
|
double cputime;
|
||||||
if (! has_times )
|
if (! has_times )
|
||||||
@ -25,7 +28,7 @@ static void tms_report()
|
|||||||
fprintf(stderr,"\tcputime=%.3f\n" , cputime);
|
fprintf(stderr,"\tcputime=%.3f\n" , cputime);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void ps_report()
|
static void ps_report(void)
|
||||||
{
|
{
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
#ifdef __APPLE__ /* MAC OS X */
|
#ifdef __APPLE__ /* MAC OS X */
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#ifndef PSTATS_H
|
#ifndef PSTATS_H
|
||||||
#define PSTATS_H
|
#define PSTATS_H
|
||||||
|
|
||||||
void pstats_init();
|
void pstats_init(void);
|
||||||
void pstats_report();
|
void pstats_report(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
|
|
||||||
#define xstr(s) str(s)
|
#define xstr(s) str(s)
|
||||||
#define str(s) #s
|
#define str(s) #s
|
||||||
|
static
|
||||||
double snr_compare( kiss_fft_cpx * test_vec_out,kiss_fft_cpx * testbuf, int n)
|
double snr_compare( kiss_fft_cpx * test_vec_out,kiss_fft_cpx * testbuf, int n)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
@ -28,10 +29,11 @@ double snr_compare( kiss_fft_cpx * test_vec_out,kiss_fft_cpx * testbuf, int n)
|
|||||||
return snr;
|
return snr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int test_stride();
|
int test_stride(void );
|
||||||
int test2d();
|
int test2d(void );
|
||||||
|
|
||||||
int main() { int exit_code=0;
|
int main(void) {
|
||||||
|
int exit_code=0;
|
||||||
|
|
||||||
#define NFFT 10
|
#define NFFT 10
|
||||||
{
|
{
|
||||||
@ -143,6 +145,7 @@ int main() { int exit_code=0;
|
|||||||
return exit_code;
|
return exit_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int test_stride()
|
int test_stride()
|
||||||
{
|
{
|
||||||
#define SKIP_FACTOR 7
|
#define SKIP_FACTOR 7
|
||||||
|
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
#define xstr(s) str(s)
|
#define xstr(s) str(s)
|
||||||
#define str(s) #s
|
#define str(s) #s
|
||||||
|
|
||||||
|
static
|
||||||
double snr_compare( kiss_fft_cpx * test_vec_out,kiss_fft_cpx * testbuf, int n)
|
double snr_compare( kiss_fft_cpx * test_vec_out,kiss_fft_cpx * testbuf, int n)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
@ -26,7 +28,7 @@ double snr_compare( kiss_fft_cpx * test_vec_out,kiss_fft_cpx * testbuf, int n)
|
|||||||
return snr;
|
return snr;
|
||||||
}
|
}
|
||||||
|
|
||||||
int main() { int exit_code=0;
|
int main(void) { int exit_code=0;
|
||||||
|
|
||||||
#define NFFT 10
|
#define NFFT 10
|
||||||
{
|
{
|
||||||
|
@ -4,13 +4,14 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
static double cputime()
|
static double cputime(void)
|
||||||
{
|
{
|
||||||
struct tms t;
|
struct tms t;
|
||||||
times(&t);
|
times(&t);
|
||||||
return (double)(t.tms_utime + t.tms_stime)/ sysconf(_SC_CLK_TCK) ;
|
return (double)(t.tms_utime + t.tms_stime)/ sysconf(_SC_CLK_TCK) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static
|
||||||
double snr_compare( kiss_fft_cpx * vec1,kiss_fft_cpx * vec2, int n)
|
double snr_compare( kiss_fft_cpx * vec1,kiss_fft_cpx * vec2, int n)
|
||||||
{
|
{
|
||||||
int k;
|
int k;
|
||||||
@ -52,12 +53,12 @@ double snr_compare( kiss_fft_cpx * vec1,kiss_fft_cpx * vec2, int n)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
int main()
|
int main(void)
|
||||||
{
|
{
|
||||||
double ts,tfft,trfft;
|
double ts,tfft,trfft;
|
||||||
int i;
|
int i;
|
||||||
kiss_fft_cpx cin[NFFT];
|
kiss_fft_cpx cin[NFFT];
|
||||||
kiss_fft_scalar sin[NFFT] = {0.309655,0.815653,0.768570,0.591841,0.404767,0.637617,0.007803,0.012665};
|
kiss_fft_scalar rin[NFFT] = {0.309655,0.815653,0.768570,0.591841,0.404767,0.637617,0.007803,0.012665};
|
||||||
kiss_fft_cpx cout[NFFT];
|
kiss_fft_cpx cout[NFFT];
|
||||||
kiss_fft_cpx sout[NFFT];
|
kiss_fft_cpx sout[NFFT];
|
||||||
|
|
||||||
@ -68,16 +69,16 @@ int main()
|
|||||||
|
|
||||||
for (i=0;i<NFFT;++i) {
|
for (i=0;i<NFFT;++i) {
|
||||||
#ifdef RANDOM
|
#ifdef RANDOM
|
||||||
sin[i] = (kiss_fft_scalar)(rand()-RAND_MAX/2);
|
rin[i] = (kiss_fft_scalar)(rand()-RAND_MAX/2);
|
||||||
#endif
|
#endif
|
||||||
cin[i].r = sin[i];
|
cin[i].r = rin[i];
|
||||||
cin[i].i = 0;
|
cin[i].i = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
kiss_fft_state = kiss_fft_alloc(NFFT,0,0,0);
|
kiss_fft_state = kiss_fft_alloc(NFFT,0,0,0);
|
||||||
kiss_fftr_state = kiss_fftr_alloc(NFFT,0,0,0);
|
kiss_fftr_state = kiss_fftr_alloc(NFFT,0,0,0);
|
||||||
kiss_fft(kiss_fft_state,cin,cout);
|
kiss_fft(kiss_fft_state,cin,cout);
|
||||||
kiss_fftr(kiss_fftr_state,sin,sout);
|
kiss_fftr(kiss_fftr_state,rin,sout);
|
||||||
printf( "nfft=%d, inverse=%d, snr=%g\n",
|
printf( "nfft=%d, inverse=%d, snr=%g\n",
|
||||||
NFFT,0, snr_compare(cout,sout,(NFFT/2)+1) );
|
NFFT,0, snr_compare(cout,sout,(NFFT/2)+1) );
|
||||||
#ifdef RANDOM
|
#ifdef RANDOM
|
||||||
@ -89,8 +90,8 @@ int main()
|
|||||||
|
|
||||||
ts = cputime();
|
ts = cputime();
|
||||||
for (i=0;i<NUMFFTS;++i) {
|
for (i=0;i<NUMFFTS;++i) {
|
||||||
kiss_fftr( kiss_fftr_state, sin, cout );
|
kiss_fftr( kiss_fftr_state, rin, cout );
|
||||||
/* kiss_fftri(kiss_fftr_state,cout,sin); */
|
/* kiss_fftri(kiss_fftr_state,cout,rin); */
|
||||||
}
|
}
|
||||||
trfft = cputime() - ts;
|
trfft = cputime() - ts;
|
||||||
|
|
||||||
@ -103,10 +104,10 @@ int main()
|
|||||||
kiss_fftr_state = kiss_fftr_alloc(NFFT,1,0,0);
|
kiss_fftr_state = kiss_fftr_alloc(NFFT,1,0,0);
|
||||||
|
|
||||||
kiss_fft(kiss_fft_state,cout,cin);
|
kiss_fft(kiss_fft_state,cout,cin);
|
||||||
kiss_fftri(kiss_fftr_state,cout,sin);
|
kiss_fftri(kiss_fftr_state,cout,rin);
|
||||||
|
|
||||||
for (i=0;i<NFFT;++i) {
|
for (i=0;i<NFFT;++i) {
|
||||||
sout[i].r = sin[i];
|
sout[i].r = rin[i];
|
||||||
sout[i].i = 0;
|
sout[i].i = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user