From 831feb7a5d79fbd1532ca8dbd52ed49226c36a78 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Fri, 25 Mar 2016 18:02:57 +0000 Subject: [PATCH] Cleanup of code for hinted JT65 decoding. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6558 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/decode65a.f90 | 13 ++++++++----- lib/decode65b.f90 | 3 +-- lib/hint65.f90 | 29 +++++++---------------------- 3 files changed, 16 insertions(+), 29 deletions(-) diff --git a/lib/decode65a.f90 b/lib/decode65a.f90 index 714966e4e..2ecf057d7 100644 --- a/lib/decode65a.f90 +++ b/lib/decode65a.f90 @@ -42,8 +42,8 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & dtbest=dt call afc65b(c5x,n6,fsample,nflip,a,ccfbest,dtbest) call timer('afc65b ',1) - dtbest=dtbest+0.003628 ! remove decimation filter and coh. integrator delay - dt=dtbest !return new, improved estimate of dt + dtbest=dtbest+0.003628 !Remove decimation filter and coh. integrator delay + dt=dtbest !Return new, improved estimate of dt sync2=3.7e-4*ccfbest/sq0 !Constant is empirical if(mode65.eq.4) cx=cx1 @@ -83,6 +83,7 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & call timer('dec65b ',0) qualbest=0. + qual0=-1.e30 minsmo=0 maxsmo=0 if(mode65.ge.2) then @@ -112,7 +113,8 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & s2(i,1:126)=s1(jj,1:126) enddo - call decode65b(s2,nflip,mode65,ntrials,naggressive,ndepth, & + nadd=ismo !### ??? ### + call decode65b(s2,nflip,nadd,mode65,ntrials,naggressive,ndepth, & mycall,hiscall,hisgrid,nexp_decode,nqd,nft,qual,nhist,decoded) if(nft.eq.1) then @@ -128,15 +130,16 @@ subroutine decode65a(dd,npts,newdat,nqd,f0,nflip,mode65,ntrials, & nsmobest=ismo endif endif + if(qual.lt.qual0) exit + qual0=qual enddo -! print*,width,minsmo,maxsmo,nsmo,nn - if(nft.eq.2) then decoded=decoded_best qual=qualbest nsmo=nsmobest param(9)=nsmo + nn=nnbest endif call timer('dec65b ',1) diff --git a/lib/decode65b.f90 b/lib/decode65b.f90 index 2efbf05aa..ed57963c3 100644 --- a/lib/decode65b.f90 +++ b/lib/decode65b.f90 @@ -1,4 +1,4 @@ -subroutine decode65b(s2,nflip,mode65,ntrials,naggressive,ndepth, & +subroutine decode65b(s2,nflip,nadd,mode65,ntrials,naggressive,ndepth, & mycall,hiscall,hisgrid,nexp_decode,nqd,nft,qual,nhist,decoded) use jt65_mod @@ -17,7 +17,6 @@ subroutine decode65b(s2,nflip,mode65,ntrials,naggressive,ndepth, & enddo enddo - nadd=mode65 call extract(s3,nadd,mode65,ntrials,naggressive,ndepth,mycall,hiscall, & hisgrid,nexp_decode,ncount,nhist,decoded,ltext,nft,qual) diff --git a/lib/hint65.f90 b/lib/hint65.f90 index 7182247a6..8cdafbca0 100644 --- a/lib/hint65.f90 +++ b/lib/hint65.f90 @@ -11,12 +11,12 @@ subroutine hint65(s3,mrs,mrs2,mrsym,mr2sym,mrprob,nadd,flip, & integer mrs(63),mrs2(63) integer mrsym(0:62),mr2sym(0:62),mrprob(0:62) integer dgen(12),sym(0:62),sym_rev(0:62) -! integer test(0:62) character*6 mycall,hiscall,hisgrid,call2(MAXCALLS) character*4 grid2(MAXCALLS),rpt(MAXRPT) character callsign*12,grid*4 character*180 line character ceme*3,msg*22 + character cgood*1 character*22 msg0(MAXMSG),decoded logical*1 eme(MAXCALLS) logical first @@ -67,10 +67,9 @@ subroutine hint65(s3,mrs,mrs2,mrsym,mr2sym,mrprob,nadd,flip, & if(ncalls.lt.10) stop 'CALL3.TXT very short or missing?' close(23) - ! NB: generation of test messages is not yet complete! j=0 - do i=-1,ncalls !### if ncalls is too small, generate random msgs ??? + do i=-1,ncalls !### if ncalls is too small, generate random msgs ??? mz=2 if(i.eq.-1) mz=1 if(i.eq.0) mz=65 @@ -130,34 +129,20 @@ subroutine hint65(s3,mrs,mrs2,mrsym,mr2sym,mrprob,nadd,flip, & enddo p=psum/ref -! Find the FT-defined soft distance -! test=sym1(0:62,k) -! nh=0 -! ns=0 -! do i=0,62 -! j=62-i -! if(mrsym(j).ne.test(i)) then -! nh=nh+1 -! if(mr2sym(j).ne.test(i)) ns=ns+mrprob(j) -! endif -! enddo -! ds=ns*63.0/sum(mrprob) - if(p.gt.u1) then u2=u1 u1=p ipk=k -! nhard=nh -! dsoft=ds -! dtotal=nh+ds -! ncandidates=0 -! ntry=0 endif + if(p.ne.u1 .and. p.gt.u2) u2=p endif enddo decoded=' ' - qual=100.0*(u1-1.12*u2) + bias=max(1.12*u2,0.35) + if(nadd.ge.4) bias=max(1.08*u2,0.45) + if(nadd.ge.8) bias=max(1.04*u2,0.60) + qual=100.0*(u1-bias) qmin=1.0 if(qual.ge.qmin) decoded=msg0(ipk)