1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-16 13:21:50 -05:00

Added a decimation by 32 for BladeRF plugin

This commit is contained in:
f4exb 2015-06-07 11:26:23 +02:00
parent 1c7ea3dfb3
commit 833890a1ea
4 changed files with 45 additions and 2 deletions

View File

@ -156,7 +156,7 @@ void BladerfGui::on_bandwidth_valueChanged(int value)
void BladerfGui::on_decim_valueChanged(int value)
{
if ((value <0) || (value > 4))
if ((value <0) || (value > 5))
return;
ui->decimText->setText(tr("%1").arg(1<<value));
m_settings.m_log2Decim = value;

View File

@ -326,7 +326,7 @@
<item row="0" column="1">
<widget class="QSlider" name="decim">
<property name="maximum">
<number>4</number>
<number>5</number>
</property>
<property name="pageStep">
<number>1</number>

View File

@ -171,18 +171,57 @@ void BladerfThread::decimate16(SampleVector::iterator* it, const qint16* buf, qi
yimag[i] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << 2; // was shift 4
pos += 8;
}
Sample s1( xreal[0], yimag[0] );
Sample s2( xreal[1], yimag[1] );
Sample s3( xreal[2], yimag[2] );
Sample s4( xreal[3], yimag[3] );
m_decimator2.myDecimate(&s1, &s2);
m_decimator2.myDecimate(&s3, &s4);
m_decimator4.myDecimate(&s2, &s4);
**it = s4;
(*it)++;
}
}
void BladerfThread::decimate32(SampleVector::iterator* it, const qint16* buf, qint32 len)
{
qint16 xreal[8], yimag[8];
for (int pos = 0; pos < len - 63; ) {
for (int i = 0; i < 8; i++) {
xreal[i] = (buf[pos+0] - buf[pos+3] + buf[pos+7] - buf[pos+4]) << 2; // was shift 4
yimag[i] = (buf[pos+1] - buf[pos+5] + buf[pos+2] - buf[pos+6]) << 2; // was shift 4
pos += 8;
}
Sample s1( xreal[0], yimag[0] );
Sample s2( xreal[1], yimag[1] );
Sample s3( xreal[2], yimag[2] );
Sample s4( xreal[3], yimag[3] );
Sample s5( xreal[4], yimag[4] );
Sample s6( xreal[5], yimag[5] );
Sample s7( xreal[6], yimag[6] );
Sample s8( xreal[7], yimag[7] );
m_decimator2.myDecimate(&s1, &s2);
m_decimator2.myDecimate(&s3, &s4);
m_decimator2.myDecimate(&s5, &s6);
m_decimator2.myDecimate(&s7, &s8);
m_decimator2.myDecimate(&s2, &s4);
m_decimator2.myDecimate(&s6, &s8);
m_decimator4.myDecimate(&s4, &s8);
**it = s8;
(*it)++;
}
}
// Decimate according to specified log2 (ex: log2=4 => decim=16)
void BladerfThread::callback(const qint16* buf, qint32 len)
{
@ -205,6 +244,9 @@ void BladerfThread::callback(const qint16* buf, qint32 len)
case 4:
decimate16(&it, buf, len);
break;
case 5:
decimate32(&it, buf, len);
break;
default:
break;
}

View File

@ -62,6 +62,7 @@ private:
void decimate4(SampleVector::iterator* it, const qint16* buf, qint32 len);
void decimate8(SampleVector::iterator* it, const qint16* buf, qint32 len);
void decimate16(SampleVector::iterator* it, const qint16* buf, qint32 len);
void decimate32(SampleVector::iterator* it, const qint16* buf, qint32 len);
void callback(const qint16* buf, qint32 len);
};