WSJT-X/libm65/decodemsk.f90
Joe Taylor 8b55eb3a28 Functioning JTMSK decoder, within stand-alone program msk.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/jtms3@2519 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2012-07-17 19:31:01 +00:00

40 lines
1.0 KiB
Fortran

subroutine decodemsk(cdat,npts,cw,i1,nchar,s2,msg)
! DF snd sync have been established, now decode the message
complex cdat(npts)
complex cw(168,0:63) !Complex waveforms for codewords
real s2(0:63,400)
character msg*400
complex z,zmax
character cc*64
! 1 2 3 4 5 6
! 0123456789012345678901234567890123456789012345678901234567890123
data cc/'0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ./?- _ @'/
msg=' '
do j=1,nchar !Find best match for each character
ia=i1 + (j-1)*168
smax=0.
do k=0,40
kk=k
if(k.eq.40) kk=57
z=0.
do i=1,168
z=z + cdat(ia+i)*conjg(cw(i,kk))
enddo
ss=abs(z)
s2(k,j)=ss
if(ss.gt.smax) then
smax=ss
zmax=z
kpk=kk
endif
enddo
msg(j:j)=cc(kpk+1:kpk+1)
if(kpk.eq.57) msg(j:j)=' '
enddo
return
end subroutine decodemsk