Q65 decoder mostly working now with all (A B C D) decoding types.

This commit is contained in:
Joe Taylor 2020-12-29 16:41:48 -05:00
parent 520a0c7cc0
commit b6d2002985
4 changed files with 41 additions and 38 deletions

View File

@ -97,13 +97,12 @@ contains
call timer('sync_q65',0) call timer('sync_q65',0)
call q65_sync(nutc,iwave,ntrperiod,mode65,codewords,ncw,nsps, & call q65_sync(nutc,iwave,ntrperiod,mode65,codewords,ncw,nsps, &
nfqso,ntol,ndepth,lclearave,emedelay,xdt,f0,snr1,width,dat4, & nfqso,ntol,ndepth,lclearave,emedelay,xdt,f0,snr1,width,dat4, &
snr2,id1) snr2,idec)
call timer('sync_q65',1) call timer('sync_q65',1)
if(idec.ge.0) then
if(id1.eq.1 .or. id1.ge.12) then
xdt1=xdt !We have a list-decode result xdt1=xdt !We have a list-decode result
f1=f0 f1=f0
! go to 100 !### TEMPORARILY REMOVED ### go to 100
endif endif
if(snr1.lt.2.8) then if(snr1.lt.2.8) then
@ -154,19 +153,20 @@ contains
call timer('q65loops',0) call timer('q65loops',0)
call q65_loops(c00,npts/2,nsps/2,mode65,nsubmode,ndepth,jpk0, & call q65_loops(c00,npts/2,nsps/2,mode65,nsubmode,ndepth,jpk0, &
xdt,f0,width,iaptype,xdt1,f1,snr2,dat4,id2) xdt,f0,width,iaptype,xdt1,f1,snr2,dat4,idec)
call timer('q65loops',1) call timer('q65loops',1)
if(id2.gt.0) exit !Exit main loop after a successful decode if(id2.gt.0) exit !Exit main loop after a successful decode
enddo enddo
! No single-transmission decode. ! No single-transmission decode.
! if(iand(ndepth,16).eq.16) call q65_avg2 if(iand(ndepth,16).eq.16) then
! print*,'AAA: try for avg',navg call q65_avg2(nutc,ntrperiod,LL,ntol,lclearave, &
baud,nsubmode,ibwa,ibwb,codewords,ncw,xdt,f0,snr1,s3,dat4,idec)
endif
100 decoded=' ' 100 decoded=' '
if(id1.gt.0 .or. id2.gt.0) then if(idec.gt.0) then
! Unpack decoded message for display to user ! Unpack decoded message for display to user
idec=id1+id2
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

View File

@ -1,5 +1,5 @@
subroutine q65_avg(nutc,ntrperiod,LL,ntol,lclearave, & subroutine q65_avg(nutc,ntrperiod,LL,ntol,lclearave,baud,nsubmode, &
baud,nsubmode,ibwa,ibwb,codewords,ncw,xdt,f0,snr1,s3) ibwa,ibwb,codewords,ncw,xdt,f0,snr1,s3)
! Accumulate Q65 spectra s3(LL,63) and associated parameters for ! Accumulate Q65 spectra s3(LL,63) and associated parameters for
! message averaging. ! message averaging.
@ -63,9 +63,14 @@ subroutine q65_avg(nutc,ntrperiod,LL,ntol,lclearave, &
f0save(nsave)=f0 !f0 f0save(nsave)=f0 !f0
s3save(:,:,nsave)=s3(:,:) !Symbol spectra s3save(:,:,nsave)=s3(:,:) !Symbol spectra
10 continue 10 return
!10 if(nsave.lt.2) go to 900 entry q65_avg2(nutc,ntrperiod,LL,ntol,lclearave,baud,nsubmode, &
ibwa,ibwb,codewords,ncw,xdt,f0,snr1,s3,dat4,idec)
mode_q65=2**nsubmode
ibwa=1.8*log(baud*mode_q65) + 2
ibwb=min(10,ibwa+4)
snr1sum=0. snr1sum=0.
xdtsum=0. xdtsum=0.
fsum=0. fsum=0.
@ -77,12 +82,8 @@ subroutine q65_avg(nutc,ntrperiod,LL,ntol,lclearave, &
cused(i)='.' !Flag for "not used" cused(i)='.' !Flag for "not used"
if(iutc(i).lt.0) cycle if(iutc(i).lt.0) cycle
if(iseq(i).ne.iseq(nsave)) cycle !Sequence must match if(iseq(i).ne.iseq(nsave)) cycle !Sequence must match
! write(*,3000) i,iseq(i),nutc,iutc(i),xdt-xdtsave(i),f0-f0save(i)
!3000 format(2i2,2i5,2f7.2)
if(abs(xdt-xdtsave(i)).gt.dtdiff) cycle !DT must be close if(abs(xdt-xdtsave(i)).gt.dtdiff) cycle !DT must be close
if(abs(f0-f0save(i)).gt.float(ntol)) cycle !Freq must match if(abs(f0-f0save(i)).gt.float(ntol)) cycle !Freq must match
! write(*,3001) 'a',i,nsave,iseq(i),snr1,xdt,f0
!3001 format(a1,3i4,3f8.2)
cused(i)='$' !Flag for "use this one" cused(i)='$' !Flag for "use this one"
s3avg=s3avg + s3save(:,:,i) !Add this spectrum s3avg=s3avg + s3save(:,:,i) !Add this spectrum
snr1sum=snr1sum + snr1save(i) snr1sum=snr1sum + snr1save(i)
@ -92,15 +93,16 @@ subroutine q65_avg(nutc,ntrperiod,LL,ntol,lclearave, &
iused(navg)=i iused(navg)=i
enddo enddo
if(navg.lt.MAXAVE) iused(navg+1)=0 if(navg.lt.MAXAVE) iused(navg+1)=0
if(navg.lt.2) go to 900
! Find averages of snr1, xdt, and f0 used in this decoding attempt. ! Find averages of snr1, xdt, and f0 used in this decoding attempt.
snr1ave=0. snr1ave=0.
xdtave=0. xdtave=0.
fave=0. f0ave=0.
if(navg.gt.0) then if(navg.gt.0) then
snr1ave=snr1sum/navg snr1ave=snr1sum/navg
xdtave=xdtsum/navg xdtave=xdtsum/navg
fave=fsum/navg f0ave=fsum/navg
endif endif
! Write parameters for display to User in the Message Averaging (F7) window. ! Write parameters for display to User in the Message Averaging (F7) window.
@ -119,28 +121,30 @@ subroutine q65_avg(nutc,ntrperiod,LL,ntol,lclearave, &
do ibw=ibwa,ibwb do ibw=ibwa,ibwb
b90=1.72**ibw b90=1.72**ibw
b90ts=b90/baud b90ts=b90/baud
call q65_dec1(s3,nsubmode,b90ts,codewords,ncw,esnodb,irc,dat4,avemsg) call q65_dec1(s3avg,nsubmode,b90ts,codewords,ncw,esnodb,irc,dat4,avemsg)
! irc=-99 !### TEMPORARY ###
if(irc.ge.0 .and. plog.ge.PLOG_MIN) then if(irc.ge.0 .and. plog.ge.PLOG_MIN) then
snr2=esnodb - db(2500.0/baud) + 3.0 !Empirical adjustment snr2=esnodb - db(2500.0/baud) + 3.0 !Empirical adjustment
id1=1 !### idec=10+navg !###
! print*,'B dec1 ',ibw,irc,avemsg ! print*,'C dec1 ',ibw,irc,idec,avemsg
exit go to 900
endif endif
enddo enddo
APmask=0 ! Should loop here over full range of available AP
APsymbols=0 ! APmask=0
! APsymbols=0
do ibw=ibwa,ibwb do ibw=ibwa,ibwb
b90=1.72**ibw b90=1.72**ibw
b90ts=b90/baud b90ts=b90/baud
call q65_dec2(s3,nsubmode,b90ts,esnodb,irc,dat4,avemsg) call q65_dec2(s3avg,nsubmode,b90ts,esnodb,irc,dat4,avemsg)
if(irc.ge.0) then if(irc.ge.0) then
id2=iaptype+2 idec=10*(iaptype+2) + navg
! print*,'C dec2 ',ibw,irc,avemsg ! print*,'D dec2 ',ibw,irc,avemsg
exit go to 900
endif endif
enddo ! ibw (b90 loop) enddo ! ibw (b90 loop)
return 900 return
end subroutine q65_avg end subroutine q65_avg

View File

@ -77,9 +77,10 @@ subroutine q65_loops(c00,npts2,nsps,mode_q65,nsubmode,ndepth,jpk0, &
! -1 = invalid params ! -1 = invalid params
! -2 = decode failed ! -2 = decode failed
! -3 = CRC mismatch ! -3 = CRC mismatch
! irc=-99 !### TEMPORARY ###
if(irc.ge.0) then if(irc.ge.0) then
id2=iaptype+2 id2=iaptype+2
! print*,'D dec2 ',ibw,irc,id2,decoded ! print*,'B dec2 ',ibw,irc,id2,decoded
go to 100 go to 100
endif endif
enddo ! ibw (b90 loop) enddo ! ibw (b90 loop)

View File

@ -1,5 +1,5 @@
subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, & subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
nfqso,ntol,ndepth,lclearave,emedelay,xdt,f0,snr1,width,dat4,snr2,id1) nfqso,ntol,ndepth,lclearave,emedelay,xdt,f0,snr1,width,dat4,snr2,idec)
! Detect and align with the Q65 sync vector, returning time and frequency ! Detect and align with the Q65 sync vector, returning time and frequency
! offsets and SNR estimate. ! offsets and SNR estimate.
@ -35,8 +35,8 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
data sync(1)/99.0/ data sync(1)/99.0/
save sync save sync
idec=-1
snr1=0. snr1=0.
id1=0
dat4=0 dat4=0
LL=64*(2+mode_q65) LL=64*(2+mode_q65)
nfft=nsps nfft=nsps
@ -182,15 +182,14 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
call q65_dec1(s3,nsubmode,b90ts,codewords,ncw,esnodb,irc,dat4,decoded) call q65_dec1(s3,nsubmode,b90ts,codewords,ncw,esnodb,irc,dat4,decoded)
! irc=-99 !### TEMPORARY ### ! irc=-99 !### TEMPORARY ###
if(irc.ge.0) then if(irc.ge.0) then
! print*,'A dec1 ',ibw,irc,decoded ! print*,'A dec1 ',ibw,irc,esnodb,baud,trim(decoded)
snr2=esnodb - db(2500.0/baud) + 3.0 !Empirical adjustment snr2=esnodb - db(2500.0/baud) + 3.0 !Empirical adjustment
id1=1 idec=1
ic=ia2/4; ic=ia2/4;
base=(sum(ccf1(-ia2:-ia2+ic)) + sum(ccf1(ia2-ic:ia2)))/(2.0+2.0*ic); base=(sum(ccf1(-ia2:-ia2+ic)) + sum(ccf1(ia2-ic:ia2)))/(2.0+2.0*ic);
ccf1=ccf1-base ccf1=ccf1-base
smax=maxval(ccf1) smax=maxval(ccf1)
if(smax.gt.10.0) ccf1=10.0*ccf1/smax if(smax.gt.10.0) ccf1=10.0*ccf1/smax
! go to 100 !### TEMPORARY ###
go to 200 go to 200
endif endif
enddo enddo
@ -257,7 +256,6 @@ subroutine q65_sync(nutc,iwave,ntrperiod,mode_q65,codewords,ncw,nsps, &
endif endif
200 smax=maxval(ccf1) 200 smax=maxval(ccf1)
! if(lavg) id1=10+navg !If this is an average decode
i1=-9999 i1=-9999
i2=-9999 i2=-9999
do i=-ia,ia do i=-ia,ia