mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-11-03 21:40:52 -05:00 
			
		
		
		
	First cut at SNR estimate. Needs testing.
This commit is contained in:
		
							parent
							
								
									79c437f69a
								
							
						
					
					
						commit
						7d5fb03dea
					
				@ -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'
 | 
					   include 'fst280_params.f90'
 | 
				
			||||||
   complex cd(0:NN*nss-1)
 | 
					   complex cd(0:NN*nss-1)
 | 
				
			||||||
 | 
				
			|||||||
@ -44,6 +44,8 @@ contains
 | 
				
			|||||||
   real llr(280),llra(280),llrb(280),llrc(280),llrd(280)
 | 
					   real llr(280),llra(280),llrb(280),llrc(280),llrd(280)
 | 
				
			||||||
   real candidates(100,4)
 | 
					   real candidates(100,4)
 | 
				
			||||||
   real bitmetrics(328,4)
 | 
					   real bitmetrics(328,4)
 | 
				
			||||||
 | 
					   real s4(0:3,NN)
 | 
				
			||||||
 | 
					   integer itone(NN)
 | 
				
			||||||
   integer hmod
 | 
					   integer hmod
 | 
				
			||||||
   integer*1 apmask(280),cw(280)
 | 
					   integer*1 apmask(280),cw(280)
 | 
				
			||||||
   integer*1 hbits(328)
 | 
					   integer*1 hbits(328)
 | 
				
			||||||
@ -133,7 +135,7 @@ contains
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
! Get first approximation of candidate frequencies
 | 
					! Get first approximation of candidate frequencies
 | 
				
			||||||
   call get_candidates_fst280(c_bigfft,nfft1,nsps,hmod,fs,fa,fb,     &
 | 
					   call get_candidates_fst280(c_bigfft,nfft1,nsps,hmod,fs,fa,fb,     &
 | 
				
			||||||
        ncand,candidates)
 | 
					        ncand,candidates,base)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   ndecodes=0
 | 
					   ndecodes=0
 | 
				
			||||||
   decodes=' '
 | 
					   decodes=' '
 | 
				
			||||||
@ -249,10 +251,8 @@ contains
 | 
				
			|||||||
         is0=isbest+ioffset
 | 
					         is0=isbest+ioffset
 | 
				
			||||||
         if(is0.lt.0) cycle
 | 
					         if(is0.lt.0) cycle
 | 
				
			||||||
         cframe=c2(is0:is0+164*nss-1)
 | 
					         cframe=c2(is0:is0+164*nss-1)
 | 
				
			||||||
         s2=sum(cframe*conjg(cframe))
 | 
					 | 
				
			||||||
         cframe=cframe/sqrt(s2)
 | 
					 | 
				
			||||||
         bitmetrics=0
 | 
					         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
 | 
					         if(badsync) cycle
 | 
				
			||||||
 | 
					
 | 
				
			||||||
         hbits=0
 | 
					         hbits=0
 | 
				
			||||||
@ -319,6 +319,20 @@ contains
 | 
				
			|||||||
                  if(idupe.eq.1) exit
 | 
					                  if(idupe.eq.1) exit
 | 
				
			||||||
                  ndecodes=ndecodes+1
 | 
					                  ndecodes=ndecodes+1
 | 
				
			||||||
                  decodes(ndecodes)=msg
 | 
					                  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)
 | 
					                  nsnr=nint(xsnr)
 | 
				
			||||||
                  iaptype=0
 | 
					                  iaptype=0
 | 
				
			||||||
                  qual=0.
 | 
					                  qual=0.
 | 
				
			||||||
@ -433,7 +447,7 @@ contains
 | 
				
			|||||||
 end subroutine fst280_downsample
 | 
					 end subroutine fst280_downsample
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 subroutine get_candidates_fst280(c_bigfft,nfft1,nsps,hmod,fs,fa,fb,   &
 | 
					 subroutine get_candidates_fst280(c_bigfft,nfft1,nsps,hmod,fs,fa,fb,   &
 | 
				
			||||||
      ncand,candidates)
 | 
					      ncand,candidates,base)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
   complex c_bigfft(0:nfft1/2)
 | 
					   complex c_bigfft(0:nfft1/2)
 | 
				
			||||||
   integer hmod
 | 
					   integer hmod
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user