mirror of
				https://github.com/saitohirga/WSJT-X.git
				synced 2025-11-03 13:30:52 -05:00 
			
		
		
		
	Add new MSK144 encoding routines and make the necessary accommodations.
git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@7022 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
		
							parent
							
								
									73a76b5740
								
							
						
					
					
						commit
						f803c5cf6f
					
				@ -330,6 +330,8 @@ set (wsjt_FSRCS
 | 
			
		||||
  lib/downsam9.f90
 | 
			
		||||
  lib/encode232.f90
 | 
			
		||||
  lib/encode4.f90
 | 
			
		||||
  lib/encode_msk40.f90
 | 
			
		||||
  lib/encode_msk144.f90
 | 
			
		||||
  lib/entail.f90
 | 
			
		||||
  lib/ephem.f90
 | 
			
		||||
  lib/extract.f90
 | 
			
		||||
@ -1075,9 +1077,6 @@ target_link_libraries (msk144sim wsjt_fort wsjt_cxx)
 | 
			
		||||
add_executable (msk144d lib/msk144d.f90 wsjtx.rc)
 | 
			
		||||
target_link_libraries (msk144d wsjt_fort wsjt_cxx)
 | 
			
		||||
 | 
			
		||||
add_executable (encode lib/ldpc/encode.c wsjtx.rc)
 | 
			
		||||
target_link_libraries (encode wsjt_fort wsjt_cxx)
 | 
			
		||||
 | 
			
		||||
add_executable (jt9 ${jt9_FSRCS} ${jt9_CXXSRCS} wsjtx.rc)
 | 
			
		||||
if (${OPENMP_FOUND} OR APPLE)
 | 
			
		||||
  if (APPLE)
 | 
			
		||||
@ -1215,7 +1214,7 @@ install (TARGETS udp_daemon message_aggregator
 | 
			
		||||
  BUNDLE DESTINATION ${WSJT_BIN_DESTINATION} COMPONENT runtime
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
install (TARGETS jt9 jt65code qra64code qra64sim jt9code jt4code wsprd msk32d msk32d_ldpc encode
 | 
			
		||||
install (TARGETS jt9 jt65code qra64code qra64sim jt9code jt4code wsprd msk32d msk32d_ldpc 
 | 
			
		||||
  RUNTIME DESTINATION ${WSJT_BIN_DESTINATION} COMPONENT runtime
 | 
			
		||||
  BUNDLE DESTINATION ${WSJT_BIN_DESTINATION} COMPONENT runtime
 | 
			
		||||
  )
 | 
			
		||||
 | 
			
		||||
@ -239,7 +239,7 @@ qint64 Modulator::readData (char * data, qint64 maxSize)
 | 
			
		||||
              }
 | 
			
		||||
            }
 | 
			
		||||
//            qDebug() << "B" << m_bFastMode << m_ic << numFrames << isym << itone[isym]
 | 
			
		||||
//                            << m_toneFrequency0 << m_nsps;
 | 
			
		||||
//                     << m_toneFrequency0 << m_nsps;
 | 
			
		||||
            m_dphi = m_twoPi * m_toneFrequency0 / m_frameRate;
 | 
			
		||||
            m_isym0 = isym;
 | 
			
		||||
            m_frequency0 = m_frequency;         //???
 | 
			
		||||
 | 
			
		||||
@ -1,6 +1,4 @@
 | 
			
		||||
subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype,pchk_file,ldpc_msg,   &
 | 
			
		||||
     encodeExeFile)
 | 
			
		||||
 | 
			
		||||
subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype)
 | 
			
		||||
!!!!!!!!!!!!!!!!!! Experimental small blocklength ldpc version
 | 
			
		||||
! s8 + 48bits + s8 + 80 bits = 144 bits (72ms message duration)
 | 
			
		||||
!
 | 
			
		||||
@ -23,9 +21,6 @@ subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype,pchk_file,ldpc_msg,   &
 | 
			
		||||
  use iso_c_binding, only: c_loc,c_size_t
 | 
			
		||||
  use packjt
 | 
			
		||||
  use hashing
 | 
			
		||||
  character*512 pchk_file,gen_file,ldpc_msg,ldpc_cw,encodeExeFile
 | 
			
		||||
  character*120 fname1,fname2
 | 
			
		||||
  character*2048 cmnd
 | 
			
		||||
  character*22 msg0
 | 
			
		||||
  character*22 message                    !Message to be generated
 | 
			
		||||
  character*22 msgsent                    !Message as it will be received
 | 
			
		||||
@ -36,30 +31,15 @@ subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype,pchk_file,ldpc_msg,   &
 | 
			
		||||
  integer*1 msgbits(80)                   !72-bit message + 8-bit hash
 | 
			
		||||
  integer*1 bitseq(144)                   !Tone #s, data and sync (values 0-1)
 | 
			
		||||
  integer*1 i1hash(4)
 | 
			
		||||
  integer*1 b7(7)
 | 
			
		||||
  integer*1 s8(8)
 | 
			
		||||
  integer*1 b11(11)
 | 
			
		||||
  integer*1 b13(13)
 | 
			
		||||
  real*8 pp(12)
 | 
			
		||||
  real*8 xi(864),xq(864),pi,twopi
 | 
			
		||||
  data b7/1,1,1,0,0,1,0/
 | 
			
		||||
  data s8/0,1,1,1,0,0,1,0/
 | 
			
		||||
  data b11/1,1,1,0,0,0,1,0,0,1,0/         !Barker 11 code
 | 
			
		||||
  data b13/1,1,1,1,1,0,0,1,1,0,1,0,1/     !Barker 13 code
 | 
			
		||||
  equivalence (ihash,i1hash)
 | 
			
		||||
  logical first
 | 
			
		||||
  data first/.true./
 | 
			
		||||
  save
 | 
			
		||||
 | 
			
		||||
  i=index(pchk_file,".pchk")
 | 
			
		||||
  gen_file=pchk_file(1:i-1)//".gen"
 | 
			
		||||
  i=index(ldpc_msg,"ldpc_msg")
 | 
			
		||||
  ldpc_cw=ldpc_msg(1:i-1)//"ldpc_cw"
 | 
			
		||||
  fname1=trim(ldpc_msg)
 | 
			
		||||
  fname2=trim(ldpc_cw)
 | 
			
		||||
 | 
			
		||||
!  call init_ldpc(trim(pchk_file)//char(0),trim(gen_file)//char(0))  
 | 
			
		||||
 | 
			
		||||
  if( first ) then
 | 
			
		||||
    first=.false.
 | 
			
		||||
    nsym=128
 | 
			
		||||
@ -90,8 +70,7 @@ subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype,pchk_file,ldpc_msg,   &
 | 
			
		||||
     enddo
 | 
			
		||||
 | 
			
		||||
     if(message(1:1).eq.'<') then
 | 
			
		||||
        call genmsk40(message,msgsent,ichk,i4tone,itype,pchk_file,      &
 | 
			
		||||
             fname1,fname2,encodeExeFile)
 | 
			
		||||
        call genmsk40(message,msgsent,ichk,i4tone,itype)
 | 
			
		||||
        if(itype.lt.0) go to 999
 | 
			
		||||
        i4tone(41)=-40
 | 
			
		||||
        go to 999
 | 
			
		||||
@ -131,22 +110,7 @@ subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype,pchk_file,ldpc_msg,   &
 | 
			
		||||
         enddo
 | 
			
		||||
     enddo
 | 
			
		||||
 | 
			
		||||
!     call ldpc_encode(msgbits,codeword)
 | 
			
		||||
 | 
			
		||||
!     print*,fname1
 | 
			
		||||
!     print*,fname2
 | 
			
		||||
 | 
			
		||||
     open(24,file=fname1,status='unknown')
 | 
			
		||||
     write(24,1010) msgbits
 | 
			
		||||
1010 format(80i1)
 | 
			
		||||
     close(24)
 | 
			
		||||
     cmnd=trim(encodeExeFile)//' "'//trim(pchk_file)//'" "'//              &
 | 
			
		||||
          trim(gen_file)//'" "'//trim(fname1)//'" "'//trim(fname2)//'"'
 | 
			
		||||
     call system(trim(cmnd))
 | 
			
		||||
     open(24,file=fname2,status='old')
 | 
			
		||||
     read(24,1020) codeword
 | 
			
		||||
1020 format(128i1)
 | 
			
		||||
     close(24)
 | 
			
		||||
     call encode_msk144(msgbits,codeword)
 | 
			
		||||
 | 
			
		||||
!Create 144-bit channel vector:
 | 
			
		||||
!8-bit sync word + 48 bits + 8-bit sync word + 80 bits
 | 
			
		||||
@ -167,7 +131,6 @@ subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype,pchk_file,ldpc_msg,   &
 | 
			
		||||
       is=(i-1)*12+1
 | 
			
		||||
       xi(is:is+11)=bitseq(2*i)*pp
 | 
			
		||||
     enddo
 | 
			
		||||
 | 
			
		||||
! Map I and Q  to tones. 
 | 
			
		||||
    i4tone=0 
 | 
			
		||||
    do i=1,72
 | 
			
		||||
@ -178,6 +141,6 @@ subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype,pchk_file,ldpc_msg,   &
 | 
			
		||||
 | 
			
		||||
! Flip polarity
 | 
			
		||||
  i4tone=-i4tone+1
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
999 return
 | 
			
		||||
end subroutine genmsk144
 | 
			
		||||
 | 
			
		||||
@ -1,15 +1,10 @@
 | 
			
		||||
subroutine genmsk40(msg,msgsent,ichk,itone,itype,pchk_file,fname1,fname2,encodeExeFile)
 | 
			
		||||
subroutine genmsk40(msg,msgsent,ichk,itone,itype)
 | 
			
		||||
 | 
			
		||||
  use hashing
 | 
			
		||||
  character*22 msg,msgsent,hashmsg
 | 
			
		||||
  character*4 crpt,rpt(0:15)
 | 
			
		||||
  character*512 encodeExeFile
 | 
			
		||||
  character*512 pchk_file
 | 
			
		||||
  character*512 pchk_file40,gen_file40
 | 
			
		||||
  character*120 fname1,fname2
 | 
			
		||||
  character*2048 cmnd
 | 
			
		||||
  logical first
 | 
			
		||||
  integer itone(144)
 | 
			
		||||
  integer*4 itone(144)
 | 
			
		||||
  integer*1 message(16),codeword(32),bitseq(40)
 | 
			
		||||
  integer*1 s8r(8)
 | 
			
		||||
  data s8r/1,0,1,1,0,0,0,1/   ! Sync word is reversed wrt msk144 sync word.
 | 
			
		||||
@ -19,12 +14,6 @@ subroutine genmsk40(msg,msgsent,ichk,itone,itype,pchk_file,fname1,fname2,encodeE
 | 
			
		||||
           "RRR ","73  "/
 | 
			
		||||
  save first,rpt
 | 
			
		||||
 | 
			
		||||
! Temporarily hardwire filenames and init on every call
 | 
			
		||||
  i=index(pchk_file,"128-80")
 | 
			
		||||
  pchk_file40=pchk_file(1:i-1)//"32-16"//pchk_file(i+6:)
 | 
			
		||||
  i=index(pchk_file40,".pchk")
 | 
			
		||||
  gen_file40=pchk_file40(1:i-1)//".gen"
 | 
			
		||||
!  call init_ldpc(trim(pchk_file40)//char(0),trim(gen_file40)//char(0))
 | 
			
		||||
  itype=-1
 | 
			
		||||
  msgsent='*** bad message ***'
 | 
			
		||||
  itone=0
 | 
			
		||||
@ -51,19 +40,7 @@ subroutine genmsk40(msg,msgsent,ichk,itone,itype,pchk_file,fname1,fname2,encodeE
 | 
			
		||||
    message(i)=iand(1,ishft(ig,1-i))
 | 
			
		||||
  enddo
 | 
			
		||||
 | 
			
		||||
!  call ldpc_encode(message,codeword)
 | 
			
		||||
  open(24,file=fname1,status='unknown')
 | 
			
		||||
  write(24,1010) message
 | 
			
		||||
1010 format(16i1)
 | 
			
		||||
  close(24)
 | 
			
		||||
  cmnd=trim(encodeExeFile)//' "'//trim(pchk_file40)//'" "'//trim(gen_file40)//'" "'        &
 | 
			
		||||
       //trim(fname1)//'" "'//trim(fname2)//'"'
 | 
			
		||||
  call system(cmnd)
 | 
			
		||||
  open(24,file=fname2,status='old')
 | 
			
		||||
  read(24,1020) codeword
 | 
			
		||||
1020 format(32i1)
 | 
			
		||||
  close(24)
 | 
			
		||||
 | 
			
		||||
  call encode_msk40(message,codeword)
 | 
			
		||||
!  write(*,'(a6,i6,2x,a6,i6,2x,a6,i6)') ' msg: ',ig,'rprt: ',irpt,'hash: ',ihash
 | 
			
		||||
!  write(*,'(a6,32i1)') '  cw: ',codeword
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -79,8 +79,7 @@ extern "C" {
 | 
			
		||||
               int* itext, int len1, int len2);
 | 
			
		||||
 | 
			
		||||
  void genmsk144_(char* msg, int* ichk, char* msgsent, int itone[],
 | 
			
		||||
               int* itext, char pchkFile[], char ldpcMsgFile[], char encodeExeFile[],
 | 
			
		||||
                  int len1, int len2, int len3, int len4, int len5);
 | 
			
		||||
               int* itext, int len1, int len2); 
 | 
			
		||||
 | 
			
		||||
  void gen65_(char* msg, int* ichk, char* msgsent, int itone[],
 | 
			
		||||
              int* itext, int len1, int len2);
 | 
			
		||||
@ -2768,8 +2767,7 @@ void MainWindow::guiUpdate()
 | 
			
		||||
                                  &m_currentMessageType, len1, len1);
 | 
			
		||||
        if(m_modeTx=="MSK144") {
 | 
			
		||||
          genmsk144_(message, &ichk, msgsent, const_cast<int *> (itone),
 | 
			
		||||
              &m_currentMessageType, &m_pchkFile[0], &m_ldpcMsgFile[0],
 | 
			
		||||
              &m_encodeExeFile[0], len1, len1, 512, 512, 512);
 | 
			
		||||
              &m_currentMessageType, len1, len1); 
 | 
			
		||||
          if(m_restart) {
 | 
			
		||||
            int nsym=144;
 | 
			
		||||
            if(itone[40]==-40) nsym=40;
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user