FT4: Only do the big FFT once for each candidate. Duh.

This commit is contained in:
Steve Franke 2019-03-30 15:55:05 -05:00
parent 68308e23aa
commit 68f82c95de
2 changed files with 14 additions and 10 deletions

View File

@ -46,7 +46,7 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, &
logical nohiscall,unpk77_success
logical one(0:255,0:7) ! 256 4-symbol sequences, 8 bits
logical first
logical first, dobigfft
data icos4a/0,1,3,2/
data icos4b/1,0,2,3/
@ -189,12 +189,14 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, &
call clockit('getcand4',1)
ndecodes=0
dobigfft=.true.
do icand=1,ncand
f0=candidate(1,icand)
snr=candidate(3,icand)-1.0
if( f0.le.10.0 .or. f0.ge.4990.0 ) cycle
call clockit('ft4_down',0)
call ft4_downsample(iwave,f0,cd2) !Downsample from 512 to 32 Sa/Symbol
call ft4_downsample(iwave,dobigfft,f0,cd2) !Downsample from 512 to 32 Sa/Symbol
if(dobigfft) dobigfft=.false.
call clockit('ft4_down',1)
sum2=sum(cd2*conjg(cd2))/(real(NMAX)/real(NDOWN))
@ -238,7 +240,7 @@ subroutine ft4_decode(cdatetime0,tbuf,nfa,nfb,nQSOProgress,ncontest,nfqso, &
if( f0.le.10.0 .or. f0.ge.4990.0 ) cycle
call clockit('ft4down ',0)
call ft4_downsample(iwave,f0,cb) !Final downsample with corrected f0
call ft4_downsample(iwave,dobigfft,f0,cb) !Final downsample with corrected f0
call clockit('ft4down ',1)
sum2=sum(abs(cb)**2)/(real(NSS)*NN)
if(sum2.gt.0.0) cb=cb/sqrt(sum2)

View File

@ -1,4 +1,4 @@
subroutine ft4_downsample(iwave,f0,c)
subroutine ft4_downsample(iwave,newdata,f0,c)
! Input: i*2 data in iwave() at sample rate 12000 Hz
! Output: Complex data in c(), sampled at 1200 Hz
@ -11,9 +11,9 @@ subroutine ft4_downsample(iwave,f0,c)
complex cx(0:NMAX/2)
real x(NMAX), window(0:NFFT2-1)
equivalence (x,cx)
logical first
logical first, newdata
data first/.true./
save first,window
save first,window,x
df=12000.0/NMAX
baud=12000.0/NSPS
@ -32,14 +32,16 @@ subroutine ft4_downsample(iwave,f0,c)
first=.false.
endif
x=iwave
call four2a(x,NMAX,1,-1,0) !r2c FFT to freq domain
if(newdata) then
x=iwave
call four2a(x,NMAX,1,-1,0) !r2c FFT to freq domain
endif
i0=nint(f0/df)
c1=0.
c1(0)=cx(i0)
do i=1,NFFT2/2
if(i0+i.le.NMAX/2) c1(i)=cx(i0+i)
if(i0-i.ge.0) c1(NFFT2-i)=cx(i0-i)
if(i0+i.le.NMAX/2) c1(i)=cx(i0+i)
if(i0-i.ge.0) c1(NFFT2-i)=cx(i0-i)
enddo
c1=c1*window/NFFT2
call four2a(c1,NFFT2,1,1,1) !c2c FFT back to time domain