BoxAlgorithm data flow question CBoxAlgorithmConfusionMatrix

Making & changing box plugins and external apps
Post Reply
BorisM
Posts: 1
Joined: Wed Sep 30, 2015 1:02 pm

BoxAlgorithm data flow question CBoxAlgorithmConfusionMatrix

Post by BorisM »

Hi,

I am a total newbie to OpenViBE.
I am trying to develop C++ plugin, more precisely a (Box)Algorithm that takes a Streamed Matrix as input, and produce a Streamed Matrix as output.
I have read the box plugins implementation algorithms, and looked at the code of the CBoxAlgorithmConfusionMatrix plugin as an example.
I am not sure I get (yet) all the plumbing necessary to pass around the data chunks between the BoxAlgorithm and the(s) Algorithm(s), and also between the BoxAlgorithm and the rest of the scenario.

For example, in CBoxAlgorithmConfusionMatrix::process(), there is the following code [openvibe 1.0.1 or git] :

Code: Select all

		TParameterHandler < IMemoryBuffer* > l_oOutputMemoryBufferHandle(m_pConfusionMatrixEncoder->getOutputParameter(OVP_GD_Algorithm_StreamedMatrixStreamEncoder_OutputParameterId_EncodedMemoryBuffer));
		l_oOutputMemoryBufferHandle=l_rDynamicBoxContext.getOutputChunk(0);

I don't understand why the l_oOutputMemoryBufferHandler local variable is necessary. It is not used anywhere else.
However, if this code is commented out, the BoxAlgorithm does not send anything to the following box (the MatrixDisplay linked to it in my scenario does not display anything).

Could you explain why this code is necessary ? Or refer me to the appropriate documentation ...

Thanks.
[I on linux (Ubuntu 14.04.3), I compile git head in RelWithDebInfo mode]

jtlindgren
Posts: 775
Joined: Tue Dec 04, 2012 3:53 pm
Location: INRIA Rennes, FRANCE

Re: BoxAlgorithm data flow question CBoxAlgorithmConfusionMa

Post by jtlindgren »

Hi Boris, welcome aboard!

Over the years, there have been evolving set of conventions of how to handle the data passing between boxes. Some boxes, like the confusion matrix box, still use old, quite complicated conventions. We haven't had the time to refactor these boxes. The currently recommended practice is described in this tutorial,

http://openvibe.inria.fr/tutorial-1-imp ... ssing-box/

If you prefer instead to work by customizing an existing box -- which is my preferred approach -- one of the simplest boxes which follow the new codec conventions is the Signal Average box. Try taking a look at that.

ps. to answer your question, assigning to the local variable actually changes m_pConfusionMatrixEncoder by some C++ overloading magic. But with the new conventions this knowledge should not needed (but you might need to pay attention that sometimes code seems to assign to a getter function -- this works if the getter returns a reference).

Hope this helps,
Jussi

Post Reply