2015-11-17 20:28:12 -05:00
|
|
|
subroutine extract(s3,nadd,nqd,ntrials,naggressive,ndepth,ncount,nhist, &
|
|
|
|
decoded,ltext,nsf)
|
2014-12-02 19:06:54 -05:00
|
|
|
|
|
|
|
! Input:
|
|
|
|
! s3 64-point spectra for each of 63 data symbols
|
|
|
|
! nadd number of spectra summed into s3
|
2015-02-05 12:43:43 -05:00
|
|
|
! nqd 0/1 to indicate decode attempt at QSO frequency
|
2014-12-02 19:06:54 -05:00
|
|
|
|
|
|
|
! Output:
|
2015-04-22 13:48:03 -04:00
|
|
|
! ncount number of symbols requiring correction (-1 for no KV decode)
|
2014-12-02 19:06:54 -05:00
|
|
|
! nhist maximum number of identical symbol values
|
|
|
|
! decoded decoded message (if ncount >=0)
|
|
|
|
! ltext true if decoded message is free text
|
2015-11-17 20:28:12 -05:00
|
|
|
! nsf 0=no decode; 1=BM decode; 2=KV decode
|
2014-12-02 19:06:54 -05:00
|
|
|
|
|
|
|
use prog_args !shm_key, exe_dir, data_dir
|
2015-04-22 13:48:03 -04:00
|
|
|
use packjt
|
2014-12-02 19:06:54 -05:00
|
|
|
|
|
|
|
real s3(64,63)
|
|
|
|
character decoded*22
|
|
|
|
integer dat4(12)
|
|
|
|
integer mrsym(63),mr2sym(63),mrprob(63),mr2prob(63)
|
2015-11-17 20:28:12 -05:00
|
|
|
integer correct(63),tmp(63)
|
|
|
|
integer param(0:7)
|
|
|
|
integer indx(0:62)
|
|
|
|
real*8 tt
|
2014-12-02 19:06:54 -05:00
|
|
|
logical nokv,ltext
|
2015-11-17 20:28:12 -05:00
|
|
|
common/chansyms65/correct
|
2014-12-02 19:06:54 -05:00
|
|
|
data nokv/.false./,nsec1/0/
|
|
|
|
save
|
|
|
|
|
2015-11-17 20:28:12 -05:00
|
|
|
nbirdie=20
|
|
|
|
npct=50
|
|
|
|
afac1=1.1
|
|
|
|
nsf=0
|
2014-12-02 19:06:54 -05:00
|
|
|
nfail=0
|
|
|
|
decoded=' '
|
|
|
|
call pctile(s3,4032,npct,base)
|
|
|
|
s3=s3/base
|
|
|
|
! Get most reliable and second-most-reliable symbol values, and their
|
|
|
|
! probabilities
|
|
|
|
1 call demod64a(s3,nadd,afac1,mrsym,mrprob,mr2sym,mr2prob,ntest,nlow)
|
|
|
|
|
|
|
|
call chkhist(mrsym,nhist,ipk) !Test for birdies and QRM
|
|
|
|
if(nhist.ge.nbirdie) then
|
|
|
|
nfail=nfail+1
|
|
|
|
call pctile(s3,4032,npct,base)
|
|
|
|
s3(ipk,1:63)=base
|
|
|
|
if(nfail.gt.30) then
|
|
|
|
decoded=' '
|
|
|
|
ncount=-1
|
|
|
|
go to 900
|
|
|
|
endif
|
|
|
|
go to 1
|
|
|
|
endif
|
|
|
|
|
2015-04-22 13:48:03 -04:00
|
|
|
call graycode65(mrsym,63,-1) !Remove gray code
|
|
|
|
call interleave63(mrsym,-1) !Remove interleaving
|
2014-12-02 19:06:54 -05:00
|
|
|
call interleave63(mrprob,-1)
|
|
|
|
|
|
|
|
call graycode65(mr2sym,63,-1) !Remove gray code and interleaving
|
|
|
|
call interleave63(mr2sym,-1) !from second-most-reliable symbols
|
|
|
|
call interleave63(mr2prob,-1)
|
|
|
|
|
2015-11-24 10:05:45 -05:00
|
|
|
write(71) mrsym,mrprob,mr2sym,mr2prob
|
2015-11-17 20:28:12 -05:00
|
|
|
nverbose=0
|
|
|
|
ntry=0
|
|
|
|
call timer('sfrsd ',0)
|
|
|
|
call sfrsd2(mrsym,mrprob,mr2sym,mr2prob,ntrials,nverbose,correct, &
|
|
|
|
param,indx,tt,ntry)
|
|
|
|
call timer('sfrsd ',1)
|
|
|
|
ncandidates=param(0)
|
|
|
|
nhard=param(1)
|
|
|
|
nsoft=param(2)
|
|
|
|
nera=param(3)
|
|
|
|
ngmd=param(4)
|
|
|
|
ndone=ndone+1
|
|
|
|
do i=1,12
|
|
|
|
dat4(i)=correct(13-i)
|
|
|
|
enddo
|
|
|
|
|
|
|
|
ncount=-1
|
2014-12-02 19:06:54 -05:00
|
|
|
decoded=' '
|
|
|
|
ltext=.false.
|
2015-11-17 20:28:12 -05:00
|
|
|
if(nhard.ge.0) then
|
|
|
|
!turn the corrected symbol array into channel symbols for subtraction
|
|
|
|
!pass it back to jt65a via common block "chansyms65"
|
|
|
|
do i=1,63
|
|
|
|
tmp(i)=correct(64-i)
|
|
|
|
enddo
|
|
|
|
correct(1:63)=tmp(1:63)
|
|
|
|
call interleave63(correct,63,1)
|
|
|
|
call graycode65(correct,63,1)
|
2014-12-02 19:06:54 -05:00
|
|
|
call unpackmsg(dat4,decoded) !Unpack the user message
|
2015-11-17 20:28:12 -05:00
|
|
|
ncount=0
|
2014-12-02 19:06:54 -05:00
|
|
|
if(iand(dat4(10),8).ne.0) ltext=.true.
|
2015-11-17 20:28:12 -05:00
|
|
|
nsf=1
|
2014-12-02 19:06:54 -05:00
|
|
|
endif
|
2015-02-13 09:22:54 -05:00
|
|
|
900 continue
|
|
|
|
|
|
|
|
return
|
2014-12-02 19:06:54 -05:00
|
|
|
end subroutine extract
|
2015-11-17 20:28:12 -05:00
|
|
|
|