From 4a7b5381369f05d058535b135e62c1b21f8c9ff7 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Wed, 3 Oct 2012 12:39:07 +0000 Subject: [PATCH] JT9 decoder (jt9.exe) now basically working. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@2632 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- libm65/jt9sim.f90 | 1 - libm65/spec9.f90 | 45 ++++++++++++++++++--------------------------- mainwindow.cpp | 2 +- 3 files changed, 19 insertions(+), 29 deletions(-) diff --git a/libm65/jt9sim.f90 b/libm65/jt9sim.f90 index 1e69aa7e4..8f720b52d 100644 --- a/libm65/jt9sim.f90 +++ b/libm65/jt9sim.f90 @@ -138,7 +138,6 @@ program jt9sim j=j+1 i4DataSymNoGray(j)=igray(itone(i)-1,-1) enddo - call unpackbits(i4DataSymNoGray,69,3,i1ScrambledBits) call interleave9(i1ScrambledBits,-1,i1Bits) diff --git a/libm65/spec9.f90 b/libm65/spec9.f90 index 0c0c8c70a..c341a8b6f 100644 --- a/libm65/spec9.f90 +++ b/libm65/spec9.f90 @@ -3,9 +3,11 @@ subroutine spec9(c0,npts8,nsps,f0a,lagpk,fpk) parameter (MAXFFT=31500) complex c0(0:npts8-1) real s(0:MAXFFT-1) - real ssym(0:9,184) + real ssym(0:8,184) + real ssymg(0:8,184) complex c(0:MAXFFT-1) - integer*1 softbit(207) + integer*1 i1SoftSymbolsScrambled(207) + integer*1 i1SoftSymbols(207) integer ibit(207) integer*1 t1(13) !72 bits and zero tail as 8-bit bytes @@ -17,6 +19,9 @@ subroutine spec9(c0,npts8,nsps,f0a,lagpk,fpk) integer isync(85) integer ii(16) !Locations of sync symbols data ii/1,6,11,16,21,26,31,39,45,51,57,63,69,75,81,85/ + integer ig(0:7) + data ig/0,1,3,2,7,6,4,5/ +! data ig/0,1,3,2,6,7,5,4/ isync=0 do i=1,16 @@ -34,7 +39,6 @@ subroutine spec9(c0,npts8,nsps,f0a,lagpk,fpk) s=0. istart=lagpk*nsps8 + idt nsym=min((npts8-istart)/nsps8,85) - print*,f0a,lagpk,fpk,fshift,nsym do j=0,nsym-1 ia=j*nsps8 + istart @@ -55,35 +59,24 @@ subroutine spec9(c0,npts8,nsps,f0a,lagpk,fpk) enddo enddo -! sync=0. -! do i=1,16 -! sync=sync + ssym(0,ii(i)) -! enddo - - do i=0,nfft-1 - freq = f0a + i*df - write(71,3001) i,i*df,freq,s(i) -3001 format(i8,3f12.3) - enddo - + ssymg=ssym do j=1,nsym - write(72,3002) j,(ssym(i,j),i=0,8) -3002 format(i3,9f7.2) + ssym(0,j)=ssymg(0,j) + do i=0,7 + ssym(ig(i)+1,j)=ssymg(i+1,j) + enddo enddo m0=3 ntones=8 k=0 do j=1,nsym -! print*,j,k,nsym if(isync(j).eq.1) cycle do m=m0-1,0,-1 !Get bit-wise soft symbols n=2**m r1=0. r2=0. - do ig=0,ntones-1 -! i=igray(ig,-1) - i=ig + do i=0,ntones-1 if(iand(i,n).ne.0) then r1=max(r1,ssym(i+1,j)) else @@ -91,15 +84,14 @@ subroutine spec9(c0,npts8,nsps,f0a,lagpk,fpk) endif enddo k=k+1 - softbit(k)=min(127,max(-127,nint(10.0*(r1-r2)))) + 128 + i1SoftSymbolsScrambled(k)=min(127,max(-127,nint(10.0*(r1-r2)))) + 128 enddo enddo ibit=0 do i=1,207 - if(softbit(i).lt.0) ibit(i)=1 + if(i1SoftSymbolsScrambled(i).lt.0) ibit(i)=1 enddo - print*,ibit ! Get the metric table bias=0.37 !To be optimized, in decoder program @@ -116,10 +108,9 @@ subroutine spec9(c0,npts8,nsps,f0a,lagpk,fpk) ndelta=17 limit=1000 - print*,softbit - call fano232(softbit,nbits+31,mettab,ndelta,limit,t1,ncycles,metric,ierr, & - maxmetric,maxnp) - print*,ncycles + call interleave9(i1SoftSymbolsScrambled,-1,i1SoftSymbols) + call fano232(i1SoftSymbols,nbits+31,mettab,ndelta,limit,t1,ncycles, & + metric,ierr,maxmetric,maxnp) nbytes=(nbits+7)/8 do i=1,nbytes diff --git a/mainwindow.cpp b/mainwindow.cpp index b4b246613..48d16902e 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1,4 +1,4 @@ -//--------------------------------------------------------------- MainWindow +//-------------------------------------------------------------- MainWindow #include "mainwindow.h" #include "ui_mainwindow.h" #include "devsetup.h"