mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-16 12:48:42 -04:00
Get rid of jt9com and npar common blocks
Also use correct C binding and have compilers determine sizes and offsets. The wsjtx.exe program now owns the decoder shared data that is shared with symspec. It is now in struct dec_data, still a global variable for now but hopefully a MainWindow member variable soon. The struct dec_data (in both C/C++ and Fortran) has a sub structure with the decoder parameters which enables copying and manipulating a lot cleaner. New of changed types of shared data must still be modified in commons.h and a new file lib/jt9com.f90, they must stay in sync as a pointer to the structure is passed between C and Fortran. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6290 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
+18
-18
@@ -40,19 +40,19 @@ void Detector::clear ()
|
||||
// set index to roughly where we are in time (1ms resolution)
|
||||
// qint64 now (QDateTime::currentMSecsSinceEpoch ());
|
||||
// unsigned msInPeriod ((now % 86400000LL) % (m_period * 1000));
|
||||
// jt9com_.kin = qMin ((msInPeriod * m_frameRate) / 1000, static_cast<unsigned> (sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0])));
|
||||
jt9com_.kin = 0;
|
||||
// dec_data.params.kin = qMin ((msInPeriod * m_frameRate) / 1000, static_cast<unsigned> (sizeof (dec_data.d2) / sizeof (dec_data.d2[0])));
|
||||
dec_data.params.kin = 0;
|
||||
m_bufferPos = 0;
|
||||
|
||||
// fill buffer with zeros (G4WJS commented out because it might cause decoder hangs)
|
||||
// qFill (jt9com_.d2, jt9com_.d2 + sizeof (jt9com_.d2) / sizeof (jt9com_.d2[0]), 0);
|
||||
// qFill (dec_data.d2, dec_data.d2 + sizeof (dec_data.d2) / sizeof (dec_data.d2[0]), 0);
|
||||
}
|
||||
|
||||
qint64 Detector::writeData (char const * data, qint64 maxSize)
|
||||
{
|
||||
int ns=secondInPeriod();
|
||||
if(ns < m_ns) { // When ns has wrapped around to zero, restart the buffers
|
||||
jt9com_.kin = 0;
|
||||
dec_data.params.kin = 0;
|
||||
m_bufferPos = 0;
|
||||
}
|
||||
m_ns=ns;
|
||||
@@ -60,15 +60,15 @@ qint64 Detector::writeData (char const * data, qint64 maxSize)
|
||||
// no torn frames
|
||||
Q_ASSERT (!(maxSize % static_cast<qint64> (bytesPerFrame ())));
|
||||
// these are in terms of input frames (not down sampled)
|
||||
size_t framesAcceptable ((sizeof (jt9com_.d2) /
|
||||
sizeof (jt9com_.d2[0]) - jt9com_.kin) * m_downSampleFactor);
|
||||
size_t framesAcceptable ((sizeof (dec_data.d2) /
|
||||
sizeof (dec_data.d2[0]) - dec_data.params.kin) * m_downSampleFactor);
|
||||
size_t framesAccepted (qMin (static_cast<size_t> (maxSize /
|
||||
bytesPerFrame ()), framesAcceptable));
|
||||
|
||||
if (framesAccepted < static_cast<size_t> (maxSize / bytesPerFrame ())) {
|
||||
qDebug () << "dropped " << maxSize / bytesPerFrame () - framesAccepted
|
||||
<< " frames of data on the floor!"
|
||||
<< jt9com_.kin << ns;
|
||||
<< dec_data.params.kin << ns;
|
||||
}
|
||||
|
||||
for (unsigned remaining = framesAccepted; remaining; ) {
|
||||
@@ -83,28 +83,28 @@ qint64 Detector::writeData (char const * data, qint64 maxSize)
|
||||
if(m_bufferPos==m_samplesPerFFT*m_downSampleFactor) {
|
||||
qint32 framesToProcess (m_samplesPerFFT * m_downSampleFactor);
|
||||
qint32 framesAfterDownSample (m_samplesPerFFT);
|
||||
if(framesToProcess==13824 and jt9com_.kin>=0 and
|
||||
jt9com_.kin < (NTMAX*12000 - framesAfterDownSample)) {
|
||||
fil4_(&m_buffer[0], &framesToProcess, &jt9com_.d2[jt9com_.kin],
|
||||
if(framesToProcess==13824 and dec_data.params.kin>=0 and
|
||||
dec_data.params.kin < (NTMAX*12000 - framesAfterDownSample)) {
|
||||
fil4_(&m_buffer[0], &framesToProcess, &dec_data.d2[dec_data.params.kin],
|
||||
&framesAfterDownSample);
|
||||
jt9com_.kin += framesAfterDownSample;
|
||||
dec_data.params.kin += framesAfterDownSample;
|
||||
} else {
|
||||
qDebug() << "framesToProcess = " << framesToProcess;
|
||||
qDebug() << "jt9com_.kin = " << jt9com_.kin;
|
||||
qDebug() << "secondInPeriod = " << secondInPeriod();
|
||||
qDebug() << "framesToProcess = " << framesToProcess;
|
||||
qDebug() << "dec_data.params.kin = " << dec_data.params.kin;
|
||||
qDebug() << "secondInPeriod = " << secondInPeriod();
|
||||
qDebug() << "framesAfterDownSample" << framesAfterDownSample;
|
||||
}
|
||||
Q_EMIT framesWritten (jt9com_.kin);
|
||||
Q_EMIT framesWritten (dec_data.params.kin);
|
||||
m_bufferPos = 0;
|
||||
}
|
||||
|
||||
} else {
|
||||
store (&data[(framesAccepted - remaining) * bytesPerFrame ()],
|
||||
numFramesProcessed, &jt9com_.d2[jt9com_.kin]);
|
||||
numFramesProcessed, &dec_data.d2[dec_data.params.kin]);
|
||||
m_bufferPos += numFramesProcessed;
|
||||
jt9com_.kin += numFramesProcessed;
|
||||
dec_data.params.kin += numFramesProcessed;
|
||||
if (m_bufferPos == static_cast<unsigned> (m_samplesPerFFT)) {
|
||||
Q_EMIT framesWritten (jt9com_.kin);
|
||||
Q_EMIT framesWritten (dec_data.params.kin);
|
||||
m_bufferPos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user