mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-12 19:36:10 -05:00
SDRdaemon plugin: better calculation of write - read pointers delta. Better amortization of buffer R/W compensation with an alpha factor of 0.25
This commit is contained in:
parent
bfdcac70d0
commit
0ffc02102e
@ -195,11 +195,11 @@ Then you should be all set to build the software with `cmake` and `make` as disc
|
||||
|
||||
This is new in version 1.1.3 and also experimental. Use at your own risk! This may or may not work on your machine and version of Windows. It was tested more or less successfully in native Windows 7, 8 and 10 however it does not work in a Virtualbox guest supposedly because it uses OpenGL ES 2.0 instead of the OpenGL desktop version (OpenGL 4.3) when it is running native and I think the OpenGL code in SDRangel is still not quite right to be compatible with the ES version (use of QtGLWidget instead of QtOpenGLWidget).
|
||||
|
||||
You should take note that the Windows scheduler is just a piece of crap and not suitable for near real time applications like SDRs. In any case you should make sure that the sdrangel process does not take more than 35% of the global CPU (check with Task Manager). Unload channel plugins if necessary. If you encounter any problem just grab a Linux installation CD or .iso file and get yourself a decent OS first. You have been warned!
|
||||
You should take note that the Windows scheduler is just a piece of crap and not suitable for near real time applications like SDRs. In any case you should make sure that the sdrangel.exe process does not take more than 35% of the global CPU (check this with Task Manager). Unload channel plugins if necessary. Promoting sdrangel.exe process to real time via Task Manager may or may not help but usually not. If you encounter any problem just grab a Linux installation CD or .iso file and get yourself a decent OS first. You have been warned!
|
||||
|
||||
There is no plug-in to interface to BladeRF hardware due to the complexity of building `libbladerf` for Windows.
|
||||
|
||||
The SDRdaemon plug-in does not work correctly mainly due to the fact that it needs an OS with a decent scheduler and Windows is definitely not this sort of OS (see my previous warning). This plug-in cannot rely on the pace of incoming UDP packets so it will use a timer (QTimer) to get the right pace for the given sample rate. Since the timing is not reliable on Windows this translates into a large read/write drift on the incoming data buffer (watch the buffer gauges in the GUI) and eventually the read pointer walks over the buffer tail or head which is the same since it is a circular buffer. If you can't live with this drift you will have to experiment with the auto read/write balance (`B` button in the GUI) and your mileage may vary in some cases it can even crash (Pipo-X8 with Windows 8).
|
||||
The SDRdaemon plug-in does not work mainly due to the fact that it needs an OS with a decent scheduler and Windows is definitely not this sort of OS (see my previous warning). It is kept there only to demonstrate how a crippled OS is Windows. If you want to use this plugin get yourself a decent OS first i.e. Linux.
|
||||
|
||||
<h3>Build environment</h3>
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <QDebug>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
#include <lz4.h>
|
||||
|
||||
|
||||
@ -264,28 +265,28 @@ uint8_t *SDRdaemonBuffer::readData(int32_t length)
|
||||
if ((m_nbReads > 5*m_rawBufferLengthSeconds) && m_autoCorrBuffer)
|
||||
{
|
||||
int32_t dBytes;
|
||||
int32_t dI = (m_rawSize / 2) - m_readIndex; // delta of read index to the middle of buffer (positive)
|
||||
|
||||
if (m_readIndex > m_writeIndex) { // write leads
|
||||
dBytes = m_writeIndex; // positive from start of buffer
|
||||
dBytes = m_writeIndex + dI; // positive from start of buffer + delta read index
|
||||
} else { // read leads
|
||||
dBytes = m_writeIndex - (int32_t) m_rawSize; // negative from end of buffer
|
||||
dBytes = m_writeIndex - (int32_t) m_rawSize + dI; // negative from end of buffer minus delta read index
|
||||
}
|
||||
|
||||
m_balCorrection += dBytes / (int32_t) (m_nbReads * m_iqSampleSize); // correction is in number of samples
|
||||
int32_t corrLimit = (int32_t) m_rawSize / (int32_t) (10 * m_rawBufferLengthSeconds * m_iqSampleSize);
|
||||
m_balCorrection = (m_balCorrection / 4) + ((int32_t) dBytes / (int32_t) (m_nbReads * m_iqSampleSize)); // correction is in number of samples. Alpha = 0.25
|
||||
|
||||
if (m_balCorrection < -m_balCorrLimit) {
|
||||
m_balCorrection = -m_balCorrLimit;
|
||||
} else if (m_balCorrection > m_balCorrLimit) {
|
||||
m_balCorrection = m_balCorrLimit;
|
||||
}
|
||||
|
||||
m_nbReads = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_balCorrection = 0;
|
||||
}
|
||||
|
||||
m_nbReads = 0;
|
||||
// un-arm
|
||||
m_skewTest = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user