From 6dcdee836efe30eee90858484bedd1452db32433 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 3 Oct 2016 17:08:02 +0000 Subject: [PATCH] Further speed improvements for MSK144 RT decoding. Fiz what I broke in the "click-on-CQ-message" logic. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7144 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- decodedtext.cpp | 6 ++---- decodedtext.h | 2 +- lib/msk144_freq_search.f90 | 12 ++++-------- lib/msk144spd.f90 | 3 ++- lib/msk144sync.f90 | 18 +++--------------- lib/mskrtd.f90 | 14 ++++++++------ mainwindow.cpp | 8 ++++++-- 7 files changed, 26 insertions(+), 37 deletions(-) diff --git a/decodedtext.cpp b/decodedtext.cpp index 9a3560ef3..d453886d9 100644 --- a/decodedtext.cpp +++ b/decodedtext.cpp @@ -129,12 +129,10 @@ QString DecodedText::call() } // get the second word, most likely the de call and the third word, most likely grid -void DecodedText::deCallAndGrid(QString jtmode,/*out*/QString& call, QString& grid) +void DecodedText::deCallAndGrid(/*out*/QString& call, QString& grid) { auto msg = _string; - int iadd=0; - if(jtmode=="MSK144") iadd=3; - msg = msg.replace (" CQ DX ", " CQ_DX ").mid (column_qsoText+iadd); + msg = msg.replace (" CQ DX ", " CQ_DX ").mid (column_qsoText); int i1 = msg.indexOf(" "); call = msg.mid(i1+1); int i2 = call.indexOf(" "); diff --git a/decodedtext.h b/decodedtext.h index 4ebb4e217..bdc8c8862 100644 --- a/decodedtext.h +++ b/decodedtext.h @@ -75,7 +75,7 @@ public: QString call(); // get the second word, most likely the de call and the third word, most likely grid - void deCallAndGrid(QString jtmode,/*out*/QString& call, QString& grid); + void deCallAndGrid(/*out*/QString& call, QString& grid); int timeInSeconds(); diff --git a/lib/msk144_freq_search.f90 b/lib/msk144_freq_search.f90 index d4fa1c3e1..5029816a3 100644 --- a/lib/msk144_freq_search.f90 +++ b/lib/msk144_freq_search.f90 @@ -11,22 +11,21 @@ subroutine msk144_freq_search(cdat,fc,if1,if2,delf,nframes,navmask,cb, & complex cc(0:NSPM-1) real xcc(0:NSPM-1) real xccs(0:NSPM-1) - integer navmask(nframes) ! defines which frames to average + integer navmask(nframes) !Tells which frames to average navg=sum(navmask) n=nframes*NSPM fac=1.0/(48.0*sqrt(float(navg))) - do ifr=if1,if2 !Find freq that maximizes sync + do ifr=if1,if2 !Find freq that maximizes sync ferr=ifr*delf call tweak1(cdat,n,-(fc+ferr),cdat2) c=0 + sumw=0. do i=1,nframes ib=(i-1)*NSPM+1 ie=ib+NSPM-1 - if( navmask(i) .eq. 1 ) then - c(1:NSPM)=c(1:NSPM)+cdat2(ib:ie) - endif + if(navmask(i).eq.1) c=c + cdat2(ib:ie) enddo cc=0 @@ -47,8 +46,5 @@ subroutine msk144_freq_search(cdat,fc,if1,if2,delf,nframes,navmask,cb, & endif enddo -! write(71,3001) fc,delf,if1,if2,nframes,bestf,xmax -!3001 format(2f8.3,3i5,2f8.3) - return end subroutine msk144_freq_search diff --git a/lib/msk144spd.f90 b/lib/msk144spd.f90 index f8c6c5ec3..fbee24de9 100644 --- a/lib/msk144spd.f90 +++ b/lib/msk144spd.f90 @@ -166,7 +166,8 @@ subroutine msk144spd(cbig,n,ntol,nsuccess,msgreceived,fc,fret,tret) fo=fc+ferrs(icand) do iav=1,NPATTERNS navmask=navpatterns(1:3,iav) - call msk144sync(cdat,3,ntol0,deltaf,navmask,npeaks,fo,fest,npkloc,nsyncsuccess,c) + call msk144sync(cdat,3,ntol0,deltaf,navmask,npeaks,fo,fest,npkloc, & + nsyncsuccess,xmax,c) if( nsyncsuccess .eq. 0 ) cycle diff --git a/lib/msk144sync.f90 b/lib/msk144sync.f90 index eec4d9d08..dfae9a21e 100644 --- a/lib/msk144sync.f90 +++ b/lib/msk144sync.f90 @@ -1,5 +1,5 @@ subroutine msk144sync(cdat,nframes,ntol,delf,navmask,npeaks,fc,fest, & - npklocs,nsuccess,c) + npklocs,nsuccess,xmax,c) !$ use omp_lib @@ -10,7 +10,6 @@ subroutine msk144sync(cdat,nframes,ntol,delf,navmask,npeaks,fc,fest, & complex cs(NSPM,8) complex cb(42) !Complex waveform for sync word -! integer*8 count0,count1,clkfreq integer s8(8) integer iloc(1) integer npklocs(npeaks) @@ -28,7 +27,6 @@ subroutine msk144sync(cdat,nframes,ntol,delf,navmask,npeaks,fc,fest, & data s8/0,1,1,1,0,0,1,0/ save first,cb,fs,pi,twopi,dt,s8,pp -! call system_clock(count0,clkfreq) if(first) then pi=4.0*atan(1.0) twopi=8.0*atan(1.0) @@ -70,8 +68,6 @@ subroutine msk144sync(cdat,nframes,ntol,delf,navmask,npeaks,fc,fest, & if(id.eq.nthreads) if2=nint(ntol/delf) call msk144_freq_search(cdat,fc,if1,if2,delf,nframes,navmask,cb, & cdat2(1,id),xm(id),bf(id),cs(1,id),xccs(1,id)) -! write(73,3002) id,if1,if2,nfreqs,nthreads,bf(id),xm(id) -!3002 format(5i5,2f10.3) !$OMP END PARALLEL xmax=xm(1) @@ -98,16 +94,8 @@ subroutine msk144sync(cdat,nframes,ntol,delf,navmask,npeaks,fc,fest, & xcc(max(0,ic2-7):min(NSPM-1,ic2+7))=0.0 enddo - if( xmax .lt. 0.7 ) then - nsuccess=0 - else - nsuccess=1 - endif - -! call system_clock(count1,clkfreq) -! t=float(count1-count0)/clkfreq -! write(72,3001) nfreqs,OMP_GET_MAX_THREADS(),nthreads,t -!3001 format(3i6,f8.3) + nsuccess=0 + if(xmax.ge.1.3) nsuccess=1 return end subroutine msk144sync diff --git a/lib/mskrtd.f90 b/lib/mskrtd.f90 index 0f01d4860..43ceb8628 100644 --- a/lib/mskrtd.f90 +++ b/lib/mskrtd.f90 @@ -88,6 +88,8 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,line) if( nsuccess .eq. 1 ) then tdec=tsec+tdec decsym=' & ' + ipk=0 + is=0 goto 900 endif @@ -101,10 +103,10 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,line) do iavg=1,npat iavmask=iavpatterns(1:8,iavg) navg=sum(iavmask) - deltaf=7.0/real(navg) ! search increment for frequency sync + deltaf=10.0/real(navg) ! search increment for frequency sync npeaks=2 call msk144sync(cdat(1:8*NSPM),8,ntol,deltaf,iavmask,npeaks,fc, & - fest,npkloc,nsyncsuccess,c) + fest,npkloc,nsyncsuccess,xmax,c) if( nsyncsuccess .eq. 0 ) cycle do ipk=1,npeaks @@ -115,9 +117,9 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,line) ct=cshift(c,ic0-1) call msk144decodeframe(ct,msgreceived,ndecodesuccess) if(ndecodesuccess .gt. 0) then - tdec=tsec+xmc(iavg)*tframe - decsym=' ^ ' - goto 900 + tdec=tsec+xmc(iavg)*tframe + decsym=' ^ ' + goto 900 endif enddo !Slicer dither enddo !Peak loop @@ -136,7 +138,7 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,line) go to 999 900 continue -! successful decode - estimate snr !!! noise estimate needs work +! Successful decode - estimate snr !!! noise estimate needs work if( pnoise .gt. 0.0 ) then snr0=10.0*log10(pmax/pnoise-1.0) else diff --git a/mainwindow.cpp b/mainwindow.cpp index edd1ceded..0aa26db4b 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -1307,6 +1307,8 @@ void MainWindow::fastSink(qint64 frames) } writeAllTxt(message); } + + decodedtext=message.mid(0,4) + message.mid(6,-1); bool stdMsg = decodedtext.report(m_baseCall, Radio::base_callsign(ui->dxCallEntry->text()),m_rptRcvd); if(m_config.spot_to_psk_reporter() and stdMsg and !m_diskData) pskPost(decodedtext); @@ -2537,7 +2539,7 @@ void MainWindow::pskPost(DecodedText decodedtext) } QString deCall; QString grid; - decodedtext.deCallAndGrid(m_mode,/*out*/deCall,grid); + decodedtext.deCallAndGrid(/*out*/deCall,grid); int audioFrequency = decodedtext.frequencyOffset(); int snr = decodedtext.snr(); Frequency frequency = m_freqNominal + audioFrequency; @@ -3229,6 +3231,7 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl) MessageBox::information_message (this, "Double-click not presently implemented for ISCAT mode"); } + if(shift) t=""; //Silence compiler warning if(m_decodedText2) { cursor=ui->decodedTextBrowser->textCursor(); @@ -3237,6 +3240,7 @@ void MainWindow::doubleClickOnCall(bool shift, bool ctrl) cursor=ui->decodedTextBrowser2->textCursor(); t= ui->decodedTextBrowser2->toPlainText(); } + cursor.select(QTextCursor::LineUnderCursor); int position {cursor.position()}; if(shift && position==-9999) return; //Silence compiler warning @@ -3325,7 +3329,7 @@ void MainWindow::processMessage(QString const& messages, int position, bool ctrl QString hiscall; QString hisgrid; - decodedtext.deCallAndGrid(m_mode,/*out*/hiscall,hisgrid); + decodedtext.deCallAndGrid(/*out*/hiscall,hisgrid); if (!Radio::is_callsign (hiscall) // not interested if not from QSO partner && !(t4.size () == 7 // unless it is of the form && (t4.at (5) == m_baseCall // " 73"