From df518f4e1d87ec6081326a46b7f8bfe4b2e25fb0 Mon Sep 17 00:00:00 2001 From: Joe Taylor Date: Thu, 9 Jun 2016 15:06:15 +0000 Subject: [PATCH] Make it possible to find MSK144 code-definition files in the "data_dir" on all platforms. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6747 ab8295b8-cf94-4d9e-aec4-7959e3be5d79 --- lib/fast_decode.f90 | 12 +++--------- lib/genmsk144.f90 | 11 ++++------- lib/msk144_decode.f90 | 5 +++-- lib/syncmsk144.f90 | 10 +++++----- mainwindow.cpp | 28 ++++++++++++---------------- mainwindow.h | 3 +-- 6 files changed, 28 insertions(+), 41 deletions(-) diff --git a/lib/fast_decode.f90 b/lib/fast_decode.f90 index 47f527cb9..9df75cd29 100644 --- a/lib/fast_decode.f90 +++ b/lib/fast_decode.f90 @@ -1,4 +1,4 @@ -subroutine fast_decode(id2,narg,line) +subroutine fast_decode(id2,narg,line,pchk_file) parameter (NMAX=30*12000) integer*2 id2(NMAX) @@ -9,15 +9,9 @@ subroutine fast_decode(id2,narg,line) logical pick character*6 cfile6 character*80 line(100) - character*80 pchk_file,gen_file + character*512 pchk_file save npts - pchk_file=line(1) - i=index(pchk_file,".pchk") - gen_file=pchk_file(1:i-1)//".gen" -! print*,pchk_file -! print*,gen_file - nutc=narg(0) ndat0=narg(1) nsubmode=narg(2) @@ -39,7 +33,7 @@ subroutine fast_decode(id2,narg,line) call jtmsk_decode(id2,narg,line) go to 900 else if(nmode.eq.104) then - call msk144_decode(id2,ndat0,nutc,0,line) + call msk144_decode(id2,ndat0,nutc,0,pchk_file,line) go to 900 endif diff --git a/lib/genmsk144.f90 b/lib/genmsk144.f90 index f5b4f8545..7b05c8697 100644 --- a/lib/genmsk144.f90 +++ b/lib/genmsk144.f90 @@ -1,4 +1,4 @@ -subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype) +subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype,pchk_file) !!!!!!!!!!!!!!!!!! Experimental small blocklength ldpc version ! s8 + 48bits + s8 + 80 bits = 144 bits (72ms message duration) @@ -22,7 +22,7 @@ subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype) use iso_c_binding, only: c_loc,c_size_t use packjt use hashing - character*85 pchk_file,gen_file + character*512 pchk_file,gen_file character*22 msg0 character*22 message !Message to be generated character*22 msgsent !Message as it will be received @@ -53,11 +53,8 @@ subroutine genmsk144(msg0,ichk,msgsent,i4tone,itype) if( first ) then first=.false. nsym=128 -!! Fix this -! pchk_file="/Users/sfranke/Builds/wsjtx_install/peg-128-80-reg3.pchk" -! gen_file="/Users/sfranke/Builds/wsjtx_install/peg-128-80-reg3.gen" - pchk_file="./data/peg-128-80-reg3.pchk" - gen_file="./data/peg-128-80-reg3.gen" + i=index(pchk_file,".pchk") + gen_file=pchk_file(1:i-1)//".gen" call init_ldpc(trim(pchk_file)//char(0),trim(gen_file)//char(0)) pi=4.*atan(1.0) twopi=8.*atan(1.0) diff --git a/lib/msk144_decode.f90 b/lib/msk144_decode.f90 index 1e67d02dc..3a914a7bd 100644 --- a/lib/msk144_decode.f90 +++ b/lib/msk144_decode.f90 @@ -1,4 +1,4 @@ -subroutine msk144_decode(id2,npts,nutc,nprint,line) +subroutine msk144_decode(id2,npts,nutc,nprint,pchk_file,line) ! Calls the experimental decoder for JTMSK 72ms ldpc messages @@ -15,6 +15,7 @@ subroutine msk144_decode(id2,npts,nutc,nprint,line) complex cdat2(24000) character*22 msg,msg0 !Decoded message character*80 line(100) !Decodes passed back to caller + character*512 pchk_file equivalence (hist,d) nsnr0=-99 @@ -58,7 +59,7 @@ subroutine msk144_decode(id2,npts,nutc,nprint,line) iz=ib-ia+1 cdat2(1:iz)=c(ia:ib) !Select nlen complex samples t0=ia/12000.0 - call syncmsk144(cdat2,iz,msg,freq,nutc,t0) + call syncmsk144(cdat2,iz,pchk_file,msg,freq,nutc,t0) if(msg(1:1).ne.' ') then if(msg.ne.msg0) then nline=nline+1 diff --git a/lib/syncmsk144.f90 b/lib/syncmsk144.f90 index 42dbd21e6..d2eb90269 100644 --- a/lib/syncmsk144.f90 +++ b/lib/syncmsk144.f90 @@ -1,4 +1,5 @@ -subroutine syncmsk144(cdat,npts,msgreceived,fest,nutc,t0) !nutc and t0 are for debug output +subroutine syncmsk144(cdat,npts,pchk_file,msgreceived,fest,nutc,t0) +!nutc and t0 are for debug output use iso_c_binding, only: c_loc,c_size_t use packjt use hashing @@ -6,7 +7,7 @@ subroutine syncmsk144(cdat,npts,msgreceived,fest,nutc,t0) !nutc and t0 are for parameter (NSPM=864) character*22 msgreceived - character*85 pchk_file,gen_file + character*512 pchk_file,gen_file complex cdat(npts) !Analytic signal complex cdat2(npts) complex c(NSPM) @@ -43,9 +44,8 @@ subroutine syncmsk144(cdat,npts,msgreceived,fest,nutc,t0) !nutc and t0 are for save first,cb,pi,twopi,dt,f0,f1 if(first) then -! These files can be found in /lib/ldpc/jtmode_codes directory - pchk_file="./data/peg-128-80-reg3.pchk" - gen_file="./data/peg-128-80-reg3.gen" + i=index(pchk_file,".pchk") + gen_file=pchk_file(1:i-1)//".gen" call init_ldpc(trim(pchk_file)//char(0),trim(gen_file)//char(0)) ! define half-sine pulse and raised-cosine edge window pi=4d0*datan(1d0) diff --git a/mainwindow.cpp b/mainwindow.cpp index 7db43ed35..7ced1d250 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -72,7 +72,7 @@ extern "C" { int* itext, int len1, int len2); void genmsk144_(char* msg, int* ichk, char* msgsent, int itone[], - int* itext, int len1, int len2); + int* itext, char pchkFile[], int len1, int len2, int len3); void gen65_(char* msg, int* ichk, char* msgsent, int itone[], int* itext, int len1, int len2); @@ -101,7 +101,8 @@ extern "C" { float* level, float* sigdb, float* snr, float* dfreq, float* width); - void fast_decode_(short id2[], int narg[], char msg[], int len); + void fast_decode_(short id2[], int narg[], char msg[], char pchkFile[], + int len1, int len2); void hash_calls_(char calls[], int* ih9, int len); void degrade_snr_(short d2[], int* n, float* db, float* bandwidth); void wav12_(short d2[], short d1[], int* nbytes, short* nbitsam2); @@ -730,6 +731,12 @@ MainWindow::MainWindow(QDir const& temp_directory, bool multiple, int ntr[]={5,10,15,30}; m_TRperiod=ntr[m_TRindex-11]; } + QString pchkFile = m_config.data_dir().absoluteFilePath("peg-128-80-reg3.pchk"); + QByteArray ba = pchkFile.toLocal8Bit(); + for(int i=0; i<512; i++) { + m_pchkFile[i]=32; + if(isetFuture(*future3); } else { memcpy(to, from, qMin(mem_jt9->size(), size)); @@ -2484,7 +2480,7 @@ void MainWindow::guiUpdate() if(m_modeTx=="JTMSK") genmsk_(message, &ichk, msgsent, const_cast (itone), &m_currentMessageType, len1, len1); if(m_modeTx=="MSK144") genmsk144_(message, &ichk, msgsent, const_cast (itone), - &m_currentMessageType, len1, len1); + &m_currentMessageType, &m_pchkFile[0], len1, len1, 512); msgsent[22]=0; } } diff --git a/mainwindow.h b/mainwindow.h index a2d0b47c5..c3a33e9e7 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -439,6 +439,7 @@ private: bool m_first_error; char m_msg[100][80]; + char m_pchkFile[512]; // labels in status bar QLabel * tx_status_label; @@ -513,8 +514,6 @@ private: QDateTime m_dateTimeQSO; - QByteArray m_ba; - QSharedMemory *mem_jt9; LogBook m_logBook; DecodedText m_QSOText;