libsdr
0.1.0
A simple SDR library
|
This class performs several operations on the real input stream, It first filters out some part of the input stream using a FIR band pass filter then shifts the center frequency to 0 and finally sub-samples the resulting stream such that the selected base-band is well represented. More...
#include <baseband.hh>
Public Types | |
typedef FreqShiftBase< Scalar >::CScalar | CScalar |
The complex input scalar. More... | |
typedef FreqShiftBase< Scalar >::SScalar | SScalar |
The real super scalar. More... | |
typedef FreqShiftBase< Scalar >::CSScalar | CSScalar |
The complex super scalar. More... | |
Public Types inherited from sdr::FreqShiftBase< Scalar > | |
typedef std::complex< Scalar > | CScalar |
The complex input signal. More... | |
typedef Traits< Scalar >::SScalar | SScalar |
The compute (super) scalar of the input type. More... | |
typedef std::complex< SScalar > | CSScalar |
The complex compute (super) scalar of the input type. More... | |
Public Member Functions | |
BaseBand (double Fc, double width, size_t order, size_t sub_sample) | |
Constructs a new BaseBand instance. More... | |
BaseBand (double Fc, double Ff, double width, size_t order, size_t sub_sample) | |
Constructs a new BaseBand instance. More... | |
virtual | ~BaseBand () |
Destructor. More... | |
virtual void | config (const Config &src_cfg) |
Configures the base band node. More... | |
virtual void | setSampleRate (double Fs) |
Sets the sample rate and updates the LUT. More... | |
virtual void | process (const Buffer< Scalar > &buffer, bool allow_overwrite) |
Processes the input buffer. More... | |
Public Member Functions inherited from sdr::Sink< Scalar > | |
Sink () | |
Constructor. More... | |
virtual | ~Sink () |
Drestructor. More... | |
virtual void | handleBuffer (const RawBuffer &buffer, bool allow_overwrite) |
Re-implemented from SinkBase . More... | |
Public Member Functions inherited from sdr::SinkBase | |
SinkBase () | |
Constructor. More... | |
virtual | ~SinkBase () |
Destructor. More... | |
Public Member Functions inherited from sdr::Source | |
Source () | |
Constructor. More... | |
virtual | ~Source () |
Destructor. More... | |
virtual void | send (const RawBuffer &buffer, bool allow_overwrite=false) |
Sends the given buffer to all connected sinks. More... | |
void | connect (SinkBase *sink, bool direct=false) |
Connect this source to a sink. More... | |
void | disconnect (SinkBase *sink) |
Disconnect a sink again. More... | |
virtual void | setConfig (const Config &config) |
Stores the configuration and propergates it if the configuration has been changed. More... | |
virtual double | sampleRate () const |
Returns the configured sample rate or 0 otherwise. More... | |
virtual Config::Type | type () const |
Returns the configured source type or Config::Type_UNDEFINED otherwise. More... | |
template<class T > | |
void | addEOS (T *instance, void(T::*function)()) |
Adds a callback to the end-of-stream signal of the source. More... | |
Public Member Functions inherited from sdr::FreqShiftBase< Scalar > | |
FreqShiftBase (double F, double Fs) | |
Constructor. More... | |
virtual | ~FreqShiftBase () |
Destructor. More... | |
double | sampleRate () const |
Returns the sample rate. More... | |
double | frequencyShift () const |
Returns the frequency shift. More... | |
virtual void | setFrequencyShift (double F) |
Sets the frequency shift and updates the LUT. More... | |
CSScalar | applyFrequencyShift (CSScalar value) |
Performs the frequency shift on a single sample. More... | |
Protected Member Functions | |
void | _process (const Buffer< Scalar > &in, const Buffer< CScalar > &out) |
Performs the actual procssing. More... | |
CSScalar | _filter_ring () |
Applies the filter on the data stored in the ring buffer. More... | |
void | _update_filter_kernel () |
Calculates or updates the filter kernel. More... | |
Protected Member Functions inherited from sdr::Source | |
void | signalEOS () |
Signals the EOS. More... | |
void | propagateConfig (const Config &config) |
Propagates the given configuration to all connected sinks. More... | |
Protected Member Functions inherited from sdr::FreqShiftBase< Scalar > | |
void | _update_lut_incr () |
Updates the multiplier LUT. More... | |
Protected Attributes | |
double | _Ff |
The center frequency of the band pass filter. More... | |
double | _width |
The width of the band pass filter. More... | |
size_t | _order |
The order of the band pass filter. More... | |
size_t | _sub_sample |
The number of averages taken for subsampling. More... | |
size_t | _ring_offset |
The current index of the ring buffer. More... | |
size_t | _sample_count |
The current number of averages. More... | |
CSScalar | _last |
The current sum of the last _sample_count samples. More... | |
bool | _shift_freq |
If true, Fc!=0 . More... | |
Buffer< CSScalar > | _lut |
look-up table | |
size_t | _lut_inc |
The LUT index increment per (1<<4) samples. More... | |
size_t | _lut_count |
The current LUT index times (1<<4). More... | |
Buffer< CSScalar > | _kernel |
The filter kernel of order _order. More... | |
Buffer< SScalar > | _ring |
A ring buffer of past values. More... | |
Buffer< CScalar > | _buffer |
The output buffer. More... | |
Protected Attributes inherited from sdr::Source | |
Config | _config |
Holds the source configuration, this can be updated by calling setConfig . More... | |
std::map< SinkBase *, bool > | _sinks |
The connected sinks. More... | |
std::list< DelegateInterface * > | _eos |
The connected EOS singal handlers. More... | |
Protected Attributes inherited from sdr::FreqShiftBase< Scalar > | |
double | _freq_shift |
The current frequency shift. More... | |
double | _Fs |
The current sample rate. More... | |
size_t | _lut_inc |
The LUT increment. More... | |
size_t | _lut_count |
The LUT index counter. More... | |
Buffer< CSScalar > | _lut |
The LUT. More... | |
Static Protected Attributes | |
static const size_t | _lut_size =128 |
Size of the look-up table. More... | |
Static Protected Attributes inherited from sdr::FreqShiftBase< Scalar > | |
static const size_t | _lut_size = 128 |
The size of the LUT. More... | |
This class performs several operations on the real input stream, It first filters out some part of the input stream using a FIR band pass filter then shifts the center frequency to 0 and finally sub-samples the resulting stream such that the selected base-band is well represented.
typedef FreqShiftBase<Scalar>::CScalar sdr::BaseBand< Scalar >::CScalar |
The complex input scalar.
typedef FreqShiftBase<Scalar>::CSScalar sdr::BaseBand< Scalar >::CSScalar |
The complex super scalar.
typedef FreqShiftBase<Scalar>::SScalar sdr::BaseBand< Scalar >::SScalar |
The real super scalar.
|
inline |
Constructs a new BaseBand instance.
Fc | Specifies the center frequency of the base band. The resulting signal will be shifted down by this frequency. |
width | Specifies the with of the band pass filter. |
order | Specifies the order of the FIR band pass filter. |
sub_sample | Specifies the sub-sampling of the resulting singnal. |
|
inline |
Constructs a new BaseBand instance.
Fc | Specifies the frequency of the base band. The resulting signal will be shifted down by this frequency. |
Ff | Specifies the center frequency of the band pass filter. |
width | Specifies the with of the band pass filter. |
order | Specifies the order of the FIR band pass filter. |
sub_sample | Specifies the sub-sampling of the resulting singnal. |
|
inlinevirtual |
Destructor.
|
inlineprotected |
Applies the filter on the data stored in the ring buffer.
|
inlineprotected |
Performs the actual procssing.
First, the bandpass filter is applied, then the filtered signal is shifted and finally the signal gets averaged over _sub_sample
samples, implementing the averaging sub-sampling.
|
inlineprotected |
Calculates or updates the filter kernel.
|
inlinevirtual |
|
inlinevirtual |
|
inlinevirtual |
Sets the sample rate and updates the LUT.
Reimplemented from sdr::FreqShiftBase< Scalar >.
|
protected |
The output buffer.
|
protected |
The center frequency of the band pass filter.
|
protected |
The filter kernel of order _order.
|
protected |
The current sum of the last _sample_count
samples.
|
protected |
The current LUT index times (1<<4).
|
protected |
The LUT index increment per (1<<4) samples.
|
staticprotected |
Size of the look-up table.
|
protected |
The order of the band pass filter.
|
protected |
A ring buffer of past values.
|
protected |
The current index of the ring buffer.
|
protected |
The current number of averages.
|
protected |
If true, Fc!=0
.
|
protected |
The number of averages taken for subsampling.
|
protected |
The width of the band pass filter.