home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
326.lha
/
KFFT_v1.1
/
fftrc
< prev
next >
Wrap
Text File
|
1989-12-23
|
1KB
|
68 lines
\ FFTRC - Fast Fourier Transform - Real in, Complex out.
\
\ KFFT V1.1 (C)Copyright 1989, Jerry Kallaus. All rights reserved.
\ May be freely redistributed for non-commercial use (FREEWARE).
INCLUDE? fft1 fftinc
anew task-fftrc
: FFTRC { a m | n/2 n41 kk km xk+xkm xk-xkm yk-ykm savbits --- }
[ auto_scale_fft? ]
.IF outbits-fft @ -> savbits 14 outbits-fft ! .THEN
a m 1- FFT ( do cmplx fft with half as many elements )
m 1- 2** -> n/2
[ float_fft? w_table_fft? NOT AND ]
.IF
pi_fft n/2 FLOAT s/
ZEXP CONJG
.ELSE
m 1- ZCELLS w-table-fft + Z@ CONJG
.THEN
z1
a -> kk
a n/2 ZCELLS + -> km
n/2 U2/ 1
DO
kk ZCELL+ -> kk
km ZCELL- -> km
ZOVER Z*
ZDUP
km @ kk @ 2DUP s+ -> xk+xkm
s-
kk CELL+ @ km CELL+ @
2DUP s- -> yk-ykm
s+ SWAP Z*
2DUP xk+xkm yk-ykm
Z+ kk Z!
SWAP SNEGATE SWAP
xk+xkm yk-ykm SNEGATE
Z+ km Z!
LOOP
ZDROP ZDROP
a @ DUP s+ a CELL+ @ DUP s+
ZDUP s- >r s+ r> a Z!
kk ZCELL+ -> kk
kk @ DUP s+ kk ! kk CELL+ DUP>R @ DUP s+ SNEGATE R> !
[ auto_scale_fft? ] .IF
savbits dup outbits-fft !
IF
savbits 16 -
IF
a n/2 2* savbits 16 -
DUP shifts-fft +!
DUP blk-exp-fft +!
ASHIFT.ARRAY
THEN
THEN
.THEN
;