mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-03 16:01:18 -05:00
2c17544f3f
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/WSJT/trunk@1 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
64 lines
1.7 KiB
Fortran
64 lines
1.7 KiB
Fortran
subroutine demod64a(signal,nadd,mrsym,mrprob,
|
|
+ mr2sym,mr2prob)
|
|
|
|
C Demodulate the 64-bin spectra for each of 63 symbols in a frame.
|
|
|
|
C Parameters
|
|
C nadd number of spectra already summed
|
|
C mrsym most reliable symbol value
|
|
C mr2sym second most likely symbol value
|
|
C mrprob probability that mrsym was the transmitted value
|
|
C mr2prob probability that mr2sym was the transmitted value
|
|
|
|
implicit real*8 (a-h,o-z)
|
|
real*4 signal(64,63)
|
|
real*8 fs(64)
|
|
integer mrsym(63),mrprob(63),mr2sym(63),mr2prob(63)
|
|
real*4 p
|
|
common/tmp8/ p(64,63)
|
|
|
|
afac=1.1 * float(nadd)**0.64
|
|
scale=255.999
|
|
|
|
C Compute average spectral value
|
|
sum=0.
|
|
do j=1,63
|
|
do i=1,64
|
|
sum=sum+signal(i,j)
|
|
enddo
|
|
enddo
|
|
ave=sum/(64.*63.)
|
|
|
|
C Compute probabilities for most reliable symbol values
|
|
do j=1,63
|
|
s1=-1.e30
|
|
fsum=0.
|
|
do i=1,64
|
|
x=min(afac*signal(i,j)/ave,50.d0)
|
|
fs(i)=exp(x)
|
|
fsum=fsum+fs(i)
|
|
if(signal(i,j).gt.s1) then
|
|
s1=signal(i,j)
|
|
i1=i !Most reliable
|
|
endif
|
|
enddo
|
|
|
|
s2=-1.e30
|
|
do i=1,64
|
|
if(i.ne.i1 .and. signal(i,j).gt.s2) then
|
|
s2=signal(i,j)
|
|
i2=i !Second most reliable
|
|
endif
|
|
p(i,j)=log(fs(i)/fsum)
|
|
enddo
|
|
p1=fs(i1)/fsum !Normalized probabilities
|
|
p2=fs(i2)/fsum
|
|
mrsym(j)=i1-1
|
|
mr2sym(j)=i2-1
|
|
mrprob(j)=scale*p1
|
|
mr2prob(j)=scale*p2
|
|
enddo
|
|
|
|
return
|
|
end
|