mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-06-16 13:32:27 -04:00
Benchmarking: added int to float decimation
This commit is contained in:
parent
efa168ec77
commit
a81e2f297a
@ -21,6 +21,7 @@ set(sdrbase_SOURCES
|
|||||||
dsp/ctcssdetector.cpp
|
dsp/ctcssdetector.cpp
|
||||||
dsp/cwkeyer.cpp
|
dsp/cwkeyer.cpp
|
||||||
dsp/cwkeyersettings.cpp
|
dsp/cwkeyersettings.cpp
|
||||||
|
dsp/decimatorsif.cpp
|
||||||
dsp/decimatorsff.cpp
|
dsp/decimatorsff.cpp
|
||||||
dsp/decimatorsfi.cpp
|
dsp/decimatorsfi.cpp
|
||||||
dsp/dspcommands.cpp
|
dsp/dspcommands.cpp
|
||||||
@ -105,6 +106,7 @@ set(sdrbase_HEADERS
|
|||||||
dsp/cwkeyer.h
|
dsp/cwkeyer.h
|
||||||
dsp/cwkeyersettings.h
|
dsp/cwkeyersettings.h
|
||||||
dsp/decimators.h
|
dsp/decimators.h
|
||||||
|
dsp/decimatorsif.h
|
||||||
dsp/decimatorsff.h
|
dsp/decimatorsff.h
|
||||||
dsp/decimatorsfi.h
|
dsp/decimatorsfi.h
|
||||||
dsp/decimatorsu.h
|
dsp/decimatorsu.h
|
||||||
|
22
sdrbase/dsp/decimatorsif.cpp
Normal file
22
sdrbase/dsp/decimatorsif.cpp
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Copyright (C) 2018 Edouard Griffiths, F4EXB //
|
||||||
|
// //
|
||||||
|
// This program is free software; you can redistribute it and/or modify //
|
||||||
|
// it under the terms of the GNU General Public License as published by //
|
||||||
|
// the Free Software Foundation as version 3 of the License, or //
|
||||||
|
// //
|
||||||
|
// This program is distributed in the hope that it will be useful, //
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
|
||||||
|
// GNU General Public License V3 for more details. //
|
||||||
|
// //
|
||||||
|
// You should have received a copy of the GNU General Public License //
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "decimatorsif.h"
|
||||||
|
|
||||||
|
const float decimation_scale<8>::scaleIn = 1.0/128.0;
|
||||||
|
const float decimation_scale<12>::scaleIn = 1.0/2048.0;
|
||||||
|
const float decimation_scale<16>::scaleIn = 1.0/32768.0;
|
||||||
|
|
1249
sdrbase/dsp/decimatorsif.h
Normal file
1249
sdrbase/dsp/decimatorsif.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -170,7 +170,7 @@ const int32_t HBFIRFilterTraits<64>::hbCoeffs[16] = {
|
|||||||
// (qint32)( 0.317657589850154464805598308885237202048 * (1 << hbShift)),
|
// (qint32)( 0.317657589850154464805598308885237202048 * (1 << hbShift)),
|
||||||
};
|
};
|
||||||
|
|
||||||
const double HBFIRFilterTraits<64>::hbCoeffsF[16] = {
|
const float HBFIRFilterTraits<64>::hbCoeffsF[16] = {
|
||||||
-0.0004653050334792540416659067936677729449,
|
-0.0004653050334792540416659067936677729449,
|
||||||
0.0007120490624526883919470643391491648799,
|
0.0007120490624526883919470643391491648799,
|
||||||
-0.0012303473710125558716887983479182366864,
|
-0.0012303473710125558716887983479182366864,
|
||||||
|
@ -69,7 +69,7 @@ struct SDRBASE_API HBFIRFilterTraits<64>
|
|||||||
static const int32_t hbShift = 12;
|
static const int32_t hbShift = 12;
|
||||||
static const int16_t hbMod[64+6];
|
static const int16_t hbMod[64+6];
|
||||||
static const int32_t hbCoeffs[16] __attribute__ ((aligned (32)));
|
static const int32_t hbCoeffs[16] __attribute__ ((aligned (32)));
|
||||||
static const double hbCoeffsF[16];
|
static const float hbCoeffsF[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
|
@ -107,9 +107,9 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
double m_even[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder]; // double buffer technique
|
float m_even[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder]; // double buffer technique
|
||||||
double m_odd[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder]; // double buffer technique
|
float m_odd[2][HBFIRFilterTraits<HBFilterOrder>::hbOrder]; // double buffer technique
|
||||||
double m_samples[HBFIRFilterTraits<HBFilterOrder>::hbOrder][2]; // double buffer technique
|
float m_samples[HBFIRFilterTraits<HBFilterOrder>::hbOrder][2]; // double buffer technique
|
||||||
|
|
||||||
int m_ptr;
|
int m_ptr;
|
||||||
int m_size;
|
int m_size;
|
||||||
@ -140,8 +140,8 @@ protected:
|
|||||||
|
|
||||||
void doFIR(float *x, float *y)
|
void doFIR(float *x, float *y)
|
||||||
{
|
{
|
||||||
double iAcc = 0;
|
float iAcc = 0;
|
||||||
double qAcc = 0;
|
float qAcc = 0;
|
||||||
|
|
||||||
//#if defined(USE_SSE4_1) && !defined(NO_DSP_SIMD)
|
//#if defined(USE_SSE4_1) && !defined(NO_DSP_SIMD)
|
||||||
// IntHalfbandFilterEO1Intrisics<HBFilterOrder>::work(
|
// IntHalfbandFilterEO1Intrisics<HBFilterOrder>::work(
|
||||||
|
@ -28,7 +28,7 @@ MainBench::MainBench(qtwebapp::LoggerWithFile *logger, const ParserBench& parser
|
|||||||
m_logger(logger),
|
m_logger(logger),
|
||||||
m_parser(parser),
|
m_parser(parser),
|
||||||
m_uniform_distribution_f(-1.0, 1.0),
|
m_uniform_distribution_f(-1.0, 1.0),
|
||||||
m_uniform_distribution_s16(-32768,32767)
|
m_uniform_distribution_s16(-2048, 2047)
|
||||||
{
|
{
|
||||||
qDebug() << "MainBench::MainBench: start";
|
qDebug() << "MainBench::MainBench: start";
|
||||||
m_instance = this;
|
m_instance = this;
|
||||||
@ -49,6 +49,8 @@ void MainBench::run()
|
|||||||
|
|
||||||
if (m_parser.getTestType() == ParserBench::TestDecimatorsII) {
|
if (m_parser.getTestType() == ParserBench::TestDecimatorsII) {
|
||||||
testDecimateII();
|
testDecimateII();
|
||||||
|
} else if (m_parser.getTestType() == ParserBench::TestDecimatorsIF) {
|
||||||
|
testDecimateIF();
|
||||||
} else if (m_parser.getTestType() == ParserBench::TestDecimatorsFI) {
|
} else if (m_parser.getTestType() == ParserBench::TestDecimatorsFI) {
|
||||||
testDecimateFI();
|
testDecimateFI();
|
||||||
} else if (m_parser.getTestType() == ParserBench::TestDecimatorsFF) {
|
} else if (m_parser.getTestType() == ParserBench::TestDecimatorsFF) {
|
||||||
@ -87,6 +89,33 @@ void MainBench::testDecimateII()
|
|||||||
delete[] buf;
|
delete[] buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainBench::testDecimateIF()
|
||||||
|
{
|
||||||
|
QElapsedTimer timer;
|
||||||
|
qint64 nsecs = 0;
|
||||||
|
|
||||||
|
qDebug() << "MainBench::testDecimateIF: create test data";
|
||||||
|
|
||||||
|
qint16 *buf = new qint16[m_parser.getNbSamples()*2];
|
||||||
|
m_convertBufferF.resize(m_parser.getNbSamples()/(1<<m_parser.getLog2Factor()));
|
||||||
|
auto my_rand = std::bind(m_uniform_distribution_s16, m_generator);
|
||||||
|
std::generate(buf, buf + m_parser.getNbSamples()*2 - 1, my_rand);
|
||||||
|
|
||||||
|
qDebug() << "MainBench::testDecimateIF: run test";
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < m_parser.getRepetition(); i++)
|
||||||
|
{
|
||||||
|
timer.start();
|
||||||
|
decimateIF(buf, m_parser.getNbSamples()*2);
|
||||||
|
nsecs += timer.nsecsElapsed();
|
||||||
|
}
|
||||||
|
|
||||||
|
printResults("MainBench::testDecimateIF", nsecs);
|
||||||
|
|
||||||
|
qDebug() << "MainBench::testDecimateIF: cleanup test data";
|
||||||
|
delete[] buf;
|
||||||
|
}
|
||||||
|
|
||||||
void MainBench::testDecimateFI()
|
void MainBench::testDecimateFI()
|
||||||
{
|
{
|
||||||
QElapsedTimer timer;
|
QElapsedTimer timer;
|
||||||
@ -173,6 +202,38 @@ void MainBench::decimateII(const qint16* buf, int len)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainBench::decimateIF(const qint16* buf, int len)
|
||||||
|
{
|
||||||
|
FSampleVector::iterator it = m_convertBufferF.begin();
|
||||||
|
|
||||||
|
switch (m_parser.getLog2Factor())
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
|
m_decimatorsIF.decimate1(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
m_decimatorsIF.decimate2_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
m_decimatorsIF.decimate4_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
m_decimatorsIF.decimate8_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
m_decimatorsIF.decimate16_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 5:
|
||||||
|
m_decimatorsIF.decimate32_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
m_decimatorsIF.decimate64_cen(&it, buf, len);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainBench::decimateFI(const float *buf, int len)
|
void MainBench::decimateFI(const float *buf, int len)
|
||||||
{
|
{
|
||||||
SampleVector::iterator it = m_convertBuffer.begin();
|
SampleVector::iterator it = m_convertBuffer.begin();
|
||||||
|
@ -24,6 +24,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
#include "dsp/decimators.h"
|
#include "dsp/decimators.h"
|
||||||
|
#include "dsp/decimatorsif.h"
|
||||||
#include "dsp/decimatorsfi.h"
|
#include "dsp/decimatorsfi.h"
|
||||||
#include "dsp/decimatorsff.h"
|
#include "dsp/decimatorsff.h"
|
||||||
#include "parserbench.h"
|
#include "parserbench.h"
|
||||||
@ -47,9 +48,11 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void testDecimateII();
|
void testDecimateII();
|
||||||
|
void testDecimateIF();
|
||||||
void testDecimateFI();
|
void testDecimateFI();
|
||||||
void testDecimateFF();
|
void testDecimateFF();
|
||||||
void decimateII(const qint16 *buf, int len);
|
void decimateII(const qint16 *buf, int len);
|
||||||
|
void decimateIF(const qint16 *buf, int len);
|
||||||
void decimateFI(const float *buf, int len);
|
void decimateFI(const float *buf, int len);
|
||||||
void decimateFF(const float *buf, int len);
|
void decimateFF(const float *buf, int len);
|
||||||
void printResults(const QString& prefix, qint64 nsecs);
|
void printResults(const QString& prefix, qint64 nsecs);
|
||||||
@ -66,6 +69,7 @@ private:
|
|||||||
#else
|
#else
|
||||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimatorsII;
|
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimatorsII;
|
||||||
#endif
|
#endif
|
||||||
|
DecimatorsIF<qint16, 12> m_decimatorsIF;
|
||||||
DecimatorsFI m_decimatorsFI;
|
DecimatorsFI m_decimatorsFI;
|
||||||
DecimatorsFF m_decimatorsFF;
|
DecimatorsFF m_decimatorsFF;
|
||||||
|
|
||||||
|
@ -118,6 +118,8 @@ ParserBench::TestType ParserBench::getTestType() const
|
|||||||
return TestDecimatorsFI;
|
return TestDecimatorsFI;
|
||||||
} else if (m_testStr == "decimateff") {
|
} else if (m_testStr == "decimateff") {
|
||||||
return TestDecimatorsFF;
|
return TestDecimatorsFF;
|
||||||
|
}else if (m_testStr == "decimateif") {
|
||||||
|
return TestDecimatorsIF;
|
||||||
} else {
|
} else {
|
||||||
return TestDecimatorsII;
|
return TestDecimatorsII;
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,7 @@ public:
|
|||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
TestDecimatorsII,
|
TestDecimatorsII,
|
||||||
|
TestDecimatorsIF,
|
||||||
TestDecimatorsFI,
|
TestDecimatorsFI,
|
||||||
TestDecimatorsFF
|
TestDecimatorsFF
|
||||||
} TestType;
|
} TestType;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user