Open jgottula opened 10 years ago
Wanted to double-check that the type system supports an important case I hadn't thought of until today. For some DSP operations, there is a notion of framing where data is processed in discrete frames with well-defined boundaries. In other words, not only does the block need to process N samples at a time, but those N samples need to be aligned to frame boundaries. Examples could include images, block codes, OSI Layer 2 frame structures, etc. For these types of DSP operations, it is more convenient to keep all the samples belonging to a frame together and pass them around as a discrete unit, rather than trying to attach some kind of metadata to identify the frame boundaries. For example, a frame could be a vector<int64_t>
of some size. Noodles doesn't need to enforce or even know about the size of these vectors, but it would just treat each vector like it's a single sample. I'm pretty sure this should "just work," but I wanted to double check.
I think it'll "just work". But I have been working under the assumption that we would be safe to use sample types by-value (i.e. copying and whatnot), which could potentially be slow/dumb for vector<>.
On Thursday, December 11, 2014, Brett Gottula notifications@github.com wrote:
Wanted to double-check that the type system supports an important case I hadn't thought of until today. For some DSP operations, there is a notion of framing where data is processed in discrete frames with well-defined boundaries. In other words, not only does the block need to process N samples at a time, but those N samples need to be aligned to frame boundaries. Examples could include images, block codes, OSI Layer 2 frame structures, etc. For these types of DSP operations, it is more convenient to keep all the samples belonging to a frame together and pass them around as a discrete unit, rather than trying to attach some kind of metadata to identify the frame boundaries. For example, a frame could be a vector
of some size. Noodles doesn't need to enforce or even know about the size of these vectors, but it would just treat each vector like it's a single sample. I'm pretty sure this should "just work," but I wanted to double check. — Reply to this email directly or view it on GitHub https://github.com/bgottula/noodles/issues/30#issuecomment-66679947.
making it work
class Block
needs to store all of the ports in amap<string, Port *>
so that debugging/GUI code can easily iterate over all ports and determine their names and typesBlock
subclasses will need to doREGISTER_PORT()
to put them in that mapPort *
isInputPort<int>
that is referenced thru aPort*
, can we go backwards and determine that it is anInputPort<int>
in a non-dumb way with some kind of runtime type info?class Noodle<T>
, use locks no matter whatT
isstd::to_string
function to convert unknownT
to string forprintf
to_string
std::string to_string(const Fxp& value)
std::string to_string(const CFxp& value)
Port
s will need a pointer to theBlock
instance that owns themPort.h
needs to depend onPort.cpp
, etc.)Port.h
andPortT.h
(the latter has template function implementations)Port
,IPort
,OPort
,InputPort<T>
,OutputPort<T>
NoodleBase
,Noodle<T>
,QNoodle<T>
,RNoodle<T>
maybe
class InputPorts
andclass OutputPorts
:operator[const char *]
which returns a reference/pointer to thePort
instance with the given name (can throw exceptions of course)InputPorts
toInputPortSet
andOutputPorts
toOutputPortSet
std::string
rather thanconst char *
as map key form_names
work
function could have a static local variable:static auto in_port = inputs["theinput"]
and thenceforth usein_port
directlyPorts.cpp
andPorts.h
toPort.cpp
andPort.h
extra stuff we should probably do now while we're rewriting everything
class Block
that has otherBlock
subclasses, whosework
function just passes inputs and outputs between its top-level ports and its sub-blocks' ports?class BlockGroup
with yet another bunch of setup functions and stuffdone
class InputPort<T>
andclass OutputPort<T>
(probably subclassed fromPort<T>
)put
get
etc. intoclass InputPort<T>
andclass OutputPort<T>
class Noodle
toclass Noodle<T>
(usequeue<T>
with same type param)class Noodle<T>
'sfrom
andto
should now beOutputPort<T> *
orInputPort<T> *
pointers (no moreBlock *
+ index nonsense!)planning
InputPort
andOutputPort
classes into theBlock
subclasss implementation?InputPorts
orOutputPorts
InputPorts
andOutputPorts
classes at all anymorePort
s need to be public so we can get a pointer and connect up the noodle?class Connector
; it will have one static instance with a static function that sets up all the noodles and stuff; everyBlock
subclass will need to includefriend class Connector
(ugh)Connector
ever does with theInputPort
s andOutputPort
s is connect them up, otherwise we could really screw up our thread safety assumptions