First cut at SNR estimate. Needs testing.

This commit is contained in:
Steven Franke 2020-06-22 08:11:45 -05:00
parent 79c437f69a
commit 7d5fb03dea
2 changed files with 20 additions and 6 deletions

View File

@ -1,4 +1,4 @@
subroutine get_fst280_bitmetrics(cd,nss,hmod,nmax,bitmetrics,badsync)
subroutine get_fst280_bitmetrics(cd,nss,hmod,nmax,bitmetrics,s4,badsync)
include 'fst280_params.f90'
complex cd(0:NN*nss-1)

View File

@ -44,6 +44,8 @@ contains
real llr(280),llra(280),llrb(280),llrc(280),llrd(280)
real candidates(100,4)
real bitmetrics(328,4)
real s4(0:3,NN)
integer itone(NN)
integer hmod
integer*1 apmask(280),cw(280)
integer*1 hbits(328)
@ -133,7 +135,7 @@ contains
! Get first approximation of candidate frequencies
call get_candidates_fst280(c_bigfft,nfft1,nsps,hmod,fs,fa,fb, &
ncand,candidates)
ncand,candidates,base)
ndecodes=0
decodes=' '
@ -249,10 +251,8 @@ contains
is0=isbest+ioffset
if(is0.lt.0) cycle
cframe=c2(is0:is0+164*nss-1)
s2=sum(cframe*conjg(cframe))
cframe=cframe/sqrt(s2)
bitmetrics=0
call get_fst280_bitmetrics(cframe,nss,hmod,ntmax,bitmetrics,badsync)
call get_fst280_bitmetrics(cframe,nss,hmod,ntmax,bitmetrics,s4,badsync)
if(badsync) cycle
hbits=0
@ -319,6 +319,20 @@ contains
if(idupe.eq.1) exit
ndecodes=ndecodes+1
decodes(ndecodes)=msg
if(iwspr.eq.0) then
call get_fst280_tones_from_bits(message101,itone,iwspr)
xsig=0
do i=1,NN
xsig=xsig+s4(itone(i),i)**2
enddo
arg=400.0*(xsig/base)-1.0
if(arg.gt.0.0) then
xsnr=10*log10(arg)-21.0-11.7*log10(nsps/800.0)
else
xsnr=-99.9
endif
!write(*,*) xsig,base,arg,xsnr
endif
nsnr=nint(xsnr)
iaptype=0
qual=0.
@ -433,7 +447,7 @@ contains
end subroutine fst280_downsample
subroutine get_candidates_fst280(c_bigfft,nfft1,nsps,hmod,fs,fa,fb, &
ncand,candidates)
ncand,candidates,base)
complex c_bigfft(0:nfft1/2)
integer hmod