mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-25 05:38:46 -05:00
MSK144: Wholesale changeover to (128,90) code with 77-bit messages. Compiles and doesn't crash, but communication between two instances has not been tested.
This commit is contained in:
parent
cbf8b35b8d
commit
fd0ad33028
@ -414,7 +414,7 @@ set (wsjt_FSRCS
|
||||
lib/encode4.f90
|
||||
lib/encode_msk40.f90
|
||||
lib/encode_msk144.f90
|
||||
lib/encode128_90.f90
|
||||
lib/encode_128_90.f90
|
||||
lib/fsk4hf/encode120.f90
|
||||
lib/fsk4hf/encode168.f90
|
||||
lib/ft8/encode174.f90
|
||||
@ -474,7 +474,7 @@ set (wsjt_FSRCS
|
||||
lib/fsk4hf/genfsk4hf.f90
|
||||
lib/ft8/genft8.f90
|
||||
lib/ft8/genft8_174_91.f90
|
||||
lib/genmsk144.f90
|
||||
lib/genmsk_128_90.f90
|
||||
lib/genmsk40.f90
|
||||
lib/fsk4hf/genmskhf.f90
|
||||
lib/fsk4hf/genwsprlf.f90
|
||||
|
@ -1,58 +0,0 @@
|
||||
subroutine encode128_90(message77,codeword)
|
||||
!
|
||||
! Add a 13-bit CRC to a 77-bit message and return a 128-bit codeword
|
||||
!
|
||||
use, intrinsic :: iso_c_binding
|
||||
use iso_c_binding, only: c_loc,c_size_t
|
||||
use crc
|
||||
|
||||
integer, parameter:: N=128, K=90, M=N-K
|
||||
character*90 tmpchar
|
||||
integer*1 codeword(N)
|
||||
integer*1 gen(M,K)
|
||||
integer*1 message77(77),message(K)
|
||||
integer*1 pchecks(M)
|
||||
integer*1, target :: i1MsgBytes(12)
|
||||
include "ldpc_128_90_b_generator.f90"
|
||||
logical first
|
||||
data first/.true./
|
||||
save first,gen
|
||||
|
||||
if( first ) then ! fill the generator matrix
|
||||
gen=0
|
||||
do i=1,M
|
||||
do j=1,23
|
||||
read(g(i)(j:j),"(Z1)") istr
|
||||
ibmax=4
|
||||
if(j.eq.23) ibmax=2
|
||||
do jj=1, ibmax
|
||||
icol=(j-1)*4+jj
|
||||
if( btest(istr,4-jj) ) gen(i,icol)=1
|
||||
enddo
|
||||
enddo
|
||||
enddo
|
||||
first=.false.
|
||||
endif
|
||||
|
||||
! Add 13 bit CRC to form 90-bit message+CRC13
|
||||
write(tmpchar,'(77i1)') message77
|
||||
tmpchar(78:80)='000'
|
||||
i1MsgBytes=0
|
||||
read(tmpchar,'(10b8)') i1MsgBytes(1:10)
|
||||
ncrc13 = crc13 (c_loc (i1MsgBytes), 12)
|
||||
write(tmpchar(78:90),'(b13)') ncrc13
|
||||
read(tmpchar,'(90i1)') message
|
||||
|
||||
do i=1,M
|
||||
nsum=0
|
||||
do j=1,K
|
||||
nsum=nsum+message(j)*gen(i,j)
|
||||
enddo
|
||||
pchecks(i)=mod(nsum,2)
|
||||
enddo
|
||||
|
||||
codeword(1:K)=message
|
||||
codeword(K+1:N)=pchecks
|
||||
|
||||
return
|
||||
end subroutine encode128_90
|
@ -1,10 +1,11 @@
|
||||
program ldpcsim174_91
|
||||
! End to end test of the (174,91)/crc14 encoder and decoder.
|
||||
use crc
|
||||
use packjt
|
||||
use packjt77
|
||||
|
||||
integer, parameter:: N=174, K=91, M=N-K
|
||||
character*22 msg,msgsent,msgreceived
|
||||
character*37 msg,msgsent,msgreceived
|
||||
character*77 c77
|
||||
character*8 arg
|
||||
character*6 grid
|
||||
character*96 tmpchar
|
||||
@ -12,7 +13,6 @@ integer*1, allocatable :: codeword(:), decoded(:), message(:)
|
||||
integer*1 msgbits(77)
|
||||
integer*1 message77(77)
|
||||
integer*1 apmask(N), cw(N)
|
||||
integer*4 i4Msg6BitWords(13)
|
||||
integer nerrtot(0:N),nerrdec(0:N)
|
||||
real*8, allocatable :: rxdata(:)
|
||||
real, allocatable :: llr(:)
|
||||
@ -48,19 +48,17 @@ allocate ( rxdata(N), llr(N) )
|
||||
|
||||
! msg="K1JT K9AN EN50"
|
||||
msg="G4WJS K9AN EN50"
|
||||
call packmsg(msg,i4Msg6BitWords,itype,.false.) !Pack into 12 6-bit bytes
|
||||
call unpackmsg(i4Msg6BitWords,msgsent,.false.,grid) !Unpack to get msgsent
|
||||
i3=0
|
||||
n3=1
|
||||
call pack77(msg,i3,n3,c77) !Pack into 12 6-bit bytes
|
||||
call unpack77(c77,msgsent) !Unpack to get msgsent
|
||||
write(*,*) "message sent ",msgsent
|
||||
|
||||
tmpchar=' '
|
||||
write(tmpchar,'(12b6.6)') i4Msg6BitWords(1:12)
|
||||
tmpchar(73:77)='00000' !i5bit
|
||||
read(tmpchar,'(77i1)') msgbits(1:77)
|
||||
read(c77,'(77i1)') msgbits(1:77)
|
||||
|
||||
write(*,*) 'message'
|
||||
write(*,'(28i1,1x,28i1,1x,16i1,1x,5i1)') msgbits
|
||||
write(*,'(77i1)') c77
|
||||
|
||||
! msgbits is the 77-bit message, codeword is 174 bits
|
||||
call encode174_91(msgbits,codeword)
|
||||
|
||||
call init_random_seed()
|
||||
|
@ -77,7 +77,7 @@ subroutine genmsk_128_90(msg0,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
||||
call pack77(message,i3,n3,c77)
|
||||
call unpack77(c77,msgsent) !Unpack to get msgsent
|
||||
if(ichk.eq.1) go to 999
|
||||
read(c77,"77i1") msgbits
|
||||
read(c77,"(77i1)") msgbits
|
||||
call encode_128_90(msgbits,codeword)
|
||||
|
||||
!Create 144-bit channel vector:
|
||||
|
@ -4,7 +4,7 @@ program msk144code
|
||||
! LDPC encoding, and other necessary details of the MSK144 protocol.
|
||||
|
||||
use packjt
|
||||
character msg*22,msgsent*22,decoded,bad*1,msgtype*13,mygrid*6
|
||||
character msg*37,msgsent*37,decoded,bad*1,msgtype*13,mygrid*6
|
||||
integer*4 i4tone(144)
|
||||
logical*1 bcontest
|
||||
include 'testmsg.f90'
|
||||
@ -43,7 +43,7 @@ program msk144code
|
||||
bcontest=.false.
|
||||
if(msg(i1:i1+1).eq.'R ') bcontest=.true.
|
||||
ichk=0
|
||||
call genmsk144(msg,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
||||
call genmsk_128_90(msg,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
||||
|
||||
msgtype=""
|
||||
if(itype.eq.1) msgtype="Std Msg"
|
||||
@ -57,7 +57,7 @@ program msk144code
|
||||
bad=" "
|
||||
if(msgsent.ne.msg) bad="*"
|
||||
write(*,1020) imsg,msg,msgsent,bad,itype,msgtype
|
||||
1020 format(i2,'.',2x,a22,2x,a22,3x,a1,i3,": ",a13)
|
||||
1020 format(i2,'.',2x,a37,2x,a37,3x,a1,i3,": ",a13)
|
||||
enddo
|
||||
|
||||
if(nmsg.eq.1) then
|
||||
|
@ -1,13 +1,14 @@
|
||||
subroutine msk144decodeframe(c,softbits,msgreceived,nsuccess,recent_calls,nrecent)
|
||||
! use timer_module, only: timer
|
||||
|
||||
use packjt77
|
||||
parameter (NSPM=864)
|
||||
character*22 msgreceived
|
||||
character*37 msgreceived
|
||||
character*12 recent_calls(nrecent)
|
||||
character*77 c77
|
||||
complex cb(42)
|
||||
complex cfac,cca,ccb
|
||||
complex c(NSPM)
|
||||
integer*1 decoded(80)
|
||||
integer*1 decoded77(77),apmask(128),cw(128)
|
||||
integer s8(8),hardbits(144)
|
||||
real*8 dt, fs, pi, twopi
|
||||
real cbi(42),cbq(42)
|
||||
@ -94,13 +95,13 @@ subroutine msk144decodeframe(c,softbits,msgreceived,nsuccess,recent_calls,nrecen
|
||||
|
||||
max_iterations=10
|
||||
! call timer('bpdec144 ',0)
|
||||
call bpdecode144(llr,max_iterations,decoded,niterations)
|
||||
apmask=0
|
||||
call bpdecode128_90(llr,apmask,max_iterations,decoded77,cw,nharderror,niterations)
|
||||
! call timer('bpdec144 ',1)
|
||||
if( niterations .ge. 0.0 ) then
|
||||
call extractmessage144(decoded,msgreceived,nhashflag,recent_calls,nrecent)
|
||||
if( nhashflag .gt. 0 ) then !Hash codes match, so print it
|
||||
nsuccess=1
|
||||
endif
|
||||
if( nharderror .ge. 0.0 ) then
|
||||
nsuccess=1
|
||||
write(c77,'(77i1)') decoded77
|
||||
call unpack77(c77,msgreceived)
|
||||
endif
|
||||
|
||||
return
|
||||
|
@ -1,7 +1,7 @@
|
||||
subroutine msk144signalquality(cframe,snr,freq,t0,softbits,msg,dxcall, &
|
||||
btrain,datadir,nbiterrors,eyeopening,pcoeffs)
|
||||
|
||||
character*22 msg,msgsent
|
||||
character*37 msg,msgsent
|
||||
character*12 dxcall
|
||||
character*12 training_dxcall
|
||||
character*12 trained_dxcall
|
||||
@ -94,7 +94,7 @@ subroutine msk144signalquality(cframe,snr,freq,t0,softbits,msg,dxcall, &
|
||||
mygrid="EN50"
|
||||
ichk=0
|
||||
bcontest=.false.
|
||||
call genmsk144(msg,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
||||
call genmsk_128_90(msg,mygrid,ichk,bcontest,msgsent,i4tone,itype)
|
||||
|
||||
! reconstruct message bits from tones
|
||||
msgbits(1)=0
|
||||
|
@ -5,7 +5,8 @@ program msk144sim
|
||||
real pings(0:NMAX-1)
|
||||
real waveform(0:NMAX-1)
|
||||
character*6 mygrid
|
||||
character arg*8,msg*22,msgsent*22,fname*40
|
||||
character arg*8,msg*37,msgsent*37,fname*40
|
||||
character*77 c77
|
||||
real wave(0:NMAX-1) !Simulated received waveform
|
||||
real*8 twopi,freq,phi,dphi0,dphi1,dphi
|
||||
type(hdr) h !Header for .wav file
|
||||
@ -40,7 +41,7 @@ program msk144sim
|
||||
bcontest=.false.
|
||||
if(msg(i1:i1+1).eq.'R ') bcontest=.true.
|
||||
ichk=0
|
||||
call genmsk144(msg,mygrid,ichk,bcontest,msgsent,itone,itype)
|
||||
call genmsk_128_90(msg,mygrid,ichk,bcontest,msgsent,itone,itype)
|
||||
twopi=8.d0*atan(1.d0)
|
||||
|
||||
nsym=144
|
||||
|
@ -13,8 +13,8 @@ subroutine mskrtd(id2,nutc0,tsec,ntol,nrxfreq,ndepth,mycall,mygrid,hiscall, &
|
||||
parameter (NSHMEM=50) !Number of recent SWL messages to remember
|
||||
|
||||
character*4 decsym !"&" for mskspd or "^" for long averages
|
||||
character*22 msgreceived !Decoded message
|
||||
character*22 msglast,msglastswl !Used for dupechecking
|
||||
character*37 msgreceived !Decoded message
|
||||
character*37 msglast,msglastswl !Used for dupechecking
|
||||
character*80 line !Formatted line with UTC dB T Freq Msg
|
||||
character*12 mycall,hiscall
|
||||
character*6 mygrid
|
||||
|
@ -88,7 +88,7 @@ extern "C" {
|
||||
void gen9_(char* msg, int* ichk, char* msgsent, int itone[],
|
||||
int* itext, fortran_charlen_t, fortran_charlen_t);
|
||||
|
||||
void genmsk144_(char* msg, char* MyGrid, int* ichk, bool* bcontest,
|
||||
void genmsk_128_90_(char* msg, char* MyGrid, int* ichk, bool* bcontest,
|
||||
char* msgsent, int itone[], int* itext, fortran_charlen_t,
|
||||
fortran_charlen_t, fortran_charlen_t);
|
||||
|
||||
@ -3472,8 +3472,8 @@ void MainWindow::guiUpdate()
|
||||
strncpy(MyCall, (m_config.my_callsign()+" ").toLatin1(),6);
|
||||
strncpy(MyGrid, (m_config.my_grid()+" ").toLatin1(),6);
|
||||
if(m_modeTx=="MSK144") {
|
||||
genmsk144_(message, MyGrid, &ichk, &bcontest, msgsent, const_cast<int *> (itone),
|
||||
&m_currentMessageType, 22, 6, 22);
|
||||
genmsk_128_90_(message, MyGrid, &ichk, &bcontest, msgsent, const_cast<int *> (itone),
|
||||
&m_currentMessageType, 37, 6, 37);
|
||||
if(m_restart) {
|
||||
int nsym=144;
|
||||
if(itone[40]==-40) nsym=40;
|
||||
|
Loading…
Reference in New Issue
Block a user