mirror of
https://github.com/mborgerding/kissfft.git
synced 2025-05-25 20:20:26 -04:00
very minor tweaks to radix 3 code
This commit is contained in:
parent
ac2eb527b7
commit
71bf5965b8
10
CHANGELOG
10
CHANGELOG
@ -1,3 +1,13 @@
|
||||
1.2 (Feb 23, 2004)
|
||||
interface change -- cfg object is forward declaration of struct instead of void*
|
||||
This maintains type saftey and lets the compiler warn/error about stupid mistakes.
|
||||
(prompted by suggestion from Erik de Castro Lopo)
|
||||
|
||||
small speed improvements
|
||||
|
||||
added psdpng.c -- sample utility that will create png spectrum "waterfalls" from an input file
|
||||
( not terribly useful yet)
|
||||
|
||||
1.1.1 (Feb 1, 2004 )
|
||||
minor bug fix -- only affects odd rank, in-place, multi-dimensional FFTs
|
||||
|
||||
|
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
||||
KFVER=111
|
||||
KFVER=120
|
||||
|
||||
DISTDIR=kiss_fft_v$(KFVER)
|
||||
TARBALL=kiss_fft_v$(KFVER).tar.gz
|
||||
|
6
README
6
README
@ -12,7 +12,7 @@ USAGE:
|
||||
|
||||
#include "kiss_fft.h"
|
||||
|
||||
void * cfg = kiss_fft_alloc( nfft ,inverse_fft );
|
||||
kiss_fft_cfg cfg = kiss_fft_alloc( nfft ,inverse_fft );
|
||||
|
||||
while ...
|
||||
|
||||
@ -38,6 +38,7 @@ You can do other cool stuff with the extras you'll find in tools/
|
||||
* arbitrary dimension FFTs (complex only currently, apologies to Steve DeKorte -- mebbe next time )
|
||||
* real FFTs
|
||||
* fast convolution filtering
|
||||
* spectrum image creation
|
||||
|
||||
The core fft and most tools/ code can be compiled to use float, double
|
||||
or 16bit short samples. The default is float.
|
||||
@ -101,6 +102,9 @@ TODO:
|
||||
*) Make the fixed point scaling and bit shifts more easily configurable.
|
||||
*) Document/revisit the input/output fft scaling
|
||||
*) See if the fixed point code can be optimized a little without adding complexity.
|
||||
*) Make doc describing the overlap (tail) scrap fast convolution filtering in kiss_fastfir.c
|
||||
*) Test all the ./tools/ code with fixed point (kiss_fastfir.c doesn't work, maybe others)
|
||||
|
||||
|
||||
AUTHOR:
|
||||
Mark Borgerding
|
||||
|
48
kiss_fft.c
48
kiss_fft.c
@ -26,7 +26,7 @@ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
|
||||
static void kf_bfly2(
|
||||
kiss_fft_cpx * Fout,
|
||||
const int fstride,
|
||||
const size_t fstride,
|
||||
const kiss_fft_cfg st,
|
||||
int m
|
||||
)
|
||||
@ -49,7 +49,7 @@ static void kf_bfly2(
|
||||
|
||||
static void kf_bfly4(
|
||||
kiss_fft_cpx * Fout,
|
||||
const int fstride,
|
||||
const size_t fstride,
|
||||
const kiss_fft_cfg st,
|
||||
const size_t m
|
||||
)
|
||||
@ -96,53 +96,51 @@ static void kf_bfly4(
|
||||
|
||||
static void kf_bfly3(
|
||||
kiss_fft_cpx * Fout,
|
||||
const int fstride,
|
||||
const size_t fstride,
|
||||
const kiss_fft_cfg st,
|
||||
int m
|
||||
size_t m
|
||||
)
|
||||
{
|
||||
kiss_fft_cpx *Fout0,*Fout1,*Fout2;
|
||||
size_t k=m;
|
||||
const size_t m2 = 2*m;
|
||||
kiss_fft_cpx *tw1,*tw2;
|
||||
kiss_fft_cpx scratch[5];
|
||||
kiss_fft_cpx epi3;
|
||||
epi3 = st->twiddles[fstride*m];
|
||||
|
||||
Fout0=Fout;
|
||||
Fout1=Fout0+m;
|
||||
Fout2=Fout0+2*m;
|
||||
tw1=tw2=st->twiddles;
|
||||
|
||||
do{
|
||||
C_FIXDIV(*Fout0,3); C_FIXDIV(*Fout1,3); C_FIXDIV(*Fout2,3);
|
||||
C_FIXDIV(*Fout,3); C_FIXDIV(Fout[m],3); C_FIXDIV(Fout[m2],3);
|
||||
|
||||
C_MUL(scratch[1],*Fout1 , *tw1);
|
||||
C_MUL(scratch[2],*Fout2 , *tw2);
|
||||
C_MUL(scratch[1],Fout[m] , *tw1);
|
||||
C_MUL(scratch[2],Fout[m2] , *tw2);
|
||||
|
||||
C_ADD(scratch[3],scratch[1],scratch[2]);
|
||||
C_SUB(scratch[0],scratch[1],scratch[2]);
|
||||
tw1 += fstride;
|
||||
tw2 += fstride*2;
|
||||
|
||||
Fout1->r = Fout0->r - scratch[3].r/2;
|
||||
Fout1->i = Fout0->i - scratch[3].i/2;
|
||||
Fout[m].r = Fout->r - scratch[3].r/2;
|
||||
Fout[m].i = Fout->i - scratch[3].i/2;
|
||||
|
||||
C_MULBYSCALAR( scratch[0] , epi3.i );
|
||||
|
||||
C_ADDTO(*Fout0,scratch[3]);
|
||||
C_ADDTO(*Fout,scratch[3]);
|
||||
|
||||
Fout2->r = Fout1->r + scratch[0].i;
|
||||
Fout2->i = Fout1->i - scratch[0].r;
|
||||
Fout[m2].r = Fout[m].r + scratch[0].i;
|
||||
Fout[m2].i = Fout[m].i - scratch[0].r;
|
||||
|
||||
Fout1->r -= scratch[0].i;
|
||||
Fout1->i += scratch[0].r;
|
||||
Fout[m].r -= scratch[0].i;
|
||||
Fout[m].i += scratch[0].r;
|
||||
|
||||
++Fout0;++Fout1;++Fout2;
|
||||
tw1 += fstride;
|
||||
tw2 += fstride*2;
|
||||
}while(--m);
|
||||
++Fout;
|
||||
}while(--k);
|
||||
}
|
||||
|
||||
static void kf_bfly5(
|
||||
kiss_fft_cpx * Fout,
|
||||
const int fstride,
|
||||
const size_t fstride,
|
||||
const kiss_fft_cfg st,
|
||||
int m
|
||||
)
|
||||
@ -204,7 +202,7 @@ static void kf_bfly5(
|
||||
/* perform the butterfly for one stage of a mixed radix FFT */
|
||||
static void kf_bfly_generic(
|
||||
kiss_fft_cpx * Fout,
|
||||
const int fstride,
|
||||
const size_t fstride,
|
||||
const kiss_fft_cfg st,
|
||||
int m,
|
||||
int p
|
||||
@ -243,7 +241,7 @@ static
|
||||
void kf_work(
|
||||
kiss_fft_cpx * Fout,
|
||||
const kiss_fft_cpx * f,
|
||||
const int fstride,
|
||||
const size_t fstride,
|
||||
int in_stride,
|
||||
int * factors,
|
||||
const kiss_fft_cfg st
|
||||
|
Loading…
Reference in New Issue
Block a user