From 3d042ee56fd786159979fce68cfd7abe6f67631b Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Sat, 26 Dec 2020 10:04:17 -0500 Subject: [PATCH] Work in progress, on Q65 message averaging. --- CMakeLists.txt | 2 ++ lib/decoder.f90 | 3 ++- lib/q65_decode.f90 | 2 +- lib/q65_sync.f90 | 34 +++++++++++++++++++--------------- 4 files changed, 24 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90f6ddc6f..053fee6d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -325,6 +325,7 @@ set (wsjt_FSRCS lib/options.f90 lib/packjt.f90 lib/77bit/packjt77.f90 + lib/q65.f90 lib/q65_decode.f90 lib/readwav.f90 lib/timer_C_wrapper.f90 @@ -495,6 +496,7 @@ set (wsjt_FSRCS lib/polyfit.f90 lib/prog_args.f90 lib/ps4.f90 + lib/q65_avg.f90 lib/q65_sync.f90 lib/qra/q65/q65_ap.f90 lib/qra/q65/q65_loops.f90 diff --git a/lib/decoder.f90 b/lib/decoder.f90 index 5db45f5be..77a03d190 100644 --- a/lib/decoder.f90 +++ b/lib/decoder.f90 @@ -201,6 +201,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) if(params%nmode.eq.66) then !NB: JT65 = 65, Q65 = 66. ! We're in Q65 mode open(17,file=trim(temp_dir)//'/red.dat',status='unknown') + open(14,file=trim(temp_dir)//'/avemsg.txt',status='unknown') call timer('dec_q65 ',0) call my_q65%decode(q65_decoded,id2,params%nutc,params%ntr, & params%nsubmode,params%nfqso,params%ntol,params%ndepth, & @@ -368,7 +369,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample) endif close(13) if(ncontest.eq.6) close(19) - if(params%nmode.eq.4 .or. params%nmode.eq.65) close(14) + if(params%nmode.eq.4 .or. params%nmode.eq.65 .or. params%nmode.eq.66) close(14) return diff --git a/lib/q65_decode.f90 b/lib/q65_decode.f90 index 9fefb8088..e2e402059 100644 --- a/lib/q65_decode.f90 +++ b/lib/q65_decode.f90 @@ -94,7 +94,7 @@ contains dgen=0 call q65_enc(dgen,codewords) !Initialize Q65 call timer('sync_q65',0) - call q65_sync(nutc,iwave,ntrperiod*12000,mode65,codewords,ncw,nsps, & + call q65_sync(nutc,iwave,ntrperiod,mode65,codewords,ncw,nsps, & nfqso,ntol,ndepth,lclearave,emedelay,xdt,f0,snr1,width,dat4,snr2,id1) call timer('sync_q65',1) if(id1.eq.1 .or. id1.ge.12) then diff --git a/lib/q65_sync.f90 b/lib/q65_sync.f90 index b8112f250..5492ee58e 100644 --- a/lib/q65_sync.f90 +++ b/lib/q65_sync.f90 @@ -1,4 +1,4 @@ -subroutine q65_sync(nutc,iwave,nmax,mode_q65,codewords,ncw,nsps,nfqso,ntol, & +subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps,nfqso,ntol, & ndepth,lclearave,emedelay,xdt,f0,snr1,width,dat4,snr2,id1) ! Detect and align with the Q65 sync vector, returning time and frequency @@ -17,7 +17,7 @@ subroutine q65_sync(nutc,iwave,nmax,mode_q65,codewords,ncw,nsps,nfqso,ntol, & parameter (NSTEP=8) !Step size nsps/NSTEP parameter (LN=2176*63) !LN=LL*NN; LL=64*(mode_q65+2), NN=63 parameter (PLOG_MIN=-240.0) !List decoding threshold - integer*2 iwave(0:nmax-1) !Raw data + integer*2 iwave(0:12000*ntrperiod-1) !Raw data integer isync(22) !Indices of sync symbols integer itone(85) integer codewords(63,206) @@ -142,13 +142,14 @@ subroutine q65_sync(nutc,iwave,nmax,mode_q65,codewords,ncw,nsps,nfqso,ntol, & enddo ! Compute 2D ccf using all 85 symbols in the list message ccf=0. + iia=200.0/df do lag=lag1,lag2 do k=1,85 j=j0 + NSTEP*(k-1) + 1 + lag if(j.ge.1 .and. j.le.jz) then do i=-ia2,ia2 ii=i0+mode_q65*(itone(k)+1)+i - if(ii.ge.1 .and. ii.le.iz) ccf(i,lag)=ccf(i,lag) + s1(ii,j) + if(ii.ge.iia .and. ii.le.iz) ccf(i,lag)=ccf(i,lag) + s1(ii,j) enddo endif enddo @@ -259,20 +260,23 @@ subroutine q65_sync(nutc,iwave,nmax,mode_q65,codewords,ncw,nsps,nfqso,ntol, & ! Compute s3() here, then call q65_avg(). i1=i0+ipk-64 i2=i1+LL-1 - j=j0+jpk-7 - n=0 - do k=1,85 - j=j+8 - if(sync(k).gt.0.0) then - cycle - endif - n=n+1 - if(j.ge.1 .and. j.le.jz) s3(-64:LL-65,n)=s1(i1:i2,j) - enddo - write(40) nutc,mode_q65,LL,xdt,f0,snr1,s3 + if(i1.ge.1 .and. i2.le.iz) then + j=j0+jpk-7 + n=0 + do k=1,85 + j=j+8 + if(sync(k).gt.0.0) then + cycle + endif + n=n+1 + if(j.ge.1 .and. j.le.jz) s3(-64:LL-65,n)=s1(i1:i2,j) + enddo + call q65_avg(nutc,ntrperiod,mode_q65,LL,nfqso,ntol,lclearave,xdt, & + f0,snr1,s3) + endif 200 smax=maxval(ccf1) - if(lavg) id1=10+navg !This is an average decode + if(lavg) id1=10+navg !If this is an average decode i1=-9999 i2=-9999 do i=-ia,ia