summaryrefslogtreecommitdiff
path: root/qmap/libqmap/getcand2.f90
diff options
context:
space:
mode:
authorDave Hibberd <hibby@debian.org>2024-04-27 12:26:26 +0100
committerDave Hibberd <hibby@debian.org>2024-04-27 12:26:26 +0100
commit93f7198f9c2864ef9630cc0cc9e46d6cc1933aa9 (patch)
tree74e80fba0ae76af8a4f9d5d1b6c8c8de8e383480 /qmap/libqmap/getcand2.f90
parentffea9660ba79a513401639a2f5d90e2fdc190fb8 (diff)
New upstream version 2.7.0~rc4+repackupstream/2.7.0_rc4+repack
Diffstat (limited to 'qmap/libqmap/getcand2.f90')
-rwxr-xr-xqmap/libqmap/getcand2.f9077
1 files changed, 63 insertions, 14 deletions
diff --git a/qmap/libqmap/getcand2.f90 b/qmap/libqmap/getcand2.f90
index f0fb1b8a..08b0acc5 100755
--- a/qmap/libqmap/getcand2.f90
+++ b/qmap/libqmap/getcand2.f90
@@ -1,4 +1,5 @@
-subroutine getcand2(ss,savg0,nts_q65,nagain,ntol,f0_selected,cand,ncand)
+subroutine getcand2(ss,savg0,nts_q65,nagain,nhsym,ntx30a,ntx30b, &
+ ntol,f0_selected,bAlso30,cand,ncand2)
! Get candidates for Q65 decodes, based on presence of sync tone.
@@ -6,15 +7,18 @@ subroutine getcand2(ss,savg0,nts_q65,nagain,ntol,f0_selected,cand,ncand)
real :: snr !Relative S/N of sync detection
real :: f !Freq of sync tone, 0 to 96000 Hz
real :: xdt !DT of matching sync pattern, -1.0 to +4.0 s
+ integer :: ntrperiod !60 for Q65-60x, 30 for Q65-30x
+ integer :: iseq !0 for first half-minute, 1 for second half
end type candidate
parameter (NFFT=32768) !FFTs done in symspec()
parameter (MAX_CANDIDATES=50)
type(candidate) :: cand(MAX_CANDIDATES)
- real ss(322,NFFT) !Symbol spectra
+ real ss(400,NFFT) !Symbol spectra
real savg0(NFFT),savg(NFFT) !Average spectra over whole Rx sequence
integer ipk1(1) !Peak index of local portion of spectrum
logical sync_ok !True if sync pattern is present
+ logical*1 bAlso30
data nseg/16/,npct/40/
savg=savg0 !Save the original spectrum
@@ -35,7 +39,7 @@ subroutine getcand2(ss,savg0,nts_q65,nagain,ntol,f0_selected,cand,ncand)
nguard=5 !Guard range in bins
i1=1
i2=NFFT-nbw-nguard
- if(nagain.eq.1) then
+ if(nagain.ge.1) then
i1=nint((1000.0*f0_selected-ntol)/df)
i2=nint((1000.0*f0_selected+ntol)/df)
endif
@@ -48,20 +52,65 @@ subroutine getcand2(ss,savg0,nts_q65,nagain,ntol,f0_selected,cand,ncand)
i0=ipk1(1) + i - 1 !Index of local peak in savg()
fpk=0.001*i0*df !Frequency of peak (kHz)
! Check to see if sync tone is present.
- call q65_sync(ss,i0,nts_q65,sync_ok,snr_sync,xdt)
- if(.not.sync_ok) cycle
+ ntrperiod=60
+ iseq=0
+ if(nhsym.ge.200) then
+ call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt)
+ if(sync_ok) then
+! Sync tone is present, we have a candidate for decoding
+ j=j+1
+ cand(j)%f=fpk
+ cand(j)%xdt=xdt
+ cand(j)%snr=snr_sync
+ cand(j)%ntrperiod=ntrperiod
+ cand(j)%iseq=iseq
+ ia=max(1,min(i,i0-nguard))
+ ib=min(i0+nbw+nguard,32768)
+ savg(ia:ib)=0.
+ if(j.ge.MAX_CANDIDATES) exit
+ endif
+ endif
+
+ if(.not.bAlso30) cycle
+ ntrperiod=30
+
+ if(nhsym.le.200 .and. ntx30a.le.5) then
+ call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt)
+ if(sync_ok) then
+! Sync tone is present, we have a candidate for decoding
+ j=j+1
+ cand(j)%f=fpk
+ cand(j)%xdt=xdt
+ cand(j)%snr=snr_sync
+ cand(j)%ntrperiod=ntrperiod
+ cand(j)%iseq=iseq
+ ia=max(1,min(i,i0-nguard))
+ ib=min(i0+nbw+nguard,32768)
+ savg(ia:ib)=0.
+ if(j.ge.MAX_CANDIDATES) exit
+ endif
+ endif
+ iseq=1
+ if(nhsym.ge.330 .and. ntx30b.le.5) then
+ call q65_sync(ss,i0,nts_q65,ntrperiod,iseq,sync_ok,snr_sync,xdt)
+ if(sync_ok) then
! Sync tone is present, we have a candidate for decoding
- j=j+1
- cand(j)%f=fpk
- cand(j)%xdt=xdt
- cand(j)%snr=snr_sync
- ia=max(1,min(i,i0-nguard))
- ib=min(i0+nbw+nguard,32768)
- savg(ia:ib)=0.
- if(j.ge.MAX_CANDIDATES) exit
+ j=j+1
+ cand(j)%f=fpk
+ cand(j)%xdt=xdt
+ cand(j)%snr=snr_sync
+ cand(j)%ntrperiod=ntrperiod
+ cand(j)%iseq=iseq
+ ia=max(1,min(i,i0-nguard))
+ ib=min(i0+nbw+nguard,32768)
+ savg(ia:ib)=0.
+ if(j.ge.MAX_CANDIDATES) exit
+ endif
+ endif
+
enddo
- ncand=j !Total number of candidates found
+ ncand2=j !Total number of candidates found
return
end subroutine getcand2