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 ntol; //+/- decoding range around fQSO (Hz)
int kin; // number of frames written to d2
int nsz; // number of frames to use in the decoder (period size)
int nzhsym;
int nsubmode;
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 prog_args
@ -29,13 +29,13 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
real ss(184,NSMAX)
logical baddata,newdat65,newdat9,single_decode,bVHF,bad0,newdat
integer*2 id2(NTMAX*12000)
integer*2 id1(NTMAX*12000)
type(params_block) :: params
character(len=20) :: datetime
character(len=12) :: mycall, hiscall
character(len=6) :: mygrid, hisgrid
save
type(counting_ft8_decoder) :: my_js8a
type(counting_ft8_decoder) :: my_js8a
type(counting_js8b_decoder) :: my_js8b
type(counting_js8c_decoder) :: my_js8c
type(counting_js8d_decoder) :: my_js8d
@ -78,11 +78,11 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
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
call timer('decjs8d ',0)
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%nexp_decode,params%ndepth,logical(params%nagain), &
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
call timer('decjs8c ',0)
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%nexp_decode,params%ndepth,logical(params%nagain), &
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
call timer('decjs8b ',0)
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%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
@ -117,11 +117,11 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
go to 800
endif
if(params%nmode.eq.8) then
if(params%nmode.eq.8 .and. params%nsubmode.eq.0) then
! We're in JS8 mode A
call timer('decjs8a ',0)
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%nexp_decode,params%ndepth,logical(params%nagain), &
logical(params%lft8apon),logical(params%lapcqonly),params%napwid, &
@ -130,8 +130,8 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
go to 800
endif
rms=sqrt(dot_product(float(id2(300000:310000)), &
float(id2(300000:310000)))/10000.0)
rms=sqrt(dot_product(float(id1(300000:310000)), &
float(id1(300000:310000)))/10000.0)
if(rms.lt.2.0) go to 800
! 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.
do n=1,nadd
k=k+1
sq=sq + float(id2(k))**2
sq=sq + float(id1(k))**2
enddo
rms=sqrt(sq/nadd)
if(rms.gt.10000.0) then
@ -153,11 +153,11 @@ subroutine multimode_decoder(ss,id2,params,nfsample)
enddo
if(bad0) then
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
npts65=52*12000
if(baddata(id2,npts65)) then
if(baddata(id1,npts65)) then
nsynced=0
ndecoded=0
go to 800

View File

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

View File

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

View File

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