mirror of
https://github.com/f4exb/sdrangel.git
synced 2025-05-28 05:02:25 -04:00
Merge branch 'dev'
This commit is contained in:
commit
f4e2ac61f8
@ -28,6 +28,7 @@ option(V4L-MSI "Use Linux Kernel MSI2500 Source." OFF)
|
||||
option(BUILD_TYPE "Build type (RELEASE, RELEASEWITHDBGINFO, DEBUG" RELEASE)
|
||||
option(DEBUG_OUTPUT "Print debug messages" OFF)
|
||||
option(HOST_RPI "Compiling on RPi" OFF)
|
||||
option(RX_SAMPLE_24BIT "Internal 24 bit Rx DSP" OFF)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules)
|
||||
|
||||
@ -186,6 +187,9 @@ elseif (${ARCHITECTURE} MATCHES "aarch64")
|
||||
endif()
|
||||
|
||||
# Compiler flags.
|
||||
if (RX_SAMPLE_24BIT)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSDR_RX_SAMPLE_24BIT")
|
||||
endif()
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fmax-errors=10 -ffast-math -ftree-vectorize ${EXTRA_FLAGS}")
|
||||
|
||||
##############################################################################
|
||||
|
17
Readme.md
17
Readme.md
@ -81,6 +81,8 @@ If you use your own location for libairspyhf install directory you need to speci
|
||||
|
||||
`-DLIBAIRSPYHF_LIBRARIES=/opt/install/libairspyhf/lib/libairspyhf.so -DLIBAIRSPYHF_INCLUDE_DIR=/opt/install/libairspyhf/include`
|
||||
|
||||
It is recommended to add `-DRX_SAMPLE_24BIT` on the cmake command line to activate the Rx 24 bit DSP build and take advantage of improved dynamic range when using decimation.
|
||||
|
||||
<h2>BladeRF</h2>
|
||||
|
||||
[BladeRF](https://www.nuand.com/) is supported through the libbladerf library that should be installed in your system for proper build of the software and operation support. Add `libbladerf-dev` to the list of dependencies to install.
|
||||
@ -160,7 +162,7 @@ If you use your own location for libmirisdr-4 install directory you need to spec
|
||||
|
||||
<h1>Plugins for special devices</h1>
|
||||
|
||||
These plugins do not use any hardware device connected to your system. They support "virtual" devices related to the file system or the network.
|
||||
These plugins do not use any hardware device connected to your system.
|
||||
|
||||
<h2>File input</h2>
|
||||
|
||||
@ -176,6 +178,10 @@ The [File sink plugin](https://github.com/f4exb/sdrangel/tree/dev/plugins/sample
|
||||
|
||||
Note that this plugin does not require any of the hardware support libraries nor the libusb library. It is always available in the list of devices as `FileSink[0]` even if no physical device is connected.
|
||||
|
||||
<h2>Test source</h2>
|
||||
|
||||
The [Test source plugin](https://github.com/f4exb/sdrangel/tree/master/plugins/samplesource/testsource) is an internal continuous wave generator that can be used to carry out test of software internals.
|
||||
|
||||
<h2>SDRdaemon receiver input</h2>
|
||||
|
||||
Linux only.
|
||||
@ -290,6 +296,15 @@ To be sure you will need at least Qt version 5.5. It definitely does not work wi
|
||||
- Windows 32 build is made with 5.9.1 and has Qt ANGLE support (OpenGL emulation with DirectX)
|
||||
- Windows 64 build is made with 5.9.1 and has no Qt ANGLE support (native OpenGL)
|
||||
|
||||
<h2>24 bit DSP</h2>
|
||||
|
||||
By default all Rx DSP processes use 16 bit samples coded on int16 fields. In order to use 24 bit samples coded on int32 fields you can specify `-DRX_SAMPLE_24BIT` on the cmake command line. This will give more dynamic range when the number of bits with decimation exceeds 16 bits:
|
||||
|
||||
- RTL-SDR, HackRF: (8 bit native) no advantage
|
||||
- Funcube Pro and Pro+: (16 bit native) no decimation hence no advantage
|
||||
- Airspy, BladeRF, LimeSDR, PlutoSDR, SDRPlay: (12 bit native) advantage for decimation by 32 or 64
|
||||
- AirspyHF: (16 bit native) advantage for any decimation
|
||||
|
||||
<h2>Ubuntu</h2>
|
||||
|
||||
<h3>Prerequisites for 14.04 LTS</h3>
|
||||
|
17
app/main.cpp
17
app/main.cpp
@ -24,6 +24,7 @@
|
||||
|
||||
#include "loggerwithfile.h"
|
||||
#include "mainwindow.h"
|
||||
#include "dsp/dsptypes.h"
|
||||
|
||||
static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *logger)
|
||||
{
|
||||
@ -34,7 +35,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
|
||||
*/
|
||||
QCoreApplication::setOrganizationName("f4exb");
|
||||
QCoreApplication::setApplicationName("SDRangel");
|
||||
QCoreApplication::setApplicationVersion("3.11.0");
|
||||
QCoreApplication::setApplicationVersion("3.11.1");
|
||||
|
||||
#if 1
|
||||
qApp->setStyle(QStyleFactory::create("fusion"));
|
||||
@ -95,19 +96,25 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
|
||||
parser.parse(*qApp);
|
||||
|
||||
#if QT_VERSION >= 0x050400
|
||||
qInfo("%s %s Qt %s %db %s %s",
|
||||
qInfo("%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld",
|
||||
qPrintable(qApp->applicationName()),
|
||||
qPrintable(qApp->applicationVersion()),
|
||||
qPrintable(QString(QT_VERSION_STR)),
|
||||
QT_POINTER_SIZE*8,
|
||||
qPrintable(QSysInfo::currentCpuArchitecture()),
|
||||
qPrintable(QSysInfo::prettyProductName()));
|
||||
qPrintable(QSysInfo::prettyProductName()),
|
||||
SDR_RX_SAMP_SZ,
|
||||
SDR_TX_SAMP_SZ,
|
||||
qApp->applicationPid());
|
||||
#else
|
||||
qInfo("%s %s Qt %s %db",
|
||||
qInfo("%s %s Qt %s %db DSP Rx:%db Tx:%db PID: %lld",
|
||||
qPrintable(qApp->applicationName()),
|
||||
qPrintable((qApp->applicationVersion()),
|
||||
qPrintable(QString(QT_VERSION_STR)),
|
||||
QT_POINTER_SIZE*8);
|
||||
QT_POINTER_SIZE*8,
|
||||
SDR_RX_SAMP_SZ,
|
||||
SDR_TX_SAMP_SZ,
|
||||
applicationPid);
|
||||
#endif
|
||||
|
||||
MainWindow w(logger, parser);
|
||||
|
@ -25,6 +25,7 @@
|
||||
|
||||
#include "loggerwithfile.h"
|
||||
#include "maincore.h"
|
||||
#include "dsp/dsptypes.h"
|
||||
|
||||
void handler(int sig) {
|
||||
fprintf(stderr, "quit the application by signal(%d).\n", sig);
|
||||
@ -55,7 +56,7 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
|
||||
|
||||
QCoreApplication::setOrganizationName("f4exb");
|
||||
QCoreApplication::setApplicationName("SDRangelSrv");
|
||||
QCoreApplication::setApplicationVersion("3.11.0");
|
||||
QCoreApplication::setApplicationVersion("3.11.1");
|
||||
|
||||
int catchSignals[] = {SIGQUIT, SIGINT, SIGTERM, SIGHUP};
|
||||
std::vector<int> vsig(catchSignals, catchSignals + sizeof(catchSignals) / sizeof(int));
|
||||
@ -65,19 +66,25 @@ static int runQtApplication(int argc, char* argv[], qtwebapp::LoggerWithFile *lo
|
||||
parser.parse(a);
|
||||
|
||||
#if QT_VERSION >= 0x050400
|
||||
qInfo("%s %s Qt %s %db %s %s",
|
||||
qPrintable(qApp->applicationName()),
|
||||
qPrintable(qApp->applicationVersion()),
|
||||
qInfo("%s %s Qt %s %db %s %s DSP Rx:%db Tx:%db PID %lld",
|
||||
qPrintable(QCoreApplication::applicationName()),
|
||||
qPrintable(QCoreApplication::applicationVersion()),
|
||||
qPrintable(QString(QT_VERSION_STR)),
|
||||
QT_POINTER_SIZE*8,
|
||||
qPrintable(QSysInfo::currentCpuArchitecture()),
|
||||
qPrintable(QSysInfo::prettyProductName()));
|
||||
qPrintable(QSysInfo::prettyProductName()),
|
||||
SDR_RX_SAMP_SZ,
|
||||
SDR_TX_SAMP_SZ,
|
||||
QCoreApplication::applicationPid());
|
||||
#else
|
||||
qInfo("%s %s Qt %s %db",
|
||||
qPrintable(qApp->applicationName()),
|
||||
qPrintable((qApp->applicationVersion()),
|
||||
qInfo("%s %s Qt %s %db DSP Rx:%db Tx:%db PID %lld",
|
||||
qPrintable(QCoreApplication::applicationName()),
|
||||
qPrintable((QCoreApplication::>applicationVersion()),
|
||||
qPrintable(QString(QT_VERSION_STR)),
|
||||
QT_POINTER_SIZE*8);
|
||||
QT_POINTER_SIZE*8,
|
||||
SDR_RX_SAMP_SZ,
|
||||
SDR_TX_SAMP_SZ,
|
||||
QCoreApplication::applicationPid());
|
||||
#endif
|
||||
|
||||
MainCore m(logger, parser, &a);
|
||||
|
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -1,3 +1,9 @@
|
||||
sdrangel (3.11.1-1) unstable; urgency=medium
|
||||
|
||||
* Replaced hardcoded bit scaling literals by defines. 24 bit sample option.
|
||||
|
||||
-- Edouard Griffiths, F4EXB <f4exb06@gmail.com> Sun, 28 Jan 2018 12:14:18 +0100
|
||||
|
||||
sdrangel (3.11.0-1) unstable; urgency=medium
|
||||
|
||||
* AirspyHF: support
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <QtGlobal>
|
||||
|
||||
#include "dsp/dsptypes.h"
|
||||
#include "dsp/wfir.h"
|
||||
#include "deviceplutosdr.h"
|
||||
#include "deviceplutosdrbox.h"
|
||||
@ -638,7 +639,7 @@ void DevicePlutoSDRBox::formatFIRCoefficients(std::ostringstream& ostr, uint32_t
|
||||
WFIR::BasicFIR(fcoeffs, nbTaps, WFIR::LPF, normalizedBW, 0.0, normalizedBW < 0.2 ? WFIR::wtHAMMING : WFIR::wtBLACKMAN_HARRIS, 0.0);
|
||||
|
||||
for (unsigned int i = 0; i < nbTaps; i++) {
|
||||
ostr << (int16_t) (fcoeffs[i] * 32768.0) << ", " << (int16_t) (fcoeffs[i] * 32768.0) << std::endl;
|
||||
ostr << (int16_t) (fcoeffs[i] * 32768.0f) << ", " << (int16_t) (fcoeffs[i] * 32768.0f) << std::endl;
|
||||
}
|
||||
|
||||
delete[] fcoeffs;
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 68 KiB |
Binary file not shown.
@ -5,12 +5,14 @@ find_package(LibUSB)
|
||||
set(airspyhf_SOURCES
|
||||
${LIBAIRSPYHFSRC}/libairspyhf/src/airspyhf.c
|
||||
${LIBAIRSPYHFSRC}/libairspyhf/src/iqbalancer.c
|
||||
${LIBAIRSPYHFSRC}/libairspyhf/src/iqconverter_int16.c
|
||||
)
|
||||
|
||||
set(airspyhf_HEADERS
|
||||
${LIBAIRSPYHFSRC}/libairspyhf/src/airspyhf.h
|
||||
${LIBAIRSPYHFSRC}/libairspyhf/src/airspyhf_commands.h
|
||||
${LIBAIRSPYHFSRC}/libairspyhf/src/iqbalancer.h
|
||||
${LIBAIRSPYHFSRC}/libairspyhf/src/iqconverter_int16.h
|
||||
)
|
||||
|
||||
include_directories(
|
||||
|
@ -92,7 +92,6 @@ void ChannelAnalyzer::feed(const SampleVector::const_iterator& begin, const Samp
|
||||
|
||||
for(SampleVector::const_iterator it = begin; it < end; ++it)
|
||||
{
|
||||
//Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
Complex c(it->real(), it->imag());
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
@ -115,16 +114,16 @@ void ChannelAnalyzer::feed(const SampleVector::const_iterator& begin, const Samp
|
||||
if (!(m_undersampleCount++ & decim_mask))
|
||||
{
|
||||
m_sum /= decim;
|
||||
m_magsq = (m_sum.real() * m_sum.real() + m_sum.imag() * m_sum.imag())/ (1<<30);
|
||||
Real re = m_sum.real() / SDR_RX_SCALED;
|
||||
Real im = m_sum.imag() / SDR_RX_SCALED;
|
||||
m_magsq = re*re + im*im;
|
||||
|
||||
if (m_ssb & !m_usb)
|
||||
{ // invert spectrum for LSB
|
||||
//m_sampleBuffer.push_back(Sample(m_sum.imag() * 32768.0, m_sum.real() * 32768.0));
|
||||
m_sampleBuffer.push_back(Sample(m_sum.imag(), m_sum.real()));
|
||||
}
|
||||
else
|
||||
{
|
||||
//m_sampleBuffer.push_back(Sample(m_sum.real() * 32768.0, m_sum.imag() * 32768.0));
|
||||
m_sampleBuffer.push_back(Sample(m_sum.real(), m_sum.imag()));
|
||||
}
|
||||
|
||||
|
@ -338,8 +338,8 @@ ChannelAnalyzerGUI::ChannelAnalyzerGUI(PluginAPI* pluginAPI, DeviceUISet *device
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
|
||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||
m_scopeVis = new ScopeVis(ui->glScope);
|
||||
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
|
||||
m_scopeVis = new ScopeVis(SDR_RX_SCALEF, ui->glScope);
|
||||
m_spectrumScopeComboVis = new SpectrumScopeComboVis(m_spectrumVis, m_scopeVis);
|
||||
m_channelAnalyzer = (ChannelAnalyzer*) rxChannel; //new ChannelAnalyzer(m_deviceUISet->m_deviceSourceAPI);
|
||||
m_channelAnalyzer->setSampleSink(m_spectrumScopeComboVis);
|
||||
|
@ -229,16 +229,16 @@ private:
|
||||
if (!(m_undersampleCount++ & (decim - 1))) // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
|
||||
{
|
||||
m_sum /= decim;
|
||||
m_magsq = (m_sum.real() * m_sum.real() + m_sum.imag() * m_sum.imag())/ (1<<30);
|
||||
Real re = m_sum.real() / SDR_RX_SCALED;
|
||||
Real im = m_sum.imag() / SDR_RX_SCALED;
|
||||
m_magsq = re*re + im*im;
|
||||
|
||||
if (m_running.m_ssb & !m_usb)
|
||||
{ // invert spectrum for LSB
|
||||
//m_sampleBuffer.push_back(Sample(m_sum.imag() * 32768.0, m_sum.real() * 32768.0));
|
||||
m_sampleBuffer.push_back(Sample(m_sum.imag(), m_sum.real()));
|
||||
}
|
||||
else
|
||||
{
|
||||
//m_sampleBuffer.push_back(Sample(m_sum.real() * 32768.0, m_sum.imag() * 32768.0));
|
||||
m_sampleBuffer.push_back(Sample(m_sum.real(), m_sum.imag()));
|
||||
}
|
||||
|
||||
|
@ -395,7 +395,7 @@ ChannelAnalyzerNGGUI::ChannelAnalyzerNGGUI(PluginAPI* pluginAPI, DeviceUISet *de
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
|
||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
|
||||
m_scopeVis = new ScopeVisNG(ui->glScope);
|
||||
m_spectrumScopeComboVis = new SpectrumScopeNGComboVis(m_spectrumVis, m_scopeVis);
|
||||
m_channelAnalyzer = (ChannelAnalyzerNG*) rxChannel; //new ChannelAnalyzerNG(m_deviceUISet->m_deviceSourceAPI);
|
||||
@ -464,8 +464,6 @@ bool ChannelAnalyzerNGGUI::setNewFinalRate(int spanLog2)
|
||||
}
|
||||
|
||||
m_spanLog2 = spanLog2;
|
||||
//m_rate = 48000 / (1<<spanLog2);
|
||||
//m_rate = m_channelizer->getInputSampleRate() / (1<<spanLog2);
|
||||
m_rate = getRequestedChannelSampleRate() / (1<<spanLog2);
|
||||
|
||||
if (m_rate == 0) {
|
||||
|
@ -89,7 +89,6 @@ void AMDemod::feed(const SampleVector::const_iterator& begin, const SampleVector
|
||||
|
||||
for (SampleVector::const_iterator it = begin; it != end; ++it)
|
||||
{
|
||||
//Complex c(it->real() / 32768.0, it->imag() / 32768.0);
|
||||
Complex c(it->real(), it->imag());
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
|
@ -161,8 +161,9 @@ private:
|
||||
|
||||
void processOneSample(Complex &ci)
|
||||
{
|
||||
Real magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (1<<30);
|
||||
Real re = ci.real() / SDR_RX_SCALED;
|
||||
Real im = ci.imag() / SDR_RX_SCALED;
|
||||
Real magsq = re*re + im*im;
|
||||
m_movingAverage.feed(magsq);
|
||||
m_magsq = m_movingAverage.average();
|
||||
m_magsqSum += magsq;
|
||||
@ -209,7 +210,7 @@ private:
|
||||
|
||||
Real attack = (m_squelchCount - 0.05f * m_settings.m_audioSampleRate) / (0.05f * m_settings.m_audioSampleRate);
|
||||
sample = demod * attack * 2048 * m_settings.m_volume;
|
||||
if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(demod * attack * 32768);
|
||||
if (m_settings.m_copyAudioToUDP) m_udpBufferAudio->write(demod * attack * SDR_RX_SCALEF);
|
||||
|
||||
m_squelchOpen = true;
|
||||
}
|
||||
|
@ -338,8 +338,7 @@ void ATVDemod::demod(Complex& c)
|
||||
magSq = fltI*fltI + fltQ*fltQ;
|
||||
m_objMagSqAverage.feed(magSq);
|
||||
fltNorm = sqrt(magSq);
|
||||
fltVal = fltNorm / (1<<15);
|
||||
//fltVal = magSq / (1<<30);
|
||||
fltVal = fltNorm / SDR_RX_SCALEF;
|
||||
|
||||
//********** Mini and Maxi Amplitude tracking **********
|
||||
|
||||
@ -414,7 +413,7 @@ void ATVDemod::demod(Complex& c)
|
||||
fltVal = (fltVal < -1.0f) ? -1.0f : (fltVal > 1.0f) ? 1.0f : fltVal;
|
||||
|
||||
if ((m_running.m_intVideoTabIndex == 1) && (m_scopeSink != 0)) { // feed scope buffer only if scope is present and visible
|
||||
m_scopeSampleBuffer.push_back(Sample(fltVal*32767.0f, 0.0f));
|
||||
m_scopeSampleBuffer.push_back(Sample(fltVal*SDR_RX_SCALEF, 0.0f));
|
||||
}
|
||||
|
||||
m_fltAmpLineAverage += fltVal;
|
||||
|
@ -474,7 +474,7 @@ void ATVDemodGUI::tick()
|
||||
if (m_atvDemod)
|
||||
{
|
||||
m_objMagSqAverage.feed(m_atvDemod->getMagSq());
|
||||
double magSqDB = CalcDb::dbPower(m_objMagSqAverage.average() / (1<<30));
|
||||
double magSqDB = CalcDb::dbPower(m_objMagSqAverage.average() / (SDR_RX_SCALED*SDR_RX_SCALED));
|
||||
ui->channePowerText->setText(tr("%1 dB").arg(magSqDB, 0, 'f', 1));
|
||||
|
||||
if (m_atvDemod->getBFOLocked()) {
|
||||
|
@ -125,7 +125,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
for (SampleVector::const_iterator it = begin; it != end; ++it)
|
||||
{
|
||||
Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
Complex c(it->real() / SDR_RX_SCALEF, it->imag() / SDR_RX_SCALEF);
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
rf_out = m_rfFilter->runFilt(c, &rf); // filter RF before demod
|
||||
@ -163,7 +163,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
if (!m_settings.m_showPilot)
|
||||
{
|
||||
m_sampleBuffer.push_back(Sample(demod * (1<<15), 0.0));
|
||||
m_sampleBuffer.push_back(Sample(demod * SDR_RX_SCALEF, 0.0));
|
||||
}
|
||||
|
||||
if (m_settings.m_rdsActive)
|
||||
@ -197,7 +197,7 @@ void BFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
if (m_settings.m_showPilot)
|
||||
{
|
||||
m_sampleBuffer.push_back(Sample(m_pilotPLLSamples[1] * (1<<15), 0.0)); // debug 38 kHz pilot
|
||||
m_sampleBuffer.push_back(Sample(m_pilotPLLSamples[1] * SDR_RX_SCALEF, 0.0)); // debug 38 kHz pilot
|
||||
}
|
||||
|
||||
if (m_settings.m_lsbStereo)
|
||||
|
@ -344,7 +344,7 @@ BFMDemodGUI::BFMDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
|
||||
|
||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
|
||||
m_bfmDemod = (BFMDemod*) rxChannel; //new BFMDemod(m_deviceUISet->m_deviceSourceAPI);
|
||||
m_bfmDemod->setMessageQueueToGUI(getInputMessageQueue());
|
||||
m_bfmDemod->setSampleSink(m_spectrumVis);
|
||||
|
@ -65,8 +65,9 @@ DSDDemod::DSDDemod(DeviceSourceAPI *deviceAPI) :
|
||||
m_audioBuffer.resize(1<<14);
|
||||
m_audioBufferFill = 0;
|
||||
|
||||
m_sampleBuffer = new qint16[1<<17]; // 128 kS
|
||||
m_sampleBuffer = new FixReal[1<<17]; // 128 kS
|
||||
m_sampleBufferIndex = 0;
|
||||
m_scaleFromShort = SDR_RX_SAMP_SZ < sizeof(short)*8 ? 1 : 1<<(SDR_RX_SAMP_SZ - sizeof(short)*8);
|
||||
|
||||
m_movingAverage.resize(16, 0);
|
||||
m_magsq = 0.0f;
|
||||
@ -126,9 +127,12 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
if (m_interpolator.decimate(&m_interpolatorDistanceRemain, c, &ci))
|
||||
{
|
||||
qint16 sample, delayedSample;
|
||||
FixReal sample, delayedSample;
|
||||
qint16 sampleDSD;
|
||||
|
||||
Real magsq = ((ci.real()*ci.real() + ci.imag()*ci.imag())) / (1<<30);
|
||||
Real re = ci.real() / SDR_RX_SCALED;
|
||||
Real im = ci.imag() / SDR_RX_SCALED;
|
||||
Real magsq = re*re + im*im;
|
||||
m_movingAverage.feed(magsq);
|
||||
|
||||
m_magsqSum += magsq;
|
||||
@ -140,7 +144,7 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
m_magsqCount++;
|
||||
|
||||
Real demod = 32768.0f * m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_demodGain;
|
||||
Real demod = m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_demodGain; // [-1.0:1.0]
|
||||
m_sampleCount++;
|
||||
|
||||
// AF processing
|
||||
@ -168,17 +172,19 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
if (m_squelchOpen)
|
||||
{
|
||||
sample = demod;
|
||||
sampleDSD = demod * 32768.0f; // DSD decoder takes int16 samples
|
||||
sample = demod * SDR_RX_SCALEF; // scale to sample size
|
||||
}
|
||||
else
|
||||
{
|
||||
sampleDSD = 0;
|
||||
sample = 0;
|
||||
}
|
||||
|
||||
m_dsdDecoder.pushSample(sample);
|
||||
m_dsdDecoder.pushSample(sampleDSD);
|
||||
|
||||
if (m_settings.m_enableCosineFiltering) { // show actual input to FSK demod
|
||||
sample = m_dsdDecoder.getFilteredSample();
|
||||
sample = m_dsdDecoder.getFilteredSample() * m_scaleFromShort;
|
||||
}
|
||||
|
||||
if (m_sampleBufferIndex < (1<<17)) {
|
||||
@ -197,7 +203,7 @@ void DSDDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
if (m_settings.m_syncOrConstellation)
|
||||
{
|
||||
Sample s(sample, m_dsdDecoder.getSymbolSyncSample());
|
||||
Sample s(sample, m_dsdDecoder.getSymbolSyncSample() * m_scaleFromShort);
|
||||
m_scopeSampleBuffer.push_back(s);
|
||||
}
|
||||
else
|
||||
|
@ -186,8 +186,9 @@ private:
|
||||
SampleVector m_scopeSampleBuffer;
|
||||
AudioVector m_audioBuffer;
|
||||
uint m_audioBufferFill;
|
||||
qint16 *m_sampleBuffer; //!< samples ring buffer
|
||||
FixReal *m_sampleBuffer; //!< samples ring buffer
|
||||
int m_sampleBufferIndex;
|
||||
int m_scaleFromShort;
|
||||
|
||||
AudioFifo m_audioFifo1;
|
||||
AudioFifo m_audioFifo2;
|
||||
|
@ -269,7 +269,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||
|
||||
m_scopeVis = new ScopeVis(ui->glScope);
|
||||
m_scopeVis = new ScopeVis(SDR_RX_SCALEF, ui->glScope);
|
||||
m_dsdDemod = (DSDDemod*) rxChannel; //new DSDDemod(m_deviceUISet->m_deviceSourceAPI);
|
||||
m_dsdDemod->setScopeSink(m_scopeVis);
|
||||
m_dsdDemod->setMessageQueueToGUI(getInputMessageQueue());
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
const PluginDescriptor DSDDemodPlugin::m_pluginDescriptor = {
|
||||
QString("DSD Demodulator"),
|
||||
QString("3.10.1"),
|
||||
QString("3.11.1"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -261,7 +261,7 @@ void LoRaDemod::feed(const SampleVector::const_iterator& begin, const SampleVect
|
||||
|
||||
for(SampleVector::const_iterator it = begin; it < end; ++it)
|
||||
{
|
||||
Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
Complex c(it->real() / SDR_RX_SCALEF, it->imag() / SDR_RX_SCALEF);
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
if(m_interpolator.decimate(&m_sampleDistanceRemain, c, &ci))
|
||||
|
@ -117,7 +117,7 @@ LoRaDemodGUI::LoRaDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseb
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
|
||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
|
||||
m_LoRaDemod = (LoRaDemod*) rxChannel; //new LoRaDemod(m_deviceUISet->m_deviceSourceAPI);
|
||||
m_LoRaDemod->setSpectrumSink(m_spectrumVis);
|
||||
|
||||
|
@ -153,7 +153,7 @@ void NFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
Real demod = m_phaseDiscri.phaseDiscriminatorDelta(ci, magsqRaw, deviation);
|
||||
|
||||
Real magsq = magsqRaw / (1<<30);
|
||||
Real magsq = magsqRaw / (SDR_RX_SCALED*SDR_RX_SCALED);
|
||||
m_movingAverage.feed(magsq);
|
||||
m_magsqSum += magsq;
|
||||
|
||||
|
@ -77,7 +77,7 @@ SSBDemod::SSBDemod(DeviceSourceAPI *deviceAPI) :
|
||||
m_magsqPeak = 0.0f;
|
||||
m_magsqCount = 0;
|
||||
|
||||
m_agc.setClampMax(32768.0*32768.0);
|
||||
m_agc.setClampMax(SDR_RX_SCALED*SDR_RX_SCALED);
|
||||
m_agc.setClamping(m_agcClamping);
|
||||
|
||||
SSBFilter = new fftfilt(m_LowCutoff / m_audioSampleRate, m_Bandwidth / m_audioSampleRate, ssbFftLen);
|
||||
@ -154,7 +154,6 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
for(SampleVector::const_iterator it = begin; it < end; ++it)
|
||||
{
|
||||
//Complex c(it->real() / 32768.0, it->imag() / 32768.0);
|
||||
Complex c(it->real(), it->imag());
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
@ -187,7 +186,7 @@ void SSBDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
{
|
||||
Real avgr = m_sum.real() / decim;
|
||||
Real avgi = m_sum.imag() / decim;
|
||||
m_magsq = (avgr * avgr + avgi * avgi) / (1<<30);
|
||||
m_magsq = (avgr * avgr + avgi * avgi) / (SDR_RX_SCALED*SDR_RX_SCALED);
|
||||
|
||||
m_magsqSum += m_magsq;
|
||||
|
||||
@ -428,7 +427,7 @@ void SSBDemod::applySettings(const SSBDemodSettings& settings, bool force)
|
||||
{
|
||||
int agcNbSamples = 48 * (1<<settings.m_agcTimeLog2);
|
||||
m_agc.setThresholdEnable(settings.m_agcPowerThreshold != -99);
|
||||
double agcPowerThreshold = CalcDb::powerFromdB(settings.m_agcPowerThreshold) * (1<<30);
|
||||
double agcPowerThreshold = CalcDb::powerFromdB(settings.m_agcPowerThreshold) * (SDR_RX_SCALED*SDR_RX_SCALED);
|
||||
int agcThresholdGate = 48 * settings.m_agcThresholdGate; // ms
|
||||
bool agcClamping = settings.m_agcClamping;
|
||||
|
||||
|
@ -244,7 +244,7 @@ SSBDemodGUI::SSBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
|
||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||
|
||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
|
||||
m_ssbDemod = (SSBDemod*) rxChannel; //new SSBDemod(m_deviceUISet->m_deviceSourceAPI);
|
||||
m_ssbDemod->setMessageQueueToGUI(getInputMessageQueue());
|
||||
m_ssbDemod->setSampleSink(m_spectrumVis);
|
||||
|
@ -104,7 +104,6 @@ void WFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
|
||||
for (SampleVector::const_iterator it = begin; it != end; ++it)
|
||||
{
|
||||
//Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
Complex c(it->real(), it->imag());
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
@ -113,7 +112,7 @@ void WFMDemod::feed(const SampleVector::const_iterator& begin, const SampleVecto
|
||||
for (int i = 0 ; i < rf_out; i++)
|
||||
{
|
||||
demod = m_phaseDiscri.phaseDiscriminatorDelta(rf[i], msq, fmDev);
|
||||
Real magsq = msq / (1<<30);
|
||||
Real magsq = msq / (SDR_RX_SCALED*SDR_RX_SCALED);
|
||||
|
||||
m_movingAverage.feed(magsq);
|
||||
m_magsqSum += magsq;
|
||||
|
@ -97,17 +97,15 @@ void TCPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
m_settingsMutex.lock();
|
||||
|
||||
// Rtl-Sdr uses full 16-bit scale; FCDPP does not
|
||||
//int rescale = 32768 * (1 << m_boost);
|
||||
int rescale = (1 << m_volume);
|
||||
|
||||
for(SampleVector::const_iterator it = begin; it < end; ++it) {
|
||||
//Complex c(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
Complex c(it->real(), it->imag());
|
||||
c *= m_nco.nextIQ();
|
||||
|
||||
if(m_interpolator.decimate(&m_sampleDistanceRemain, c, &ci))
|
||||
{
|
||||
m_magsq = ((ci.real()*ci.real() + ci.imag()*ci.imag())*rescale*rescale) / (1<<30);
|
||||
m_magsq = ((ci.real()*ci.real() + ci.imag()*ci.imag())*rescale*rescale) / (SDR_RX_SCALED*SDR_RX_SCALED);
|
||||
m_sampleBuffer.push_back(Sample(ci.real() * rescale, ci.imag() * rescale));
|
||||
m_sampleDistanceRemain += m_inputSampleRate / m_outputSampleRate;
|
||||
}
|
||||
@ -145,7 +143,7 @@ void TCPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
|
||||
if((m_sampleFormat == TCPSrcSettings::FormatNFM) && (m_ssbSockets.count() > 0)) {
|
||||
for(SampleVector::const_iterator it = m_sampleBuffer.begin(); it != m_sampleBuffer.end(); ++it) {
|
||||
Complex cj(it->real() / 32768.0f, it->imag() / 32768.0f);
|
||||
Complex cj(it->real() / SDR_RX_SCALEF, it->imag() / SDR_RX_SCALEF);
|
||||
// An FFT filter here is overkill, but was already set up for SSB
|
||||
int n_out = TCPFilter->runFilt(cj, &sideband);
|
||||
if (n_out) {
|
||||
|
@ -132,7 +132,7 @@ TCPSrcGUI::TCPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
|
||||
m_tcpSrc = (TCPSrc*) rxChannel; //new TCPSrc(m_deviceUISet->m_deviceSourceAPI);
|
||||
m_tcpSrc->setSpectrum(m_spectrumVis);
|
||||
|
||||
|
@ -36,20 +36,25 @@ The display is in the format `address:audio port/data port`
|
||||
|
||||
Sample rate in samples per second of the signal that is sent over UDP. The actual byte rate depends on the type of sample which corresponds to a number of bytes per sample.
|
||||
|
||||
<h3>6: Type of samples</h3>
|
||||
<h3>6: Type and size of samples</h3>
|
||||
|
||||
Combo box to specify the type of samples that are sent over UDP.
|
||||
Left: combo box to specify the type of samples that are sent over UDP:
|
||||
|
||||
- `S16LE I/Q`: Raw I/Q samples on signed 16 bits integers with Little Endian layout. Use it with software that accepts I/Q data as input like GNUradio with the `UDP source` block. The output is interleaved I and Q samples
|
||||
- `S16LE NFM`: AF of FM demodulated signal as 16 bits signed integers with Little Endian layout. Use it with software that takes the FM demodulated audio or the discriminator output of a radio as input. Make sure you specify the appropriate signal bandwidth (see 7) according to the AF bandwidth needs. The output is a repetition of NFM samples on real part and on imaginary part this facilitates integration wtih software expecting a stereo type of input with the same samples on L and R channels. With GNURadio just use a complex to real block.
|
||||
- `S16LE NFM Mono`: This is the same as above but only one sample is output for one NFM sample. This can be used with software that accept a mono type of input like `dsd` or `multimon`.
|
||||
- `S16LE USB`: AF of USB demodulated signal as 16 bits signed integers with Little Endian layout. Use it with software that uses a SSB demodulated signal as input i.e. software that is based on the audio output of a SSB radio. The output is the I/Q binaural output of the demodulator.
|
||||
- `S16LE LSB`: AF of LSB demodulated signal as 16 bits signed integers with Little Endian layout. Use it with software that uses a SSB demodulated signal as input i.e. software that is based on the audio output of a SSB radio. The output is the I/Q binaural output of the demodulator.
|
||||
- `S16LE LSB Mono`: AF of the LSB part of a SSB demodulated signal as "mono" (I+Q)*0.7 samples that is one sample per demodulator output sample. This can be used with software that accepts mono type of input.
|
||||
- `S16LE USB Mono`: AF of the USB part of a SSB demodulated signal as "mono" (I+Q)*0.7 samples that is one sample per demodulator output sample. This can be used with software that accepts mono type of input.
|
||||
- `S16LE AM Mono`: AF of the enveloppe demodulated signal i.e. channel magnitude or sqrt(I² + Q²) as "mono" samples that is one sample per demodulator output sample. This can be used with software that accepts mono type of input.
|
||||
- `S16LE AM !DC Mono`: Same as above but with a DC block based on magnitude average over a 5 ms period
|
||||
- `S16LE AM BPF Mono`: Same as AM Mono but raw magnitude signal is passed through a bandpass filter with lower cutoff at 300 Hz and higher cutoff at RF bandwidth frequency
|
||||
- `I/Q`: Raw I/Q samples. Use it with software that accepts I/Q data as input like GNUradio with the `UDP source` block. The output is interleaved I and Q samples
|
||||
- `NFM`: AF of FM demodulated signal. Use it with software that takes the FM demodulated audio or the discriminator output of a radio as input. Make sure you specify the appropriate signal bandwidth (see 7) according to the AF bandwidth needs. The output is a repetition of NFM samples on real part and on imaginary part this facilitates integration wtih software expecting a stereo type of input with the same samples on L and R channels. With GNURadio just use a complex to real block.
|
||||
- `NFM Mono`: This is the same as above but only one sample is output for one NFM sample. This can be used with software that accept a mono type of input like `dsd` or `multimon`.
|
||||
- `USB`: AF of USB demodulated signal. Use it with software that uses a SSB demodulated signal as input i.e. software that is based on the audio output of a SSB radio. The output is the I/Q binaural output of the demodulator.
|
||||
- `LSB`: AF of LSB demodulated signal. Use it with software that uses a SSB demodulated signal as input i.e. software that is based on the audio output of a SSB radio. The output is the I/Q binaural output of the demodulator.
|
||||
- `LSB Mono`: AF of the LSB part of a SSB demodulated signal as "mono" (I+Q)*0.7 samples that is one sample per demodulator output sample. This can be used with software that accepts mono type of input.
|
||||
- `USB Mono`: AF of the USB part of a SSB demodulated signal as "mono" (I+Q)*0.7 samples that is one sample per demodulator output sample. This can be used with software that accepts mono type of input.
|
||||
- `AM Mono`: AF of the enveloppe demodulated signal i.e. channel magnitude or sqrt(I² + Q²) as "mono" samples that is one sample per demodulator output sample. This can be used with software that accepts mono type of input.
|
||||
- `AM !DC Mono`: Same as above but with a DC block based on magnitude average over a 5 ms period
|
||||
- `AM BPF Mono`: Same as AM Mono but raw magnitude signal is passed through a bandpass filter with lower cutoff at 300 Hz and higher cutoff at RF bandwidth frequency
|
||||
|
||||
Right: Sample size in bits:
|
||||
|
||||
- `16 bits`: samples are 16 bit signed with little endian layout (S16LE)
|
||||
- `24 bits`: samples are 32 bit signed with little endian layout (S32LE) using only the 3 less significant bytes. This means that the range is -2²³ to 2²³ - 1
|
||||
|
||||
<h3>7: Signal bandwidth</h3>
|
||||
|
||||
|
@ -57,8 +57,10 @@ UDPSrc::UDPSrc(DeviceSourceAPI *deviceAPI) :
|
||||
{
|
||||
setObjectName(m_channelId);
|
||||
|
||||
m_udpBuffer = new UDPSink<Sample>(this, udpBlockSize, m_settings.m_udpPort);
|
||||
m_udpBufferMono = new UDPSink<FixReal>(this, udpBlockSize, m_settings.m_udpPort);
|
||||
m_udpBuffer16 = new UDPSink<Sample16>(this, udpBlockSize, m_settings.m_udpPort);
|
||||
m_udpBufferMono16 = new UDPSink<int16_t>(this, udpBlockSize, m_settings.m_udpPort);
|
||||
m_udpBuffer24 = new UDPSink<Sample24>(this, udpBlockSize, m_settings.m_udpPort);
|
||||
m_udpBufferMono24 = new UDPSink<int32_t>(this, udpBlockSize, m_settings.m_udpPort);
|
||||
m_audioSocket = new QUdpSocket(this);
|
||||
m_udpAudioBuf = new char[m_udpAudioPayloadSize];
|
||||
|
||||
@ -92,7 +94,7 @@ UDPSrc::UDPSrc(DeviceSourceAPI *deviceAPI) :
|
||||
qWarning("UDPSrc::UDPSrc: cannot bind audio port");
|
||||
}
|
||||
|
||||
m_agc.setClampMax(32768.0*32768.0);
|
||||
m_agc.setClampMax(SDR_RX_SCALED*SDR_RX_SCALED);
|
||||
m_agc.setClamping(true);
|
||||
|
||||
//DSPEngine::instance()->addAudioSink(&m_audioFifo);
|
||||
@ -109,8 +111,10 @@ UDPSrc::UDPSrc(DeviceSourceAPI *deviceAPI) :
|
||||
UDPSrc::~UDPSrc()
|
||||
{
|
||||
delete m_audioSocket;
|
||||
delete m_udpBuffer;
|
||||
delete m_udpBufferMono;
|
||||
delete m_udpBuffer24;
|
||||
delete m_udpBufferMono24;
|
||||
delete m_udpBuffer16;
|
||||
delete m_udpBufferMono16;
|
||||
delete[] m_udpAudioBuf;
|
||||
if (UDPFilter) delete UDPFilter;
|
||||
if (m_settings.m_audioActive) DSPEngine::instance()->removeAudioSink(&m_audioFifo);
|
||||
@ -148,7 +152,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
if ((m_settings.m_agc) &&
|
||||
(m_settings.m_sampleFormat != UDPSrcSettings::FormatNFM) &&
|
||||
(m_settings.m_sampleFormat != UDPSrcSettings::FormatNFMMono) &&
|
||||
(m_settings.m_sampleFormat != UDPSrcSettings::FormatS16LE))
|
||||
(m_settings.m_sampleFormat != UDPSrcSettings::FormatIQ))
|
||||
{
|
||||
agcFactor = m_agc.feedAndGetValue(ci);
|
||||
inMagSq = m_agc.getMagSq();
|
||||
@ -158,7 +162,7 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
inMagSq = ci.real()*ci.real() + ci.imag()*ci.imag();
|
||||
}
|
||||
|
||||
m_inMovingAverage.feed(inMagSq / (1<<30));
|
||||
m_inMovingAverage.feed(inMagSq / (SDR_RX_SCALED*SDR_RX_SCALED));
|
||||
m_inMagsq = m_inMovingAverage.average();
|
||||
|
||||
Sample ss(ci.real(), ci.imag());
|
||||
@ -179,8 +183,8 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
{
|
||||
l = m_squelchOpen ? sideband[i].real() * m_settings.m_gain : 0;
|
||||
r = m_squelchOpen ? sideband[i].imag() * m_settings.m_gain : 0;
|
||||
m_udpBuffer->write(Sample(l, r));
|
||||
m_outMovingAverage.feed((l*l + r*r) / (1<<30));
|
||||
udpWrite(l, r);
|
||||
m_outMovingAverage.feed((l*l + r*r) / (SDR_RX_SCALED*SDR_RX_SCALED));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -195,22 +199,22 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
{
|
||||
l = m_squelchOpen ? sideband[i].real() * m_settings.m_gain : 0;
|
||||
r = m_squelchOpen ? sideband[i].imag() * m_settings.m_gain : 0;
|
||||
m_udpBuffer->write(Sample(l, r));
|
||||
m_outMovingAverage.feed((l*l + r*r) / (1<<30));
|
||||
udpWrite(l, r);
|
||||
m_outMovingAverage.feed((l*l + r*r) / (SDR_RX_SCALED*SDR_RX_SCALED));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatNFM)
|
||||
{
|
||||
double demod = m_squelchOpen ? 32768.0 * m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain : 0;
|
||||
m_udpBuffer->write(Sample(demod, demod));
|
||||
m_outMovingAverage.feed((demod * demod) / (1<<30));
|
||||
Real discri = m_squelchOpen ? m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain : 0;
|
||||
udpWriteNorm(discri, discri);
|
||||
m_outMovingAverage.feed(discri*discri);
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatNFMMono)
|
||||
{
|
||||
FixReal demod = m_squelchOpen ? (FixReal) (32768.0f * m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain) : 0;
|
||||
m_udpBufferMono->write(demod);
|
||||
m_outMovingAverage.feed((demod * demod) / 1073741824.0);
|
||||
Real discri = m_squelchOpen ? m_phaseDiscri.phaseDiscriminator(ci) * m_settings.m_gain : 0;
|
||||
udpWriteNormMono(discri);
|
||||
m_outMovingAverage.feed(discri*discri);
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatLSBMono) // Monaural LSB
|
||||
{
|
||||
@ -222,8 +226,8 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
for (int i = 0; i < n_out; i++)
|
||||
{
|
||||
l = m_squelchOpen ? (sideband[i].real() + sideband[i].imag()) * 0.7 * m_settings.m_gain : 0;
|
||||
m_udpBufferMono->write(l);
|
||||
m_outMovingAverage.feed((l * l) / (1<<30));
|
||||
udpWriteMono(l);
|
||||
m_outMovingAverage.feed((l * l) / (SDR_RX_SCALED*SDR_RX_SCALED));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -237,16 +241,17 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
for (int i = 0; i < n_out; i++)
|
||||
{
|
||||
l = m_squelchOpen ? (sideband[i].real() + sideband[i].imag()) * 0.7 * m_settings.m_gain : 0;
|
||||
m_udpBufferMono->write(l);
|
||||
m_outMovingAverage.feed((l * l) / (1<<30));
|
||||
udpWriteMono(l);
|
||||
m_outMovingAverage.feed((l * l) / (SDR_RX_SCALED*SDR_RX_SCALED));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatAMMono)
|
||||
{
|
||||
FixReal demod = m_squelchOpen ? (FixReal) (sqrt(inMagSq) * agcFactor * m_settings.m_gain) : 0;
|
||||
m_udpBufferMono->write(demod);
|
||||
m_outMovingAverage.feed((demod * demod) / 1073741824.0);
|
||||
Real amplitude = m_squelchOpen ? sqrt(inMagSq) * agcFactor * m_settings.m_gain : 0;
|
||||
FixReal demod = (FixReal) amplitude;
|
||||
udpWriteMono(demod);
|
||||
m_outMovingAverage.feed((amplitude/SDR_RX_SCALEF)*(amplitude/SDR_RX_SCALEF));
|
||||
}
|
||||
else if (m_settings.m_sampleFormat == UDPSrcSettings::FormatAMNoDCMono)
|
||||
{
|
||||
@ -254,13 +259,14 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
{
|
||||
double demodf = sqrt(inMagSq);
|
||||
m_amMovingAverage.feed(demodf);
|
||||
FixReal demod = (FixReal) ((demodf - m_amMovingAverage.average()) * agcFactor * m_settings.m_gain);
|
||||
m_udpBufferMono->write(demod);
|
||||
m_outMovingAverage.feed((demod * demod) / 1073741824.0);
|
||||
Real amplitude = (demodf - m_amMovingAverage.average()) * agcFactor * m_settings.m_gain;
|
||||
FixReal demod = (FixReal) amplitude;
|
||||
udpWriteMono(demod);
|
||||
m_outMovingAverage.feed((amplitude/SDR_RX_SCALEF)*(amplitude/SDR_RX_SCALEF));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_udpBufferMono->write(0);
|
||||
udpWriteMono(0);
|
||||
m_outMovingAverage.feed(0);
|
||||
}
|
||||
}
|
||||
@ -271,13 +277,14 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
double demodf = sqrt(inMagSq);
|
||||
demodf = m_bandpass.filter(demodf);
|
||||
demodf /= 301.0;
|
||||
FixReal demod = (FixReal) (demodf * agcFactor * m_settings.m_gain);
|
||||
m_udpBufferMono->write(demod);
|
||||
m_outMovingAverage.feed((demod * demod) / 1073741824.0);
|
||||
Real amplitude = demodf * agcFactor * m_settings.m_gain;
|
||||
FixReal demod = (FixReal) amplitude;
|
||||
udpWriteMono(demod);
|
||||
m_outMovingAverage.feed((amplitude/SDR_RX_SCALEF)*(amplitude/SDR_RX_SCALEF));
|
||||
}
|
||||
else
|
||||
{
|
||||
m_udpBufferMono->write(0);
|
||||
udpWriteMono(0);
|
||||
m_outMovingAverage.feed(0);
|
||||
}
|
||||
}
|
||||
@ -285,14 +292,12 @@ void UDPSrc::feed(const SampleVector::const_iterator& begin, const SampleVector:
|
||||
{
|
||||
if (m_squelchOpen)
|
||||
{
|
||||
Sample s(ci.real() * m_settings.m_gain, ci.imag() * m_settings.m_gain);
|
||||
m_udpBuffer->write(s);
|
||||
m_outMovingAverage.feed((inMagSq*m_settings.m_gain*m_settings.m_gain) / (1<<30));
|
||||
udpWrite(ci.real() * m_settings.m_gain, ci.imag() * m_settings.m_gain);
|
||||
m_outMovingAverage.feed((inMagSq*m_settings.m_gain*m_settings.m_gain) / (SDR_RX_SCALED*SDR_RX_SCALED));
|
||||
}
|
||||
else
|
||||
{
|
||||
Sample s(0, 0);
|
||||
m_udpBuffer->write(s);
|
||||
udpWrite(0, 0);
|
||||
m_outMovingAverage.feed(0);
|
||||
}
|
||||
}
|
||||
@ -484,6 +489,7 @@ void UDPSrc::applySettings(const UDPSrcSettings& settings, bool force)
|
||||
<< " m_squelchGate" << settings.m_squelchGate
|
||||
<< " m_agc" << settings.m_agc
|
||||
<< " m_sampleFormat: " << settings.m_sampleFormat
|
||||
<< " m_sampleSize: " << 16 + settings.m_sampleSize*8
|
||||
<< " m_outputSampleRate: " << settings.m_outputSampleRate
|
||||
<< " m_rfBandwidth: " << settings.m_rfBandwidth
|
||||
<< " m_fmDeviation: " << settings.m_fmDeviation
|
||||
@ -568,14 +574,18 @@ void UDPSrc::applySettings(const UDPSrcSettings& settings, bool force)
|
||||
|
||||
if ((settings.m_udpAddress != m_settings.m_udpAddress) || force)
|
||||
{
|
||||
m_udpBuffer->setAddress(const_cast<QString&>(settings.m_udpAddress));
|
||||
m_udpBufferMono->setAddress(const_cast<QString&>(settings.m_udpAddress));
|
||||
m_udpBuffer16->setAddress(const_cast<QString&>(settings.m_udpAddress));
|
||||
m_udpBufferMono16->setAddress(const_cast<QString&>(settings.m_udpAddress));
|
||||
m_udpBuffer24->setAddress(const_cast<QString&>(settings.m_udpAddress));
|
||||
m_udpBufferMono24->setAddress(const_cast<QString&>(settings.m_udpAddress));
|
||||
}
|
||||
|
||||
if ((settings.m_udpPort != m_settings.m_udpPort) || force)
|
||||
{
|
||||
m_udpBuffer->setPort(settings.m_udpPort);
|
||||
m_udpBufferMono->setPort(settings.m_udpPort);
|
||||
m_udpBuffer16->setPort(settings.m_udpPort);
|
||||
m_udpBufferMono16->setPort(settings.m_udpPort);
|
||||
m_udpBuffer24->setPort(settings.m_udpPort);
|
||||
m_udpBufferMono24->setPort(settings.m_udpPort);
|
||||
}
|
||||
|
||||
if ((settings.m_audioPort != m_settings.m_audioPort) || force)
|
||||
|
@ -142,6 +142,22 @@ protected:
|
||||
{ }
|
||||
};
|
||||
|
||||
struct Sample16
|
||||
{
|
||||
Sample16() : m_r(0), m_i(0) {}
|
||||
Sample16(int16_t r, int16_t i) : m_r(r), m_i(i) {}
|
||||
int16_t m_r;
|
||||
int16_t m_i;
|
||||
};
|
||||
|
||||
struct Sample24
|
||||
{
|
||||
Sample24() : m_r(0), m_i(0) {}
|
||||
Sample24(int32_t r, int32_t i) : m_r(r), m_i(i) {}
|
||||
int32_t m_r;
|
||||
int32_t m_i;
|
||||
};
|
||||
|
||||
DeviceSourceAPI *m_deviceAPI;
|
||||
ThreadedBasebandSampleSink* m_threadedChannelizer;
|
||||
DownChannelizer* m_channelizer;
|
||||
@ -167,8 +183,10 @@ protected:
|
||||
fftfilt* UDPFilter;
|
||||
|
||||
SampleVector m_sampleBuffer;
|
||||
UDPSink<Sample> *m_udpBuffer;
|
||||
UDPSink<FixReal> *m_udpBufferMono;
|
||||
UDPSink<Sample16> *m_udpBuffer16;
|
||||
UDPSink<int16_t> *m_udpBufferMono16;
|
||||
UDPSink<Sample24> *m_udpBuffer24;
|
||||
UDPSink<int32_t> *m_udpBufferMono24;
|
||||
|
||||
AudioVector m_audioBuffer;
|
||||
uint m_audioBufferFill;
|
||||
@ -259,6 +277,64 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
void udpWrite(FixReal real, FixReal imag)
|
||||
{
|
||||
if (SDR_RX_SAMP_SZ == 16)
|
||||
{
|
||||
if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) {
|
||||
m_udpBuffer16->write(Sample16(real, imag));
|
||||
} else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) {
|
||||
m_udpBuffer24->write(Sample24(real<<8, imag<<8));
|
||||
}
|
||||
}
|
||||
else if (SDR_RX_SAMP_SZ == 24)
|
||||
{
|
||||
if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) {
|
||||
m_udpBuffer16->write(Sample16(real>>8, imag>>8));
|
||||
} else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) {
|
||||
m_udpBuffer24->write(Sample24(real, imag));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void udpWriteMono(FixReal sample)
|
||||
{
|
||||
if (SDR_RX_SAMP_SZ == 16)
|
||||
{
|
||||
if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) {
|
||||
m_udpBufferMono16->write(sample);
|
||||
} else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) {
|
||||
m_udpBufferMono24->write(sample<<8);
|
||||
}
|
||||
}
|
||||
else if (SDR_RX_SAMP_SZ == 24)
|
||||
{
|
||||
if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) {
|
||||
m_udpBufferMono16->write(sample>>8);
|
||||
} else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) {
|
||||
m_udpBufferMono24->write(sample);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void udpWriteNorm(Real real, Real imag)
|
||||
{
|
||||
if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) {
|
||||
m_udpBuffer16->write(Sample16(real*32768.0, imag*32768.0));
|
||||
} else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) {
|
||||
m_udpBuffer24->write(Sample24(real*8388608.0, imag*8388608.0));
|
||||
}
|
||||
}
|
||||
|
||||
void udpWriteNormMono(Real sample)
|
||||
{
|
||||
if (m_settings.m_sampleSize == UDPSrcSettings::Size16bits) {
|
||||
m_udpBufferMono16->write(sample*32768.0);
|
||||
} else if (m_settings.m_sampleSize == UDPSrcSettings::Size24bits) {
|
||||
m_udpBufferMono24->write(sample*8388608.0);
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif // INCLUDE_UDPSRC_H
|
||||
|
@ -147,7 +147,7 @@ UDPSrcGUI::UDPSrcGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||
m_spectrumVis = new SpectrumVis(SDR_RX_SCALEF, ui->glSpectrum);
|
||||
m_udpSrc = (UDPSrc*) rxChannel; //new UDPSrc(m_deviceUISet->m_deviceSourceAPI);
|
||||
m_udpSrc->setSpectrum(m_spectrumVis);
|
||||
|
||||
@ -262,7 +262,7 @@ void UDPSrcGUI::setSampleFormatIndex(const UDPSrcSettings::SampleFormat& sampleF
|
||||
{
|
||||
switch(sampleFormat)
|
||||
{
|
||||
case UDPSrcSettings::FormatS16LE:
|
||||
case UDPSrcSettings::FormatIQ:
|
||||
ui->sampleFormat->setCurrentIndex(0);
|
||||
break;
|
||||
case UDPSrcSettings::FormatNFM:
|
||||
@ -303,7 +303,7 @@ void UDPSrcGUI::setSampleFormat(int index)
|
||||
switch(index)
|
||||
{
|
||||
case 0:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatS16LE;
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatIQ;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
case 1:
|
||||
@ -343,7 +343,7 @@ void UDPSrcGUI::setSampleFormat(int index)
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
default:
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatS16LE;
|
||||
m_settings.m_sampleFormat = UDPSrcSettings::FormatIQ;
|
||||
ui->fmDeviation->setEnabled(false);
|
||||
break;
|
||||
}
|
||||
@ -395,6 +395,18 @@ void UDPSrcGUI::on_sampleFormat_currentIndexChanged(int index)
|
||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_sampleSize_currentIndexChanged(int index)
|
||||
{
|
||||
if ((index < 0) || (index >= UDPSrcSettings::SizeNone)) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_settings.m_sampleSize = (UDPSrcSettings::SampleSize) index;
|
||||
|
||||
ui->applyBtn->setEnabled(true);
|
||||
ui->applyBtn->setStyleSheet("QPushButton { background-color : green; }");
|
||||
}
|
||||
|
||||
void UDPSrcGUI::on_sampleRate_textEdited(const QString& arg1 __attribute__((unused)))
|
||||
{
|
||||
bool ok;
|
||||
|
@ -95,6 +95,7 @@ private:
|
||||
private slots:
|
||||
void on_deltaFrequency_changed(qint64 value);
|
||||
void on_sampleFormat_currentIndexChanged(int index);
|
||||
void on_sampleSize_currentIndexChanged(int index);
|
||||
void on_sampleRate_textEdited(const QString& arg1);
|
||||
void on_rfBandwidth_textEdited(const QString& arg1);
|
||||
void on_fmDeviation_textEdited(const QString& arg1);
|
||||
|
@ -364,7 +364,7 @@
|
||||
<item row="4" column="0">
|
||||
<layout class="QHBoxLayout" name="FormatLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="formatLabel">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
@ -386,52 +386,69 @@
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE I/Q</string>
|
||||
<string>I/Q</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE NFM</string>
|
||||
<string>NFM</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE NFM Mono</string>
|
||||
<string>NFM Mono</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE LSB</string>
|
||||
<string>LSB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE USB</string>
|
||||
<string>USB</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE LSB Mono</string>
|
||||
<string>LSB Mono</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE USB Mono</string>
|
||||
<string>USB Mono</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE AM Mono</string>
|
||||
<string>AM Mono</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE AM !DC Mono</string>
|
||||
<string>AM !DC Mono</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>S16LE AM BPF Mono</string>
|
||||
<string>AM BPF Mono</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="sampleSize">
|
||||
<property name="toolTip">
|
||||
<string>Samples size</string>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>16 bits</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>24 bits</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
const PluginDescriptor UDPSrcPlugin::m_pluginDescriptor = {
|
||||
QString("UDP Channel Source"),
|
||||
QString("3.10.1"),
|
||||
QString("3.11.1"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -31,7 +31,8 @@ UDPSrcSettings::UDPSrcSettings() :
|
||||
void UDPSrcSettings::resetToDefaults()
|
||||
{
|
||||
m_outputSampleRate = 48000;
|
||||
m_sampleFormat = FormatS16LE;
|
||||
m_sampleFormat = FormatIQ;
|
||||
m_sampleSize = Size16bits;
|
||||
m_inputFrequencyOffset = 0;
|
||||
m_rfBandwidth = 12500;
|
||||
m_fmDeviation = 2500;
|
||||
@ -77,6 +78,7 @@ QByteArray UDPSrcSettings::serialize() const
|
||||
s.writeS32(17, m_squelchGate);
|
||||
s.writeBool(18, m_agc);
|
||||
s.writeString(19, m_title);
|
||||
s.writeS32(20, (int) m_sampleFormat);
|
||||
|
||||
return s.final();
|
||||
|
||||
@ -106,12 +108,12 @@ bool UDPSrcSettings::deserialize(const QByteArray& data)
|
||||
d.readS32(2, &s32tmp, 0);
|
||||
m_inputFrequencyOffset = s32tmp;
|
||||
|
||||
d.readS32(3, &s32tmp, FormatS16LE);
|
||||
d.readS32(3, &s32tmp, FormatIQ);
|
||||
|
||||
if ((s32tmp >= 0) && (s32tmp < (int) FormatNone)) {
|
||||
m_sampleFormat = (SampleFormat) s32tmp;
|
||||
} else {
|
||||
m_sampleFormat = FormatS16LE;
|
||||
m_sampleFormat = FormatIQ;
|
||||
}
|
||||
|
||||
d.readReal(4, &m_outputSampleRate, 48000.0);
|
||||
@ -134,6 +136,14 @@ bool UDPSrcSettings::deserialize(const QByteArray& data)
|
||||
d.readBool(18, &m_agc, false);
|
||||
d.readString(19, &m_title, "UDP Sample Source");
|
||||
|
||||
d.readS32(20, &s32tmp, Size16bits);
|
||||
|
||||
if ((s32tmp >= 0) && (s32tmp < (int) SizeNone)) {
|
||||
m_sampleSize = (SampleSize) s32tmp;
|
||||
} else {
|
||||
m_sampleSize = Size16bits;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -26,7 +26,7 @@ struct Serializable;
|
||||
struct UDPSrcSettings
|
||||
{
|
||||
enum SampleFormat {
|
||||
FormatS16LE,
|
||||
FormatIQ,
|
||||
FormatNFM,
|
||||
FormatNFMMono,
|
||||
FormatLSB,
|
||||
@ -39,8 +39,15 @@ struct UDPSrcSettings
|
||||
FormatNone
|
||||
};
|
||||
|
||||
enum SampleSize {
|
||||
Size16bits,
|
||||
Size24bits,
|
||||
SizeNone
|
||||
};
|
||||
|
||||
float m_outputSampleRate;
|
||||
SampleFormat m_sampleFormat;
|
||||
SampleSize m_sampleSize;
|
||||
int64_t m_inputFrequencyOffset;
|
||||
float m_rfBandwidth;
|
||||
int m_fmDeviation;
|
||||
|
@ -129,8 +129,8 @@ void AMMod::pull(Sample& sample)
|
||||
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
Real magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (1<<30);
|
||||
double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (SDR_TX_SCALED*SDR_TX_SCALED);
|
||||
m_movingAverage.feed(magsq);
|
||||
m_magsq = m_movingAverage.average();
|
||||
|
||||
|
@ -163,8 +163,8 @@ void ATVMod::pullFinalize(Complex& ci, Sample& sample)
|
||||
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
Real magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (1<<30);
|
||||
double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (SDR_TX_SCALED*SDR_TX_SCALED);
|
||||
m_movingAverage.feed(magsq);
|
||||
|
||||
sample.m_real = (FixReal) ci.real();
|
||||
|
@ -43,7 +43,7 @@ void ATVModSettings::resetToDefaults()
|
||||
m_cameraPlay = false;
|
||||
m_channelMute = false;
|
||||
m_invertedVideo = false;
|
||||
m_rfScalingFactor = 29204.0f; // -1dB
|
||||
m_rfScalingFactor = 0.891235351562f * SDR_TX_SCALEF; // -1dB
|
||||
m_fmExcursion = 0.5f; // half bandwidth
|
||||
m_forceDecimator = false;
|
||||
m_overlayText = "ATV";
|
||||
|
@ -135,8 +135,8 @@ void NFMMod::pull(Sample& sample)
|
||||
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
Real magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (1<<30);
|
||||
double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (SDR_TX_SCALED*SDR_TX_SCALED);
|
||||
m_movingAverage.feed(magsq);
|
||||
m_magsq = m_movingAverage.average();
|
||||
|
||||
@ -175,8 +175,8 @@ void NFMMod::modulateSample()
|
||||
m_modPhasor += (m_settings.m_fmDeviation / (float) m_settings.m_audioSampleRate) * m_bandpass.filter(t) * (M_PI / 378.0f);
|
||||
}
|
||||
|
||||
m_modSample.real(cos(m_modPhasor) * 29204.0f); // -1 dB
|
||||
m_modSample.imag(sin(m_modPhasor) * 29204.0f);
|
||||
m_modSample.real(cos(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF); // -1 dB
|
||||
m_modSample.imag(sin(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF);
|
||||
}
|
||||
|
||||
void NFMMod::pullAF(Real& sample)
|
||||
|
@ -160,12 +160,12 @@ void SSBMod::pull(Sample& sample)
|
||||
m_interpolatorDistanceRemain += m_interpolatorDistance;
|
||||
|
||||
ci *= m_carrierNco.nextIQ(); // shift to carrier frequency
|
||||
ci *= 29204.0f; //scaling at -1 dB to account for possible filter overshoot
|
||||
ci *= 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
|
||||
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
Real magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (1<<30);
|
||||
double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (SDR_TX_SCALED*SDR_TX_SCALED);
|
||||
m_movingAverage.feed(magsq);
|
||||
m_magsq = m_movingAverage.average();
|
||||
|
||||
@ -298,13 +298,13 @@ void SSBMod::pullAF(Complex& sample)
|
||||
{
|
||||
if (m_settings.m_audioFlipChannels)
|
||||
{
|
||||
ci.real((m_audioBuffer[m_audioBufferFill].r / 32768.0f) * m_settings.m_volumeFactor);
|
||||
ci.imag((m_audioBuffer[m_audioBufferFill].l / 32768.0f) * m_settings.m_volumeFactor);
|
||||
ci.real((m_audioBuffer[m_audioBufferFill].r / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
||||
ci.imag((m_audioBuffer[m_audioBufferFill].l / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
||||
}
|
||||
else
|
||||
{
|
||||
ci.real((m_audioBuffer[m_audioBufferFill].l / 32768.0f) * m_settings.m_volumeFactor);
|
||||
ci.imag((m_audioBuffer[m_audioBufferFill].r / 32768.0f) * m_settings.m_volumeFactor);
|
||||
ci.real((m_audioBuffer[m_audioBufferFill].l / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
||||
ci.imag((m_audioBuffer[m_audioBufferFill].r / SDR_TX_SCALEF) * m_settings.m_volumeFactor);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -419,18 +419,8 @@ void SSBMod::pullAF(Complex& sample)
|
||||
|
||||
if (!(m_undersampleCount++ & decim_mask))
|
||||
{
|
||||
Real avgr = (m_sum.real() / decim) * 29204.0f; //scaling at -1 dB to account for possible filter overshoot
|
||||
Real avgi = (m_sum.imag() / decim) * 29204.0f;
|
||||
// m_magsqSpectrum = (avgr * avgr + avgi * avgi) / (1<<30);
|
||||
//
|
||||
// m_magsqSum += m_magsqSpectrum;
|
||||
//
|
||||
// if (m_magsqSpectrum > m_magsqPeak)
|
||||
// {
|
||||
// m_magsqPeak = m_magsqSpectrum;
|
||||
// }
|
||||
//
|
||||
// m_magsqCount++;
|
||||
Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
|
||||
Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_TX_SCALEF;
|
||||
|
||||
if (!m_settings.m_dsb & !m_settings.m_usb)
|
||||
{ // invert spectrum for LSB
|
||||
@ -453,18 +443,8 @@ void SSBMod::pullAF(Complex& sample)
|
||||
|
||||
if (!(m_undersampleCount++ & decim_mask))
|
||||
{
|
||||
Real avgr = (m_sum.real() / decim) * 29204.0f; //scaling at -1 dB to account for possible filter overshoot
|
||||
Real avgi = (m_sum.imag() / decim) * 29204.0f;
|
||||
// m_magsqSpectrum = (avgr * avgr + avgi * avgi) / (1<<30);
|
||||
//
|
||||
// m_magsqSum += m_magsqSpectrum;
|
||||
//
|
||||
// if (m_magsqSpectrum > m_magsqPeak)
|
||||
// {
|
||||
// m_magsqPeak = m_magsqSpectrum;
|
||||
// }
|
||||
//
|
||||
// m_magsqCount++;
|
||||
Real avgr = (m_sum.real() / decim) * 0.891235351562f * SDR_TX_SCALEF; //scaling at -1 dB to account for possible filter overshoot
|
||||
Real avgi = (m_sum.imag() / decim) * 0.891235351562f * SDR_TX_SCALEF;
|
||||
|
||||
if (!m_settings.m_dsb & !m_settings.m_usb)
|
||||
{ // invert spectrum for LSB
|
||||
|
@ -364,7 +364,7 @@ SSBModGUI::SSBModGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandSam
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
|
||||
|
||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||
m_spectrumVis = new SpectrumVis(SDR_TX_SCALEF, ui->glSpectrum);
|
||||
m_ssbMod = (SSBMod*) channelTx; //new SSBMod(m_deviceUISet->m_deviceSinkAPI);
|
||||
m_ssbMod->setSpectrumSampleSink(m_spectrumVis);
|
||||
m_ssbMod->setMessageQueueToGUI(getInputMessageQueue());
|
||||
|
@ -139,8 +139,8 @@ void WFMMod::pull(Sample& sample)
|
||||
}
|
||||
|
||||
m_modPhasor += (m_settings.m_fmDeviation / (float) m_outputSampleRate) * ri.real() * M_PI * 2.0f;
|
||||
ci.real(cos(m_modPhasor) * 29204.0f); // -1 dB
|
||||
ci.imag(sin(m_modPhasor) * 29204.0f);
|
||||
ci.real(cos(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF); // -1 dB
|
||||
ci.imag(sin(m_modPhasor) * 0.891235351562f * SDR_TX_SCALEF);
|
||||
|
||||
// RF filtering
|
||||
rf_out = m_rfFilter->runFilt(ci, &rf);
|
||||
@ -157,8 +157,8 @@ void WFMMod::pull(Sample& sample)
|
||||
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
Real magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (1<<30);
|
||||
double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (SDR_TX_SCALED*SDR_TX_SCALED);
|
||||
m_movingAverage.feed(magsq);
|
||||
m_magsq = m_movingAverage.average();
|
||||
|
||||
|
@ -134,7 +134,7 @@ void UDPSink::pull(Sample& sample)
|
||||
m_settingsMutex.unlock();
|
||||
|
||||
double magsq = ci.real() * ci.real() + ci.imag() * ci.imag();
|
||||
magsq /= (1<<30);
|
||||
magsq /= (SDR_TX_SCALED*SDR_TX_SCALED);
|
||||
m_movingAverage.feed(magsq);
|
||||
m_magsq = m_movingAverage.average();
|
||||
|
||||
@ -151,7 +151,7 @@ void UDPSink::modulateSample()
|
||||
m_udpHandler.readSample(s);
|
||||
|
||||
uint64_t magsq = s.m_real * s.m_real + s.m_imag * s.m_imag;
|
||||
m_inMovingAverage.feed(magsq/1073741824.0);
|
||||
m_inMovingAverage.feed(magsq/(SDR_TX_SCALED*SDR_TX_SCALED));
|
||||
m_inMagsq = m_inMovingAverage.average();
|
||||
|
||||
calculateSquelch(m_inMagsq);
|
||||
@ -180,9 +180,9 @@ void UDPSink::modulateSample()
|
||||
|
||||
if (m_squelchOpen)
|
||||
{
|
||||
m_modPhasor += (m_settings.m_fmDeviation / m_settings.m_inputSampleRate) * (t / 32768.0f) * M_PI * 2.0f;
|
||||
m_modSample.real(cos(m_modPhasor) * 10362.2f * m_settings.m_gainOut);
|
||||
m_modSample.imag(sin(m_modPhasor) * 10362.2f * m_settings.m_gainOut);
|
||||
m_modPhasor += (m_settings.m_fmDeviation / m_settings.m_inputSampleRate) * (t / SDR_TX_SCALEF) * M_PI * 2.0f;
|
||||
m_modSample.real(cos(m_modPhasor) * 0.3162292f * SDR_TX_SCALEF * m_settings.m_gainOut);
|
||||
m_modSample.imag(sin(m_modPhasor) * 0.3162292f * SDR_TX_SCALEF * m_settings.m_gainOut);
|
||||
calculateLevel(m_modSample);
|
||||
}
|
||||
else
|
||||
@ -195,14 +195,14 @@ void UDPSink::modulateSample()
|
||||
{
|
||||
FixReal t;
|
||||
readMonoSample(t);
|
||||
m_inMovingAverage.feed((t*t)/1073741824.0);
|
||||
m_inMovingAverage.feed((t*t)/(SDR_TX_SCALED*SDR_TX_SCALED));
|
||||
m_inMagsq = m_inMovingAverage.average();
|
||||
|
||||
calculateSquelch(m_inMagsq);
|
||||
|
||||
if (m_squelchOpen)
|
||||
{
|
||||
m_modSample.real(((t / 32768.0f)*m_settings.m_amModFactor*m_settings.m_gainOut + 1.0f) * 16384.0f); // modulate and scale zero frequency carrier
|
||||
m_modSample.real(((t / SDR_TX_SCALEF)*m_settings.m_amModFactor*m_settings.m_gainOut + 1.0f) * (SDR_TX_SCALEF/2)); // modulate and scale zero frequency carrier
|
||||
m_modSample.imag(0.0f);
|
||||
calculateLevel(m_modSample);
|
||||
}
|
||||
@ -220,14 +220,14 @@ void UDPSink::modulateSample()
|
||||
int n_out = 0;
|
||||
|
||||
readMonoSample(t);
|
||||
m_inMovingAverage.feed((t*t)/1073741824.0);
|
||||
m_inMovingAverage.feed((t*t)/(SDR_TX_SCALED*SDR_TX_SCALED));
|
||||
m_inMagsq = m_inMovingAverage.average();
|
||||
|
||||
calculateSquelch(m_inMagsq);
|
||||
|
||||
if (m_squelchOpen)
|
||||
{
|
||||
ci.real((t / 32768.0f) * m_settings.m_gainOut);
|
||||
ci.real((t / SDR_TX_SCALEF) * m_settings.m_gainOut);
|
||||
ci.imag(0.0f);
|
||||
|
||||
n_out = m_SSBFilter->runSSB(ci, &filtered, (m_settings.m_sampleFormat == UDPSinkSettings::FormatUSB));
|
||||
@ -239,8 +239,8 @@ void UDPSink::modulateSample()
|
||||
}
|
||||
|
||||
c = m_SSBFilterBuffer[m_SSBFilterBufferIndex];
|
||||
m_modSample.real(m_SSBFilterBuffer[m_SSBFilterBufferIndex].real() * 32768.0f);
|
||||
m_modSample.imag(m_SSBFilterBuffer[m_SSBFilterBufferIndex].imag() * 32768.0f);
|
||||
m_modSample.real(m_SSBFilterBuffer[m_SSBFilterBufferIndex].real() * SDR_TX_SCALEF);
|
||||
m_modSample.imag(m_SSBFilterBuffer[m_SSBFilterBufferIndex].imag() * SDR_TX_SCALEF);
|
||||
m_SSBFilterBufferIndex++;
|
||||
|
||||
calculateLevel(m_modSample);
|
||||
@ -305,8 +305,8 @@ void UDPSink::calculateLevel(Complex sample)
|
||||
}
|
||||
else
|
||||
{
|
||||
qreal rmsLevel = m_levelSum > 0.0 ? sqrt((m_levelSum/(1<<30)) / m_levelNbSamples) : 0.0;
|
||||
emit levelChanged(rmsLevel, m_peakLevel / 32768.0, m_levelNbSamples);
|
||||
qreal rmsLevel = m_levelSum > 0.0 ? sqrt((m_levelSum/(SDR_TX_SCALED*SDR_TX_SCALED)) / m_levelNbSamples) : 0.0;
|
||||
emit levelChanged(rmsLevel, m_peakLevel / SDR_TX_SCALEF, m_levelNbSamples);
|
||||
m_peakLevel = 0.0f;
|
||||
m_levelSum = 0.0f;
|
||||
m_levelCalcCount = 0;
|
||||
|
@ -119,7 +119,7 @@ UDPSinkGUI::UDPSinkGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, BasebandS
|
||||
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
|
||||
setAttribute(Qt::WA_DeleteOnClose, true);
|
||||
|
||||
m_spectrumVis = new SpectrumVis(ui->glSpectrum);
|
||||
m_spectrumVis = new SpectrumVis(SDR_TX_SCALEF, ui->glSpectrum);
|
||||
m_udpSink = (UDPSink*) channelTx; //new UDPSink(m_deviceUISet->m_deviceSinkAPI);
|
||||
m_udpSink->setSpectrumSink(m_spectrumVis);
|
||||
m_udpSink->setMessageQueueToGUI(getInputMessageQueue());
|
||||
|
@ -51,7 +51,7 @@ private:
|
||||
unsigned int m_log2Interp;
|
||||
int m_fcPos;
|
||||
|
||||
Interpolators<qint16, SDR_SAMP_SZ, 12> m_interpolators;
|
||||
Interpolators<qint16, SDR_TX_SAMP_SZ, 12> m_interpolators;
|
||||
|
||||
void run();
|
||||
void callback(qint16* buf, qint32 len);
|
||||
|
@ -70,7 +70,7 @@ private:
|
||||
QElapsedTimer m_elapsedTimer;
|
||||
bool m_throttleToggle;
|
||||
|
||||
Interpolators<qint16, SDR_SAMP_SZ, 16> m_interpolators;
|
||||
Interpolators<qint16, SDR_TX_SAMP_SZ, 16> m_interpolators;
|
||||
int16_t *m_buf;
|
||||
|
||||
void run();
|
||||
|
@ -49,7 +49,7 @@ private:
|
||||
|
||||
unsigned int m_log2Interp;
|
||||
|
||||
Interpolators<qint8, SDR_SAMP_SZ, 8> m_interpolators;
|
||||
Interpolators<qint8, SDR_TX_SAMP_SZ, 8> m_interpolators;
|
||||
|
||||
void run();
|
||||
void callback(qint8* buf, qint32 len);
|
||||
|
@ -56,7 +56,7 @@ private:
|
||||
unsigned int m_log2Interp; // soft decimation
|
||||
int m_fcPos;
|
||||
|
||||
Interpolators<qint16, SDR_SAMP_SZ, 12> m_interpolators;
|
||||
Interpolators<qint16, SDR_TX_SAMP_SZ, 12> m_interpolators;
|
||||
|
||||
void run();
|
||||
void callback(qint16* buf, qint32 len);
|
||||
|
@ -221,7 +221,6 @@ bool PlutoSDROutput::handleMessage(const Message& message)
|
||||
|
||||
bool PlutoSDROutput::openDevice()
|
||||
{
|
||||
//m_sampleSourceFifo.resize(m_settings.m_devSampleRate/(1<<(m_settings.m_log2Interp <= 4 ? m_settings.m_log2Interp : 4)));
|
||||
m_sampleSourceFifo.resize(32*PLUTOSDR_BLOCKSIZE_SAMPLES);
|
||||
|
||||
// look for Rx buddy and get reference to common parameters
|
||||
|
@ -54,7 +54,7 @@ private:
|
||||
|
||||
unsigned int m_log2Interp; // soft interpolation
|
||||
|
||||
Interpolators<qint16, SDR_SAMP_SZ, 12> m_interpolators;
|
||||
Interpolators<qint16, SDR_TX_SAMP_SZ, 12> m_interpolators;
|
||||
|
||||
void run();
|
||||
void convert(qint16* buf, qint32 len);
|
||||
|
@ -55,7 +55,11 @@ private:
|
||||
int m_fcPos;
|
||||
static AirspyThread *m_this;
|
||||
|
||||
Decimators<qint16, SDR_SAMP_SZ, 12> m_decimators;
|
||||
#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
|
||||
|
||||
void run();
|
||||
void callback(const qint16* buf, qint32 len);
|
||||
|
@ -53,7 +53,11 @@ private:
|
||||
unsigned int m_log2Decim;
|
||||
static AirspyHFThread *m_this;
|
||||
|
||||
Decimators<qint16, SDR_SAMP_SZ, 16> m_decimators;
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
Decimators<qint64, qint16, SDR_RX_SAMP_SZ, 16> m_decimators;
|
||||
#else
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> m_decimators;
|
||||
#endif
|
||||
|
||||
void run();
|
||||
void callback(const qint16* buf, qint32 len);
|
||||
|
@ -51,7 +51,11 @@ private:
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
|
||||
Decimators<qint16, SDR_SAMP_SZ, 12> m_decimators;
|
||||
#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
|
||||
|
||||
void run();
|
||||
void callback(const qint16* buf, qint32 len);
|
||||
|
@ -175,6 +175,7 @@ bool FileSourceGui::handleMessage(const Message& message)
|
||||
else if (FileSourceInput::MsgReportFileSourceStreamData::match(message))
|
||||
{
|
||||
m_sampleRate = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getSampleRate();
|
||||
m_sampleSize = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getSampleSize();
|
||||
m_centerFrequency = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getCenterFrequency();
|
||||
m_startingTimeStamp = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getStartingTimeStamp();
|
||||
m_recordLength = ((FileSourceInput::MsgReportFileSourceStreamData&)message).getRecordLength();
|
||||
@ -312,6 +313,7 @@ void FileSourceGui::updateWithStreamData()
|
||||
{
|
||||
ui->centerFrequency->setValue(m_centerFrequency/1000);
|
||||
ui->sampleRateText->setText(tr("%1k").arg((float)m_sampleRate / 1000));
|
||||
ui->sampleSizeText->setText(tr("%1b").arg(m_sampleSize));
|
||||
ui->play->setEnabled(m_acquisition);
|
||||
QTime recordLength(0, 0, 0, 0);
|
||||
recordLength = recordLength.addSecs(m_recordLength);
|
||||
|
@ -63,6 +63,7 @@ private:
|
||||
bool m_acquisition;
|
||||
QString m_fileName;
|
||||
int m_sampleRate;
|
||||
quint32 m_sampleSize;
|
||||
quint64 m_centerFrequency;
|
||||
quint32 m_recordLength;
|
||||
std::time_t m_startingTimeStamp;
|
||||
|
@ -6,7 +6,7 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>246</width>
|
||||
<width>300</width>
|
||||
<height>190</height>
|
||||
</rect>
|
||||
</property>
|
||||
@ -231,16 +231,56 @@
|
||||
<layout class="QHBoxLayout" name="rateTimeLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="sampleRateText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Record sample rate</string>
|
||||
<string>Record sample rate (kS/s)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>0k</string>
|
||||
<string>00000k</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sampleSizeText">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>22</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Record sample size (bits)</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>00b</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -48,6 +48,7 @@ FileSourceInput::FileSourceInput(DeviceSourceAPI *deviceAPI) :
|
||||
m_deviceDescription(),
|
||||
m_fileName("..."),
|
||||
m_sampleRate(0),
|
||||
m_sampleSize(0),
|
||||
m_centerFrequency(0),
|
||||
m_recordLength(0),
|
||||
m_startingTimeStamp(0),
|
||||
@ -85,6 +86,7 @@ void FileSourceInput::openFileStream()
|
||||
m_sampleRate = header.sampleRate;
|
||||
m_centerFrequency = header.centerFrequency;
|
||||
m_startingTimeStamp = header.startTimeStamp;
|
||||
m_sampleSize = header.sampleSize;
|
||||
|
||||
if (fileSize > sizeof(FileRecord::Header)) {
|
||||
m_recordLength = (fileSize - sizeof(FileRecord::Header)) / (4 * m_sampleRate);
|
||||
@ -97,6 +99,7 @@ void FileSourceInput::openFileStream()
|
||||
<< " length: " << m_recordLength << " seconds";
|
||||
|
||||
MsgReportFileSourceStreamData *report = MsgReportFileSourceStreamData::create(m_sampleRate,
|
||||
m_sampleSize,
|
||||
m_centerFrequency,
|
||||
m_startingTimeStamp,
|
||||
m_recordLength); // file stream data
|
||||
@ -136,7 +139,7 @@ bool FileSourceInput::start()
|
||||
m_ifstream.seekg(sizeof(FileRecord::Header), std::ios::beg);
|
||||
}
|
||||
|
||||
if(!m_sampleFifo.setSize(m_sampleRate * 4)) {
|
||||
if(!m_sampleFifo.setSize(m_sampleRate * sizeof(Sample))) {
|
||||
qCritical("Could not allocate SampleFifo");
|
||||
return false;
|
||||
}
|
||||
@ -149,7 +152,7 @@ bool FileSourceInput::start()
|
||||
return false;
|
||||
}
|
||||
|
||||
m_fileSourceThread->setSamplerate(m_sampleRate);
|
||||
m_fileSourceThread->setSampleRateAndSize(m_sampleRate, m_sampleSize);
|
||||
m_fileSourceThread->connectTimer(m_masterTimer);
|
||||
m_fileSourceThread->startWork();
|
||||
m_deviceDescription = "FileSource";
|
||||
|
@ -173,30 +173,35 @@ public:
|
||||
|
||||
public:
|
||||
int getSampleRate() const { return m_sampleRate; }
|
||||
quint32 getSampleSize() const { return m_sampleSize; }
|
||||
quint64 getCenterFrequency() const { return m_centerFrequency; }
|
||||
std::time_t getStartingTimeStamp() const { return m_startingTimeStamp; }
|
||||
quint32 getRecordLength() const { return m_recordLength; }
|
||||
|
||||
static MsgReportFileSourceStreamData* create(int sampleRate,
|
||||
quint32 sampleSize,
|
||||
quint64 centerFrequency,
|
||||
std::time_t startingTimeStamp,
|
||||
quint32 recordLength)
|
||||
{
|
||||
return new MsgReportFileSourceStreamData(sampleRate, centerFrequency, startingTimeStamp, recordLength);
|
||||
return new MsgReportFileSourceStreamData(sampleRate, sampleSize, centerFrequency, startingTimeStamp, recordLength);
|
||||
}
|
||||
|
||||
protected:
|
||||
int m_sampleRate;
|
||||
quint32 m_sampleSize;
|
||||
quint64 m_centerFrequency;
|
||||
std::time_t m_startingTimeStamp;
|
||||
quint32 m_recordLength;
|
||||
|
||||
MsgReportFileSourceStreamData(int sampleRate,
|
||||
quint32 sampleSize,
|
||||
quint64 centerFrequency,
|
||||
std::time_t startingTimeStamp,
|
||||
quint32 recordLength) :
|
||||
Message(),
|
||||
m_sampleRate(sampleRate),
|
||||
m_sampleSize(sampleSize),
|
||||
m_centerFrequency(centerFrequency),
|
||||
m_startingTimeStamp(startingTimeStamp),
|
||||
m_recordLength(recordLength)
|
||||
@ -265,6 +270,7 @@ public:
|
||||
QString m_deviceDescription;
|
||||
QString m_fileName;
|
||||
int m_sampleRate;
|
||||
quint32 m_sampleSize;
|
||||
quint64 m_centerFrequency;
|
||||
quint32 m_recordLength; //!< record length in seconds computed from file size
|
||||
std::time_t m_startingTimeStamp;
|
||||
|
@ -29,7 +29,7 @@
|
||||
|
||||
const PluginDescriptor FileSourcePlugin::m_pluginDescriptor = {
|
||||
QString("File source input"),
|
||||
QString("3.10.1"),
|
||||
QString("3.11.1"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -27,12 +27,15 @@ FileSourceThread::FileSourceThread(std::ifstream *samplesStream, SampleSinkFifo*
|
||||
QThread(parent),
|
||||
m_running(false),
|
||||
m_ifstream(samplesStream),
|
||||
m_buf(0),
|
||||
m_fileBuf(0),
|
||||
m_convertBuf(0),
|
||||
m_bufsize(0),
|
||||
m_chunksize(0),
|
||||
m_sampleFifo(sampleFifo),
|
||||
m_samplesCount(0),
|
||||
m_samplerate(0),
|
||||
m_samplesize(0),
|
||||
m_samplebytes(0),
|
||||
m_throttlems(FILESOURCE_THROTTLE_MS),
|
||||
m_throttleToggle(false)
|
||||
{
|
||||
@ -45,8 +48,12 @@ FileSourceThread::~FileSourceThread()
|
||||
stopWork();
|
||||
}
|
||||
|
||||
if (m_buf != 0) {
|
||||
free(m_buf);
|
||||
if (m_fileBuf != 0) {
|
||||
free(m_fileBuf);
|
||||
}
|
||||
|
||||
if (m_convertBuf != 0) {
|
||||
free(m_convertBuf);
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,49 +84,67 @@ void FileSourceThread::stopWork()
|
||||
wait();
|
||||
}
|
||||
|
||||
void FileSourceThread::setSamplerate(int samplerate)
|
||||
void FileSourceThread::setSampleRateAndSize(int samplerate, quint32 samplesize)
|
||||
{
|
||||
qDebug() << "FileSourceThread::setSamplerate:"
|
||||
<< " new:" << samplerate
|
||||
<< " old:" << m_samplerate;
|
||||
qDebug() << "FileSourceThread::setSampleRateAndSize:"
|
||||
<< " new rate:" << samplerate
|
||||
<< " new size:" << samplesize
|
||||
<< " old rate:" << m_samplerate
|
||||
<< " old size:" << m_samplesize;
|
||||
|
||||
if (samplerate != m_samplerate)
|
||||
if ((samplerate != m_samplerate) || (samplesize != m_samplesize))
|
||||
{
|
||||
if (m_running) {
|
||||
stopWork();
|
||||
}
|
||||
|
||||
m_samplerate = samplerate;
|
||||
// TODO: implement FF and slow motion here. 4 corresponds to live. 2 is half speed, 8 is doulbe speed
|
||||
m_chunksize = (m_samplerate * 4 * m_throttlems) / 1000;
|
||||
m_samplesize = samplesize;
|
||||
m_samplebytes = m_samplesize > 16 ? sizeof(int32_t) : sizeof(int16_t);
|
||||
// TODO: implement FF and slow motion here. 2 corresponds to live. 1 is half speed, 4 is double speed
|
||||
m_chunksize = (m_samplerate * 2 * m_samplebytes * m_throttlems) / 1000;
|
||||
|
||||
setBuffer(m_chunksize);
|
||||
setBuffers(m_chunksize);
|
||||
}
|
||||
|
||||
//m_samplerate = samplerate;
|
||||
}
|
||||
|
||||
void FileSourceThread::setBuffer(std::size_t chunksize)
|
||||
void FileSourceThread::setBuffers(std::size_t chunksize)
|
||||
{
|
||||
if (chunksize > m_bufsize)
|
||||
{
|
||||
m_bufsize = chunksize;
|
||||
int nbSamples = m_bufsize/(2 * m_samplebytes);
|
||||
|
||||
if (m_buf == 0)
|
||||
if (m_fileBuf == 0)
|
||||
{
|
||||
qDebug() << "FileSourceThread::setBuffer: Allocate buffer";
|
||||
m_buf = (quint8*) malloc(m_bufsize);
|
||||
qDebug() << "FileSourceThread::setBuffers: Allocate file buffer";
|
||||
m_fileBuf = (quint8*) malloc(m_bufsize);
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "FileSourceThread::setBuffer: Re-allocate buffer";
|
||||
quint8 *buf = m_buf;
|
||||
m_buf = (quint8*) realloc((void*) m_buf, m_bufsize);
|
||||
if (!m_buf) free(buf);
|
||||
qDebug() << "FileSourceThread::setBuffers: Re-allocate file buffer";
|
||||
quint8 *buf = m_fileBuf;
|
||||
m_fileBuf = (quint8*) realloc((void*) m_fileBuf, m_bufsize);
|
||||
if (!m_fileBuf) free(buf);
|
||||
}
|
||||
|
||||
qDebug() << "FileSourceThread::setBuffer: size: " << m_bufsize
|
||||
<< " #samples: " << (m_bufsize/4);
|
||||
if (m_convertBuf == 0)
|
||||
{
|
||||
qDebug() << "FileSourceThread::setBuffers: Allocate conversion buffer";
|
||||
m_convertBuf = (quint8*) malloc(nbSamples*sizeof(Sample));
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug() << "FileSourceThread::setBuffers: Re-allocate conversion buffer";
|
||||
quint8 *buf = m_convertBuf;
|
||||
m_convertBuf = (quint8*) realloc((void*) m_convertBuf, nbSamples*sizeof(Sample));
|
||||
if (!m_convertBuf) free(buf);
|
||||
}
|
||||
|
||||
qDebug() << "FileSourceThread::setBuffers: size: " << m_bufsize
|
||||
<< " #samples: " << nbSamples;
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,17 +176,18 @@ void FileSourceThread::tick()
|
||||
if (throttlems != m_throttlems)
|
||||
{
|
||||
m_throttlems = throttlems;
|
||||
m_chunksize = 4 * ((m_samplerate * (m_throttlems+(m_throttleToggle ? 1 : 0))) / 1000);
|
||||
m_chunksize = 2 * m_samplebytes * ((m_samplerate * (m_throttlems+(m_throttleToggle ? 1 : 0))) / 1000);
|
||||
m_throttleToggle = !m_throttleToggle;
|
||||
setBuffer(m_chunksize);
|
||||
setBuffers(m_chunksize);
|
||||
}
|
||||
|
||||
// read samples directly feeding the SampleFifo (no callback)
|
||||
m_ifstream->read(reinterpret_cast<char*>(m_buf), m_chunksize);
|
||||
m_ifstream->read(reinterpret_cast<char*>(m_fileBuf), m_chunksize);
|
||||
|
||||
if (m_ifstream->eof())
|
||||
{
|
||||
m_sampleFifo->write(m_buf, m_ifstream->gcount());
|
||||
writeToSampleFifo(m_fileBuf, (qint32) m_ifstream->gcount());
|
||||
//m_sampleFifo->write(m_buf, m_ifstream->gcount());
|
||||
// TODO: handle loop playback situation
|
||||
m_ifstream->clear();
|
||||
m_ifstream->seekg(sizeof(FileRecord::Header), std::ios::beg);
|
||||
@ -171,8 +197,55 @@ void FileSourceThread::tick()
|
||||
}
|
||||
else
|
||||
{
|
||||
m_sampleFifo->write(m_buf, m_chunksize);
|
||||
m_samplesCount += m_chunksize / 4;
|
||||
writeToSampleFifo(m_fileBuf, (qint32) m_chunksize);
|
||||
//m_sampleFifo->write(m_buf, m_chunksize);
|
||||
m_samplesCount += m_chunksize / (2 * m_samplebytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FileSourceThread::writeToSampleFifo(const quint8* buf, qint32 nbBytes)
|
||||
{
|
||||
if (m_samplesize == 16)
|
||||
{
|
||||
if (SDR_RX_SAMP_SZ == 16)
|
||||
{
|
||||
m_sampleFifo->write(buf, nbBytes);
|
||||
}
|
||||
else if (SDR_RX_SAMP_SZ == 24)
|
||||
{
|
||||
FixReal *convertBuf = (FixReal *) m_convertBuf;
|
||||
const int16_t *fileBuf = (int16_t *) buf;
|
||||
int nbSamples = nbBytes / (2 * m_samplebytes);
|
||||
|
||||
for (int is = 0; is < nbSamples; is++)
|
||||
{
|
||||
convertBuf[2*is] = fileBuf[2*is] << 8;
|
||||
convertBuf[2*is+1] = fileBuf[2*is+1] << 8;
|
||||
}
|
||||
|
||||
m_sampleFifo->write((quint8*) convertBuf, nbSamples*sizeof(Sample));
|
||||
}
|
||||
}
|
||||
else if (m_samplesize == 24)
|
||||
{
|
||||
if (SDR_RX_SAMP_SZ == 24)
|
||||
{
|
||||
m_sampleFifo->write(buf, nbBytes);
|
||||
}
|
||||
else if (SDR_RX_SAMP_SZ == 16)
|
||||
{
|
||||
FixReal *convertBuf = (FixReal *) m_convertBuf;
|
||||
const int32_t *fileBuf = (int32_t *) buf;
|
||||
int nbSamples = nbBytes / (2 * m_samplebytes);
|
||||
|
||||
for (int is = 0; is < nbSamples; is++)
|
||||
{
|
||||
convertBuf[2*is] = fileBuf[2*is] >> 8;
|
||||
convertBuf[2*is+1] = fileBuf[2*is+1] >> 8;
|
||||
}
|
||||
|
||||
m_sampleFifo->write((quint8*) convertBuf, nbSamples*sizeof(Sample));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -41,8 +41,8 @@ public:
|
||||
|
||||
void startWork();
|
||||
void stopWork();
|
||||
void setSamplerate(int samplerate);
|
||||
void setBuffer(std::size_t chunksize);
|
||||
void setSampleRateAndSize(int samplerate, quint32 samplesize);
|
||||
void setBuffers(std::size_t chunksize);
|
||||
bool isRunning() const { return m_running; }
|
||||
std::size_t getSamplesCount() const { return m_samplesCount; }
|
||||
void setSamplesCount(int samplesCount) { m_samplesCount = samplesCount; }
|
||||
@ -55,20 +55,23 @@ private:
|
||||
bool m_running;
|
||||
|
||||
std::ifstream* m_ifstream;
|
||||
quint8 *m_buf;
|
||||
quint8 *m_fileBuf;
|
||||
quint8 *m_convertBuf;
|
||||
std::size_t m_bufsize;
|
||||
std::size_t m_chunksize;
|
||||
SampleSinkFifo* m_sampleFifo;
|
||||
std::size_t m_samplesCount;
|
||||
|
||||
int m_samplerate;
|
||||
int m_samplerate; //!< File I/Q stream original sample rate
|
||||
quint32 m_samplesize; //!< File effective sample size in bits (I or Q). Ex: 16, 24.
|
||||
quint32 m_samplebytes; //!< Number of bytes used to store a I or Q sample. Ex: 2. 4.
|
||||
int m_throttlems;
|
||||
QElapsedTimer m_elapsedTimer;
|
||||
bool m_throttleToggle;
|
||||
|
||||
void run();
|
||||
//void decimate1(SampleVector::iterator* it, const qint16* buf, qint32 len);
|
||||
//void callback(const qint16* buf, qint32 len);
|
||||
void writeToSampleFifo(const quint8* buf, qint32 nbBytes);
|
||||
private slots:
|
||||
void tick();
|
||||
};
|
||||
|
@ -54,7 +54,11 @@ private:
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
|
||||
Decimators<qint8, SDR_SAMP_SZ, 8> m_decimators;
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
Decimators<qint64, qint8, SDR_RX_SAMP_SZ, 8> m_decimators;
|
||||
#else
|
||||
Decimators<qint32, qint8, SDR_RX_SAMP_SZ, 8> m_decimators;
|
||||
#endif
|
||||
|
||||
void run();
|
||||
void callback(const qint8* buf, qint32 len);
|
||||
|
@ -55,7 +55,11 @@ private:
|
||||
|
||||
unsigned int m_log2Decim; // soft decimation
|
||||
|
||||
Decimators<qint16, SDR_SAMP_SZ, 12> m_decimators;
|
||||
#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
|
||||
|
||||
void run();
|
||||
void callback(const qint16* buf, qint32 len);
|
||||
|
@ -59,7 +59,11 @@ private:
|
||||
int m_fcPos;
|
||||
float m_phasor;
|
||||
|
||||
Decimators<qint16, SDR_SAMP_SZ, 12> m_decimators;
|
||||
#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
|
||||
|
||||
void run();
|
||||
void convert(const qint16* buf, qint32 len);
|
||||
|
@ -52,7 +52,11 @@ private:
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
|
||||
DecimatorsU<quint8, SDR_SAMP_SZ, 8, 127> m_decimators;
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
DecimatorsU<qint64, quint8, SDR_RX_SAMP_SZ, 8, 127> m_decimators;
|
||||
#else
|
||||
DecimatorsU<qint32, quint8, SDR_RX_SAMP_SZ, 8, 127> m_decimators;
|
||||
#endif
|
||||
|
||||
void run();
|
||||
void callback(const quint8* buf, qint32 len);
|
||||
|
@ -174,7 +174,7 @@ void SDRdaemonSourceBuffer::checkSlotData(int slotIndex)
|
||||
if (sampleRate > 0)
|
||||
{
|
||||
int64_t ts = m_currentMeta.m_tv_sec * 1000000LL + m_currentMeta.m_tv_usec;
|
||||
ts -= (rwDelayBytes * 1000000LL) / (sampleRate * sizeof(Sample));
|
||||
ts -= (rwDelayBytes * 1000000LL) / (sampleRate * sizeof(SDRdaemonSample));
|
||||
m_tvOut_sec = ts / 1000000LL;
|
||||
m_tvOut_usec = ts - (m_tvOut_sec * 1000000LL);
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
struct Sample
|
||||
struct SDRdaemonSample
|
||||
{
|
||||
int16_t i;
|
||||
int16_t q;
|
||||
@ -68,12 +68,12 @@ public:
|
||||
uint8_t filler;
|
||||
};
|
||||
|
||||
static const int samplesPerBlock = (SDRDAEMONSOURCE_UDPSIZE - sizeof(Header)) / sizeof(Sample);
|
||||
static const int samplesPerBlock = (SDRDAEMONSOURCE_UDPSIZE - sizeof(Header)) / sizeof(SDRdaemonSample);
|
||||
static const int framesSize = SDRDAEMONSOURCE_NBDECODERSLOTS * (SDRDAEMONSOURCE_NBORIGINALBLOCKS - 1) * (SDRDAEMONSOURCE_UDPSIZE - sizeof(Header));
|
||||
|
||||
struct ProtectedBlock
|
||||
{
|
||||
Sample samples[samplesPerBlock];
|
||||
SDRdaemonSample samples[samplesPerBlock];
|
||||
};
|
||||
|
||||
struct SuperBlock
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
const PluginDescriptor SDRdaemonSourcePlugin::m_pluginDescriptor = {
|
||||
QString("SDRdaemon source input"),
|
||||
QString("3.9.0"),
|
||||
QString("3.11.1"),
|
||||
QString("(c) Edouard Griffiths, F4EXB"),
|
||||
QString("https://github.com/f4exb/sdrangel"),
|
||||
true,
|
||||
|
@ -51,6 +51,8 @@ SDRdaemonSourceUDPHandler::SDRdaemonSourceUDPHandler(SampleSinkFifo *sampleFifo,
|
||||
m_throttlems(SDRDAEMONSOURCE_THROTTLE_MS),
|
||||
m_readLengthSamples(0),
|
||||
m_readLength(0),
|
||||
m_converterBuffer(0),
|
||||
m_converterBufferNbSamples(0),
|
||||
m_throttleToggle(false),
|
||||
m_rateDivider(1000/SDRDAEMONSOURCE_THROTTLE_MS),
|
||||
m_autoCorrBuffer(true)
|
||||
@ -72,6 +74,7 @@ SDRdaemonSourceUDPHandler::~SDRdaemonSourceUDPHandler()
|
||||
{
|
||||
stop();
|
||||
delete[] m_udpBuf;
|
||||
if (m_converterBuffer) { delete[] m_converterBuffer; }
|
||||
#ifdef USE_INTERNAL_TIMER
|
||||
if (m_timer) {
|
||||
delete m_timer;
|
||||
@ -263,9 +266,32 @@ void SDRdaemonSourceUDPHandler::tick()
|
||||
|
||||
m_readLength = m_readLengthSamples * SDRdaemonSourceBuffer::m_iqSampleSize;
|
||||
|
||||
// read samples directly feeding the SampleFifo (no callback)
|
||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_sdrDaemonBuffer.readData(m_readLength)), m_readLength);
|
||||
m_samplesCount += m_readLengthSamples;
|
||||
if (SDR_RX_SAMP_SZ == 16)
|
||||
{
|
||||
// read samples directly feeding the SampleFifo (no callback)
|
||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_sdrDaemonBuffer.readData(m_readLength)), m_readLength);
|
||||
m_samplesCount += m_readLengthSamples;
|
||||
}
|
||||
else if (SDR_RX_SAMP_SZ == 24)
|
||||
{
|
||||
if (m_readLengthSamples > m_converterBufferNbSamples)
|
||||
{
|
||||
if (m_converterBuffer) { delete[] m_converterBuffer; }
|
||||
m_converterBuffer = new int32_t[m_readLengthSamples*2];
|
||||
}
|
||||
|
||||
uint8_t *buf = m_sdrDaemonBuffer.readData(m_readLength);
|
||||
|
||||
for (unsigned int is = 0; is < m_readLengthSamples; is++)
|
||||
{
|
||||
m_converterBuffer[2*is] = ((int16_t*)buf)[2*is];
|
||||
m_converterBuffer[2*is]<<=8;
|
||||
m_converterBuffer[2*is+1] = ((int16_t*)buf)[2*is+1];
|
||||
m_converterBuffer[2*is+1]<<=8;
|
||||
}
|
||||
|
||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*sizeof(Sample));
|
||||
}
|
||||
|
||||
if (m_tickCount < m_rateDivider)
|
||||
{
|
||||
|
@ -77,6 +77,8 @@ private:
|
||||
int m_throttlems;
|
||||
uint32_t m_readLengthSamples;
|
||||
uint32_t m_readLength;
|
||||
int32_t *m_converterBuffer;
|
||||
uint32_t m_converterBufferNbSamples;
|
||||
bool m_throttleToggle;
|
||||
uint32_t m_rateDivider;
|
||||
bool m_autoCorrBuffer;
|
||||
|
@ -52,7 +52,11 @@ private:
|
||||
unsigned int m_log2Decim;
|
||||
int m_fcPos;
|
||||
|
||||
Decimators<qint16, SDR_SAMP_SZ, 12> m_decimators;
|
||||
#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
|
||||
|
||||
void run();
|
||||
void callback(const qint16* buf, qint32 len);
|
||||
|
@ -85,9 +85,15 @@ private:
|
||||
bool m_throttleToggle;
|
||||
QMutex m_mutex;
|
||||
|
||||
Decimators<qint16, SDR_SAMP_SZ, 8> m_decimators_8;
|
||||
Decimators<qint16, SDR_SAMP_SZ, 12> m_decimators_12;
|
||||
Decimators<qint16, SDR_SAMP_SZ, 16> m_decimators_16;
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
Decimators<qint64, qint16, SDR_RX_SAMP_SZ, 8> m_decimators_8;
|
||||
Decimators<qint64, qint16, SDR_RX_SAMP_SZ, 12> m_decimators_12;
|
||||
Decimators<qint64, qint16, SDR_RX_SAMP_SZ, 16> m_decimators_16;
|
||||
#else
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 8> m_decimators_8;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 12> m_decimators_12;
|
||||
Decimators<qint32, qint16, SDR_RX_SAMP_SZ, 16> m_decimators_16;
|
||||
#endif
|
||||
|
||||
void run();
|
||||
void callback(const qint16* buf, qint32 len);
|
||||
|
@ -18,11 +18,15 @@
|
||||
#define INCLUDE_GPL_DSP_DECIMATORS_H_
|
||||
|
||||
#include "dsp/dsptypes.h"
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
#include "dsp/inthalfbandfilterdb.h"
|
||||
#else
|
||||
#ifdef USE_SSE4_1
|
||||
#include "dsp/inthalfbandfiltereo1.h"
|
||||
#else
|
||||
#include "dsp/inthalfbandfilterdb.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DECIMATORS_HB_FILTER_ORDER 64
|
||||
|
||||
@ -44,6 +48,42 @@ struct decimation_shifts
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<16, 24>
|
||||
{
|
||||
static const uint pre1 = 0;
|
||||
static const uint pre2 = 0;
|
||||
static const uint post2 = 9;
|
||||
static const uint pre4 = 0;
|
||||
static const uint post4 = 10;
|
||||
static const uint pre8 = 0;
|
||||
static const uint post8 = 11;
|
||||
static const uint pre16 = 0;
|
||||
static const uint post16 = 12;
|
||||
static const uint pre32 = 0;
|
||||
static const uint post32 = 13;
|
||||
static const uint pre64 = 0;
|
||||
static const uint post64 = 14;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<24, 24>
|
||||
{
|
||||
static const uint pre1 = 0;
|
||||
static const uint pre2 = 0;
|
||||
static const uint post2 = 1;
|
||||
static const uint pre4 = 0;
|
||||
static const uint post4 = 2;
|
||||
static const uint pre8 = 0;
|
||||
static const uint post8 = 3;
|
||||
static const uint pre16 = 0;
|
||||
static const uint post16 = 4;
|
||||
static const uint pre32 = 0;
|
||||
static const uint post32 = 5;
|
||||
static const uint pre64 = 0;
|
||||
static const uint post64 = 6;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<16, 16>
|
||||
{
|
||||
@ -62,6 +102,24 @@ struct decimation_shifts<16, 16>
|
||||
static const uint post64 = 6;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<24, 16>
|
||||
{
|
||||
static const uint pre1 = 8;
|
||||
static const uint pre2 = 7;
|
||||
static const uint post2 = 0;
|
||||
static const uint pre4 = 6;
|
||||
static const uint post4 = 0;
|
||||
static const uint pre8 = 5;
|
||||
static const uint post8 = 0;
|
||||
static const uint pre16 = 4;
|
||||
static const uint post16 = 0;
|
||||
static const uint pre32 = 3;
|
||||
static const uint post32 = 0;
|
||||
static const uint pre64 = 2;
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<16, 12>
|
||||
{
|
||||
@ -80,6 +138,24 @@ struct decimation_shifts<16, 12>
|
||||
static const uint post64 = 2;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<24, 12>
|
||||
{
|
||||
static const uint pre1 = 12;
|
||||
static const uint pre2 = 11;
|
||||
static const uint post2 = 0;
|
||||
static const uint pre4 = 10;
|
||||
static const uint post4 = 0;
|
||||
static const uint pre8 = 9;
|
||||
static const uint post8 = 0;
|
||||
static const uint pre16 = 8;
|
||||
static const uint post16 = 0;
|
||||
static const uint pre32 = 7;
|
||||
static const uint post32 = 0;
|
||||
static const uint pre64 = 6;
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<16, 8>
|
||||
{
|
||||
@ -98,7 +174,25 @@ struct decimation_shifts<16, 8>
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
template<>
|
||||
struct decimation_shifts<24, 8>
|
||||
{
|
||||
static const uint pre1 = 16;
|
||||
static const uint pre2 = 15;
|
||||
static const uint post2 = 0;
|
||||
static const uint pre4 = 14;
|
||||
static const uint post4 = 0;
|
||||
static const uint pre8 = 13;
|
||||
static const uint post8 = 0;
|
||||
static const uint pre16 = 12;
|
||||
static const uint post16 = 0;
|
||||
static const uint pre32 = 11;
|
||||
static const uint post32 = 0;
|
||||
static const uint pre64 = 10;
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
class Decimators
|
||||
{
|
||||
public:
|
||||
@ -146,6 +240,14 @@ public:
|
||||
void decimate64_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len);
|
||||
|
||||
private:
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
#else
|
||||
#ifdef USE_SSE4_1
|
||||
IntHalfbandFilterEO1<DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEO1<DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
@ -154,17 +256,18 @@ private:
|
||||
IntHalfbandFilterEO1<DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEO1<DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
#else
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate1(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate1(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
|
||||
@ -178,8 +281,8 @@ void Decimators<T, SdrBits, InputBits>::decimate1(SampleVector::iterator* it, co
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate1(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate1(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
|
||||
@ -193,10 +296,10 @@ void Decimators<T, SdrBits, InputBits>::decimate1(SampleVector::iterator* it, co
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate2_u(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate2_u(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -214,10 +317,10 @@ void Decimators<T, SdrBits, InputBits>::decimate2_u(SampleVector::iterator* it,
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate2_u(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate2_u(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 3; pos += 4)
|
||||
{
|
||||
@ -237,10 +340,10 @@ void Decimators<T, SdrBits, InputBits>::decimate2_u(SampleVector::iterator* it,
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -258,10 +361,10 @@ void Decimators<T, SdrBits, InputBits>::decimate2_inf(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate2_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate2_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 3; pos += 4)
|
||||
{
|
||||
@ -281,10 +384,10 @@ void Decimators<T, SdrBits, InputBits>::decimate2_inf(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -302,10 +405,10 @@ void Decimators<T, SdrBits, InputBits>::decimate2_sup(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate2_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate2_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 3; pos += 4)
|
||||
{
|
||||
@ -325,10 +428,10 @@ void Decimators<T, SdrBits, InputBits>::decimate2_sup(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -342,10 +445,10 @@ void Decimators<T, SdrBits, InputBits>::decimate4_inf(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate4_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate4_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 3; pos += 4)
|
||||
{
|
||||
@ -359,8 +462,8 @@ void Decimators<T, SdrBits, InputBits>::decimate4_inf(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
// Sup (USB):
|
||||
// x y x y x y x y / x -> 1,-2,-5,6 / y -> -0,-3,4,7
|
||||
@ -368,7 +471,7 @@ void Decimators<T, SdrBits, InputBits>::decimate4_sup(SampleVector::iterator* it
|
||||
// Inf (LSB):
|
||||
// x y x y x y x y / x -> 0,-3,-4,7 / y -> 1,2,-5,-6
|
||||
// [ rotate: 0, 1, -3, 2, -4, -5, 7, -6]
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -382,10 +485,10 @@ void Decimators<T, SdrBits, InputBits>::decimate4_sup(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate4_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate4_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 3; pos += 4)
|
||||
{
|
||||
@ -399,10 +502,10 @@ void Decimators<T, SdrBits, InputBits>::decimate4_sup(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[2], yimag[2];
|
||||
AccuType xreal[2], yimag[2];
|
||||
|
||||
for (int pos = 0; pos < len - 15; pos += 8)
|
||||
{
|
||||
@ -422,10 +525,10 @@ void Decimators<T, SdrBits, InputBits>::decimate8_inf(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate8_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate8_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal[2], yimag[2];
|
||||
AccuType xreal[2], yimag[2];
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 4)
|
||||
{
|
||||
@ -445,10 +548,10 @@ void Decimators<T, SdrBits, InputBits>::decimate8_inf(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[2], yimag[2];
|
||||
AccuType xreal[2], yimag[2];
|
||||
|
||||
for (int pos = 0; pos < len - 15; pos += 8)
|
||||
{
|
||||
@ -468,10 +571,10 @@ void Decimators<T, SdrBits, InputBits>::decimate8_sup(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate8_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate8_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal[2], yimag[2];
|
||||
AccuType xreal[2], yimag[2];
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 4)
|
||||
{
|
||||
@ -491,12 +594,12 @@ void Decimators<T, SdrBits, InputBits>::decimate8_sup(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
// Offset tuning: 4x downsample and rotate, then
|
||||
// downsample 4x more. [ rotate: 0, 1, -3, 2, -4, -5, 7, -6]
|
||||
qint32 xreal[4], yimag[4];
|
||||
AccuType xreal[4], yimag[4];
|
||||
|
||||
for (int pos = 0; pos < len - 31; )
|
||||
{
|
||||
@ -519,12 +622,12 @@ void Decimators<T, SdrBits, InputBits>::decimate16_inf(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate16_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate16_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
// Offset tuning: 4x downsample and rotate, then
|
||||
// downsample 4x more. [ rotate: 0, 1, -3, 2, -4, -5, 7, -6]
|
||||
qint32 xreal[4], yimag[4];
|
||||
AccuType xreal[4], yimag[4];
|
||||
|
||||
for (int pos = 0; pos < len - 15; )
|
||||
{
|
||||
@ -547,12 +650,12 @@ void Decimators<T, SdrBits, InputBits>::decimate16_inf(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
// Offset tuning: 4x downsample and rotate, then
|
||||
// downsample 4x more. [ rotate: 1, 0, -2, 3, -5, -4, 6, -7]
|
||||
qint32 xreal[4], yimag[4];
|
||||
AccuType xreal[4], yimag[4];
|
||||
|
||||
for (int pos = 0; pos < len - 31; )
|
||||
{
|
||||
@ -575,12 +678,12 @@ void Decimators<T, SdrBits, InputBits>::decimate16_sup(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate16_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate16_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
// Offset tuning: 4x downsample and rotate, then
|
||||
// downsample 4x more. [ rotate: 1, 0, -2, 3, -5, -4, 6, -7]
|
||||
qint32 xreal[4], yimag[4];
|
||||
AccuType xreal[4], yimag[4];
|
||||
|
||||
for (int pos = 0; pos < len - 15; )
|
||||
{
|
||||
@ -603,10 +706,10 @@ void Decimators<T, SdrBits, InputBits>::decimate16_sup(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[8], yimag[8];
|
||||
AccuType xreal[8], yimag[8];
|
||||
|
||||
for (int pos = 0; pos < len - 63; )
|
||||
{
|
||||
@ -634,10 +737,10 @@ void Decimators<T, SdrBits, InputBits>::decimate32_inf(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate32_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate32_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal[8], yimag[8];
|
||||
AccuType xreal[8], yimag[8];
|
||||
|
||||
for (int pos = 0; pos < len - 31; )
|
||||
{
|
||||
@ -665,10 +768,10 @@ void Decimators<T, SdrBits, InputBits>::decimate32_inf(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[8], yimag[8];
|
||||
AccuType xreal[8], yimag[8];
|
||||
|
||||
for (int pos = 0; pos < len - 63; )
|
||||
{
|
||||
@ -696,10 +799,10 @@ void Decimators<T, SdrBits, InputBits>::decimate32_sup(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate32_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate32_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal[8], yimag[8];
|
||||
AccuType xreal[8], yimag[8];
|
||||
|
||||
for (int pos = 0; pos < len - 31; )
|
||||
{
|
||||
@ -727,10 +830,10 @@ void Decimators<T, SdrBits, InputBits>::decimate32_sup(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[16], yimag[16];
|
||||
AccuType xreal[16], yimag[16];
|
||||
|
||||
for (int pos = 0; pos < len - 127; )
|
||||
{
|
||||
@ -767,10 +870,10 @@ void Decimators<T, SdrBits, InputBits>::decimate64_inf(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate64_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate64_inf(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal[16], yimag[16];
|
||||
AccuType xreal[16], yimag[16];
|
||||
|
||||
for (int pos = 0; pos < len - 63; )
|
||||
{
|
||||
@ -807,10 +910,10 @@ void Decimators<T, SdrBits, InputBits>::decimate64_inf(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[16], yimag[16];
|
||||
AccuType xreal[16], yimag[16];
|
||||
|
||||
for (int pos = 0; pos < len - 127; )
|
||||
{
|
||||
@ -847,10 +950,10 @@ void Decimators<T, SdrBits, InputBits>::decimate64_sup(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate64_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate64_sup(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 xreal[16], yimag[16];
|
||||
AccuType xreal[16], yimag[16];
|
||||
|
||||
for (int pos = 0; pos < len - 63; )
|
||||
{
|
||||
@ -887,10 +990,10 @@ void Decimators<T, SdrBits, InputBits>::decimate64_sup(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[2];
|
||||
AccuType intbuf[2];
|
||||
|
||||
for (int pos = 0; pos < len - 3; pos += 4)
|
||||
{
|
||||
@ -905,14 +1008,15 @@ void Decimators<T, SdrBits, InputBits>::decimate2_cen(SampleVector::iterator* it
|
||||
|
||||
(**it).setReal(intbuf[0] >> decimation_shifts<SdrBits, InputBits>::post2);
|
||||
(**it).setImag(intbuf[1] >> decimation_shifts<SdrBits, InputBits>::post2);
|
||||
|
||||
++(*it);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate2_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate2_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 intbuf[2];
|
||||
AccuType intbuf[2];
|
||||
|
||||
for (int pos = 0; pos < len - 1; pos += 2)
|
||||
{
|
||||
@ -931,10 +1035,10 @@ void Decimators<T, SdrBits, InputBits>::decimate2_cen(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[4];
|
||||
AccuType intbuf[4];
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -966,10 +1070,10 @@ void Decimators<T, SdrBits, InputBits>::decimate4_cen(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate4_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate4_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 intbuf[4];
|
||||
AccuType intbuf[4];
|
||||
|
||||
for (int pos = 0; pos < len - 3; pos += 4)
|
||||
{
|
||||
@ -1001,10 +1105,10 @@ void Decimators<T, SdrBits, InputBits>::decimate4_cen(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[8];
|
||||
AccuType intbuf[8];
|
||||
|
||||
for (int pos = 0; pos < len - 15; pos += 16)
|
||||
{
|
||||
@ -1061,10 +1165,10 @@ void Decimators<T, SdrBits, InputBits>::decimate8_cen(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate8_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate8_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 intbuf[8];
|
||||
AccuType intbuf[8];
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -1121,10 +1225,10 @@ void Decimators<T, SdrBits, InputBits>::decimate8_cen(SampleVector::iterator* it
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[16];
|
||||
AccuType intbuf[16];
|
||||
|
||||
for (int pos = 0; pos < len - 31; pos += 32)
|
||||
{
|
||||
@ -1230,10 +1334,10 @@ void Decimators<T, SdrBits, InputBits>::decimate16_cen(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate16_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate16_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 intbuf[16];
|
||||
AccuType intbuf[16];
|
||||
|
||||
for (int pos = 0; pos < len - 15; pos += 16)
|
||||
{
|
||||
@ -1339,10 +1443,10 @@ void Decimators<T, SdrBits, InputBits>::decimate16_cen(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[32];
|
||||
AccuType intbuf[32];
|
||||
|
||||
for (int pos = 0; pos < len - 63; pos += 64)
|
||||
{
|
||||
@ -1545,10 +1649,10 @@ void Decimators<T, SdrBits, InputBits>::decimate32_cen(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate32_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate32_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 intbuf[32];
|
||||
AccuType intbuf[32];
|
||||
|
||||
for (int pos = 0; pos < len - 31; pos += 32)
|
||||
{
|
||||
@ -1751,10 +1855,10 @@ void Decimators<T, SdrBits, InputBits>::decimate32_cen(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[64];
|
||||
AccuType intbuf[64];
|
||||
|
||||
for (int pos = 0; pos < len - 127; pos += 128)
|
||||
{
|
||||
@ -2151,10 +2255,10 @@ void Decimators<T, SdrBits, InputBits>::decimate64_cen(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate64_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<AccuType, T, SdrBits, InputBits>::decimate64_cen(SampleVector::iterator* it, const T* bufI, const T* bufQ, qint32 len)
|
||||
{
|
||||
qint32 intbuf[64];
|
||||
AccuType intbuf[64];
|
||||
|
||||
for (int pos = 0; pos < len - 63; pos += 64)
|
||||
{
|
||||
@ -2551,218 +2655,4 @@ void Decimators<T, SdrBits, InputBits>::decimate64_cen(SampleVector::iterator* i
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
while (pos < len - 1)
|
||||
{
|
||||
qint32 x0 = buf[pos+0] << decimation_shifts<SdrBits, InputBits>::pre2;
|
||||
qint32 y0 = buf[pos+1] << decimation_shifts<SdrBits, InputBits>::pre2;
|
||||
pos += 2;
|
||||
|
||||
if (m_decimator2.workDecimateCenter(&x0, &y0))
|
||||
{
|
||||
(**it).setReal(x0 >> decimation_shifts<SdrBits, InputBits>::post2);
|
||||
(**it).setImag(y0 >> decimation_shifts<SdrBits, InputBits>::post2);
|
||||
++(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
while (pos < len - 1)
|
||||
{
|
||||
qint32 x0 = buf[pos+0] << decimation_shifts<SdrBits, InputBits>::pre4;
|
||||
qint32 y0 = buf[pos+1] << decimation_shifts<SdrBits, InputBits>::pre4;
|
||||
pos += 2;
|
||||
|
||||
if (m_decimator2.workDecimateCenter(&x0, &y0))
|
||||
{
|
||||
qint32 x1 = x0;
|
||||
qint32 y1 = y0;
|
||||
|
||||
if (m_decimator4.workDecimateCenter(&x1, &y1))
|
||||
{
|
||||
(**it).setReal(x0 >> decimation_shifts<SdrBits, InputBits>::post4);
|
||||
(**it).setImag(y0 >> decimation_shifts<SdrBits, InputBits>::post4);
|
||||
++(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
while (pos < len - 1)
|
||||
{
|
||||
qint32 x0 = buf[pos+0] << decimation_shifts<SdrBits, InputBits>::pre8;
|
||||
qint32 y0 = buf[pos+1] << decimation_shifts<SdrBits, InputBits>::pre8;
|
||||
pos += 2;
|
||||
|
||||
if (m_decimator2.workDecimateCenter(&x0, &y0))
|
||||
{
|
||||
qint32 x1 = x0;
|
||||
qint32 y1 = y0;
|
||||
|
||||
if (m_decimator4.workDecimateCenter(&x1, &y1))
|
||||
{
|
||||
qint32 x2 = x1;
|
||||
qint32 y2 = y1;
|
||||
|
||||
if (m_decimator8.workDecimateCenter(&x2, &y2))
|
||||
{
|
||||
(**it).setReal(x2 >> decimation_shifts<SdrBits, InputBits>::post8);
|
||||
(**it).setImag(y2 >> decimation_shifts<SdrBits, InputBits>::post8);
|
||||
++(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
while (pos < len - 1)
|
||||
{
|
||||
qint32 x0 = buf[pos+0] << decimation_shifts<SdrBits, InputBits>::pre16;
|
||||
qint32 y0 = buf[pos+1] << decimation_shifts<SdrBits, InputBits>::pre16;
|
||||
pos += 2;
|
||||
|
||||
if (m_decimator2.workDecimateCenter(&x0, &y0))
|
||||
{
|
||||
qint32 x1 = x0;
|
||||
qint32 y1 = y0;
|
||||
|
||||
if (m_decimator4.workDecimateCenter(&x1, &y1))
|
||||
{
|
||||
qint32 x2 = x1;
|
||||
qint32 y2 = y1;
|
||||
|
||||
if (m_decimator8.workDecimateCenter(&x2, &y2))
|
||||
{
|
||||
qint32 x3 = x2;
|
||||
qint32 y3 = y2;
|
||||
|
||||
if (m_decimator16.workDecimateCenter(&x3, &y3))
|
||||
{
|
||||
(**it).setReal(x3 >> decimation_shifts<SdrBits, InputBits>::post16);
|
||||
(**it).setImag(y3 >> decimation_shifts<SdrBits, InputBits>::post16);
|
||||
++(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
while (pos < len - 1)
|
||||
{
|
||||
qint32 x0 = buf[pos+0] << decimation_shifts<SdrBits, InputBits>::pre32;
|
||||
qint32 y0 = buf[pos+1] << decimation_shifts<SdrBits, InputBits>::pre32;
|
||||
pos += 2;
|
||||
|
||||
if (m_decimator2.workDecimateCenter(&x0, &y0))
|
||||
{
|
||||
qint32 x1 = x0;
|
||||
qint32 y1 = y0;
|
||||
|
||||
if (m_decimator4.workDecimateCenter(&x1, &y1))
|
||||
{
|
||||
qint32 x2 = x1;
|
||||
qint32 y2 = y1;
|
||||
|
||||
if (m_decimator8.workDecimateCenter(&x2, &y2))
|
||||
{
|
||||
qint32 x3 = x2;
|
||||
qint32 y3 = y2;
|
||||
|
||||
if (m_decimator16.workDecimateCenter(&x3, &y3))
|
||||
{
|
||||
qint32 x4 = x3;
|
||||
qint32 y4 = y3;
|
||||
|
||||
if (m_decimator32.workDecimateCenter(&x4, &y4))
|
||||
{
|
||||
(**it).setReal(x4 >> decimation_shifts<SdrBits, InputBits>::post32);
|
||||
(**it).setImag(y4 >> decimation_shifts<SdrBits, InputBits>::post32);
|
||||
++(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits>
|
||||
void Decimators<T, SdrBits, InputBits>::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
int pos = 0;
|
||||
|
||||
while (pos < len - 1)
|
||||
{
|
||||
qint32 x0 = buf[pos+0] << decimation_shifts<SdrBits, InputBits>::pre64;
|
||||
qint32 y0 = buf[pos+1] << decimation_shifts<SdrBits, InputBits>::pre64;
|
||||
pos += 2;
|
||||
|
||||
if (m_decimator2.workDecimateCenter(&x0, &y0))
|
||||
{
|
||||
qint32 x1 = x0;
|
||||
qint32 y1 = y0;
|
||||
|
||||
if (m_decimator4.workDecimateCenter(&x1, &y1))
|
||||
{
|
||||
qint32 x2 = x1;
|
||||
qint32 y2 = y1;
|
||||
|
||||
if (m_decimator8.workDecimateCenter(&x2, &y2))
|
||||
{
|
||||
qint32 x3 = x2;
|
||||
qint32 y3 = y2;
|
||||
|
||||
if (m_decimator16.workDecimateCenter(&x3, &y3))
|
||||
{
|
||||
qint32 x4 = x3;
|
||||
qint32 y4 = y3;
|
||||
|
||||
if (m_decimator32.workDecimateCenter(&x4, &y4))
|
||||
{
|
||||
qint32 x5 = x4;
|
||||
qint32 y5 = y4;
|
||||
|
||||
if (m_decimator64.workDecimateCenter(&x5, &y5))
|
||||
{
|
||||
(**it).setReal(x5 >> decimation_shifts<SdrBits, InputBits>::post64);
|
||||
(**it).setImag(y5 >> decimation_shifts<SdrBits, InputBits>::post64);
|
||||
++(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
#endif /* INCLUDE_GPL_DSP_DECIMATORS_H_ */
|
||||
|
@ -24,11 +24,15 @@
|
||||
#define INCLUDE_GPL_DSP_DECIMATORSU_H_
|
||||
|
||||
#include "dsp/dsptypes.h"
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
#include "dsp/inthalfbandfilterdb.h"
|
||||
#else
|
||||
#ifdef USE_SSE4_1
|
||||
#include "dsp/inthalfbandfiltereo1.h"
|
||||
#else
|
||||
#include "dsp/inthalfbandfilterdb.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DECIMATORS_HB_FILTER_ORDER 64
|
||||
|
||||
@ -50,6 +54,24 @@ struct decimation_shifts
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<24, 24>
|
||||
{
|
||||
static const uint pre1 = 0;
|
||||
static const uint pre2 = 0;
|
||||
static const uint post2 = 1;
|
||||
static const uint pre4 = 0;
|
||||
static const uint post4 = 2;
|
||||
static const uint pre8 = 0;
|
||||
static const uint post8 = 3;
|
||||
static const uint pre16 = 0;
|
||||
static const uint post16 = 4;
|
||||
static const uint pre32 = 0;
|
||||
static const uint post32 = 5;
|
||||
static const uint pre64 = 0;
|
||||
static const uint post64 = 6;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<16, 16>
|
||||
{
|
||||
@ -68,6 +90,24 @@ struct decimation_shifts<16, 16>
|
||||
static const uint post64 = 6;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<24, 16>
|
||||
{
|
||||
static const uint pre1 = 8;
|
||||
static const uint pre2 = 7;
|
||||
static const uint post2 = 0;
|
||||
static const uint pre4 = 6;
|
||||
static const uint post4 = 0;
|
||||
static const uint pre8 = 5;
|
||||
static const uint post8 = 0;
|
||||
static const uint pre16 = 4;
|
||||
static const uint post16 = 0;
|
||||
static const uint pre32 = 3;
|
||||
static const uint post32 = 0;
|
||||
static const uint pre64 = 2;
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<16, 12>
|
||||
{
|
||||
@ -86,6 +126,24 @@ struct decimation_shifts<16, 12>
|
||||
static const uint post64 = 2;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<24, 12>
|
||||
{
|
||||
static const uint pre1 = 12;
|
||||
static const uint pre2 = 11;
|
||||
static const uint post2 = 0;
|
||||
static const uint pre4 = 10;
|
||||
static const uint post4 = 0;
|
||||
static const uint pre8 = 9;
|
||||
static const uint post8 = 0;
|
||||
static const uint pre16 = 8;
|
||||
static const uint post16 = 0;
|
||||
static const uint pre32 = 7;
|
||||
static const uint post32 = 0;
|
||||
static const uint pre64 = 6;
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<>
|
||||
struct decimation_shifts<16, 8>
|
||||
{
|
||||
@ -104,7 +162,25 @@ struct decimation_shifts<16, 8>
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
template<>
|
||||
struct decimation_shifts<24, 8>
|
||||
{
|
||||
static const uint pre1 = 16;
|
||||
static const uint pre2 = 15;
|
||||
static const uint post2 = 0;
|
||||
static const uint pre4 = 14;
|
||||
static const uint post4 = 0;
|
||||
static const uint pre8 = 13;
|
||||
static const uint post8 = 0;
|
||||
static const uint pre16 = 12;
|
||||
static const uint post16 = 0;
|
||||
static const uint pre32 = 11;
|
||||
static const uint post32 = 0;
|
||||
static const uint pre64 = 10;
|
||||
static const uint post64 = 0;
|
||||
};
|
||||
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
class DecimatorsU
|
||||
{
|
||||
public:
|
||||
@ -130,6 +206,14 @@ public:
|
||||
void decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len);
|
||||
|
||||
private:
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterDB<qint64, DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
#else
|
||||
#ifdef USE_SSE4_1
|
||||
IntHalfbandFilterEO1<DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterEO1<DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
@ -138,17 +222,18 @@ private:
|
||||
IntHalfbandFilterEO1<DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterEO1<DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
#else
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterDB<DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator2; // 1st stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator16; // 4th stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator32; // 5th stages
|
||||
IntHalfbandFilterDB<qint32, DECIMATORS_HB_FILTER_ORDER> m_decimator64; // 6th stages
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate1(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate1(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
|
||||
@ -162,8 +247,8 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate1(SampleVector::iterator
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate2_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
|
||||
@ -183,10 +268,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate2_inf(SampleVector::iter
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate2_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -204,10 +289,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate2_sup(SampleVector::iter
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate4_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -221,8 +306,8 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate4_inf(SampleVector::iter
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate4_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
// Sup (USB):
|
||||
// x y x y x y x y / x -> 1,-2,-5,6 / y -> -0,-3,4,7
|
||||
@ -230,7 +315,7 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate4_sup(SampleVector::iter
|
||||
// Inf (LSB):
|
||||
// x y x y x y x y / x -> 0,-3,-4,7 / y -> 1,2,-5,-6
|
||||
// [ rotate: 0, 1, -3, 2, -4, -5, 7, -6]
|
||||
qint32 xreal, yimag;
|
||||
AccuType xreal, yimag;
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -244,10 +329,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate4_sup(SampleVector::iter
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate8_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[2], yimag[2];
|
||||
AccuType xreal[2], yimag[2];
|
||||
|
||||
for (int pos = 0; pos < len - 15; pos += 8)
|
||||
{
|
||||
@ -267,10 +352,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate8_inf(SampleVector::iter
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate8_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[2], yimag[2];
|
||||
AccuType xreal[2], yimag[2];
|
||||
|
||||
for (int pos = 0; pos < len - 15; pos += 8)
|
||||
{
|
||||
@ -290,12 +375,12 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate8_sup(SampleVector::iter
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate16_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
// Offset tuning: 4x downsample and rotate, then
|
||||
// downsample 4x more. [ rotate: 0, 1, -3, 2, -4, -5, 7, -6]
|
||||
qint32 xreal[4], yimag[4];
|
||||
AccuType xreal[4], yimag[4];
|
||||
|
||||
for (int pos = 0; pos < len - 31; )
|
||||
{
|
||||
@ -318,12 +403,12 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate16_inf(SampleVector::ite
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate16_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
// Offset tuning: 4x downsample and rotate, then
|
||||
// downsample 4x more. [ rotate: 1, 0, -2, 3, -5, -4, 6, -7]
|
||||
qint32 xreal[4], yimag[4];
|
||||
AccuType xreal[4], yimag[4];
|
||||
|
||||
for (int pos = 0; pos < len - 31; )
|
||||
{
|
||||
@ -346,10 +431,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate16_sup(SampleVector::ite
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate32_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[8], yimag[8];
|
||||
AccuType xreal[8], yimag[8];
|
||||
|
||||
for (int pos = 0; pos < len - 63; )
|
||||
{
|
||||
@ -377,10 +462,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate32_inf(SampleVector::ite
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate32_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[8], yimag[8];
|
||||
AccuType xreal[8], yimag[8];
|
||||
|
||||
for (int pos = 0; pos < len - 63; )
|
||||
{
|
||||
@ -408,10 +493,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate32_sup(SampleVector::ite
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate64_inf(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[16], yimag[16];
|
||||
AccuType xreal[16], yimag[16];
|
||||
|
||||
for (int pos = 0; pos < len - 127; )
|
||||
{
|
||||
@ -448,10 +533,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate64_inf(SampleVector::ite
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate64_sup(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 xreal[16], yimag[16];
|
||||
AccuType xreal[16], yimag[16];
|
||||
|
||||
for (int pos = 0; pos < len - 127; )
|
||||
{
|
||||
@ -488,10 +573,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate64_sup(SampleVector::ite
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate2_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[2];
|
||||
AccuType intbuf[2];
|
||||
|
||||
for (int pos = 0; pos < len - 3; pos += 4)
|
||||
{
|
||||
@ -510,10 +595,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate2_cen(SampleVector::iter
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate4_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[4];
|
||||
AccuType intbuf[4];
|
||||
|
||||
for (int pos = 0; pos < len - 7; pos += 8)
|
||||
{
|
||||
@ -545,10 +630,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate4_cen(SampleVector::iter
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate8_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[8];
|
||||
AccuType intbuf[8];
|
||||
|
||||
for (int pos = 0; pos < len - 15; pos += 16)
|
||||
{
|
||||
@ -605,10 +690,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate8_cen(SampleVector::iter
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate16_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[16];
|
||||
AccuType intbuf[16];
|
||||
|
||||
for (int pos = 0; pos < len - 31; pos += 32)
|
||||
{
|
||||
@ -714,10 +799,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate16_cen(SampleVector::ite
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate32_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[32];
|
||||
AccuType intbuf[32];
|
||||
|
||||
for (int pos = 0; pos < len - 63; pos += 64)
|
||||
{
|
||||
@ -920,10 +1005,10 @@ void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate32_cen(SampleVector::ite
|
||||
}
|
||||
}
|
||||
|
||||
template<typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<T, SdrBits, InputBits, Shift>::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
template<typename AccuType, typename T, uint SdrBits, uint InputBits, int Shift>
|
||||
void DecimatorsU<AccuType, T, SdrBits, InputBits, Shift>::decimate64_cen(SampleVector::iterator* it, const T* buf, qint32 len)
|
||||
{
|
||||
qint32 intbuf[64];
|
||||
AccuType intbuf[64];
|
||||
|
||||
for (int pos = 0; pos < len - 127; pos += 128)
|
||||
{
|
||||
|
@ -192,6 +192,28 @@ void DownChannelizer::applyConfiguration()
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
DownChannelizer::FilterStage::FilterStage(Mode mode) :
|
||||
m_filter(new IntHalfbandFilterDB<qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>),
|
||||
m_workFunction(0),
|
||||
m_mode(mode),
|
||||
m_sse(false)
|
||||
{
|
||||
switch(mode) {
|
||||
case ModeCenter:
|
||||
m_workFunction = &IntHalfbandFilterDB<qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateCenter;
|
||||
break;
|
||||
|
||||
case ModeLowerHalf:
|
||||
m_workFunction = &IntHalfbandFilterDB<qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateLowerHalf;
|
||||
break;
|
||||
|
||||
case ModeUpperHalf:
|
||||
m_workFunction = &IntHalfbandFilterDB<qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateUpperHalf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#else
|
||||
#ifdef USE_SSE4_1
|
||||
DownChannelizer::FilterStage::FilterStage(Mode mode) :
|
||||
m_filter(new IntHalfbandFilterEO1<DOWNCHANNELIZER_HB_FILTER_ORDER>),
|
||||
@ -215,27 +237,27 @@ DownChannelizer::FilterStage::FilterStage(Mode mode) :
|
||||
}
|
||||
#else
|
||||
DownChannelizer::FilterStage::FilterStage(Mode mode) :
|
||||
m_filter(new IntHalfbandFilterDB<DOWNCHANNELIZER_HB_FILTER_ORDER>),
|
||||
m_filter(new IntHalfbandFilterDB<qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>),
|
||||
m_workFunction(0),
|
||||
m_mode(mode),
|
||||
m_sse(false)
|
||||
{
|
||||
switch(mode) {
|
||||
case ModeCenter:
|
||||
m_workFunction = &IntHalfbandFilterDB<DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateCenter;
|
||||
m_workFunction = &IntHalfbandFilterDB<qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateCenter;
|
||||
break;
|
||||
|
||||
case ModeLowerHalf:
|
||||
m_workFunction = &IntHalfbandFilterDB<DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateLowerHalf;
|
||||
m_workFunction = &IntHalfbandFilterDB<qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateLowerHalf;
|
||||
break;
|
||||
|
||||
case ModeUpperHalf:
|
||||
m_workFunction = &IntHalfbandFilterDB<DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateUpperHalf;
|
||||
m_workFunction = &IntHalfbandFilterDB<qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>::workDecimateUpperHalf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
DownChannelizer::FilterStage::~FilterStage()
|
||||
{
|
||||
delete m_filter;
|
||||
|
@ -23,11 +23,15 @@
|
||||
#include <QMutex>
|
||||
#include "util/export.h"
|
||||
#include "util/message.h"
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
#include "dsp/inthalfbandfilterdb.h"
|
||||
#else
|
||||
#ifdef USE_SSE4_1
|
||||
#include "dsp/inthalfbandfiltereo1.h"
|
||||
#else
|
||||
#include "dsp/inthalfbandfilterdb.h"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DOWNCHANNELIZER_HB_FILTER_ORDER 48
|
||||
|
||||
@ -78,12 +82,17 @@ protected:
|
||||
ModeUpperHalf
|
||||
};
|
||||
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
typedef bool (IntHalfbandFilterDB<qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>::*WorkFunction)(Sample* s);
|
||||
IntHalfbandFilterDB<qint64, DOWNCHANNELIZER_HB_FILTER_ORDER>* m_filter;
|
||||
#else
|
||||
#ifdef USE_SSE4_1
|
||||
typedef bool (IntHalfbandFilterEO1<DOWNCHANNELIZER_HB_FILTER_ORDER>::*WorkFunction)(Sample* s);
|
||||
IntHalfbandFilterEO1<DOWNCHANNELIZER_HB_FILTER_ORDER>* m_filter;
|
||||
#else
|
||||
typedef bool (IntHalfbandFilterDB<DOWNCHANNELIZER_HB_FILTER_ORDER>::*WorkFunction)(Sample* s);
|
||||
IntHalfbandFilterDB<DOWNCHANNELIZER_HB_FILTER_ORDER>* m_filter;
|
||||
typedef bool (IntHalfbandFilterDB<qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>::*WorkFunction)(Sample* s);
|
||||
IntHalfbandFilterDB<qint32, DOWNCHANNELIZER_HB_FILTER_ORDER>* m_filter;
|
||||
#endif
|
||||
#endif
|
||||
WorkFunction m_workFunction;
|
||||
Mode m_mode;
|
||||
|
@ -178,7 +178,7 @@ void DSPDeviceSourceEngine::dcOffset(SampleVector::iterator begin, SampleVector:
|
||||
double count;
|
||||
int io = 0;
|
||||
int qo = 0;
|
||||
Sample corr((qint16)m_iOffset, (qint16)m_qOffset);
|
||||
Sample corr((FixReal)m_iOffset, (FixReal)m_qOffset);
|
||||
|
||||
// sum and correct in one pass
|
||||
for(SampleVector::iterator it = begin; it < end; it++)
|
||||
@ -232,14 +232,14 @@ void DSPDeviceSourceEngine::imbalance(SampleVector::iterator begin, SampleVector
|
||||
m_iRange = (m_iRange * 15 + (iMax - iMin)) >> 4;
|
||||
m_qRange = (m_qRange * 15 + (qMax - qMin)) >> 4;
|
||||
|
||||
// calculate imbalance as Q15.16
|
||||
// calculate imbalance on 32 bit full scale
|
||||
if(m_qRange != 0) {
|
||||
m_imbalance = ((uint)m_iRange << 16) / (uint)m_qRange;
|
||||
m_imbalance = ((uint)m_iRange << (32-SDR_RX_SAMP_SZ)) / (uint)m_qRange;
|
||||
}
|
||||
|
||||
// correct imbalance and convert back to signed int 16
|
||||
// correct imbalance and convert back to sample size
|
||||
for(SampleVector::iterator it = begin; it < end; it++) {
|
||||
it->m_imag = (it->m_imag * m_imbalance) >> 16;
|
||||
it->m_imag = (it->m_imag * m_imbalance) >> (32-SDR_RX_SAMP_SZ);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,13 +22,25 @@
|
||||
#include <vector>
|
||||
#include <QtGlobal>
|
||||
|
||||
#define SDR_SAMP_SZ 16 // internal fixed arithmetic sample size
|
||||
#ifdef SDR_RX_SAMPLE_24BIT
|
||||
#define SDR_RX_SAMP_SZ 24 // internal fixed arithmetic sample size
|
||||
#define SDR_RX_SCALEF 8388608.0f
|
||||
#define SDR_RX_SCALED 8388608.0
|
||||
typedef qint32 FixReal;
|
||||
#else
|
||||
#define SDR_RX_SAMP_SZ 16 // internal fixed arithmetic sample size
|
||||
#define SDR_RX_SCALEF 32768.0f
|
||||
#define SDR_RX_SCALED 32768.0
|
||||
typedef qint16 FixReal;
|
||||
#endif
|
||||
|
||||
#define SDR_TX_SAMP_SZ 16
|
||||
#define SDR_TX_SCALEF 32768.0f
|
||||
#define SDR_TX_SCALED 32768.0
|
||||
|
||||
typedef float Real;
|
||||
typedef std::complex<Real> Complex;
|
||||
|
||||
typedef qint16 FixReal;
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct Sample
|
||||
{
|
||||
|
@ -122,15 +122,21 @@ void FileRecord::handleConfigure(const std::string& fileName)
|
||||
|
||||
void FileRecord::writeHeader()
|
||||
{
|
||||
m_sampleFile.write((const char *) &m_sampleRate, sizeof(int));
|
||||
m_sampleFile.write((const char *) &m_centerFrequency, sizeof(quint64));
|
||||
m_sampleFile.write((const char *) &m_sampleRate, sizeof(qint32)); // 4 bytes
|
||||
m_sampleFile.write((const char *) &m_centerFrequency, sizeof(quint64)); // 8 bytes
|
||||
std::time_t ts = time(0);
|
||||
m_sampleFile.write((const char *) &ts, sizeof(std::time_t));
|
||||
m_sampleFile.write((const char *) &ts, sizeof(std::time_t)); // 8 bytes
|
||||
quint32 sampleSize = SDR_RX_SAMP_SZ;
|
||||
m_sampleFile.write((const char *) &sampleSize, sizeof(int)); // 4 bytes
|
||||
}
|
||||
|
||||
void FileRecord::readHeader(std::ifstream& sampleFile, Header& header)
|
||||
{
|
||||
sampleFile.read((char *) &(header.sampleRate), sizeof(int));
|
||||
sampleFile.read((char *) &(header.sampleRate), sizeof(qint32));
|
||||
sampleFile.read((char *) &(header.centerFrequency), sizeof(quint64));
|
||||
sampleFile.read((char *) &(header.startTimeStamp), sizeof(std::time_t));
|
||||
sampleFile.read((char *) &(header.sampleSize), sizeof(quint32));
|
||||
if ((header.sampleSize != 16) && (header.sampleSize != 24)) { // assume 16 bits if garbage (old I/Q file)
|
||||
header.sampleSize = 16;
|
||||
}
|
||||
}
|
||||
|
@ -16,9 +16,10 @@ public:
|
||||
|
||||
struct Header
|
||||
{
|
||||
int sampleRate;
|
||||
qint32 sampleRate;
|
||||
quint64 centerFrequency;
|
||||
std::time_t startTimeStamp;
|
||||
quint32 sampleSize;
|
||||
};
|
||||
|
||||
FileRecord();
|
||||
@ -39,7 +40,7 @@ public:
|
||||
|
||||
private:
|
||||
std::string m_fileName;
|
||||
int m_sampleRate;
|
||||
qint32 m_sampleRate;
|
||||
quint64 m_centerFrequency;
|
||||
bool m_recordOn;
|
||||
bool m_recordStart;
|
||||
|
@ -122,12 +122,12 @@ private:
|
||||
IntHalfbandFilterEO1<INTERPOLATORS_HB_FILTER_ORDER_NEXT> m_interpolator32; // 5th stages
|
||||
IntHalfbandFilterEO1<INTERPOLATORS_HB_FILTER_ORDER_NEXT> m_interpolator64; // 6th stages
|
||||
#else
|
||||
IntHalfbandFilterDB<INTERPOLATORS_HB_FILTER_ORDER_FIRST> m_interpolator2; // 1st stages
|
||||
IntHalfbandFilterDB<INTERPOLATORS_HB_FILTER_ORDER_SECOND> m_interpolator4; // 2nd stages
|
||||
IntHalfbandFilterDB<INTERPOLATORS_HB_FILTER_ORDER_NEXT> m_interpolator8; // 3rd stages
|
||||
IntHalfbandFilterDB<INTERPOLATORS_HB_FILTER_ORDER_NEXT> m_interpolator16; // 4th stages
|
||||
IntHalfbandFilterDB<INTERPOLATORS_HB_FILTER_ORDER_NEXT> m_interpolator32; // 5th stages
|
||||
IntHalfbandFilterDB<INTERPOLATORS_HB_FILTER_ORDER_NEXT> m_interpolator64; // 6th stages
|
||||
IntHalfbandFilterDB<qint32, INTERPOLATORS_HB_FILTER_ORDER_FIRST> m_interpolator2; // 1st stages
|
||||
IntHalfbandFilterDB<qint32, INTERPOLATORS_HB_FILTER_ORDER_SECOND> m_interpolator4; // 2nd stages
|
||||
IntHalfbandFilterDB<qint32, INTERPOLATORS_HB_FILTER_ORDER_NEXT> m_interpolator8; // 3rd stages
|
||||
IntHalfbandFilterDB<qint32, INTERPOLATORS_HB_FILTER_ORDER_NEXT> m_interpolator16; // 4th stages
|
||||
IntHalfbandFilterDB<qint32, INTERPOLATORS_HB_FILTER_ORDER_NEXT> m_interpolator32; // 5th stages
|
||||
IntHalfbandFilterDB<qint32, INTERPOLATORS_HB_FILTER_ORDER_NEXT> m_interpolator64; // 6th stages
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -23,7 +23,7 @@
|
||||
#include "dsp/hbfiltertraits.h"
|
||||
#include "util/export.h"
|
||||
|
||||
template<uint32_t HBFilterOrder>
|
||||
template<typename AccuType, uint32_t HBFilterOrder>
|
||||
class SDRANGEL_API IntHalfbandFilter {
|
||||
public:
|
||||
IntHalfbandFilter() :
|
||||
@ -146,38 +146,38 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool workDecimateCenter(qint32 *x, qint32 *y)
|
||||
{
|
||||
// insert sample into ring-buffer
|
||||
m_samples[m_ptr][0] = *x;
|
||||
m_samples[m_ptr][1] = *y;
|
||||
|
||||
switch(m_state)
|
||||
{
|
||||
case 0:
|
||||
// advance write-pointer
|
||||
m_ptr = (m_ptr + HBFIRFilterTraits<HBFilterOrder>::hbOrder) % (HBFIRFilterTraits<HBFilterOrder>::hbOrder + 1);
|
||||
|
||||
// next state
|
||||
m_state = 1;
|
||||
|
||||
// tell caller we don't have a new sample
|
||||
return false;
|
||||
|
||||
default:
|
||||
// save result
|
||||
doFIR(x, y);
|
||||
|
||||
// advance write-pointer
|
||||
m_ptr = (m_ptr + HBFIRFilterTraits<HBFilterOrder>::hbOrder) % (HBFIRFilterTraits<HBFilterOrder>::hbOrder + 1);
|
||||
|
||||
// next state
|
||||
m_state = 0;
|
||||
|
||||
// tell caller we have a new sample
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// bool workDecimateCenter(qint32 *x, qint32 *y)
|
||||
// {
|
||||
// // insert sample into ring-buffer
|
||||
// m_samples[m_ptr][0] = *x;
|
||||
// m_samples[m_ptr][1] = *y;
|
||||
//
|
||||
// switch(m_state)
|
||||
// {
|
||||
// case 0:
|
||||
// // advance write-pointer
|
||||
// m_ptr = (m_ptr + HBFIRFilterTraits<HBFilterOrder>::hbOrder) % (HBFIRFilterTraits<HBFilterOrder>::hbOrder + 1);
|
||||
//
|
||||
// // next state
|
||||
// m_state = 1;
|
||||
//
|
||||
// // tell caller we don't have a new sample
|
||||
// return false;
|
||||
//
|
||||
// default:
|
||||
// // save result
|
||||
// doFIR(x, y);
|
||||
//
|
||||
// // advance write-pointer
|
||||
// m_ptr = (m_ptr + HBFIRFilterTraits<HBFilterOrder>::hbOrder) % (HBFIRFilterTraits<HBFilterOrder>::hbOrder + 1);
|
||||
//
|
||||
// // next state
|
||||
// m_state = 0;
|
||||
//
|
||||
// // tell caller we have a new sample
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// downsample by 2, return edges of spectrum rotated into center - unused
|
||||
// bool workDecimateFullRotate(Sample* sample)
|
||||
@ -748,7 +748,7 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
qint32 m_samples[HBFIRFilterTraits<HBFilterOrder>::hbOrder + 1][2]; // Valgrind optim (from qint16)
|
||||
AccuType m_samples[HBFIRFilterTraits<HBFilterOrder>::hbOrder + 1][2]; // Valgrind optim (from qint16)
|
||||
qint16 m_ptr;
|
||||
int m_state;
|
||||
|
||||
@ -759,8 +759,8 @@ protected:
|
||||
int b = HBFIRFilterTraits<HBFilterOrder>::hbMod[m_ptr + 2 - 2]; //-1 - 1
|
||||
|
||||
// go through samples in buffer
|
||||
qint32 iAcc = 0;
|
||||
qint32 qAcc = 0;
|
||||
AccuType iAcc = 0;
|
||||
AccuType qAcc = 0;
|
||||
|
||||
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
|
||||
{
|
||||
@ -790,8 +790,8 @@ protected:
|
||||
qint16 b = m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder / 2) - 1;
|
||||
|
||||
// go through samples in buffer
|
||||
qint32 iAcc = 0;
|
||||
qint32 qAcc = 0;
|
||||
AccuType iAcc = 0;
|
||||
AccuType qAcc = 0;
|
||||
|
||||
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
|
||||
{
|
||||
@ -811,8 +811,8 @@ protected:
|
||||
qint16 b = m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder / 2) - 1;
|
||||
|
||||
// go through samples in buffer
|
||||
qint32 iAcc = 0;
|
||||
qint32 qAcc = 0;
|
||||
AccuType iAcc = 0;
|
||||
AccuType qAcc = 0;
|
||||
|
||||
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
|
||||
{
|
||||
@ -839,8 +839,8 @@ protected:
|
||||
int b = HBFIRFilterTraits<HBFilterOrder>::hbMod[m_ptr + 2 - 2]; //-1 - 1
|
||||
|
||||
// go through samples in buffer
|
||||
qint32 iAcc = 0;
|
||||
qint32 qAcc = 0;
|
||||
AccuType iAcc = 0;
|
||||
AccuType qAcc = 0;
|
||||
|
||||
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
|
||||
{
|
||||
|
@ -26,7 +26,7 @@
|
||||
#include "dsp/hbfiltertraits.h"
|
||||
#include "util/export.h"
|
||||
|
||||
template<uint32_t HBFilterOrder>
|
||||
template<typename AccuType, uint32_t HBFilterOrder>
|
||||
class SDRANGEL_API IntHalfbandFilterDB {
|
||||
public:
|
||||
IntHalfbandFilterDB();
|
||||
@ -35,7 +35,7 @@ public:
|
||||
bool workDecimateCenter(Sample* sample)
|
||||
{
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) sample->real(), (FixReal) sample->imag());
|
||||
storeSampleFixReal((FixReal) sample->real(), (FixReal) sample->imag());
|
||||
|
||||
switch(m_state)
|
||||
{
|
||||
@ -67,7 +67,7 @@ public:
|
||||
{
|
||||
case 0:
|
||||
// insert sample into ring-buffer
|
||||
storeSample(0, 0);
|
||||
storeSampleFixReal((FixReal) 0, (FixReal) 0);
|
||||
// save result
|
||||
doFIR(SampleOut);
|
||||
// advance write-pointer
|
||||
@ -79,7 +79,7 @@ public:
|
||||
|
||||
default:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
|
||||
storeSampleFixReal((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
|
||||
// save result
|
||||
doFIR(SampleOut);
|
||||
// advance write-pointer
|
||||
@ -125,32 +125,32 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
bool workDecimateCenter(qint32 *x, qint32 *y)
|
||||
{
|
||||
// insert sample into ring-buffer
|
||||
storeSample(*x, *y);
|
||||
|
||||
switch(m_state)
|
||||
{
|
||||
case 0:
|
||||
// advance write-pointer
|
||||
advancePointer();
|
||||
// next state
|
||||
m_state = 1;
|
||||
// tell caller we don't have a new sample
|
||||
return false;
|
||||
|
||||
default:
|
||||
// save result
|
||||
doFIR(x, y);
|
||||
// advance write-pointer
|
||||
advancePointer();
|
||||
// next state
|
||||
m_state = 0;
|
||||
// tell caller we have a new sample
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// bool workDecimateCenter(qint32 *x, qint32 *y)
|
||||
// {
|
||||
// // insert sample into ring-buffer
|
||||
// storeSample32(*x, *y);
|
||||
//
|
||||
// switch (m_state)
|
||||
// {
|
||||
// case 0:
|
||||
// // advance write-pointer
|
||||
// advancePointer();
|
||||
// // next state
|
||||
// m_state = 1;
|
||||
// // tell caller we don't have a new sample
|
||||
// return false;
|
||||
//
|
||||
// default:
|
||||
// // save result
|
||||
// doFIR(x, y);
|
||||
// // advance write-pointer
|
||||
// advancePointer();
|
||||
// // next state
|
||||
// m_state = 0;
|
||||
// // tell caller we have a new sample
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// downsample by 2, return lower half of original spectrum
|
||||
bool workDecimateLowerHalf(Sample* sample)
|
||||
@ -159,7 +159,7 @@ public:
|
||||
{
|
||||
case 0:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) -sample->imag(), (FixReal) sample->real());
|
||||
storeSampleFixReal((FixReal) -sample->imag(), (FixReal) sample->real());
|
||||
// advance write-pointer
|
||||
advancePointer();
|
||||
// next state
|
||||
@ -169,7 +169,7 @@ public:
|
||||
|
||||
case 1:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) -sample->real(), (FixReal) -sample->imag());
|
||||
storeSampleFixReal((FixReal) -sample->real(), (FixReal) -sample->imag());
|
||||
// save result
|
||||
doFIR(sample);
|
||||
// advance write-pointer
|
||||
@ -181,7 +181,7 @@ public:
|
||||
|
||||
case 2:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) sample->imag(), (FixReal) -sample->real());
|
||||
storeSampleFixReal((FixReal) sample->imag(), (FixReal) -sample->real());
|
||||
// advance write-pointer
|
||||
advancePointer();
|
||||
// next state
|
||||
@ -191,7 +191,7 @@ public:
|
||||
|
||||
default:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) sample->real(), (FixReal) sample->imag());
|
||||
storeSampleFixReal((FixReal) sample->real(), (FixReal) sample->imag());
|
||||
// save result
|
||||
doFIR(sample);
|
||||
// advance write-pointer
|
||||
@ -279,7 +279,7 @@ public:
|
||||
{
|
||||
case 0:
|
||||
// insert sample into ring-buffer
|
||||
storeSample(0, 0);
|
||||
storeSampleFixReal((FixReal) 0, (FixReal) 0);
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -297,7 +297,7 @@ public:
|
||||
|
||||
case 1:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
|
||||
storeSampleFixReal((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -315,7 +315,7 @@ public:
|
||||
|
||||
case 2:
|
||||
// insert sample into ring-buffer
|
||||
storeSample(0, 0);
|
||||
storeSampleFixReal((FixReal) 0, (FixReal) 0);
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -333,7 +333,7 @@ public:
|
||||
|
||||
default:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
|
||||
storeSampleFixReal((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -358,7 +358,7 @@ public:
|
||||
{
|
||||
case 0:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) sample->imag(), (FixReal) -sample->real());
|
||||
storeSampleFixReal((FixReal) sample->imag(), (FixReal) -sample->real());
|
||||
// advance write-pointer
|
||||
advancePointer();
|
||||
// next state
|
||||
@ -368,7 +368,7 @@ public:
|
||||
|
||||
case 1:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) -sample->real(), (FixReal) -sample->imag());
|
||||
storeSampleFixReal((FixReal) -sample->real(), (FixReal) -sample->imag());
|
||||
// save result
|
||||
doFIR(sample);
|
||||
// advance write-pointer
|
||||
@ -380,7 +380,7 @@ public:
|
||||
|
||||
case 2:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) -sample->imag(), (FixReal) sample->real());
|
||||
storeSampleFixReal((FixReal) -sample->imag(), (FixReal) sample->real());
|
||||
// advance write-pointer
|
||||
advancePointer();
|
||||
// next state
|
||||
@ -390,7 +390,7 @@ public:
|
||||
|
||||
default:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) sample->real(), (FixReal) sample->imag());
|
||||
storeSampleFixReal((FixReal) sample->real(), (FixReal) sample->imag());
|
||||
// save result
|
||||
doFIR(sample);
|
||||
// advance write-pointer
|
||||
@ -478,7 +478,7 @@ public:
|
||||
{
|
||||
case 0:
|
||||
// insert sample into ring-buffer
|
||||
storeSample(0, 0);
|
||||
storeSampleFixReal((FixReal) 0, (FixReal) 0);
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -496,7 +496,7 @@ public:
|
||||
|
||||
case 1:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
|
||||
storeSampleFixReal((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -514,7 +514,7 @@ public:
|
||||
|
||||
case 2:
|
||||
// insert sample into ring-buffer
|
||||
storeSample(0, 0);
|
||||
storeSampleFixReal((FixReal) 0, (FixReal) 0);
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -532,7 +532,7 @@ public:
|
||||
|
||||
default:
|
||||
// insert sample into ring-buffer
|
||||
storeSample((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
|
||||
storeSampleFixReal((FixReal) sampleIn->real(), (FixReal) sampleIn->imag());
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -552,47 +552,47 @@ public:
|
||||
|
||||
void myDecimate(const Sample* sample1, Sample* sample2)
|
||||
{
|
||||
storeSample((FixReal) sample1->real(), (FixReal) sample1->imag());
|
||||
storeSampleFixReal((FixReal) sample1->real(), (FixReal) sample1->imag());
|
||||
advancePointer();
|
||||
|
||||
storeSample((FixReal) sample2->real(), (FixReal) sample2->imag());
|
||||
storeSampleFixReal((FixReal) sample2->real(), (FixReal) sample2->imag());
|
||||
doFIR(sample2);
|
||||
advancePointer();
|
||||
}
|
||||
|
||||
void myDecimate(qint32 x1, qint32 y1, qint32 *x2, qint32 *y2)
|
||||
void myDecimate(AccuType x1, AccuType y1, AccuType *x2, AccuType *y2)
|
||||
{
|
||||
storeSample(x1, y1);
|
||||
storeSampleAccu(x1, y1);
|
||||
advancePointer();
|
||||
|
||||
storeSample(*x2, *y2);
|
||||
doFIR(x2, y2);
|
||||
storeSampleAccu(*x2, *y2);
|
||||
doFIRAccu(x2, y2);
|
||||
advancePointer();
|
||||
}
|
||||
|
||||
/** Simple zero stuffing and filter */
|
||||
void myInterpolateZeroStuffing(Sample* sample1, Sample* sample2)
|
||||
{
|
||||
storeSample((FixReal) sample1->real(), (FixReal) sample1->imag());
|
||||
storeSampleFixReal((FixReal) sample1->real(), (FixReal) sample1->imag());
|
||||
doFIR(sample1);
|
||||
advancePointer();
|
||||
|
||||
storeSample(0, 0);
|
||||
storeSampleFixReal((FixReal) 0, (FixReal) 0);
|
||||
doFIR(sample2);
|
||||
advancePointer();
|
||||
}
|
||||
|
||||
/** Simple zero stuffing and filter */
|
||||
void myInterpolateZeroStuffing(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2)
|
||||
{
|
||||
storeSample(*x1, *y1);
|
||||
doFIR(x1, y1);
|
||||
advancePointer();
|
||||
|
||||
storeSample(0, 0);
|
||||
doFIR(x2, y2);
|
||||
advancePointer();
|
||||
}
|
||||
// void myInterpolateZeroStuffing(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2)
|
||||
// {
|
||||
// storeSampleAccu(*x1, *y1);
|
||||
// doFIR(x1, y1);
|
||||
// advancePointer();
|
||||
//
|
||||
// storeSampleAccu(0, 0);
|
||||
// doFIR(x2, y2);
|
||||
// advancePointer();
|
||||
// }
|
||||
|
||||
/** Optimized upsampler by 2 not calculating FIR with inserted null samples */
|
||||
void myInterpolate(qint32 *x1, qint32 *y1, qint32 *x2, qint32 *y2)
|
||||
@ -619,12 +619,12 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
qint32 m_samplesDB[2*(HBFIRFilterTraits<HBFilterOrder>::hbOrder - 1)][2]; // double buffer technique
|
||||
AccuType m_samplesDB[2*(HBFIRFilterTraits<HBFilterOrder>::hbOrder - 1)][2]; // double buffer technique
|
||||
int m_ptr;
|
||||
int m_size;
|
||||
int m_state;
|
||||
|
||||
void storeSample(const FixReal& sampleI, const FixReal& sampleQ)
|
||||
void storeSampleFixReal(const FixReal& sampleI, const FixReal& sampleQ)
|
||||
{
|
||||
m_samplesDB[m_ptr][0] = sampleI;
|
||||
m_samplesDB[m_ptr][1] = sampleQ;
|
||||
@ -632,7 +632,7 @@ protected:
|
||||
m_samplesDB[m_ptr + m_size][1] = sampleQ;
|
||||
}
|
||||
|
||||
void storeSample(qint32 x, qint32 y)
|
||||
void storeSampleAccu(AccuType x, AccuType y)
|
||||
{
|
||||
m_samplesDB[m_ptr][0] = x;
|
||||
m_samplesDB[m_ptr][1] = y;
|
||||
@ -649,8 +649,8 @@ protected:
|
||||
{
|
||||
int a = m_ptr + m_size; // tip pointer
|
||||
int b = m_ptr + 1; // tail pointer
|
||||
qint32 iAcc = 0;
|
||||
qint32 qAcc = 0;
|
||||
AccuType iAcc = 0;
|
||||
AccuType qAcc = 0;
|
||||
|
||||
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
|
||||
{
|
||||
@ -660,8 +660,8 @@ protected:
|
||||
b += 2;
|
||||
}
|
||||
|
||||
iAcc += ((qint32)m_samplesDB[b-1][0]) << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
|
||||
qAcc += ((qint32)m_samplesDB[b-1][1]) << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
|
||||
iAcc += m_samplesDB[b-1][0] << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
|
||||
qAcc += m_samplesDB[b-1][1] << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
|
||||
|
||||
sample->setReal(iAcc >> (HBFIRFilterTraits<HBFilterOrder>::hbShift -1));
|
||||
sample->setImag(qAcc >> (HBFIRFilterTraits<HBFilterOrder>::hbShift -1));
|
||||
@ -671,8 +671,8 @@ protected:
|
||||
{
|
||||
int a = m_ptr + m_size; // tip pointer
|
||||
int b = m_ptr + 1; // tail pointer
|
||||
qint32 iAcc = 0;
|
||||
qint32 qAcc = 0;
|
||||
AccuType iAcc = 0;
|
||||
AccuType qAcc = 0;
|
||||
|
||||
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
|
||||
{
|
||||
@ -682,8 +682,30 @@ protected:
|
||||
b += 2;
|
||||
}
|
||||
|
||||
iAcc += ((qint32)m_samplesDB[b-1][0]) << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
|
||||
qAcc += ((qint32)m_samplesDB[b-1][1]) << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
|
||||
iAcc += m_samplesDB[b-1][0] << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
|
||||
qAcc += m_samplesDB[b-1][1] << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
|
||||
|
||||
*x = iAcc >> (HBFIRFilterTraits<HBFilterOrder>::hbShift -1); // HB_SHIFT incorrect do not loose the gained bit
|
||||
*y = qAcc >> (HBFIRFilterTraits<HBFilterOrder>::hbShift -1);
|
||||
}
|
||||
|
||||
void doFIRAccu(AccuType *x, AccuType *y)
|
||||
{
|
||||
int a = m_ptr + m_size; // tip pointer
|
||||
int b = m_ptr + 1; // tail pointer
|
||||
AccuType iAcc = 0;
|
||||
AccuType qAcc = 0;
|
||||
|
||||
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
|
||||
{
|
||||
iAcc += (m_samplesDB[a][0] + m_samplesDB[b][0]) * HBFIRFilterTraits<HBFilterOrder>::hbCoeffs[i];
|
||||
qAcc += (m_samplesDB[a][1] + m_samplesDB[b][1]) * HBFIRFilterTraits<HBFilterOrder>::hbCoeffs[i];
|
||||
a -= 2;
|
||||
b += 2;
|
||||
}
|
||||
|
||||
iAcc += m_samplesDB[b-1][0] << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
|
||||
qAcc += m_samplesDB[b-1][1] << (HBFIRFilterTraits<HBFilterOrder>::hbShift - 1);
|
||||
|
||||
*x = iAcc >> (HBFIRFilterTraits<HBFilterOrder>::hbShift -1); // HB_SHIFT incorrect do not loose the gained bit
|
||||
*y = qAcc >> (HBFIRFilterTraits<HBFilterOrder>::hbShift -1);
|
||||
@ -695,8 +717,8 @@ protected:
|
||||
qint16 b = m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder / 2) - 1;
|
||||
|
||||
// go through samples in buffer
|
||||
qint32 iAcc = 0;
|
||||
qint32 qAcc = 0;
|
||||
AccuType iAcc = 0;
|
||||
AccuType qAcc = 0;
|
||||
|
||||
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
|
||||
{
|
||||
@ -716,8 +738,8 @@ protected:
|
||||
qint16 b = m_ptr + (HBFIRFilterTraits<HBFilterOrder>::hbOrder / 2) - 1;
|
||||
|
||||
// go through samples in buffer
|
||||
qint32 iAcc = 0;
|
||||
qint32 qAcc = 0;
|
||||
AccuType iAcc = 0;
|
||||
AccuType qAcc = 0;
|
||||
|
||||
for (int i = 0; i < HBFIRFilterTraits<HBFilterOrder>::hbOrder / 4; i++)
|
||||
{
|
||||
@ -732,8 +754,8 @@ protected:
|
||||
}
|
||||
};
|
||||
|
||||
template<uint32_t HBFilterOrder>
|
||||
IntHalfbandFilterDB<HBFilterOrder>::IntHalfbandFilterDB()
|
||||
template<typename AccuType, uint32_t HBFilterOrder>
|
||||
IntHalfbandFilterDB<AccuType, HBFilterOrder>::IntHalfbandFilterDB()
|
||||
{
|
||||
m_size = HBFIRFilterTraits<HBFilterOrder>::hbOrder - 1;
|
||||
|
||||
|
@ -70,7 +70,7 @@ public:
|
||||
{
|
||||
case 0:
|
||||
// insert sample into ring-buffer
|
||||
storeSample(0, 0);
|
||||
storeSample((FixReal) 0, (FixReal) 0);
|
||||
// save result
|
||||
doFIR(SampleOut);
|
||||
// advance write-pointer
|
||||
@ -131,7 +131,7 @@ public:
|
||||
bool workDecimateCenter(int32_t *x, int32_t *y)
|
||||
{
|
||||
// insert sample into ring-buffer
|
||||
storeSample(*x, *y);
|
||||
storeSample32(*x, *y);
|
||||
|
||||
switch(m_state)
|
||||
{
|
||||
@ -215,7 +215,7 @@ public:
|
||||
{
|
||||
case 0:
|
||||
// insert sample into ring-buffer
|
||||
storeSample(0, 0);
|
||||
storeSample((FixReal) 0, (FixReal) 0);
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -251,7 +251,7 @@ public:
|
||||
|
||||
case 2:
|
||||
// insert sample into ring-buffer
|
||||
storeSample(0, 0);
|
||||
storeSample((FixReal) 0, (FixReal) 0);
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -414,7 +414,7 @@ public:
|
||||
{
|
||||
case 0:
|
||||
// insert sample into ring-buffer
|
||||
storeSample(0, 0);
|
||||
storeSample((FixReal) 0, (FixReal) 0);
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -450,7 +450,7 @@ public:
|
||||
|
||||
case 2:
|
||||
// insert sample into ring-buffer
|
||||
storeSample(0, 0);
|
||||
storeSample((FixReal) 0, (FixReal) 0);
|
||||
|
||||
// save result
|
||||
doFIR(&s);
|
||||
@ -565,10 +565,10 @@ public:
|
||||
|
||||
void myDecimate(int32_t x1, int32_t y1, int32_t *x2, int32_t *y2)
|
||||
{
|
||||
storeSample(x1, y1);
|
||||
storeSample32(x1, y1);
|
||||
advancePointer();
|
||||
|
||||
storeSample(*x2, *y2);
|
||||
storeSample32(*x2, *y2);
|
||||
doFIR(x2, y2);
|
||||
advancePointer();
|
||||
}
|
||||
@ -580,7 +580,7 @@ public:
|
||||
doFIR(sample1);
|
||||
advancePointer();
|
||||
|
||||
storeSample(0, 0);
|
||||
storeSample((FixReal) 0, (FixReal) 0);
|
||||
doFIR(sample2);
|
||||
advancePointer();
|
||||
}
|
||||
@ -588,11 +588,11 @@ public:
|
||||
/** Simple zero stuffing and filter */
|
||||
void myInterpolateZeroStuffing(int32_t *x1, int32_t *y1, int32_t *x2, int32_t *y2)
|
||||
{
|
||||
storeSample(*x1, *y1);
|
||||
storeSample32(*x1, *y1);
|
||||
doFIR(x1, y1);
|
||||
advancePointer();
|
||||
|
||||
storeSample(0, 0);
|
||||
storeSample32(0, 0);
|
||||
doFIR(x2, y2);
|
||||
advancePointer();
|
||||
}
|
||||
@ -648,7 +648,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
void storeSample(int32_t x, int32_t y)
|
||||
void storeSample32(int32_t x, int32_t y)
|
||||
{
|
||||
if ((m_ptr % 2) == 0)
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
|
||||
// written by Christian Daniel //
|
||||
// //
|
||||
// This program is free software; you can redistribute it and/or modify //
|
||||
@ -74,7 +74,7 @@ uint SampleSinkFifo::write(const quint8* data, uint count)
|
||||
uint remaining;
|
||||
uint len;
|
||||
const Sample* begin = (const Sample*)data;
|
||||
count /= 4;
|
||||
count /= sizeof(Sample);
|
||||
|
||||
total = MIN(count, m_size - m_fill);
|
||||
if(total < count) {
|
||||
|
@ -120,12 +120,12 @@ public:
|
||||
void decimate64_cen(SampleSinkFifoDoubleBuffered& fifo, const T* buf, qint32 len);
|
||||
|
||||
private:
|
||||
IntHalfbandFilter<32> m_decimator2; // 1st stages
|
||||
IntHalfbandFilter<32> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilter<32> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilter<32> m_decimator16; // 4th stages
|
||||
IntHalfbandFilter<32> m_decimator32; // 5th stages
|
||||
IntHalfbandFilter<32> m_decimator64; // 6th stages
|
||||
IntHalfbandFilter<qint32, 32> m_decimator2; // 1st stages
|
||||
IntHalfbandFilter<qint32, 32> m_decimator4; // 2nd stages
|
||||
IntHalfbandFilter<qint32, 32> m_decimator8; // 3rd stages
|
||||
IntHalfbandFilter<qint32, 32> m_decimator16; // 4th stages
|
||||
IntHalfbandFilter<qint32, 32> m_decimator32; // 5th stages
|
||||
IntHalfbandFilter<qint32, 32> m_decimator64; // 6th stages
|
||||
};
|
||||
|
||||
template<typename T, uint32_t SdrBits, uint32_t InputBits>
|
||||
|
@ -228,20 +228,20 @@ UpChannelizer::FilterStage::FilterStage(Mode mode) :
|
||||
}
|
||||
#else
|
||||
UpChannelizer::FilterStage::FilterStage(Mode mode) :
|
||||
m_filter(new IntHalfbandFilterDB<UPCHANNELIZER_HB_FILTER_ORDER>),
|
||||
m_filter(new IntHalfbandFilterDB<qint32, UPCHANNELIZER_HB_FILTER_ORDER>),
|
||||
m_workFunction(0)
|
||||
{
|
||||
switch(mode) {
|
||||
case ModeCenter:
|
||||
m_workFunction = &IntHalfbandFilterDB<UPCHANNELIZER_HB_FILTER_ORDER>::workInterpolateCenter;
|
||||
m_workFunction = &IntHalfbandFilterDB<qint32, UPCHANNELIZER_HB_FILTER_ORDER>::workInterpolateCenter;
|
||||
break;
|
||||
|
||||
case ModeLowerHalf:
|
||||
m_workFunction = &IntHalfbandFilterDB<UPCHANNELIZER_HB_FILTER_ORDER>::workInterpolateLowerHalf;
|
||||
m_workFunction = &IntHalfbandFilterDB<qint32, UPCHANNELIZER_HB_FILTER_ORDER>::workInterpolateLowerHalf;
|
||||
break;
|
||||
|
||||
case ModeUpperHalf:
|
||||
m_workFunction = &IntHalfbandFilterDB<UPCHANNELIZER_HB_FILTER_ORDER>::workInterpolateUpperHalf;
|
||||
m_workFunction = &IntHalfbandFilterDB<qint32, UPCHANNELIZER_HB_FILTER_ORDER>::workInterpolateUpperHalf;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -87,8 +87,8 @@ protected:
|
||||
typedef bool (IntHalfbandFilterEO1<UPCHANNELIZER_HB_FILTER_ORDER>::*WorkFunction)(Sample* sIn, Sample *sOut);
|
||||
IntHalfbandFilterEO1<UPCHANNELIZER_HB_FILTER_ORDER>* m_filter;
|
||||
#else
|
||||
typedef bool (IntHalfbandFilterDB<UPCHANNELIZER_HB_FILTER_ORDER>::*WorkFunction)(Sample* sIn, Sample *sOut);
|
||||
IntHalfbandFilterDB<UPCHANNELIZER_HB_FILTER_ORDER>* m_filter;
|
||||
typedef bool (IntHalfbandFilterDB<qint32, UPCHANNELIZER_HB_FILTER_ORDER>::*WorkFunction)(Sample* sIn, Sample *sOut);
|
||||
IntHalfbandFilterDB<qint32, UPCHANNELIZER_HB_FILTER_ORDER>* m_filter;
|
||||
#endif
|
||||
WorkFunction m_workFunction;
|
||||
|
||||
|
@ -1,5 +1,27 @@
|
||||
<RCC>
|
||||
<qresource prefix="/">
|
||||
<file>index.html</file>
|
||||
<file>webapi/doc/html2/index.html</file>
|
||||
<file>webapi/doc/swagger/swagger.yaml</file>
|
||||
<file>webapi/doc/swagger/include/CWKeyer.yaml</file>
|
||||
<file>webapi/doc/swagger/include/FileSource.yaml</file>
|
||||
<file>webapi/doc/swagger/include/HackRF.yaml</file>
|
||||
<file>webapi/doc/swagger/include/LimeSdr.yaml</file>
|
||||
<file>webapi/doc/swagger/include/NFMDemod.yaml</file>
|
||||
<file>webapi/doc/swagger/include/NFMMod.yaml</file>
|
||||
<file>webapi/doc/swagger/include/RtlSdr.yaml</file>
|
||||
<file>webapi/doc/swagger-ui/swagger-ui.js.map</file>
|
||||
<file>webapi/doc/swagger-ui/swagger-ui.js</file>
|
||||
<file>webapi/doc/swagger-ui/swagger-ui.css.map</file>
|
||||
<file>webapi/doc/swagger-ui/swagger-ui.css</file>
|
||||
<file>webapi/doc/swagger-ui/swagger-ui-standalone-preset.js.map</file>
|
||||
<file>webapi/doc/swagger-ui/swagger-ui-standalone-preset.js</file>
|
||||
<file>webapi/doc/swagger-ui/swagger-ui-bundle.js.map</file>
|
||||
<file>webapi/doc/swagger-ui/swagger-ui-bundle.js</file>
|
||||
<file>webapi/doc/swagger-ui/oauth2-redirect.html</file>
|
||||
<file>webapi/doc/swagger-ui/index.html</file>
|
||||
<file>webapi/doc/swagger-ui/favicon-32x32.png</file>
|
||||
<file>webapi/doc/swagger-ui/favicon-16x16.png</file>
|
||||
<file>webapi/index.html</file>
|
||||
<file>webapi/sdrangel_logo.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
</RCC>
|
||||
|
@ -1137,7 +1137,7 @@ margin-bottom: 20px;
|
||||
"description" : "Summarized information about logical devices from hardware devices attached to this SDRangel instance"
|
||||
};
|
||||
defs.InstanceSummaryResponse = {
|
||||
"required" : [ "appname", "devicesetlist", "qtVersion", "version" ],
|
||||
"required" : [ "appname", "devicesetlist", "dspRxBits", "dspTxBits", "pid", "qtVersion", "version" ],
|
||||
"properties" : {
|
||||
"version" : {
|
||||
"type" : "string",
|
||||
@ -1147,6 +1147,18 @@ margin-bottom: 20px;
|
||||
"type" : "string",
|
||||
"description" : "Qt version with which the software was compiled"
|
||||
},
|
||||
"dspRxBits" : {
|
||||
"type" : "integer",
|
||||
"description" : "Number of samples significant bits in software Rx DSP"
|
||||
},
|
||||
"dspTxBits" : {
|
||||
"type" : "integer",
|
||||
"description" : "Number of samples significant bits in software Tx DSP"
|
||||
},
|
||||
"pid" : {
|
||||
"type" : "integer",
|
||||
"description" : "PID of the SDRangel instance"
|
||||
},
|
||||
"appname" : {
|
||||
"type" : "string",
|
||||
"description" : "Application name: SDRangel for a GUI instance and SDRangelSrv for a server instance"
|
||||
@ -1847,7 +1859,7 @@ margin-bottom: 20px;
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetChannelDelete-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelDelete-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -2341,7 +2353,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetChannelPost-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost/sdrangel/deviceset/{deviceSetIndex}/channel"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelPost-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -2854,7 +2866,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetChannelSettingsGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelSettingsGet-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -3348,7 +3360,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetChannelSettingsPatch-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelSettingsPatch-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -3894,7 +3906,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetChannelSettingsPut-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost/sdrangel/deviceset/{deviceSetIndex}/channel/{channelIndex}/settings"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetChannelSettingsPut-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -4440,7 +4452,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetDevicePut-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost/sdrangel/deviceset/{deviceSetIndex}/device"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDevicePut-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -4953,7 +4965,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetDeviceRunDelete-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/run"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost/sdrangel/deviceset/{deviceSetIndex}/device/run"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceRunDelete-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -5414,7 +5426,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetDeviceRunGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/run"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/deviceset/{deviceSetIndex}/device/run"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceRunGet-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -5875,7 +5887,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetDeviceRunPost-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/run"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost/sdrangel/deviceset/{deviceSetIndex}/device/run"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceRunPost-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -6336,7 +6348,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetDeviceSettingsGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/deviceset/{deviceSetIndex}/device/settings"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceSettingsGet-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -6754,7 +6766,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetDeviceSettingsPatch-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost/sdrangel/deviceset/{deviceSetIndex}/device/settings"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceSettingsPatch-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -7224,7 +7236,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetDeviceSettingsPut-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/device/settings"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost/sdrangel/deviceset/{deviceSetIndex}/device/settings"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetDeviceSettingsPut-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -7694,7 +7706,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetFocusPatch-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}/focus"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost/sdrangel/deviceset/{deviceSetIndex}/focus"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetFocusPatch-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -8155,7 +8167,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-devicesetGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/deviceset/{deviceSetIndex}"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/deviceset/{deviceSetIndex}"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-devicesetGet-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -8573,7 +8585,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-instanceDeviceSetDelete-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost:8091/sdrangel/deviceset"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost/sdrangel/deviceset"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-instanceDeviceSetDelete-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -8951,7 +8963,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-DeviceSet-instanceDeviceSetPost-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost:8091/sdrangel/deviceset?tx="</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost/sdrangel/deviceset?tx="</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-DeviceSet-instanceDeviceSetPost-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -9327,7 +9339,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceAudioGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/audio"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/audio"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceAudioGet-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -9662,7 +9674,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceAudioPatch-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost:8091/sdrangel/audio"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost/sdrangel/audio"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceAudioPatch-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -10049,7 +10061,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceChannels-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/channels?tx="</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/channels?tx="</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceChannels-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -10422,7 +10434,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceDVSerialPatch-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost:8091/sdrangel/dvserial?dvserial="</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost/sdrangel/dvserial?dvserial="</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceDVSerialPatch-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -10795,7 +10807,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceDelete-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost:8091/sdrangel"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost/sdrangel"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceDelete-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -11173,7 +11185,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceDeviceSetsGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/devicesets"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/devicesets"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceDeviceSetsGet-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -11508,7 +11520,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceDevices-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/devices?tx="</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/devices?tx="</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceDevices-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -11881,7 +11893,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceLocationGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/location"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/location"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceLocationGet-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -12216,7 +12228,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceLocationPut-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost:8091/sdrangel/location"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost/sdrangel/location"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceLocationPut-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -12611,7 +12623,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceLoggingGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/logging"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/logging"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceLoggingGet-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -12946,7 +12958,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceLoggingPut-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost:8091/sdrangel/logging"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost/sdrangel/logging"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceLoggingPut-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -13376,7 +13388,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instancePresetDelete-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost:8091/sdrangel/preset"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X DELETE "http://localhost/sdrangel/preset"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instancePresetDelete-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -13849,7 +13861,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instancePresetFilePost-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost:8091/sdrangel/preset/file"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost/sdrangel/preset/file"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instancePresetFilePost-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -14322,7 +14334,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instancePresetFilePut-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost:8091/sdrangel/preset/file"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost/sdrangel/preset/file"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instancePresetFilePut-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -14795,7 +14807,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instancePresetGet-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel/presets"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel/presets"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instancePresetGet-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -15130,7 +15142,7 @@ except ApiException as e:
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instancePresetPatch-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost:8091/sdrangel/preset"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PATCH "http://localhost/sdrangel/preset"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instancePresetPatch-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -15603,7 +15615,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instancePresetPost-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost:8091/sdrangel/preset"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X POST "http://localhost/sdrangel/preset"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instancePresetPost-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -16119,7 +16131,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instancePresetPut-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost:8091/sdrangel/preset"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X PUT "http://localhost/sdrangel/preset"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instancePresetPut-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -16592,7 +16604,7 @@ $(document).ready(function() {
|
||||
|
||||
<div class="tab-content">
|
||||
<div class="tab-pane active" id="examples-Instance-instanceSummary-0-curl">
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost:8091/sdrangel"</code></pre>
|
||||
<pre class="prettyprint"><code class="language-bsh">curl -X GET "http://localhost/sdrangel"</code></pre>
|
||||
</div>
|
||||
<div class="tab-pane" id="examples-Instance-instanceSummary-0-java">
|
||||
<pre class="prettyprint"><code class="language-java">import SWGSDRangel.*;
|
||||
@ -16909,7 +16921,7 @@ except ApiException as e:
|
||||
</div>
|
||||
<div id="generator">
|
||||
<div class="content">
|
||||
Generated 2018-01-16T19:54:59.982+01:00
|
||||
Generated 2018-01-25T00:10:31.068+01:00
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
BIN
sdrbase/resources/webapi/doc/swagger-ui/favicon-16x16.png
Normal file
BIN
sdrbase/resources/webapi/doc/swagger-ui/favicon-16x16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 445 B |
BIN
sdrbase/resources/webapi/doc/swagger-ui/favicon-32x32.png
Normal file
BIN
sdrbase/resources/webapi/doc/swagger-ui/favicon-32x32.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
96
sdrbase/resources/webapi/doc/swagger-ui/index.html
Normal file
96
sdrbase/resources/webapi/doc/swagger-ui/index.html
Normal file
@ -0,0 +1,96 @@
|
||||
<!-- HTML for static distribution bundle build -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Swagger UI</title>
|
||||
<link href="https://fonts.googleapis.com/css?family=Open+Sans:400,700|Source+Code+Pro:300,600|Titillium+Web:400,600,700" rel="stylesheet">
|
||||
<link rel="stylesheet" type="text/css" href="./swagger-ui.css" >
|
||||
<link rel="icon" type="image/png" href="./favicon-32x32.png" sizes="32x32" />
|
||||
<link rel="icon" type="image/png" href="./favicon-16x16.png" sizes="16x16" />
|
||||
<style>
|
||||
html
|
||||
{
|
||||
box-sizing: border-box;
|
||||
overflow: -moz-scrollbars-vertical;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
*,
|
||||
*:before,
|
||||
*:after
|
||||
{
|
||||
box-sizing: inherit;
|
||||
}
|
||||
|
||||
body {
|
||||
margin:0;
|
||||
background: #fafafa;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="position:absolute;width:0;height:0">
|
||||
<defs>
|
||||
<symbol viewBox="0 0 20 20" id="unlocked">
|
||||
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V6h2v-.801C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8z"></path>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 20 20" id="locked">
|
||||
<path d="M15.8 8H14V5.6C14 2.703 12.665 1 10 1 7.334 1 6 2.703 6 5.6V8H4c-.553 0-1 .646-1 1.199V17c0 .549.428 1.139.951 1.307l1.197.387C5.672 18.861 6.55 19 7.1 19h5.8c.549 0 1.428-.139 1.951-.307l1.196-.387c.524-.167.953-.757.953-1.306V9.199C17 8.646 16.352 8 15.8 8zM12 8H8V5.199C8 3.754 8.797 3 10 3c1.203 0 2 .754 2 2.199V8z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 20 20" id="close">
|
||||
<path d="M14.348 14.849c-.469.469-1.229.469-1.697 0L10 11.819l-2.651 3.029c-.469.469-1.229.469-1.697 0-.469-.469-.469-1.229 0-1.697l2.758-3.15-2.759-3.152c-.469-.469-.469-1.228 0-1.697.469-.469 1.228-.469 1.697 0L10 8.183l2.651-3.031c.469-.469 1.228-.469 1.697 0 .469.469.469 1.229 0 1.697l-2.758 3.152 2.758 3.15c.469.469.469 1.229 0 1.698z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 20 20" id="large-arrow">
|
||||
<path d="M13.25 10L6.109 2.58c-.268-.27-.268-.707 0-.979.268-.27.701-.27.969 0l7.83 7.908c.268.271.268.709 0 .979l-7.83 7.908c-.268.271-.701.27-.969 0-.268-.269-.268-.707 0-.979L13.25 10z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 20 20" id="large-arrow-down">
|
||||
<path d="M17.418 6.109c.272-.268.709-.268.979 0s.271.701 0 .969l-7.908 7.83c-.27.268-.707.268-.979 0l-7.908-7.83c-.27-.268-.27-.701 0-.969.271-.268.709-.268.979 0L10 13.25l7.418-7.141z"/>
|
||||
</symbol>
|
||||
|
||||
|
||||
<symbol viewBox="0 0 24 24" id="jump-to">
|
||||
<path d="M19 7v4H5.83l3.58-3.59L8 6l-6 6 6 6 1.41-1.41L5.83 13H21V7z"/>
|
||||
</symbol>
|
||||
|
||||
<symbol viewBox="0 0 24 24" id="expand">
|
||||
<path d="M10 18h4v-2h-4v2zM3 6v2h18V6H3zm3 7h12v-2H6v2z"/>
|
||||
</symbol>
|
||||
|
||||
</defs>
|
||||
</svg>
|
||||
|
||||
<div id="swagger-ui"></div>
|
||||
|
||||
<script src="./swagger-ui-bundle.js"> </script>
|
||||
<script src="./swagger-ui-standalone-preset.js"> </script>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
|
||||
// Build a system
|
||||
const ui = SwaggerUIBundle({
|
||||
url: window.location.protocol + "//" + window.location.host + "/doc/swagger/swagger.yaml",
|
||||
validatorUrl: window.location.protocol + "//" + window.location.host + "/doc/swagger/swagger.yaml",
|
||||
dom_id: '#swagger-ui',
|
||||
deepLinking: true,
|
||||
presets: [
|
||||
SwaggerUIBundle.presets.apis,
|
||||
SwaggerUIStandalonePreset
|
||||
],
|
||||
plugins: [
|
||||
SwaggerUIBundle.plugins.DownloadUrl
|
||||
],
|
||||
layout: "StandaloneLayout"
|
||||
})
|
||||
|
||||
window.ui = ui
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
60
sdrbase/resources/webapi/doc/swagger-ui/oauth2-redirect.html
Normal file
60
sdrbase/resources/webapi/doc/swagger-ui/oauth2-redirect.html
Normal file
@ -0,0 +1,60 @@
|
||||
<!doctype html>
|
||||
<html lang="en-US">
|
||||
<body onload="run()">
|
||||
</body>
|
||||
</html>
|
||||
<script>
|
||||
'use strict';
|
||||
function run () {
|
||||
var oauth2 = window.opener.swaggerUIRedirectOauth2;
|
||||
var sentState = oauth2.state;
|
||||
var redirectUrl = oauth2.redirectUrl;
|
||||
var isValid, qp, arr;
|
||||
|
||||
if (/code|token|error/.test(window.location.hash)) {
|
||||
qp = window.location.hash.substring(1);
|
||||
} else {
|
||||
qp = location.search.substring(1);
|
||||
}
|
||||
|
||||
arr = qp.split("&")
|
||||
arr.forEach(function (v,i,_arr) { _arr[i] = '"' + v.replace('=', '":"') + '"';})
|
||||
qp = qp ? JSON.parse('{' + arr.join() + '}',
|
||||
function (key, value) {
|
||||
return key === "" ? value : decodeURIComponent(value)
|
||||
}
|
||||
) : {}
|
||||
|
||||
isValid = qp.state === sentState
|
||||
|
||||
if ((
|
||||
oauth2.auth.schema.get("flow") === "accessCode"||
|
||||
oauth2.auth.schema.get("flow") === "authorizationCode"
|
||||
) && !oauth2.auth.code) {
|
||||
if (!isValid) {
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "warning",
|
||||
message: "Authorization may be unsafe, passed state was changed in server Passed state wasn't returned from auth server"
|
||||
});
|
||||
}
|
||||
|
||||
if (qp.code) {
|
||||
delete oauth2.state;
|
||||
oauth2.auth.code = qp.code;
|
||||
oauth2.callback({auth: oauth2.auth, redirectUrl: redirectUrl});
|
||||
} else {
|
||||
oauth2.errCb({
|
||||
authId: oauth2.auth.name,
|
||||
source: "auth",
|
||||
level: "error",
|
||||
message: "Authorization failed: no accessCode received from the server"
|
||||
});
|
||||
}
|
||||
} else {
|
||||
oauth2.callback({auth: oauth2.auth, token: qp, isValid: isValid, redirectUrl: redirectUrl});
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
</script>
|
99
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-bundle.js
Normal file
99
sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-bundle.js
Normal file
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user