More progress on decoder for short JTMSK messages.

git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6462 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2016-02-03 19:47:42 +00:00
parent 5fc5597652
commit be26c48f91
6 changed files with 61 additions and 58 deletions

View File

@ -32,7 +32,7 @@ CFLAGS = -O2 -I.
${FC} ${FFLAGS} -c $< ${FC} ${FFLAGS} -c $<
#all: jt9code JTMSKcode #all: jt9code JTMSKcode
all: testmsk JTMSKcode all: jtmsk JTMSKcode
OBJS4 = jt9code.o packjt.o fmtmsg.o gen9.o deg2grid.o grid2deg.o \ OBJS4 = jt9code.o packjt.o fmtmsg.o gen9.o deg2grid.o grid2deg.o \
entail.o encode232.o interleave9.o graycode.o igray.o entail.o encode232.o interleave9.o graycode.o igray.o
@ -44,11 +44,11 @@ OBJS5 = JTMSKcode.o packjt.o fmtmsg.o genmsk.o deg2grid.o grid2deg.o \
JTMSKcode: $(OBJS5) JTMSKcode: $(OBJS5)
$(FC) -o JTMSKcode $(OBJS5) $(FC) -o JTMSKcode $(OBJS5)
OBJS6 = testmsk.o jtmsk.o analytic.o four2a.o db.o mskdf.o pctile.o \ OBJS6 = jtmsk.o jtmsk.o analytic.o four2a.o db.o mskdf.o pctile.o \
sort.o tweak1.o syncmsk.o genmsk.o packjt.o fmtmsg.o indexx.o \ sort.o tweak1.o syncmsk.o genmsk.o packjt.o fmtmsg.o indexx.o \
deg2grid.o grid2deg.o entail.o nhash.o tab.o vit213.o deg2grid.o grid2deg.o entail.o nhash.o tab.o vit213.o
testmsk: $(OBJS6) jtmsk: $(OBJS6)
$(FC) -o testmsk $(OBJS6) -lfftw3f $(FC) -o jtmsk $(OBJS6) -lfftw3f
OBJS1 = t1.o four2a.o db.o OBJS1 = t1.o four2a.o db.o
t1: $(OBJS1) t1: $(OBJS1)

View File

@ -32,7 +32,7 @@ CFLAGS = -O2 -I.
${FC} ${FFLAGS} -c $< ${FC} ${FFLAGS} -c $<
#all: jt9code JTMSKcode.exe #all: jt9code JTMSKcode.exe
all: testmsk.exe JTMSKsim.exe JTMSKcode.exe fixwav.exe all: jtmsk.exe JTMSKsim.exe JTMSKcode.exe fixwav.exe
OBJS3 = JTMSKsim.o wavhdr.o gran.o four2a.o db.o OBJS3 = JTMSKsim.o wavhdr.o gran.o four2a.o db.o
JTMSKsim.exe: $(OBJS3) JTMSKsim.exe: $(OBJS3)
@ -48,12 +48,14 @@ OBJS5 = JTMSKcode.o packjt.o fmtmsg.o genmsk.o deg2grid.o grid2deg.o \
JTMSKcode.exe: $(OBJS5) JTMSKcode.exe: $(OBJS5)
$(FC) -o JTMSKcode.exe $(OBJS5) $(FC) -o JTMSKcode.exe $(OBJS5)
OBJS6 = testmsk.o jtmsk.o analytic.o four2a.o db.o pctile.o \ OBJS6 = jtmsk.o analytic.o four2a.o db.o pctile.o \
shell.o tweak1.o syncmsk.o genmsk.o packjt.o fmtmsg.o indexx.o \ shell.o tweak1.o syncmsk.o genmsk.o packjt.o fmtmsg.o indexx.o \
deg2grid.o grid2deg.o entail.o hashing.o nhash.o tab.o vit213.o \ deg2grid.o grid2deg.o entail.o hashing.o nhash.o tab.o vit213.o \
mskdt.o timer.o rectify_msk.o mskdt.o rectify_msk.o timer.o jtmsk_decode.o genmsk_short.o \
testmsk.exe: $(OBJS6) jtmsk_short.o golay24_table.o hash.o
$(FC) -o testmsk.exe $(OBJS6) C:\JTSDK\fftw3f\libfftw3f-3.dll
jtmsk.exe: $(OBJS6)
$(FC) -o jtmsk.exe $(OBJS6) C:\JTSDK\fftw3f\libfftw3f-3.dll
OBJS1 = fixwav.o wavhdr.o OBJS1 = fixwav.o wavhdr.o
fixwav.exe: $(OBJS1) fixwav.exe: $(OBJS1)

View File

@ -1,22 +1,28 @@
program testmsk program jtmsk
use timer_module, only: timer parameter (NMAX=359424)
parameter (NMAX=359424)
integer*2 id2(NMAX) integer*2 id2(NMAX)
integer narg(0:11) integer narg(0:13)
character*6 mycall,hiscall
character*22 msg,arg*8
character*80 line(100) character*80 line(100)
character*60 line0
character infile*80 character infile*80
nargs=iargc() nargs=iargc()
if(nargs.lt.1) then if(nargs.lt.4) then
print*,'Usage: testmsk infile1 [infile2 ...]' print*,'Usage: jtmsk MyCall HisCall ntol infile1 [infile2 ...]'
print*,'Examples: testmsk ~/data/JTMSK3/150825_115515.wav'
print*,' testmsk C:/data/JTMSK3/150825_120245.wav'
go to 999 go to 999
endif endif
call getarg(1,mycall)
call getarg(2,hiscall)
msg='<'//mycall//' '//hiscall//'> 26'
call fmtmsg(msg,iz)
call hash_calls(msg,narg(12))
call getarg(3,arg)
read(arg,*) ntol
nfiles=nargs nfiles=nargs-3
tsync1=0. tsync1=0.
tsync2=0. tsync2=0.
tsoft=0. tsoft=0.
@ -24,10 +30,9 @@ program testmsk
ttotal=0. ttotal=0.
ndecodes=0 ndecodes=0
call init_timer() call timer('jtmsk ',0)
call timer('testmsk ',0)
do ifile=1,nfiles do ifile=1,nfiles
call getarg(ifile,infile) call getarg(ifile+3,infile)
open(10,file=infile,access='stream',status='old') open(10,file=infile,access='stream',status='old')
read(10) id2(1:22) !Skip 44 header bytes read(10) id2(1:22) !Skip 44 header bytes
npts=179712 !### T/R = 15 s npts=179712 !### T/R = 15 s
@ -37,7 +42,6 @@ program testmsk
read(infile(i1-6:i1-1),*) narg(0) read(infile(i1-6:i1-1),*) narg(0)
nrxfreq=1500 nrxfreq=1500
ntol=100
narg(1)=npts !npts narg(1)=npts !npts
narg(2)=0 !nsubmode narg(2)=0 !nsubmode
narg(3)=1 !newdat narg(3)=1 !newdat
@ -56,12 +60,18 @@ program testmsk
do i=1,narg(8) do i=1,narg(8)
if(line(i)(1:1).eq.char(0)) exit if(line(i)(1:1).eq.char(0)) exit
ndecodes=ndecodes+1 ndecodes=ndecodes+1
write(*,1002) line(i)(1:60),ndecodes line0=line(i)(1:60)
i1=index(line(i)(1:60),'<...>')
if(i1.gt.0 .and. narg(13).eq.narg(12)) then
i2=index(msg,'>')
line0=line(i)(1:i1-1)//msg(1:i2)//line(i)(i1+5:i1+10)
endif
write(*,1002) line0,ndecodes
1002 format(a60,i10) 1002 format(a60,i10)
enddo enddo
enddo enddo
call timer('testmsk ',1) call timer('jtmsk ',1)
call timer('testmsk ',101) call timer('jtmsk ',101)
999 end program testmsk 999 end program jtmsk

View File

@ -1,14 +1,14 @@
subroutine jtmsk_decode(id2,narg,line) subroutine jtmsk_decode(id2,narg,line)
! Decoder for JTMSK ! Decoder for JTMSK mode
parameter (NMAX=30*12000) parameter (NMAX=30*12000)
parameter (NFFTMAX=512*1024) parameter (NFFTMAX=512*1024)
parameter (NSPM=1404) !Samples per JTMSK message parameter (NSPM=1404) !Samples per JTMSK long message
integer*2 id2(0:NMAX) !Raw i*2 data, up to T/R = 30 s integer*2 id2(0:NMAX) !Raw i*2 data, up to T/R = 30 s
real d(0:NMAX) !Raw r*4 data real d(0:NMAX) !Raw r*4 data
real ty(703) real ty(NMAX/512) !Ping times
real yellow(703) real yellow(NMAX/512)
complex c(NFFTMAX) !Complex (analytic) data complex c(NFFTMAX) !Complex (analytic) data
complex cdat(24000) !Short segments, up to 2 s complex cdat(24000) !Short segments, up to 2 s
complex cdat2(24000) complex cdat2(24000)
@ -16,7 +16,6 @@ subroutine jtmsk_decode(id2,narg,line)
character*22 msg,msg0 !Decoded message character*22 msg,msg0 !Decoded message
character*80 line(100) !Decodes passed back to caller character*80 line(100) !Decodes passed back to caller
limtrace=-1
! Parameters from GUI are in narg(): ! Parameters from GUI are in narg():
nutc=narg(0) !UTC nutc=narg(0) !UTC
npts=min(narg(1),NMAX) !Number of samples in id2 (12000 Hz) npts=min(narg(1),NMAX) !Number of samples in id2 (12000 Hz)
@ -38,13 +37,14 @@ subroutine jtmsk_decode(id2,narg,line)
d(0:npts-1)=id2(0:npts-1) d(0:npts-1)=id2(0:npts-1)
rms=sqrt(dot_product(d(0:npts-1),d(0:npts-1))/npts) rms=sqrt(dot_product(d(0:npts-1),d(0:npts-1))/npts)
d(0:npts-1)=d(0:npts-1)/rms !### Would it be better to set median rms to 1.0 ?
d(0:npts-1)=d(0:npts-1)/rms !Normalize so that rms=1.0
call mskdt(d,npts,ty,yellow,nyel) call mskdt(d,npts,ty,yellow,nyel)
nyel=min(nyel,5) nyel=min(nyel,5)
n=log(float(npts))/log(2.0) + 1.0 n=log(float(npts))/log(2.0) + 1.0
nfft=min(2**n,1024*1024) nfft=min(2**n,1024*1024)
call analytic(d,npts,nfft,c) !Convert to analytic signal call analytic(d,npts,nfft,c) !Convert to analytic signal and filter
nbefore=NSPM nbefore=NSPM
nafter=4*NSPM nafter=4*NSPM
@ -66,18 +66,21 @@ subroutine jtmsk_decode(id2,narg,line)
if(abs(idf1).gt.ntol) exit if(abs(idf1).gt.ntol) exit
fpk=idf1 + nrxfreq fpk=idf1 + nrxfreq
call tweak1(cdat2,iz,1500.0-fpk,cdat) call tweak1(cdat2,iz,1500.0-fpk,cdat)
call syncmsk(cdat,iz,jpk,ipk,idf,rmax,snr,metric,msg) call syncmsk(cdat,iz,jpk,ipk,idf,rmax,snr,metric,msg)
freq=fpk+idf freq=fpk+idf
if(metric.eq.-9999) cycle !No output if no significant sync if(metric.eq.-9999) cycle !No output if no significant sync
t0=(ia+jpk)/12000.0 t0=(ia+jpk)/12000.0
nsnr=nint(yellow(n)-2.0) nsnr=nint(yellow(n)-2.0)
if(msg.eq.' ') then
call jtmsk_short(cdat,iz,narg,tbest,idfpk,msg)
endif
if(msg.ne.' ') then if(msg.ne.' ') then
if(msg.ne.msg0) then if(msg.ne.msg0) then
nline=nline+1 nline=nline+1
nsnr0=-99 nsnr0=-99
endif endif
if(nsnr.gt.nsnr0) then if(nsnr.gt.nsnr0 .and. nline.gt.0) then
call rectify_msk(cdat2(jpk:jpk+NSPM-1),msg,freq2) call rectify_msk(cdat2(jpk:jpk+NSPM-1),msg,freq2)
write(line(nline),1020) nutc,nsnr,t0,nint(freq2),msg write(line(nline),1020) nutc,nsnr,t0,nint(freq2),msg
1020 format(i6.6,i4,f5.1,i5,' & ',a22) 1020 format(i6.6,i4,f5.1,i5,' & ',a22)
@ -90,7 +93,9 @@ subroutine jtmsk_decode(id2,narg,line)
enddo enddo
enddo enddo
900 if(nline.eq.0) then 900 continue
nline=1
if(nline.eq.0) then
msg=' ' msg=' '
call jtmsk_short(c,npts,narg,tbest,idfpk,msg) call jtmsk_short(c,npts,narg,tbest,idfpk,msg)

View File

@ -14,7 +14,6 @@ subroutine jtmsk_short(cdat,npts,narg,tbest,idfpk,decoded)
real r1(0:NMAX-1) real r1(0:NMAX-1)
real r2(0:4095) real r2(0:4095)
real r1save(NSAVE) real r1save(NSAVE)
! integer*8 count0,count1,clkfreq
integer itone(234) !Message bits integer itone(234) !Message bits
integer jgood(NSAVE) integer jgood(NSAVE)
integer indx(NSAVE) integer indx(NSAVE)
@ -24,8 +23,6 @@ subroutine jtmsk_short(cdat,npts,narg,tbest,idfpk,decoded)
data first/.true./,nrxfreq0/-1/,ttot/0.0/ data first/.true./,nrxfreq0/-1/,ttot/0.0/
save first,cw,cb11,nrxfreq0,ttot save first,cw,cb11,nrxfreq0,ttot
! call system_clock(count0,clkfreq)
nrxfreq=narg(10) !Target Rx audio frequency (Hz) nrxfreq=narg(10) !Target Rx audio frequency (Hz)
ntol=narg(11) !Search range, +/- ntol (Hz) ntol=narg(11) !Search range, +/- ntol (Hz)
nhashcalls=narg(12) nhashcalls=narg(12)
@ -66,6 +63,7 @@ subroutine jtmsk_short(cdat,npts,narg,tbest,idfpk,decoded)
maxdecodes=999 maxdecodes=999
r1max=0. r1max=0.
! call timer('r1 ',0)
do j=0,npts-210 !Find the B11 sync vectors do j=0,npts-210 !Find the B11 sync vectors
z1=0. z1=0.
ss=0. ss=0.
@ -80,6 +78,7 @@ subroutine jtmsk_short(cdat,npts,narg,tbest,idfpk,decoded)
jpk=j jpk=j
endif endif
enddo enddo
! call timer('r1 ',1)
k=0 k=0
do j=1,npts-211 do j=1,npts-211
@ -97,6 +96,7 @@ subroutine jtmsk_short(cdat,npts,narg,tbest,idfpk,decoded)
ibest2=-1 ibest2=-1
idfbest=0 idfbest=0
u1best=0. u1best=0.
! call timer('kk ',0)
do kk=1,min(kmax,10) do kk=1,min(kmax,10)
k=indx(kmax+1-kk) k=indx(kmax+1-kk)
j=jgood(k) j=jgood(k)
@ -109,6 +109,7 @@ subroutine jtmsk_short(cdat,npts,narg,tbest,idfpk,decoded)
do iidf=0,10 do iidf=0,10
idf=20*((iidf+1)/2) idf=20*((iidf+1)/2)
if(idf.gt.ntol) exit
if(iand(iidf,1).eq.1) idf=-idf if(iand(iidf,1).eq.1) idf=-idf
call tweak1(cdat(j-144:j+209),354,float(-idf),cd) call tweak1(cdat(j-144:j+209),354,float(-idf),cd)
cd(354:)=0. cd(354:)=0.
@ -165,16 +166,13 @@ subroutine jtmsk_short(cdat,npts,narg,tbest,idfpk,decoded)
! if(r1best.gt.0.0) write(*,3101) tbest,kk,nrxfreq+idfbest,ibest,nn, & ! if(r1best.gt.0.0) write(*,3101) tbest,kk,nrxfreq+idfbest,ibest,nn, &
! r1best,u1best,u2best,u2best/u1best,r1_r2best,idfbest ! r1best,u1best,u2best,u2best/u1best,r1_r2best,idfbest
enddo enddo
! call timer('kk ',1)
! if(r1best.gt.0.0) then ! if(r1best.gt.0.0) then
! write(*,3101) tbest,kk,nrxfreq+idfbest,ibest,nn,r1best,u1best,u2best, & ! write(*,3101) tbest,kk,nrxfreq+idfbest,ibest,nn,r1best,u1best,u2best, &
! u2best/u1best,r1_r2best,idfbest ! u2best/u1best,r1_r2best,idfbest
!3101 format(f6.2,4i5,5f8.2,i6) !3101 format(f6.2,4i5,5f8.2,i6)
! endif ! endif
! call system_clock(count1,clkfreq)
! ttot=float(count1-count0)/float(clkfreq)
! write(*,3001) ttot
!3001 format('Execution time:',f7.3)
return return
end subroutine jtmsk_short end subroutine jtmsk_short

View File

@ -74,7 +74,7 @@ subroutine syncmsk(cdat,npts,jpk,ipk,idf,rmax,snr,metric,decoded)
dt=1.0/12000.0 dt=1.0/12000.0
f0=1000.0 f0=1000.0
f1=2000.0 f1=2000.0
dphi=0 !quel compiler gripe dphi=0
do i=1,11 do i=1,11
if(b11(i).eq.0) dphi=twopi*f0*dt if(b11(i).eq.0) dphi=twopi*f0*dt
if(b11(i).eq.1) dphi=twopi*f1*dt if(b11(i).eq.1) dphi=twopi*f1*dt
@ -182,9 +182,7 @@ subroutine syncmsk(cdat,npts,jpk,ipk,idf,rmax,snr,metric,decoded)
call timer('sync2 ',1) call timer('sync2 ',1)
kmax=k kmax=k
call timer('indexx ',0)
call indexx(rsave,kmax,indx) call indexx(rsave,kmax,indx)
call timer('indexx ',1)
call timer('sync3 ',0) call timer('sync3 ',0)
do kk=1,kmax do kk=1,kmax
@ -197,7 +195,6 @@ subroutine syncmsk(cdat,npts,jpk,ipk,idf,rmax,snr,metric,decoded)
smax=0. smax=0.
dfx=0. dfx=0.
idfbest=0 idfbest=0
call timer('idf ',0)
do itry=1,25 do itry=1,25
idf=itry/2 idf=itry/2
if(mod(itry,2).eq.0) idf=-idf if(mod(itry,2).eq.0) idf=-idf
@ -216,9 +213,7 @@ subroutine syncmsk(cdat,npts,jpk,ipk,idf,rmax,snr,metric,decoded)
call tweak1(cdat,npts,-dfx,cdat) call tweak1(cdat,npts,-dfx,cdat)
cfac=cmplx(cos(phi),-sin(phi)) cfac=cmplx(cos(phi),-sin(phi))
cdat=cfac*cdat cdat=cfac*cdat
call timer('idf ',1)
call timer('softsym ',0)
sig=0. sig=0.
ref=0. ref=0.
rdat(1:npts)=cdat rdat(1:npts)=cdat
@ -266,7 +261,6 @@ subroutine syncmsk(cdat,npts,jpk,ipk,idf,rmax,snr,metric,decoded)
symbol(n)=sym symbol(n)=sym
enddo enddo
snr=db(sig/ref-1.0) snr=db(sig/ref-1.0)
call timer('softsym ',1)
rdata(1:35)=symbol(12:46) rdata(1:35)=symbol(12:46)
rdata(36:104)=symbol(59:127) rdata(36:104)=symbol(59:127)
@ -288,16 +282,10 @@ subroutine syncmsk(cdat,npts,jpk,ipk,idf,rmax,snr,metric,decoded)
e1(j)=i1 e1(j)=i1
rd2(j)=rdata(i+99) rd2(j)=rdata(i+99)
enddo enddo
! call system_clock(count0,clkfreq)
! tsoft=tsoft + (count0-count1)/float(clkfreq)
! Decode the message ! Decode the message
nb1=87 nb1=87
call timer('vit213 ',0)
call vit213(e1,nb1,mettab,d8,metric) call vit213(e1,nb1,mettab,d8,metric)
call timer('vit213 ',1)
! call system_clock(count1,clkfreq)
! tvit=tvit + (count1-count0)/float(clkfreq)
ihash=nhash(c_loc(d8),int(9,c_size_t),146) ihash=nhash(c_loc(d8),int(9,c_size_t),146)
ihash=2*iand(ihash,32767) ihash=2*iand(ihash,32767)
decoded=' ' decoded=' '