mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-12-24 11:40:31 -05:00
Code cleanup for the sync64 routine.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6941 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
71d94aa4c9
commit
6a8ed228e2
@ -1,43 +1,45 @@
|
|||||||
subroutine sync64(dd,nf1,nf2,maxf1,dtx,f0,kpk,snrdb,s3a)
|
subroutine sync64(dd,nf1,nf2,maxf1,dtx,f0,kpk,snrdb,s3a)
|
||||||
|
|
||||||
parameter (NMAX=60*12000) !Max size of raw data at 12000 Hz
|
parameter (NMAX=60*12000) !Max size of raw data at 12000 Hz
|
||||||
parameter (NSPS=2304) !Samples per symbol at 4000 Hz
|
parameter (NSPS=2304) !Samples per symbol at 4000 Hz
|
||||||
parameter (NSPC=7*NSPS) !Samples per Costas array
|
parameter (NSPC=7*NSPS) !Samples per Costas array
|
||||||
real dd(NMAX) !Raw data
|
real dd(NMAX) !Raw data
|
||||||
real x(672000) !Up to 56 s at 12000 Hz
|
real x(672000) !Up to 56 s at 12000 Hz
|
||||||
real t(5)
|
real s3a(0:63,1:63) !Synchronized symbol spectra
|
||||||
real s3a(0:63,1:63)
|
real s1(0:NSPC-1) !Power spectrum of Costas 1
|
||||||
real s0(0:NSPC-1)
|
real s2(0:NSPC-1) !Power spectrum of Costas 2
|
||||||
real s1(0:NSPC-1)
|
real s3(0:NSPC-1) !Power spectrum of Costas 3
|
||||||
real s2(0:NSPC-1)
|
real s0(0:NSPC-1) !Sum of s1+s2+s3
|
||||||
real s3(0:NSPC-1)
|
real s0a(0:NSPC-1) !Best synchromized spectrum
|
||||||
real s0a(0:NSPC-1)
|
integer icos7(0:6) !Costas 7x7 tones
|
||||||
|
|
||||||
integer*8 count0,count1,clkfreq
|
|
||||||
integer icos7(0:6)
|
|
||||||
integer ipk0(1)
|
integer ipk0(1)
|
||||||
|
complex cc(0:NSPC-1) !Costas waveform
|
||||||
complex cc(0:NSPC-1)
|
complex c0(0:336000) !Complex spectrum of dd()
|
||||||
complex c0(0:336000)
|
complex c1(0:NSPC-1) !Complex spectrum of Costas 1
|
||||||
complex c1(0:NSPC-1)
|
complex c2(0:NSPC-1) !Complex spectrum of Costas 2
|
||||||
complex c2(0:NSPC-1)
|
complex c3(0:NSPC-1) !Complex spectrum of Costas 3
|
||||||
complex c3(0:NSPC-1)
|
logical first
|
||||||
equivalence (x,c0)
|
equivalence (x,c0)
|
||||||
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 pattern
|
data icos7/2,5,6,0,4,1,3/ !Costas 7x7 tone pattern
|
||||||
|
data first/.true./
|
||||||
save
|
save
|
||||||
|
|
||||||
twopi=8.0*atan(1.0)
|
if(first) then
|
||||||
dfgen=12000.0/6912.0
|
twopi=8.0*atan(1.0)
|
||||||
k=-1
|
dfgen=12000.0/6912.0
|
||||||
phi=0.
|
k=-1
|
||||||
do j=0,6
|
phi=0.
|
||||||
dphi=twopi*icos7(j)*dfgen/4000.0
|
do j=0,6 !Compute complex Costas waveform
|
||||||
do i=1,2304
|
dphi=twopi*icos7(j)*dfgen/4000.0
|
||||||
phi=phi + dphi
|
do i=1,2304
|
||||||
if(phi.gt.twopi) phi=phi-twopi
|
phi=phi + dphi
|
||||||
k=k+1
|
if(phi.gt.twopi) phi=phi-twopi
|
||||||
cc(k)=cmplx(cos(phi),sin(phi))
|
k=k+1
|
||||||
|
cc(k)=cmplx(cos(phi),sin(phi))
|
||||||
|
enddo
|
||||||
enddo
|
enddo
|
||||||
enddo
|
first=.false.
|
||||||
|
endif
|
||||||
|
|
||||||
npts0=54*12000
|
npts0=54*12000
|
||||||
nfft1=672000
|
nfft1=672000
|
||||||
@ -45,11 +47,8 @@ subroutine sync64(dd,nf1,nf2,maxf1,dtx,f0,kpk,snrdb,s3a)
|
|||||||
df1=12000.0/nfft1
|
df1=12000.0/nfft1
|
||||||
fac=2.0/nfft1
|
fac=2.0/nfft1
|
||||||
x=fac*dd(1:nfft1)
|
x=fac*dd(1:nfft1)
|
||||||
call system_clock(count0,clkfreq)
|
|
||||||
call four2a(c0,nfft1,1,-1,0) !Forward r2c FFT
|
call four2a(c0,nfft1,1,-1,0) !Forward r2c FFT
|
||||||
call four2a(c0,nfft2,1,1,1) !Inverse c2c FFT; c0 is analytic sig
|
call four2a(c0,nfft2,1,1,1) !Inverse c2c FFT; c0 is analytic sig
|
||||||
call system_clock(count1,clkfreq)
|
|
||||||
t(1)=float(count1-count0)/float(clkfreq)
|
|
||||||
npts2=npts0/3 !Downsampled complex data length
|
npts2=npts0/3 !Downsampled complex data length
|
||||||
nfft3=NSPC
|
nfft3=NSPC
|
||||||
nh3=nfft3/2
|
nh3=nfft3/2
|
||||||
@ -66,7 +65,6 @@ subroutine sync64(dd,nf1,nf2,maxf1,dtx,f0,kpk,snrdb,s3a)
|
|||||||
kb=maxf1
|
kb=maxf1
|
||||||
ipk=0
|
ipk=0
|
||||||
kpk=0
|
kpk=0
|
||||||
call system_clock(count0,clkfreq)
|
|
||||||
do iter=1,2
|
do iter=1,2
|
||||||
do j1=ja,jb,jstep
|
do j1=ja,jb,jstep
|
||||||
j2=j1 + 39*2304
|
j2=j1 + 39*2304
|
||||||
@ -101,8 +99,6 @@ subroutine sync64(dd,nf1,nf2,maxf1,dtx,f0,kpk,snrdb,s3a)
|
|||||||
ipk=ipk0(1)
|
ipk=ipk0(1)
|
||||||
f0=(ipk+ia-1)*df3
|
f0=(ipk+ia-1)*df3
|
||||||
kpk=k
|
kpk=k
|
||||||
! write(16,3101) jpk,ipk,kpk,dtx,f0,snr
|
|
||||||
!3101 format(3i5,f8.3,f8.2,f10.1)
|
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
@ -112,9 +108,11 @@ subroutine sync64(dd,nf1,nf2,maxf1,dtx,f0,kpk,snrdb,s3a)
|
|||||||
! ka=kpk
|
! ka=kpk
|
||||||
! kb=kpk
|
! kb=kpk
|
||||||
enddo
|
enddo
|
||||||
call system_clock(count1,clkfreq)
|
|
||||||
t(2)=float(count1-count0)/float(clkfreq)
|
|
||||||
snrdb=10.0*log10(snr)-39.0
|
snrdb=10.0*log10(snr)-39.0
|
||||||
|
|
||||||
|
!###
|
||||||
|
! Now use tweak on the c0() array, then do nfft4=NSPS FFTs to get s3a(),
|
||||||
|
! the properly synchronized symbol spectra.
|
||||||
|
|
||||||
return
|
return
|
||||||
end subroutine sync64
|
end subroutine sync64
|
||||||
|
Loading…
Reference in New Issue
Block a user