mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-11-03 21:40:52 -05:00 
			
		
		
		
	Code cleanup.
This commit is contained in:
		
							parent
							
								
									aff22a904d
								
							
						
					
					
						commit
						668631180d
					
				@ -197,9 +197,8 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
 | 
			
		||||
  if(params%nmode.eq.66) then
 | 
			
		||||
! We're in QRA66 mode
 | 
			
		||||
     call timer('decqra66',0)
 | 
			
		||||
     call my_qra66%decode(qra66_decoded,id2,params%nutc,params%nfa,         &
 | 
			
		||||
          params%nfb,params%nfqso,params%ndepth,logical(params%lapcqonly),  &
 | 
			
		||||
          mycall,hiscall,hisgrid)
 | 
			
		||||
     call my_qra66%decode(qra66_decoded,id2,params%nutc,params%nfqso,        &
 | 
			
		||||
          params%ntol,params%ndepth,mycall,hiscall,hisgrid)
 | 
			
		||||
     call timer('decqra66',1)
 | 
			
		||||
     go to 800
 | 
			
		||||
  endif
 | 
			
		||||
 | 
			
		||||
@ -28,7 +28,7 @@ module qra66_decode
 | 
			
		||||
 | 
			
		||||
contains
 | 
			
		||||
 | 
			
		||||
  subroutine decode(this,callback,iwave,nutc,nfa,nfb,nfqso,ndepth,lapdx,   &
 | 
			
		||||
  subroutine decode(this,callback,iwave,nutc,nfqso,ntol,ndepth,   &
 | 
			
		||||
       mycall,hiscall,hisgrid)
 | 
			
		||||
 | 
			
		||||
    use timer_module, only: timer
 | 
			
		||||
@ -41,12 +41,9 @@ contains
 | 
			
		||||
    character(len=6) :: hisgrid
 | 
			
		||||
    character*37 decoded
 | 
			
		||||
    integer*2 iwave(NFFT1)                 !Raw data
 | 
			
		||||
    integer ipk(1)
 | 
			
		||||
    integer dat4(12)
 | 
			
		||||
    logical lapdx,ltext
 | 
			
		||||
    complex c00(0:NFFT1-1)                 !Spectrum, then analytic signal
 | 
			
		||||
    complex c0(0:NFFT1-1)                  !Snalytic signal
 | 
			
		||||
    real s(900)
 | 
			
		||||
    complex c0(0:NFFT1-1)                  !Analytic signal, 6000 S/s
 | 
			
		||||
    real s3(-64:127,63)
 | 
			
		||||
    real a(5)
 | 
			
		||||
    data nc1z/-1/,nc2z/-1/,ng2z/-1/,maxaptypez/-1/
 | 
			
		||||
@ -67,12 +64,11 @@ contains
 | 
			
		||||
    b90=20.0                 !8 to 25 is OK; not very critical
 | 
			
		||||
    nFadingModel=1
 | 
			
		||||
 | 
			
		||||
! These probably need work:
 | 
			
		||||
! AP control could be done differently, but this works well:
 | 
			
		||||
    maxaptype=0
 | 
			
		||||
    if(ndepth.eq.2) maxaptype=3
 | 
			
		||||
    if(ndepth.eq.3) maxaptype=5
 | 
			
		||||
 | 
			
		||||
! Prime the decoder for possible AP decoding
 | 
			
		||||
    if(nc1.ne.nc1z .or. nc2.ne.nc2z .or. ng2.ne.ng2z .or.            &
 | 
			
		||||
         maxaptype.ne.maxaptypez) then
 | 
			
		||||
       do naptype=0,maxaptype
 | 
			
		||||
@ -87,30 +83,10 @@ contains
 | 
			
		||||
    endif
 | 
			
		||||
    naptype=maxaptype
 | 
			
		||||
 | 
			
		||||
! Compute the full-length spectrum
 | 
			
		||||
! Downsample to give complex data at 6000 S/s
 | 
			
		||||
    fac=2.0/NFFT1
 | 
			
		||||
    c0=fac*iwave
 | 
			
		||||
    call four2a(c0,NFFT1,1,-1,1)           !Forward c2c FFT
 | 
			
		||||
 | 
			
		||||
    nadd=101
 | 
			
		||||
    nh=nadd/2
 | 
			
		||||
    df2=nh*df1
 | 
			
		||||
    iz=3000.0/df2
 | 
			
		||||
    do i=1,iz                              !Compute smoothed spectrum
 | 
			
		||||
       s(i)=0.
 | 
			
		||||
       j0=nh*i
 | 
			
		||||
       do j=j0-nh,j0+nh
 | 
			
		||||
          s(i)=s(i) + real(c0(j))**2 + aimag(c0(j))**2
 | 
			
		||||
       enddo
 | 
			
		||||
    enddo
 | 
			
		||||
    call smo121(s,iz)
 | 
			
		||||
    ia=1450/df2
 | 
			
		||||
    ib=1550/df2
 | 
			
		||||
    s(:ia)=0.
 | 
			
		||||
    s(ib:)=0.
 | 
			
		||||
    ipk=maxloc(s)
 | 
			
		||||
    f0=df2*ipk(1) - 0.5*baud               !Candidate sync frequency
 | 
			
		||||
 | 
			
		||||
    c0(NFFT2/2+1:NFFT2)=0.                 !Zero the top half
 | 
			
		||||
    c0(0)=0.5*c0(0)
 | 
			
		||||
    call four2a(c0,nfft2,1,1,1)            !Inverse c2c FFT
 | 
			
		||||
@ -119,28 +95,27 @@ contains
 | 
			
		||||
    call sync66a(iwave,15*12000,nsps,nfqso,ntol,xdt,f0,snr1)
 | 
			
		||||
    jpk=(xdt+0.5)*6000 - 384               !### Empirical ###
 | 
			
		||||
    if(jpk.lt.0) jpk=0
 | 
			
		||||
    c00=c0
 | 
			
		||||
    a=0.
 | 
			
		||||
    a(1)=-(f0 + 2.0*baud)           !For sync66a
 | 
			
		||||
    call twkfreq(c00,c0,15*6000,6000.0,a)
 | 
			
		||||
    a(1)=-(f0 + 2.0*baud)                  !Data tones start 2 bins higher
 | 
			
		||||
    call twkfreq(c0,c0,15*6000,6000.0,a)
 | 
			
		||||
    xdt=jpk/6000.0 - 0.5
 | 
			
		||||
    call spec66(c0(jpk:jpk+85*NSPS/2-1),s3)
 | 
			
		||||
 | 
			
		||||
    do j=1,63
 | 
			
		||||
    do j=1,63                              !Normalize to symbol baseline
 | 
			
		||||
       call pctile(s3(:,j),192,40,base)
 | 
			
		||||
       s3(:,j)=s3(:,j)/base
 | 
			
		||||
    enddo
 | 
			
		||||
 | 
			
		||||
! Apply AGC
 | 
			
		||||
    s3max=20.0
 | 
			
		||||
    do j=1,63
 | 
			
		||||
    do j=1,63                              !Apply AGC to suppress pings
 | 
			
		||||
     xx=maxval(s3(-64:127,j))
 | 
			
		||||
     if(xx.gt.s3max) s3(-64:127,j)=s3(-64:127,j)*s3max/xx
 | 
			
		||||
    enddo
 | 
			
		||||
 | 
			
		||||
!Call Nico's QRA64 decoder
 | 
			
		||||
    call qra64_dec(s3,nc1,nc2,ng2,naptype,0,nSubmode,b90,      &
 | 
			
		||||
         nFadingModel,dat4,snr2,irc)
 | 
			
		||||
    snr2=snr2 + 6.0
 | 
			
		||||
    snr2=snr2 + 5.563                      !10*log(6912/1920)
 | 
			
		||||
    if(irc.gt.0) call badmsg(irc,dat4,nc1,nc2,ng2)
 | 
			
		||||
 | 
			
		||||
    decoded='                                     '
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user