WSJT-X/lib/superfox/sfox_demod.f90

41 lines
1.2 KiB
Fortran
Raw Normal View History

subroutine sfox_demod(crcvd,f,t,s3,chansym)
2024-01-31 14:02:33 -05:00
use sfox_mod
2024-01-31 14:02:33 -05:00
complex crcvd(NMAX) !Signal as received
complex c(0:NSPS-1) !Work array, one symbol long
real s(0:NQ-1) !Power spectrum
2024-02-15 08:53:44 -05:00
real s3(0:NQ-1,0:NN-1) !Symbol spectra
integer chansym(NN) !Hard-decision symbol values
2024-01-31 14:02:33 -05:00
integer ipk(1)
i0=nint(12000.0*t)
df=12000.0/NSPS
j0=nint(f/df)-NQ/2
2024-02-15 08:53:44 -05:00
do n=1,NN !Loop over all symbols
2024-01-31 14:02:33 -05:00
ib=n*NSPS + i0
if(n.gt.ND1) ib=(NS+n)*NSPS + i0
ia=ib-NSPS+1
chansym(n)=0
2024-01-31 18:59:41 -05:00
if(ia.lt.1 .or. ib.gt.NMAX) cycle
2024-01-31 14:02:33 -05:00
c=crcvd(ia:ib)
call four2a(c,NSPS,1,-1,1) !Compute symbol spectrum
do j=0,NQ-1
s(j)=real(c(j0+j))**2 + aimag(c(j0+j))**2
s3(j,n-1)=s(j)
2024-01-31 14:02:33 -05:00
enddo
2024-02-10 09:29:57 -05:00
! Could we measure fspread, perhaps in the sync routine, and use that to
! decide whether to smooth spectra here?
2024-02-21 09:23:45 -05:00
! call smo121(s,NQ) !Helps for LD, HM propagation...
! call smo121(s,NQ)
2024-02-10 09:29:57 -05:00
ipk=maxloc(s(0:NQ-1))
chansym(n)=ipk(1) - 1
2024-01-31 14:02:33 -05:00
enddo
call pctile(s3,NQ*NN,50,base)
s3=s3/base
2024-01-31 14:02:33 -05:00
return
end subroutine sfox_demod