mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-11-03 13:30:52 -05:00 
			
		
		
		
	Make changes to ft8b_2.f90 to accommodate the new 77-bit in/out encoding/decoding routines. With these changes, WSJT-X decodes (174,91) frames.
This commit is contained in:
		
							parent
							
								
									1a31e5b2d6
								
							
						
					
					
						commit
						3f8c218ebe
					
				@ -4,7 +4,6 @@ subroutine extractmessage77(decoded77,msgreceived)
 | 
				
			|||||||
  character*22 msgreceived
 | 
					  character*22 msgreceived
 | 
				
			||||||
  character*77 cbits
 | 
					  character*77 cbits
 | 
				
			||||||
  integer*1 decoded77(77)
 | 
					  integer*1 decoded77(77)
 | 
				
			||||||
  integer*1, target::  i1Dec8BitBytes(12)
 | 
					 | 
				
			||||||
  integer*4 i4Dec6BitWords(12)
 | 
					  integer*4 i4Dec6BitWords(12)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  write(cbits,'(77i1)') decoded77
 | 
					  write(cbits,'(77i1)') decoded77
 | 
				
			||||||
 | 
				
			|||||||
@ -16,11 +16,11 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly,   &
 | 
				
			|||||||
  real s1(0:7,ND),s2(0:7,NN),s1sort(8*ND)
 | 
					  real s1(0:7,ND),s2(0:7,NN),s1sort(8*ND)
 | 
				
			||||||
  real ps(0:7),psl(0:7)
 | 
					  real ps(0:7),psl(0:7)
 | 
				
			||||||
  real bmeta(3*ND),bmetb(3*ND),bmetap(3*ND)
 | 
					  real bmeta(3*ND),bmetb(3*ND),bmetap(3*ND)
 | 
				
			||||||
  real llr(3*ND),llra(3*ND),llrb(3*ND),llrd(3*ND)           !Soft symbols
 | 
					  real llra(3*ND),llrb(3*ND),llrd(3*ND)           !Soft symbols
 | 
				
			||||||
  real dd0(15*12000)
 | 
					  real dd0(15*12000)
 | 
				
			||||||
  integer*1 decoded(91),decoded0(91),apmask(3*ND),cw(3*ND)
 | 
					  integer*1 message77(77),apmask(3*ND),cw(3*ND)
 | 
				
			||||||
  integer*1 msgbits(91)
 | 
					  integer*1 msgbits(77)
 | 
				
			||||||
  integer apsym(91)
 | 
					  integer apsym(77)
 | 
				
			||||||
  integer mcq(28),mde(28),mrrr(16),m73(16),mrr73(16)
 | 
					  integer mcq(28),mde(28),mrrr(16),m73(16),mrr73(16)
 | 
				
			||||||
  integer itone(NN)
 | 
					  integer itone(NN)
 | 
				
			||||||
  integer indxs1(8*ND)
 | 
					  integer indxs1(8*ND)
 | 
				
			||||||
@ -42,9 +42,6 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly,   &
 | 
				
			|||||||
  data first/.true./
 | 
					  data first/.true./
 | 
				
			||||||
  save nappasses,naptypes
 | 
					  save nappasses,naptypes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
! All of the AP-related code in this routine needs to be re-written! AP decoding 
 | 
					 | 
				
			||||||
! passes are disabled for now.
 | 
					 | 
				
			||||||
!
 | 
					 | 
				
			||||||
  if(first) then
 | 
					  if(first) then
 | 
				
			||||||
     mcq=2*mcq-1
 | 
					     mcq=2*mcq-1
 | 
				
			||||||
     mde=2*mde-1
 | 
					     mde=2*mde-1
 | 
				
			||||||
@ -79,6 +76,7 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly,   &
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  max_iterations=30
 | 
					  max_iterations=30
 | 
				
			||||||
  nharderrors=-1
 | 
					  nharderrors=-1
 | 
				
			||||||
 | 
					  nbadcrc=1  ! this is used upstream to flag good decodes. 
 | 
				
			||||||
  fs2=12000.0/NDOWN
 | 
					  fs2=12000.0/NDOWN
 | 
				
			||||||
  dt2=1.0/fs2
 | 
					  dt2=1.0/fs2
 | 
				
			||||||
  twopi=8.0*atan(1.0)
 | 
					  twopi=8.0*atan(1.0)
 | 
				
			||||||
@ -265,7 +263,7 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly,   &
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
     cw=0
 | 
					     cw=0
 | 
				
			||||||
     call timer('bpd174_91 ',0)
 | 
					     call timer('bpd174_91 ',0)
 | 
				
			||||||
     call bpdecode174_91(llrd,apmask,max_iterations,decoded,cw,nharderrors,  &
 | 
					     call bpdecode174_91(llrd,apmask,max_iterations,message77,cw,nharderrors,  &
 | 
				
			||||||
          niterations)
 | 
					          niterations)
 | 
				
			||||||
     call timer('bpd174_91 ',1)
 | 
					     call timer('bpd174_91 ',1)
 | 
				
			||||||
     dmin=0.0
 | 
					     dmin=0.0
 | 
				
			||||||
@ -280,83 +278,70 @@ subroutine ft8b_2(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly,   &
 | 
				
			|||||||
        endif
 | 
					        endif
 | 
				
			||||||
        if(nagain) ndeep=5
 | 
					        if(nagain) ndeep=5
 | 
				
			||||||
        call timer('osd174_91 ',0)
 | 
					        call timer('osd174_91 ',0)
 | 
				
			||||||
        call osd174_91(llrd,apmask,ndeep,decoded,cw,nharderrors,dmin)
 | 
					        call osd174_91(llrd,apmask,ndeep,message77,cw,nharderrors,dmin)
 | 
				
			||||||
        call timer('osd174_91 ',1)
 | 
					        call timer('osd174_91 ',1)
 | 
				
			||||||
     endif
 | 
					     endif
 | 
				
			||||||
     nbadcrc=1
 | 
					 | 
				
			||||||
     message='                      '
 | 
					     message='                      '
 | 
				
			||||||
     xsnr=-99.0
 | 
					     xsnr=-99.0
 | 
				
			||||||
 | 
					     if(nharderrors.lt.0) cycle
 | 
				
			||||||
     if(count(cw.eq.0).eq.174) cycle           !Reject the all-zero codeword
 | 
					     if(count(cw.eq.0).eq.174) cycle           !Reject the all-zero codeword
 | 
				
			||||||
     if(nharderrors.ge.0 .and. nharderrors+dmin.lt.60.0 .and. &        
 | 
					     nbadcrc=0  ! If we get this far, must be a valid codeword.
 | 
				
			||||||
        .not.(sync.lt.2.0 .and. nharderrors.gt.35)      .and. &
 | 
					     i5bit=16*message77(73) + 8*message77(74) + 4*message77(75) + 2*message77(76) + message77(77)
 | 
				
			||||||
        .not.(ipass.gt.2 .and. nharderrors.gt.39)       .and. &
 | 
					     iFreeText=message77(57)
 | 
				
			||||||
        .not.(ipass.eq.4 .and. nharderrors.gt.30)             &
 | 
					     if(i5bit.eq.1) message77(57:)=0
 | 
				
			||||||
       ) then
 | 
					     call extractmessage77(message77,message)
 | 
				
			||||||
        call chkcrc14a(decoded,nbadcrc)
 | 
					! This needs fixing for messages with i5bit=1        
 | 
				
			||||||
     else
 | 
					     call genft8_174_91(message,mygrid6,bcontest,i5bit,msgsent,msgbits,itone)
 | 
				
			||||||
        nharderrors=-1
 | 
					     if(lsubtract) call subtractft8(dd0,itone,f1,xdt2)
 | 
				
			||||||
        cycle 
 | 
					     xsig=0.0
 | 
				
			||||||
     endif
 | 
					     xnoi=0.0
 | 
				
			||||||
     i5bit=16*decoded(73) + 8*decoded(74) + 4*decoded(75) + 2*decoded(76) + decoded(77)
 | 
					     do i=1,79
 | 
				
			||||||
     iFreeText=decoded(57)
 | 
					        xsig=xsig+s2(itone(i),i)**2
 | 
				
			||||||
     if(nbadcrc.eq.0) then
 | 
					        ios=mod(itone(i)+4,7)
 | 
				
			||||||
        decoded0=decoded
 | 
					        xnoi=xnoi+s2(ios,i)**2
 | 
				
			||||||
        if(i5bit.eq.1) decoded(57:)=0
 | 
					     enddo
 | 
				
			||||||
        call extractmessage174_91(decoded,message,ncrcflag)
 | 
					     xsnr=0.001
 | 
				
			||||||
        decoded=decoded0
 | 
					     if(xnoi.gt.0 .and. xnoi.lt.xsig) xsnr=xsig/xnoi-1.0
 | 
				
			||||||
! This needs fixing for messages with i5bit=1:        
 | 
					     xsnr=10.0*log10(xsnr)-27.0
 | 
				
			||||||
        call genft8_174_91(message,mygrid6,bcontest,i5bit,msgsent,msgbits,itone)
 | 
					     xsnr2=db(xsig/xbase - 1.0) - 32.0
 | 
				
			||||||
        if(lsubtract) call subtractft8(dd0,itone,f1,xdt2)
 | 
					     if(.not.nagain) xsnr=xsnr2
 | 
				
			||||||
        xsig=0.0
 | 
					     if(xsnr .lt. -24.0) xsnr=-24.0
 | 
				
			||||||
        xnoi=0.0
 | 
					     
 | 
				
			||||||
        do i=1,79
 | 
					     if(i5bit.eq.1) then
 | 
				
			||||||
           xsig=xsig+s2(itone(i),i)**2
 | 
					        do i=1,12
 | 
				
			||||||
           ios=mod(itone(i)+4,7)
 | 
					           i1hiscall(i)=ichar(hiscall12(i:i))
 | 
				
			||||||
           xnoi=xnoi+s2(ios,i)**2
 | 
					 | 
				
			||||||
        enddo
 | 
					        enddo
 | 
				
			||||||
        xsnr=0.001
 | 
					        icrc10=crc10(c_loc(i1hiscall),12)
 | 
				
			||||||
        if(xnoi.gt.0 .and. xnoi.lt.xsig) xsnr=xsig/xnoi-1.0
 | 
					        write(cbits,1001) decoded
 | 
				
			||||||
        xsnr=10.0*log10(xsnr)-27.0
 | 
					1001    format(87i1)
 | 
				
			||||||
        xsnr2=db(xsig/xbase - 1.0) - 32.0
 | 
					        read(cbits,1002) ncrc10,nrpt
 | 
				
			||||||
        if(.not.nagain) xsnr=xsnr2
 | 
					1002    format(56x,b10,b6)
 | 
				
			||||||
        if(xsnr .lt. -24.0) xsnr=-24.0
 | 
					        irpt=nrpt-30
 | 
				
			||||||
 | 
					        i1=index(message,' ')
 | 
				
			||||||
 | 
					        i2=index(message(i1+1:),' ') + i1
 | 
				
			||||||
 | 
					        c1=message(1:i1)//'   '
 | 
				
			||||||
 | 
					        c2=message(i1+1:i2)//'   '
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if(i5bit.eq.1) then
 | 
					        if(ncrc10.eq.icrc10) msg37=c1//' RR73; '//c2//' <'//      &
 | 
				
			||||||
           do i=1,12
 | 
					             trim(hiscall12)//'>    '
 | 
				
			||||||
              i1hiscall(i)=ichar(hiscall12(i:i))
 | 
					        if(ncrc10.ne.icrc10) msg37=c1//' RR73; '//c2//' <...>    '
 | 
				
			||||||
           enddo
 | 
					 | 
				
			||||||
           icrc10=crc10(c_loc(i1hiscall),12)
 | 
					 | 
				
			||||||
           write(cbits,1001) decoded
 | 
					 | 
				
			||||||
1001       format(87i1)
 | 
					 | 
				
			||||||
           read(cbits,1002) ncrc10,nrpt
 | 
					 | 
				
			||||||
1002       format(56x,b10,b6)
 | 
					 | 
				
			||||||
           irpt=nrpt-30
 | 
					 | 
				
			||||||
           i1=index(message,' ')
 | 
					 | 
				
			||||||
           i2=index(message(i1+1:),' ') + i1
 | 
					 | 
				
			||||||
           c1=message(1:i1)//'   '
 | 
					 | 
				
			||||||
           c2=message(i1+1:i2)//'   '
 | 
					 | 
				
			||||||
           
 | 
					           
 | 
				
			||||||
           if(ncrc10.eq.icrc10) msg37=c1//' RR73; '//c2//' <'//      &
 | 
					        msg37=c1//' RR73; '//c2//' <...>    '
 | 
				
			||||||
                trim(hiscall12)//'>    '
 | 
					        write(msg37(35:37),1010) irpt
 | 
				
			||||||
           if(ncrc10.ne.icrc10) msg37=c1//' RR73; '//c2//' <...>    '
 | 
					1010    format(i3.2)
 | 
				
			||||||
 | 
					        if(msg37(35:35).ne.'-') msg37(35:35)='+'
 | 
				
			||||||
           
 | 
					           
 | 
				
			||||||
!           msg37=c1//' RR73; '//c2//' <...>    '
 | 
					        iz=len(trim(msg37))
 | 
				
			||||||
           write(msg37(35:37),1010) irpt
 | 
					        do iter=1,10                           !Collapse multiple blanks
 | 
				
			||||||
1010       format(i3.2)
 | 
					           ib2=index(msg37(1:iz),'  ')
 | 
				
			||||||
           if(msg37(35:35).ne.'-') msg37(35:35)='+'
 | 
					           if(ib2.lt.1) exit
 | 
				
			||||||
           
 | 
					           msg37=msg37(1:ib2)//msg37(ib2+2:)
 | 
				
			||||||
           iz=len(trim(msg37))
 | 
					           iz=iz-1
 | 
				
			||||||
           do iter=1,10                           !Collapse multiple blanks
 | 
					        enddo
 | 
				
			||||||
              ib2=index(msg37(1:iz),'  ')
 | 
					     else
 | 
				
			||||||
              if(ib2.lt.1) exit
 | 
					        msg37=message//'               '
 | 
				
			||||||
              msg37=msg37(1:ib2)//msg37(ib2+2:)
 | 
					 | 
				
			||||||
              iz=iz-1
 | 
					 | 
				
			||||||
           enddo
 | 
					 | 
				
			||||||
        else
 | 
					 | 
				
			||||||
           msg37=message//'               '
 | 
					 | 
				
			||||||
        endif
 | 
					 | 
				
			||||||
        return
 | 
					 | 
				
			||||||
     endif
 | 
					     endif
 | 
				
			||||||
 | 
					     return
 | 
				
			||||||
  enddo
 | 
					  enddo
 | 
				
			||||||
  return
 | 
					  return
 | 
				
			||||||
end subroutine ft8b_2
 | 
					end subroutine ft8b_2
 | 
				
			||||||
 | 
				
			|||||||
@ -2,16 +2,14 @@ subroutine genft8_174_91(msg,mygrid,bcontest,i5bit,msgsent,msgbits,itone)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
! Encode an FT8 message, producing array itone().
 | 
					! Encode an FT8 message, producing array itone().
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  use crc
 | 
					 | 
				
			||||||
  use packjt
 | 
					  use packjt
 | 
				
			||||||
  include 'ft8_params.f90'
 | 
					  include 'ft8_params.f90'
 | 
				
			||||||
  character*22 msg,msgsent
 | 
					  character*22 msg,msgsent
 | 
				
			||||||
  character*6 mygrid
 | 
					  character*6 mygrid
 | 
				
			||||||
  character*91 cbits
 | 
					  character*91 cbits
 | 
				
			||||||
  logical bcontest,checksumok
 | 
					  logical bcontest
 | 
				
			||||||
  integer*4 i4Msg6BitWords(12)                !72-bit message as 6-bit words
 | 
					  integer*4 i4Msg6BitWords(12)                !72-bit message as 6-bit words
 | 
				
			||||||
  integer*1 msgbits(91),codeword(174)
 | 
					  integer*1 msgbits(77),codeword(174)
 | 
				
			||||||
  integer*1, target:: i1Msg8BitBytes(12)
 | 
					 | 
				
			||||||
  integer itone(79)
 | 
					  integer itone(79)
 | 
				
			||||||
  integer icos7(0:6)
 | 
					  integer icos7(0:6)
 | 
				
			||||||
  integer graymap(0:7)
 | 
					  integer graymap(0:7)
 | 
				
			||||||
@ -21,21 +19,8 @@ subroutine genft8_174_91(msg,mygrid,bcontest,i5bit,msgsent,msgbits,itone)
 | 
				
			|||||||
  call packmsg(msg,i4Msg6BitWords,itype,bcontest) !Pack into 12 6-bit bytes
 | 
					  call packmsg(msg,i4Msg6BitWords,itype,bcontest) !Pack into 12 6-bit bytes
 | 
				
			||||||
  call unpackmsg(i4Msg6BitWords,msgsent,bcontest,mygrid) !Unpack to get msgsent
 | 
					  call unpackmsg(i4Msg6BitWords,msgsent,bcontest,mygrid) !Unpack to get msgsent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  write(cbits,1000) i4Msg6BitWords,8*i5bit
 | 
					  write(cbits,'(12b6.6,b8.8)') i4Msg6BitWords,8*i5bit
 | 
				
			||||||
1000 format(12b6.6,b8.8)
 | 
					  read(cbits,'(77i1)') msgbits 
 | 
				
			||||||
  read(cbits,1001) i1Msg8BitBytes(1:10)
 | 
					 | 
				
			||||||
1001 format(10b8)
 | 
					 | 
				
			||||||
  i1Msg8BitBytes(10)=iand(i1Msg8BitBytes(10),128+64+32+16+8)
 | 
					 | 
				
			||||||
  i1Msg8BitBytes(11:12)=0
 | 
					 | 
				
			||||||
  icrc14=crc14(c_loc(i1Msg8BitBytes),12)
 | 
					 | 
				
			||||||
  i1Msg8BitBytes(11)=icrc14/256
 | 
					 | 
				
			||||||
  i1Msg8BitBytes(12)=iand (icrc14,255)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  write(cbits,1003) i4Msg6BitWords,i5bit,icrc14
 | 
					 | 
				
			||||||
1003 format(12b6.6,b5.5,b14.14)
 | 
					 | 
				
			||||||
  read(cbits,1004) msgbits
 | 
					 | 
				
			||||||
1004 format(91i1)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
  call encode174_91(msgbits,codeword)      !Encode the test message
 | 
					  call encode174_91(msgbits,codeword)      !Encode the test message
 | 
				
			||||||
 | 
					
 | 
				
			||||||
! Message structure: S7 D29 S7 D29 S7
 | 
					! Message structure: S7 D29 S7 D29 S7
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user