From 802f078386244fe5e30f63b7718c2a7912985f7c Mon Sep 17 00:00:00 2001 From: Steven Franke Date: Tue, 4 Aug 2020 09:15:44 -0500 Subject: [PATCH] Fix SNR calculation for B,C,D submodes. --- lib/fst4/get_fst4_bitmetrics.f90 | 2 +- lib/fst4/get_fst4_bitmetrics2.f90 | 11 ++++------- lib/fst4_decode.f90 | 2 +- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/lib/fst4/get_fst4_bitmetrics.f90 b/lib/fst4/get_fst4_bitmetrics.f90 index 125777568..9cf1e2470 100644 --- a/lib/fst4/get_fst4_bitmetrics.f90 +++ b/lib/fst4/get_fst4_bitmetrics.f90 @@ -52,7 +52,7 @@ subroutine get_fst4_bitmetrics(cd,nss,hmod,nmax,nhicoh,bitmetrics,s4,badsync) do itone=0,3 cs(itone,k)=sum(csymb*conjg(c1(:,itone))) enddo - s4(0:3,k)=abs(cs(0:3,k)) + s4(0:3,k)=abs(cs(0:3,k))**2 enddo ! Sync quality check diff --git a/lib/fst4/get_fst4_bitmetrics2.f90 b/lib/fst4/get_fst4_bitmetrics2.f90 index 6a669bd4c..9badef231 100644 --- a/lib/fst4/get_fst4_bitmetrics2.f90 +++ b/lib/fst4/get_fst4_bitmetrics2.f90 @@ -1,4 +1,4 @@ -subroutine get_fst4_bitmetrics2(cd,nss,hmod,nsizes,bitmetrics,s4hmod,badsync) +subroutine get_fst4_bitmetrics2(cd,nss,hmod,nsizes,bitmetrics,s4snr,badsync) include 'fst4_params.f90' complex cd(0:NN*nss-1) @@ -15,7 +15,7 @@ subroutine get_fst4_bitmetrics2(cd,nss,hmod,nsizes,bitmetrics,s4hmod,badsync) logical badsync real bitmetrics(2*NN,4) real s2(0:65535) - real s4(0:3,NN,4),s4hmod(0:3,NN) + real s4(0:3,NN,4),s4snr(0:3,NN) data isyncword1/0,1,3,2,1,0,2,3/ data isyncword2/2,3,1,0,3,2,0,1/ data graymap/0,1,3,2/ @@ -121,11 +121,8 @@ subroutine get_fst4_bitmetrics2(cd,nss,hmod,nsizes,bitmetrics,s4hmod,badsync) call normalizebmet(bitmetrics(:,3),2*NN) call normalizebmet(bitmetrics(:,4),2*NN) -! Return the s4 array corresponding to N=1/hmod. Will be used for SNR calculation - if(hmod.eq.1) s4hmod(:,:)=s4(:,:,1) - if(hmod.eq.2) s4hmod(:,:)=s4(:,:,2) - if(hmod.eq.4) s4hmod(:,:)=s4(:,:,3) - if(hmod.eq.8) s4hmod(:,:)=s4(:,:,4) +! Return the s4 array corresponding to N=1. Will be used for SNR calculation + s4snr(:,:)=s4(:,:,1) return end subroutine get_fst4_bitmetrics2 diff --git a/lib/fst4_decode.f90 b/lib/fst4_decode.f90 index caf9a4b4f..72041bc3f 100644 --- a/lib/fst4_decode.f90 +++ b/lib/fst4_decode.f90 @@ -550,7 +550,7 @@ contains endif xsig=0 do i=1,NN - xsig=xsig+s4(itone(i),i)**2 + xsig=xsig+s4(itone(i),i) enddo arg=600.0*(xsig/base)-1.0 if(arg.gt.0.0) then