WSJT-X/lib/extract4.f90
Bill Somerville dd1362b69a Rationalize NA contest mode
Generic message packing and unpacking routines now understand antipode
grid contest messages.  These messages  are now recognized as standard
messages in  message response processing and  dealt with appropriately
when contest mode is selected and applicable (currently FT8 and MSK144
only).

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@8062 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
2017-09-01 20:10:35 +00:00

70 lines
1.6 KiB
Fortran

subroutine extract4(sym0,ncount,decoded)
use packjt
real sym0(207)
real sym(207)
character decoded*22
character*72 c72
integer*1 symbol(207)
integer*1 data1(13) !Decoded data (8-bit bytes)
integer data4a(9) !Decoded data (8-bit bytes)
integer data4(12) !Decoded data (6-bit bytes)
integer mettab(-128:127,0:1) !Metric table
logical first
data first/.true./
save first,mettab,ndelta
if(first) then
call getmet4(mettab,ndelta)
first=.false.
endif
!### Optimize these params: ...
amp=30.0
limit=10000
ave0=sum(sym0)/207.0
sym=sym0-ave0
sq=dot_product(sym,sym)
rms0=sqrt(sq/206.0)
sym=sym/rms0
do j=1,207
n=nint(amp*sym(j))
if(n.lt.-127) n=-127
if(n.gt.127) n=127
symbol(j)=n
enddo
nbits=72
ncycles=0
ncount=-1
decoded=' '
call interleave4(symbol(2),-1) !Remove the interleaving
call fano232(symbol(2),nbits+31,mettab,ndelta,limit,data1, &
ncycles,metric,ncount)
nlim=ncycles/(nbits+31)
!### Make usage here like that in jt9fano...
if(ncount.ge.0) then
do i=1,9
i4=data1(i)
if(i4.lt.0) i4=i4+256
data4a(i)=i4
enddo
write(c72,1100) (data4a(i),i=1,9)
1100 format(9b8.8)
read(c72,1102) data4
1102 format(12b6)
call unpackmsg(data4,decoded,.false.,' ')
if(decoded(1:6).eq.'000AAA') then
! decoded='***WRONG MODE?***'
decoded=' '
ncount=-1
endif
endif
return
end subroutine extract4