mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-14 12:22:00 -05:00
Decimate more.
This commit is contained in:
parent
95fe79650c
commit
f2c1b6e11e
@ -1,7 +1,7 @@
|
|||||||
project(demod)
|
project(demod)
|
||||||
|
|
||||||
add_subdirectory(lora)
|
add_subdirectory(lora)
|
||||||
add_subdirectory(nfm)
|
add_subdirectory(nfm_testing)
|
||||||
add_subdirectory(ssb)
|
add_subdirectory(ssb)
|
||||||
add_subdirectory(tcpsrc)
|
add_subdirectory(tcpsrc)
|
||||||
add_subdirectory(usb)
|
add_subdirectory(usb)
|
||||||
|
@ -94,7 +94,7 @@ bool V4LInput::startInput(int device)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_deviceDescription = QString("RTL-SDR /dev/swradio0");
|
m_deviceDescription = QString("SDRplay /dev/swradio0");
|
||||||
|
|
||||||
qDebug("V4LInput: start");
|
qDebug("V4LInput: start");
|
||||||
//MsgReportV4L::create(m_gains)->submit(m_guiMessageQueue);
|
//MsgReportV4L::create(m_gains)->submit(m_guiMessageQueue);
|
||||||
@ -123,7 +123,7 @@ const QString& V4LInput::getDeviceDescription() const
|
|||||||
int V4LInput::getSampleRate() const
|
int V4LInput::getSampleRate() const
|
||||||
{
|
{
|
||||||
// The output rate is lower than the device rate
|
// The output rate is lower than the device rate
|
||||||
int result = SAMPLERATE / 2;
|
int result = SAMPLERATE / 4;
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
#include <QtPlugin>
|
#include <QtPlugin>
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <rtl-sdr.h>
|
|
||||||
#include "plugin/pluginapi.h"
|
#include "plugin/pluginapi.h"
|
||||||
#include "util/simpleserializer.h"
|
#include "util/simpleserializer.h"
|
||||||
#include "v4lplugin.h"
|
#include "v4lplugin.h"
|
||||||
@ -8,7 +7,7 @@
|
|||||||
|
|
||||||
const PluginDescriptor V4LPlugin::m_pluginDescriptor = {
|
const PluginDescriptor V4LPlugin::m_pluginDescriptor = {
|
||||||
QString("V4L Input"),
|
QString("V4L Input"),
|
||||||
QString("3.18"),
|
QString("4.0"),
|
||||||
QString("(c) 2014 John Greb"),
|
QString("(c) 2014 John Greb"),
|
||||||
QString("http://palosaari.fi/linux/"),
|
QString("http://palosaari.fi/linux/"),
|
||||||
true,
|
true,
|
||||||
@ -36,7 +35,7 @@ PluginInterface::SampleSourceDevices V4LPlugin::enumSampleSources()
|
|||||||
{
|
{
|
||||||
SampleSourceDevices result;
|
SampleSourceDevices result;
|
||||||
|
|
||||||
QString displayedName(QString("Kernel Source #1"));
|
QString displayedName(QString("Linux V4L (SDRplay)"));
|
||||||
SimpleSerializer s(1);
|
SimpleSerializer s(1);
|
||||||
s.writeS32(1, 0);
|
s.writeS32(1, 0);
|
||||||
result.append(SampleSourceDevice(displayedName, "org.osmocom.sdr.samplesource.v4l", s.final()));
|
result.append(SampleSourceDevice(displayedName, "org.osmocom.sdr.samplesource.v4l", s.final()));
|
||||||
|
@ -218,6 +218,7 @@ V4LThread::set_tuner_gain(double gain)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define CASTUP (int)(qint16)
|
||||||
int
|
int
|
||||||
V4LThread::work(int noutput_items)
|
V4LThread::work(int noutput_items)
|
||||||
{
|
{
|
||||||
@ -230,20 +231,20 @@ V4LThread::work(int noutput_items)
|
|||||||
SampleVector::iterator it;
|
SampleVector::iterator it;
|
||||||
|
|
||||||
unsigned int pos = 0;
|
unsigned int pos = 0;
|
||||||
// MSI format is 252 sample pairs : 63 * 4
|
// MSI format is 252 sample pairs :( 63 * 4) * 4bytes
|
||||||
it = m_convertBuffer.begin();
|
it = m_convertBuffer.begin();
|
||||||
if (recebuf_len >= 8) { // in bytes
|
if (recebuf_len >= 16) { // in bytes
|
||||||
b = (uint16_t *) recebuf_ptr;
|
b = (uint16_t *) recebuf_ptr;
|
||||||
unsigned int len = 4 * noutput_items; // decimation (i+q * 2 : cmplx)
|
unsigned int len = 8 * noutput_items; // decimation (i+q * 4 : cmplx)
|
||||||
if (len * 2 > recebuf_len)
|
if (len * 2 > recebuf_len)
|
||||||
len = recebuf_len / 2;
|
len = recebuf_len / 2;
|
||||||
// Decimate by two for lower cpu usage
|
// Decimate by two for lower cpu usage
|
||||||
for (pos = 0; pos < len - 3; pos += 4) {
|
for (pos = 0; pos < len - 7; pos += 8) {
|
||||||
xreal = (qint16)(b[pos+0]<<2) + (qint16)(b[pos+2]<<2);
|
xreal = CASTUP(b[pos+0]<<2) + CASTUP(b[pos+2]<<2)
|
||||||
// + (qint16)(b[pos+4]<<2) + (qint16)(b[pos+6]<<2);
|
+ CASTUP(b[pos+4]<<2) + CASTUP(b[pos+6]<<2);
|
||||||
yimag = (qint16)(b[pos+1]<<2) + (qint16)(b[pos+3]<<2);
|
yimag = CASTUP(b[pos+1]<<2) + CASTUP(b[pos+3]<<2)
|
||||||
// + (int)(b[pos+5]<<2) + (int)(b[pos+7]<<2);
|
+ CASTUP(b[pos+5]<<2) + CASTUP(b[pos+7]<<2);
|
||||||
Sample s( (qint16)(xreal >> 2) , (qint16)(yimag>>2) );
|
Sample s( (qint16)(xreal >> 2) , (qint16)(yimag >> 2) );
|
||||||
*it = s;
|
*it = s;
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
@ -252,8 +253,8 @@ V4LThread::work(int noutput_items)
|
|||||||
recebuf_ptr = (void*)(b + pos);
|
recebuf_ptr = (void*)(b + pos);
|
||||||
}
|
}
|
||||||
// return now if there is still data in buffer, else free buffer and get another.
|
// return now if there is still data in buffer, else free buffer and get another.
|
||||||
if (recebuf_len >= 8)
|
if (recebuf_len >= 16)
|
||||||
return pos / 4;
|
return pos / 8;
|
||||||
{ // free buffer, if there was one.
|
{ // free buffer, if there was one.
|
||||||
if (pos > 0) {
|
if (pos > 0) {
|
||||||
CLEAR(buf);
|
CLEAR(buf);
|
||||||
@ -290,5 +291,5 @@ V4LThread::work(int noutput_items)
|
|||||||
recebuf_len = buf.bytesused;
|
recebuf_len = buf.bytesused;
|
||||||
recebuf_mmap_index = buf.index;
|
recebuf_mmap_index = buf.index;
|
||||||
}
|
}
|
||||||
return pos / 4;
|
return pos / 8;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
|
|
||||||
// lowest samplerate in the kernel is 1.2M, but this works better
|
// lowest samplerate in the kernel is 1.2M, but this works better
|
||||||
#define SAMPLERATE 1536000
|
#define SAMPLERATE 1536000
|
||||||
|
//#define SAMPLERATE 768000
|
||||||
#define BLOCKSIZE 8192
|
#define BLOCKSIZE 8192
|
||||||
|
|
||||||
class V4LThread : public QThread {
|
class V4LThread : public QThread {
|
||||||
|
Loading…
Reference in New Issue
Block a user