DSD demod plugin: lowpass filter for DV serial upsample

pull/27/head
f4exb 2016-09-10 20:03:06 +02:00
rodzic d9ad7213fe
commit d01a4166eb
7 zmienionych plików z 121 dodań i 8 usunięć

Wyświetl plik

@ -105,6 +105,7 @@ set(sdrbase_SOURCES
sdrbase/dsp/fftfilt.cxx sdrbase/dsp/fftfilt.cxx
sdrbase/dsp/fftwindow.cpp sdrbase/dsp/fftwindow.cpp
sdrbase/dsp/filterrc.cpp sdrbase/dsp/filterrc.cpp
sdrbase/dsp/filtermbe.cpp
sdrbase/dsp/filesink.cpp sdrbase/dsp/filesink.cpp
sdrbase/dsp/interpolator.cpp sdrbase/dsp/interpolator.cpp
sdrbase/dsp/inthalfbandfilter.cpp sdrbase/dsp/inthalfbandfilter.cpp
@ -188,6 +189,7 @@ set(sdrbase_HEADERS
sdrbase/dsp/fftwengine.h sdrbase/dsp/fftwengine.h
sdrbase/dsp/fftwindow.h sdrbase/dsp/fftwindow.h
sdrbase/dsp/filterrc.h sdrbase/dsp/filterrc.h
sdrbase/dsp/filtermbe.h
sdrbase/dsp/filesink.h sdrbase/dsp/filesink.h
sdrbase/dsp/gfft.h sdrbase/dsp/gfft.h
sdrbase/dsp/interpolator.h sdrbase/dsp/interpolator.h

Wyświetl plik

@ -395,10 +395,12 @@ You can uninstall the software with `make uninstall` or `sudo make uninstall` fr
- The message queuing model supports a n:1 connection to an object (on its input queue) and a 1:1 connection from an object (on its output queue). Assuming a different model can cause insidious disruptions. - The message queuing model supports a n:1 connection to an object (on its input queue) and a 1:1 connection from an object (on its output queue). Assuming a different model can cause insidious disruptions.
- As the objects input and output queues can be publicly accessed there is no strict control of which objects post messages on these queues. The correct assumption is that messages can be popped from the input queue only by its holder and that messages can be pushed on the output queue only by its holder. - As the objects input and output queues can be publicly accessed there is no strict control of which objects post messages on these queues. The correct assumption is that messages can be popped from the input queue only by its holder and that messages can be pushed on the output queue only by its holder.
- Objects managing more than one message queue (input + output for example) do not work well under stress conditions. Output queue removed from sample sources but this model has to be revised throughout the application. - Objects managing more than one message queue (input + output for example) do not work well under stress conditions. Output queue removed from sample sources but this model has to be revised throughout the application.
- File input plugin in Linux: it is having trouble switching to another file source. The best option is to restart SDRangel. Strangely enough the Windows version does not seem to be affected maybe this is an ALSA only issue.
- SDRdaemon FEC plugin: it has trouble doing the first connection or reconnecting to another device. The best option is to try then acknowledge the error message and restart SDRangel.
<h1>Limitations</h1> <h1>Limitations</h1>
- Tabbed panels showing "X0" refer to the only one selected device it is meant to be populated by more tabs when it will support more than one device possibly Rx + Tx. - Your hardware. Still SDRangel is relatively conservative on computer resources.
<h1>Features</h1> <h1>Features</h1>

Wyświetl plik

@ -226,7 +226,6 @@ String is in the form: `02223297>G00000222`
- At the left of the `>` sign this is the source address (24 bits) as defined in the DMR ETSI standard - At the left of the `>` sign this is the source address (24 bits) as defined in the DMR ETSI standard
- The first character at the right of the `>` sign is the address type indicator: - The first character at the right of the `>` sign is the address type indicator:
- `G`: group address - `G`: group address
- `U`: unit (individual) address - `U`: unit (individual) address
- Next on the right is the target address (24 bits) as defined in the DMR ETSI standard - Next on the right is the target address (24 bits) as defined in the DMR ETSI standard

Wyświetl plik

@ -149,37 +149,37 @@ void DVSerialWorker::upsample6(short *in, short *out, int nbSamplesIn)
// m_phase = 0.0f; // m_phase = 0.0f;
// } // }
up = (cur*1 + prev*5) / 6; up = m_upsampleFilter.run((cur*1 + prev*5) / 6);
*out = up; *out = up;
out++; out++;
*out = up; *out = up;
out++; out++;
up = (cur*2 + prev*4) / 6; up = m_upsampleFilter.run((cur*2 + prev*4) / 6);
*out = up; *out = up;
out++; out++;
*out = up; *out = up;
out++; out++;
up = (cur*3 + prev*3) / 6; up = m_upsampleFilter.run((cur*3 + prev*3) / 6);
*out = up; *out = up;
out++; out++;
*out = up; *out = up;
out++; out++;
up = (cur*4 + prev*2) / 6; up = m_upsampleFilter.run((cur*4 + prev*2) / 6);
*out = up; *out = up;
out++; out++;
*out = up; *out = up;
out++; out++;
up = (cur*5 + prev*1) / 6; up = m_upsampleFilter.run((cur*5 + prev*1) / 6);
*out = up; *out = up;
out++; out++;
*out = up; *out = up;
out++; out++;
up = in[i]; up = m_upsampleFilter.run(in[i]);
*out = up; *out = up;
out++; out++;
*out = up; *out = up;

Wyświetl plik

@ -27,6 +27,7 @@
#include "util/message.h" #include "util/message.h"
#include "util/syncmessenger.h" #include "util/syncmessenger.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
#include "dsp/filtermbe.h"
class AudioFifo; class AudioFifo;
@ -123,6 +124,7 @@ private:
uint m_audioBufferFill; uint m_audioBufferFill;
short m_upsamplerLastValue; short m_upsamplerLastValue;
float m_phase; float m_phase;
MBEAudioInterpolatorFilter m_upsampleFilter;
}; };
#endif /* SDRBASE_DSP_DVSERIALWORKER_H_ */ #endif /* SDRBASE_DSP_DVSERIALWORKER_H_ */

Wyświetl plik

@ -0,0 +1,54 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 F4EXB //
// written by Edouard Griffiths //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#include "filtermbe.h"
const float MBEAudioInterpolatorFilter::m_a0 = 3.869430E-02;
const float MBEAudioInterpolatorFilter::m_a1 = 7.738860E-02;
const float MBEAudioInterpolatorFilter::m_a2 = 3.869430E-02;
const float MBEAudioInterpolatorFilter::m_b1 = 1.392667E+00;
const float MBEAudioInterpolatorFilter::m_b2 = -5.474446E-01;
MBEAudioInterpolatorFilter::MBEAudioInterpolatorFilter()
{}
MBEAudioInterpolatorFilter::~MBEAudioInterpolatorFilter()
{}
void MBEAudioInterpolatorFilter::init()
{
m_x[0] = 0.0f;
m_x[1] = 0.0f;
m_y[0] = 0.0f;
m_y[1] = 0.0f;
}
float MBEAudioInterpolatorFilter::run(float sample)
{
float y = m_a0*sample + m_a1*m_x[0] + m_a2*m_x[1] + m_b1*m_y[0] + m_b2*m_y[1]; // this is y[n]
m_x[1] = m_x[0];
m_x[0] = sample;
m_y[1] = m_y[0];
m_y[0] = y;
return y;
}

Wyświetl plik

@ -0,0 +1,54 @@
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 F4EXB //
// written by Edouard Griffiths //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRBASE_DSP_FILTERMBE_H_
#define SDRBASE_DSP_FILTERMBE_H_
/**
* This is a 2 pole lowpass Chebyshev (recursive) filter at fc=0.075 using coefficients found in table 20-1 of
* http://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch20.pdf
*
* At the interpolated sampling frequency of 48 kHz the -3 dB corner is at 48 * .075 = 3.6 kHz which is perfect for voice
*
* a0= 3.869430E-02
* a1= 7.738860E-02 b1= 1.392667E+00
* a2= 3.869430E-02 b2= -5.474446E-01
*
* given x[n] is the new input sample and y[n] the returned output sample:
*
* y[n] = a0*x[n] + a1*x[n] + a2*x[n] + b1*y[n-1] + b2*y[n-2]
*
* This one works directly with floats
*
*/
class MBEAudioInterpolatorFilter
{
public:
MBEAudioInterpolatorFilter();
~MBEAudioInterpolatorFilter();
void init();
float run(float sample);
private:
float m_x[2];
float m_y[2];
static const float m_a0, m_a1, m_a2, m_b1, m_b2;
};
#endif /* SDRBASE_DSP_FILTERMBE_H_ */