Updated ultra to 4, reorgnazed fixStop, and testing new decode patterns

This commit is contained in:
Jordan Sherer 2019-10-29 09:55:32 -04:00
parent b526e274f8
commit 0ca7b0e5ed
5 changed files with 57 additions and 57 deletions

View File

@ -88,6 +88,7 @@ extern struct dec_data {
int nfb; //High decode limit (Hz) int nfb; //High decode limit (Hz)
int ntol; //+/- decoding range around fQSO (Hz) int ntol; //+/- decoding range around fQSO (Hz)
int kin; // number of frames written to d2 int kin; // number of frames written to d2
int nsz; // number of frames to use in the decoder (period size)
int nzhsym; int nzhsym;
int nsubmode; int nsubmode;
bool nagain; bool nagain;

View File

@ -1,4 +1,4 @@
subroutine multimode_decoder(ss,id2,params,nfsample) subroutine multimode_decoder(ss,id1,params,nfsample)
!$ use omp_lib !$ use omp_lib
use prog_args use prog_args
@ -29,13 +29,13 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
real ss(184,NSMAX) real ss(184,NSMAX)
logical baddata,newdat65,newdat9,single_decode,bVHF,bad0,newdat logical baddata,newdat65,newdat9,single_decode,bVHF,bad0,newdat
integer*2 id2(NTMAX*12000) integer*2 id1(NTMAX*12000)
type(params_block) :: params type(params_block) :: params
character(len=20) :: datetime character(len=20) :: datetime
character(len=12) :: mycall, hiscall character(len=12) :: mycall, hiscall
character(len=6) :: mygrid, hisgrid character(len=6) :: mygrid, hisgrid
save save
type(counting_ft8_decoder) :: my_js8a type(counting_ft8_decoder) :: my_js8a
type(counting_js8b_decoder) :: my_js8b type(counting_js8b_decoder) :: my_js8b
type(counting_js8c_decoder) :: my_js8c type(counting_js8c_decoder) :: my_js8c
type(counting_js8d_decoder) :: my_js8d type(counting_js8d_decoder) :: my_js8d
@ -78,11 +78,11 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
endif endif
endif endif
if(params%nmode.eq.8 .and. params%nsubmode.eq.3) then if(params%nmode.eq.8 .and. params%nsubmode.eq.4) then
! We're in JS8 mode D ! We're in JS8 mode D
call timer('decjs8d ',0) call timer('decjs8d ',0)
newdat=params%newdat newdat=params%newdat
call my_js8d%decode(js8d_decoded,id2,params%nQSOProgress,params%nfqso, & call my_js8d%decode(js8d_decoded,id1,params%nQSOProgress,params%nfqso, &
params%nftx,newdat,params%nutc,params%nfa,params%nfb, & params%nftx,newdat,params%nutc,params%nfa,params%nfb, &
params%nexp_decode,params%ndepth,logical(params%nagain), & params%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, & logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
@ -95,7 +95,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
! We're in JS8 mode C ! We're in JS8 mode C
call timer('decjs8c ',0) call timer('decjs8c ',0)
newdat=params%newdat newdat=params%newdat
call my_js8c%decode(js8c_decoded,id2,params%nQSOProgress,params%nfqso, & call my_js8c%decode(js8c_decoded,id1,params%nQSOProgress,params%nfqso, &
params%nftx,newdat,params%nutc,params%nfa,params%nfb, & params%nftx,newdat,params%nutc,params%nfa,params%nfb, &
params%nexp_decode,params%ndepth,logical(params%nagain), & params%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, & logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
@ -108,7 +108,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
! We're in JS8 mode B ! We're in JS8 mode B
call timer('decjs8b ',0) call timer('decjs8b ',0)
newdat=params%newdat newdat=params%newdat
call my_js8b%decode(js8b_decoded,id2,params%nQSOProgress,params%nfqso, & call my_js8b%decode(js8b_decoded,id1,params%nQSOProgress,params%nfqso, &
params%nftx,newdat,params%nutc,params%nfa,params%nfb, & params%nftx,newdat,params%nutc,params%nfa,params%nfb, &
params%nexp_decode,params%ndepth,logical(params%nagain), & params%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, & logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
@ -117,11 +117,11 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
go to 800 go to 800
endif endif
if(params%nmode.eq.8) then if(params%nmode.eq.8 .and. params%nsubmode.eq.0) then
! We're in JS8 mode A ! We're in JS8 mode A
call timer('decjs8a ',0) call timer('decjs8a ',0)
newdat=params%newdat newdat=params%newdat
call my_js8a%decode(js8a_decoded,id2,params%nQSOProgress,params%nfqso, & call my_js8a%decode(js8a_decoded,id1,params%nQSOProgress,params%nfqso, &
params%nftx,newdat,params%nutc,params%nfa,params%nfb, & params%nftx,newdat,params%nutc,params%nfa,params%nfb, &
params%nexp_decode,params%ndepth,logical(params%nagain), & params%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, & logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
@ -130,8 +130,8 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
go to 800 go to 800
endif endif
rms=sqrt(dot_product(float(id2(300000:310000)), & rms=sqrt(dot_product(float(id1(300000:310000)), &
float(id2(300000:310000)))/10000.0) float(id1(300000:310000)))/10000.0)
if(rms.lt.2.0) go to 800 if(rms.lt.2.0) go to 800
! Zap data at start that might come from T/R switching transient? ! Zap data at start that might come from T/R switching transient?
@ -142,7 +142,7 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
sq=0. sq=0.
do n=1,nadd do n=1,nadd
k=k+1 k=k+1
sq=sq + float(id2(k))**2 sq=sq + float(id1(k))**2
enddo enddo
rms=sqrt(sq/nadd) rms=sqrt(sq/nadd)
if(rms.gt.10000.0) then if(rms.gt.10000.0) then
@ -153,11 +153,11 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
enddo enddo
if(bad0) then if(bad0) then
nz=min(NTMAX*12000,kbad+100) nz=min(NTMAX*12000,kbad+100)
! id2(1:nz)=0 ! temporarily disabled as it can breaak the JT9 decoder, maybe others ! id1(1:nz)=0 ! temporarily disabled as it can breaak the JT9 decoder, maybe others
endif endif
npts65=52*12000 npts65=52*12000
if(baddata(id2,npts65)) then if(baddata(id1,npts65)) then
nsynced=0 nsynced=0
ndecoded=0 ndecoded=0
go to 800 go to 800

View File

@ -19,6 +19,7 @@
integer(c_int) :: nfb integer(c_int) :: nfb
integer(c_int) :: ntol integer(c_int) :: ntol
integer(c_int) :: kin integer(c_int) :: kin
integer(c_int) :: nsz
integer(c_int) :: nzhsym integer(c_int) :: nzhsym
integer(c_int) :: nsubmode integer(c_int) :: nsubmode
logical(c_bool) :: nagain logical(c_bool) :: nagain

View File

@ -2455,7 +2455,7 @@ void MainWindow::setDecodedTextFont (QFont const& font)
void MainWindow::fixStop() void MainWindow::fixStop()
{ {
#if 1 #if 0
m_hsymStop=((int(m_TRperiod/0.288))/8)*8 - 1; // 0.288 because 6912/12000/2 = 0.288 m_hsymStop=((int(m_TRperiod/0.288))/8)*8 - 1; // 0.288 because 6912/12000/2 = 0.288
if(m_nSubMode == Varicode::JS8CallUltra){ if(m_nSubMode == Varicode::JS8CallUltra){
m_hsymStop++; m_hsymStop++;
@ -2463,18 +2463,15 @@ void MainWindow::fixStop()
#elif 0 #elif 0
m_hsymStop = int(m_TRperiod/0.288); m_hsymStop = int(m_TRperiod/0.288);
#else #else
if(m_nSubMode == Varicode::JS8CallNormal){ int symbolSamples = 0;
m_hsymStop = int(((float)JS8A_SYMBOL_SAMPLES*(float)JS8_NUM_SYMBOLS/(float)RX_SAMPLE_RATE)/0.288); float threshold = 1.0;
} switch(m_nSubMode){
else if(m_nSubMode == Varicode::JS8CallFast){ case Varicode::JS8CallNormal: symbolSamples = JS8A_SYMBOL_SAMPLES; break;
m_hsymStop = int(((float)JS8B_SYMBOL_SAMPLES*(float)JS8_NUM_SYMBOLS/(float)RX_SAMPLE_RATE)/0.288); case Varicode::JS8CallFast: symbolSamples = JS8B_SYMBOL_SAMPLES; break;
} case Varicode::JS8CallTurbo: symbolSamples = JS8C_SYMBOL_SAMPLES; break;
else if(m_nSubMode == Varicode::JS8CallTurbo){ case Varicode::JS8CallUltra: symbolSamples = JS8D_SYMBOL_SAMPLES; break;
m_hsymStop = int(((float)JS8C_SYMBOL_SAMPLES*(float)JS8_NUM_SYMBOLS/(float)RX_SAMPLE_RATE)/0.288);
}
else if(m_nSubMode == Varicode::JS8CallUltra){
m_hsymStop = int(((float)JS8D_SYMBOL_SAMPLES*(float)JS8_NUM_SYMBOLS/(float)RX_SAMPLE_RATE)/0.288);
} }
m_hsymStop = qFloor(float(symbolSamples*JS8_NUM_SYMBOLS + threshold*RX_SAMPLE_RATE)/(float)m_nsps*2.0);
#endif #endif
} }
@ -2551,10 +2548,9 @@ void MainWindow::dataSink(qint64 frames)
QDateTime now {DriftingDateTime::currentDateTimeUtc ()}; QDateTime now {DriftingDateTime::currentDateTimeUtc ()};
// if the current half symbol index is the half symbol stop index, then proceed // if the current half symbol index is the half symbol stop index, then proceed
int submode = m_nSubMode; qint32 submode = m_nSubMode;
int period = m_TRperiod; qint32 period = m_TRperiod;
qint32 halfSymbolStop = m_hsymStop; qint32 halfSymbolStop = m_hsymStop;
//bool newDataReady = m_ihsym == m_hsymStop;
bool newDataReady = m_ihsym % m_hsymStop == 0; bool newDataReady = m_ihsym % m_hsymStop == 0;
#if 0 #if 0
@ -2564,6 +2560,7 @@ void MainWindow::dataSink(qint64 frames)
if(!m_decoderBusy) // m_nSubMode == Varicode::JS8CallNormal) if(!m_decoderBusy) // m_nSubMode == Varicode::JS8CallNormal)
{ {
#if 0
if(lastn != n && n % JS8A_TX_SECONDS == 0){ if(lastn != n && n % JS8A_TX_SECONDS == 0){
qDebug() << "could decode normal now" << n; qDebug() << "could decode normal now" << n;
period = JS8A_TX_SECONDS; period = JS8A_TX_SECONDS;
@ -2571,8 +2568,7 @@ void MainWindow::dataSink(qint64 frames)
newDataReady = true; newDataReady = true;
m_hsymStop = m_ihsym; m_hsymStop = m_ihsym;
} }
lastn = n;
#if 0
if(lastn != n && n % JS8B_TX_SECONDS == 0){ if(lastn != n && n % JS8B_TX_SECONDS == 0){
qDebug() << "could decode fast now" << n; qDebug() << "could decode fast now" << n;
period = JS8B_TX_SECONDS; period = JS8B_TX_SECONDS;
@ -2587,29 +2583,29 @@ void MainWindow::dataSink(qint64 frames)
newDataReady = true; newDataReady = true;
m_hsymStop = m_ihsym; m_hsymStop = m_ihsym;
} }
lastn = n;
#endif #elif 0
#if 0
qint32 hsymNormalStop = ((int(JS8A_TX_SECONDS/0.288))/8)*8 - 1; // 0.288 because 6912/12000/2 = 0.288 qint32 hsymNormalStop = ((int(JS8A_TX_SECONDS/0.288))/8)*8 - 1; // 0.288 because 6912/12000/2 = 0.288
qint32 hsymFastStop = ((int(JS8B_TX_SECONDS/0.288))/8)*8 - 1; // 0.288 because 6912/12000/2 = 0.288 qint32 hsymFastStop = ((int(JS8B_TX_SECONDS/0.288))/8)*8 - 1; // 0.288 because 6912/12000/2 = 0.288
qint32 hsymTurboStop = ((int(JS8C_TX_SECONDS/0.288))/8)*8 - 1; // 0.288 because 6912/12000/2 = 0.288 qint32 hsymTurboStop = ((int(JS8C_TX_SECONDS/0.288))/8)*8 - 1; // 0.288 because 6912/12000/2 = 0.288
if(m_ihsym % hsymNormalStop == 0){ /// if(m_ihsym % hsymNormalStop == 0){
period = JS8A_TX_SECONDS; /// period = JS8A_TX_SECONDS;
submode = Varicode::JS8CallNormal; /// submode = Varicode::JS8CallNormal;
halfSymbolStop= hsymNormalStop; /// halfSymbolStop= hsymNormalStop;
qDebug() << "could decode normal now" << n; /// qDebug() << "could decode normal now" << n;
newDataReady = true; /// newDataReady = true;
} /// }
if(m_ihsym % hsymFastStop == 0){ /// if(m_ihsym % hsymFastStop == 0){
period = JS8B_TX_SECONDS; /// period = JS8B_TX_SECONDS;
submode = Varicode::JS8CallFast; /// submode = Varicode::JS8CallFast;
halfSymbolStop= hsymFastStop; /// halfSymbolStop= hsymFastStop;
qDebug() << "could decode fast now" << n; /// qDebug() << "could decode fast now" << n;
newDataReady = true; /// newDataReady = true;
} /// }
if(m_ihsym % hsymTurboStop == 0){ if(m_ihsym % hsymTurboStop == 0 || m_ihsym == hsymTurboStop/2-1){
period = JS8C_TX_SECONDS; period = JS8C_TX_SECONDS;
submode = Varicode::JS8CallTurbo; submode = Varicode::JS8CallTurbo;
dec_data.params.nsz = hsymTurboStop * m_nsps / 2;
halfSymbolStop= hsymTurboStop; halfSymbolStop= hsymTurboStop;
qDebug() << "could decode turbo now" << n; qDebug() << "could decode turbo now" << n;
newDataReady = true; newDataReady = true;
@ -2633,8 +2629,8 @@ void MainWindow::dataSink(qint64 frames)
decode(submode, period); //Start decoder decode(submode, period); //Start decoder
#else #else
if(n % JS8A_TX_SECONDS == 0) decode(Varicode::JS8CallNormal, JS8A_TX_SECONDS); if(n % JS8A_TX_SECONDS == 0) decode(Varicode::JS8CallNormal, JS8A_TX_SECONDS);
if(n % JS8B_TX_SECONDS == 0) decode(Varicode::JS8CallFast, JS8B_TX_SECONDS); if(n % JS8B_TX_SECONDS == 0) decode(Varicode::JS8CallFast, JS8B_TX_SECONDS);
if(n % JS8C_TX_SECONDS == 0) decode(Varicode::JS8CallTurbo, JS8C_TX_SECONDS); if(n % JS8C_TX_SECONDS == 0) decode(Varicode::JS8CallTurbo, JS8C_TX_SECONDS);
#endif #endif
if(!m_diskData) { //Always save; may delete later if(!m_diskData) { //Always save; may delete later
@ -4039,9 +4035,11 @@ void MainWindow::decode(int submode, int period)
strncpy(dec_data.params.hiscall,(hisCall + " ").toLatin1 ().constData (), 12); strncpy(dec_data.params.hiscall,(hisCall + " ").toLatin1 ().constData (), 12);
strncpy(dec_data.params.hisgrid,(hisGrid + " ").toLatin1 ().constData (), 6); strncpy(dec_data.params.hisgrid,(hisGrid + " ").toLatin1 ().constData (), 6);
#if JS8_RING_BUFFER #if 0 // JS8_RING_BUFFER
unsigned maxframe = period * RX_SAMPLE_RATE; // TODO: m_TRperiod here needs to be replaced with what we send to m_detector period
unsigned periodFrames = m_hsymStop * m_nsps / 2; unsigned maxframe = m_TRperiod * RX_SAMPLE_RATE;
unsigned periodFrames = dec_data.params.nsz; //m_hsymStop * m_nsps / 2;
//dec_data.params.nsz = periodFrames;
memset(dec_data.d1, 0, sizeof(dec_data.d1)); memset(dec_data.d1, 0, sizeof(dec_data.d1));
if(dec_data.params.kin < periodFrames){ if(dec_data.params.kin < periodFrames){
@ -4049,11 +4047,11 @@ void MainWindow::decode(int submode, int period)
int delta = periodFrames - dec_data.params.kin; int delta = periodFrames - dec_data.params.kin;
memcpy(dec_data.d1, &dec_data.d2[maxframe-delta], delta * sizeof(dec_data.d2[0])); memcpy(dec_data.d1, &dec_data.d2[maxframe-delta], delta * sizeof(dec_data.d2[0]));
memcpy(&dec_data.d1[delta * sizeof(dec_data.d2[0])], dec_data.d2, dec_data.params.kin * sizeof(dec_data.d2[0])); memcpy(&dec_data.d1[delta * sizeof(dec_data.d2[0])], dec_data.d2, dec_data.params.kin * sizeof(dec_data.d2[0]));
//qDebug() << "try decode from" << (maxframe-delta) << "to" << dec_data.params.kin << "at beginning of buffer with delta" << delta << "and period" << periodFrames; qDebug() << "try decode from" << (maxframe-delta) << "to" << dec_data.params.kin << "at beginning of buffer with delta" << delta << "and period frames" << periodFrames;
} else { } else {
// decode the last N frames based on the current tr period // decode the last N frames based on the current tr period
memcpy(dec_data.d1, &dec_data.d2[dec_data.params.kin-periodFrames], periodFrames * sizeof(dec_data.d2[0])); memcpy(dec_data.d1, &dec_data.d2[dec_data.params.kin-periodFrames], periodFrames * sizeof(dec_data.d2[0]));
//qDebug() << "try decode from" << (dec_data.params.kin-periodFrames) << "to" << dec_data.params.kin << "with period" << periodFrames; qDebug() << "try decode from" << (dec_data.params.kin-periodFrames) << "to" << dec_data.params.kin << "with period frames" << periodFrames;
} }
#else #else
memset(dec_data.d1, 0, sizeof(dec_data.d1)); memset(dec_data.d1, 0, sizeof(dec_data.d1));

View File

@ -28,7 +28,7 @@ public:
JS8CallNormal = 0, JS8CallNormal = 0,
JS8CallFast = 1, JS8CallFast = 1,
JS8CallTurbo = 2, JS8CallTurbo = 2,
JS8CallUltra = 3 JS8CallUltra = 4
}; };
// frame type transmitted via itype and decoded by the ft8 decoded // frame type transmitted via itype and decoded by the ft8 decoded