diff --git a/commons.h b/commons.h index f89bd8250..ff573e8b5 100644 --- a/commons.h +++ b/commons.h @@ -18,6 +18,7 @@ extern struct { int nfb; //High decode limit (kHz) int ntol; //+/- decoding range around fQSO (Hz) int kin; + int nzhsym; int nsynced; int ndecoded; } jt9com_; diff --git a/lib/decoder.f90 b/lib/decoder.f90 index dd6ee198a..32653d483 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -14,7 +14,7 @@ subroutine decoder(ntrSeconds,ndepth,nRxLog,c00) integer ii(1) complex c0(NDMAX),c00(NDMAX) common/jt9com/ss0(184,NSMAX),savg(NSMAX),id2(NMAX),nutc0,ndiskdat, & - ntr,nfqso,newdat,npts80,nfb,ntol,kin,nsynced,ndecoded + ntr,nfqso,newdat,npts80,nfb,ntol,kin,nzhsym,nsynced,ndecoded common/jt9comB/ss(184,NSMAX),c0 common/tracer/limtrace,lu logical first @@ -79,7 +79,7 @@ subroutine decoder(ntrSeconds,ndepth,nRxLog,c00) tstep=kstep/12000.0 call timer('sync9 ',0) - call sync9(ss,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipk) ! Get sync, approx freq + call sync9(ss,nzhsym,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipk) !Compute ccfred call timer('sync9 ',1) open(13,file='decoded.txt',status='unknown') @@ -98,7 +98,6 @@ subroutine decoder(ntrSeconds,ndepth,nRxLog,c00) ii=maxloc(ccfred(ia:ib)) i=ii(1) + ia - 1 f=(i-1)*df3 - print*,ipk,i,ccfred(i),f,abs(f-fgood) if((i.eq.ipk .or. ccfred(i).ge.3.0) .and. abs(f-fgood).gt.10.0*df8) then call timer('spec9 ',0) call spec9(c0,npts8,nsps,f,fpk,xdt,snr,i1SoftSymbols) diff --git a/lib/jt9sync.f90 b/lib/jt9sync.f90 index 49f3e1c94..a8e33685c 100644 --- a/lib/jt9sync.f90 +++ b/lib/jt9sync.f90 @@ -4,6 +4,10 @@ integer ii2(16) !Locations of sync half-symbols data ii2/1,3,9,19,31,45,65,69,101,103,109,119,131,145,165,169/ + integer ka(16),kb(16) !Reference symbols for sync + data ka/5,5,11,21,33,47,63,71,97,105,111,121,133,147,159,163/ + data kb/7,7,13,23,35,49,67,73,99,107,113,123,135,149,161,167/ + integer isync(85) !Sync vector data isync/ & diff --git a/lib/symspec.f90 b/lib/symspec.f90 index 9b9b02ec6..fc41385ff 100644 --- a/lib/symspec.f90 +++ b/lib/symspec.f90 @@ -33,7 +33,7 @@ subroutine symspec(k,ntrperiod,nsps,ingain,nb,nbslider,pxdb,s,red, & integer*2 id2 complex c0(NDMAX) common/jt9com/ss(184,NSMAX),savg(NSMAX),id2(NMAX),nutc,ndiskdat, & - ntr,mousefqso,newdat,nfa,nfb,ntol,kin + ntr,mousefqso,newdat,nfa,nfb,ntol,kin,nzhsym,nsynced,ndecoded data rms/999.0/,k0/99999999/,ntrperiod0/0/,nfft3z/0/ save diff --git a/lib/sync9.f90 b/lib/sync9.f90 index 502a3aa54..c47ac95c1 100644 --- a/lib/sync9.f90 +++ b/lib/sync9.f90 @@ -1,4 +1,4 @@ -subroutine sync9(ss,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipkbest) +subroutine sync9(ss,nzhsym,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipkbest) parameter (NSMAX=22000) !Max length of saved spectra real ss(184,NSMAX) @@ -18,16 +18,20 @@ subroutine sync9(ss,tstep,df3,ntol,nfqso,ccfred,ia,ib,ipkbest) endif sbest=0. - lagmax=2.5/tstep + 0.9999 + lag1=-(2.5/tstep + 0.9999) + lag2=5.0/tstep + 0.9999 ccfred=0. do i=ia,ib smax=0. - do lag=-lagmax,lagmax + do lag=lag1,lag2 sum=0. do j=1,16 k=ii2(j) + lag - if(k.ge.1) sum=sum + ss(k,i) - 0.5*(ss(k+2,i)+ss(k+4,i)) + kaa=ka(j)+lag + kbb=kb(j)+lag + if(k.ge.1 .and. k.le.nzhsym) sum=sum + ss(k,i) - & + 0.5*(ss(kaa,i)+ss(kbb,i)) enddo if(sum.gt.smax) then smax=sum diff --git a/mainwindow.cpp b/mainwindow.cpp index 70e24caf3..a4f116dcc 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -350,12 +350,11 @@ void MainWindow::dataSink(int k) g_pWideGraph->dataSink2(s,red,df3,ihsym,m_diskData,lstrong); } - // This is a bit strange. Why do we need the "-3" ??? -// if(ihsym == m_hsymStop-3) { if(ihsym == m_hsymStop) { m_dataAvailable=true; jt9com_.npts8=(ihsym*m_nsps)/16; jt9com_.newdat=1; + jt9com_.nzhsym=m_hsymStop; QDateTime t = QDateTime::currentDateTimeUtc(); m_dateTime=t.toString("yyyy-MMM-dd hh:mm"); decode(); //Start the decoder diff --git a/soundin.cpp b/soundin.cpp index 6f1b3da07..1e376d97d 100644 --- a/soundin.cpp +++ b/soundin.cpp @@ -19,6 +19,7 @@ extern struct { int nfb; //High decode limit (kHz) int ntol; //+/- decoding range around fQSO (Hz) int kin; + int nzhsym; int nsynced; int ndecoded; } jt9com_;