2024-02-13 12:02:04 -05:00
|
|
|
subroutine sfox_demod(crcvd,f,t,s3,chansym)
|
2024-01-31 14:02:33 -05:00
|
|
|
|
2024-02-08 10:45:43 -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
|
2024-02-10 13:35:06 -05:00
|
|
|
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
|
2024-02-13 12:02:04 -05:00
|
|
|
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
|
2024-02-10 13:35:06 -05:00
|
|
|
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
|
2024-02-13 14:56:20 -05:00
|
|
|
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
|
2024-02-10 13:35:06 -05:00
|
|
|
do j=0,NQ-1
|
|
|
|
s(j)=real(c(j0+j))**2 + aimag(c(j0+j))**2
|
2024-02-13 12:02:04 -05:00
|
|
|
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
|
|
|
|
2024-02-10 13:35:06 -05:00
|
|
|
ipk=maxloc(s(0:NQ-1))
|
|
|
|
chansym(n)=ipk(1) - 1
|
2024-01-31 14:02:33 -05:00
|
|
|
enddo
|
|
|
|
|
2024-02-15 15:46:09 -05:00
|
|
|
call pctile(s3,NQ*NN,50,base)
|
|
|
|
s3=s3/base
|
|
|
|
|
2024-01-31 14:02:33 -05:00
|
|
|
return
|
2024-02-13 12:02:04 -05:00
|
|
|
end subroutine sfox_demod
|