2018-07-10 15:32:59 -04:00
|
|
|
subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
|
2018-07-11 16:32:08 -04:00
|
|
|
napwid,lsubtract,nagain,iaptype,mycall12,hiscall12, &
|
2017-12-19 15:01:06 -05:00
|
|
|
sync0,f1,xdt,xbase,apsym,nharderrors,dmin,nbadcrc,ipass,iera,msg37,xsnr)
|
2017-06-19 16:15:43 -04:00
|
|
|
|
2017-12-08 12:03:11 -05:00
|
|
|
use crc
|
2017-06-30 16:11:07 -04:00
|
|
|
use timer_module, only: timer
|
2018-07-05 14:07:17 -04:00
|
|
|
use packjt77
|
2017-06-19 16:15:43 -04:00
|
|
|
include 'ft8_params.f90'
|
2018-01-30 10:25:10 -05:00
|
|
|
parameter(NP2=2812)
|
2018-07-03 16:34:39 -04:00
|
|
|
character*37 msg37,msgsent37
|
2018-01-30 10:25:10 -05:00
|
|
|
character*12 mycall12,hiscall12
|
2018-07-04 11:15:01 -04:00
|
|
|
character*77 c77
|
2018-07-11 16:32:08 -04:00
|
|
|
character*6 mycall6,hiscall6,c1,c2
|
2017-12-08 12:03:11 -05:00
|
|
|
character*87 cbits
|
2017-07-01 09:08:30 -04:00
|
|
|
real a(5)
|
2018-06-26 12:11:58 -04:00
|
|
|
real s8(0:7,NN)
|
|
|
|
real s2(0:511),s2l(0:511)
|
2018-07-28 18:32:45 -04:00
|
|
|
real bmeta(3*ND),bmetb(3*ND),bmetc(3*ND)
|
2018-06-26 12:11:58 -04:00
|
|
|
real bmetal(3*ND),bmetbl(3*ND),bmetcl(3*ND)
|
2018-06-22 12:20:28 -04:00
|
|
|
real llra(3*ND),llrb(3*ND),llrc(3*ND),llrd(3*ND) !Soft symbols
|
2018-06-26 12:11:58 -04:00
|
|
|
real llral(3*ND),llrbl(3*ND),llrcl(3*ND) !Soft symbols
|
2017-07-01 09:08:30 -04:00
|
|
|
real dd0(15*12000)
|
2018-06-17 13:11:32 -04:00
|
|
|
integer*1 message77(77),apmask(3*ND),cw(3*ND)
|
|
|
|
integer*1 msgbits(77)
|
|
|
|
integer apsym(77)
|
2018-07-28 18:32:45 -04:00
|
|
|
integer mcq(29),mrrr(19),m73(19),mrr73(19)
|
2017-07-01 09:08:30 -04:00
|
|
|
integer itone(NN)
|
2017-07-25 16:55:13 -04:00
|
|
|
integer icos7(0:6),ip(1)
|
2017-12-18 14:07:10 -05:00
|
|
|
integer nappasses(0:5) !Number of decoding passes to use for each QSO state
|
2017-07-27 11:35:40 -04:00
|
|
|
integer naptypes(0:5,4) ! (nQSOProgress, decoding pass) maximum of 4 passes for now
|
2017-12-22 13:00:47 -05:00
|
|
|
integer*1, target:: i1hiscall(12)
|
2018-06-27 10:55:34 -04:00
|
|
|
logical one(0:511,0:8)
|
2018-06-25 18:01:34 -04:00
|
|
|
integer graymap(0:7)
|
2018-06-30 15:56:19 -04:00
|
|
|
complex cd0(0:3199)
|
2017-07-01 09:08:30 -04:00
|
|
|
complex ctwk(32)
|
|
|
|
complex csymb(32)
|
2018-06-22 12:20:28 -04:00
|
|
|
complex cs(0:7,NN)
|
2017-12-03 19:46:19 -05:00
|
|
|
logical first,newdat,lsubtract,lapon,lapcqonly,nagain
|
2018-06-05 17:37:29 -04:00
|
|
|
data icos7/3,1,4,0,6,5,2/ ! Flipped w.r.t. original FT8 sync array
|
2018-07-28 18:32:45 -04:00
|
|
|
data mcq/0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0/
|
|
|
|
data mrrr/0,1,1,1,1,1,1,0,1,0,0,1,0,0,1,0,0,0,1/
|
|
|
|
data m73/0,1,1,1,1,1,1,0,1,0,0,1,0,1,0,0,0,0,1/
|
|
|
|
data mrr73/0,1,1,1,1,1,1,0,0,1,1,1,0,1,0,1,0,0,1/
|
2017-07-27 11:35:40 -04:00
|
|
|
data first/.true./
|
2018-07-07 09:18:31 -04:00
|
|
|
data graymap/0,1,3,2,5,6,4,7/
|
2018-06-27 10:55:34 -04:00
|
|
|
save nappasses,naptypes,one
|
2017-07-27 11:35:40 -04:00
|
|
|
|
|
|
|
if(first) then
|
|
|
|
mcq=2*mcq-1
|
|
|
|
mrrr=2*mrrr-1
|
|
|
|
m73=2*m73-1
|
|
|
|
mrr73=2*mrr73-1
|
|
|
|
nappasses(0)=2
|
|
|
|
nappasses(1)=2
|
|
|
|
nappasses(2)=2
|
|
|
|
nappasses(3)=4
|
|
|
|
nappasses(4)=4
|
|
|
|
nappasses(5)=3
|
|
|
|
|
|
|
|
! iaptype
|
|
|
|
!------------------------
|
2018-07-28 18:32:45 -04:00
|
|
|
! 1 CQ ??? ??? (29+3=32 ap bits)
|
|
|
|
! 2 MyCall ??? ??? (29+3=32 ap bits)
|
|
|
|
! 3 MyCall DxCall ??? (58+3=61 ap bits)
|
|
|
|
! 4 MyCall DxCall RRR (77 ap bits)
|
|
|
|
! 5 MyCall DxCall 73 (77 ap bits)
|
|
|
|
! 6 MyCall DxCall RR73 (77 ap bits)
|
2017-07-27 11:35:40 -04:00
|
|
|
|
2017-08-03 10:46:21 -04:00
|
|
|
naptypes(0,1:4)=(/1,2,0,0/)
|
|
|
|
naptypes(1,1:4)=(/2,3,0,0/)
|
|
|
|
naptypes(2,1:4)=(/2,3,0,0/)
|
|
|
|
naptypes(3,1:4)=(/3,4,5,6/)
|
|
|
|
naptypes(4,1:4)=(/3,4,5,6/)
|
2017-12-03 19:46:19 -05:00
|
|
|
naptypes(5,1:4)=(/3,1,2,0/)
|
2018-06-25 18:01:34 -04:00
|
|
|
|
2018-06-27 10:55:34 -04:00
|
|
|
one=.false.
|
2018-06-25 18:01:34 -04:00
|
|
|
do i=0,511
|
|
|
|
do j=0,8
|
2018-06-27 16:11:39 -04:00
|
|
|
if(iand(i,2**j).ne.0) one(i,j)=.true.
|
2018-06-25 18:01:34 -04:00
|
|
|
enddo
|
|
|
|
enddo
|
2017-07-27 11:35:40 -04:00
|
|
|
first=.false.
|
|
|
|
endif
|
2017-07-21 23:01:09 -04:00
|
|
|
|
2017-07-12 17:49:39 -04:00
|
|
|
max_iterations=30
|
|
|
|
nharderrors=-1
|
2018-06-17 13:11:32 -04:00
|
|
|
nbadcrc=1 ! this is used upstream to flag good decodes.
|
2017-07-06 10:19:39 -04:00
|
|
|
fs2=12000.0/NDOWN
|
2017-07-06 08:07:17 -04:00
|
|
|
dt2=1.0/fs2
|
|
|
|
twopi=8.0*atan(1.0)
|
|
|
|
delfbest=0.
|
|
|
|
ibest=0
|
|
|
|
|
2017-07-01 16:47:59 -04:00
|
|
|
call timer('ft8_down',0)
|
2017-07-06 08:07:17 -04:00
|
|
|
call ft8_downsample(dd0,newdat,f1,cd0) !Mix f1 to baseband and downsample
|
2017-07-01 16:47:59 -04:00
|
|
|
call timer('ft8_down',1)
|
2017-06-19 16:15:43 -04:00
|
|
|
|
2017-07-27 14:07:54 -04:00
|
|
|
i0=nint((xdt+0.5)*fs2) !Initial guess for start of signal
|
2017-07-01 09:08:30 -04:00
|
|
|
smax=0.0
|
2017-07-27 14:07:54 -04:00
|
|
|
do idt=i0-8,i0+8 !Search over +/- one quarter symbol
|
2018-06-05 17:37:29 -04:00
|
|
|
call sync8d(cd0,idt,ctwk,0,2,sync)
|
2017-07-06 08:07:17 -04:00
|
|
|
if(sync.gt.smax) then
|
|
|
|
smax=sync
|
|
|
|
ibest=idt
|
|
|
|
endif
|
2017-07-01 09:08:30 -04:00
|
|
|
enddo
|
2017-07-06 08:07:17 -04:00
|
|
|
xdt2=ibest*dt2 !Improved estimate for DT
|
2017-07-01 09:08:30 -04:00
|
|
|
|
2017-07-06 08:07:17 -04:00
|
|
|
! Now peak up in frequency
|
|
|
|
i0=nint(xdt2*fs2)
|
2017-07-01 09:08:30 -04:00
|
|
|
smax=0.0
|
2017-07-06 08:07:17 -04:00
|
|
|
do ifr=-5,5 !Search over +/- 2.5 Hz
|
2017-07-01 09:08:30 -04:00
|
|
|
delf=ifr*0.5
|
|
|
|
dphi=twopi*delf*dt2
|
|
|
|
phi=0.0
|
|
|
|
do i=1,32
|
|
|
|
ctwk(i)=cmplx(cos(phi),sin(phi))
|
|
|
|
phi=mod(phi+dphi,twopi)
|
|
|
|
enddo
|
2018-06-05 17:37:29 -04:00
|
|
|
call sync8d(cd0,i0,ctwk,1,2,sync)
|
2017-07-01 09:08:30 -04:00
|
|
|
if( sync .gt. smax ) then
|
|
|
|
smax=sync
|
|
|
|
delfbest=delf
|
|
|
|
endif
|
|
|
|
enddo
|
|
|
|
a=0.0
|
|
|
|
a(1)=-delfbest
|
|
|
|
call twkfreq1(cd0,NP2,fs2,a,cd0)
|
|
|
|
xdt=xdt2
|
2017-07-06 08:07:17 -04:00
|
|
|
f1=f1+delfbest !Improved estimate of DF
|
2018-06-30 15:56:19 -04:00
|
|
|
call sync8d(cd0,i0,ctwk,0,2,sync)
|
2017-06-19 16:15:43 -04:00
|
|
|
|
2017-06-27 15:44:12 -04:00
|
|
|
do k=1,NN
|
2017-07-01 09:08:30 -04:00
|
|
|
i1=ibest+(k-1)*32
|
2017-07-01 09:45:16 -04:00
|
|
|
csymb=cmplx(0.0,0.0)
|
2018-06-30 15:56:19 -04:00
|
|
|
if( i1.ge.0 .and. i1+31 .le. NP2-1 ) csymb=cd0(i1:i1+31)
|
2017-07-01 09:08:30 -04:00
|
|
|
call four2a(csymb,32,1,-1,1)
|
2018-06-26 12:11:58 -04:00
|
|
|
cs(0:7,k)=csymb(1:8)/1e3
|
|
|
|
s8(0:7,k)=abs(csymb(1:8))
|
2017-07-01 09:08:30 -04:00
|
|
|
enddo
|
2017-07-26 09:05:34 -04:00
|
|
|
|
2017-07-25 16:55:13 -04:00
|
|
|
! sync quality check
|
|
|
|
is1=0
|
|
|
|
is2=0
|
|
|
|
is3=0
|
|
|
|
do k=1,7
|
2018-06-22 12:20:28 -04:00
|
|
|
ip=maxloc(s8(:,k))
|
2017-07-25 16:55:13 -04:00
|
|
|
if(icos7(k-1).eq.(ip(1)-1)) is1=is1+1
|
2018-06-22 12:20:28 -04:00
|
|
|
ip=maxloc(s8(:,k+36))
|
2017-07-25 16:55:13 -04:00
|
|
|
if(icos7(k-1).eq.(ip(1)-1)) is2=is2+1
|
2018-06-22 12:20:28 -04:00
|
|
|
ip=maxloc(s8(:,k+72))
|
2017-07-25 16:55:13 -04:00
|
|
|
if(icos7(k-1).eq.(ip(1)-1)) is3=is3+1
|
|
|
|
enddo
|
|
|
|
! hard sync sum - max is 21
|
|
|
|
nsync=is1+is2+is3
|
|
|
|
if(nsync .le. 6) then ! bail out
|
|
|
|
nbadcrc=1
|
|
|
|
return
|
|
|
|
endif
|
2017-07-26 09:05:34 -04:00
|
|
|
|
2018-06-26 12:11:58 -04:00
|
|
|
do nsym=1,3
|
|
|
|
nt=2**(3*nsym)
|
|
|
|
do ihalf=1,2
|
|
|
|
do k=1,29,nsym
|
|
|
|
if(ihalf.eq.1) ks=k+7
|
|
|
|
if(ihalf.eq.2) ks=k+43
|
|
|
|
amax=-1.0
|
|
|
|
do i=0,nt-1
|
|
|
|
i1=i/64
|
|
|
|
i2=iand(i,63)/8
|
|
|
|
i3=iand(i,7)
|
|
|
|
if(nsym.eq.1) then
|
|
|
|
s2(i)=abs(cs(graymap(i3),ks))
|
|
|
|
elseif(nsym.eq.2) then
|
|
|
|
s2(i)=abs(cs(graymap(i2),ks)+cs(graymap(i3),ks+1))
|
|
|
|
elseif(nsym.eq.3) then
|
|
|
|
s2(i)=abs(cs(graymap(i1),ks)+cs(graymap(i2),ks+1)+cs(graymap(i3),ks+2))
|
|
|
|
else
|
|
|
|
print*,"Error - nsym must be 1, 2, or 3."
|
|
|
|
endif
|
|
|
|
enddo
|
2018-06-27 16:11:39 -04:00
|
|
|
s2l(0:nt-1)=log(s2(0:nt-1)+1e-32)
|
2018-06-26 12:11:58 -04:00
|
|
|
i32=1+(k-1)*3+(ihalf-1)*87
|
2018-06-27 16:11:39 -04:00
|
|
|
if(nsym.eq.1) ibmax=2
|
|
|
|
if(nsym.eq.2) ibmax=5
|
|
|
|
if(nsym.eq.3) ibmax=8
|
|
|
|
do ib=0,ibmax
|
|
|
|
bm=maxval(s2(0:nt-1),one(0:nt-1,ibmax-ib)) - &
|
|
|
|
maxval(s2(0:nt-1),.not.one(0:nt-1,ibmax-ib))
|
2018-07-28 18:32:45 -04:00
|
|
|
! bml=maxval(s2l(0:nt-1),one(0:nt-1,ibmax-ib)) - &
|
|
|
|
! maxval(s2l(0:nt-1),.not.one(0:nt-1,ibmax-ib))
|
2018-06-27 16:11:39 -04:00
|
|
|
if(i32+ib .gt.174) cycle
|
|
|
|
if(nsym.eq.1) then
|
|
|
|
bmeta(i32+ib)=bm
|
2018-07-28 18:32:45 -04:00
|
|
|
! bmetal(i32+ib)=bml
|
2018-06-27 16:11:39 -04:00
|
|
|
elseif(nsym.eq.2) then
|
|
|
|
bmetb(i32+ib)=bm
|
2018-07-28 18:32:45 -04:00
|
|
|
! bmetbl(i32+ib)=bml
|
2018-06-27 16:11:39 -04:00
|
|
|
elseif(nsym.eq.3) then
|
|
|
|
bmetc(i32+ib)=bm
|
2018-07-28 18:32:45 -04:00
|
|
|
! bmetcl(i32+ib)=bml
|
2018-06-27 16:11:39 -04:00
|
|
|
endif
|
|
|
|
enddo
|
2018-06-22 12:20:28 -04:00
|
|
|
enddo
|
|
|
|
enddo
|
|
|
|
enddo
|
2017-08-21 20:14:51 -04:00
|
|
|
call normalizebmet(bmeta,3*ND)
|
2018-07-28 18:32:45 -04:00
|
|
|
! call normalizebmet(bmetal,3*ND)
|
2017-09-17 11:34:32 -04:00
|
|
|
call normalizebmet(bmetb,3*ND)
|
2018-07-28 18:32:45 -04:00
|
|
|
! call normalizebmet(bmetbl,3*ND)
|
2018-06-22 12:20:28 -04:00
|
|
|
call normalizebmet(bmetc,3*ND)
|
2018-07-28 18:32:45 -04:00
|
|
|
! call normalizebmet(bmetcl,3*ND)
|
2017-07-15 10:21:18 -04:00
|
|
|
|
2017-09-17 11:34:32 -04:00
|
|
|
scalefac=2.83
|
2018-06-11 16:10:44 -04:00
|
|
|
llra=scalefac*bmeta
|
2018-07-28 18:32:45 -04:00
|
|
|
! llral=scalefac*bmetal
|
2018-06-11 16:10:44 -04:00
|
|
|
llrb=scalefac*bmetb
|
2018-07-28 18:32:45 -04:00
|
|
|
! llrbl=scalefac*bmetbl
|
2018-06-22 12:20:28 -04:00
|
|
|
llrc=scalefac*bmetc
|
2018-07-28 18:32:45 -04:00
|
|
|
! llrcl=scalefac*bmetcl
|
2018-06-26 12:11:58 -04:00
|
|
|
|
2018-07-28 18:32:45 -04:00
|
|
|
apmag=maxval(abs(llrb))*1.01
|
2017-07-14 12:02:01 -04:00
|
|
|
|
2017-07-27 11:35:40 -04:00
|
|
|
! pass #
|
|
|
|
!------------------------------
|
2018-07-28 18:32:45 -04:00
|
|
|
! 1 regular decoding, nsym=1
|
|
|
|
! 2 regular decoding, nsym=2
|
|
|
|
! 3 regular decoding, nsym=3
|
|
|
|
! 4 ap pass 1, nsym=2 (for now?)
|
2017-07-27 11:35:40 -04:00
|
|
|
! 5 ap pass 2
|
|
|
|
! 6 ap pass 3
|
2018-07-28 18:32:45 -04:00
|
|
|
! 7 ap pass 4
|
2017-07-27 11:35:40 -04:00
|
|
|
|
2017-07-27 14:07:54 -04:00
|
|
|
if(lapon) then
|
2017-12-03 19:46:19 -05:00
|
|
|
if(.not.lapcqonly) then
|
2018-07-28 18:32:45 -04:00
|
|
|
npasses=3+nappasses(nQSOProgress)
|
2017-12-03 19:46:19 -05:00
|
|
|
else
|
2018-07-28 18:32:45 -04:00
|
|
|
npasses=4
|
2017-12-03 19:46:19 -05:00
|
|
|
endif
|
2017-07-27 14:07:54 -04:00
|
|
|
else
|
2018-07-28 18:32:45 -04:00
|
|
|
npasses=3
|
2017-07-27 14:07:54 -04:00
|
|
|
endif
|
|
|
|
|
2018-07-28 18:32:45 -04:00
|
|
|
do ipass=1,npasses
|
2018-06-11 16:10:44 -04:00
|
|
|
llrd=llra
|
|
|
|
if(ipass.eq.2) llrd=llrb
|
2018-06-22 12:20:28 -04:00
|
|
|
if(ipass.eq.3) llrd=llrc
|
2018-07-28 18:32:45 -04:00
|
|
|
if(ipass.le.3) then
|
2017-07-27 11:35:40 -04:00
|
|
|
apmask=0
|
|
|
|
iaptype=0
|
|
|
|
endif
|
2018-07-04 17:20:12 -04:00
|
|
|
|
2018-07-28 18:32:45 -04:00
|
|
|
if(ipass .gt. 3) then
|
|
|
|
llrd=llrb ! Needs to be checked
|
|
|
|
if(.not.lapcqonly) then
|
|
|
|
iaptype=naptypes(nQSOProgress,ipass-3)
|
|
|
|
else
|
|
|
|
iaptype=1
|
|
|
|
endif
|
|
|
|
if(iaptype.ge.3 .and. (abs(f1-nfqso).gt.napwid .and. abs(f1-nftx).gt.napwid) ) cycle
|
|
|
|
if(iaptype.eq.1 .or. iaptype.eq.2 ) then ! AP,???,???
|
|
|
|
apmask=0
|
|
|
|
apmask(1:29)=1
|
|
|
|
apmask(75:77)=1
|
|
|
|
llrd(75:77)=apmag*apsym(75:77)
|
|
|
|
if(iaptype.eq.1) llrd(1:29)=apmag*mcq(1:29)
|
|
|
|
if(iaptype.eq.2) llrd(1:29)=apmag*apsym(1:29)
|
|
|
|
endif
|
|
|
|
if(iaptype.eq.3) then ! mycall, dxcall, ???
|
|
|
|
apmask=0
|
|
|
|
apmask(1:56)=1
|
|
|
|
apmask(75:77)=1
|
|
|
|
llrd(1:56)=apmag*apsym(1:56)
|
|
|
|
llrd(75:77)=apmag*apsym(75:77)
|
|
|
|
endif
|
|
|
|
if(iaptype.eq.4 .or. iaptype.eq.5 .or. iaptype.eq.6) then
|
|
|
|
apmask=0
|
|
|
|
apmask(1:77)=1 ! mycall, hiscall, RRR|73|RR73
|
|
|
|
llrd(1:58)=apmag*apsym(1:58)
|
|
|
|
if(iaptype.eq.4) llrd(59:77)=apmag*mrrr
|
|
|
|
if(iaptype.eq.5) llrd(59:77)=apmag*m73
|
|
|
|
if(iaptype.eq.6) llrd(59:77)=apmag*mrr73
|
|
|
|
endif
|
|
|
|
if(iaptype.eq.7) then ! ???, dxcall, ???
|
|
|
|
apmask=0
|
|
|
|
apmask(30:58)=1 ! hiscall
|
|
|
|
apmask(75:77)=1
|
|
|
|
llrd(30:58)=apmag*apsym(30:58)
|
|
|
|
llrd(75:77)=apmag*apsym(75:77)
|
|
|
|
endif
|
|
|
|
endif
|
2017-07-27 11:35:40 -04:00
|
|
|
|
|
|
|
cw=0
|
2018-06-05 17:37:29 -04:00
|
|
|
call timer('bpd174_91 ',0)
|
2018-06-17 13:11:32 -04:00
|
|
|
call bpdecode174_91(llrd,apmask,max_iterations,message77,cw,nharderrors, &
|
2017-07-27 11:35:40 -04:00
|
|
|
niterations)
|
2018-06-05 17:37:29 -04:00
|
|
|
call timer('bpd174_91 ',1)
|
2017-07-27 11:35:40 -04:00
|
|
|
dmin=0.0
|
|
|
|
if(ndepth.eq.3 .and. nharderrors.lt.0) then
|
2017-08-21 20:14:51 -04:00
|
|
|
ndeep=3
|
2017-07-27 11:35:40 -04:00
|
|
|
if(abs(nfqso-f1).le.napwid .or. abs(nftx-f1).le.napwid) then
|
2017-09-17 11:34:32 -04:00
|
|
|
if((ipass.eq.3 .or. ipass.eq.4) .and. .not.nagain) then
|
2017-08-21 20:14:51 -04:00
|
|
|
ndeep=3
|
2017-08-12 21:35:13 -04:00
|
|
|
else
|
2017-08-21 20:14:51 -04:00
|
|
|
ndeep=4
|
2017-07-27 11:35:40 -04:00
|
|
|
endif
|
2017-07-14 12:02:01 -04:00
|
|
|
endif
|
2017-08-21 20:14:51 -04:00
|
|
|
if(nagain) ndeep=5
|
2018-06-05 17:37:29 -04:00
|
|
|
call timer('osd174_91 ',0)
|
2018-06-17 13:11:32 -04:00
|
|
|
call osd174_91(llrd,apmask,ndeep,message77,cw,nharderrors,dmin)
|
2018-06-05 17:37:29 -04:00
|
|
|
call timer('osd174_91 ',1)
|
2017-07-27 11:35:40 -04:00
|
|
|
endif
|
2018-07-04 17:20:12 -04:00
|
|
|
|
2018-07-03 16:59:24 -04:00
|
|
|
msg37=' '
|
2017-07-27 11:35:40 -04:00
|
|
|
xsnr=-99.0
|
2018-07-08 09:29:12 -04:00
|
|
|
if(nharderrors.lt.0 .or. nharderrors.gt.36) cycle
|
2017-07-27 11:35:40 -04:00
|
|
|
if(count(cw.eq.0).eq.174) cycle !Reject the all-zero codeword
|
2018-07-04 11:15:01 -04:00
|
|
|
write(c77,'(77i1)') message77
|
|
|
|
read(c77(72:74),'(b3)') n3
|
|
|
|
read(c77(75:77),'(b3)') i3
|
2018-07-28 09:50:50 -04:00
|
|
|
if(i3.gt.4 .or. (i3.eq.0.and.n3.gt.5)) then
|
|
|
|
cycle
|
|
|
|
endif
|
2018-07-04 11:15:01 -04:00
|
|
|
call unpack77(c77,msg37)
|
2018-07-27 10:43:58 -04:00
|
|
|
if(index(msg37,'QU1RK').gt.0) then
|
|
|
|
cycle
|
|
|
|
endif
|
2018-07-28 09:50:50 -04:00
|
|
|
nbadcrc=0 ! If we get this far: valid codeword, valid (i3,n3), nonquirky message.
|
2018-07-11 16:32:08 -04:00
|
|
|
call genft8_174_91(msg37,i3,n3,msgsent37,msgbits,itone)
|
2018-07-02 17:13:27 -04:00
|
|
|
if(lsubtract) call subtractft8(dd0,itone,f1,xdt)
|
2018-06-17 13:11:32 -04:00
|
|
|
xsig=0.0
|
|
|
|
xnoi=0.0
|
|
|
|
do i=1,79
|
2018-06-22 12:20:28 -04:00
|
|
|
xsig=xsig+s8(itone(i),i)**2
|
2018-06-17 13:11:32 -04:00
|
|
|
ios=mod(itone(i)+4,7)
|
2018-06-22 12:20:28 -04:00
|
|
|
xnoi=xnoi+s8(ios,i)**2
|
2018-06-17 13:11:32 -04:00
|
|
|
enddo
|
2018-06-30 15:56:19 -04:00
|
|
|
|
2018-06-17 13:11:32 -04:00
|
|
|
xsnr=0.001
|
|
|
|
if(xnoi.gt.0 .and. xnoi.lt.xsig) xsnr=xsig/xnoi-1.0
|
|
|
|
xsnr=10.0*log10(xsnr)-27.0
|
2018-07-04 17:20:12 -04:00
|
|
|
! need to reconcile signal normalization between this routine and the old ft8b_1 so
|
|
|
|
! that SNRs come out the same.
|
2018-06-17 13:11:32 -04:00
|
|
|
xsnr2=db(xsig/xbase - 1.0) - 32.0
|
2018-07-04 17:58:24 -04:00
|
|
|
! if(.not.nagain) xsnr=xsnr2
|
2018-06-17 13:11:32 -04:00
|
|
|
if(xsnr .lt. -24.0) xsnr=-24.0
|
|
|
|
|
|
|
|
return
|
2017-07-08 10:06:48 -04:00
|
|
|
enddo
|
2017-06-19 16:15:43 -04:00
|
|
|
return
|
2018-06-05 17:37:29 -04:00
|
|
|
end subroutine ft8b_2
|
|
|
|
|
2018-06-11 16:10:44 -04:00
|
|
|
! This currently resides in ft8b_1.f90
|
2018-06-05 17:37:29 -04:00
|
|
|
!subroutine normalizebmet(bmet,n)
|
|
|
|
! real bmet(n)
|
|
|
|
!
|
|
|
|
! bmetav=sum(bmet)/real(n)
|
|
|
|
! bmet2av=sum(bmet*bmet)/real(n)
|
|
|
|
! var=bmet2av-bmetav*bmetav
|
|
|
|
! if( var .gt. 0.0 ) then
|
|
|
|
! bmetsig=sqrt(var)
|
|
|
|
! else
|
|
|
|
! bmetsig=sqrt(bmet2av)
|
|
|
|
! endif
|
|
|
|
! bmet=bmet/bmetsig
|
|
|
|
! return
|
|
|
|
!end subroutine normalizebmet
|
2017-08-21 20:14:51 -04:00
|
|
|
|
2017-09-17 11:34:32 -04:00
|
|
|
|