Initial experimentation

This commit is contained in:
Jordan Sherer 2019-10-25 14:15:45 -04:00
parent feeb6540a7
commit 56d457a056
6 changed files with 59 additions and 22 deletions

View File

@ -58,6 +58,7 @@ qint64 Detector::writeData (char const * data, qint64 maxSize)
{ {
int ns=secondInPeriod(); int ns=secondInPeriod();
if(ns < m_ns) { // When ns has wrapped around to zero, restart the buffers if(ns < m_ns) { // When ns has wrapped around to zero, restart the buffers
dec_data.params.kpos = 0;
dec_data.params.kin = 0; dec_data.params.kin = 0;
m_bufferPos = 0; m_bufferPos = 0;
} }
@ -117,8 +118,6 @@ qint64 Detector::writeData (char const * data, qint64 maxSize)
remaining -= numFramesProcessed; remaining -= numFramesProcessed;
} }
return maxSize; // we drop any data past the end of the buffer on return maxSize; // we drop any data past the end of the buffer on
// the floor until the next period starts // the floor until the next period starts
} }

View File

@ -69,6 +69,7 @@ extern struct dec_data {
float ss[184*NSMAX]; // symbol spectra float ss[184*NSMAX]; // symbol spectra
float savg[NSMAX]; float savg[NSMAX];
float sred[5760]; float sred[5760];
short int d1[NTMAX*RX_SAMPLE_RATE]; // sample frame buffer
short int d2[NTMAX*RX_SAMPLE_RATE]; // sample frame buffer short int d2[NTMAX*RX_SAMPLE_RATE]; // sample frame buffer
struct struct
{ {
@ -85,7 +86,9 @@ extern struct dec_data {
int nfSplit; //JT65 | JT9 split frequency int nfSplit; //JT65 | JT9 split frequency
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; int knum; // maximum number of frames per period in d2
int kpos; // number of frames already processed in d2
int kin; // number of frames available in d2
int nzhsym; int nzhsym;
int nsubmode; int nsubmode;
bool nagain; bool nagain;

View File

@ -61,7 +61,7 @@ subroutine jt9a()
local_params=shared_data%params !save a copy because wsjtx carries on accessing local_params=shared_data%params !save a copy because wsjtx carries on accessing
call flush(6) call flush(6)
call timer('decoder ',0) call timer('decoder ',0)
call multimode_decoder(shared_data%ss,shared_data%id2,local_params,12000) call multimode_decoder(shared_data%ss,shared_data%id1,local_params,12000)
call timer('decoder ',1) call timer('decoder ',1)
100 inquire(file=trim(temp_dir)//'/.lock',exist=fileExists) 100 inquire(file=trim(temp_dir)//'/.lock',exist=fileExists)

View File

@ -18,6 +18,8 @@
integer(c_int) :: nfsplit integer(c_int) :: nfsplit
integer(c_int) :: nfb integer(c_int) :: nfb
integer(c_int) :: ntol integer(c_int) :: ntol
integer(c_int) :: knum
integer(c_int) :: kpos
integer(c_int) :: kin integer(c_int) :: kin
integer(c_int) :: nzhsym integer(c_int) :: nzhsym
integer(c_int) :: nsubmode integer(c_int) :: nsubmode
@ -52,6 +54,7 @@
real(c_float) :: ss(184,NSMAX) real(c_float) :: ss(184,NSMAX)
real(c_float) :: savg(NSMAX) real(c_float) :: savg(NSMAX)
real(c_float) :: sred(5760) real(c_float) :: sred(5760)
integer(c_short) :: id1(NMAX)
integer(c_short) :: id2(NMAX) integer(c_short) :: id2(NMAX)
type(params_block) :: params type(params_block) :: params
end type dec_data end type dec_data

View File

@ -2,7 +2,8 @@ subroutine symspec(shared_data,k,ntrperiod,nsps,ingain,nminw,pxdb,s, &
df3,ihsym,npts8,pxdbmax) df3,ihsym,npts8,pxdbmax)
! Input: ! Input:
! k pointer to the most recent new data ! shared_data pointer to the most recent new data
! k frames in that data
! ntrperiod T/R sequence length, minutes ! ntrperiod T/R sequence length, minutes
! nsps samples per symbol, at 12000 Hz ! nsps samples per symbol, at 12000 Hz
! ndiskdat 0/1 to indicate if data from disk ! ndiskdat 0/1 to indicate if data from disk

View File

@ -2496,9 +2496,9 @@ void MainWindow::dataSink(qint64 frames)
int nsps=m_nsps; int nsps=m_nsps;
int nsmo=m_wideGraph->smoothYellow()-1; int nsmo=m_wideGraph->smoothYellow()-1;
symspec_(&dec_data,&k,&trmin,&nsps,&m_inGain,&nsmo,&m_px,s,&m_df3,&m_ihsym,&m_npts8,&m_pxmax); symspec_(&dec_data,&k,&trmin,&nsps,&m_inGain,&nsmo,&m_px,s,&m_df3,&m_ihsym,&m_npts8,&m_pxmax);
qDebug() << "dataSink" << k << "ihsym" << m_ihsym;
if(m_mode=="WSPR") wspr_downsample_(dec_data.d2,&k);
if(m_ihsym <=0) return; if(m_ihsym <=0) return;
if(ui) ui->signal_meter_widget->setValue(m_px,m_pxmax); // Update thermometer if(ui) ui->signal_meter_widget->setValue(m_px,m_pxmax); // Update thermometer
if(m_monitoring || m_diskData) { if(m_monitoring || m_diskData) {
m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData); m_wideGraph->dataSink2(s,m_df3,m_ihsym,m_diskData);
@ -2519,22 +2519,38 @@ void MainWindow::dataSink(qint64 frames)
int submode = m_nSubMode; int submode = m_nSubMode;
int period = m_TRperiod; int period = m_TRperiod;
qint32 halfSymbolStop = m_hsymStop; qint32 halfSymbolStop = m_hsymStop;
bool newDataReady = m_ihsym == m_hsymStop; //bool newDataReady = m_ihsym == m_hsymStop;
bool newDataReady = m_ihsym % m_hsymStop == 0;
#if 0 #if 0
if(m_nSubMode == Varicode::JS8CallNormal) static int lastn = 0;
{
int n = now.time().second(); int n = now.time().second();
if(!m_decoderBusy) // m_nSubMode == Varicode::JS8CallNormal)
{
#if 0 #if 0
if(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;
submode = Varicode::JS8CallNormal;
newDataReady = true;
m_hsymStop = m_ihsym;
} }
if(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;
submode = Varicode::JS8CallFast;
newDataReady = true;
m_hsymStop = m_ihsym;
} }
if(n % JS8C_TX_SECONDS == 0){ if(lastn != n && n % JS8C_TX_SECONDS == 0){
qDebug() << "could decode turbo now" << n; qDebug() << "could decode turbo now" << n;
period = JS8C_TX_SECONDS;
submode = Varicode::JS8CallTurbo;
newDataReady = true;
m_hsymStop = m_ihsym;
} }
lastn = n;
#endif #endif
#if 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
@ -2575,12 +2591,19 @@ void MainWindow::dataSink(qint64 frames)
dec_data.params.newdat=1; dec_data.params.newdat=1;
dec_data.params.nagain=0; dec_data.params.nagain=0;
dec_data.params.nzhsym=halfSymbolStop; dec_data.params.nzhsym=halfSymbolStop;
dec_data.params.knum=period * RX_SAMPLE_RATE;
m_dateTime = now.toString ("yyyy-MMM-dd hh:mm"); m_dateTime = now.toString ("yyyy-MMM-dd hh:mm");
//qDebug() << now << "half symbol" << m_ihsym << "stop symbol" << m_hsymStop; //qDebug() << now << "half symbol" << m_ihsym << "stop symbol" << m_hsymStop;
if(!m_mode.startsWith ("WSPR")){ if(!m_mode.startsWith ("WSPR")){
#if 1
decode(submode, period); //Start decoder 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);
#endif
} }
if(!m_diskData) { //Always save; may delete later if(!m_diskData) { //Always save; may delete later
@ -3888,6 +3911,7 @@ void MainWindow::decode(int submode, int period)
m_msec0=DriftingDateTime::currentMSecsSinceEpoch(); m_msec0=DriftingDateTime::currentMSecsSinceEpoch();
if(!m_dataAvailable or m_TRperiod==0) return; if(!m_dataAvailable or m_TRperiod==0) return;
ui->DecodeButton->setChecked (true); ui->DecodeButton->setChecked (true);
if(dec_data.params.nagain==0 && dec_data.params.newdat==1 && (!m_diskData)) { if(dec_data.params.nagain==0 && dec_data.params.newdat==1 && (!m_diskData)) {
qint64 ms = DriftingDateTime::currentMSecsSinceEpoch() % 86400000; qint64 ms = DriftingDateTime::currentMSecsSinceEpoch() % 86400000;
@ -3903,6 +3927,11 @@ void MainWindow::decode(int submode, int period)
int isec=t.toString("ss").toInt(); int isec=t.toString("ss").toInt();
isec=isec - isec%m_TRperiod; isec=isec - isec%m_TRperiod;
dec_data.params.nutc=10000*ihr + 100*imin + isec; dec_data.params.nutc=10000*ihr + 100*imin + isec;
// qint64 now (DriftingDateTime::currentMSecsSinceEpoch ());
//unsigned msInPeriod = (ms % (period * 1000));
//unsigned frameInPeriod = qMin ((msInPeriod * RX_SAMPLE_RATE) / 1000, static_cast<unsigned> (sizeof (dec_data.d2) / sizeof (dec_data.d2[0])));
//dec_data.params.kpos = qMax(0, (period * RX_SAMPLE_RATE));
} }
} }
@ -3985,6 +4014,8 @@ 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);
qDebug() << "knum" << dec_data.params.knum << "kpos" << dec_data.params.kpos << "kin" << dec_data.params.kin;
//newdat=1 ==> this is new data, must do the big FFT //newdat=1 ==> this is new data, must do the big FFT
//nagain=1 ==> decode only at fQSO +/- Tol //nagain=1 ==> decode only at fQSO +/- Tol