mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-24 02:12:37 -04:00
Code cleanup.
This commit is contained in:
parent
05cae7b911
commit
dc6f78d50b
@ -7,11 +7,12 @@ contains
|
|||||||
subroutine sfox_init(mm0,nn0,kk0,itu,fspread,delay)
|
subroutine sfox_init(mm0,nn0,kk0,itu,fspread,delay)
|
||||||
|
|
||||||
character*2 itu
|
character*2 itu
|
||||||
integer isps(23)
|
integer isps(30)
|
||||||
integer iloc(1)
|
integer iloc(1)
|
||||||
data isps/1000,1008,1024,1050,1080,1120,1152,1176,1200,1260, &
|
data isps/1000,1008,1024,1050,1080,1120,1152,1176,1200,1260, &
|
||||||
1280,1296,1344,1350,1372,1400,1440,1470,1500,1512, &
|
1280,1296,1344,1350,1372,1400,1440,1470,1500,1512, &
|
||||||
1536,1568,1600/
|
1536,1568,1600,1620,1680,1728,1920,1944,1960,2000/
|
||||||
|
|
||||||
|
|
||||||
MM=mm0 !Bits per symbol
|
MM=mm0 !Bits per symbol
|
||||||
NQ=2**MM !Q, number of MFSK tones
|
NQ=2**MM !Q, number of MFSK tones
|
||||||
@ -19,18 +20,17 @@ contains
|
|||||||
KK=kk0 !Information symbols, before puncture
|
KK=kk0 !Information symbols, before puncture
|
||||||
ND1=25 !Data symbols before sync
|
ND1=25 !Data symbols before sync
|
||||||
ND2=NN-2-ND1 !Data symbols after sync
|
ND2=NN-2-ND1 !Data symbols after sync
|
||||||
ND=ND1+ND2 !Total data symbols (125)
|
ND=ND1+ND2 !Total data symbols
|
||||||
NFZ=3 !First zero
|
NFZ=3 !First zero
|
||||||
|
|
||||||
tsync=2.0
|
tsync=2.0
|
||||||
jsps=nint((12.6-tsync)*12000.0/ND)
|
jsps=nint((12.6-tsync)*12000.0/ND)
|
||||||
iloc=minloc(abs(isps-jsps))
|
iloc=minloc(abs(isps-jsps))
|
||||||
|
|
||||||
NSPS=isps(iloc(1)) !Samples per symbol
|
NSPS=isps(iloc(1)) !Samples per symbol
|
||||||
NS=nint(tsync*12000.0/NSPS)
|
NS=nint(tsync*12000.0/NSPS)
|
||||||
if(mod(NS,2).eq.1) NS=NS+1
|
if(mod(NS,2).eq.1) NS=NS+1
|
||||||
NSYNC=NS*NSPS !Samples in sync waveform (24,576)
|
NSYNC=NS*NSPS !Samples in sync waveform
|
||||||
NZ=NSPS*(ND+NS) !Samples in full Tx waveform (151,552)
|
NZ=NSPS*(ND+NS) !Samples in full Tx waveform
|
||||||
NFFT=32768 !Length of FFT for sync waveform
|
NFFT=32768 !Length of FFT for sync waveform
|
||||||
NFFT1=2*NSPS !Length of FFTs for symbol spectra
|
NFFT1=2*NSPS !Length of FFTs for symbol spectra
|
||||||
|
|
||||||
|
@ -55,13 +55,16 @@ program sfoxtest
|
|||||||
syncwidth=100.0
|
syncwidth=100.0
|
||||||
baud=12000.0/NSPS
|
baud=12000.0/NSPS
|
||||||
bw=NQ*baud
|
bw=NQ*baud
|
||||||
|
|
||||||
maxerr=(NN-KK)/2
|
maxerr=(NN-KK)/2
|
||||||
write(*,1000) MM,NN,KK,NSPS,baud,bw,itu,fspread,delay,maxerr
|
tsync=NSYNC/12000.0
|
||||||
|
txt=(NN-2+NS)*NSPS/12000.0
|
||||||
|
|
||||||
|
write(*,1000) MM,NN,KK,NSPS,baud,bw,itu,fspread,delay,maxerr, &
|
||||||
|
tsync,txt
|
||||||
1000 format('M:',i2,' Base code: (',i3,',',i3,') NSPS:',i5, &
|
1000 format('M:',i2,' Base code: (',i3,',',i3,') NSPS:',i5, &
|
||||||
' Symbol Rate:',f7.3,' BW:',f6.0/ &
|
' Symbol Rate:',f7.3,' BW:',f6.0/ &
|
||||||
'Channel: ',a2,' fspread:',f5.1,' delay:',f5.1, &
|
'Channel: ',a2,' fspread:',f4.1,' delay:',f5.1, &
|
||||||
' MaxErr:',i3/)
|
' MaxErr:',i3,' tsync:',f4.1,' TxT:',f5.1/)
|
||||||
|
|
||||||
! Allocate storage for arrays that depend on code parameters.
|
! Allocate storage for arrays that depend on code parameters.
|
||||||
allocate(msg0(1:KK))
|
allocate(msg0(1:KK))
|
||||||
@ -102,6 +105,8 @@ program sfoxtest
|
|||||||
ngood=0
|
ngood=0
|
||||||
ntot=0
|
ntot=0
|
||||||
nworst=0
|
nworst=0
|
||||||
|
sqt=0.
|
||||||
|
sqf=0.
|
||||||
|
|
||||||
do ifile=1,nfiles
|
do ifile=1,nfiles
|
||||||
xnoise=0.
|
xnoise=0.
|
||||||
@ -137,8 +142,11 @@ program sfoxtest
|
|||||||
call sync_sf(crcvd,clo,verbose,f,t)
|
call sync_sf(crcvd,clo,verbose,f,t)
|
||||||
ferr=f-f1
|
ferr=f-f1
|
||||||
terr=t-xdt
|
terr=t-xdt
|
||||||
if(abs(ferr).lt.3.0 .and. abs(terr).lt.0.01) ngoodsync=ngoodsync+1
|
if(abs(ferr).lt.3.0 .and. abs(terr).lt.0.01) then
|
||||||
! if(abs(terr).lt.0.01) ngoodsync=ngoodsync+1
|
ngoodsync=ngoodsync+1
|
||||||
|
sqt=sqt + terr*terr
|
||||||
|
sqf=sqf + ferr*ferr
|
||||||
|
endif
|
||||||
|
|
||||||
a=0.
|
a=0.
|
||||||
a(1)=1500.0-f
|
a(1)=1500.0-f
|
||||||
@ -148,8 +156,6 @@ program sfoxtest
|
|||||||
nera=0
|
nera=0
|
||||||
chansym=mod(chansym,nq) !Enforce 0 to nq-1
|
chansym=mod(chansym,nq) !Enforce 0 to nq-1
|
||||||
nharderr=count(chansym.ne.chansym0) !Count hard errors
|
nharderr=count(chansym.ne.chansym0) !Count hard errors
|
||||||
! write(71,3071) f1,f,ferr,xdt,t,terr,nharderr
|
|
||||||
!3071 format(6f10.3,i6)
|
|
||||||
ntot=ntot+nharderr
|
ntot=ntot+nharderr
|
||||||
nworst=max(nworst,nharderr)
|
nworst=max(nworst,nharderr)
|
||||||
call rs_decode_sf(chansym,iera,nera,nfixed) !Call the decoder
|
call rs_decode_sf(chansym,iera,nera,nfixed) !Call the decoder
|
||||||
@ -174,20 +180,24 @@ program sfoxtest
|
|||||||
enddo ! ifile
|
enddo ! ifile
|
||||||
fgoodsync=float(ngoodsync)/nfiles
|
fgoodsync=float(ngoodsync)/nfiles
|
||||||
fgood=float(ngood)/nfiles
|
fgood=float(ngood)/nfiles
|
||||||
|
if(snrdb.eq.0.0) then
|
||||||
if(isnr.eq.0) write(*,1300)
|
if(isnr.eq.0) write(*,1300)
|
||||||
1300 format(' SNR N fsync fgood averr worst'/ &
|
1300 format(' SNR iters fsync fgood averr worst rmsf rmst'/ &
|
||||||
'-----------------------------------------')
|
'-----------------------------------------------------')
|
||||||
ave_harderr=float(ntot)/nfiles
|
ave_harderr=float(ntot)/nfiles
|
||||||
write(*,1310) snr,nfiles,fgoodsync,fgood,ave_harderr,nworst
|
rmst=sqrt(sqt/ngoodsync)
|
||||||
1310 format(f7.2,i6,2f7.2,f7.1,i6)
|
rmsf=sqrt(sqf/ngoodsync)
|
||||||
|
write(*,1310) snr,nfiles,fgoodsync,fgood,ave_harderr,nworst, &
|
||||||
|
rmsf,rmst
|
||||||
|
1310 format(f7.2,i6,2f7.2,f7.1,i6,f7.2,f6.3)
|
||||||
|
|
||||||
if(snrdb.eq.0 .and. fgood.le.0.5 .and. fgood0.gt.0.5) then
|
if(fgood.le.0.5 .and. fgood0.gt.0.5) then
|
||||||
threshold=isnr + 1 - (fgood0-0.50)/(fgood0-fgood+0.000001)
|
threshold=isnr + 1 - (fgood0-0.50)/(fgood0-fgood+0.000001)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
fgood0=fgood
|
fgood0=fgood
|
||||||
|
endif
|
||||||
if(snrdb.ne.0.0) exit
|
if(snrdb.ne.0.0) exit
|
||||||
if(fgood.eq.0.0) exit
|
! if(fgood.eq.0.0) exit
|
||||||
if(fgoodsync.lt.0.5) exit
|
if(fgoodsync.lt.0.5) exit
|
||||||
enddo ! isnr
|
enddo ! isnr
|
||||||
write(*,1320) threshold
|
write(*,1320) threshold
|
||||||
|
Loading…
x
Reference in New Issue
Block a user