kopia lustrzana https://github.com/f4exb/sdrangel
Support decoding with waterfall at 96,192 and 384kHz.
rodzic
e17018f6e4
commit
34d2f8e504
|
@ -52,6 +52,7 @@ void USBDemod::configure(MessageQueue* messageQueue, Real Bandwidth, Real volume
|
||||||
cmd->submit(messageQueue, this);
|
cmd->submit(messageQueue, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Expects samplerate as multiples of 96kHz. */
|
||||||
void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly)
|
void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iterator end, bool positiveOnly)
|
||||||
{
|
{
|
||||||
Real a, b;
|
Real a, b;
|
||||||
|
@ -59,11 +60,13 @@ void USBDemod::feed(SampleVector::const_iterator begin, SampleVector::const_iter
|
||||||
int n_out;
|
int n_out;
|
||||||
cmplx *sideband;
|
cmplx *sideband;
|
||||||
bool consumed;
|
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();
|
a = it->real();
|
||||||
b = it->imag();
|
b = it->imag();
|
||||||
// TODO: Assumes 96kHz; Expect breakage.
|
|
||||||
c = Complex(a / 65536.0, b / 65536.0);
|
c = Complex(a / 65536.0, b / 65536.0);
|
||||||
|
|
||||||
n_out = USBFilter->run(c, &sideband, true);
|
n_out = USBFilter->run(c, &sideband, true);
|
||||||
|
|
|
@ -140,7 +140,7 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
||||||
{
|
{
|
||||||
qint16 xreal, yimag, phase;
|
qint16 xreal, yimag, phase;
|
||||||
SampleVector::iterator it = m_convertBuffer.begin();
|
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;
|
if (++m_localdecimation < decimationFactor[m_decimation]) return;
|
||||||
m_localdecimation = 0;
|
m_localdecimation = 0;
|
||||||
|
@ -148,15 +148,15 @@ void RTLSDRThread::callback(const quint8* buf, qint32 len)
|
||||||
switch(4 - m_decimation) {
|
switch(4 - m_decimation) {
|
||||||
case 0: // 1:1 = no decimation
|
case 0: // 1:1 = no decimation
|
||||||
// just rotation
|
// just rotation
|
||||||
phase = -1;
|
phase = -(1<<2);
|
||||||
for (int pos = 0; pos < len + 3; pos += 4) {
|
for (int pos = 0; pos < len + 3; pos += 4) {
|
||||||
phase *= -1;
|
phase *= -1;
|
||||||
xreal = phase * (buf[pos+0] - 127);
|
xreal = phase * (2 * buf[pos+0] - 255);
|
||||||
yimag = phase * (buf[pos+1] - 127);
|
yimag = phase * (2 * buf[pos+1] - 255);
|
||||||
*it++ = Sample( xreal<<3,yimag<<3);
|
*it++ = Sample(xreal, yimag);
|
||||||
xreal = phase * (127 - buf[pos+3]);
|
xreal = phase * (255 - 2 * buf[pos+3]);
|
||||||
yimag = phase * (buf[pos+2] - 127);
|
yimag = phase * (2 * buf[pos+2] - 255);
|
||||||
*it++ = Sample( xreal<<3,yimag<<3);
|
*it++ = Sample(xreal, yimag);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 1: // 1:2
|
case 1: // 1:2
|
||||||
|
|
Ładowanie…
Reference in New Issue