mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-25 02:42:28 -04:00
More-or-less functional decoder for JTMSK short messages.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6419 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
333f8519d3
commit
8f993eeb9f
@ -4,7 +4,7 @@ subroutine fast9(id2,narg,line)
|
|||||||
|
|
||||||
parameter (NMAX=30*12000,NSAVE=500)
|
parameter (NMAX=30*12000,NSAVE=500)
|
||||||
integer*2 id2(0:NMAX)
|
integer*2 id2(0:NMAX)
|
||||||
integer narg(0:11)
|
integer narg(0:13)
|
||||||
integer*1 i1SoftSymbols(207)
|
integer*1 i1SoftSymbols(207)
|
||||||
integer*1 i1save(207,NSAVE)
|
integer*1 i1save(207,NSAVE)
|
||||||
integer indx(NSAVE)
|
integer indx(NSAVE)
|
||||||
|
@ -2,7 +2,7 @@ subroutine fast_decode(id2,narg,line)
|
|||||||
|
|
||||||
parameter (NMAX=30*12000)
|
parameter (NMAX=30*12000)
|
||||||
integer*2 id2(NMAX)
|
integer*2 id2(NMAX)
|
||||||
integer narg(0:9)
|
integer narg(0:13)
|
||||||
real dat(30*12000)
|
real dat(30*12000)
|
||||||
complex cdat(262145),cdat2(262145)
|
complex cdat(262145),cdat2(262145)
|
||||||
real psavg(450)
|
real psavg(450)
|
||||||
@ -21,8 +21,9 @@ subroutine fast_decode(id2,narg,line)
|
|||||||
t1=0.001*narg(7)
|
t1=0.001*narg(7)
|
||||||
maxlines=narg(8)
|
maxlines=narg(8)
|
||||||
nmode=narg(9)
|
nmode=narg(9)
|
||||||
|
nrxfreq=narg(10)
|
||||||
! call sleep_msec(100) !### TEMPORARY ###
|
ntol=narg(11)
|
||||||
|
nhashcalls=narg(12)
|
||||||
|
|
||||||
if(nmode.eq.102) then
|
if(nmode.eq.102) then
|
||||||
call fast9(id2,narg,line)
|
call fast9(id2,narg,line)
|
||||||
@ -45,7 +46,6 @@ subroutine fast_decode(id2,narg,line)
|
|||||||
! NB: npts, nsps, etc., are all reduced by 9/32
|
! NB: npts, nsps, etc., are all reduced by 9/32
|
||||||
|
|
||||||
write(cfile6,'(i6.6)') nutc
|
write(cfile6,'(i6.6)') nutc
|
||||||
ntol=400
|
|
||||||
nfreeze=1
|
nfreeze=1
|
||||||
mousedf=0
|
mousedf=0
|
||||||
mousebutton=0
|
mousebutton=0
|
||||||
|
@ -53,3 +53,14 @@ subroutine genmsk_short(msg,msgsent,ichk,itone,itype)
|
|||||||
|
|
||||||
900 return
|
900 return
|
||||||
end subroutine genmsk_short
|
end subroutine genmsk_short
|
||||||
|
|
||||||
|
subroutine hash_calls(calls,ih9)
|
||||||
|
|
||||||
|
use hashing
|
||||||
|
character*(*) calls
|
||||||
|
i1=index(calls,'>')
|
||||||
|
call hash(calls(2:i1-1),i1-2,ih9)
|
||||||
|
ih9=iand(ih9,511) !9-bit hash for the two callsigns
|
||||||
|
|
||||||
|
return
|
||||||
|
end subroutine hash_calls
|
||||||
|
@ -15,9 +15,8 @@ subroutine jtmsk_decode(id2,narg,line)
|
|||||||
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)
|
||||||
integer narg(0:11) !Arguments passed from calling pgm
|
integer narg(0:13) !Arguments passed from calling pgm
|
||||||
character*22 msg,msg0 !Decoded message
|
character*22 msg,msg0 !Decoded message
|
||||||
character*22 msg1 !### Test ###
|
|
||||||
character*80 line(100) !Decodes passed back to caller
|
character*80 line(100) !Decodes passed back to caller
|
||||||
|
|
||||||
limtrace=-1
|
limtrace=-1
|
||||||
@ -33,7 +32,7 @@ subroutine jtmsk_decode(id2,narg,line)
|
|||||||
nmode=narg(9)
|
nmode=narg(9)
|
||||||
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)
|
||||||
nsnr0=-99
|
nsnr0=-99
|
||||||
nline=0
|
nline=0
|
||||||
line(1:100)(1:1)=char(0)
|
line(1:100)(1:1)=char(0)
|
||||||
@ -54,28 +53,6 @@ subroutine jtmsk_decode(id2,narg,line)
|
|||||||
call analytic(d,npts,nfft,c) !Convert to analytic signal
|
call analytic(d,npts,nfft,c) !Convert to analytic signal
|
||||||
call timer('analytic',1)
|
call timer('analytic',1)
|
||||||
|
|
||||||
msg1="<K1ABC W9XYZ> R26"
|
|
||||||
msg=' '
|
|
||||||
call jtmsk_short(c,npts,msg1,msg)
|
|
||||||
|
|
||||||
!### Needs work!
|
|
||||||
nsnr=1
|
|
||||||
if(msg.ne.' ') then
|
|
||||||
if(msg.ne.msg0) then
|
|
||||||
nline=nline+1
|
|
||||||
nsnr0=-99
|
|
||||||
endif
|
|
||||||
if(nsnr.gt.nsnr0) then
|
|
||||||
! call rectify_msk(cdat2(jpk:jpk+NSPM-1),msg,freq2)
|
|
||||||
write(line(nline),1020) nutc,nsnr,t0,nint(freq2),msg
|
|
||||||
nsnr0=nsnr
|
|
||||||
go to 900
|
|
||||||
endif
|
|
||||||
msg0=msg
|
|
||||||
if(nline.ge.maxlines) go to 900
|
|
||||||
endif
|
|
||||||
!###
|
|
||||||
|
|
||||||
nbefore=NSPM
|
nbefore=NSPM
|
||||||
nafter=4*NSPM
|
nafter=4*NSPM
|
||||||
! Process ping list (sorted by S/N) from top down.
|
! Process ping list (sorted by S/N) from top down.
|
||||||
@ -124,7 +101,21 @@ subroutine jtmsk_decode(id2,narg,line)
|
|||||||
enddo
|
enddo
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
900 if(line(1)(1:6).eq.' ') line(1)(1:1)=char(0)
|
900 if(nline.eq.0) then
|
||||||
|
msg=' '
|
||||||
|
call jtmsk_short(c,npts,narg,tbest,msg)
|
||||||
|
|
||||||
|
!### Needs work!
|
||||||
|
if(msg.ne.' ') then
|
||||||
|
nline=nline+1
|
||||||
|
j=nint(12000.0*tbest/512.0)
|
||||||
|
nsnr=nint(yellow(j)-1.0)
|
||||||
|
write(line(nline),1020) nutc,nsnr,tbest,nrxfreq,msg
|
||||||
|
endif
|
||||||
|
!###
|
||||||
|
|
||||||
|
endif
|
||||||
|
if(line(1)(1:6).eq.' ') line(1)(1:1)=char(0)
|
||||||
|
|
||||||
return
|
return
|
||||||
end subroutine jtmsk_decode
|
end subroutine jtmsk_decode
|
||||||
|
@ -1,37 +1,41 @@
|
|||||||
subroutine jtmsk_short(cdat,npts,msg,decoded)
|
subroutine jtmsk_short(cdat,npts,narg,tbest,decoded)
|
||||||
|
|
||||||
parameter (NMAX=15*12000,NSAVE=100)
|
parameter (NMAX=15*12000,NSAVE=100)
|
||||||
character*22 msg,decoded,msgsent
|
character*22 msg,decoded,msgsent
|
||||||
character*3 rpt(0:7)
|
character*3 rpt(0:7)
|
||||||
complex cdat(0:npts-1)
|
complex cdat(0:npts-1)
|
||||||
complex cw(0:209,0:4096) !Waveforms of possible messages
|
complex cw(0:209,0:4095) !Waveforms of possible messages
|
||||||
complex cb11(0:65) !Complex waveform of Barker 11
|
complex cb11(0:65) !Complex waveform of Barker 11
|
||||||
complex z1,z2a,z2b
|
complex z1,z2a,z2b
|
||||||
real*8 dt,twopi,freq,phi,dphi0,dphi1,dphi
|
real*8 dt,twopi,freq,phi,dphi0,dphi1,dphi
|
||||||
real r1(0:NMAX-1)
|
real r1(0:NMAX-1)
|
||||||
real r2(0:4096)
|
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)
|
||||||
|
integer narg(0:13)
|
||||||
logical first
|
logical first
|
||||||
data rpt /'26 ','27 ','28 ','R26','R27','R28','RRR','73 '/
|
data rpt /'26 ','27 ','28 ','R26','R27','R28','RRR','73 '/
|
||||||
data first/.true./
|
data first/.true./,nrxfreq0/-1/
|
||||||
save first,cw,cb11
|
save first,cw,cb11,nrxfreq0
|
||||||
|
|
||||||
if(first) then
|
nrxfreq=narg(10) !Target Rx audio frequency (Hz)
|
||||||
|
ntol=narg(11) !Search range, +/- ntol (Hz)
|
||||||
|
nhashcalls=narg(12)
|
||||||
|
|
||||||
|
if(first .or. nrxfreq.ne.nrxfreq0) then
|
||||||
dt=1.d0/12000.d0
|
dt=1.d0/12000.d0
|
||||||
twopi=8.d0*atan(1.d0)
|
twopi=8.d0*atan(1.d0)
|
||||||
freq=1500.d0
|
freq=nrxfreq
|
||||||
dphi0=twopi*(freq-500.d0)*dt !Phase increment, lower tone
|
dphi0=twopi*(freq-500.d0)*dt !Phase increment, lower tone
|
||||||
dphi1=twopi*(freq+500.d0)*dt !Phase increment, upper tone
|
dphi1=twopi*(freq+500.d0)*dt !Phase increment, upper tone
|
||||||
nsym=35 !Number of symbols
|
nsym=35 !Number of symbols
|
||||||
nspm=6*nsym !Samples per message
|
nspm=6*nsym !Samples per message
|
||||||
|
|
||||||
do imsg=0,4096 !Generate all possible message waveforms
|
msg="<C1ALL C2ALL> 73"
|
||||||
ichk=0
|
do imsg=0,4095 !Generate all possible message waveforms
|
||||||
if(imsg.lt.4096) ichk=10000+imsg
|
ichk=10000+imsg
|
||||||
call genmsk(msg,ichk,msgsent,itone,itype) !Encode the message
|
call genmsk(msg,ichk,msgsent,itone,itype) !Encode the message
|
||||||
k=-1
|
k=-1
|
||||||
phi=0.d0
|
phi=0.d0
|
||||||
@ -49,18 +53,12 @@ subroutine jtmsk_short(cdat,npts,msg,decoded)
|
|||||||
enddo
|
enddo
|
||||||
cb11=cw(0:65,0)
|
cb11=cw(0:65,0)
|
||||||
first=.false.
|
first=.false.
|
||||||
|
nrxfreq0=nrxfreq
|
||||||
endif
|
endif
|
||||||
|
|
||||||
! r1thresh=0.40
|
|
||||||
r1thresh=0.80
|
r1thresh=0.80
|
||||||
r2thresh=0.50
|
|
||||||
rmax=0.9
|
|
||||||
ngood=0
|
|
||||||
nbad=0
|
|
||||||
maxdecodes=999
|
maxdecodes=999
|
||||||
|
|
||||||
! call system_clock(count0,clkfreq)
|
|
||||||
|
|
||||||
r1max=0.
|
r1max=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.
|
||||||
@ -89,7 +87,8 @@ subroutine jtmsk_short(cdat,npts,msg,decoded)
|
|||||||
kmax=k
|
kmax=k
|
||||||
call indexx(r1save,kmax,indx)
|
call indexx(r1save,kmax,indx)
|
||||||
|
|
||||||
r2bad=0.
|
ibest2=-1
|
||||||
|
u1best=0.
|
||||||
do kk=1,kmax
|
do kk=1,kmax
|
||||||
k=indx(kmax+1-kk)
|
k=indx(kmax+1-kk)
|
||||||
j=jgood(k)
|
j=jgood(k)
|
||||||
@ -98,7 +97,7 @@ subroutine jtmsk_short(cdat,npts,msg,decoded)
|
|||||||
u2=0.
|
u2=0.
|
||||||
r2max=0.
|
r2max=0.
|
||||||
ibest=-1
|
ibest=-1
|
||||||
do imsg=0,4096
|
do imsg=0,4095
|
||||||
ssa=0.
|
ssa=0.
|
||||||
ssb=0.
|
ssb=0.
|
||||||
do i=0,209
|
do i=0,209
|
||||||
@ -118,29 +117,35 @@ subroutine jtmsk_short(cdat,npts,msg,decoded)
|
|||||||
u1=r2max
|
u1=r2max
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
r1or2=r1(j)/r2max
|
r1_r2=r1(j)/r2max
|
||||||
if(r2max.ge.r2thresh .and. u2/u1.lt.rmax .and. r1or2.ge.0.91) then
|
|
||||||
t=j/12000.0
|
t=j/12000.0
|
||||||
n=0
|
n=0
|
||||||
|
if(ibest/8.eq.narg(12) .and. iand(ibest,7).eq.3) n=1
|
||||||
|
! write(52,3101) t,nrxfreq,ibest/8,n,r1(j),u1,u2,u2/u1,r1_r2
|
||||||
|
! flush(52)
|
||||||
|
if(u1.ge.0.75 .and. u2/u1.lt.0.9 .and. r1_r2.lt.1.11) then
|
||||||
|
! write(*,3101) t,nrxfreq,ibest/8,n,r1(j),u1,u2,u2/u1,r1_r2
|
||||||
|
if(u1.gt.u1best) then
|
||||||
irpt=iand(ibest,7)
|
irpt=iand(ibest,7)
|
||||||
|
ihash=ibest/8
|
||||||
|
narg(13)=ihash
|
||||||
decoded="<...> "//rpt(irpt)
|
decoded="<...> "//rpt(irpt)
|
||||||
if(r2max.eq.r2(4096)) then
|
tbest=t
|
||||||
n=1
|
r1best=r1(j)
|
||||||
decoded=msg(1:14)//rpt(irpt)
|
u1best=u1
|
||||||
|
u2best=u2
|
||||||
|
ibest2=ibest
|
||||||
|
r1_r2best=r1_r2
|
||||||
|
nn=0
|
||||||
|
if(ihash.eq.narg(12) .and. iand(ibest2,7).eq.3) nn=1
|
||||||
endif
|
endif
|
||||||
go to 900
|
|
||||||
|
|
||||||
! if(n.eq.0) nbad=nbad+1
|
|
||||||
! if(n.eq.1) ngood=ngood+1
|
|
||||||
! if(n.eq.0 .and. r2max.gt.r2bad) r2bad=r2max
|
|
||||||
! write(52,3020) k,t,ibest,r1(j),r2max,u2/u1,r1or2,n,decoded
|
|
||||||
!3020 format(i3,f9.4,i5,4f7.2,i2,1x,a22)
|
|
||||||
! if(ngood+nbad.ge.maxdecodes) exit
|
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
! if(r1best.gt.0.0) then
|
||||||
|
! write(*,3101) tbest,nrxfreq,ihash,nn,r1best,u1best,u2best, &
|
||||||
|
! u2best/u1best,r1_r2best
|
||||||
|
!3101 format(f7.2,3i6,5f8.2)
|
||||||
|
! endif
|
||||||
|
|
||||||
! print "('Worst false decode:',f6.3)",r2bad
|
return
|
||||||
! print "('Good:',i3,' Bad:',i3)",ngood,nbad
|
|
||||||
|
|
||||||
900 return
|
|
||||||
end subroutine jtmsk_short
|
end subroutine jtmsk_short
|
||||||
|
Loading…
x
Reference in New Issue
Block a user