From 4bce86d61e566cf7750fa4b85e12a6552b6f5abe Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 3 Jul 2017 19:01:38 +0000 Subject: [PATCH] Correct the FT8 downsample factor to be exactly 1/64. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7779 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/fsk4hf/ft8b.f90 | 26 +++++++++++++++----------- lib/refspectrum.f90 | 2 ++ 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/lib/fsk4hf/ft8b.f90 b/lib/fsk4hf/ft8b.f90 index 8c5401fba..8c26b0197 100644 --- a/lib/fsk4hf/ft8b.f90 +++ b/lib/fsk4hf/ft8b.f90 @@ -13,7 +13,7 @@ subroutine ft8b(dd0,nfqso,f1,xdt,nharderrors,dmin,nbadcrc,message,xsnr) integer*1 decoded(KK),apmask(3*ND),cw(3*ND) integer itone(NN) integer icos7(0:6) - complex cd0(NP2) + complex cd0(3125) complex csync(0:6,32) complex ctwk(32) complex csymb(32) @@ -193,30 +193,34 @@ subroutine ft8_downsample(dd,f0,c1) ! Downconvert to complex data sampled at 187.5 Hz, 32 samples/symbol - parameter (NMAX=15*12000,NFFT2=2812) + parameter (NMAX=15*12000) + parameter (NFFT1=200000,NFFT2=3125) !200000/64 = 3125 complex c1(0:NFFT2-1) - complex cx(0:NMAX/2) - real dd(NMAX),x(NMAX) + complex cx(0:NFFT1/2) + real dd(NMAX),x(NFFT1) equivalence (x,cx) save x - df=12000.0/NMAX - x=dd - call four2a(cx,NMAX,1,-1,0) !r2c FFT to freq domain - baud=12000.0/(32.0*64.0) + df=12000.0/NFFT1 + x(1:NMAX)=dd + x(NMAX+1:NFFT1)=0. !Zero-pad the x array + call four2a(cx,NFFT1,1,-1,0) !r2c FFT to freq domain + baud=12000.0/2048.0 i0=nint(f0/df) ft=f0+8.0*baud - it=min(nint(ft/df),NMAX/2-1) + it=min(nint(ft/df),NFFT1/2) fb=f0-1.0*baud ib=max(1,nint(fb/df)) k=0 - c1=cmplx(0.0,0.0) + c1=0. do i=ib,it c1(k)=cx(i) k=k+1 enddo c1=cshift(c1,i0-ib) call four2a(c1,NFFT2,1,1,1) !c2c FFT back to time domain - c1=c1/(NMAX*NFFT2) + fac=1.0/sqrt(float(NFFT1)*NFFT2) + c1=fac*c1 + return end subroutine ft8_downsample diff --git a/lib/refspectrum.f90 b/lib/refspectrum.f90 index 8d0730df9..982813b98 100644 --- a/lib/refspectrum.f90 +++ b/lib/refspectrum.f90 @@ -25,6 +25,8 @@ subroutine refspectrum(id2,id2b,kk,bclear,brefspec,buseref,fname) data first/.true./,blastuse/.false./ save + print*,fname + if(first) then pi=4.0*atan(1.0) do i=0,NFFT-1