mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-29 12:52:28 -04:00
Code cleanup.
This commit is contained in:
parent
aff22a904d
commit
668631180d
@ -197,9 +197,8 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
|
|||||||
if(params%nmode.eq.66) then
|
if(params%nmode.eq.66) then
|
||||||
! We're in QRA66 mode
|
! We're in QRA66 mode
|
||||||
call timer('decqra66',0)
|
call timer('decqra66',0)
|
||||||
call my_qra66%decode(qra66_decoded,id2,params%nutc,params%nfa, &
|
call my_qra66%decode(qra66_decoded,id2,params%nutc,params%nfqso, &
|
||||||
params%nfb,params%nfqso,params%ndepth,logical(params%lapcqonly), &
|
params%ntol,params%ndepth,mycall,hiscall,hisgrid)
|
||||||
mycall,hiscall,hisgrid)
|
|
||||||
call timer('decqra66',1)
|
call timer('decqra66',1)
|
||||||
go to 800
|
go to 800
|
||||||
endif
|
endif
|
||||||
|
@ -28,7 +28,7 @@ module qra66_decode
|
|||||||
|
|
||||||
contains
|
contains
|
||||||
|
|
||||||
subroutine decode(this,callback,iwave,nutc,nfa,nfb,nfqso,ndepth,lapdx, &
|
subroutine decode(this,callback,iwave,nutc,nfqso,ntol,ndepth, &
|
||||||
mycall,hiscall,hisgrid)
|
mycall,hiscall,hisgrid)
|
||||||
|
|
||||||
use timer_module, only: timer
|
use timer_module, only: timer
|
||||||
@ -41,12 +41,9 @@ contains
|
|||||||
character(len=6) :: hisgrid
|
character(len=6) :: hisgrid
|
||||||
character*37 decoded
|
character*37 decoded
|
||||||
integer*2 iwave(NFFT1) !Raw data
|
integer*2 iwave(NFFT1) !Raw data
|
||||||
integer ipk(1)
|
|
||||||
integer dat4(12)
|
integer dat4(12)
|
||||||
logical lapdx,ltext
|
logical lapdx,ltext
|
||||||
complex c00(0:NFFT1-1) !Spectrum, then analytic signal
|
complex c0(0:NFFT1-1) !Analytic signal, 6000 S/s
|
||||||
complex c0(0:NFFT1-1) !Snalytic signal
|
|
||||||
real s(900)
|
|
||||||
real s3(-64:127,63)
|
real s3(-64:127,63)
|
||||||
real a(5)
|
real a(5)
|
||||||
data nc1z/-1/,nc2z/-1/,ng2z/-1/,maxaptypez/-1/
|
data nc1z/-1/,nc2z/-1/,ng2z/-1/,maxaptypez/-1/
|
||||||
@ -67,12 +64,11 @@ contains
|
|||||||
b90=20.0 !8 to 25 is OK; not very critical
|
b90=20.0 !8 to 25 is OK; not very critical
|
||||||
nFadingModel=1
|
nFadingModel=1
|
||||||
|
|
||||||
! These probably need work:
|
! AP control could be done differently, but this works well:
|
||||||
maxaptype=0
|
maxaptype=0
|
||||||
if(ndepth.eq.2) maxaptype=3
|
if(ndepth.eq.2) maxaptype=3
|
||||||
if(ndepth.eq.3) maxaptype=5
|
if(ndepth.eq.3) maxaptype=5
|
||||||
|
|
||||||
! Prime the decoder for possible AP decoding
|
|
||||||
if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z .or. &
|
if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z .or. &
|
||||||
maxaptype.ne.maxaptypez) then
|
maxaptype.ne.maxaptypez) then
|
||||||
do naptype=0,maxaptype
|
do naptype=0,maxaptype
|
||||||
@ -87,60 +83,39 @@ contains
|
|||||||
endif
|
endif
|
||||||
naptype=maxaptype
|
naptype=maxaptype
|
||||||
|
|
||||||
! Compute the full-length spectrum
|
! Downsample to give complex data at 6000 S/s
|
||||||
fac=2.0/NFFT1
|
fac=2.0/NFFT1
|
||||||
c0=fac*iwave
|
c0=fac*iwave
|
||||||
call four2a(c0,NFFT1,1,-1,1) !Forward c2c FFT
|
call four2a(c0,NFFT1,1,-1,1) !Forward c2c FFT
|
||||||
|
|
||||||
nadd=101
|
|
||||||
nh=nadd/2
|
|
||||||
df2=nh*df1
|
|
||||||
iz=3000.0/df2
|
|
||||||
do i=1,iz !Compute smoothed spectrum
|
|
||||||
s(i)=0.
|
|
||||||
j0=nh*i
|
|
||||||
do j=j0-nh,j0+nh
|
|
||||||
s(i)=s(i) + real(c0(j))**2 + aimag(c0(j))**2
|
|
||||||
enddo
|
|
||||||
enddo
|
|
||||||
call smo121(s,iz)
|
|
||||||
ia=1450/df2
|
|
||||||
ib=1550/df2
|
|
||||||
s(:ia)=0.
|
|
||||||
s(ib:)=0.
|
|
||||||
ipk=maxloc(s)
|
|
||||||
f0=df2*ipk(1) - 0.5*baud !Candidate sync frequency
|
|
||||||
|
|
||||||
c0(NFFT2/2+1:NFFT2)=0. !Zero the top half
|
c0(NFFT2/2+1:NFFT2)=0. !Zero the top half
|
||||||
c0(0)=0.5*c0(0)
|
c0(0)=0.5*c0(0)
|
||||||
call four2a(c0,nfft2,1,1,1) !Inverse c2c FFT
|
call four2a(c0,nfft2,1,1,1) !Inverse c2c FFT
|
||||||
|
|
||||||
ntol=100
|
ntol=100
|
||||||
call sync66a(iwave,15*12000,nsps,nfqso,ntol,xdt,f0,snr1)
|
call sync66a(iwave,15*12000,nsps,nfqso,ntol,xdt,f0,snr1)
|
||||||
jpk=(xdt+0.5)*6000 - 384 !### Empirical ###
|
jpk=(xdt+0.5)*6000 - 384 !### Empirical ###
|
||||||
if(jpk.lt.0) jpk=0
|
if(jpk.lt.0) jpk=0
|
||||||
c00=c0
|
|
||||||
a=0.
|
a=0.
|
||||||
a(1)=-(f0 + 2.0*baud) !For sync66a
|
a(1)=-(f0 + 2.0*baud) !Data tones start 2 bins higher
|
||||||
call twkfreq(c00,c0,15*6000,6000.0,a)
|
call twkfreq(c0,c0,15*6000,6000.0,a)
|
||||||
xdt=jpk/6000.0 - 0.5
|
xdt=jpk/6000.0 - 0.5
|
||||||
call spec66(c0(jpk:jpk+85*NSPS/2-1),s3)
|
call spec66(c0(jpk:jpk+85*NSPS/2-1),s3)
|
||||||
|
|
||||||
do j=1,63
|
do j=1,63 !Normalize to symbol baseline
|
||||||
call pctile(s3(:,j),192,40,base)
|
call pctile(s3(:,j),192,40,base)
|
||||||
s3(:,j)=s3(:,j)/base
|
s3(:,j)=s3(:,j)/base
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
! Apply AGC
|
|
||||||
s3max=20.0
|
s3max=20.0
|
||||||
do j=1,63
|
do j=1,63 !Apply AGC to suppress pings
|
||||||
xx=maxval(s3(-64:127,j))
|
xx=maxval(s3(-64:127,j))
|
||||||
if(xx.gt.s3max) s3(-64:127,j)=s3(-64:127,j)*s3max/xx
|
if(xx.gt.s3max) s3(-64:127,j)=s3(-64:127,j)*s3max/xx
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
|
!Call Nico's QRA64 decoder
|
||||||
call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90, &
|
call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90, &
|
||||||
nFadingModel,dat4,snr2,irc)
|
nFadingModel,dat4,snr2,irc)
|
||||||
snr2=snr2 + 6.0
|
snr2=snr2 + 5.563 !10*log(6912/1920)
|
||||||
if(irc.gt.0) call badmsg(irc,dat4,nc1,nc2,ng2)
|
if(irc.gt.0) call badmsg(irc,dat4,nc1,nc2,ng2)
|
||||||
|
|
||||||
decoded=' '
|
decoded=' '
|
||||||
|
Loading…
x
Reference in New Issue
Block a user