Working toward multi-decode capability.

This commit is contained in:
Joe Taylor 2021-02-01 10:54:04 -05:00
parent 6519c07a71
commit 86ada8c9d4
2 changed files with 31 additions and 10 deletions

View File

@ -135,18 +135,12 @@ contains
call timer('q65_dec0',1)
if(idec.ge.0) then
dtdec=xdt !We have a list-decode result
dtdec=xdt !We have a list-decode result at nfqso
f0dec=f0
go to 100
endif
! if(snr1.lt.2.8) then
! dtdec=0. !No reliable sync, abandon decoding attempt
! f0dec=0.
! go to 100
! endif
! Prepare for a single-period decode woth iaptype = 0, 1, or 2 (also 4?)
! Prepare for a single-period decode with iaptype = 0, 1, 2, or 4
jpk0=(xdt+1.0)*6000 !Index of nominal start of signal
if(ntrperiod.le.30) jpk0=(xdt+0.5)*6000 !For shortest sequences
if(jpk0.lt.0) jpk0=0
@ -203,7 +197,7 @@ contains
go to 100
endif
! There was no 'q3n' decode. Try for a 'q[012]n' decode.
! There was no 'q3n' decode. Try for a 'q[0124]n' decode.
! Call top-level routine in q65 module: establish sync and try for a q[012]n
! decode, this time using the cumulative 's1a' symbol spectra.
@ -268,6 +262,11 @@ contains
endif
navg0=1000*navg(0) + navg(1)
! do icand=1,ncand
! write(72,3072) icand,candidates(icand,1:3)
!3072 format(i2,3f10.3)
! enddo
return
end subroutine decode

View File

@ -12,10 +12,11 @@ module q65
integer codewords(63,206)
integer ibwa,ibwb,ncw,nsps,mode_q65,nfa,nfb
integer idf,idt,ibw
integer istep,nsmo,lag1,lag2,npasses,nused,iseq
integer istep,nsmo,lag1,lag2,npasses,nused,iseq,ncand
integer i0,j0
integer navg(0:1)
logical lnewdat
real candidates(20,3) !snr, xdt, and f0 of top candidates
real,allocatable,save :: s1a(:,:,:) !Cumulative symbol spectra
real sync(85) !sync vector
real df,dtstep,dtdec,f0dec,ftol
@ -394,8 +395,11 @@ subroutine q65_ccf_22(s1,iz,jz,nfqso,ipk,jpk,f0,xdt,ccf2)
real s1(iz,jz)
real ccf2(iz) !Orange sync curve
real, allocatable :: xdt2(:)
integer, allocatable :: indx(:)
allocate(xdt2(iz))
allocate(indx(iz))
ccfbest=0.
ibest=0
lagpk=0
@ -425,11 +429,29 @@ subroutine q65_ccf_22(s1,iz,jz,nfqso,ipk,jpk,f0,xdt,ccf2)
endif
enddo
! Parameters for the top candidate:
ipk=ibest - i0
jpk=lagbest
f0=nfqso + ipk*df
xdt=jpk*dtstep
! Save parameters for best candidates
i1=nfa/df
i2=nfb/df
jzz=i2-i1+1
call pctile(ccf2(i1:i2),jzz,40,base)
ccf2=ccf2/base
call indexx(ccf2(i1:i2),jzz,indx)
ncand=0
do j=1,20
i=indx(jzz-j+1)+i1-1
if(ccf2(i).lt.3.0) exit
ncand=ncand+1
candidates(ncand,1)=ccf2(i)
candidates(ncand,2)=xdt2(i)
candidates(ncand,3)=i*df
enddo
return
end subroutine q65_ccf_22