diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /map65/libm65/ccf2.f90 | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to 'map65/libm65/ccf2.f90')
| -rw-r--r-- | map65/libm65/ccf2.f90 | 93 |
1 files changed, 58 insertions, 35 deletions
diff --git a/map65/libm65/ccf2.f90 b/map65/libm65/ccf2.f90 index 287e70ff..521c7d6f 100644 --- a/map65/libm65/ccf2.f90 +++ b/map65/libm65/ccf2.f90 @@ -1,45 +1,68 @@ -subroutine ccf2(ss,nz,nflip,ccfbest,lagpk) +module ccf2_mod + implicit none +contains -! parameter (LAGMAX=60) - parameter (LAGMAX=200) - real ss(nz) - real ccf(-LAGMAX:LAGMAX) - integer npr(126) +subroutine ccf2(ss, nz, nflip, ccfbest, lagpk) + implicit none -! The JT65 pseudo-random sync pattern: - data npr/ & + !==== Arguments ============================================================ + integer, intent(in) :: nz + real, intent(in) :: ss(nz) + integer, intent(in) :: nflip + real, intent(out) :: ccfbest + integer, intent(out) :: lagpk + + !==== Parameters =========================================================== + integer, parameter :: LAGMAX = 200 + + !==== Local variables ====================================================== + real :: ccf(-LAGMAX:LAGMAX) + real :: s0, s1, x + integer :: npr(126) + integer :: i, j, lag, lag1, lag2 + + !==== JT65 pseudo-random sync pattern ===================================== + data npr / & 1,0,0,1,1,0,0,0,1,1,1,1,1,1,0,1,0,1,0,0, & 0,1,0,1,1,0,0,1,0,0,0,1,1,1,0,0,1,1,1,1, & 0,1,1,0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,1,1, & 0,0,1,1,0,1,0,1,0,1,0,0,1,0,0,0,0,0,0,1, & 1,0,0,0,0,0,0,0,1,1,0,1,0,0,1,0,1,1,0,1, & 0,1,0,1,0,0,1,1,0,0,1,0,0,1,0,0,0,0,1,1, & - 1,1,1,1,1,1/ - save - - ccfbest=0. - lag1=-LAGMAX - lag2=LAGMAX - do lag=lag1,lag2 - s0=0. - s1=0. - do i=1,126 - j=2*(8*i + 43) + lag - if(j.ge.1 .and. j.le.nz-8) then - x=ss(j)+ss(j+8) !Add two half-symbol contributions - if(npr(i).eq.0) then - s0=s0 + x + 1,1,1,1,1,1 / + + !==== Initialize outputs =================================================== + ccfbest = 0.0 + lagpk = 0 + + !==== Main correlation loop =============================================== + lag1 = -LAGMAX + lag2 = LAGMAX + + do lag = lag1, lag2 + s0 = 0.0 + s1 = 0.0 + + do i = 1, 126 + j = 2*(8*i + 43) + lag + if (j >= 1 .and. j <= nz-8) then + x = ss(j) + ss(j+8) + if (npr(i) == 0) then + s0 = s0 + x else - s1=s1 + x - endif - endif - enddo - ccf(lag)=nflip*(s1-s0) - if(ccf(lag).gt.ccfbest) then - ccfbest=ccf(lag) - lagpk=lag - endif - enddo - - return + s1 = s1 + x + end if + end if + end do + + ccf(lag) = nflip * (s1 - s0) + + if (ccf(lag) > ccfbest) then + ccfbest = ccf(lag) + lagpk = lag + end if + end do + end subroutine ccf2 + +end module ccf2_mod |
