diff options
| author | Christoph Berg <myon@debian.org> | 2021-03-27 10:23:34 +0100 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2021-03-27 10:23:34 +0100 |
| commit | 5c88480ddc5c5dab1f3444a8b8de9303fd6140da (patch) | |
| tree | e7073b1ff21f63e0b62c5846d849360c1a87df93 /lib/q65_decode.f90 | |
| parent | 1c4a8c9374cacfc002e47c8e3bb824e82aa8441c (diff) | |
New upstream version 2.4.0~rc4+repackupstream/2.4.0_rc4+repack
Diffstat (limited to 'lib/q65_decode.f90')
| -rw-r--r-- | lib/q65_decode.f90 | 72 |
1 files changed, 40 insertions, 32 deletions
diff --git a/lib/q65_decode.f90 b/lib/q65_decode.f90 index 0bea7d8e..7869527d 100644 --- a/lib/q65_decode.f90 +++ b/lib/q65_decode.f90 @@ -67,10 +67,10 @@ contains integer dat4(13) !Decoded message as 12 6-bit integers integer dgen(13) logical lclearave,lnewdat0,lapcqonly,unpk77_success - logical single_decode,lagain + logical single_decode,lagain,ex complex, allocatable :: c00(:) !Analytic signal, 6000 Sa/s complex, allocatable :: c0(:) !Analytic signal, 6000 Sa/s - + ! Start by setting some parameters and allocating storage for large arrays call sec0(0,tdecode) nfa=nfa0 @@ -79,7 +79,7 @@ contains idec=-1 idf=0 idt=0 - irc=0 + nrc=-2 mode_q65=2**nsubmode npts=ntrperiod*12000 nfft1=ntrperiod*12000 @@ -87,7 +87,7 @@ contains ! Determine the T/R sequence: iseq=0 (even), or iseq=1 (odd) n=nutc - if(ntrperiod.ge.60) n=100*n + if(ntrperiod.ge.60 .and. nutc.le.2359) n=100*n write(cutc,'(i6.6)') n read(cutc,'(3i2)') ih,im,is nsec=3600*ih + 60*im + is @@ -98,9 +98,12 @@ contains allocate (c00(0:nfft1-1)) allocate (c0(0:nfft1-1)) - if(ntrperiod.eq.15) then - nsps=1800 - else if(ntrperiod.eq.30) then + if(lagain) then + call q65_hist(nfqso,dxcall=hiscall,dxgrid=hisgrid) + endif + + nsps=1800 + if(ntrperiod.eq.30) then nsps=3600 else if(ntrperiod.eq.60) then nsps=7200 @@ -108,23 +111,26 @@ contains nsps=16000 else if(ntrperiod.eq.300) then nsps=41472 - else - stop 'Invalid TR period' endif baud=12000.0/nsps this%callback => callback nFadingModel=1 + + inquire(file='ndepth.dat',exist=ex) + if(.not.ex) ndepth=iand(ndepth,not(3)) + 1 !Treat any ndepth as "Fast" + maxiters=67 ibwa=max(1,int(1.8*log(baud*mode_q65)) + 1) - ibwb=min(10,ibwa+3) + ibwb=min(10,ibwa+4) if(iand(ndepth,3).ge.2) then - ibwa=max(1,int(1.8*log(baud*mode_q65)) + 2) + ibwa=max(1,int(1.8*log(baud*mode_q65)) + 1) ibwb=min(10,ibwa+5) else if(iand(ndepth,3).eq.3) then ibwa=max(1,ibwa-1) ibwb=min(10,ibwb+1) + maxiters=100 endif - + ! Generate codewords for full-AP list decoding call q65_set_list(mycall,hiscall,hisgrid,codewords,ncw) dgen=0 @@ -175,7 +181,6 @@ contains call timer('q65loops',0) call q65_loops(c00,npts/2,nsps/2,nsubmode,ndepth,jpk0, & xdt,f0,iaptype,xdt1,f1,snr2,dat4,idec) -! idec=-1 !### TEMPORARY ### call timer('q65loops',1) if(idec.ge.0) then dtdec=xdt1 @@ -185,8 +190,9 @@ contains enddo ! ipass if(iand(ndepth,16).eq.0 .or. navg(iseq).lt.2) go to 100 + ! There was no single-transmission decode. Try for an average 'q3n' decode. - call timer('list_avg',0) +50 call timer('list_avg',0) ! Call top-level routine in q65 module: establish sync and try for a q3 ! decode, this time using the cumulative 's1a' symbol spectra. iavg=1 @@ -229,10 +235,13 @@ contains write(c77,1000) dat4(1:12),dat4(13)/2 1000 format(12b6.6,b5.5) call unpack77(c77,0,decoded,unpk77_success) !Unpack to get msgsent + call q65_snr(dat4,dtdec,f0dec,mode_q65,nused,snr2) nsnr=nint(snr2) call this%callback(nutc,snr1,nsnr,dtdec,f0dec,decoded, & idec,nused,ntrperiod) - if(iand(ndepth,128).ne.0) call q65_clravg !AutoClrAvg after decode + call q65_hist(nint(f0dec),msg0=decoded) + if(iand(ndepth,128).ne.0 .and. .not.lagain .and. & + int(abs(f0dec-nfqso)).le.ntol ) call q65_clravg !AutoClrAvg call sec0(1,tdecode) open(22,file=trim(data_dir)//'/q65_decodes.dat',status='unknown', & position='append',iostat=ios) @@ -244,21 +253,15 @@ contains if(c6.eq.' ') c6='<b> ' c4=hisgrid(1:4) if(c4.eq.' ') c4='<b> ' - fmt='(i6.4,1x,a4,5i2,3i3,f6.2,f7.1,f7.2,f6.1,f6.2,'// & + fmt='(i6.4,1x,a4,4i2,6i3,i4,f6.2,f7.1,f6.1,f7.1,f6.2,'// & '1x,a6,1x,a6,1x,a4,1x,a)' if(ntrperiod.le.30) fmt(5:5)='6' - write(22,fmt) nutc,cmode,nQSOprogress,idec,idf,idt,ibw,nused, & - icand,ncand,xdt,f0,snr1,snr2,tdecode,mycall(1:6),c6,c4, & - trim(decoded) + if(idec.eq.3) nrc=0 + write(22,fmt) nutc,cmode,nQSOprogress,idec,idfbest,idtbest,ibw, & + ndistbest,nused,icand,ncand,nrc,ndepth,xdt,f0,snr2,plog, & + tdecode,mycall(1:6),c6,c4,trim(decoded) close(22) endif - else -! Report snr1, even if no decode. - nsnr=db(snr1) - 35.0 - if(nsnr.lt.-35) nsnr=-35 - idec=-1 - call this%callback(nutc,snr1,nsnr,xdt,f0,decoded, & - idec,0,ntrperiod) endif navg0=1000*navg(0) + navg(1) if(single_decode .or. lagain) go to 900 @@ -309,10 +312,13 @@ contains ! Unpack decoded message for display to user write(c77,1000) dat4(1:12),dat4(13)/2 call unpack77(c77,0,decoded,unpk77_success) !Unpack to get msgsent + call q65_snr(dat4,dtdec,f0dec,mode_q65,nused,snr2) nsnr=nint(snr2) call this%callback(nutc,snr1,nsnr,dtdec,f0dec,decoded, & idec,nused,ntrperiod) - if(iand(ndepth,128).ne.0) call q65_clravg !AutoClrAvg after decode + call q65_hist(nint(f0dec),msg0=decoded) + if(iand(ndepth,128).ne.0 .and. .not.lagain .and. & + int(abs(f0dec-nfqso)).le.ntol ) call q65_clravg !AutoClrAvg call sec0(1,tdecode) open(22,file=trim(data_dir)//'/q65_decodes.dat',status='unknown', & position='append',iostat=ios) @@ -324,16 +330,18 @@ contains if(c6.eq.' ') c6='<b> ' c4=hisgrid(1:4) if(c4.eq.' ') c4='<b> ' - fmt='(i6.4,1x,a4,5i2,3i3,f6.2,f7.1,f7.2,f6.1,f6.2,'// & + fmt='(i6.4,1x,a4,4i2,6i3,i4,f6.2,f7.1,f6.1,f7.1,f6.2,'// & '1x,a6,1x,a6,1x,a4,1x,a)' if(ntrperiod.le.30) fmt(5:5)='6' - write(22,fmt) nutc,cmode,nQSOprogress,idec,idf,idt,ibw,nused, & - icand,ncand,xdt,f0,snr1,snr2,tdecode,mycall(1:6),c6,c4, & - trim(decoded) + if(idec.eq.3) nrc=0 + write(22,fmt) nutc,cmode,nQSOprogress,idec,idfbest,idtbest,ibw, & + ndistbest,nused,icand,ncand,nrc,ndepth,xdt,f0,snr2,plog, & + tdecode,mycall(1:6),c6,c4,trim(decoded) close(22) endif endif - enddo + enddo ! icand + if(iavg.eq.0 .and.navg(iseq).ge.2) go to 50 900 return end subroutine decode |
