From 4722ccb12b94d7fec21506f4c90bf58d8a3d5797 Mon Sep 17 00:00:00 2001 From: Mark Borgerding Date: Sat, 7 May 2005 03:02:10 +0000 Subject: [PATCH] getting ready for long-overdue 1.2.2 --- CHANGELOG | 7 +++++++ Makefile | 3 ++- README | 2 +- _kiss_fft_guts.h | 6 +++++- tools/Makefile | 3 ++- tools/kiss_fftr.c | 2 ++ 6 files changed, 19 insertions(+), 4 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 45c014a..16a4f83 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +1.2.2 (May 6, 2005) The Matthew release + Replaced fixed point division with multiply&shift. Thanks to Jean-Marc Valin for the prodding. + + Added C_FIXDIV calls to real fft routines to prevent possible overflow when using fixed point. + Credit to Robert Oschler of robodance for pointing me towards the bug. + + 1.2.1 (April 4, 2004) compiles cleanly with just about every -W warning flag under the sun diff --git a/Makefile b/Makefile index d295e0e..9e48dc4 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -KFVER=1_2_1 +KFVER=1_2_2 DISTDIR=kiss_fft_v$(KFVER) TARBALL=kiss_fft_v$(KFVER).tar.gz @@ -34,4 +34,5 @@ asm: kiss_fft.s kiss_fft.s: kiss_fft.c kiss_fft.h _kiss_fft_guts.h [ -e kiss_fft.s ] && mv kiss_fft.s kiss_fft.s~ || true gcc -S kiss_fft.c -O3 -march=pentiumpro -ffast-math -fomit-frame-pointer -dA -fverbose-asm + gcc -o kiss_fft_short.s -S kiss_fft.c -O3 -march=pentiumpro -ffast-math -fomit-frame-pointer -dA -fverbose-asm -DFIXED_POINT [ -e kiss_fft.s~ ] && diff kiss_fft.s~ kiss_fft.s || true diff --git a/README b/README index 3dd93a0..131f9f9 100644 --- a/README +++ b/README @@ -12,7 +12,7 @@ USAGE: #include "kiss_fft.h" - kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,inverse_fft ); + kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,is_inverse_fft ,0,0 ); while ... diff --git a/_kiss_fft_guts.h b/_kiss_fft_guts.h index f0fc9e2..d61bbce 100644 --- a/_kiss_fft_guts.h +++ b/_kiss_fft_guts.h @@ -52,8 +52,12 @@ struct kiss_fft_state{ do{ (m).r = sround( smul((a).r,(b).r) - smul((a).i,(b).i) ); \ (m).i = sround( smul((a).r,(b).i) + smul((a).i,(b).r) ); }while(0) +# define DIVSCALAR(x,k) \ + (x) = sround( smul( x, 32768/k ) ) + # define C_FIXDIV(c,div) \ - do{ (c).r /= div; (c).i /=div; }while(0) + do { DIVSCALAR( (c).r , div); \ + DIVSCALAR( (c).i , div); }while (0) # define C_MULBYSCALAR( c, s ) \ do{ (c).r = sround( smul( (c).r , s ) ) ;\ diff --git a/tools/Makefile b/tools/Makefile index c4dec54..dbf4ab6 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -27,7 +27,8 @@ else DUMPHDR=dumphdr_$(DATATYPE) endif -all: $(FFTUTIL) $(FASTFILT) $(FASTFILTREAL) $(PSDPNG) $(DUMPHDR) +all: $(FFTUTIL) $(FASTFILT) $(FASTFILTREAL) $(PSDPNG) +# $(DUMPHDR) #CFLAGS=-Wall -O3 -pedantic -march=pentiumpro -ffast-math -fomit-frame-pointer $(WARNINGS) # If the above flags do not work, try the following diff --git a/tools/kiss_fftr.c b/tools/kiss_fftr.c index 48d1ff5..681d242 100644 --- a/tools/kiss_fftr.c +++ b/tools/kiss_fftr.c @@ -125,6 +125,8 @@ void kiss_fftri(kiss_fftr_cfg st,const kiss_fft_cpx *freqdata,kiss_fft_scalar *t fk = freqdata[k]; fnkc.r = freqdata[N - k].r; fnkc.i = -freqdata[N - k].i; + C_FIXDIV( fk , 2 ); + C_FIXDIV( fnkc , 2 ); C_ADD (fek, fk, fnkc); C_SUB (tmpbuf, fk, fnkc);