2013-07-08 09:17:22 -04:00
|
|
|
program jt65
|
|
|
|
|
|
|
|
! Test the JT65 decoder for WSJT-X
|
|
|
|
|
2015-11-17 20:28:12 -05:00
|
|
|
use options
|
|
|
|
character c
|
|
|
|
logical :: display_help=.false.,err
|
2013-07-08 09:17:22 -04:00
|
|
|
parameter (NZMAX=60*12000)
|
|
|
|
integer*4 ihdr(11)
|
|
|
|
integer*2 id2(NZMAX)
|
|
|
|
real*4 dd(NZMAX)
|
|
|
|
character*80 infile
|
2015-11-17 20:28:12 -05:00
|
|
|
character(len=500) optarg
|
2013-07-08 09:17:22 -04:00
|
|
|
common/tracer/limtrace,lu
|
2013-07-09 12:05:23 -04:00
|
|
|
equivalence (lenfile,ihdr(2))
|
2015-11-17 20:28:12 -05:00
|
|
|
type (option) :: long_options(3) = [ &
|
|
|
|
option ('help',.false.,'h','Display this help message',''), &
|
|
|
|
option ('ntrials',.true.,'n','default=1000',''), &
|
|
|
|
option ('single-signal mode',.false.,'s','default=1000','') ]
|
|
|
|
|
|
|
|
limtrace=0
|
|
|
|
lu=12
|
|
|
|
ntol=50
|
|
|
|
nfqso=1270
|
|
|
|
nagain=0
|
|
|
|
nsubmode=0
|
|
|
|
ntrials=10000
|
|
|
|
nlow=200
|
|
|
|
nhigh=4000
|
|
|
|
n2pass=2
|
|
|
|
|
|
|
|
do
|
|
|
|
call getopt('hn:s',long_options,c,optarg,narglen,nstat,noffset,nremain,err)
|
|
|
|
if( nstat .ne. 0 ) then
|
|
|
|
exit
|
|
|
|
end if
|
|
|
|
select case (c)
|
|
|
|
case ('h')
|
|
|
|
display_help = .true.
|
|
|
|
case ('n')
|
|
|
|
read (optarg(:narglen), *) ntrials
|
|
|
|
case ('s')
|
|
|
|
nlow=1250
|
|
|
|
nhigh=1290
|
|
|
|
n2pass=1
|
|
|
|
end select
|
|
|
|
end do
|
2013-07-08 09:17:22 -04:00
|
|
|
|
|
|
|
nargs=iargc()
|
2015-11-17 20:28:12 -05:00
|
|
|
if(display_help .or. (nargs.lt.1)) then
|
|
|
|
print*,'Usage: jt65 [-n ntrials] [-s] file1 [file2 ...]'
|
|
|
|
print*,' -s single-signal mode'
|
2013-07-08 09:17:22 -04:00
|
|
|
go to 999
|
|
|
|
endif
|
|
|
|
|
|
|
|
open(12,file='timer.out',status='unknown')
|
|
|
|
call timer('jt65 ',0)
|
|
|
|
|
2015-11-17 20:28:12 -05:00
|
|
|
ndecoded=0
|
2013-07-08 09:17:22 -04:00
|
|
|
do ifile=1,nargs
|
2015-11-17 20:28:12 -05:00
|
|
|
newdat=1
|
|
|
|
nfa=nlow
|
|
|
|
nfb=nhigh
|
|
|
|
call getarg(ifile+noffset,infile)
|
|
|
|
if( infile.eq.'' ) goto 900
|
2013-07-08 09:17:22 -04:00
|
|
|
open(10,file=infile,access='stream',status='old',err=998)
|
|
|
|
call timer('read ',0)
|
|
|
|
read(10) ihdr
|
|
|
|
i1=index(infile,'.wav')
|
2015-11-17 20:28:12 -05:00
|
|
|
if( i1 .eq. 0 ) i1=index(infile,'.WAV')
|
|
|
|
read(infile(i1-4:i1-1),*,err=998) nutc
|
|
|
|
npts=52*12000
|
2013-07-08 09:17:22 -04:00
|
|
|
read(10) id2(1:npts)
|
|
|
|
call timer('read ',1)
|
|
|
|
dd(1:npts)=id2(1:npts)
|
|
|
|
dd(npts+1:)=0.
|
|
|
|
call timer('jt65a ',0)
|
2015-11-17 20:28:12 -05:00
|
|
|
|
|
|
|
! open(56,file='subtracted.wav',access='stream',status='unknown')
|
|
|
|
! write(56) ihdr(1:11)
|
|
|
|
|
|
|
|
call jt65a(dd,npts,newdat,nutc,nfa,nfb,nfqso,ntol,nsubmode, &
|
|
|
|
minsync,nagain,n2pass,ntrials, naggressive,ndepth,ndecoded)
|
2013-07-08 09:17:22 -04:00
|
|
|
call timer('jt65a ',1)
|
|
|
|
enddo
|
|
|
|
|
2015-11-17 20:28:12 -05:00
|
|
|
900 call timer('jt65 ',1)
|
2013-07-08 09:17:22 -04:00
|
|
|
call timer('jt65 ',101)
|
2015-11-17 20:28:12 -05:00
|
|
|
! call four2a(a,-1,1,1,1) !Free the memory used for plans
|
|
|
|
! call filbig(a,-1,1,0.0,0,0,0,0,0) ! (ditto)
|
2013-07-08 09:17:22 -04:00
|
|
|
go to 999
|
|
|
|
|
2015-11-17 20:28:12 -05:00
|
|
|
998 print*,'Cannot read from file:'
|
2013-07-08 09:17:22 -04:00
|
|
|
print*,infile
|
|
|
|
|
|
|
|
999 end program jt65
|