diff options
| author | Christoph Berg <myon@debian.org> | 2021-09-09 22:49:00 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2021-09-09 22:49:00 +0200 |
| commit | 85895feeaf88bcde26bbfc71e8f6b2047c0f5f41 (patch) | |
| tree | 79807e00771e4af4ce279e368262f2222806102f /map65/libm65/ccf2.f90 | |
| parent | 2f095a04ed69d9aa14b47dc4acde6b3225b2d65e (diff) | |
New upstream version 2.5.0~rc6+repackupstream/2.5.0_rc6+repack
Diffstat (limited to 'map65/libm65/ccf2.f90')
| -rw-r--r-- | map65/libm65/ccf2.f90 | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/map65/libm65/ccf2.f90 b/map65/libm65/ccf2.f90 new file mode 100644 index 00000000..287e70ff --- /dev/null +++ b/map65/libm65/ccf2.f90 @@ -0,0 +1,45 @@ +subroutine ccf2(ss,nz,nflip,ccfbest,lagpk) + +! parameter (LAGMAX=60) + parameter (LAGMAX=200) + real ss(nz) + real ccf(-LAGMAX:LAGMAX) + integer npr(126) + +! The 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 + 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 +end subroutine ccf2 |
