1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-23 01:55:48 -05:00

Support decoding with waterfall at 96,192 and 384kHz.

This commit is contained in:
Hexameron 2014-08-12 19:35:26 +01:00
parent e17018f6e4
commit 34d2f8e504
2 changed files with 13 additions and 10 deletions

View File

@ -52,6 +52,7 @@ void USBDemod::configure(MessageQueue* messageQueue, Real Bandwidth, Real volume
cmd->submit(messageQueue, this);
}
/* Expects samplerate as multiples of 96kHz. */
void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly)
{
Real a, b;
@ -59,11 +60,13 @@ void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter
int n_out;
cmplx *sideband;
bool consumed;
int samplestep = m_sampleRate / 96000;
for(SampleVector::const_iterator it = begin; it < end; ++it) {
if (samplestep < 1 )
samplestep = 1;
for(SampleVector::const_iterator it = begin; it < end; it += samplestep) {
a = it->real();
b = it->imag();
// TODO: Assumes 96kHz; Expect breakage.
c = Complex(a / 65536.0, b / 65536.0);
n_out = USBFilter->run(c, &sideband, true);

View File

@ -140,7 +140,7 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
{
qint16 xreal, yimag, phase;
SampleVector::iterator it = m_convertBuffer.begin();
int decimationFactor[] = {1, 2, 4, 8, 16, 0};
int decimationFactor[] = {1, 1, 1, 2, 4, 0};
if (++m_localdecimation < decimationFactor[m_decimation]) return;
m_localdecimation = 0;
@ -148,15 +148,15 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
switch(4 - m_decimation) {
case 0: // 1:1 = no decimation
// just rotation
phase = -1;
phase = -(1<<2);
for (int pos = 0; pos < len + 3; pos += 4) {
phase *= -1;
xreal = phase * (buf[pos+0] - 127);
yimag = phase * (buf[pos+1] - 127);
*it++ = Sample( xreal<<3,yimag<<3);
xreal = phase * (127 - buf[pos+3]);
yimag = phase * (buf[pos+2] - 127);
*it++ = Sample( xreal<<3,yimag<<3);
xreal = phase * (2 * buf[pos+0] - 255);
yimag = phase * (2 * buf[pos+1] - 255);
*it++ = Sample(xreal, yimag);
xreal = phase * (255 - 2 * buf[pos+3]);
yimag = phase * (2 * buf[pos+2] - 255);
*it++ = Sample(xreal, yimag);
}
break;
case 1: // 1:2