From 13c9938607aef6978605e255b1914d176c8b7608 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 24 Nov 2015 19:49:04 +0000 Subject: [PATCH] Implement (still in very basic form) experience-based decoding for JT65. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6174 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- CMakeLists.txt | 1 + lib/exp_decode65.f90 | 95 ++++++++++++++++++++++++++++++++++++++++++++ lib/extract.f90 | 27 ++++++++----- 3 files changed, 112 insertions(+), 11 deletions(-) create mode 100644 lib/exp_decode65.f90 diff --git a/CMakeLists.txt b/CMakeLists.txt index 79355857e..12c6f8227 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -286,6 +286,7 @@ set (wsjt_FSRCS lib/encode4.f90 lib/entail.f90 lib/ephem.f90 + lib/exp_decode65.f90 lib/extract.f90 lib/extract4.f90 lib/fano232.f90 diff --git a/lib/exp_decode65.f90 b/lib/exp_decode65.f90 new file mode 100644 index 000000000..4ceeb109c --- /dev/null +++ b/lib/exp_decode65.f90 @@ -0,0 +1,95 @@ +subroutine exp_decode65(mrsym,mrprob,mr2sym,nhard,nsoft,nbest,correct) + + use packjt + use prog_args + parameter (NMAX=10000) + integer*1 sym1(0:62,NMAX) + integer mrsym(0:62),mr2sym(0:62),mrprob(0:62) + integer dgen(12),sym(0:62),sym_rev(0:62) + integer test(0:62) + integer correct(0:62) + character*6 mycall,hiscall(NMAX) + character*4 hisgrid(NMAX) + character callsign*12,grid*4 + character*180 line + character ceme*3,msg*22 + logical*1 eme(NMAX) + logical first + data first/.true./ + save first,sym1,nused + +!### + mycall='VK7MO' !### TEMPORARY ### + if(first) then + neme=1 + + open(23,file=trim(data_dir)//'/CALL3.TXT',status='unknown') + icall=0 + j=0 + do i=1,NMAX + read(23,1002,end=10) line +1002 format(a80) + if(line(1:4).eq.'ZZZZ') cycle + if(line(1:2).eq.'//') cycle + i1=index(line,',') + if(i1.lt.4) cycle + i2=index(line(i1+1:),',') + if(i2.lt.5) cycle + i2=i2+i1 + i3=index(line(i2+1:),',') + if(i3.lt.1) i3=index(line(i2+1:),' ') + i3=i2+i3 + callsign=line(1:i1-1) + grid=line(i1+1:i2-1) + ceme=line(i2+1:i3-1) + eme(i)=ceme.eq.'EME' + if(neme.eq.1 .and. (.not.eme(i))) cycle + j=j+1 + hiscall(j)=callsign(1:6) !### Fix for compound callsigns! + hisgrid(j)=grid + enddo +10 ncalls=j + close(23) + + j=0 + do i=1,ncalls + if(neme.eq.1 .and. (.not.eme(i))) cycle + j=j+1 + msg=mycall//' '//hiscall(i)//' '//hisgrid(i) + call fmtmsg(msg,iz) + call packmsg(msg,dgen,itype) !Pack message into 72 bits + call rs_encode(dgen,sym_rev) !RS encode + sym(0:62)=sym_rev(62:0:-1) + sym1(0:62,j)=sym + enddo + nused=j + first=.false. + endif +!### + + nbest=999999 + do j=1,nused + test=sym1(0:62,j) + nh=0 + ns=0 + do i=0,62 + k=62-i + if(mrsym(k).ne.test(i)) then + nh=nh+1 + if(mr2sym(k).ne.test(i)) ns=ns+mrprob(k) + endif + enddo + ns=63*ns/sum(mrprob) + + if(nh+ns.lt.nbest) then + nhard=nh + nsoft=ns + nbest=nhard+nsoft + ncandidates=0 + ntry=0 + correct=test + endif + enddo + + return +end subroutine exp_decode65 diff --git a/lib/extract.f90 b/lib/extract.f90 index a8654134c..0484030b6 100644 --- a/lib/extract.f90 +++ b/lib/extract.f90 @@ -61,10 +61,9 @@ subroutine extract(s3,nadd,nqd,ntrials,naggressive,ndepth,ncount,nhist, & call graycode65(mr2sym,63,-1) !Remove gray code and interleaving call interleave63(mr2sym,-1) !from second-most-reliable symbols call interleave63(mr2prob,-1) - - write(71) mrsym,mrprob,mr2sym,mr2prob - nverbose=0 ntry=0 + + nverbose=0 call timer('sfrsd ',0) call sfrsd2(mrsym,mrprob,mr2sym,mr2prob,ntrials,nverbose,correct, & param,indx,tt,ntry) @@ -72,20 +71,27 @@ subroutine extract(s3,nadd,nqd,ntrials,naggressive,ndepth,ncount,nhist, & ncandidates=param(0) nhard=param(1) nsoft=param(2) - nera=param(3) - ngmd=param(4) - ndone=ndone+1 - do i=1,12 - dat4(i)=correct(13-i) - enddo + if(nhard.lt.0 .and. ndepth.ge.5) then + call timer('exp_deco',0) + call exp_decode65(mrsym,mrprob,mr2sym,nhard,nsoft,nbest,correct) + if(nbest.gt.72+2*naggressive) then + nhard=-1 + endif + call timer('exp_deco',1) + endif + + ndone=ndone+1 ncount=-1 decoded=' ' ltext=.false. if(nhard.ge.0) then !turn the corrected symbol array into channel symbols for subtraction !pass it back to jt65a via common block "chansyms65" - do i=1,63 + do i=1,12 + dat4(i)=correct(13-i) + enddo + do i=1,63 tmp(i)=correct(64-i) enddo correct(1:63)=tmp(1:63) @@ -100,4 +106,3 @@ subroutine extract(s3,nadd,nqd,ntrials,naggressive,ndepth,ncount,nhist, & return end subroutine extract -