From 68f82c95de615c861c53dbe6b7b3bd5c031a1b68 Mon Sep 17 00:00:00 2001 From: Steve Franke Date: Sat, 30 Mar 2019 15:55:05 -0500 Subject: [PATCH] FT4: Only do the big FFT once for each candidate. Duh. --- lib/ft4/ft4_decode.f90 | 8 +++++--- lib/ft4/ft4_downsample.f90 | 16 +++++++++------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/ft4/ft4_decode.f90 b/lib/ft4/ft4_decode.f90 index bd28b8899..83287e1e9 100644 --- a/lib/ft4/ft4_decode.f90 +++ b/lib/ft4/ft4_decode.f90 @@ -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) diff --git a/lib/ft4/ft4_downsample.f90 b/lib/ft4/ft4_downsample.f90 index ca5991346..8fb7c5d1d 100644 --- a/lib/ft4/ft4_downsample.f90 +++ b/lib/ft4/ft4_downsample.f90 @@ -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