From 17ddb8eb011d17ba68c0db588f3707d5665488f7 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 3 Oct 2012 00:37:40 +0000 Subject: [PATCH] Program jt9sim cleaned up in various ways. Final Fano decoding of soft symbols moved to subroutine decode9. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2629 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- libm65/Makefile.MinGW | 2 +- libm65/genjt9.f90 | 8 ++--- libm65/jt9sim.f90 | 71 +++++++++---------------------------------- mainwindow.cpp | 2 +- 4 files changed, 21 insertions(+), 62 deletions(-) diff --git a/libm65/Makefile.MinGW b/libm65/Makefile.MinGW index 0358891ca..9a1c2f2e4 100644 --- a/libm65/Makefile.MinGW +++ b/libm65/Makefile.MinGW @@ -37,7 +37,7 @@ OBJS1 = trimlist.o display.o getdphi.o pctile.o ccf65.o \ lenmsk.o decodemsk.o ping.o makepings.o alignmsg.o match.o \ rtping.o jtmsk.o hipass.o setupmsk.o foldmsk.o genjt9.o \ packbits.o unpackbits.o encode232.o interleave9.o entail.o \ - fano232.o + fano232.o spec9.o libm65.a: $(OBJS1) ar cr libm65.a $(OBJS1) diff --git a/libm65/genjt9.f90 b/libm65/genjt9.f90 index b401ee479..1f1099d0f 100644 --- a/libm65/genjt9.f90 +++ b/libm65/genjt9.f90 @@ -31,10 +31,10 @@ subroutine genjt9(message,minutes,msgsent,d6) call encode232(d1,nsym2,d2) !Convolutional code, K=32, r=1/2 call interleave9(d2,1,d3) !Interleave the single bits call packbits(d3,nsym2,3,d4) !Pack 3-bit groups into words - d5=d4 - print*,d5 - -! call graycode(d4,69,1,d5) !Apply Gray code + +! d5=d4 +! print*,d5 + call graycode(d4,69,1,d5) !Apply Gray code ! Insert sync symbols (ntone=0) and add 1 to the data-tone numbers. j=0 diff --git a/libm65/jt9sim.f90 b/libm65/jt9sim.f90 index 870ed436e..1e69aa7e4 100644 --- a/libm65/jt9sim.f90 +++ b/libm65/jt9sim.f90 @@ -4,23 +4,19 @@ program jt9sim parameter (NMAX=1800*12000) integer ihdr(11) - integer*2 iwave !Generated waveform (no noise) + integer*2 iwave !Generated waveform (no noise) real*8 f0,f,dt,twopi,phi,dphi,baud,fspan character msg*22,msg0*22,message*22,msgsent*22,arg*8,fname*11 - integer*4 itone(85) - integer*4 mettab(0:255,0:1) - integer*4 t0(13) !72-bit message as 6-bit words - integer*1 t1(13) !72 bits and zero tail as 8-bit bytes - integer*1 t2(207) !Encoded information-carrying bits - integer*1 t3(207) !Bits from t4, after interleaving - integer*4 t4(69) !Symbols from t5, values 0-7 - integer*4 t5(69) !Gray-coded symbols, values 0-7 - integer*4 t6(85) !Channel symbols including sync, values 0-8 - integer*1 tmp(72) + integer*4 itone(85) !Channel symbols (values 0-8) + integer*4 i4DataSymNoGray(69) !Data Symbols, values 0-7 + integer*1 i1ScrambledBits(207) !Hard-decision demodulated bits, interleaved + integer*1 i1Bits(207) !Encoded information-carrying bits + integer*1 i1SoftSymbols(207) integer*1 i1 equivalence (i1,i4) - integer isync(85) !Sync vector + + integer isync(85) !Sync vector data isync/ & 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,0,0,0,0, & 1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,0,0,0,1,0, & @@ -70,18 +66,6 @@ program jt9sim open(12,file='msgs.txt',status='old') -! 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) - write(*,1000) 1000 format('File N freq S/N Message'/ & '---------------------------------------------------') @@ -147,51 +131,26 @@ program jt9sim write(10) ihdr,iwave(1:npts) close(10) -! We're done! Now decode the data in itone, as a test. +! We're done! Now decode the data symbols from itone, as a test. j=0 do i=1,85 if(isync(i).eq.1) cycle j=j+1 - t5(j)=itone(i)-1 + i4DataSymNoGray(j)=igray(itone(i)-1,-1) enddo -! call graycode(t5,69,-1,t4) - t4=t5 - call unpackbits(t4,69,3,t3) -! call interleave9(t3,-1,t2) - t2=t3 + call unpackbits(i4DataSymNoGray,69,3,i1ScrambledBits) + call interleave9(i1ScrambledBits,-1,i1Bits) - nbits=72 - ndelta=17 - limit=1000 do i=1,206 i4=-10 - if(t2(i).eq.1) i4=10 + if(i1Bits(i).eq.1) i4=10 i4=i4+128 - t2(i)=i1 + i1SoftSymbols(i)=i1 enddo - print*,t2 - - call fano232(t2,nbits+31,mettab,ndelta,limit,t1,ncycles,metric,ierr, & - maxmetric,maxnp) - print*,ncycles + call decode9(i1SoftSymbols,msg) - nbytes=(nbits+7)/8 - do i=1,nbytes - n=t1(i) - t4(i)=iand(n,255) - enddo - call unpackbits(t4,nbytes,8,tmp) - call packbits(tmp,12,6,t4) - do i=1,12 - if(t4(i).lt.128) t1(i)=t4(i) - if(t4(i).ge.128) t1(i)=t4(i)-256 - enddo - do i=1,12 - t4(i)=t1(i) - enddo - call unpackmsg(t4,msg) !Unpack decoded msg if(msg.ne.msg0) print*,'Decode error: ',msg0,' ',msg enddo 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"