Added some decoder logging and js8 tone generation tweaks to ensure the right costas is getting generated for the right submode

This commit is contained in:
Jordan Sherer 2020-01-04 15:55:20 -05:00
parent ecf77ba04e
commit 3875de4950
13 changed files with 39 additions and 127 deletions

View File

@ -384,8 +384,6 @@ set (wsjt_FSRCS
lib/ft8/foxgen_wrap.f90
lib/fqso_first.f90
lib/freqcal.f90
lib/ft8/ft8apset.f90
lib/ft8/genft8.f90
lib/js8/genjs8.f90
lib/geodist.f90
lib/getlags.f90

View File

@ -1,31 +0,0 @@
subroutine ft8apset(mycall12,mygrid6,hiscall12,hisgrid6,bcontest,apsym,iaptype)
parameter(NAPM=4,KK=87)
character*12 mycall12,hiscall12
character*22 msg,msgsent
character*6 mycall,hiscall
character*6 mygrid6,hisgrid6
character*4 hisgrid
logical bcontest
integer apsym(KK)
integer*1 msgbits(KK)
integer itone(KK)
! mycall=mycall12(1:6)
! hiscall=hiscall12(1:6)
! hisgrid=hisgrid6(1:4)
! if(len_trim(hiscall).eq.0) then
! iaptype=1
! hiscall="K9AN"
! else
! iaptype=2
! endif
! hisgrid=hisgrid6(1:4)
!! if(len_trim(hisgrid).eq.0) hisgrid="EN50"
! if(index(hisgrid," ").eq.0) hisgrid="EN50"
msg='tZQpZP-slh4+' ! HELLO WORLD
i3bit=0 ! ### TEMPORARY ??? ###
call genft8(msg,mygrid6,bcontest,i3bit,msgsent,msgbits,itone)
apsym=2*msgbits-1
return
end subroutine ft8apset

View File

@ -1,69 +0,0 @@
subroutine genft8(msg,mygrid,bcontest,i3bit,msgsent,msgbits,itone)
! Encode an FT8 message, producing array itone().
use crc
use packjt
include 'ft8_params.f90'
character*68 alphabet
character*22 msg,msgsent
character*6 mygrid
character*87 cbits
logical bcontest,checksumok
integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words
integer*1 msgbits(KK),codeword(3*ND)
integer*1, target:: i1Msg8BitBytes(11)
integer itone(NN)
integer icos7(0:6)
data icos7/4,2,5,6,1,3,0/ !Costas 7x7 tone pattern
alphabet='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-+/?.'
itype=6
do i=1,12
v=index(alphabet, msg(i:i))
if(v.eq.0) exit
i4Msg6BitWords(i)=v - 1
enddo
msgsent=' '
msgsent(1:12)=msg(1:12)
! call packmsg(msg,i4Msg6BitWords,itype,bcontest) !Pack into 12 6-bit bytes
! call unpackmsg(i4Msg6BitWords,msgsent,bcontest,mygrid) !Unpack to get msgsent
write(cbits,1000) i4Msg6BitWords,32*i3bit
1000 format(12b6.6,b8.8)
read(cbits,1001) i1Msg8BitBytes(1:10)
1001 format(10b8)
i1Msg8BitBytes(10)=iand(i1Msg8BitBytes(10),transfer(128+64+32,0_1))
i1Msg8BitBytes(11)=0
icrc12=crc12(c_loc(i1Msg8BitBytes),11)
icrc12=xor(icrc12, 42) ! TODO: jsherer - could change the crc here
! For reference, here's how to check the CRC
! i1Msg8BitBytes(10)=icrc12/256
! i1Msg8BitBytes(11)=iand (icrc12,255)
! checksumok = crc12_check(c_loc (i1Msg8BitBytes), 11)
! if( checksumok ) write(*,*) 'Good checksum'
write(cbits,1003) i4Msg6BitWords,i3bit,icrc12
1003 format(12b6.6,b3.3,b12.12)
read(cbits,1004) msgbits
1004 format(87i1)
call encode174(msgbits,codeword) !Encode the test message
! Message structure: S7 D29 S7 D29 S7
itone(1: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.30) k=k+7
itone(k)=codeword(i)*4 + codeword(i+1)*2 + codeword(i+2)
enddo
return
end subroutine genft8

View File

@ -1,4 +1,4 @@
subroutine genjs8(msg,mygrid,bcontest,i3bit,msgsent,msgbits,itone)
subroutine genjs8(msg,icos,mygrid,bcontest,i3bit,msgsent,msgbits,itone)
! Encode an JS8 message, producing array itone().
@ -11,20 +11,20 @@ subroutine genjs8(msg,mygrid,bcontest,i3bit,msgsent,msgbits,itone)
parameter (ND=58) !Data symbols
parameter (NS=21) !Sync symbols (3 @ Costas 7x7)
parameter (NN=NS+ND) !Total channel symbols (79)
parameter (NCOSTAS=1)
character*68 alphabet
character*22 msg,msgsent
character*6 mygrid
character*87 cbits
logical bcontest,checksumok
integer icos
integer*4 i4Msg6BitWords(12) !72-bit message as 6-bit words
integer*1 msgbits(KK),codeword(3*ND)
integer*1, target:: i1Msg8BitBytes(11)
integer itone(NN)
integer icos7a(0:6), icos7b(0:6), icos7c(0:6)
if(NCOSTAS.eq.1) then
if(icos.eq.1) then !icos is used elsewhere as NCOSTAS parameter
icos7a = (/4,2,5,6,1,3,0/) !Beginning Costas 7x7 tone pattern
icos7b = (/4,2,5,6,1,3,0/) !Middle Costas 7x7 tone pattern
icos7c = (/4,2,5,6,1,3,0/) !End Costas 7x7 tone pattern

View File

@ -55,6 +55,11 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
icos7c = (/2,5,0,6,4,1,3/) !End Costas 7x7 tone pattern
endif
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> js8dec costas', icos7a, icos7b, icos7c
flush(6)
endif
if(first) then
mcq=2*mcq-1
mde=2*mde-1
@ -452,7 +457,8 @@ subroutine js8dec(dd0,newdat,nQSOProgress,nfqso,nftx,ndepth,lapon,lapcqonly, &
decoded=decoded0
message(1:12)=origmsg(1:12)
call genjs8(message,mygrid6,bcontest,i3bit,msgsent,msgbits,itone)
icos=NCOSTAS
call genjs8(message,icos,mygrid6,bcontest,i3bit,msgsent,msgbits,itone)
if(lsubtract) then
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> subtract', f1, xdt2, itone

View File

@ -19,6 +19,7 @@ subroutine syncjs8(dd,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase)
equivalence (x,cx)
integer icos7a(0:6), icos7b(0:6), icos7c(0:6)
if(NCOSTAS.eq.1) then
icos7a = (/4,2,5,6,1,3,0/) !Beginning Costas 7x7 tone pattern
icos7b = (/4,2,5,6,1,3,0/) !Middle Costas 7x7 tone pattern
@ -29,6 +30,12 @@ subroutine syncjs8(dd,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase)
icos7c = (/2,5,0,6,4,1,3/) !End Costas 7x7 tone pattern
endif
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> syncjs8 costas', icos7a, icos7b, icos7c
flush(6)
endif
! Compute symbol spectra, stepping by NSTEP steps.
savg=0.
tstep=NSTEP/12000.0
@ -134,7 +141,7 @@ subroutine syncjs8(dd,nfa,nfb,syncmin,nfqso,s,candidate,ncand,sbase)
n=ia + indx(iz+1-i) - 1
if(red(n).lt.syncmin.or.isnan(red(n))) exit
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug>', 'red candidate', red(n), n*df, (jpeak(n)-1)*tstep
write(*,*) '<DecodeDebug> red candidate', red(n), n*df, (jpeak(n)-1)*tstep
flush(6)
endif
k=k+1

View File

@ -16,6 +16,7 @@ subroutine syncjs8d(cd0,i0,ctwk,itwk,sync)
p(z1)=(real(z1)**2 + aimag(z1)**2) !Statement function for power
integer icos7a(0:6), icos7b(0:6), icos7c(0:6)
if(NCOSTAS.eq.1) then
icos7a = (/4,2,5,6,1,3,0/) !Beginning Costas 7x7 tone pattern
icos7b = (/4,2,5,6,1,3,0/) !Middle Costas 7x7 tone pattern
@ -26,6 +27,11 @@ subroutine syncjs8d(cd0,i0,ctwk,itwk,sync)
icos7c = (/2,5,0,6,4,1,3/) !End Costas 7x7 tone pattern
endif
if(NWRITELOG.eq.1) then
write(*,*) '<DecodeDebug> syncjs8d costas', icos7a, icos7b, icos7c
flush(6)
endif
! Set some constants and compute the csync array.
if( first ) then
twopi=8.0*atan(1.0)

View File

@ -53,8 +53,6 @@ contains
write(datetime,1001) nutc !### TEMPORARY ###
1001 format("000000_",i6.6)
call ft8apset(mycall12,mygrid6,hiscall12,hisgrid6,bcontest,apsym,iaptype)
dd=iwave
ndecodes=0
allmessages=' '

View File

@ -53,8 +53,6 @@ contains
write(datetime,1001) nutc !### TEMPORARY ###
1001 format("000000_",i6.6)
call ft8apset(mycall12,mygrid6,hiscall12,hisgrid6,bcontest,apsym,iaptype)
dd=iwave
ndecodes=0
allmessages=' '

View File

@ -53,8 +53,6 @@ contains
write(datetime,1001) nutc !### TEMPORARY ###
1001 format("000000_",i6.6)
call ft8apset(mycall12,mygrid6,hiscall12,hisgrid6,bcontest,apsym,iaptype)
dd=iwave
ndecodes=0
allmessages=' '

View File

@ -53,8 +53,6 @@ contains
write(datetime,1001) nutc !### TEMPORARY ###
1001 format("000000_",i6.6)
call ft8apset(mycall12,mygrid6,hiscall12,hisgrid6,bcontest,apsym,iaptype)
dd=iwave
ndecodes=0
allmessages=' '

View File

@ -53,8 +53,6 @@ contains
write(datetime,1001) nutc !### TEMPORARY ###
1001 format("000000_",i6.6)
call ft8apset(mycall12,mygrid6,hiscall12,hisgrid6,bcontest,apsym,iaptype)
dd=iwave
ndecodes=0
allmessages=' '

View File

@ -83,11 +83,7 @@ extern "C" {
int* minw, float* px, float s[], float* df3, int* nhsym, int* npts8,
float *m_pxmax);
void genft8_(char* msg, char* MyGrid, bool* bcontest, int* i3bit, char* msgsent,
char ft8msgbits[], int itone[], fortran_charlen_t, fortran_charlen_t,
fortran_charlen_t);
void genjs8_(char* msg, char* MyGrid, bool* bcontest, int* i3bit, char* msgsent,
void genjs8_(char* msg, int* icos, char* MyGrid, bool* bcontest, int* i3bit, char* msgsent,
char ft8msgbits[], int itone[], fortran_charlen_t, fortran_charlen_t,
fortran_charlen_t);
@ -5492,6 +5488,7 @@ void MainWindow::guiUpdate()
if(m_tune) {
itone[0]=0;
} else if(m_modeTx=="FT8") {
int icos = 0;
bool bcontest=false;
char MyCall[6];
char MyGrid[6];
@ -5503,18 +5500,26 @@ void MainWindow::guiUpdate()
//m_i3bit=0;
char ft8msgbits[75 + 12]; //packed 75 bit ft8 message plus 12-bit CRC
// set which costas definition to use based on normal = old, the rest = new
if(m_nSubMode == Varicode::JS8CallNormal){
qDebug() << "gen ft8";
genft8_(message, MyGrid, &bcontest, &m_i3bit, msgsent, const_cast<char *> (ft8msgbits),
const_cast<int *> (itone), 22, 6, 22);
} else if (m_nSubMode == Varicode::JS8CallFast || m_nSubMode == Varicode::JS8CallTurbo || m_nSubMode == Varicode::JS8CallSlow || m_nSubMode == Varicode::JS8CallUltra){
icos=1;
} else if (m_nSubMode == Varicode::JS8CallSlow || m_nSubMode == Varicode::JS8CallFast || m_nSubMode == Varicode::JS8CallTurbo || m_nSubMode == Varicode::JS8CallUltra){
qDebug() << "gen js8";
genjs8_(message, MyGrid, &bcontest, &m_i3bit, msgsent, const_cast<char *> (ft8msgbits),
const_cast<int *> (itone), 22, 6, 22);
icos=2;
}
genjs8_(message, &icos, MyGrid, &bcontest, &m_i3bit, msgsent, const_cast<char *> (ft8msgbits),
const_cast<int *> (itone), 22, 6, 22);
qDebug() << "-> msg:" << message;
qDebug() << "-> bit:" << m_i3bit;
for(int i = 0; i < 7; i++){
qDebug() << "-> tone" << i << "=" << itone[i];
}
for(int i = JS8_NUM_SYMBOLS-7; i < JS8_NUM_SYMBOLS; i++){
qDebug() << "-> tone" << i << "=" << itone[i];
}
msgibits = m_i3bit;
msgsent[22]=0;