mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-10-31 04:50:34 -04:00 
			
		
		
		
	First bare-bones decoder for FT8.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7716 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									c14fd2b1e5
								
							
						
					
					
						commit
						44b4c180f6
					
				| @ -326,6 +326,7 @@ set (wsjt_FSRCS | ||||
|   lib/bpdecode144.f90 | ||||
|   lib/fsk4hf/bpdecode120.f90 | ||||
|   lib/fsk4hf/bpdecode168.f90 | ||||
|   lib/fsk4hf/bpdecode174.f90 | ||||
|   lib/fsk4hf/bpdecode300.f90 | ||||
|   lib/baddata.f90 | ||||
|   lib/ccf2.f90 | ||||
| @ -356,6 +357,7 @@ set (wsjt_FSRCS | ||||
|   lib/encode_msk144.f90 | ||||
|   lib/fsk4hf/encode120.f90 | ||||
|   lib/fsk4hf/encode168.f90 | ||||
|   lib/fsk4hf/encode174.f90 | ||||
|   lib/fsk4hf/encode300.f90 | ||||
|   lib/entail.f90 | ||||
|   lib/ephem.f90 | ||||
| @ -363,6 +365,7 @@ set (wsjt_FSRCS | ||||
|   lib/extract4.f90 | ||||
|   lib/extractmessage144.f90 | ||||
|   lib/fsk4hf/extractmessage168.f90 | ||||
|   lib/fsk4hf/extractmessage174.f90 | ||||
|   lib/fano232.f90 | ||||
|   lib/fast9.f90 | ||||
|   lib/fast_decode.f90 | ||||
| @ -387,6 +390,7 @@ set (wsjt_FSRCS | ||||
|   lib/fqso_first.f90 | ||||
|   lib/freqcal.f90 | ||||
|   lib/fsk4hf/fsk4hf.f90 | ||||
|   lib/fsk4hf/ft8d.f90 | ||||
|   lib/fsk4hf/ft8sim.f90 | ||||
|   lib/gen4.f90 | ||||
|   lib/gen65.f90 | ||||
| @ -428,6 +432,7 @@ set (wsjt_FSRCS | ||||
|   lib/ldpcsim144.f90 | ||||
|   lib/fsk4hf/ldpcsim120.f90 | ||||
|   lib/fsk4hf/ldpcsim168.f90 | ||||
|   lib/fsk4hf/ldpcsim174.f90 | ||||
|   lib/fsk4hf/ldpcsim300.f90 | ||||
|   lib/ldpcsim40.f90 | ||||
|   lib/libration.f90 | ||||
| @ -455,6 +460,7 @@ set (wsjt_FSRCS | ||||
|   lib/mskrtd.f90 | ||||
|   lib/fsk4hf/msksoftsym.f90 | ||||
|   lib/fsk4hf/msksoftsymw.f90 | ||||
|   lib/fsk4hf/osd174.f90 | ||||
|   lib/fsk4hf/osd300.f90 | ||||
|   lib/pctile.f90 | ||||
|   lib/peakdt9.f90 | ||||
| @ -492,6 +498,7 @@ set (wsjt_FSRCS | ||||
|   lib/sync4.f90 | ||||
|   lib/sync64.f90 | ||||
|   lib/sync65.f90 | ||||
|   lib/fsk4hf/sync8.f90 | ||||
|   lib/sync9.f90 | ||||
|   lib/sync9f.f90 | ||||
|   lib/sync9w.f90 | ||||
| @ -1149,6 +1156,9 @@ target_link_libraries (ldpcsim168 wsjt_fort wsjt_cxx) | ||||
| add_executable (fsk4hf lib/fsk4hf/fsk4hf.f90 wsjtx.rc) | ||||
| target_link_libraries (fsk4hf wsjt_fort wsjt_cxx) | ||||
| 
 | ||||
| add_executable (ft8d lib/fsk4hf/ft8d.f90 wsjtx.rc) | ||||
| target_link_libraries (ft8d wsjt_fort wsjt_cxx) | ||||
| 
 | ||||
| add_executable (ft8sim lib/fsk4hf/ft8sim.f90 wsjtx.rc) | ||||
| target_link_libraries (ft8sim wsjt_fort wsjt_cxx) | ||||
| 
 | ||||
|  | ||||
| @ -26,7 +26,8 @@ subroutine extractmessage174(decoded,msgreceived,ncrcflag,recent_calls,nrecent) | ||||
|   i1Dec8BitBytes(11)=decoded(80)*128+decoded(81)*64+decoded(82)*2*32+decoded(83)*16 | ||||
|   i1Dec8BitBytes(11)=i1Dec8BitBytes(11)+decoded(84)*8+decoded(85)*4+decoded(86)*2+decoded(87) | ||||
| 
 | ||||
|   if( crc12_check(c_loc (i1Dec8BitBytes), 11) ) then | ||||
| !  if( crc12_check(c_loc (i1Dec8BitBytes), 11) ) then | ||||
|   if(.true.) then    !### TEST ### | ||||
| ! CRC12 checks out --- unpack 72-bit message | ||||
|     do ibyte=1,12 | ||||
|       itmp=0 | ||||
|  | ||||
| @ -1,10 +1,11 @@ | ||||
| ! LDPC (168,84) code | ||||
| parameter (KK=84)                     !Information bits (72 + CRC12) | ||||
| parameter (ND=56)                     !Data symbols | ||||
| ! LDPC (174,87) code | ||||
| parameter (KK=87)                     !Information bits (75 + CRC12) | ||||
| parameter (ND=58)                     !Data symbols | ||||
| parameter (NS=21)                     !Sync symbols (3 @ Costas 7x7) | ||||
| parameter (NN=NS+ND)                  !Total symbols (77) | ||||
| parameter (NN=NS+ND)                  !Total symbols (79) | ||||
| parameter (NSPS=2048)                 !Samples per symbol at 12000 S/s | ||||
| parameter (N7=7*NSPS)                 !Samples in Costas 7x7 array (14,336) | ||||
| parameter (NZ=NSPS*NN)                !Samples in full 15 s waveform (157,696) | ||||
| parameter (NZ=NSPS*NN)                !Samples in full 15 s waveform (161,792) | ||||
| parameter (NMAX=15*12000)             !Samples in iwave (180,000) | ||||
| parameter (NFFT1=1*NSPS, NH1=NFFT1/2) !Length of FFTs for symbol spectra | ||||
| parameter (NFFT1=2*NSPS, NH1=NFFT1/2) !Length of FFTs for symbol spectra | ||||
| parameter (NHSYM=2*NMAX/NSPS-1)       !Number of symbol spectra (half-symbol steps) | ||||
|  | ||||
| @ -8,8 +8,8 @@ program ft8sim | ||||
|   type(hdr) h                            !Header for .wav file | ||||
|   character arg*12,fname*16 | ||||
|   character msg*22,msgsent*22 | ||||
|   complex c0(0:NZ-1) | ||||
|   complex c(0:NZ-1) | ||||
|   complex c0(0:NMAX-1) | ||||
|   complex c(0:NMAX-1) | ||||
|   integer itone(NN) | ||||
|   integer*2 iwave(NMAX)                  !Generated full-length waveform   | ||||
| 
 | ||||
| @ -42,7 +42,7 @@ program ft8sim | ||||
|   bw=8*baud                              !Occupied bandwidth (Hz) | ||||
|   txt=NZ*dt                              !Transmission length (s) | ||||
|   bandwidth_ratio=2500.0/(fs/2.0) | ||||
|   sig=sqrt(bandwidth_ratio) * 10.0**(0.05*snrdb) | ||||
|   sig=sqrt(2*bandwidth_ratio) * 10.0**(0.05*snrdb) | ||||
|   if(snrdb.gt.90.0) sig=1.0 | ||||
|   txt=NN*NSPS/12000.0 | ||||
| 
 | ||||
| @ -53,7 +53,7 @@ program ft8sim | ||||
| 
 | ||||
|   phi=0.0 | ||||
|   c0=0. | ||||
|   k=-1 + nint(xdt/dt) | ||||
|   k=-1 + nint((xdt+0.5)/dt)              !Start audio at t=0.5 s | ||||
|   do j=1,NN                              !Generate 8-FSK waveform from itone | ||||
|      dphi=twopi*(f0+itone(j)*baud)*dt | ||||
|      if(k.eq.0) phi=-dphi | ||||
| @ -62,11 +62,11 @@ program ft8sim | ||||
|         phi=phi+dphi | ||||
|         if(phi.gt.twopi) phi=phi-twopi | ||||
|         xphi=phi | ||||
|         if(k.ge.0 .and. k.lt.NZ) c0(k)=cmplx(cos(xphi),sin(xphi)) | ||||
|         if(k.ge.0 .and. k.lt.NMAX) c0(k)=cmplx(cos(xphi),sin(xphi)) | ||||
|      enddo | ||||
|   enddo | ||||
| 
 | ||||
|   call sgran() | ||||
| !  call sgran() | ||||
|   do ifile=1,nfiles | ||||
|      c=c0 | ||||
|      if( fspread .ne. 0.0 .or. delay .ne. 0.0 ) then | ||||
| @ -83,8 +83,8 @@ program ft8sim | ||||
| 
 | ||||
|      fac=32767.0 | ||||
|      rms=100.0 | ||||
|      if(snrdb.ge.90.0) iwave(1:NZ)=nint(fac*real(c)) | ||||
|      if(snrdb.lt.90.0) iwave(1:NZ)=nint(rms*real(c)) | ||||
|      if(snrdb.ge.90.0) iwave(1:NMAX)=nint(fac*real(c)) | ||||
|      if(snrdb.lt.90.0) iwave(1:NMAX)=nint(rms*real(c)) | ||||
|      iwave(NZ+1:)=0 | ||||
| 
 | ||||
|      h=default_header(12000,NMAX) | ||||
| @ -95,10 +95,10 @@ program ft8sim | ||||
|      close(10) | ||||
|      write(*,1110) ifile,xdt,f0,snrdb,fname | ||||
| 1110 format(i4,f7.2,f8.2,f7.1,2x,a16) | ||||
|      do i=0,NZ-1 | ||||
|         write(13,3001) i,i/12000.0,c(i),iwave(i+1) | ||||
| 3001    format(i8,f12.6,2f12.3,i8) | ||||
|      enddo | ||||
| !     do i=0,NZ-1 | ||||
| !        write(13,3001) i,i/12000.0,c(i),iwave(i+1) | ||||
| !3001    format(i8,f12.6,2f12.3,i8) | ||||
| !     enddo | ||||
| enddo | ||||
|         | ||||
| 999 end program ft8sim | ||||
|  | ||||
| @ -8,8 +8,8 @@ subroutine genft8(msg,msgsent,itone) | ||||
|   include 'ft8_params.f90' | ||||
| 
 | ||||
|   character*22 msg,msgsent | ||||
|   character*84 cbits | ||||
|   integer*4 i4Msg6BitWords(12)            !72-bit message as 6-bit words | ||||
|   character*87 cbits | ||||
|   integer*4 i4Msg6BitWords(12)                !72-bit message as 6-bit words | ||||
|   integer*1 msgbits(KK),codeword(3*ND) | ||||
|   integer itone(NN) | ||||
|   integer icos7(0:6) | ||||
| @ -17,24 +17,26 @@ subroutine genft8(msg,msgsent,itone) | ||||
| 
 | ||||
|   call packmsg(msg,i4Msg6BitWords,itype)      !Pack into 12 6-bit bytes | ||||
|   call unpackmsg(i4Msg6BitWords,msgsent)      !Unpack to get msgsent | ||||
|   icrc=0        !### temporary ### | ||||
|   i3bit=0         !### temporary ### | ||||
|   icrc12=0        !### temporary ### | ||||
| 
 | ||||
|   write(cbits,1000) i4Msg6BitWords,icrc | ||||
| 1000 format(12b6.6,b12.12) | ||||
|   write(cbits,1000) i4Msg6BitWords,i3bit,icrc12 | ||||
| 1000 format(12b6.6,b3.3,b12.12) | ||||
|   read(cbits,1002) msgbits | ||||
| 1002 format(84i1) | ||||
| 1002 format(87i1) | ||||
|   print*,cbits | ||||
| 
 | ||||
|   call encode168(msgbits,codeword)      !Encode the test message | ||||
|   call encode174(msgbits,codeword)      !Encode the test message | ||||
| 
 | ||||
| ! Message structure: S7 D28 S7 D28 S7 | ||||
| ! Message structure: S7 D29 S7 D29 S7 | ||||
|   itone(1:7)=icos7 | ||||
|   itone(35+1:35+7)=icos7 | ||||
|   itone(36+1:36+7)=icos7 | ||||
|   itone(NN-6:NN)=icos7 | ||||
|   k=7 | ||||
|   do j=1,ND | ||||
|      i=3*j -2 | ||||
|      k=k+1 | ||||
|      if(j.eq.29) k=k+7 | ||||
|      if(j.eq.30) k=k+7 | ||||
|      itone(k)=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2) | ||||
|   enddo | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user