From 5850317de0b08b0c284d690bd97e180f96a29d7e Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Tue, 2 Feb 2021 09:27:40 -0500 Subject: [PATCH] Speed improvements for Q65 multi-decode. --- lib/q65_decode.f90 | 48 ++++++++++++++++++++++----------------------- lib/qra/q65/q65.f90 | 8 ++++++-- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/lib/q65_decode.f90 b/lib/q65_decode.f90 index 9d5f0dfb5..2d83d0728 100644 --- a/lib/q65_decode.f90 +++ b/lib/q65_decode.f90 @@ -60,7 +60,8 @@ contains character*77 c77 character*78 c78 character*6 cutc - character c6*6,c4*4 + character c6*6,c4*4,cmode*4 + character*80 fmt integer*2 iwave(NMAX) !Raw data real, allocatable :: dd(:) !Raw data integer dat4(13) !Decoded message as 12 6-bit integers @@ -113,9 +114,12 @@ contains baud=12000.0/nsps this%callback => callback nFadingModel=1 - ibwa=max(1,int(1.8*log(baud*mode_q65)) + 2) - ibwb=min(10,ibwa+5) - if(iand(ndepth,3).eq.3) then + ibwa=max(1,int(1.8*log(baud*mode_q65)) + 1) + ibwb=min(10,ibwa+3) + if(iand(ndepth,3).ge.2) then + ibwa=max(1,int(1.8*log(baud*mode_q65)) + 2) + ibwb=min(10,ibwa+5) + else if(iand(ndepth,3).eq.3) then ibwa=max(1,ibwa-1) ibwb=min(10,ibwb+1) endif @@ -233,21 +237,18 @@ contains position='append',iostat=ios) if(ios.eq.0) then ! Save decoding parameters to q65_decoded.dat, for later analysis. + write(cmode,'(i3)') ntrperiod + cmode(4:4)=char(ichar('A')+nsubmode) c6=hiscall(1:6) if(c6.eq.' ') c6=' ' c4=hisgrid(1:4) if(c4.eq.' ') c4=' ' - if(ntrperiod.ge.60) then - write(22,1022) nutc,ntrperiod,nsubmode,nQSOprogress,idec, & - nused,iaptype,irc,idf,idt,ibw,xdt,f0,snr1,snr2, & - tdecode,mycall(1:6),c6,c4,trim(decoded) -1022 format(i6.4,10i3,f6.2,f7.1,f7.2,f6.1,f6.2,1x,a6,1x,a6,1x,a4,1x,a) - else - write(22,1023) nutc,ntrperiod,nsubmode,nQSOprogress,idec, & - nused,iaptype,irc,idf,idt,ibw,xdt,f0,snr1,snr2, & - tdecode,mycall(1:6),c6,c4,trim(decoded) -1023 format(i6.6,10i3,f6.2,f7.1,f7.2,f6.1,f6.2,1x,a6,1x,a6,1x,a4,1x,a) - endif + fmt='(i6.4,1x,a4,5i2,3i3,f6.2,f7.1,f7.2,f6.1,f6.2,'// & + '1x,a6,1x,a6,1x,a4,1x,a)' + if(ntrperiod.le.30) fmt(5:5)='6' + write(22,fmt) nutc,cmode,nQSOprogress,idec,idf,idt,ibw,nused, & + icand,ncand,xdt,f0,snr1,snr2,tdecode,mycall(1:6),c6,c4, & + trim(decoded) close(22) endif else @@ -315,19 +316,18 @@ contains position='append',iostat=ios) if(ios.eq.0) then ! Save decoding parameters to q65_decoded.dat, for later analysis. + write(cmode,'(i3)') ntrperiod + cmode(4:4)=char(ichar('A')+nsubmode) c6=hiscall(1:6) if(c6.eq.' ') c6=' ' c4=hisgrid(1:4) if(c4.eq.' ') c4=' ' - if(ntrperiod.ge.60) then - write(22,1022) nutc,ntrperiod,nsubmode,nQSOprogress,idec, & - nused,iaptype,irc,idf,idt,ibw,xdt,f0,snr1,snr2, & - tdecode,mycall(1:6),c6,c4,trim(decoded) - else - write(22,1023) nutc,ntrperiod,nsubmode,nQSOprogress,idec, & - nused,iaptype,irc,idf,idt,ibw,xdt,f0,snr1,snr2, & - tdecode,mycall(1:6),c6,c4,trim(decoded) - endif + fmt='(i6.4,1x,a4,5i2,3i3,f6.2,f7.1,f7.2,f6.1,f6.2,'// & + '1x,a6,1x,a6,1x,a4,1x,a)' + if(ntrperiod.le.30) fmt(5:5)='6' + write(22,fmt) nutc,cmode,nQSOprogress,idec,idf,idt,ibw,nused, & + icand,ncand,xdt,f0,snr1,snr2,tdecode,mycall(1:6),c6,c4, & + trim(decoded) close(22) endif endif diff --git a/lib/qra/q65/q65.f90 b/lib/qra/q65/q65.f90 index 9735d2d7b..151bda712 100644 --- a/lib/qra/q65/q65.f90 +++ b/lib/qra/q65/q65.f90 @@ -443,17 +443,21 @@ subroutine q65_ccf_22(s1,iz,jz,nfqso,ipk,jpk,f0,xdt,ccf2) ccf2=ccf2/base call indexx(ccf2(i1:i2),jzz,indx) ncand=0 + maxcand=20 do j=1,20 i=indx(jzz-j+1)+i1-1 - if(ccf2(i).lt.3.0) exit + if(ccf2(i).lt.3.4) exit !Candidate limit f=i*df if(f.ge.(nfqso-ftol) .and. f.le.(nfqso+ftol)) cycle - biggest=maxval(ccf2(i-3:i+3)) + i3=i-67*mode_q65 + i4=i+3*mode_q65 + biggest=maxval(ccf2(i3:i4)) if(ccf2(i).ne.biggest) cycle ncand=ncand+1 candidates(ncand,1)=ccf2(i) candidates(ncand,2)=xdt2(i) candidates(ncand,3)=f + if(ncand.ge.maxcand) exit enddo return