mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-09-26 14:56:33 -04:00
Benchmarking: added actual decimator test
This commit is contained in:
parent
375db9ae21
commit
698f5bd172
@ -25,12 +25,15 @@ add_library(sdrbench SHARED
|
|||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
.
|
.
|
||||||
|
${CMAKE_SOURCE_DIR}/exports
|
||||||
|
${CMAKE_SOURCE_DIR}/sdrbase
|
||||||
${CMAKE_SOURCE_DIR}/logging
|
${CMAKE_SOURCE_DIR}/logging
|
||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(sdrbench
|
target_link_libraries(sdrbench
|
||||||
${QT_LIBRARIES}
|
${QT_LIBRARIES}
|
||||||
|
sdrbase
|
||||||
logging
|
logging
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -17,6 +17,8 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
|
||||||
#include "mainbench.h"
|
#include "mainbench.h"
|
||||||
|
|
||||||
MainBench *MainBench::m_instance = 0;
|
MainBench *MainBench::m_instance = 0;
|
||||||
@ -31,16 +33,74 @@ MainBench::MainBench(qtwebapp::LoggerWithFile *logger, const ParserBench& parser
|
|||||||
qDebug() << "MainBench::MainBench: end";
|
qDebug() << "MainBench::MainBench: end";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MainBench::~MainBench()
|
||||||
|
{}
|
||||||
|
|
||||||
void MainBench::run()
|
void MainBench::run()
|
||||||
{
|
{
|
||||||
qDebug() << "MainBench::run: work in progress";
|
QElapsedTimer timer;
|
||||||
|
qint64 nsecs;
|
||||||
|
|
||||||
qDebug() << "MainBench::run: parameters:"
|
qDebug() << "MainBench::run: parameters:"
|
||||||
<< " test: " << m_parser.getTest()
|
<< " test: " << m_parser.getTest()
|
||||||
<< " nsamples: " << m_parser.getNbSamples()
|
<< " nsamples: " << m_parser.getNbSamples()
|
||||||
<< " repet: " << m_parser.getRepetition()
|
<< " repet: " << m_parser.getRepetition()
|
||||||
<< " log2f: " << m_parser.getLog2Factor();
|
<< " log2f: " << m_parser.getLog2Factor();
|
||||||
|
|
||||||
|
qDebug() << "MainBench::run: create test data";
|
||||||
|
|
||||||
|
m_buf = new qint16[m_parser.getNbSamples()*2];
|
||||||
|
m_convertBuffer.resize(m_parser.getNbSamples()/(1<<m_parser.getLog2Factor()));
|
||||||
|
|
||||||
|
qDebug() << "MainBench::run: run test";
|
||||||
|
timer.start();
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < m_parser.getRepetition(); i++)
|
||||||
|
{
|
||||||
|
decimate(m_buf, m_parser.getNbSamples()*2);
|
||||||
|
}
|
||||||
|
|
||||||
|
nsecs = timer.nsecsElapsed();
|
||||||
|
QDebug debug = qDebug();
|
||||||
|
debug.noquote();
|
||||||
|
debug << tr("MainBench::run: ran test in %L1 ns").arg(nsecs);
|
||||||
|
|
||||||
|
|
||||||
|
qDebug() << "MainBench::run: cleanup test data";
|
||||||
|
|
||||||
|
delete[] m_buf;
|
||||||
|
|
||||||
emit finished();
|
emit finished();
|
||||||
}
|
}
|
||||||
|
|
||||||
MainBench::~MainBench()
|
void MainBench::decimate(const qint16* buf, int len)
|
||||||
{}
|
{
|
||||||
|
SampleVector::iterator it = m_convertBuffer.begin();
|
||||||
|
|
||||||
|
switch (m_parser.getLog2Factor())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
m_decimators.decimate1(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
m_decimators.decimate2_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
m_decimators.decimate4_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
m_decimators.decimate8_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
m_decimators.decimate16_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
m_decimators.decimate32_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
m_decimators.decimate64_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "dsp/decimators.h"
|
||||||
#include "parserbench.h"
|
#include "parserbench.h"
|
||||||
|
|
||||||
namespace qtwebapp {
|
namespace qtwebapp {
|
||||||
@ -41,9 +42,20 @@ signals:
|
|||||||
void finished();
|
void finished();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void decimate(const qint16 *buf, int len);
|
||||||
|
|
||||||
static MainBench *m_instance;
|
static MainBench *m_instance;
|
||||||
qtwebapp::LoggerWithFile *m_logger;
|
qtwebapp::LoggerWithFile *m_logger;
|
||||||
const ParserBench& m_parser;
|
const ParserBench& m_parser;
|
||||||
|
|
||||||
|
#ifdef SDR_RX_SAMPLE_24BIT
|
||||||
|
Decimators<qint64, qint16, SDR_RX_SAMP_SZ, 12> m_decimators;
|
||||||
|
#else
|
||||||
|
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
qint16 *m_buf;
|
||||||
|
SampleVector m_convertBuffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SDRBENCH_MAINBENCH_H_
|
#endif // SDRBENCH_MAINBENCH_H_
|
||||||
|
Loading…
Reference in New Issue
Block a user