2015-12-17 15:29:55 -05:00
|
|
|
program jt65
|
|
|
|
|
2015-12-29 18:52:55 -05:00
|
|
|
! Test the JT65 decoder for WSJT-X
|
2015-12-17 15:29:55 -05:00
|
|
|
|
|
|
|
use options
|
2015-12-27 10:40:57 -05:00
|
|
|
use timer_module, only: timer
|
|
|
|
use timer_impl, only: init_timer
|
2015-12-29 18:52:55 -05:00
|
|
|
use jt65_test
|
2016-01-02 09:29:02 -05:00
|
|
|
use readwav
|
2015-12-27 10:40:57 -05:00
|
|
|
|
2016-02-28 13:08:02 -05:00
|
|
|
character c,mode
|
2017-11-04 13:03:56 -04:00
|
|
|
logical :: display_help=.false.,nrobust=.false.,single_decode=.false., ljt65apon=.false.
|
2016-01-02 09:29:02 -05:00
|
|
|
type(wav_header) :: wav
|
2015-12-17 15:29:55 -05:00
|
|
|
integer*2 id2(NZMAX)
|
|
|
|
real*4 dd(NZMAX)
|
|
|
|
character*80 infile
|
|
|
|
character(len=500) optarg
|
2015-12-17 18:21:38 -05:00
|
|
|
character*12 mycall,hiscall
|
|
|
|
character*6 hisgrid
|
2016-02-28 13:08:02 -05:00
|
|
|
|
|
|
|
type (option) :: long_options(12) = [ &
|
2016-01-01 11:34:55 -05:00
|
|
|
option ('aggressive',.true.,'a','aggressiveness [0-10], default AGGR=0','AGGR'), &
|
2016-01-23 20:45:05 -05:00
|
|
|
option ('depth',.true.,'d','depth=5 hinted decoding, default DEPTH=0','DEPTH'), &
|
2015-12-29 18:52:55 -05:00
|
|
|
option ('freq',.true.,'f','signal frequency, default FREQ=1270','FREQ'), &
|
|
|
|
option ('help',.false.,'h','Display this help message',''), &
|
2016-02-28 13:08:02 -05:00
|
|
|
option ('mode',.true.,'m','Mode A, B, C. Default is A.','MODE'), &
|
2015-12-29 18:52:55 -05:00
|
|
|
option ('ntrials',.true.,'n','number of trials, default TRIALS=10000','TRIALS'), &
|
|
|
|
option ('robust-sync',.false.,'r','robust sync',''), &
|
|
|
|
option ('my-call',.true.,'c','my callsign',''), &
|
|
|
|
option ('his-call',.true.,'x','his callsign',''), &
|
|
|
|
option ('his-grid',.true.,'g','his grid locator',''), &
|
|
|
|
option ('experience-decoding',.true.,'X' &
|
|
|
|
,'experience decoding options (1..n), default FLAGS=0','FLAGS'), &
|
|
|
|
option ('single-signal-mode',.false.,'s','decode at signal frequency only','') ]
|
2015-12-17 15:29:55 -05:00
|
|
|
|
2017-10-30 17:30:14 -04:00
|
|
|
naggressive=10
|
2016-01-09 10:01:41 -05:00
|
|
|
nfqso=1500
|
2017-10-30 17:30:14 -04:00
|
|
|
ntrials=100000
|
2016-03-22 12:42:59 -04:00
|
|
|
nexp_decode=0
|
2017-10-30 17:30:14 -04:00
|
|
|
ntol=20
|
2016-01-01 11:34:55 -05:00
|
|
|
nsubmode=0
|
2015-12-29 18:52:55 -05:00
|
|
|
nlow=200
|
|
|
|
nhigh=4000
|
2017-10-30 17:30:14 -04:00
|
|
|
n2pass=1
|
|
|
|
ndepth=1
|
2017-11-03 20:40:08 -04:00
|
|
|
nQSOProgress=6
|
2015-12-17 15:29:55 -05:00
|
|
|
|
|
|
|
do
|
2016-02-28 13:08:02 -05:00
|
|
|
call getopt('a:d:f:hm:n:rc:x:g:X:s',long_options,c,optarg,narglen,nstat,noffset,nremain,.true.)
|
2015-12-29 18:52:55 -05:00
|
|
|
if( nstat .ne. 0 ) then
|
|
|
|
exit
|
|
|
|
end if
|
|
|
|
select case (c)
|
2016-01-01 11:34:55 -05:00
|
|
|
case ('a')
|
|
|
|
read (optarg(:narglen), *) naggressive
|
2016-01-23 20:45:05 -05:00
|
|
|
case ('d')
|
|
|
|
read (optarg(:narglen), *) ndepth
|
2015-12-29 18:52:55 -05:00
|
|
|
case ('f')
|
2015-12-17 15:29:55 -05:00
|
|
|
read (optarg(:narglen), *) nfqso
|
2015-12-29 18:52:55 -05:00
|
|
|
case ('h')
|
2015-12-17 15:29:55 -05:00
|
|
|
display_help = .true.
|
2016-02-28 13:08:02 -05:00
|
|
|
case ('m')
|
|
|
|
read (optarg(:narglen), *) mode
|
|
|
|
if( mode .eq. 'b' .or. mode .eq. 'B' ) then
|
|
|
|
nsubmode=1
|
|
|
|
endif
|
|
|
|
if( mode .eq. 'c' .or. mode .eq. 'C' ) then
|
|
|
|
nsubmode=2
|
|
|
|
endif
|
2015-12-29 18:52:55 -05:00
|
|
|
case ('n')
|
2015-12-17 15:29:55 -05:00
|
|
|
read (optarg(:narglen), *) ntrials
|
2015-12-29 18:52:55 -05:00
|
|
|
case ('r')
|
|
|
|
nrobust=.true.
|
|
|
|
case ('c')
|
2015-12-17 15:29:55 -05:00
|
|
|
read (optarg(:narglen), *) mycall
|
2015-12-29 18:52:55 -05:00
|
|
|
case ('x')
|
2015-12-17 15:29:55 -05:00
|
|
|
read (optarg(:narglen), *) hiscall
|
2015-12-29 18:52:55 -05:00
|
|
|
case ('g')
|
2015-12-17 15:29:55 -05:00
|
|
|
read (optarg(:narglen), *) hisgrid
|
2015-12-29 18:52:55 -05:00
|
|
|
case ('X')
|
2016-03-22 12:42:59 -04:00
|
|
|
read (optarg(:narglen), *) nexp_decode
|
2015-12-29 18:52:55 -05:00
|
|
|
case ('s')
|
2016-03-22 12:42:59 -04:00
|
|
|
single_decode=.true.
|
2016-03-17 09:28:57 -04:00
|
|
|
ntol=100
|
2015-12-17 15:29:55 -05:00
|
|
|
nlow=nfqso-ntol
|
|
|
|
nhigh=nfqso+ntol
|
|
|
|
n2pass=1
|
2015-12-29 18:52:55 -05:00
|
|
|
end select
|
2015-12-17 15:29:55 -05:00
|
|
|
end do
|
|
|
|
|
2016-03-22 12:42:59 -04:00
|
|
|
if(single_decode) nexp_decode=ior(nexp_decode,32)
|
2015-12-17 15:29:55 -05:00
|
|
|
if(display_help .or. nstat.lt.0 .or. nremain.lt.1) then
|
|
|
|
print *, ''
|
|
|
|
print *, 'Usage: jt65 [OPTIONS] file1 [file2 ...]'
|
|
|
|
print *, ''
|
|
|
|
print *, ' JT65 decode pre-recorded .WAV file(s)'
|
|
|
|
print *, ''
|
|
|
|
print *, 'OPTIONS:'
|
|
|
|
print *, ''
|
|
|
|
do i = 1, size (long_options)
|
2015-12-29 18:52:55 -05:00
|
|
|
call long_options(i) % print (6)
|
2015-12-17 15:29:55 -05:00
|
|
|
end do
|
|
|
|
go to 999
|
|
|
|
endif
|
|
|
|
|
2015-12-29 18:52:55 -05:00
|
|
|
call init_timer ('timer.out')
|
2015-12-17 15:29:55 -05:00
|
|
|
call timer('jt65 ',0)
|
|
|
|
|
|
|
|
ndecoded=0
|
|
|
|
do ifile=noffset+1,noffset+nremain
|
|
|
|
nfa=nlow
|
|
|
|
nfb=nhigh
|
2015-12-17 18:21:38 -05:00
|
|
|
minsync=0
|
2015-12-17 15:29:55 -05:00
|
|
|
call get_command_argument(ifile,optarg,narglen)
|
|
|
|
infile=optarg(:narglen)
|
|
|
|
call timer('read ',0)
|
2016-01-02 09:29:02 -05:00
|
|
|
call wav%read (infile)
|
2015-12-17 15:29:55 -05:00
|
|
|
i1=index(infile,'.wav')
|
|
|
|
if( i1 .eq. 0 ) i1=index(infile,'.WAV')
|
|
|
|
read(infile(i1-4:i1-1),*,err=998) nutc
|
|
|
|
npts=52*12000
|
2016-01-02 09:29:02 -05:00
|
|
|
read(unit=wav%lun) id2(1:npts)
|
|
|
|
close(unit=wav%lun)
|
2015-12-17 15:29:55 -05:00
|
|
|
call timer('read ',1)
|
|
|
|
dd(1:npts)=id2(1:npts)
|
|
|
|
dd(npts+1:)=0.
|
2015-12-29 18:52:55 -05:00
|
|
|
call test(dd,nutc,nfa,nfb,nfqso,ntol,nsubmode, &
|
2016-01-09 10:01:41 -05:00
|
|
|
n2pass,nrobust,ntrials,naggressive,ndepth, &
|
2017-11-04 13:03:56 -04:00
|
|
|
mycall,hiscall,hisgrid,nexp_decode,nQSOProgress,ljt65apon)
|
2017-10-30 17:30:14 -04:00
|
|
|
! if(nft.gt.0) exit
|
2015-12-17 15:29:55 -05:00
|
|
|
enddo
|
|
|
|
|
|
|
|
call timer('jt65 ',1)
|
|
|
|
call timer('jt65 ',101)
|
2015-12-29 18:52:55 -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)
|
2015-12-17 15:29:55 -05:00
|
|
|
go to 999
|
|
|
|
|
|
|
|
998 print*,'Cannot read from file:'
|
|
|
|
print*,infile
|
|
|
|
|
2015-12-29 18:52:55 -05:00
|
|
|
999 continue
|
|
|
|
end program jt65
|