Corrected known flaws in audio waveform generated by JTMS3.

Working on JTMS3 decoder.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/jtms3@2503 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2012-07-10 13:43:16 +00:00
parent cb0093239d
commit 1aa080460e
8 changed files with 510 additions and 46 deletions

View File

@ -17,7 +17,7 @@ CFLAGS = -I. -fbounds-check
%.o: %.F90
${FC} ${FFLAGS} -c $<
all: libm65.a ms3.exe
all: libm65.a ms3.exe JTMScode.exe
OBJS1 = trimlist.o display.o getdphi.o pctile.o ccf65.o \
decode1a.o sort.o filbig.o fil6521.o afc65b.o \
@ -33,18 +33,17 @@ OBJS1 = trimlist.o display.o getdphi.o pctile.o ccf65.o \
gen65.o chkmsg.o ptt.o astrosub.o astro0.o recvpkt.o symspec.o \
iqcal.o iqfix.o timf2.o s3avg.o genjtms3.o \
entail.o encode232.o scr258.o analytic.o db.o
libm65.a: $(OBJS1)
ar cr libm65.a $(OBJS1)
ranlib libm65.a
OBJS3 = ms3.o
OBJS3 = ms3.o specjtms.o
ms3.exe: $(OBJS3) libm65.a
$(FC) -o ms3.exe $(OBJS3) libm65.a ../libfftw3f_win.a \
$(FC) -o ms3.exe $(OBJS3) libm65.a ../libfftw3f_win.a
OBJS2 = JT65code.o
JT65code.exe: $(OBJS2) libm65.a
$(FC) -o JT65code.exe $(OBJS2) libm65.a
OBJS2 = JTMScode.o genjtms3a.o fano232.o
JTMScode.exe: $(OBJS2) libm65.a
$(FC) -o JTMScode.exe $(OBJS2) libm65.a ../libfftw3f_win.a
INCPATH = -I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include/QtCore' \
-I'c:/QtSDK/Desktop/Qt/4.7.4/mingw/include' \

View File

@ -1,25 +0,0 @@
subroutine analytic(d,npts,nfft,s,c)
! Convert real data to analytic signal
parameter (NMAX=512*1024)
real d(npts)
real s(NMAX)
complex c(NMAX)
nh=nfft/2
fac=2.0/nfft
c(1:npts)=fac*d(1:npts)
c(npts+1:nfft)=0.
call four2a(c,nfft,1,-1,1) !Forward c2c FFT
do i=1,nh
s(i)=real(c(i))**2 + aimag(c(i))**2
enddo
c(1)=0.5*c(1)
c(nh+2:nfft)=0.
call four2a(c,nfft,1,1,1) !Inverse c2c FFT
return
end subroutine analytic

256
libm65/bpskmetrics.dat Normal file
View File

@ -0,0 +1,256 @@
-12.8 1.000 -9.966 1.000000 0.000000
-12.7 1.000 -9.966 1.000000 0.000000
-12.6 1.000 -9.966 1.000000 0.000000
-12.5 1.000 -9.966 1.000000 0.000000
-12.4 1.000 -9.966 1.000000 0.000000
-12.3 1.000 -9.966 1.000000 0.000000
-12.2 1.000 -9.966 1.000000 0.000000
-12.1 1.000 -9.966 1.000000 0.000000
-12.0 1.000 -9.966 1.000000 0.000000
-11.9 1.000 -9.966 1.000000 0.000000
-11.8 1.000 -9.966 1.000000 0.000000
-11.7 1.000 -9.966 1.000000 0.000000
-11.6 1.000 -9.966 1.000000 0.000000
-11.5 1.000 -9.966 1.000000 0.000000
-11.4 1.000 -9.966 1.000000 0.000000
-11.3 1.000 -9.966 1.000000 0.000000
-11.2 1.000 -9.966 1.000000 0.000000
-11.1 1.000 -9.966 1.000000 0.000000
-11.0 1.000 -9.966 1.000000 0.000000
-10.9 1.000 -9.966 1.000000 0.000000
-10.8 1.000 -9.966 1.000000 0.000000
-10.7 1.000 -9.966 1.000000 0.000000
-10.6 1.000 -9.966 1.000000 0.000000
-10.5 1.000 -9.966 1.000000 0.000000
-10.4 1.000 -9.966 1.000000 0.000000
-10.3 1.000 -9.966 1.000000 0.000000
-10.2 1.000 -9.966 1.000000 0.000000
-10.1 1.000 -9.966 1.000000 0.000000
-10.0 1.000 -9.966 1.000000 0.000000
-9.9 1.000 -9.966 1.000000 0.000000
-9.8 1.000 -9.966 1.000000 0.000000
-9.7 1.000 -9.966 1.000000 0.000000
-9.6 1.000 -9.966 1.000000 0.000000
-9.5 1.000 -9.966 1.000000 0.000000
-9.4 1.000 -9.966 1.000000 0.000000
-9.3 1.000 -9.966 1.000000 0.000000
-9.2 1.000 -9.966 1.000000 0.000000
-9.1 1.000 -9.966 1.000000 0.000000
-9.0 1.000 -9.966 1.000000 0.000000
-8.9 1.000 -9.966 1.000000 0.000000
-8.8 1.000 -9.966 1.000000 0.000000
-8.7 1.000 -9.966 1.000000 0.000000
-8.6 1.000 -9.966 1.000000 0.000000
-8.5 1.000 -9.966 1.000000 0.000000
-8.4 1.000 -9.966 1.000000 0.000000
-8.3 1.000 -9.966 1.000000 0.000000
-8.2 1.000 -9.966 1.000000 0.000000
-8.1 1.000 -9.966 1.000000 0.000000
-8.0 1.000 -9.966 1.000000 0.000000
-7.9 1.000 -9.966 1.000000 0.000000
-7.8 1.000 -9.966 1.000000 0.000000
-7.7 1.000 -9.966 1.000000 0.000000
-7.6 1.000 -9.966 1.000000 0.000000
-7.5 1.000 -9.966 1.000000 0.000000
-7.4 1.000 -9.966 1.000000 0.000000
-7.3 1.000 -9.966 1.000000 0.000000
-7.2 1.000 -9.966 1.000000 0.000000
-7.1 1.000 -9.966 1.000000 0.000000
-7.0 1.000 -9.966 1.000000 0.000000
-6.9 1.000 -9.966 1.000000 0.000000
-6.8 1.000 -9.966 1.000000 0.000000
-6.7 1.000 -9.966 1.000000 0.000000
-6.6 1.000 -9.966 1.000000 0.000000
-6.5 1.000 -9.966 1.000000 0.000000
-6.4 1.000 -9.966 1.000000 0.000000
-6.3 1.000 -9.966 1.000000 0.000000
-6.2 1.000 -9.966 1.000000 0.000000
-6.1 1.000 -9.966 1.000000 0.000000
-6.0 1.000 -9.966 1.000000 0.000000
-5.9 1.000 -9.966 1.000000 0.000000
-5.8 1.000 -9.966 1.000000 0.000000
-5.7 1.000 -9.966 1.000000 0.000000
-5.6 1.000 -9.966 1.000000 0.000000
-5.5 1.000 -9.966 1.000000 0.000000
-5.4 1.000 -9.966 1.000000 0.000000
-5.3 1.000 -9.966 1.000000 0.000000
-5.2 1.000 -9.966 1.000000 0.000000
-5.1 1.000 -9.966 1.000000 0.000000
-5.0 1.000 -9.966 1.000000 0.000000
-4.9 1.000 -9.966 1.000000 0.000000
-4.8 1.000 -9.966 1.000000 0.000000
-4.7 1.000 -9.966 1.000000 0.000000
-4.6 1.000 -9.966 1.000000 0.000000
-4.5 1.000 -9.966 1.000000 0.000000
-4.4 1.000 -9.966 1.000000 0.000000
-4.3 1.000 -9.966 1.000000 0.000000
-4.2 1.000 -9.966 1.000000 0.000000
-4.1 1.000 -9.966 1.000000 0.000000
-4.0 1.000 -9.966 1.000000 0.000000
-3.9 1.000 -9.966 1.000000 0.000000
-3.8 1.000 -9.966 1.000000 0.000000
-3.7 1.000 -9.966 1.000000 0.000000
-3.6 1.000 -9.966 1.000000 0.000000
-3.5 1.000 -9.966 1.000000 0.000000
-3.4 1.000 -9.966 1.000000 0.000000
-3.3 1.000 -9.966 1.000000 0.000000
-3.2 1.000 -9.966 1.000000 0.000000
-3.1 1.000 -9.966 1.000000 0.000000
-3.0 1.000 -9.966 1.000000 0.000000
-2.9 1.000 -9.966 1.000000 0.000000
-2.8 1.000 -9.966 0.999955 0.000045
-2.7 1.000 -9.966 0.999968 0.000032
-2.6 1.000 -9.966 0.999909 0.000091
-2.5 1.000 -9.966 0.999983 0.000017
-2.4 1.000 -9.966 0.999937 0.000063
-2.3 1.000 -9.966 0.999914 0.000086
-2.2 1.000 -9.966 0.999813 0.000187
-2.1 1.000 -9.966 0.999775 0.000225
-2.0 1.000 -9.966 0.999671 0.000329
-1.9 0.999 -9.966 0.999531 0.000469
-1.8 0.999 -9.308 0.999211 0.000789
-1.7 0.998 -8.893 0.998948 0.001052
-1.6 0.998 -8.191 0.998290 0.001710
-1.5 0.996 -7.655 0.997519 0.002481
-1.4 0.994 -7.037 0.996192 0.003808
-1.3 0.992 -6.513 0.994525 0.005475
-1.2 0.988 -5.931 0.991804 0.008196
-1.1 0.982 -5.359 0.987816 0.012184
-1.0 0.974 -4.789 0.981916 0.018084
-0.9 0.961 -4.217 0.973110 0.026890
-0.8 0.942 -3.672 0.960785 0.039215
-0.7 0.915 -3.123 0.942613 0.057387
-0.6 0.874 -2.582 0.916477 0.083523
-0.5 0.816 -2.062 0.880296 0.119704
-0.4 0.734 -1.573 0.831905 0.168095
-0.3 0.619 -1.109 0.768168 0.231832
-0.2 0.465 -0.690 0.690103 0.309897
-0.1 0.260 -0.317 0.598759 0.401241
0.0 0.000 0.000 0.500000 0.500000
0.1 -0.317 0.260 0.401241 0.598759
0.2 -0.690 0.465 0.309897 0.690103
0.3 -1.109 0.619 0.231832 0.768168
0.4 -1.573 0.734 0.168095 0.831905
0.5 -2.062 0.816 0.119704 0.880296
0.6 -2.582 0.874 0.083523 0.916477
0.7 -3.123 0.915 0.057387 0.942613
0.8 -3.672 0.942 0.039215 0.960785
0.9 -4.217 0.961 0.026890 0.973110
1.0 -4.789 0.974 0.018084 0.981916
1.1 -5.359 0.982 0.012184 0.987816
1.2 -5.931 0.988 0.008196 0.991804
1.3 -6.513 0.992 0.005475 0.994525
1.4 -7.037 0.994 0.003808 0.996192
1.5 -7.655 0.996 0.002481 0.997519
1.6 -8.191 0.998 0.001710 0.998290
1.7 -8.893 0.998 0.001052 0.998948
1.8 -9.308 0.999 0.000789 0.999211
1.9 -9.966 0.999 0.000469 0.999531
2.0 -9.966 1.000 0.000329 0.999671
2.1 -9.966 1.000 0.000225 0.999775
2.2 -9.966 1.000 0.000187 0.999813
2.3 -9.966 1.000 0.000086 0.999914
2.4 -9.966 1.000 0.000063 0.999937
2.5 -9.966 1.000 0.000017 0.999983
2.6 -9.966 1.000 0.000091 0.999909
2.7 -9.966 1.000 0.000032 0.999968
2.8 -9.966 1.000 0.000045 0.999955
2.9 -9.966 1.000 0.000000 1.000000
3.0 -9.966 1.000 0.000000 1.000000
3.1 -9.966 1.000 0.000000 1.000000
3.2 -9.966 1.000 0.000000 1.000000
3.3 -9.966 1.000 0.000000 1.000000
3.4 -9.966 1.000 0.000000 1.000000
3.5 -9.966 1.000 0.000000 1.000000
3.6 -9.966 1.000 0.000000 1.000000
3.7 -9.966 1.000 0.000000 1.000000
3.8 -9.966 1.000 0.000000 1.000000
3.9 -9.966 1.000 0.000000 1.000000
4.0 -9.966 1.000 0.000000 1.000000
4.1 -9.966 1.000 0.000000 1.000000
4.2 -9.966 1.000 0.000000 1.000000
4.3 -9.966 1.000 0.000000 1.000000
4.4 -9.966 1.000 0.000000 1.000000
4.5 -9.966 1.000 0.000000 1.000000
4.6 -9.966 1.000 0.000000 1.000000
4.7 -9.966 1.000 0.000000 1.000000
4.8 -9.966 1.000 0.000000 1.000000
4.9 -9.966 1.000 0.000000 1.000000
5.0 -9.966 1.000 0.000000 1.000000
5.1 -9.966 1.000 0.000000 1.000000
5.2 -9.966 1.000 0.000000 1.000000
5.3 -9.966 1.000 0.000000 1.000000
5.4 -9.966 1.000 0.000000 1.000000
5.5 -9.966 1.000 0.000000 1.000000
5.6 -9.966 1.000 0.000000 1.000000
5.7 -9.966 1.000 0.000000 1.000000
5.8 -9.966 1.000 0.000000 1.000000
5.9 -9.966 1.000 0.000000 1.000000
6.0 -9.966 1.000 0.000000 1.000000
6.1 -9.966 1.000 0.000000 1.000000
6.2 -9.966 1.000 0.000000 1.000000
6.3 -9.966 1.000 0.000000 1.000000
6.4 -9.966 1.000 0.000000 1.000000
6.5 -9.966 1.000 0.000000 1.000000
6.6 -9.966 1.000 0.000000 1.000000
6.7 -9.966 1.000 0.000000 1.000000
6.8 -9.966 1.000 0.000000 1.000000
6.9 -9.966 1.000 0.000000 1.000000
7.0 -9.966 1.000 0.000000 1.000000
7.1 -9.966 1.000 0.000000 1.000000
7.2 -9.966 1.000 0.000000 1.000000
7.3 -9.966 1.000 0.000000 1.000000
7.4 -9.966 1.000 0.000000 1.000000
7.5 -9.966 1.000 0.000000 1.000000
7.6 -9.966 1.000 0.000000 1.000000
7.7 -9.966 1.000 0.000000 1.000000
7.8 -9.966 1.000 0.000000 1.000000
7.9 -9.966 1.000 0.000000 1.000000
8.0 -9.966 1.000 0.000000 1.000000
8.1 -9.966 1.000 0.000000 1.000000
8.2 -9.966 1.000 0.000000 1.000000
8.3 -9.966 1.000 0.000000 1.000000
8.4 -9.966 1.000 0.000000 1.000000
8.5 -9.966 1.000 0.000000 1.000000
8.6 -9.966 1.000 0.000000 1.000000
8.7 -9.966 1.000 0.000000 1.000000
8.8 -9.966 1.000 0.000000 1.000000
8.9 -9.966 1.000 0.000000 1.000000
9.0 -9.966 1.000 0.000000 1.000000
9.1 -9.966 1.000 0.000000 1.000000
9.2 -9.966 1.000 0.000000 1.000000
9.3 -9.966 1.000 0.000000 1.000000
9.4 -9.966 1.000 0.000000 1.000000
9.5 -9.966 1.000 0.000000 1.000000
9.6 -9.966 1.000 0.000000 1.000000
9.7 -9.966 1.000 0.000000 1.000000
9.8 -9.966 1.000 0.000000 1.000000
9.9 -9.966 1.000 0.000000 1.000000
10.0 -9.966 1.000 0.000000 1.000000
10.1 -9.966 1.000 0.000000 1.000000
10.2 -9.966 1.000 0.000000 1.000000
10.3 -9.966 1.000 0.000000 1.000000
10.4 -9.966 1.000 0.000000 1.000000
10.5 -9.966 1.000 0.000000 1.000000
10.6 -9.966 1.000 0.000000 1.000000
10.7 -9.966 1.000 0.000000 1.000000
10.8 -9.966 1.000 0.000000 1.000000
10.9 -9.966 1.000 0.000000 1.000000
11.0 -9.966 1.000 0.000000 1.000000
11.1 -9.966 1.000 0.000000 1.000000
11.2 -9.966 1.000 0.000000 1.000000
11.3 -9.966 1.000 0.000000 1.000000
11.4 -9.966 1.000 0.000000 1.000000
11.5 -9.966 1.000 0.000000 1.000000
11.6 -9.966 1.000 0.000000 1.000000
11.7 -9.966 1.000 0.000000 1.000000
11.8 -9.966 1.000 0.000000 1.000000
11.9 -9.966 1.000 0.000000 1.000000
12.0 -9.966 1.000 0.000000 1.000000
12.1 -9.966 1.000 0.000000 1.000000
12.2 -9.966 1.000 0.000000 1.000000
12.3 -9.966 1.000 0.000000 1.000000
12.4 -9.966 1.000 0.000000 1.000000
12.5 -9.966 1.000 0.000000 1.000000
12.6 -9.966 1.000 0.000000 1.000000
12.7 -9.966 1.000 0.000000 1.000000

View File

@ -1,5 +0,0 @@
real function db(x)
db=-99.0
if(x.gt.1.259e-10) db=10.0*log10(x)
return
end function db

164
libm65/fano232.f90 Normal file
View File

@ -0,0 +1,164 @@
subroutine fano232(symbol,nbits,mettab,ndelta,maxcycles,dat, &
ncycles,metric,ierr,maxmetric,maxnp)
! Sequential decoder for K=32, r=1/2 convolutional code using
! the Fano algorithm. Translated from C routine for same purpose
! written by Phil Karn, KA9Q.
parameter (MAXBITS=103)
parameter (MAXDAT=(MAXBITS+7)/8)
integer*1 symbol(0:2*MAXBITS-1)
integer*1 dat(MAXDAT) !Decoded user data, 8 bits per byte
integer mettab(0:255,0:1) !Metric table
! These were the "node" structure in Karn's C code:
integer nstate(0:MAXBITS-1) !Encoder state of next node
integer gamma(0:MAXBITS-1) !Cumulative metric to this node
integer metrics(0:3,0:MAXBITS-1) !Metrics indexed by all possible Tx syms
integer tm(0:1,0:MAXBITS-1) !Sorted metrics for current hypotheses
integer ii(0:MAXBITS-1) !Current branch being tested
logical noback
include 'conv232.f90'
maxmetric=-9999999
maxnp=-9999999
ntail=nbits-31
! Compute all possible branch metrics for each symbol pair.
! This is the only place we actually look at the raw input symbols
i4a=0
i4b=0
do np=0,nbits-1
j=2*np
i4a=symbol(j)
i4b=symbol(j+1)
if (i4a.lt.0) i4a=i4a+256
if (i4b.lt.0) i4b=i4b+256
metrics(0,np) = mettab(i4a,0) + mettab(i4b,0)
metrics(1,np) = mettab(i4a,0) + mettab(i4b,1)
metrics(2,np) = mettab(i4a,1) + mettab(i4b,0)
metrics(3,np) = mettab(i4a,1) + mettab(i4b,1)
enddo
np=0
nstate(np)=0
! Compute and sort branch metrics from the root node
n=iand(nstate(np),npoly1)
n=ieor(n,ishft(n,-16))
lsym=partab(iand(ieor(n,ishft(n,-8)),255))
n=iand(nstate(np),npoly2)
n=ieor(n,ishft(n,-16))
lsym=lsym+lsym+partab(iand(ieor(n,ishft(n,-8)),255))
m0=metrics(lsym,np)
m1=metrics(ieor(3,lsym),np)
if(m0.gt.m1) then
tm(0,np)=m0 !0-branch has better metric
tm(1,np)=m1
else
tm(0,np)=m1 !1-branch is better
tm(1,np)=m0
nstate(np)=nstate(np) + 1 !Set low bit
endif
! Start with best branch
ii(np)=0
gamma(np)=0
nt=0
! Start the Fano decoder
do i=1,nbits*maxcycles
! Look forward
ngamma=gamma(np) + tm(ii(np),np)
if(ngamma.ge.nt) then
! Node is acceptable. If first time visiting this node, tighten threshold:
if(gamma(np).lt.(nt+ndelta)) nt=nt + ndelta * ((ngamma-nt)/ndelta)
! Move forward
gamma(np+1)=ngamma
nstate(np+1)=ishft(nstate(np),1)
np=np+1
! if(ngamma.gt.maxmetric) then
if(np.gt.maxnp) then
maxmetric=ngamma
maxnp=np
endif
if(np.eq.nbits-1) go to 100 !We're done!
n=iand(nstate(np),npoly1)
n=ieor(n,ishft(n,-16))
lsym=partab(iand(ieor(n,ishft(n,-8)),255))
n=iand(nstate(np),npoly2)
n=ieor(n,ishft(n,-16))
lsym=lsym+lsym+partab(iand(ieor(n,ishft(n,-8)),255))
if(np.ge.ntail) then
tm(0,np)=metrics(lsym,np) !We're in the tail, all zeros
else
m0=metrics(lsym,np)
m1=metrics(ieor(3,lsym),np)
if(m0.gt.m1) then
tm(0,np)=m0 !0-branch has better metric
tm(1,np)=m1
else
tm(0,np)=m1 !1-branch is better
tm(1,np)=m0
nstate(np)=nstate(np) + 1 !Set low bit
endif
endif
ii(np)=0 !Start with best branch
go to 99
endif
! Threshold violated, can't go forward
10 noback=.false.
if(np.eq.0) noback=.true.
if(np.gt.0) then
if(gamma(np-1).lt.nt) noback=.true.
endif
if(noback) then
! Can't back up, either. Relax threshold and look forward again
! to a better branch.
nt=nt-ndelta
if(ii(np).ne.0) then
ii(np)=0
nstate(np)=ieor(nstate(np),1)
endif
go to 99
endif
! Back up
np=np-1
if(np.lt.ntail .and. ii(np).ne.1) then
! Search the next best branch
ii(np)=ii(np)+1
nstate(np)=ieor(nstate(np),1)
go to 99
endif
go to 10
99 continue
enddo
i=nbits*maxcycles
100 metric=gamma(np) !Final path metric
! Copy decoded data to user's buffer
nbytes=(nbits+7)/8
np=7
do j=1,nbytes-1
i4a=nstate(np)
dat(j)=i4a
np=np+8
enddo
dat(nbytes)=0
ncycles=i+1
ierr=0
if(i.ge.maxcycles*nbits) ierr=-1
return
end subroutine fano232

View File

@ -11,10 +11,15 @@ subroutine genjtms3(msg,msgsent,iwave,nwave)
real*4 s(6192)
real*4 carrier(6192)
logical first
integer*1 isync(43)
integer indx0(9) !Indices of duplicated symbols
data indx0 /16,38,60,82,104,126,148,170,192/
data first/.true./
data isync/0,1,0,0,1,0,1,0,0,1,1,1,0,1,1,1,1,1,0,0, &
0,1,0,1,1,1,0,0,0,0,0,1,0,0,0,1,1,0,1,0, &
1,1,0/ !Hadamard-43 sync code
save
sinc(x)=sin(pi*x)/(pi*x)
if(first) then
@ -28,7 +33,6 @@ subroutine genjtms3(msg,msgsent,iwave,nwave)
if(k.gt.3096) k=k-6192
x=x+dx
p(k)=sinc(x) * (sinc(x/2.0))**2
! p(k)=sinc(x) * exp(-(x/2.0)**2)
if(k.ne.3096) p(-k)=p(k)
enddo
p(0)=1.0
@ -75,8 +79,14 @@ subroutine genjtms3(msg,msgsent,iwave,nwave)
iwave(i)=n
enddo
! print*,'nmax:',nmax
nwave=6192
nblk=30*48000/6192
do n=2,nblk
ib=n*6192
ia=ib-6191
iwave(ia:ib)=iwave(1:6192)
enddo
nwave=ib
msgsent=msg
return

View File

@ -6,7 +6,10 @@ subroutine specjtms(k)
parameter (NFFT=8192,NH=NFFT/2)
integer*2 id
real x(NFFT),w(NFFT)
complex cx(NFFT),cx2(NFFT)
real p(24)
real chansym(258),softsym(341)
integer nsum(24)
complex cx(NFFT),cx2(NFFT),cx0(NFFT)
complex covx(NH)
real s1a(NH),s2a(580)
logical first,window
@ -16,6 +19,7 @@ subroutine specjtms(k)
if(first) then
pi=4.0*atan(1.0)
twopi=2.0*pi
do i=1,nfft
w(i)=(sin(i*pi/nfft))**2
enddo
@ -24,6 +28,9 @@ subroutine specjtms(k)
jb=nint(3400.0)/df
iz=3000.0/df
covx=0.
read(10,3001) chansym
3001 format(50f1.0)
chansym=2.0*chansym - 1.0
window=.false.
first=.false.
endif
@ -40,7 +47,6 @@ subroutine specjtms(k)
if(k.lt.8192) return
x(1:nfft)=0.001*id(i0:ib)
! call analytic(x,nfft,nfft,s,cx)
fac=2.0/nfft
cx=fac*x
@ -71,14 +77,16 @@ subroutine specjtms(k)
if(sq.gt.spk0) then
spk0=sq
f0=0.5*(f-3000.0)
phi0=atan2(aimag(cx2(j)),real(cx2(j)))
phi0=0.5*atan2(aimag(cx2(j)),real(cx2(j)))
endif
write(15,1020) (j-1)*df,sq
1020 format(f10.3,f12.3)
enddo
slimit=1.5
if(spk0.gt.slimit) then
slimit=2.0
! slimit=87.5
! if(spk0.gt.slimit) then
if(abs(spk0-87.3).lt.0.1) then
write(*,1030) t,f0,phi0,spk0
1030 format('t:',f6.2,' f0:',f7.1,' phi0:',f6.2,' spk0:',f8.1)
do i=1,iz
@ -91,6 +99,63 @@ subroutine specjtms(k)
write(17,1050) f0a,s2a(j)
1050 format(2f12.3)
enddo
phi=phi0
phi=3.9
dphi=2.0*pi*(f0+1500.0 -1.1)/48000.0
p=0.
nsum=0
do i=1,nfft
phi=phi+dphi
if(phi.gt.twopi) phi=phi-twopi
cx0(i)=cx(i)*cmplx(cos(phi),-sin(phi))
pha=atan2(aimag(cx0(i)),real(cx0(i)))
write(18,1060) i,cx0(i),pha
1060 format(i6,5f12.3)
j=mod(i-1,24) + 1
! p(j)=p(j)+abs(cx0(i))
p(j)=p(j) + real(cx0(i))**2 + aimag(cx0(i))**2
nsum(j)=nsum(j)+1
enddo
do i=1,24
p(i)=p(i)/nsum(i)
write(20,1070) i,p(i)
1070 format(i6,f12.3)
enddo
do i=16,nfft,24
amp=abs(cx0(i))
pha=atan2(aimag(cx0(i)),real(cx0(i)))
j=(i+23)/24
write(21,1060) j,cx0(i),pha,pha+twopi,amp
softsym(j)=real(cx0(i))
enddo
! do iter=1,5
chansym=cshift(chansym,-86)
do lag=0,83
sum=dot_product(chansym,softsym(lag+1:lag+258))
if(abs(sum).gt.smax) then
smax=abs(sum)
lagpk=lag
endif
write(22,1080) lag,sum
1080 format(i3,f12.3)
enddo
! chansym=cshift(chansym,43)
! enddo
do i=1,258
prod=-chansym(i)*softsym(lagpk+i)
write(23,1090) i,prod,chansym(i),softsym(lagpk+i)
1090 format(i5,3f10.3)
enddo
do i=1,258,6
write(24,1100) (i+5)/6,int(chansym(i)),softsym(lagpk+i)
1100 format(2i5,f8.1)
enddo
endif
end subroutine specjtms

View File

@ -1,4 +1,4 @@
//------------------------------------------------------------- MainWindow
//-------------------------------------------------------------- MainWindow
#include "mainwindow.h"
#include "ui_mainwindow.h"
#include "devsetup.h"