|
libsdr
0.1.0
A simple SDR library
|
This class performs several operations on the complex (integral) input stream, it first filters out some part of the input stream using a FIR band pass (band pass is centerred around Ff with width width) then shifts the center frequency Fc to 0 and finally sub-samples the resulting stream.
More...
#include <baseband.hh>
Public Types | |
| typedef std::complex< Scalar > | CScalar |
| The complex type of the input stream. More... | |
| typedef int32_t | SScalar |
| The (real) computation scalar type (super scalar), the computations are performed with this scalar type. More... | |
| typedef std::complex< SScalar > | CSScalar |
Complex SScalar type. 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 | |
| IQBaseBand (double Fc, double width, size_t order, size_t sub_sample, double oFs=0.0) | |
Constructor, the filter center frequency Ff equals the given center frequency Fc. More... | |
| IQBaseBand (double Fc, double Ff, double width, size_t order, size_t sub_sample, double oFs=0.0) | |
| Constructor. More... | |
| virtual | ~IQBaseBand () |
| Destructor. More... | |
| size_t | order () const |
| Returns the order of the band-pass filter. More... | |
| void | setOrder (size_t o) |
| (Re-) Sets the filter order. More... | |
| double | centerFrequency () const |
| Returns the center frequency. More... | |
| void | setCenterFrequency (double Fc) |
| Resets the center frequency. More... | |
| double | filterFrequency () const |
| Returns the filter frequency. More... | |
| void | setFilterFrequency (double Ff) |
| (Re-) Sets the filter frequency. More... | |
| double | filterWidth () const |
| Returns the filter width. More... | |
| void | setFilterWidth (double width) |
| Sets the filter width. More... | |
| size_t | subSample () const |
| Returns the sub sampling. More... | |
| void | setSubsample (size_t sub_sample) |
| Resets the sub sampling. More... | |
| void | setOutputSampleRate (double Fs) |
| Resets the output sample rate. More... | |
| virtual void | config (const Config &src_cfg) |
| Configures the BaseBand node. More... | |
| virtual void | process (const Buffer< std::complex< Scalar > > &buffer, bool allow_overwrite) |
| Processes the given buffer. More... | |
Public Member Functions inherited from sdr::Sink< std::complex< 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... | |
| virtual void | setSampleRate (double Fs) |
| Sets the sample rate and updates the LUT. 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 | _reconfigure () |
| Reconfigures the node. More... | |
| void | _process (const Buffer< CScalar > &in, const Buffer< CScalar > &out) |
| Performs the base-band selection, frequency shift and sub-sampling. More... | |
| CSScalar | _filter_ring () const |
| Applies the filter on the data stored in the ring buffer. More... | |
| void | _update_filter_kernel () |
| Updates the band-pass 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 | |
| int32_t | _Fc |
| The frequency shift of the base band. More... | |
| int32_t | _Ff |
| The center frequency of the base band. More... | |
| int32_t | _Fs |
| The input sample rate. More... | |
| int32_t | _width |
| The filter width. More... | |
| size_t | _order |
| The order of the filter. More... | |
| size_t | _sub_sample |
| The number of sample averages for the sub sampling. More... | |
| double | _oFs |
| Holds the desired output sample rate, _sub_sample will be adjusted accordingly. More... | |
| size_t | _ring_offset |
| The current index of the ring buffer. More... | |
| size_t | _sample_count |
| Holds the current number of samples averaged. More... | |
| CSScalar | _last |
Holds the current sum of the last _sample_count samples. More... | |
| size_t | _sourceBs |
| Buffer size of the source. More... | |
| Buffer< CSScalar > | _kernel |
| The filter kernel of order _order. More... | |
| Buffer< CSScalar > | _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... | |
Additional Inherited Members | |
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 complex (integral) input stream, it first filters out some part of the input stream using a FIR band pass (band pass is centerred around Ff with width width) then shifts the center frequency Fc to 0 and finally sub-samples the resulting stream.
This node can be used to select a portion of the input spectrum and for the reduction of the stream rate, allowing for some more expensive operations to be performed on the output stream.
| typedef std::complex<Scalar> sdr::IQBaseBand< Scalar >::CScalar |
The complex type of the input stream.
| typedef std::complex<SScalar> sdr::IQBaseBand< Scalar >::CSScalar |
Complex SScalar type.
| typedef int32_t sdr::IQBaseBand< Scalar >::SScalar |
The (real) computation scalar type (super scalar), the computations are performed with this scalar type.
|
inline |
Constructor, the filter center frequency Ff equals the given center frequency Fc.
|
inline |
Constructor.
|
inlinevirtual |
Destructor.
|
inlineprotected |
Applies the filter on the data stored in the ring buffer.
|
inlineprotected |
Performs the base-band selection, frequency shift and sub-sampling.
Stores the results into out. The input and output buffer may overlapp.
|
inlineprotected |
Reconfigures the node.
|
inlineprotected |
Updates the band-pass filter kernel.
|
inline |
Returns the center frequency.
|
inlinevirtual |
Configures the BaseBand node.
Implements sdr::SinkBase.
|
inline |
Returns the filter frequency.
|
inline |
Returns the filter width.
|
inline |
Returns the order of the band-pass filter.
|
inlinevirtual |
Processes the given buffer.
Implements sdr::Sink< std::complex< Scalar > >.
|
inline |
Resets the center frequency.
|
inline |
(Re-) Sets the filter frequency.
|
inline |
Sets the filter width.
|
inline |
(Re-) Sets the filter order.
|
inline |
Resets the output sample rate.
The sub-sampling will be adjusted accordingly. Please note the the resulting output sample rate will be rounded up to be an integral fraction of the input sample rate.
|
inline |
Resets the sub sampling.
Please note that the Queue needs to be stopped before calling this function!
|
inline |
Returns the sub sampling.
|
protected |
The output buffer.
|
protected |
The frequency shift of the base band.
The filter result will be shifted by -_Fc.
|
protected |
The center frequency of the base band.
|
protected |
The input sample rate.
|
protected |
The filter kernel of order _order.
|
protected |
Holds the current sum of the last _sample_count samples.
|
protected |
Holds the desired output sample rate, _sub_sample will be adjusted accordingly.
|
protected |
The order of the filter.
Must be greater that 0.
|
protected |
A ring buffer of past values.
The band-pass filtering is performed on this buffer.
|
protected |
The current index of the ring buffer.
|
protected |
Holds the current number of samples averaged.
|
protected |
Buffer size of the source.
|
protected |
The number of sample averages for the sub sampling.
_sub_sample==1 means no subsampling.
|
protected |
The filter width.
1.8.9.1