Avoid the ring buffer if we're operating on disk data

This commit is contained in:
Jordan Sherer 2019-10-31 07:53:48 -04:00
parent 3a46548527
commit fdac8556f5
2 changed files with 24 additions and 14 deletions

View File

@ -7,6 +7,7 @@
#define RX_SAMPLE_RATE 12000 #define RX_SAMPLE_RATE 12000
#define JS8_USE_REFSPEC 1 // compute the signal refspec #define JS8_USE_REFSPEC 1 // compute the signal refspec
#define JS8_USE_IHSYM 1 // compute ihsym manually instead of from symspec
#define JS8_RING_BUFFER 1 // use a ring buffer instead of clearing the decode frames #define JS8_RING_BUFFER 1 // use a ring buffer instead of clearing the decode frames
#define JS8_DECODER_ONE 1 // decode only one mode at a time #define JS8_DECODER_ONE 1 // decode only one mode at a time
#define JS8_DECODER_E2S 0 // decode every 2 seconds instead of at the half symbol stop #define JS8_DECODER_E2S 0 // decode every 2 seconds instead of at the half symbol stop

View File

@ -2520,7 +2520,7 @@ void MainWindow::dataSink(qint64 frames)
int nsmo=m_wideGraph->smoothYellow()-1; int nsmo=m_wideGraph->smoothYellow()-1;
/// START IHSYM /// START IHSYM
#if JS8_USE_IHSYM
// moving ihsym computation to here from symspec.f90 // moving ihsym computation to here from symspec.f90
// 1) set the initial ihsym // 1) set the initial ihsym
if(m_ihsym == 0){ if(m_ihsym == 0){
@ -2542,6 +2542,9 @@ void MainWindow::dataSink(qint64 frames)
qDebug() << "dataSink" << k << "ihsym" << m_ihsym << "ihs" << ihs; qDebug() << "dataSink" << k << "ihsym" << m_ihsym << "ihs" << ihs;
/// END IHSYM /// END IHSYM
#else
symspec_(&dec_data,&k,&trmin,&nsps,&m_inGain,&nsmo,&m_px,s,&m_df3,&m_ihsym,&m_npts8,&m_pxmax);
#endif
if(m_ihsym <= 0) return; if(m_ihsym <= 0) return;
@ -4061,6 +4064,11 @@ void MainWindow::decode(int submode, int period)
// clear out d1 // clear out d1
memset(dec_data.d1, 0, sizeof(dec_data.d1)); memset(dec_data.d1, 0, sizeof(dec_data.d1));
// copy the whole sample if disk data, otherwise, copy the needed frames
if(m_diskData){
qDebug() << "try decode from" << 0 << "to" << dec_data.params.kin;
memcpy(dec_data.d1, dec_data.d2, sizeof(dec_data.d2));
} else {
// compute frames to copy for decoding // compute frames to copy for decoding
int neededFrames = dec_data.params.nzhsym * m_nsps / 2.0; int neededFrames = dec_data.params.nzhsym * m_nsps / 2.0;
int start = qMax(0, dec_data.params.kin-neededFrames); int start = qMax(0, dec_data.params.kin-neededFrames);
@ -4076,6 +4084,7 @@ void MainWindow::decode(int submode, int period)
memcpy(dec_data.d1, &dec_data.d2[maxFrames-missingFrames], sizeof(dec_data.d2[0]) * missingFrames); memcpy(dec_data.d1, &dec_data.d2[maxFrames-missingFrames], sizeof(dec_data.d2[0]) * missingFrames);
} }
memcpy(dec_data.d1 + missingFrames, dec_data.d2 + start, sizeof(dec_data.d2[0]) * availableFrames); memcpy(dec_data.d1 + missingFrames, dec_data.d2 + start, sizeof(dec_data.d2[0]) * availableFrames);
}
#else #else
qDebug() << "try decode from" << 0 << "to" << dec_data.params.kin; qDebug() << "try decode from" << 0 << "to" << dec_data.params.kin;
memset(dec_data.d1, 0, sizeof(dec_data.d1)); memset(dec_data.d1, 0, sizeof(dec_data.d1));