Add IMIX as a Frame Length mode

Use Simple IMIX as defined in Wikipedia - Frame lengths 64, 594, 1518 in
a 7:4:1 ratio
This commit is contained in:
Srivats P 2021-09-23 08:11:22 +05:30
parent 9f70f29499
commit d5365a25d4
6 changed files with 37 additions and 18 deletions

View File

@ -432,6 +432,12 @@ void StreamConfigDialog::on_cmbPktLenMode_currentIndexChanged(QString mode)
lePktLenMin->setEnabled(true);
lePktLenMax->setEnabled(true);
}
else if (mode == "IMIX")
{
lePktLen->setDisabled(true);
lePktLenMin->setDisabled(true);
lePktLenMax->setDisabled(true);
}
else
{
qWarning("Unhandled/Unknown PktLenMode = %s", qPrintable(mode));
@ -1165,12 +1171,7 @@ void StreamConfigDialog::on_lePacketsPerSec_textChanged(const QString &text)
{
bool isOk;
Stream *pStream = mpStream;
uint frameLen;
if (pStream->lenMode() == Stream::e_fl_fixed)
frameLen = pStream->frameLen();
else
frameLen = (pStream->frameLenMin() + pStream->frameLenMax())/2;
uint frameLen = pStream->frameLenAvg();
if (rbSendPackets->isChecked())
{
@ -1189,13 +1190,9 @@ void StreamConfigDialog::on_leBurstsPerSec_textChanged(const QString &text)
bool isOk;
Stream *pStream = mpStream;
uint burstSize = lePacketsPerBurst->text().toULong(&isOk);
uint frameLen;
uint frameLen = pStream->frameLenAvg();
qDebug("start of %s(%s)", __FUNCTION__, qPrintable(text));
if (pStream->lenMode() == Stream::e_fl_fixed)
frameLen = pStream->frameLen();
else
frameLen = (pStream->frameLenMin() + pStream->frameLenMax())/2;
if (rbSendBursts->isChecked())
{
@ -1215,12 +1212,7 @@ void StreamConfigDialog::on_leBitsPerSec_textEdited(const QString &text)
bool isOk;
Stream *pStream = mpStream;
uint burstSize = lePacketsPerBurst->text().toULong(&isOk);
uint frameLen;
if (pStream->lenMode() == Stream::e_fl_fixed)
frameLen = pStream->frameLen();
else
frameLen = (pStream->frameLenMin() + pStream->frameLenMax())/2;
uint frameLen = pStream->frameLenAvg();
if (rbSendPackets->isChecked())
{

View File

@ -108,6 +108,11 @@ QLineEdit:enabled[inputMask = "HH HH HH HH HH HH; "] { background-colo
<string>Random</string>
</property>
</item>
<item>
<property name="text">
<string>IMIX</string>
</property>
</item>
</widget>
</item>
<item row="0" column="1">

View File

@ -26,6 +26,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>
#include <qendian.h>
#if 0
#ifdef qDebug
#undef qDebug
#define qDebug(...)
#endif
#endif
/*!
\class AbstractProtocol

View File

@ -45,6 +45,7 @@ message StreamCore {
e_fl_inc = 1;
e_fl_dec = 2;
e_fl_random = 3;
e_fl_imix = 4;
}
// Basics

View File

@ -237,6 +237,14 @@ quint16 StreamBase::frameLen(int streamIndex) const
pktLen = frameLenMin() + (pktLen %
(frameLenMax() - frameLenMin() + 1));
break;
case OstProto::StreamCore::e_fl_imix: {
// 64, 594, 1518 in 7:4:1 ratio
// sizes mixed up intentionally below
static int imixPattern[12]
= {64, 594, 64, 594, 64, 1518, 64, 64, 594, 64, 594, 64};
pktLen = imixPattern[streamIndex % 12];
break;
}
default:
qWarning("Unhandled len mode %d. Using default 64",
lenMode());
@ -282,6 +290,8 @@ quint16 StreamBase::frameLenAvg() const
if (lenMode() == e_fl_fixed)
avgFrameLen = frameLen();
else if (lenMode() == e_fl_imix)
avgFrameLen = (7*64 + 4*594 + 1*1518)/12; // 64,594,1518 in 7:4:1 ratio
else
avgFrameLen = (frameLenMin() + frameLenMax())/2;
@ -470,6 +480,9 @@ int StreamBase::frameSizeVariableCount() const
case e_fl_random:
count = qMin(frameLenMax() - frameLenMin() + 1, frameCount());
break;
case OstProto::StreamCore::e_fl_imix:
count = 12; // 7:4:1 ratio, so 7+4+1
break;
default:
qWarning("%s: Unhandled len mode %d", __FUNCTION__, lenMode());
break;

View File

@ -51,7 +51,8 @@ public:
e_fl_fixed,
e_fl_inc,
e_fl_dec,
e_fl_random
e_fl_random,
e_fl_imix
};
enum SendUnit {