SatDump 2.0.0-alpha-76a915210
Loading...
Searching...
No Matches
satdump::ndsp::CorrectIQBlock< T > Class Template Reference

Simple Correct IQ block (removes a DC spike). More...

#include <correct_iq.h>

Inheritance diagram for satdump::ndsp::CorrectIQBlock< T >:
satdump::ndsp::BlockSimple< T, T > satdump::ndsp::Block

Public Member Functions

uint32_t process (T *input, uint32_t nsamples, T *output)
 Simplified "work" function, called automatically by work(). This takes away all boilerplate work usually needed, making simpler block implementations more trivial to work with.
void init ()
 Applies current parameters to the block. This is called automatically once in start(), but may also be called manually by the block as needed.
nlohmann::json get_cfg (std::string key)
 Get parameters of the block as JSON.
Block::cfg_res_t set_cfg (std::string key, nlohmann::json v)
 Set parameters of the block from JSON, including potentially IO configurations for blocks that may have variable output sizes. However, you likely should implemenet that in a separate function as well (eg, addVFO or such) for it to be easy to be done in C++ directly, and using said function here. Optionally, this can also be made to be functional while the block is running!
Public Member Functions inherited from satdump::ndsp::BlockSimple< T, T >
 BlockSimple (std::string id, std::vector< BlockIO > in={}, std::vector< BlockIO > out={})
Public Member Functions inherited from satdump::ndsp::Block
std::vector< BlockIOget_inputs ()
 Get the block's input configurations and streams. You should not modify them.
std::vector< BlockIOget_outputs ()
 Get the block's output configurations and streams. You should not modify them.
void set_input (BlockIO f, int i)
 Link an input to an output stream of some sort. This also checks the type of the BlockIO to ensure (some level of) compatibility.
BlockIO get_output (int i, int nbuf)
 Get one of the block's outputs, creating the fifo it if nbuf != 0.
void link (Block *ptr, int output_index, int input_index, int nbuf)
 Link a block's output to another input, more or less just a warper around set_input and set_output.
 Block (std::string id, std::vector< BlockIO > in={}, std::vector< BlockIO > out={})
 Generic constructor, to be overloaded.
virtual nlohmann::ordered_json get_cfg_list ()
 Get parameters LIST of the block's parameters. This does not contain actual values, only a description of what is available. This will contains a name, optionally description, its type and range if applicable, string options and so on. This must be re-pulled in several cases :
nlohmann::json get_cfg ()
 Get parameters of the block as JSON. Unlike get_cfg(key), this returns every single available parameter as declared by get_cfg_list().
cfg_res_t set_cfg (nlohmann::json v)
 Set parameters of the block from JSON. Essentially the same as set_cfg(key, v), except this will set any number of them at once.
virtual void start ()
 Starts this block's internal thread and loop.
virtual void stop (bool stop_now=false)
 Stops the block, or rather tells the internal loop it should exit & joins the thread to wait. TODOREWORK, potentially allow sending the terminator as well to force-quit.

Additional Inherited Members

Public Types inherited from satdump::ndsp::Block
enum  cfg_res_t { RES_OK = 0 , RES_LISTUPD = 1 , RES_IOUPD = 2 , RES_ERR = 3 }
 set_cfg status. More...
Public Attributes inherited from satdump::ndsp::Block
const std::string d_id
Protected Member Functions inherited from satdump::ndsp::Block
bool is_work_running ()
template<typename T>
void setValFromJSONIfExists (T &v, nlohmann::json p)
Protected Attributes inherited from satdump::ndsp::Block
std::vector< BlockIOinputs
std::vector< BlockIOoutputs
bool work_should_exit
 Used to signal to a block it should exit in order to stop(). Usually only needed in sources.

Detailed Description

template<typename T>
class satdump::ndsp::CorrectIQBlock< T >

Simple Correct IQ block (removes a DC spike).

This is the simplest implementation I thought of. A DC component will be a constant offset in the raw samples, so correcting for it is as simple as getting the average value (which in a normal situation should be close to 0), and substract it.

It just removes a DC spike using the a moving average, respecting each stream type.

Parameters
alpha0.0001
beta0
acc0

Member Function Documentation

◆ get_cfg()

template<typename T>
nlohmann::json satdump::ndsp::CorrectIQBlock< T >::get_cfg ( std::string key)
inlinevirtual

Get parameters of the block as JSON.

Parameters
keythe parameter to retrieve
Returns
requested parameter value

Implements satdump::ndsp::Block.

◆ init()

template<typename T>
void satdump::ndsp::CorrectIQBlock< T >::init ( )
inlinevirtual

Applies current parameters to the block. This is called automatically once in start(), but may also be called manually by the block as needed.

Reimplemented from satdump::ndsp::Block.

◆ process()

template<typename T>
uint32_t satdump::ndsp::CorrectIQBlock< T >::process ( T * input,
uint32_t nsamples,
T * output )
virtual

Simplified "work" function, called automatically by work(). This takes away all boilerplate work usually needed, making simpler block implementations more trivial to work with.

The number of output samples MUST be <= nsamples!

Parameters
inputinput sample buffer
nsamplesnumber of input samples
outputoutput sample byffer
Returns
number of output samples (<= nsamples)

Implements satdump::ndsp::BlockSimple< T, T >.

◆ set_cfg()

template<typename T>
Block::cfg_res_t satdump::ndsp::CorrectIQBlock< T >::set_cfg ( std::string key,
nlohmann::json v )
inlinevirtual

Set parameters of the block from JSON, including potentially IO configurations for blocks that may have variable output sizes. However, you likely should implemenet that in a separate function as well (eg, addVFO or such) for it to be easy to be done in C++ directly, and using said function here. Optionally, this can also be made to be functional while the block is running!

Parameters
keyparameter to set
vvalue to set
Returns
error code or status.

Implements satdump::ndsp::Block.


The documentation for this class was generated from the following files:
  • src-core/dsp/utils/correct_iq.h
  • src-core/dsp/utils/correct_iq.cpp