From 8f554321c84ce101b06befd263eab2b4904c8e89 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 14 Sep 2020 09:55:33 -0400 Subject: [PATCH 1/8] Make sure that Tx audio frequency in FST4 mode comes from FST4 TxFreq spinner, not the WSPR/FST4W spinner. --- widgets/mainwindow.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 25fcee3c7..7eb32dafe 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -7159,6 +7159,7 @@ void MainWindow::transmit (double snr) int hmod=1; //No FST4/W submodes double dfreq=hmod*12000.0/nsps; double f0=ui->WSPRfreqSpinBox->value() - m_XIT; + if(m_mode=="FST4") f0=ui->TxFreqSpinBox->value() - m_XIT; if(!m_tune) f0 += + 1.5*dfreq; Q_EMIT sendMessage (m_mode, NUM_FST4_SYMBOLS,double(nsps),f0,toneSpacing, m_soundOutput,m_config.audio_output_channel(), From 98d52e35acd035070b91c3c4b6c2ca4e32408bb1 Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Mon, 14 Sep 2020 09:00:30 -0500 Subject: [PATCH 2/8] Speed up FST4 decoding. --- lib/fst4_decode.f90 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/fst4_decode.f90 b/lib/fst4_decode.f90 index 6237ba4a7..848559530 100644 --- a/lib/fst4_decode.f90 +++ b/lib/fst4_decode.f90 @@ -392,7 +392,7 @@ contains if(iwspr.eq.0) then maxosd=2 Keff=91 - norder=4 + norder=3 call timer('d240_101',0) call decode240_101(llr,Keff,maxosd,norder,apmask,message101, & cw,ntype,nharderrors,dmin) From ca0804450baf56378346d65727dfa5447d86c172 Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Mon, 14 Sep 2020 09:07:45 -0500 Subject: [PATCH 3/8] Remove some redundant code. --- lib/fst4_decode.f90 | 3 --- 1 file changed, 3 deletions(-) diff --git a/lib/fst4_decode.f90 b/lib/fst4_decode.f90 index 848559530..c90149298 100644 --- a/lib/fst4_decode.f90 +++ b/lib/fst4_decode.f90 @@ -214,15 +214,12 @@ contains if(ndepth.eq.3) then nblock=4 jittermax=2 - norder=3 elseif(ndepth.eq.2) then nblock=3 jittermax=0 - norder=3 elseif(ndepth.eq.1) then nblock=1 jittermax=0 - norder=3 endif ndropmax=1 From f20c45c1679178d744867dd33edff04a87609a2c Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 14 Sep 2020 10:56:54 -0400 Subject: [PATCH 4/8] FST4: Align WideGraph green bar with RxFreq on startup. CTRL-diouble-click on waterfall sets FTol=10 and calls decoder. --- widgets/mainwindow.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 7eb32dafe..0bf7e7610 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -2969,7 +2969,10 @@ void MainWindow::on_DecodeButton_clicked (bool /* checked */) //Decode request void MainWindow::freezeDecode(int n) //freezeDecode() { - if((n%100)==2) on_DecodeButton_clicked (true); + if((n%100)==2) { + if(m_mode=="FST4") ui->sbFtol->setValue(10); + on_DecodeButton_clicked (true); + } } void MainWindow::on_ClrAvgButton_clicked() @@ -5906,6 +5909,7 @@ void MainWindow::on_actionFST4_triggered() m_wideGraph->setMode(m_mode); m_wideGraph->setModeTx(m_modeTx); m_wideGraph->setPeriod(m_TRperiod,6912); + m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value()); m_wideGraph->setTxFreq(ui->TxFreqSpinBox->value()); switch_mode (Modes::FST4); m_wideGraph->setMode(m_mode); From 1b59d9dc8ceac7af8518f1637cad6ab42b0cf15d Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Mon, 14 Sep 2020 12:42:32 -0500 Subject: [PATCH 5/8] Eliminate redundancies from the calculation of sequence correlations. --- lib/fst4/get_fst4_bitmetrics.f90 | 118 ++++++++++++++++++++----------- 1 file changed, 77 insertions(+), 41 deletions(-) diff --git a/lib/fst4/get_fst4_bitmetrics.f90 b/lib/fst4/get_fst4_bitmetrics.f90 index 69a649a04..87255e2ba 100644 --- a/lib/fst4/get_fst4_bitmetrics.f90 +++ b/lib/fst4/get_fst4_bitmetrics.f90 @@ -5,9 +5,9 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual, complex cd(0:NN*nss-1) complex cs(0:3,NN) complex csymb(nss) - complex, allocatable, save :: c1(:,:) ! ideal waveforms, 20 samples per symbol, 4 tones + complex, allocatable, save :: ci(:,:) ! ideal waveforms, 20 samples per symbol, 4 tones complex cp(0:3) ! accumulated phase shift over symbol types 0:3 - complex csum,cterm + complex c1(4,8),c2(16,4),c4(256,2),c8(655356),cterm integer isyncword1(0:7),isyncword2(0:7) integer graymap(0:3) integer ip(1) @@ -25,9 +25,9 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual, data first/.true./,nss0/-1/ save first,one,cp,nss0 - if(nss.ne.nss0 .and. allocated(c1)) deallocate(c1) + if(nss.ne.nss0 .and. allocated(ci)) deallocate(ci) if(first .or. nss.ne.nss0) then - allocate(c1(nss,0:3)) + allocate(ci(nss,0:3)) one=.false. do i=0,65535 do j=0,15 @@ -40,7 +40,7 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual, dp=(itone-1.5)*dphi phi=0.0 do j=1,nss - c1(j,itone)=cmplx(cos(phi),sin(phi)) + ci(j,itone)=cmplx(cos(phi),sin(phi)) phi=mod(phi+dp,twopi) enddo cp(itone)=cmplx(cos(phi),sin(phi)) @@ -52,7 +52,7 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual, i1=(k-1)*NSS csymb=cd(i1:i1+NSS-1) do itone=0,3 - cs(itone,k)=sum(csymb*conjg(c1(:,itone))) + cs(itone,k)=sum(csymb*conjg(ci(:,itone))) enddo s4(0:3,k)=abs(cs(0:3,k))**2 enddo @@ -85,49 +85,85 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual, return endif - call timer('seqcorrs',0) bitmetrics=0.0 - do nseq=1,nmax !Try coherent sequences of 1,2,3,4 or 1,2,4,8 symbols - if(nseq.eq.1) nsym=1 - if(nseq.eq.2) nsym=2 - if(nhicoh.eq.0) then - if(nseq.eq.3) nsym=3 - if(nseq.eq.4) nsym=4 - else - if(nseq.eq.3) nsym=4 - if(nseq.eq.4) nsym=8 - endif - nt=4**nsym - do ks=1,NN-nsym+1,nsym + +! Process the frame in 8-symbol chunks. Use 1-symbol correlations to calculate +! 2-symbol correlations. Then use 2-symbol correlations to calculate 4-symbol +! correlations. Finally, use 4-symbol correlations to calculate 8-symbol corrs. +! This eliminates redundant calculations. + + do k=1,NN,8 + + do m=1,8 ! do 4 1-symbol correlations for each of 8 symbs s2=0 - do i=0,nt-1 - csum=0 -! cterm=1 ! hmod.ne.1 - term=1 - do j=0,nsym-1 - ntone=mod(i/4**(nsym-1-j),4) - csum=csum+cs(graymap(ntone),ks+j)*term - term=-term -! csum=csum+cs(graymap(ntone),ks+j)*cterm ! hmod.ne.1 -! cterm=cterm*conjg(cp(graymap(ntone))) ! hmod.ne.1 - enddo - s2(i)=abs(csum) + do n=1,4 + c1(n,m)=cs(graymap(n-1),k+m-1) + s2(n-1)=abs(c1(n,m)) enddo - ipt=1+(ks-1)*2 - if(nsym.eq.1) ibmax=1 - if(nsym.eq.2) ibmax=3 - if(nsym.eq.3) ibmax=5 - if(nsym.eq.4) ibmax=7 - if(nsym.eq.8) ibmax=15 - do ib=0,ibmax - bm=maxval(s2(0:nt-1),one(0:nt-1,ibmax-ib)) - & - maxval(s2(0:nt-1),.not.one(0:nt-1,ibmax-ib)) + ipt=(k-1)*2+2*(m-1)+1 + do ib=0,1 + bm=maxval(s2(0:3),one(0:3,1-ib)) - & + maxval(s2(0:3),.not.one(0:3,1-ib)) if(ipt+ib.gt.2*NN) cycle - bitmetrics(ipt+ib,nseq)=bm + bitmetrics(ipt+ib,1)=bm enddo enddo + + do m=1,4 ! do 16 2-symbol correlations for each of 4 2-symbol groups + s2=0 + do i=1,4 + do j=1,4 + is=(i-1)*4+j + c2(is,m)=c1(i,2*m-1)-c1(j,2*m) + s2(is-1)=abs(c2(is,m)) + enddo + enddo + ipt=(k-1)*2+4*(m-1)+1 + do ib=0,3 + bm=maxval(s2(0:15),one(0:15,3-ib)) - & + maxval(s2(0:15),.not.one(0:15,3-ib)) + if(ipt+ib.gt.2*NN) cycle + bitmetrics(ipt+ib,2)=bm + enddo + enddo + + do m=1,2 ! do 256 4-symbol corrs for each of 2 4-symbol groups + s2=0 + do i=1,16 + do j=1,16 + is=(i-1)*16+j + c4(is,m)=c2(i,2*m-1)+c2(j,2*m) + s2(is-1)=abs(c4(is,m)) + enddo + enddo + ipt=(k-1)*2+8*(m-1)+1 + do ib=0,7 + bm=maxval(s2(0:255),one(0:255,7-ib)) - & + maxval(s2(0:255),.not.one(0:255,7-ib)) + if(ipt+ib.gt.2*NN) cycle + bitmetrics(ipt+ib,3)=bm + enddo + enddo + + s2=0 ! do 65536 8-symbol correlations for the entire group + do i=1,256 + do j=1,256 + is=(i-1)*256+j + c8(is)=c4(i,1)+c4(j,2) + s2(is-1)=abs(c8(is)) + enddo + enddo + ipt=(k-1)*2+1 + do ib=0,15 + bm=maxval(s2(0:65535),one(0:65535,15-ib)) - & + maxval(s2(0:65535),.not.one(0:65535,15-ib)) + if(ipt+ib.gt.2*NN) cycle + bitmetrics(ipt+ib,4)=bm + enddo + enddo + call timer('seqcorrs',1) hbits=0 From 3886411fadc2458110db5dfca07d35f69fa78f64 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Mon, 14 Sep 2020 13:55:30 -0400 Subject: [PATCH 6/8] Two more corrections to mode-switch settings of GUI controls in FST4/FST4W. --- widgets/mainwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/widgets/mainwindow.cpp b/widgets/mainwindow.cpp index 0bf7e7610..1957068f9 100644 --- a/widgets/mainwindow.cpp +++ b/widgets/mainwindow.cpp @@ -5910,6 +5910,7 @@ void MainWindow::on_actionFST4_triggered() m_wideGraph->setModeTx(m_modeTx); m_wideGraph->setPeriod(m_TRperiod,6912); m_wideGraph->setRxFreq(ui->RxFreqSpinBox->value()); + m_wideGraph->setTol(ui->sbFtol->value()); m_wideGraph->setTxFreq(ui->TxFreqSpinBox->value()); switch_mode (Modes::FST4); m_wideGraph->setMode(m_mode); @@ -5944,7 +5945,6 @@ void MainWindow::on_actionFST4W_triggered() m_wideGraph->setRxFreq(ui->sbFST4W_RxFreq->value()); m_wideGraph->setTol(ui->sbFST4W_FTol->value()); ui->sbFtol->setValue(100); - ui->RxFreqSpinBox->setValue(1500); switch_mode (Modes::FST4W); statusChanged(); } From b49a90f5301e9e141379857ba63adc8b7ec6ff84 Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Mon, 14 Sep 2020 13:03:33 -0500 Subject: [PATCH 7/8] Remove a redundant array. --- lib/fst4/get_fst4_bitmetrics.f90 | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/fst4/get_fst4_bitmetrics.f90 b/lib/fst4/get_fst4_bitmetrics.f90 index 87255e2ba..181be6f56 100644 --- a/lib/fst4/get_fst4_bitmetrics.f90 +++ b/lib/fst4/get_fst4_bitmetrics.f90 @@ -7,7 +7,7 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual, complex csymb(nss) complex, allocatable, save :: ci(:,:) ! ideal waveforms, 20 samples per symbol, 4 tones complex cp(0:3) ! accumulated phase shift over symbol types 0:3 - complex c1(4,8),c2(16,4),c4(256,2),c8(655356),cterm + complex c1(4,8),c2(16,4),c4(256,2),cterm integer isyncword1(0:7),isyncword2(0:7) integer graymap(0:3) integer ip(1) @@ -150,8 +150,7 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual, do i=1,256 do j=1,256 is=(i-1)*256+j - c8(is)=c4(i,1)+c4(j,2) - s2(is-1)=abs(c8(is)) + s2(is-1)=abs(c4(i,1)+c4(j,2)) enddo enddo ipt=(k-1)*2+1 From 221ede2903d7d8032d043ea69c76174580d8bd1d Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Mon, 14 Sep 2020 13:07:07 -0500 Subject: [PATCH 8/8] Remove some unused variables. --- lib/fst4/get_fst4_bitmetrics.f90 | 9 +++------ lib/fst4_decode.f90 | 2 +- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/fst4/get_fst4_bitmetrics.f90 b/lib/fst4/get_fst4_bitmetrics.f90 index 181be6f56..9d3b0ba83 100644 --- a/lib/fst4/get_fst4_bitmetrics.f90 +++ b/lib/fst4/get_fst4_bitmetrics.f90 @@ -1,4 +1,4 @@ -subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual,badsync) +subroutine get_fst4_bitmetrics(cd,nss,nmax,nhicoh,bitmetrics,s4,nsync_qual,badsync) use timer_module, only: timer include 'fst4_params.f90' @@ -6,12 +6,10 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual, complex cs(0:3,NN) complex csymb(nss) complex, allocatable, save :: ci(:,:) ! ideal waveforms, 20 samples per symbol, 4 tones - complex cp(0:3) ! accumulated phase shift over symbol types 0:3 - complex c1(4,8),c2(16,4),c4(256,2),cterm + complex c1(4,8),c2(16,4),c4(256,2) integer isyncword1(0:7),isyncword2(0:7) integer graymap(0:3) integer ip(1) - integer hmod integer hbits(2*NN) logical one(0:65535,0:15) ! 65536 8-symbol sequences, 16 bits logical first @@ -35,7 +33,7 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual, enddo enddo twopi=8.0*atan(1.0) - dphi=twopi*hmod/nss + dphi=twopi/nss do itone=0,3 dp=(itone-1.5)*dphi phi=0.0 @@ -43,7 +41,6 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,nsync_qual, ci(j,itone)=cmplx(cos(phi),sin(phi)) phi=mod(phi+dp,twopi) enddo - cp(itone)=cmplx(cos(phi),sin(phi)) enddo first=.false. endif diff --git a/lib/fst4_decode.f90 b/lib/fst4_decode.f90 index c90149298..5d953e0e4 100644 --- a/lib/fst4_decode.f90 +++ b/lib/fst4_decode.f90 @@ -316,7 +316,7 @@ contains cframe=c2(is0:is0+160*nss-1) bitmetrics=0 call timer('bitmetrc',0) - call get_fst4_bitmetrics(cframe,nss,hmod,nblock,nhicoh,bitmetrics, & + call get_fst4_bitmetrics(cframe,nss,nblock,nhicoh,bitmetrics, & s4,nsync_qual,badsync) call timer('bitmetrc',1) if(badsync) cycle