mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-18 01:52:05 -05:00
Tweaks to syncmsk144 - improve performance for short pings.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6758 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
c7344e0441
commit
b91a9a782b
@ -109,6 +109,10 @@ subroutine syncmsk144(cdat,npts,pchk_file,msgreceived,fest,nutc,t0)
|
|||||||
niterations=0
|
niterations=0
|
||||||
ndither=0
|
ndither=0
|
||||||
i1hashdec=0
|
i1hashdec=0
|
||||||
|
fest=0.0
|
||||||
|
i1Dec8BitBytes=0
|
||||||
|
nbadsync1=-1
|
||||||
|
nbadsync2=-1
|
||||||
goto 999
|
goto 999
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -140,70 +144,102 @@ subroutine syncmsk144(cdat,npts,pchk_file,msgreceived,fest,nutc,t0)
|
|||||||
|
|
||||||
! See if we can find "closed brackets" - a pair of peaks that differ by 864, plus or minus
|
! See if we can find "closed brackets" - a pair of peaks that differ by 864, plus or minus
|
||||||
! This information is not yet used for anything
|
! This information is not yet used for anything
|
||||||
do ii=1,5
|
! do ii=1,5
|
||||||
do jj=ii+1,5
|
! do jj=ii+1,5
|
||||||
if( (ii .ne. jj) .and. (abs( abs(ipeaks(ii)-ipeaks(jj))-864) .le. 5) ) then
|
! if( (ii .ne. jj) .and. (abs( abs(ipeaks(ii)-ipeaks(jj))-864) .le. 5) ) then
|
||||||
! write(*,*) "closed brackets: ",ii,jj,ipeaks(ii),ipeaks(jj),abs(ipeaks(ii)-ipeaks(jj))
|
! write(*,*) "closed brackets: ",ii,jj,ipeaks(ii),ipeaks(jj),abs(ipeaks(ii)-ipeaks(jj))
|
||||||
endif
|
! endif
|
||||||
enddo
|
! enddo
|
||||||
enddo
|
! enddo
|
||||||
|
|
||||||
do iav=1,6
|
|
||||||
do ipk=1,5
|
do ipk=1,5
|
||||||
do id=1,3
|
|
||||||
if( id .eq. 1 ) is=0
|
|
||||||
if( id .eq. 2 ) is=-1
|
|
||||||
if( id .eq. 3 ) is=1
|
|
||||||
|
|
||||||
! we want ic to be the index of the first sample of the message
|
! we want ic to be the index of the first sample of the frame
|
||||||
ic=ipeaks(ipk)
|
ic0=ipeaks(ipk)
|
||||||
|
|
||||||
if( ic .le. 864 ) ic=ic+864
|
! fine adjustment of sync index
|
||||||
if( ic .gt. 2*864 ) ic=ic-864
|
! bb lag used to place the sampling index at the center of the eye
|
||||||
! now do fine adjustment of sync index
|
|
||||||
! bb is used to place the sampling index at the center of the eye
|
|
||||||
do i=1,6
|
do i=1,6
|
||||||
io=i-3
|
if( ic0+11+NSPM .le. npts ) then
|
||||||
ill=max(1,ic+io)
|
bb(i) = sum( ( cdat(ic0+i-1+6:ic0+i-1+6+NSPM:6) * conjg( cdat(ic0+i-1:ic0+i-1+NSPM:6) ) )*2 )
|
||||||
iul=min(ic+io+6+864,npts)
|
else
|
||||||
bb(i) = sum( ( cdat(ic+io:iul-6:6) * conjg( cdat(ic+io+6:iul:6) ) )*2 )
|
bb(i) = sum( ( cdat(ic0+i-1+6:npts:6) * conjg( cdat(ic0+i-1:npts-6:6) ) )*2 )
|
||||||
|
endif
|
||||||
enddo
|
enddo
|
||||||
iloc=maxloc(abs(bb))
|
iloc=maxloc(abs(bb))
|
||||||
ibb=iloc(1)
|
ibb=iloc(1)
|
||||||
|
bba=abs(bb(ibb))
|
||||||
|
if( ibb .le. 3 ) ibb=ibb-1
|
||||||
|
if( ibb .gt. 3 ) ibb=ibb-7
|
||||||
|
do id=1,3 ! slicer dither
|
||||||
|
if( id .eq. 1 ) is=0
|
||||||
|
if( id .eq. 2 ) is=-1
|
||||||
|
if( id .eq. 3 ) is=1
|
||||||
! Adjust frame index to place peak of bb at desired lag
|
! Adjust frame index to place peak of bb at desired lag
|
||||||
ic=ic + ibb-2+is
|
ic=ic0+ibb+is
|
||||||
if( ic .le. 864 ) ic=ic+864
|
if( ic .lt. 1 ) ic=ic+864
|
||||||
if( ic .gt. 2*864 ) ic=ic-864
|
|
||||||
|
|
||||||
! Estimate fine frequency error.
|
! Estimate fine frequency error.
|
||||||
! Should a larger separation be used when frames are averaged?
|
! Should a larger separation be used when frames are averaged?
|
||||||
cca=sum(cdat(ic:ic+41)*conjg(cb))
|
cca=sum(cdat(ic:ic+41)*conjg(cb))
|
||||||
ccb=sum(cdat(ic+56*6:ic+56*6+41)*conjg(cb))
|
if( ic+56*6+41 .le. npts ) then
|
||||||
cfac=ccb*conjg(cca)
|
ccb=sum(cdat(ic+56*6:ic+56*6+41)*conjg(cb))
|
||||||
ferr2=atan2(imag(cfac),real(cfac))/(twopi*56*6*dt)
|
cfac=ccb*conjg(cca)
|
||||||
|
ferr2=atan2(imag(cfac),real(cfac))/(twopi*56*6*dt)
|
||||||
|
else
|
||||||
|
ccb=sum(cdat(ic-88*6:ic-88*6+41)*conjg(cb))
|
||||||
|
cfac=cca*conjg(ccb)
|
||||||
|
ferr2=atan2(imag(cfac),real(cfac))/(twopi*88*6*dt)
|
||||||
|
endif
|
||||||
|
|
||||||
! Final estimate of the carrier frequency - returned to the calling program
|
! Final estimate of the carrier frequency - returned to the calling program
|
||||||
fest=1500+ferr+ferr2
|
fest=1500+ferr+ferr2
|
||||||
! Remove fine frequency error
|
! Remove fine frequency error
|
||||||
call tweak1(cdat,npts,-ferr2,cdat2)
|
call tweak1(cdat,npts,-ferr2,cdat2)
|
||||||
|
|
||||||
! place the beginning of the central frame at NSPM+1
|
! place the beginning of frame at index NSPM+1
|
||||||
cdat2=cshift(cdat2,ic-865)
|
cdat2=cshift(cdat2,ic-(NSPM+1))
|
||||||
|
|
||||||
|
do iav=1,7
|
||||||
! Try each of the three frames individually, and then
|
! Try each of the three frames individually, and then
|
||||||
! do frame averaging on passes 4 and 5
|
! do frame averaging on passes 4 and 5
|
||||||
|
if( 0 .eq. 1 ) then
|
||||||
if( iav .eq. 1 ) then
|
if( iav .eq. 1 ) then
|
||||||
c=cdat2(NSPM+1:2*NSPM)
|
|
||||||
elseif( iav .eq. 2 ) then
|
|
||||||
c=cdat2(2*NSPM+1:npts)
|
|
||||||
elseif( iav .eq. 3 ) then
|
|
||||||
c=cdat2(1:NSPM)
|
c=cdat2(1:NSPM)
|
||||||
|
elseif( iav .eq. 2 ) then
|
||||||
|
c=cdat2(NSPM+1:2*NSPM)
|
||||||
|
elseif( iav .eq. 3 ) then
|
||||||
|
c=cdat2(2*NSPM+1:npts)
|
||||||
elseif( iav .eq. 4 ) then
|
elseif( iav .eq. 4 ) then
|
||||||
c=cdat2(1:NSPM)+cdat2(NSPM+1:2*NSPM)
|
c=cdat2(1:NSPM)+cdat2(NSPM+1:2*NSPM)
|
||||||
elseif( iav .eq. 5 ) then
|
elseif( iav .eq. 5 ) then
|
||||||
c=cdat2(NSPM+1:2*NSPM)+cdat2(2*NSPM+1:npts)
|
c=cdat2(1:NSPM)+cdat2(NSPM+1:2*NSPM)
|
||||||
elseif( iav .eq. 6 ) then
|
elseif( iav .eq. 6 ) then
|
||||||
|
c=cdat2(1:NSPM)+cdat2(NSPM+1:2*NSPM)
|
||||||
|
elseif( iav .eq. 7 ) then
|
||||||
|
c=cdat2(1:NSPM)+cdat2(NSPM+1:2*NSPM)
|
||||||
|
elseif( iav .eq. 8 ) then
|
||||||
|
c=cdat2(NSPM+1:2*NSPM)+cdat2(2*NSPM+1:npts)
|
||||||
|
elseif( iav .eq. 9 ) then
|
||||||
|
c=cdat2(1:NSPM)+cdat2(NSPM+1:2*NSPM)+cdat2(2*NSPM+1:npts)
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
|
if( iav .eq. 1 ) then
|
||||||
|
c(1:NSPM)=cdat2(NSPM+1:2*NSPM) !avg 1 frame to the right of ic
|
||||||
|
elseif( iav .eq. 2 ) then
|
||||||
|
c=cdat2(NSPM-431:NSPM+432) !1 frame centered on ic
|
||||||
|
c=cshift(c,-432)
|
||||||
|
elseif( iav .eq. 3 ) then !1 frame to the left of ic
|
||||||
|
c=cdat2(1:NSPM)
|
||||||
|
elseif( iav .eq. 4 ) then
|
||||||
|
c=cdat2(NSPM+432:NSPM+432+863) !1 frame beginning 36ms to the right of ic
|
||||||
|
c=cshift(c,432)
|
||||||
|
elseif( iav .eq. 5 ) then
|
||||||
|
c=cdat2(1:NSPM)+cdat2(NSPM+1:2*NSPM)
|
||||||
|
elseif( iav .eq. 6 ) then
|
||||||
|
c=cdat2(NSPM+1:2*NSPM)+cdat2(2*NSPM+1:npts)
|
||||||
|
elseif( iav .eq. 7 ) then
|
||||||
c=cdat2(1:NSPM)+cdat2(NSPM+1:2*NSPM)+cdat2(2*NSPM+1:npts)
|
c=cdat2(1:NSPM)+cdat2(NSPM+1:2*NSPM)+cdat2(2*NSPM+1:npts)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
@ -214,28 +250,33 @@ subroutine syncmsk144(cdat,npts,pchk_file,msgreceived,fest,nutc,t0)
|
|||||||
ffin=atan2(imag(cfac),real(cfac))/(twopi*56*6*dt)
|
ffin=atan2(imag(cfac),real(cfac))/(twopi*56*6*dt)
|
||||||
phase0=atan2(imag(cca+ccb),real(cca+ccb))
|
phase0=atan2(imag(cca+ccb),real(cca+ccb))
|
||||||
|
|
||||||
! Remove the static phase error from the data
|
|
||||||
cfac=cmplx(cos(phase0),sin(phase0))
|
cfac=cmplx(cos(phase0),sin(phase0))
|
||||||
c=c*conjg(cfac)
|
c=c*conjg(cfac)
|
||||||
|
|
||||||
! sample to get softsamples
|
! sample to get softsamples
|
||||||
do i=1,72
|
! do i=1,72
|
||||||
softbits(2*i-1)=imag(c(1+(i-1)*12))
|
! softbits(2*i-1)=imag(c(1+(i-1)*12))
|
||||||
softbits(2*i)=real(c(7+(i-1)*12))
|
! softbits(2*i)=real(c(7+(i-1)*12))
|
||||||
|
! enddo
|
||||||
|
|
||||||
|
! matched filter
|
||||||
|
softbits(1)=sum(imag(c(1:6))*pp(7:12))+sum(imag(c(864-5:864))*pp(1:6))
|
||||||
|
softbits(2)=sum(real(c(1:12))*pp)
|
||||||
|
do i=2,72
|
||||||
|
softbits(2*i-1)=sum(imag(c(1+(i-1)*12-6:1+(i-1)*12+5))*pp)
|
||||||
|
softbits(2*i)=sum(real(c(7+(i-1)*12-6:7+(i-1)*12+5))*pp)
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
hardbits=0
|
hardbits=0
|
||||||
do i=1,144
|
do i=1,144
|
||||||
if( softbits(i) .ge. 0.0 ) then
|
if( softbits(i) .ge. 0.0 ) then
|
||||||
hardbits(i)=1
|
hardbits(i)=1
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
nbadsync1=(8-sum( (2*hardbits(1:8)-1)*s8 ) )/2
|
||||||
! calculated the number of sync-word bits that are incorrect
|
nbadsync2=(8-sum( (2*hardbits(1+56:8+56)-1)*s8 ) )/2
|
||||||
! don't present to the decoder if there are too many sync-word bit-errors
|
|
||||||
nbadsync1=(8-sum(s8*(2*hardbits(1:8)-1)))/2
|
|
||||||
nbadsync2=(8-sum(s8*(2*hardbits(57:57+7)-1)))/2
|
|
||||||
nbadsync=nbadsync1+nbadsync2
|
nbadsync=nbadsync1+nbadsync2
|
||||||
if( nbadsync .gt. 6 ) cycle
|
if( nbadsync .gt. 4 ) cycle
|
||||||
|
|
||||||
! this could be used to count the number of hard errors that were corrected
|
! this could be used to count the number of hard errors that were corrected
|
||||||
hardword(1:48)=hardbits(9:9+47)
|
hardword(1:48)=hardbits(9:9+47)
|
||||||
@ -249,8 +290,7 @@ subroutine syncmsk144(cdat,npts,pchk_file,msgreceived,fest,nutc,t0)
|
|||||||
ssig=sqrt(s2av-sav*sav)
|
ssig=sqrt(s2av-sav*sav)
|
||||||
softbits=softbits/ssig
|
softbits=softbits/ssig
|
||||||
|
|
||||||
! sigma=0.65
|
sigma=0.65
|
||||||
sigma=0.70
|
|
||||||
lratio(1:48)=softbits(9:9+47)
|
lratio(1:48)=softbits(9:9+47)
|
||||||
lratio(49:128)=softbits(65:65+80-1)
|
lratio(49:128)=softbits(65:65+80-1)
|
||||||
lratio=exp(2.0*lratio/(sigma*sigma))
|
lratio=exp(2.0*lratio/(sigma*sigma))
|
||||||
@ -258,7 +298,7 @@ subroutine syncmsk144(cdat,npts,pchk_file,msgreceived,fest,nutc,t0)
|
|||||||
unscrambledsoftbits(1:127:2)=lratio(1:64)
|
unscrambledsoftbits(1:127:2)=lratio(1:64)
|
||||||
unscrambledsoftbits(2:128:2)=lratio(65:128)
|
unscrambledsoftbits(2:128:2)=lratio(65:128)
|
||||||
|
|
||||||
max_iterations=10
|
max_iterations=20
|
||||||
max_dither=50
|
max_dither=50
|
||||||
call ldpc_decode(unscrambledsoftbits, decoded, max_iterations, niterations, max_dither, ndither)
|
call ldpc_decode(unscrambledsoftbits, decoded, max_iterations, niterations, max_dither, ndither)
|
||||||
|
|
||||||
@ -309,9 +349,9 @@ goto 999
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
999 continue
|
999 continue
|
||||||
! write(78,1001) nutc,t0,iav,ipk,is,fdiff,fest,nbadsync1,nbadsync2, &
|
! write(78,1001) nutc,t0,iav,ipk,is,fdiff,fest,ffin,nbadsync1,nbadsync2, &
|
||||||
! phase0,niterations,ndither,i1hashdec,i1Dec8BitBytes(10),msgreceived
|
! phase0,niterations,ndither,i1hashdec,i1Dec8BitBytes(10),msgreceived
|
||||||
!1001 format(i6,f8.2,i4,i4,i4,f8.2,f8.2,i4,i4,f8.2,i4,i4,i4,i4,2x,a22)
|
!1001 format(i6,f8.2,i4,i4,i4,f8.2,f8.2,f8.2,i4,i4,f8.2,i4,i4,i4,i4,2x,a22)
|
||||||
|
|
||||||
return
|
return
|
||||||
end subroutine syncmsk144
|
end subroutine syncmsk144
|
||||||
|
Loading…
Reference in New Issue
Block a user