diff --git a/lib/q65_decode.f90 b/lib/q65_decode.f90 index 538ecf698..70f0d7009 100644 --- a/lib/q65_decode.f90 +++ b/lib/q65_decode.f90 @@ -94,7 +94,7 @@ contains call q65_enc(dgen,codewords) !Initialize Q65 call timer('sync_q65',0) call q65_sync(nutc,iwave,ntrperiod*12000,mode65,codewords,ncw,nsps, & - nfqso,ntol,emedelay,xdt,f0,snr1,dat4,snr2,id1) + nfqso,ntol,emedelay,xdt,f0,snr1,width,dat4,snr2,id1) call timer('sync_q65',1) if(id1.eq.1) then xdt1=xdt @@ -139,8 +139,8 @@ contains endif endif call timer('q65loops',0) - call q65_loops(c00,npts/2,nsps/2,nmode,mode65,nsubmode, & - nFadingModel,ndepth,jpk0,xdt,f0,iaptype,apmask,apsymbols, & + call q65_loops(c00,npts/2,nsps/2,nmode,mode65,nsubmode, & + nFadingModel,ndepth,jpk0,xdt,f0,width,iaptype,apmask,apsymbols, & xdt1,f1,snr2,dat4,id2) call timer('q65loops',1) ! snr2=snr2 + db(6912.0/nsps) diff --git a/lib/q65_sync.f90 b/lib/q65_sync.f90 index c6db664a3..644eb1644 100644 --- a/lib/q65_sync.f90 +++ b/lib/q65_sync.f90 @@ -1,5 +1,5 @@ subroutine q65_sync(nutc,iwave,nmax,mode_q65,codewords,ncw,nsps,nfqso,ntol, & - emedelay,xdt,f0,snr1,dat4,snr2,id1) + emedelay,xdt,f0,snr1,width,dat4,snr2,id1) ! Detect and align with the Q65 sync vector, returning time and frequency ! offsets and SNR estimate. @@ -243,12 +243,18 @@ subroutine q65_sync(nutc,iwave,nmax,mode_q65,codewords,ncw,nsps,nfqso,ntol, & ccf1=ccf(-ia:ia,jpk)/rms if(snr1.gt.10.0) ccf1=(10.0/snr1)*ccf1 -200 do i=-ia,ia +200 smax=maxval(ccf1) + i1=-9999 + i2=-9999 + do i=-ia,ia + if(i1.eq.-9999 .and. ccf1(i).ge.0.5*smax) i1=i + if(i2.eq.-9999 .and. ccf1(-i).ge.0.5*smax) i2=-i freq=nfqso + i*df write(17,1100) freq,ccf1(i),xdt 1100 format(3f10.3) enddo close(17) + width=df*(i2-i1) 900 return end subroutine q65_sync diff --git a/lib/qra/q65/q65_loops.f90 b/lib/qra/q65/q65_loops.f90 index 0f83d7275..2545573f9 100644 --- a/lib/qra/q65/q65_loops.f90 +++ b/lib/qra/q65/q65_loops.f90 @@ -1,5 +1,5 @@ subroutine q65_loops(c00,npts2,nsps,mode,mode_q65,nsubmode,nFadingModel, & - ndepth,jpk0,xdt0,f0,iaptype,APmask,APsymbols,xdt1,f1,snr2,dat4,id2) + ndepth,jpk0,xdt0,f0,width,iaptype,APmask,APsymbols,xdt1,f1,snr2,dat4,id2) use packjt77 use timer_module, only: timer @@ -69,9 +69,9 @@ subroutine q65_loops(c00,npts2,nsps,mode,mode_q65,nsubmode,nFadingModel, & nbw=ibw ndist=ndf**2 + ndt**2 + ((nbw-2))**2 if(ndist.gt.maxdist) cycle - ! b90=1.728**ibw b90=3.0**nbw !### Mult by ~baud/3.33 ??? ### if(nbw.eq.0) b90=baud + if(b90.lt.0.5*width) cycle if(b90.gt.230.0) cycle call timer('q65_intr',0) b90ts = b90/baud