Running now with Q65-type sync and full decoding.

This commit is contained in:
Joe Taylor 2024-02-26 17:04:04 -05:00
parent f263a70dd3
commit 376f0d1e53
3 changed files with 22 additions and 35 deletions

View File

@ -1,36 +1,29 @@
subroutine sfox_demod(crcvd,f,t,s3,chansym)
subroutine sfox_demod(crcvd,f,t,isync,s3)
use sfox_mod
complex crcvd(NMAX) !Signal as received
complex c(0:NSPS-1) !Work array, one symbol long
real s(0:NQ-1) !Power spectrum
real s3(0:NQ-1,0:NN-1) !Symbol spectra
integer chansym(NN) !Hard-decision symbol values
integer ipk(1)
real s3(0:NQ-1,0:NN-1) !Synchronized symbol spectra
integer isync(44)
! integer ipk(1)
i0=nint(12000.0*t)
j0=nint(12000.0*(t+0.5))
df=12000.0/NSPS
j0=nint(f/df)-NQ/2
do n=1,NN !Loop over all symbols
ib=n*NSPS + i0
if(n.gt.ND1) ib=(NS+n)*NSPS + i0
ia=ib-NSPS+1
chansym(n)=0
if(ia.lt.1 .or. ib.gt.NMAX) cycle
c=crcvd(ia:ib)
i0=nint(f/df)-NQ/2
k=-1
do n=1,NDS !Loop over all symbols
if(any(isync(1:NS).eq.n)) cycle
jb=n*NSPS + j0
ja=jb-NSPS+1
if(ja.lt.1 .or. jb.gt.NMAX) cycle
k=k+1
c=crcvd(ja:jb)
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)
do i=0,NQ-1
s3(i,k)=real(c(i0+i))**2 + aimag(c(i0+i))**2
enddo
! Could we measure fspread, perhaps in the sync routine, and use that to
! decide whether to smooth spectra here?
! call smo121(s,NQ) !Helps for LD, HM propagation...
! call smo121(s,NQ)
ipk=maxloc(s(0:NQ-1))
chansym(n)=ipk(1) - 1
! ipk=maxloc(s3(0:NQ-1,k))
! if(k.lt.10) print*,'AAA',k,ipk(1)-1
enddo
call pctile(s3,NQ*NN,50,base)

View File

@ -213,8 +213,6 @@ program sfoxtest
endif
ferr=f-f1
terr=t-xdt
! write(*,4100) f1,f,ferr,xdt,t,terr
!4100 format(3f10.1,3f10.3)
igoodsync=0
if(abs(ferr).lt.baud/2.0 .and. abs(terr).lt.tsym/4.0) then
@ -225,13 +223,13 @@ program sfoxtest
endif
a=0.
a(1)=1500.0-f
a(1)=1500.0-f - baud
call timer('twkfreq ',0)
call twkfreq(crcvd,crcvd,NMAX,fsample,a)
call timer('twkfreq ',1)
f=1500.0
call timer('demod ',0)
call sfox_demod(crcvd,f,t,s3,chansym) !Get s3 and hard symbol values
call sfox_demod(crcvd,f,t,isync,s3) !Get s3(0:NQ-1,0:127)
call timer('demod ',1)
call timer('prob ',0)
@ -240,7 +238,7 @@ program sfoxtest
nera=0
chansym=mod(chansym,nq) !Enforce 0 to nq-1
nharderr=count(chansym.ne.chansym0) !Count hard errors
nharderr=count(rxdat.ne.chansym0) !Count hard errors
ntot=ntot+nharderr
nworst=max(nworst,nharderr)

View File

@ -50,10 +50,6 @@ subroutine sym_prob(s3,rxdat,rxprob,rxdat2,rxprob2)
rxprob(j)=scale*p1 !Scaled probabilities, 0 - 255
rxprob2(j)=scale*p2
enddo
! Once, ntest.lt.50 or nlow.gt.20 were used to flag bad data:
ntest=sum(rxprob)
nlow=count(rxprob.le.5)
return
end subroutine sym_prob