First cut at joint QSO/WSPR type decoding for FST240.

This commit is contained in:
Steven Franke 2020-06-30 15:06:18 -05:00
parent 0472a816fb
commit 630ef640ac

View File

@ -50,6 +50,7 @@ contains
real candidates(100,4)
real bitmetrics(320,4)
real s4(0:3,NN)
real minsync
logical lapcqonly
integer itone(NN)
integer hmod
@ -215,13 +216,6 @@ contains
allocate( c2(0:nfft2-1) )
allocate( cframe(0:160*nss-1) )
if(single_decode) then
fa=max(100,nint(nfqso+1.5*hmod*baud-ntol))
fb=min(4800,nint(nfqso+1.5*hmod*baud+ntol))
else
fa=max(100,nfa)
fb=min(4800,nfb)
endif
if(ndeep.eq.3) then
nblock=1
@ -246,9 +240,42 @@ contains
call four2a(r_data,nfft1,1,-1,0)
c_bigfft=cmplx(r_data(1:nfft1+2:2),r_data(2:nfft1+2:2))
if(iwspr.eq.0) then
itype1=1
itype2=1
elseif( iwspr.eq.1 ) then
itype1=2
itype2=2
elseif( iwspr.eq.2 ) then
itype1=1
itype2=2
endif
do iqorw=itype1,itype2 ! iqorw=1 for QSO mode and iqorw=2 for wspr-type messages
if( iwspr.lt.2 ) then
if( single_decode ) then
fa=max(100,nint(nfqso+1.5*hmod*baud-ntol))
fb=min(4800,nint(nfqso+1.5*hmod*baud+ntol))
else
fa=max(100,nfa)
fb=min(4800,nfb)
endif
elseif( iwspr.eq.2 .and. iqorw.eq.1 ) then
fa=max(100,nfa)
fb=nfsplit
elseif( iwspr.eq.2 .and. iqorw.eq.2 ) then
fa=nfsplit
fb=min(4800,nfb)
endif
minsync=1.25
if(iqorw.eq.2) then
minsync=1.2
endif
! Get first approximation of candidate frequencies
call get_candidates_fst240(c_bigfft,nfft1,nsps,hmod,fs,fa,fb, &
ncand,candidates,base)
minsync,ncand,candidates,base)
ndecodes=0
decodes=' '
@ -414,7 +441,7 @@ contains
if(ndepth.eq.1) ntmax=nblock
apmask=0
if(iwspr.eq.1) then
if(iqorw.eq.2) then ! 50-bit msgs, no ap decoding
nblock=4
ntmax=nblock
endif
@ -468,13 +495,14 @@ contains
dmin=0.0
nharderrors=-1
unpk77_success=.false.
if(iwspr.eq.0) then
if(iqorw.eq.1) then
maxosd=2
norder=3
call timer('d240_101',0)
call decode240_101(llr,Keff,maxosd,norder,apmask,message101, &
cw,ntype,nharderrors,dmin)
call timer('d240_101',1)
else
elseif(iqorw.eq.2) then
maxosd=2
call timer('d240_74 ',0)
Keff=64
@ -484,7 +512,7 @@ contains
call timer('d240_74 ',1)
endif
if(nharderrors .ge.0) then
if(iwspr.eq.0) then
if(iqor2.eq.1) then
write(c77,'(77i1)') mod(message101(1:77)+rvec,2)
call unpack77(c77,0,msg,unpk77_success)
else
@ -500,7 +528,7 @@ contains
if(idupe.eq.1) exit
ndecodes=ndecodes+1
decodes(ndecodes)=msg
if(iwspr.eq.0) then
call get_fst240_tones_from_bits(message101,itone,iwspr)
xsig=0
do i=1,NN
@ -521,14 +549,12 @@ contains
call this%callback(nutc,smax1,nsnr,xdt,fsig,msg, &
iaptype,qual,ntrperiod,lwspr)
goto 2002
else
cycle
endif
endif
enddo ! metrics
enddo ! istart jitter
2002 continue
enddo !candidate list!ws
enddo !candidate list
enddo ! iqorw
return
end subroutine decode
@ -651,7 +677,7 @@ contains
end subroutine fst240_downsample
subroutine get_candidates_fst240(c_bigfft,nfft1,nsps,hmod,fs,fa,fb, &
ncand,candidates,base)
minsync,ncand,candidates,base)
complex c_bigfft(0:nfft1/2) !Full length FFT of raw data
integer hmod !Modulation index (submode)
@ -660,9 +686,8 @@ contains
real s(18000) !Low resolution power spectrum
real s2(18000) !CCF of s() with 4 tones
real xdb(-3:3) !Model 4-tone CCF peaks
real minsync
data xdb/0.25,0.50,0.75,1.0,0.75,0.50,0.25/
data nfft1z/-1/
save nfft1z
nh1=nfft1/2
df1=fs/nfft1
@ -702,8 +727,6 @@ contains
enddo
call pctile(s2(ina+hmod*3:inb-hmod*3),inb-ina+1-hmod*6,30,base)
s2=s2/base !Normalize wrt noise level
! thresh=1.25
thresh=1.15 !First candidate threshold
ncand=0
candidates=0
@ -713,7 +736,7 @@ contains
! Find candidates, using the CLEAN algorithm to remove a model of each one
! from s2() after it has been found.
pval=99.99
do while(ncand.lt.100 .and. pval.gt.thresh)
do while(ncand.lt.100 .and. pval.gt.minsync)
im=maxloc(s2(ia:ib))
iploc=ia+im(1)-1 !Index of CCF peak
pval=s2(iploc) !Peak value