mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Further improvements to decoder for short JTMSK messages.
In mainwindow.cpp, return after executing call to fastSink(). ###???### git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6464 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
parent
95a3c00eda
commit
1ee6659101
@ -6,6 +6,7 @@ subroutine jtmsk_decode(id2,narg,line)
|
|||||||
parameter (NFFTMAX=512*1024)
|
parameter (NFFTMAX=512*1024)
|
||||||
parameter (NSPM=1404) !Samples per JTMSK long 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
|
||||||
|
integer hist(0:32868)
|
||||||
real d(0:NMAX) !Raw r*4 data
|
real d(0:NMAX) !Raw r*4 data
|
||||||
real ty(NMAX/512) !Ping times
|
real ty(NMAX/512) !Ping times
|
||||||
real yellow(NMAX/512)
|
real yellow(NMAX/512)
|
||||||
@ -15,6 +16,7 @@ subroutine jtmsk_decode(id2,narg,line)
|
|||||||
integer narg(0:14) !Arguments passed from calling pgm
|
integer narg(0:14) !Arguments passed from calling pgm
|
||||||
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
|
||||||
|
equivalence (hist,d)
|
||||||
|
|
||||||
! Parameters from GUI are in narg():
|
! Parameters from GUI are in narg():
|
||||||
nutc=narg(0) !UTC
|
nutc=narg(0) !UTC
|
||||||
@ -36,10 +38,21 @@ subroutine jtmsk_decode(id2,narg,line)
|
|||||||
msg0=' '
|
msg0=' '
|
||||||
msg=msg0
|
msg=msg0
|
||||||
|
|
||||||
d(0:npts-1)=id2(0:npts-1)
|
hist=0
|
||||||
rms=sqrt(dot_product(d(0:npts-1),d(0:npts-1))/npts)
|
do i=0,npts-1
|
||||||
|
n=abs(id2(i))
|
||||||
|
hist(n)=hist(n)+1
|
||||||
|
enddo
|
||||||
|
ns=0
|
||||||
|
do n=0,32768
|
||||||
|
ns=ns+hist(n)
|
||||||
|
if(ns.gt.npts/2) exit
|
||||||
|
enddo
|
||||||
|
fac=1.0/(1.5*n)
|
||||||
|
d(0:npts-1)=fac*id2(0:npts-1)
|
||||||
|
! rms=sqrt(dot_product(d(0:npts-1),d(0:npts-1))/npts)
|
||||||
!### Would it be better to set median rms to 1.0 ?
|
!### 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
|
! 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)
|
||||||
|
|
||||||
@ -70,8 +83,8 @@ subroutine jtmsk_decode(id2,narg,line)
|
|||||||
call syncmsk(cdat,iz,jpk,ipk,idf,rmax,snr,metric,msg)
|
call syncmsk(cdat,iz,jpk,ipk,idf,rmax,snr,metric,msg)
|
||||||
if(metric.eq.-9999) cycle !No output if no significant sync
|
if(metric.eq.-9999) cycle !No output if no significant sync
|
||||||
if(msg(1:1).eq.' ') call jtmsk_short(cdat,iz,narg,tbest,idfpk,msg)
|
if(msg(1:1).eq.' ') call jtmsk_short(cdat,iz,narg,tbest,idfpk,msg)
|
||||||
if(index(msg,'<').eq.1 .and. naggressive.eq.0 .and. &
|
if(msg(1:1).eq.'<' .and. naggressive.eq.0 .and. &
|
||||||
narg(13).ne.narg(12)) msg=' '
|
narg(13)/8.ne.narg(12)) msg=' '
|
||||||
if(msg(1:1).ne.' ') then
|
if(msg(1:1).ne.' ') then
|
||||||
if(msg.ne.msg0) then
|
if(msg.ne.msg0) then
|
||||||
nline=nline+1
|
nline=nline+1
|
||||||
@ -79,10 +92,14 @@ subroutine jtmsk_decode(id2,narg,line)
|
|||||||
endif
|
endif
|
||||||
freq=fpk+idf
|
freq=fpk+idf
|
||||||
t0=(ia+jpk)/12000.0
|
t0=(ia+jpk)/12000.0
|
||||||
nsnr=nint(yellow(n)-4.0)
|
y=10.0**(0.1*(yellow(n)-1.5))
|
||||||
|
nsnr=max(-5,nint(db(y)))
|
||||||
if(nsnr.gt.nsnr0 .and. nline.gt.0) 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,narg(13),freq2)
|
||||||
write(line(nline),1020) nutc,nsnr,t0,nint(freq2),msg
|
freq=freq2
|
||||||
|
if(msg(1:1).eq.'<') freq=freq2+idfpk
|
||||||
|
!### Check freq values !!!
|
||||||
|
write(line(nline),1020) nutc,nsnr,t0,nint(freq),msg
|
||||||
1020 format(i6.6,i4,f5.1,i5,' & ',a22)
|
1020 format(i6.6,i4,f5.1,i5,' & ',a22)
|
||||||
nsnr0=nsnr
|
nsnr0=nsnr
|
||||||
go to 900
|
go to 900
|
||||||
@ -91,9 +108,11 @@ subroutine jtmsk_decode(id2,narg,line)
|
|||||||
if(nline.ge.maxlines) go to 900
|
if(nline.ge.maxlines) go to 900
|
||||||
endif
|
endif
|
||||||
enddo
|
enddo
|
||||||
|
! print*,'c',nutc,n,nint(yellow(n)-4.0),freq,freq2
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
900 continue
|
900 continue
|
||||||
|
! print*,'d',nutc,n,nint(yellow(n)-4.0),freq,freq2
|
||||||
if(line(1)(1:6).eq.' ') line(1)(1:1)=char(0)
|
if(line(1)(1:6).eq.' ') line(1)(1:1)=char(0)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -142,7 +142,7 @@ subroutine jtmsk_short(cdat,npts,narg,tbest,idfpk,decoded)
|
|||||||
if(u1.gt.u1best) then
|
if(u1.gt.u1best) then
|
||||||
irpt=iand(ibest,7)
|
irpt=iand(ibest,7)
|
||||||
ihash=ibest/8
|
ihash=ibest/8
|
||||||
narg(13)=ihash
|
narg(13)=ibest
|
||||||
decoded="<...> "//rpt(irpt)
|
decoded="<...> "//rpt(irpt)
|
||||||
tbest=t
|
tbest=t
|
||||||
r1best=r1(j)
|
r1best=r1(j)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
subroutine rectify_msk(c,msg,freq2)
|
subroutine rectify_msk(c,msg0,imsg,freq2)
|
||||||
|
|
||||||
parameter (NSPM=1404)
|
parameter (NSPM=1404)
|
||||||
complex c(0:NSPM-1) !Received data
|
complex c(0:NSPM-1) !Received data
|
||||||
@ -6,11 +6,18 @@ subroutine rectify_msk(c,msg,freq2)
|
|||||||
complex c1(0:NSPM-1) !Rectified signal
|
complex c1(0:NSPM-1) !Rectified signal
|
||||||
complex c2(0:NSPM-1) !Integral of rectified signal
|
complex c2(0:NSPM-1) !Integral of rectified signal
|
||||||
complex c3(0:2*NSPM-1) !FFT of rectified signal
|
complex c3(0:2*NSPM-1) !FFT of rectified signal
|
||||||
complex cfac !,z
|
complex cfac
|
||||||
character*22 msg,msgsent
|
character*22 msg0,msg,msgsent
|
||||||
integer i4tone(234)
|
integer i4tone(234)
|
||||||
|
|
||||||
ichk=0
|
ichk=0
|
||||||
|
msg=msg0
|
||||||
|
nsym=234
|
||||||
|
if(imsg.ge.0) then
|
||||||
|
ichk=10000+imsg
|
||||||
|
msg="<C1ALL C2ALL> 73"
|
||||||
|
nsym=35
|
||||||
|
endif
|
||||||
call genmsk(msg,ichk,msgsent,i4tone,itype) !Get tone sequence for msg
|
call genmsk(msg,ichk,msgsent,i4tone,itype) !Get tone sequence for msg
|
||||||
|
|
||||||
twopi=8.0*atan(1.0)
|
twopi=8.0*atan(1.0)
|
||||||
@ -21,7 +28,7 @@ subroutine rectify_msk(c,msg,freq2)
|
|||||||
dphi=0.
|
dphi=0.
|
||||||
k=-1
|
k=-1
|
||||||
c2=0.
|
c2=0.
|
||||||
do j=1,234 !Generate Tx waveform for msg
|
do j=1,nsym !Generate Tx waveform for msg
|
||||||
if(i4tone(j).eq.0) dphi=twopi*f0*dt
|
if(i4tone(j).eq.0) dphi=twopi*f0*dt
|
||||||
if(i4tone(j).eq.1) dphi=twopi*f1*dt
|
if(i4tone(j).eq.1) dphi=twopi*f1*dt
|
||||||
do i=1,6
|
do i=1,6
|
||||||
@ -37,22 +44,6 @@ subroutine rectify_msk(c,msg,freq2)
|
|||||||
cfac=cmplx(cos(pha),-sin(pha))
|
cfac=cmplx(cos(pha),-sin(pha))
|
||||||
c1=cfac*c1
|
c1=cfac*c1
|
||||||
c2=cfac*c2
|
c2=cfac*c2
|
||||||
! sq=0.
|
|
||||||
! do k=0,NSPM-1
|
|
||||||
! pha=atan2(aimag(c2(k)),real(c2(k)))
|
|
||||||
! write(61,3001) k,c1(k),c2(k),pha
|
|
||||||
!3001 format(i6,7f12.3)
|
|
||||||
! sq=sq + aimag(c1(k))**2
|
|
||||||
! enddo
|
|
||||||
|
|
||||||
! z=c2(5)
|
|
||||||
! do j=1,234
|
|
||||||
! k=j*6 - 1
|
|
||||||
! if(j.ge.2) z=c2(k)-c2(k-6)
|
|
||||||
! pha=atan2(aimag(z),real(z))
|
|
||||||
! write(62,3001) j,z,pha
|
|
||||||
! enddo
|
|
||||||
|
|
||||||
nfft=2*NSPM
|
nfft=2*NSPM
|
||||||
c3(0:NSPM-1)=c2
|
c3(0:NSPM-1)=c2
|
||||||
c3(NSPM:nfft-1)=0.
|
c3(NSPM:nfft-1)=0.
|
||||||
@ -67,8 +58,6 @@ subroutine rectify_msk(c,msg,freq2)
|
|||||||
smax=s
|
smax=s
|
||||||
freq2=1500.0 + f
|
freq2=1500.0 + f
|
||||||
endif
|
endif
|
||||||
! write(63,3002) f,s,db(s),c3(i)
|
|
||||||
!3002 format(f10.1,f12.3,f10.2,2f12.1)
|
|
||||||
enddo
|
enddo
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -875,7 +875,7 @@ void MainWindow::dataSink(qint64 frames)
|
|||||||
|
|
||||||
if(m_mode=="ISCAT" or m_mode=="JTMSK" or m_bFast9) {
|
if(m_mode=="ISCAT" or m_mode=="JTMSK" or m_bFast9) {
|
||||||
fastSink(frames);
|
fastSink(frames);
|
||||||
// return;
|
return; //### Had been commented out (2/4/2016) ###
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get power, spectrum, and ihsym
|
// Get power, spectrum, and ihsym
|
||||||
@ -1485,7 +1485,9 @@ void MainWindow::closeEvent(QCloseEvent * e)
|
|||||||
mem_jt9->detach();
|
mem_jt9->detach();
|
||||||
QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")};
|
QFile quitFile {m_config.temp_dir ().absoluteFilePath (".quit")};
|
||||||
quitFile.open(QIODevice::ReadWrite);
|
quitFile.open(QIODevice::ReadWrite);
|
||||||
|
qDebug() << "A";
|
||||||
QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.remove(); // Allow jt9 to terminate
|
QFile {m_config.temp_dir ().absoluteFilePath (".lock")}.remove(); // Allow jt9 to terminate
|
||||||
|
qDebug() << "B";
|
||||||
bool b=proc_jt9.waitForFinished(1000);
|
bool b=proc_jt9.waitForFinished(1000);
|
||||||
if(!b) proc_jt9.kill();
|
if(!b) proc_jt9.kill();
|
||||||
quitFile.remove();
|
quitFile.remove();
|
||||||
@ -1909,7 +1911,7 @@ void::MainWindow::fast_decode_done()
|
|||||||
}
|
}
|
||||||
if(m_msg[i][0]==0) break;
|
if(m_msg[i][0]==0) break;
|
||||||
QString message=QString::fromLatin1(m_msg[i]);
|
QString message=QString::fromLatin1(m_msg[i]);
|
||||||
if(narg[13]==narg[12]) message=message.trimmed().replace("<...>",m_calls);
|
if(narg[13]/8==narg[12]) message=message.trimmed().replace("<...>",m_calls);
|
||||||
|
|
||||||
//Left (Band activity) window
|
//Left (Band activity) window
|
||||||
DecodedText decodedtext;
|
DecodedText decodedtext;
|
||||||
|
Loading…
Reference in New Issue
Block a user