From 21b3c7ed135c7c6e8a7ebae167bd73bc0963d141 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 3 Oct 2012 00:41:07 +0000 Subject: [PATCH] Add the decode9 routine. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2631 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- libm65/decode9.f90 | 54 ++++++++++++++++++++++++++++++++++++++++++++++ mainwindow.cpp | 2 +- 2 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 libm65/decode9.f90 diff --git a/libm65/decode9.f90 b/libm65/decode9.f90 new file mode 100644 index 000000000..c415b5dc4 --- /dev/null +++ b/libm65/decode9.f90 @@ -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 diff --git a/mainwindow.cpp b/mainwindow.cpp index 48d16902e..b4b246613 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,4 @@ -//-------------------------------------------------------------- MainWindow +//--------------------------------------------------------------- MainWindow #include "mainwindow.h" #include "ui_mainwindow.h" #include "devsetup.h"