Message averaging now working for 'q3n' decodes.

This commit is contained in:
Joe Taylor 2021-01-14 14:56:37 -05:00
parent 02d410d4f7
commit 921831119c
2 changed files with 44 additions and 28 deletions

View File

@ -73,7 +73,7 @@ contains
npts=ntrperiod*12000 npts=ntrperiod*12000
nfft1=ntrperiod*12000 nfft1=ntrperiod*12000
nfft2=ntrperiod*6000 nfft2=ntrperiod*6000
if(lclearave) nsave=0 if(lclearave) call q65_clravg
allocate(dd(npts)) allocate(dd(npts))
allocate (c00(0:nfft1-1)) allocate (c00(0:nfft1-1))
allocate (c0(0:nfft1-1)) allocate (c0(0:nfft1-1))
@ -93,7 +93,6 @@ contains
endif endif
baud=12000.0/nsps baud=12000.0/nsps
df1=12000.0/nfft1
this%callback => callback this%callback => callback
nFadingModel=1 nFadingModel=1
ibwa=max(1,int(1.8*log(baud*mode_q65)) + 2) ibwa=max(1,int(1.8*log(baud*mode_q65)) + 2)
@ -103,14 +102,17 @@ contains
ibwb=min(10,ibwb+1) ibwb=min(10,ibwb+1)
endif endif
! Set up the codewords for full-AP list decoding ! Generate codewords for full-AP list decoding
call q65_set_list(mycall,hiscall,hisgrid,codewords,ncw) call q65_set_list(mycall,hiscall,hisgrid,codewords,ncw)
dgen=0 dgen=0
call q65_enc(dgen,codewords) !Initialize the Q65 codec call q65_enc(dgen,codewords) !Initialize the Q65 codec
nused=1
call timer('q65_dec0',0) call timer('q65_dec0',0)
! Call top-level routine in q65 module: establish sync and try for a q3 decode. ! Call top-level routine in q65 module: establish sync and try for a q3 decode.
call q65_dec0(nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, & call q65_dec0(nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, &
emedelay,xdt,f0,snr1,width,dat4,snr2,idec) emedelay,xdt,f0,snr1,width,dat4,snr2,idec)
! idec=-1 !### TEMPORARY ###
call timer('q65_dec0',1) call timer('q65_dec0',1)
if(idec.ge.0) then if(idec.ge.0) then
@ -124,24 +126,22 @@ contains
f1=0. f1=0.
go to 100 go to 100
endif endif
! Prepare for a single-period decode woth iaptype = 0, 1, or 2 (also 4?)
jpk0=(xdt+1.0)*6000 !Index of nominal start of signal jpk0=(xdt+1.0)*6000 !Index of nominal start of signal
if(ntrperiod.le.30) jpk0=(xdt+0.5)*6000 !For shortest sequences if(ntrperiod.le.30) jpk0=(xdt+0.5)*6000 !For shortest sequences
if(jpk0.lt.0) jpk0=0 if(jpk0.lt.0) jpk0=0
fac=1.0/32767.0 fac=1.0/32767.0
dd=fac*iwave(1:npts) dd=fac*iwave(1:npts)
call ana64(dd,npts,c00) !Convert to complex c00() at 6000 Sa/s call ana64(dd,npts,c00) !Convert to complex c00() at 6000 Sa/s
call ft8apset(mycall,hiscall,ncontest,apsym0,aph10) ! Generate ap symbols
! Generate ap symbols as in FT8
call ft8apset(mycall,hiscall,ncontest,apsym0,aph10)
where(apsym0.eq.-1) apsym0=0 where(apsym0.eq.-1) apsym0=0
! Main decoding loop starts here
npasses=2 npasses=2
if(nQSOprogress.eq.5) npasses=3 if(nQSOprogress.eq.5) npasses=3
if(lapcqonly) npasses=1 if(lapcqonly) npasses=1
iaptype=0 iaptype=0
do ipass=0,npasses do ipass=0,npasses !Loop over AP passes
apmask=0 !Try first with no AP information apmask=0 !Try first with no AP information
apsymbols=0 apsymbols=0
@ -160,41 +160,36 @@ contains
call timer('q65loops',0) call timer('q65loops',0)
call q65_loops(c00,npts/2,nsps/2,nsubmode,ndepth,jpk0, & call q65_loops(c00,npts/2,nsps/2,nsubmode,ndepth,jpk0, &
xdt,f0,iaptype,xdt1,f1,snr2,dat4,idec) xdt,f0,iaptype,xdt1,f1,snr2,dat4,idec)
! idec=-1 !### TEMPORARY ###
call timer('q65loops',1) call timer('q65loops',1)
if(idec.ge.0) go to 100 !Successful decode, we're done if(idec.ge.0) go to 100 !Successful decode, we're done
enddo enddo
! There was no single-transmission decode.
if(iand(ndepth,16).eq.16) then if(iand(ndepth,16).eq.16) then
! Try for an average decode. ! There was no single-transmission decode. Try for an average decode.
call timer('q65_avg2',0) call timer('list_avg',0)
! call q65_avg2(ntrperiod,baud,nsubmode,nQSOprogress,lapcqonly, & call q65_q3a(xdt,f0,nfqso,nsps,snr2,dat4,idec,decoded)
! codewords,ncw,xdt,f0,snr2,dat4,idec) call timer('list_avg',1)
call timer('q65_avg2',1) nused=navg
endif endif
100 decoded=' ' 100 decoded=' '
if(idec.ge.0) then if(idec.ge.0) then
! ------------------------------------------------------
! idec Meaning ! idec Meaning
! ------------------------------------------------------ ! ------------------------------------------------------
! -1: No decode ! -1: No decode
! 1: Decode with AP for "MyCall DxCall ?" ! 0: Decode without AP information
! 2: Decode without AP information ! 1: Decode with AP for "CQ ? ?"
! 3: Decode with AP for "CQ ? ?" ! 2: Decode with AP for "MyCall ? ?"
! 4: Decode with AP for "MyCall ? ?" ! 3: Decode with AP for "MyCall DxCall ?"
! ------------------------------------------------------
! Second digit (if any) is number of sequences averaged.
! ------------------------------------------------------
! Unpack decoded message for display to user ! Unpack decoded message for display to user
write(c77,1000) dat4(1:12),dat4(13)/2 write(c77,1000) dat4(1:12),dat4(13)/2
1000 format(12b6.6,b5.5) 1000 format(12b6.6,b5.5)
call unpack77(c77,0,decoded,unpk77_success) !Unpack to get msgsent call unpack77(c77,0,decoded,unpk77_success) !Unpack to get msgsent
nsnr=nint(snr2) nsnr=nint(snr2)
call this%callback(nutc,snr1,nsnr,xdt1,f1,decoded,idec,navg,ntrperiod) call this%callback(nutc,snr1,nsnr,xdt1,f1,decoded,idec,nused,ntrperiod)
call q65_clravg call q65_clravg !Automatic ClrAvg after a decode
else else
! Report snr1, even if no decode. ! Report snr1, even if no decode.
nsnr=db(snr1) - 35.0 nsnr=db(snr1) - 35.0

View File

@ -71,7 +71,7 @@ subroutine q65_dec0(nutc,iwave,ntrperiod,nfqso,ntol,ndepth,lclearave, &
istep=nsps/NSTEP istep=nsps/NSTEP
iz=5000.0/df !Uppermost frequency bin, at 5000 Hz iz=5000.0/df !Uppermost frequency bin, at 5000 Hz
txt=85.0*nsps/12000.0 txt=85.0*nsps/12000.0
jz=(txt+1.0)*12000.0/istep !Number of quarter-symbol steps jz=(txt+1.0)*12000.0/istep !Number of symbol/NSTEP bins
if(nsps.ge.6912) jz=(txt+2.0)*12000.0/istep !For TR 60 s and higher if(nsps.ge.6912) jz=(txt+2.0)*12000.0/istep !For TR 60 s and higher
ia=ntol/df ia=ntol/df
ia2=max(ia,10*mode_q65,nint(100.0/df)) ia2=max(ia,10*mode_q65,nint(100.0/df))
@ -196,7 +196,7 @@ end subroutine q65_dec0
subroutine q65_clravg subroutine q65_clravg
s1a=0. if(allocated(s1a)) s1a=0.
navg=0 navg=0
return return
@ -282,6 +282,27 @@ subroutine q65_dec_q3(s1,iz,jz,s3,LL,ipk,jpk,snr2,dat4,idec,decoded)
return return
end subroutine q65_dec_q3 end subroutine q65_dec_q3
subroutine q65_q3a(xdt,f0,nfqso,nsps,snr2,dat4,idec,decoded)
integer dat4(13)
character*37 decoded
real, allocatable :: s3a(:,:) !Symbol energies for avg s3a(LL,63)
df=12000.0/nsps
dtstep=float(nsps)/(NSTEP*12000.0)
iz=5000.0/df !Uppermost frequency bin, at 5000 Hz
txt=85.0*nsps/12000.0
istep=nsps/NSTEP
jz=(txt+1.0)*12000.0/istep !Number of symbol/NSTEP bins
LL=64*(2+mode_q65)
allocate(s3a(-64:LL-65,63))
ipk=nint((f0-nfqso)/df) + mode_q65
jpk=nint(xdt/dtstep)
call q65_dec_q3(s1a,iz,jz,s3a,LL,ipk,jpk,snr2,dat4,idec,decoded)
return
end subroutine q65_q3a
subroutine q65_ccf_85(s1,iz,jz,nfqso,ia,ia2, & subroutine q65_ccf_85(s1,iz,jz,nfqso,ia,ia2, &
ipk,jpk,f0,xdt,imsg_best,ccf,ccf1) ipk,jpk,f0,xdt,imsg_best,ccf,ccf1)