#include <VrSigProc.h>
Inheritance diagram for VrSigProc:
Public Member Functions | |
VrSigProc (int number_of_outputs, unsigned int arg_itype_size, unsigned int arg_type_size) | |
virtual | ~VrSigProc () |
bool | connect_proc (VrSigProc *proc, port n) |
connect our next input to proc's nth output | |
virtual const char * | name () |
default name for a module (override with actual name) | |
virtual int | forecast (VrSampleRange output, VrSampleRange inputs[]) |
map output range to required input ranges | |
virtual float | memoryTouched () |
virtual int | work (VrSampleRange output, void *o[], VrSampleRange inputs[], void *i[])=0 |
Generate up to output.size output points at o[output#][sample#] using data at the inputptrs[input#][sample#]. | |
virtual float | averageInputUse (int n) |
virtual int | checkOutputSamplingFrequency (float) |
bool | isSink () |
return true iff this VrSigProc is a sink | |
virtual int | setSamplingFrequency (double sf) |
virtual bool | dataReady (VrSampleRange r) |
has the data been computed? | |
virtual void | size_setup (unsigned int size) |
virtual void | setup () |
VrSampleIndex | getMarkedWP () |
unsigned int | getMaxOutputSize () |
VrSampleIndex | getWP () |
double | getSamplingFrequency () |
virtual int | callback (int attribute_number, float value) |
Protected Member Functions | |
virtual VrSigProc * | getUpstreamModuleN (port p) |
double | getInputSamplingFrequencyN (port p) |
void | setOutputSize (int o) |
set required multiple for number of items produced | |
unsigned int | getOutputSize () |
void | setup_upstream () |
int | getNumberInputs () |
bool | is_synced (VrSampleIndex arg_index) |
void | sync (VrSampleIndex arg_index) |
force rest of procedure to run sequentially | |
VrSampleIndex | proc_minRP () |
Protected Attributes | |
VrBuffer ** | outBuffer |
unsigned int | maxDSReadSize |
max Down Stream Read Size. How big a read we might get. maxOutSize should never exceed this. | |
unsigned int | numberInputs |
unsigned int | numberOutputs |
Private Member Functions | |
MUTEX_DECLARE (mutex) | |
void | attach_writer (writerLL *r) |
void | detach_writer (writerLL *r) |
void | init_base () |
Cause initialize methods to be called. This is called on all sinks for which isConnectedToSource is true, and results in the pre_initialize and initialize methods being called in the order source to sink. | |
virtual void | pre_initialize () |
Set sampling frequency based on upstream sampling freq. | |
virtual void | initialize () |
Initialize any local state that is dependent on sampling frequency. | |
virtual bool | isConnectedToSource () |
int | minwritespace (VrSampleIndex newWP, unsigned int desired) |
void | initOutputBuffers (int n) |
virtual void | initOutputBuffer (int n) |
void | initMarkedData () |
virtual unsigned int | mapSizeUp (int i, unsigned int size) |
virtual bool | dataMarked (VrSampleRange r) |
is data marked to be computed? | |
virtual int | markData (VrSampleRange r) |
figure out what data to compute | |
virtual int | markDataUpstream (VrSampleRange *inputs, bool *dataMarkedUpstream) |
propagate marking upstream | |
virtual bool | compute () |
compute the marked data | |
Private Attributes | |
int | uses_sync |
double | proc_samplingFrequency |
volatile VrSampleIndex | WP |
data before this has been written | |
volatile VrSampleIndex | markedWP |
data before this has been marked and will be written | |
unsigned int | maxOutSize |
maximum size that we should ever output at once. | |
VrConnect ** | inputConn |
unsigned int | setupCalled |
unsigned int | outputSize |
unsigned int | type_size |
unsigned int | itype_size |
unsigned int | initializeCalled |
VrSampleRange | myMarkedData |
VrSampleRange * | inputs_forecasted |
writerLL * | myWriterLL |
readerLL * | myReaderLLs |
volatile writerLL * | first |
volatile writerLL * | last |
Static Private Attributes | |
const int | MARK_ALREADY = 2 |
all data is already computed | |
const int | MARK_READY = 1 |
data is ready to be computed (and has been marked) | |
const int | MARK_READY_NO_MARK = 0 |
data is ready on this level or above, | |
const int | MARK_NO_READY = -1 |
no data is ready to be computed | |
const int | MARK_THREAD = -2 |
data is marked by another thread | |
const int | MARK_continue = -3 |
flag distinct from all others (keep last) | |
Friends | |
class | VrMultiTask |
All signal processing modules are descendants from VrSigProc. In the simplest case a user defines a subclass of VrSigProc and overrides the forecast and work methods.
|
|
|
|
|
|
|
|
|
|
|
compute the marked data Compute is the second part of the markData / compute dyad. These two methods are called from VrMultiTask::schedule to schedule and compute the work of the signal processing modules. Note that this can run in parallel. All of the scheduling is done in markData, so there is very little overhead or contention here.
|
|
connect our next input to Connect our next input to PROC's Pth output. |
|
is data marked to be computed?
|
|
has the data been computed?
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Cause initialize methods to be called. This is called on all sinks for which isConnectedToSource is true, and results in the pre_initialize and initialize methods being called in the order source to sink.
|
|
|
|
|
Reimplemented in VrGuppiSource< oType >, and GrMC4020Source< oType >. |
|
|
|
|
|
Reimplemented in VrSource< oType >, GrSource, and VrSource< unsigned long >. |
|
return true iff this VrSigProc is a sink
|
|
|
figure out what data to compute markData is the first part of the markData / VrSigProc::compute dyad. These two methods are called from VrMultiTask::schedule to schedule and compute the work of the signal processing modules. markData is called from the downstream side (starting with the sinks) to determine what data to schedule for future computation. Note that markData does NOT run in parallel (VrMultiTask is holding its mutex whenever it calls markData, and is the root of all calls to markData). This function also has many side effects, including sometimes setting startMarkedModule. Really needs to be cleaned up.
Mark data to be computed * initialize pointers to thread-specific marking data * save which range this thread marked * save which input ranges were forcasted as needed for this marking * create our entry in writer linked list * create our entries in the reader linked lists upstream * set the starting module for this compute block to this * |
|
propagate marking upstream This is the embodiment of a bunch of heuristics determining which data to schedule when (Explain this mess.)
|
|
Returns the total number of bytes read (ignores written bytes) per second by the upstream chain ending with this module zero has a special meaning (no outputs in cache) Reimplemented in VrFakeGuppiSource< oType >, VrGuppiSource< oType >, and GrMC4020Source< oType >. |
|
|
|
|
|
|
|
Returns the minimum RP in downstream buffers' readers. computes the most up to date value possible. |
|
set required multiple for number of items produced
|
|
|
|
Reimplemented in VrSink< iType >, GrSink, VrSink< unsigned long >, and VrSink< VrComplex >. |
|
Reimplemented in VrSink< iType >, GrSink, VrSink< unsigned long >, and VrSink< VrComplex >. |
|
|
|
force rest of procedure to run sequentially Call sync (arg_index) from work(...) to ensure the rest of the procedure runs sequentially... |
|
|
|
|
Reimplemented in VrCorr< iType, oType >, VrSyncCorr< iType >, and VrSyncCorr< char >. |
|
|
|
|
|
|
|
|
|
Reimplemented in GrTestSink, GrTestSkippingSink, and GrTestSource. |
|
all data is already computed
|
|
flag distinct from all others (keep last)
|
|
no data is ready to be computed
|
|
data is ready to be computed (and has been marked)
|
|
data is ready on this level or above,
|
|
data is marked by another thread
|
|
data before this has been marked and will be written
|
|
max Down Stream Read Size. How big a read we might get. maxOutSize should never exceed this.
|
|
maximum size that we should ever output at once. due to cache size and latency contraints we may actually output anywhere < 2*maxOutSize to prevent unnecessarily small chunks from being marked |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
data before this has been written
|