Add the decode9 routine.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2631 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-10-03 00:41:07 +00:00
parent 8f01c0e064
commit 31f01dfff5
2 changed files with 55 additions and 1 deletions

54
libm65/decode9.f90 Normal file
View File

@ -0,0 +1,54 @@
subroutine decode9(i1SoftSymbols,msg)
! Decoder for JT9
! Input: i1SoftSymbols(207) - Single-bit soft symbols
! Output: msg - decoded message (blank if erasure)
character*22 msg
integer*4 i4DecodedBytes(9)
integer*4 i4Decoded6BitWords(12)
integer*1 i1DecodedBytes(13) !72 bits and zero tail as 8-bit bytes
integer*1 i1SoftSymbols(207)
integer*1 i1DecodedBits(72)
integer*1 i1
logical first
integer*4 mettab(0:255,0:1)
equivalence (i1,i4)
data first/.true./
save
if(first) then
! Get the metric table
bias=0.37 !To be optimized, in decoder program
scale=10 ! ... ditto ...
open(19,file='met8.21',status='old')
do i=0,255
read(19,*) x00,x0,x1
mettab(i,0)=nint(scale*(x0-bias))
mettab(i,1)=nint(scale*(x1-bias)) !### Check range, etc. ###
enddo
close(19)
first=.false.
endif
msg=' '
nbits=72
ndelta=17
limit=1000
call fano232(i1SoftSymbols,nbits+31,mettab,ndelta,limit,i1DecodedBytes, &
ncycles,metric,ierr,maxmetric,maxnp)
if(ncycles.lt.(nbits*limit)) then
nbytes=(nbits+7)/8
do i=1,nbytes
n=i1DecodedBytes(i)
i4DecodedBytes(i)=iand(n,255)
enddo
call unpackbits(i4DecodedBytes,nbytes,8,i1DecodedBits)
call packbits(i1DecodedBits,12,6,i4Decoded6BitWords)
call unpackmsg(i4Decoded6BitWords,msg) !Unpack decoded msg
endif
return
end subroutine decode9

View File

@ -1,4 +1,4 @@
//-------------------------------------------------------------- MainWindow
//--------------------------------------------------------------- MainWindow
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "devsetup.h"