mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-24 10:22:26 -04:00
Code cleanup.
This commit is contained in:
parent
ceb80ac810
commit
b0e5ff0013
@ -1,7 +1,6 @@
|
|||||||
subroutine getcand2(ss,savg0,nts_q65,cand,ncand)
|
subroutine getcand2(ss,savg0,nts_q65,cand,ncand)
|
||||||
|
|
||||||
use wideband_sync
|
use wideband_sync
|
||||||
! parameter(NFFT=32768)
|
|
||||||
real ss(322,NFFT)
|
real ss(322,NFFT)
|
||||||
real savg0(NFFT),savg(NFFT)
|
real savg0(NFFT),savg(NFFT)
|
||||||
integer ipk1(1)
|
integer ipk1(1)
|
||||||
@ -27,8 +26,6 @@ subroutine getcand2(ss,savg0,nts_q65,cand,ncand)
|
|||||||
nguard=5
|
nguard=5
|
||||||
|
|
||||||
j=0
|
j=0
|
||||||
sync(1:NFFT)%ccfmax=0.
|
|
||||||
|
|
||||||
do i=1,NFFT-nbw-nguard
|
do i=1,NFFT-nbw-nguard
|
||||||
if(savg(i).lt.smin) cycle
|
if(savg(i).lt.smin) cycle
|
||||||
spk=maxval(savg(i:i+nb0))
|
spk=maxval(savg(i:i+nb0))
|
||||||
@ -39,13 +36,9 @@ subroutine getcand2(ss,savg0,nts_q65,cand,ncand)
|
|||||||
call q65_sync(ss,i0,nts_q65,sync_ok,snr_sync,xdt)
|
call q65_sync(ss,i0,nts_q65,sync_ok,snr_sync,xdt)
|
||||||
if(.not.sync_ok) cycle
|
if(.not.sync_ok) cycle
|
||||||
j=j+1
|
j=j+1
|
||||||
! write(73,3073) j,fpk+32.0-2.270,snr_sync,xdt
|
|
||||||
!3073 format(i3,3f10.3)
|
|
||||||
cand(j)%f=fpk
|
cand(j)%f=fpk
|
||||||
cand(j)%xdt=xdt
|
cand(j)%xdt=xdt
|
||||||
cand(j)%snr=snr_sync
|
cand(j)%snr=snr_sync
|
||||||
cand(j)%iflip=0
|
|
||||||
sync(i0)%ccfmax=snr_sync
|
|
||||||
ia=min(i,i0-nguard)
|
ia=min(i,i0-nguard)
|
||||||
ib=i0+nbw+nguard
|
ib=i0+nbw+nguard
|
||||||
savg(ia:ib)=0.
|
savg(ia:ib)=0.
|
||||||
@ -53,10 +46,5 @@ subroutine getcand2(ss,savg0,nts_q65,cand,ncand)
|
|||||||
enddo
|
enddo
|
||||||
ncand=j
|
ncand=j
|
||||||
|
|
||||||
! do i=1,NFFT
|
|
||||||
! write(72,3072) i,0.001*i*df+32.0,savg0(i),savg(i),sync(i)%ccfmax
|
|
||||||
!3072 format(i6,f15.6,3f15.3)
|
|
||||||
! enddo
|
|
||||||
|
|
||||||
return
|
return
|
||||||
end subroutine getcand2
|
end subroutine getcand2
|
||||||
|
@ -15,11 +15,9 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
|
|||||||
parameter (MAXFFT2=336000) !56*6000 (downsampled by 1/16)
|
parameter (MAXFFT2=336000) !56*6000 (downsampled by 1/16)
|
||||||
parameter (NMAX=60*12000)
|
parameter (NMAX=60*12000)
|
||||||
parameter (RAD=57.2957795)
|
parameter (RAD=57.2957795)
|
||||||
! type(hdr) h !Header for the .wav file
|
|
||||||
integer*2 iwave(60*12000)
|
integer*2 iwave(60*12000)
|
||||||
complex ca(MAXFFT1) !FFTs of raw x,y data
|
complex ca(MAXFFT1) !FFTs of raw x,y data
|
||||||
complex cx(0:MAXFFT2-1),cz(0:MAXFFT2)
|
complex cx(0:MAXFFT2-1),cz(0:MAXFFT2)
|
||||||
integer ipk1(1)
|
|
||||||
real*8 fcenter,freq0,freq1
|
real*8 fcenter,freq0,freq1
|
||||||
character*12 mycall0,hiscall0
|
character*12 mycall0,hiscall0
|
||||||
character*12 mycall,hiscall
|
character*12 mycall,hiscall
|
||||||
@ -38,16 +36,7 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
|
|||||||
|
|
||||||
! Find best frequency from sync_dat, the "orange sync curve".
|
! Find best frequency from sync_dat, the "orange sync curve".
|
||||||
df3=96000.0/32768.0
|
df3=96000.0/32768.0
|
||||||
ifreq=nint((1000.0*f0)/df3)
|
ipk=(1000.0*f0-1.0)/df3
|
||||||
ia=nint(ifreq-ntol/df3)
|
|
||||||
ib=nint(ifreq+ntol/df3)
|
|
||||||
ipk1=maxloc(sync(ia:ib)%ccfmax)
|
|
||||||
ipk=ia+ipk1(1)-1
|
|
||||||
! f_ipk=ipk*df3
|
|
||||||
ipk2=(1000.0*f0-1.0)/df3
|
|
||||||
snr1=sync(ipk)%ccfmax
|
|
||||||
ipk=ipk2 !Substitute new ipk value
|
|
||||||
|
|
||||||
nfft1=MAXFFT1
|
nfft1=MAXFFT1
|
||||||
nfft2=MAXFFT2
|
nfft2=MAXFFT2
|
||||||
df=96000.0/NFFT1
|
df=96000.0/NFFT1
|
||||||
@ -62,8 +51,6 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
|
|||||||
if(nagain.eq.1) k0=nint((f_mouse-1000.0)/df)
|
if(nagain.eq.1) k0=nint((f_mouse-1000.0)/df)
|
||||||
|
|
||||||
if(k0.lt.nh .or. k0.gt.MAXFFT1-nfft2+1) go to 900
|
if(k0.lt.nh .or. k0.gt.MAXFFT1-nfft2+1) go to 900
|
||||||
if(snr1.lt.1.5) go to 900 !### Threshold needs work? ###
|
|
||||||
|
|
||||||
fac=1.0/nfft2
|
fac=1.0/nfft2
|
||||||
cx(0:nfft2-1)=ca(k0:k0+nfft2-1)
|
cx(0:nfft2-1)=ca(k0:k0+nfft2-1)
|
||||||
cx=fac*cx
|
cx=fac*cx
|
||||||
@ -111,7 +98,6 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
|
|||||||
nsnr0=-99 !Default snr for no decode
|
nsnr0=-99 !Default snr for no decode
|
||||||
|
|
||||||
! NB: Frequency of ipk is now shifted to 1000 Hz.
|
! NB: Frequency of ipk is now shifted to 1000 Hz.
|
||||||
|
|
||||||
call map65_mmdec(nutc,iwave,nqd,nsubmode,nfa,nfb,1000,ntol, &
|
call map65_mmdec(nutc,iwave,nqd,nsubmode,nfa,nfb,1000,ntol, &
|
||||||
newdat,nagain,max_drift,ndepth,mycall,hiscall,hisgrid)
|
newdat,nagain,max_drift,ndepth,mycall,hiscall,hisgrid)
|
||||||
MHz=fcenter
|
MHz=fcenter
|
||||||
@ -134,11 +120,9 @@ subroutine q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
|
|||||||
write(12,1130) datetime,trim(result(ndecodes)(5:))
|
write(12,1130) datetime,trim(result(ndecodes)(5:))
|
||||||
1130 format(a11,1x,a)
|
1130 format(a11,1x,a)
|
||||||
result(ndecodes)=trim(result(ndecodes))//char(0)
|
result(ndecodes)=trim(result(ndecodes))//char(0)
|
||||||
! print*,'AAA',f_ipk,k0*df,f0,ipk,ipk2,trim(msg0)
|
|
||||||
idec=0
|
idec=0
|
||||||
endif
|
endif
|
||||||
|
|
||||||
900 flush(12)
|
900 flush(12)
|
||||||
|
|
||||||
return
|
return
|
||||||
end subroutine q65b
|
end subroutine q65b
|
||||||
|
@ -26,7 +26,6 @@ subroutine q65wa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, &
|
|||||||
save
|
save
|
||||||
|
|
||||||
if(nagain.eq.1) ndepth=3
|
if(nagain.eq.1) ndepth=3
|
||||||
|
|
||||||
nkhz_center=nint(1000.0*(fcenter-int(fcenter)))
|
nkhz_center=nint(1000.0*(fcenter-int(fcenter)))
|
||||||
mfa=nfa-nkhz_center+48
|
mfa=nfa-nkhz_center+48
|
||||||
mfb=nfb-nkhz_center+48
|
mfb=nfb-nkhz_center+48
|
||||||
@ -34,15 +33,9 @@ subroutine q65wa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, &
|
|||||||
nts_q65=2**(mode_q65-1) !Q65 tone separation factor
|
nts_q65=2**(mode_q65-1) !Q65 tone separation factor
|
||||||
|
|
||||||
call timer('get_cand',0)
|
call timer('get_cand',0)
|
||||||
! call get_candidates(ss,savg,nhsym,mfa,mfb,nts_jt65,nts_q65,cand,ncand)
|
|
||||||
call getcand2(ss,savg,nts_q65,cand,ncand)
|
call getcand2(ss,savg,nts_q65,cand,ncand)
|
||||||
call timer('get_cand',1)
|
call timer('get_cand',1)
|
||||||
|
|
||||||
! do i=1,ncand
|
|
||||||
! write(71,3071) i,cand(i)%f,cand(i)%xdt,cand(i)%snr
|
|
||||||
!3071 format(i2,3f10.3)
|
|
||||||
! enddo
|
|
||||||
|
|
||||||
candec=.false.
|
candec=.false.
|
||||||
nwrite_q65=0
|
nwrite_q65=0
|
||||||
bq65=mode_q65.gt.0
|
bq65=mode_q65.gt.0
|
||||||
@ -61,26 +54,17 @@ subroutine q65wa(dd,ss,savg,newdat,nutc,fcenter,ntol,nfa,nfb, &
|
|||||||
! Do the wideband Q65 decode
|
! Do the wideband Q65 decode
|
||||||
do icand=1,ncand
|
do icand=1,ncand
|
||||||
f0=cand(icand)%f
|
f0=cand(icand)%f
|
||||||
if(cand(icand)%iflip.ne.0) cycle !Do only Q65 candidates here
|
|
||||||
if(candec(icand)) cycle !Skip if already decoded
|
if(candec(icand)) cycle !Skip if already decoded
|
||||||
freq=cand(icand)%f+nkhz_center-48.0-1.27046
|
freq=cand(icand)%f+nkhz_center-48.0-1.27046
|
||||||
ikhz=nint(freq)
|
ikhz=nint(freq)
|
||||||
idec=-1
|
idec=-1
|
||||||
|
|
||||||
! print*,'AAA',icand,nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
|
|
||||||
! mycall,hiscall,hisgrid,mode_q65,f0,fqso,newdat, &
|
|
||||||
! nagain,max_drift,ndop00
|
|
||||||
call timer('q65b ',0)
|
call timer('q65b ',0)
|
||||||
call q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
|
call q65b(nutc,nqd,fcenter,nfcal,nfsample,ikhz,mousedf,ntol, &
|
||||||
mycall,hiscall,hisgrid,mode_q65,f0,fqso,newdat, &
|
mycall,hiscall,hisgrid,mode_q65,f0,fqso,newdat, &
|
||||||
nagain,max_drift,ndepth,datetime,ndop00,idec)
|
nagain,max_drift,ndepth,datetime,ndop00,idec)
|
||||||
call timer('q65b ',1)
|
call timer('q65b ',1)
|
||||||
if(idec.ge.0) candec(icand)=.true.
|
if(idec.ge.0) candec(icand)=.true.
|
||||||
|
|
||||||
! write(71,3071) icand,cand(icand)%f,32.0+cand(icand)%f, &
|
|
||||||
! cand(icand)%xdt,cand(icand)%snr,idec,ndecodes
|
|
||||||
!3071 format(i2,4f10.3,2i5)
|
|
||||||
|
|
||||||
enddo ! icand
|
enddo ! icand
|
||||||
ndecdone=2
|
ndecdone=2
|
||||||
|
|
||||||
|
@ -4,24 +4,11 @@ module wideband_sync
|
|||||||
real :: snr !Relative S/N of sync detection
|
real :: snr !Relative S/N of sync detection
|
||||||
real :: f !Freq of sync tone, 0 to 96000 Hz
|
real :: f !Freq of sync tone, 0 to 96000 Hz
|
||||||
real :: xdt !DT of matching sync pattern, -1.0 to +4.0 s
|
real :: xdt !DT of matching sync pattern, -1.0 to +4.0 s
|
||||||
real :: pol !Polarization angle, degrees
|
|
||||||
integer :: ipol !Polarization angle, 1 to 4 ==> 0, 45, 90, 135 deg
|
|
||||||
integer :: iflip !Sync type: JT65 = +/- 1, Q65 = 0
|
|
||||||
integer :: indx
|
|
||||||
end type candidate
|
end type candidate
|
||||||
type sync_dat
|
|
||||||
real :: ccfmax
|
|
||||||
real :: xdt
|
|
||||||
real :: pol
|
|
||||||
integer :: ipol
|
|
||||||
integer :: iflip
|
|
||||||
logical :: birdie
|
|
||||||
end type sync_dat
|
|
||||||
|
|
||||||
parameter (NFFT=32768)
|
parameter (NFFT=32768)
|
||||||
parameter (MAX_CANDIDATES=50)
|
parameter (MAX_CANDIDATES=50)
|
||||||
parameter (SNR1_THRESHOLD=4.5)
|
parameter (SNR1_THRESHOLD=4.5)
|
||||||
type(sync_dat) :: sync(NFFT)
|
|
||||||
integer nkhz_center
|
integer nkhz_center
|
||||||
|
|
||||||
end module wideband_sync
|
end module wideband_sync
|
||||||
|
Loading…
x
Reference in New Issue
Block a user