mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-12-24 11:40:31 -05:00
e25dd201a3
1. Change to rectangular FFT window for 2D sync spectrum (ss). 2. Move 2D sync spectrum array to common block. 3. Change to quarter-symbol steps for the ss array. 4. Allow up to 4 decoding passes. 5. Wire up Fast/Normal/Deep for 2, 3, or 4 decoding passes. 6. Make minsmo=0 (instead of 1) for minimally spread JT65B/C signals. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8178 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
77 lines
1.9 KiB
Fortran
77 lines
1.9 KiB
Fortran
!subroutine xcor(ss,ipk,nsteps,nsym,lag1,lag2,ccf,ccf0,lagpk,flip,fdot,nrobust)
|
|
subroutine xcor(ipk,nsteps,nsym,lag1,lag2,ccf,ccf0,lagpk,flip,fdot,nrobust)
|
|
|
|
! Computes ccf of a row of ss and the pseudo-random array pr. Returns
|
|
! peak of the CCF and the lag at which peak occurs. For JT65, the
|
|
! CCF peak may be either positive or negative, with negative implying
|
|
! the "OOO" message.
|
|
|
|
use jt65_mod
|
|
parameter (NHMAX=3413) !Max length of power spectra
|
|
parameter (NSMAX=552) !Max number of quarter-symbol steps
|
|
real ss(NSMAX,NHMAX) !2d spectrum, stepped by half-symbols
|
|
real a(NSMAX)
|
|
! real ccf(-44:118)
|
|
real ccf(lag1:lag2)
|
|
data lagmin/0/ !Silence g77 warning
|
|
! save
|
|
common/sync/ss
|
|
|
|
df=12000.0/8192.
|
|
! dtstep=0.5/df
|
|
dtstep=0.25/df
|
|
fac=dtstep/(60.0*df)
|
|
do j=1,nsteps
|
|
ii=nint((j-nsteps/2)*fdot*fac)+ipk
|
|
if( (ii.ge.1) .and. (ii.le.NHMAX) ) then
|
|
a(j)=ss(j,ii)
|
|
endif
|
|
enddo
|
|
|
|
if(nrobust.eq.1) then
|
|
! use robust correlation estimator to mitigate AGC attack spikes at beginning
|
|
! this reduces the number of spurious candidates overall
|
|
call pctile(a,nsteps,50,xmed)
|
|
do j=1,nsteps
|
|
if( a(j).ge.xmed ) then
|
|
a(j)=1
|
|
else
|
|
a(j)=-1
|
|
endif
|
|
enddo
|
|
endif
|
|
|
|
ccfmax=0.
|
|
ccfmin=0.
|
|
do lag=lag1,lag2
|
|
x=0.
|
|
do i=1,nsym
|
|
j=4*i-3+lag
|
|
if(j.ge.1 .and. j.le.nsteps) x=x+a(j)*pr(i)
|
|
enddo
|
|
ccf(lag)=2*x !The 2 is for plotting scale
|
|
if(ccf(lag).gt.ccfmax) then
|
|
ccfmax=ccf(lag)
|
|
lagpk=lag
|
|
endif
|
|
|
|
if(ccf(lag).lt.ccfmin) then
|
|
ccfmin=ccf(lag)
|
|
lagmin=lag
|
|
endif
|
|
enddo
|
|
|
|
ccf0=ccfmax
|
|
flip=1.0
|
|
if(-ccfmin.gt.ccfmax) then
|
|
do lag=lag1,lag2
|
|
ccf(lag)=-ccf(lag)
|
|
enddo
|
|
lagpk=lagmin
|
|
ccf0=-ccfmin
|
|
flip=-1.0
|
|
endif
|
|
|
|
return
|
|
end subroutine xcor
|