analyse de la box meanVariance

Making & changing box plugins and external apps
Post Reply
matthieuG
Posts: 54
Joined: Thu Nov 12, 2009 10:22 am
Location: grenoble

analyse de la box meanVariance

Post by matthieuG »

Hello,

To better understand mecanism and logic of boxes, I took the meanVariance box example. It is linked to this document if you don't have [plugins\sample]. Some Part are still incomplet (in red), that why I post :

LE .H
_The CBox... class CBox inherit the well done plugin :

Code: Select all

class CBoxAlgorithmMeanVariance : public OpenViBEToolkit::TBoxAlgorithm<OpenVibe::Plugins::IBoxAlgorithm > {...};
Then, the standard virtual methods

Code: Select all

virtual void release() ..., virtual OpenViBE::boolean initialize(), virtual OpenViBE::boolean uninitialize(), virtual OpenViBE::boolean processInput(OpenViBE::uint32 ui32InputIndex), virtual OpenViBE::boolean process() ... and some other methods
Endly, the well done macro: _IDerivedFromClass_Final(....)
After, as protected, some parameters are buildt, and proxy for in/output

Code: Select all

OpenViBE::Kernel::IAlgorithmProxy *m_p...
and the handlers

Code: Select all

OpenViBE::Kernel::TParameterHandler<OpenViBE::IMemoryBuffer*>

_The CBox_Desc.... class inherit IBoxAlgorithmDesc
Then,the standard virtual methods which begin with get_...(name), next getCreatedClass, create and getBoxPrototype which define the BoxContext.
And endly the well done macro: _IDerivedFromClass_Final(....)

up to here, all seems to be ok, it is easy to follow (if the macro is accepted).

LE .CPP
initialize()
The three proxy have been instantiated with an algorithm from a list:

Code: Select all

(*3) Decoder=&getAlgorithmManager().getAlgorithm(getAlgorithmManager().createAlgorithm(REF_Algo));
Decoder->initialize()
Then, it is the pipes of handler installation :

Code: Select all

EBMLMemHandle.initialize(decoder->getInputParameter(Ref))
Retrievement of Box Parameter (settings) for initialization

Code: Select all

getStaticBoxContext().getSettingValue(0,m_sDSPConfigurationFilename);
getStaticBoxContext().getSettingValue(1,m_sMinMaxConfigurationFilename);
...

uninitialize()
...in the same manner ...


processInput()
box is marked as ready ti process data


process()
Retrievement of matrix in box context:

Code: Select all

IBoxIO& l_r_Dyn...=this->getDynamicBoxContext()
then loop on chunk of matrix in te first input (the only one, the 0th) :

Code: Select all

for(uint32 j=0; j<l_rDynamicBoxContext.getInputChunkCount(0); j++
at each chunk, extract information :

Code: Select all

m_oEBMLMemoryBufferHandleInput1=l_rDynamicBoxContext.getInputChunk(0,j); //...more start and End Time
After, process of information following two ways : either information is Header kind, either it is Buffer kind :

Code: Select all

if(m_pDecoderInput1->isOutputTriggerActive(Ref_Header)) ...
//...
if(m_pDecoderInput1->isOutputTriggerActive(Ref_Buffer)
//...
Header Type: decoding
to force output matrix to be of on two dimension??

Code: Select all

m_oMatrixOutput1Handle->setDimensionCount(2);
m_oMatrixOutput2Handle->setDimensionCount(2)
REtrievement ofinput matrix dimension:

Code: Select all

m_ui32NbChannels=m_oMatrixInput1Handle->getDimensionSize(0);
m_ui32NbSamplesPerBuffer=m_oMatrixInput1Handle->getDimensionSize(1);
update matrix dimension??

Code: Select all

m_f64S1List.resize(m_ui32NbChannels);
m_f64S2List.resize(m_ui32NbChannels);
m_f64N=0
then loop onnumber of matrix?

Code: Select all

for(uint32 i=0; i<m_oMatrixInput1Handle->getDimensionCount();i++)//....
..to force output matrix dimension:

Code: Select all

m_oMatrixOutput1Handle->setDimensionSize(0,m_ui32NbChannels);
m_oMatrixOutput1Handle->setDimensionSize(1,1);
endly, push signals in handlers ? :

Code: Select all

 m_oEBMLMemoryBufferHandleOutput1=l_rDynamicBoxContext.getOutpuutChunk(0)
Buffer Type: process algorithm
if time disable process, write messages in a file and go on.
else :
dump data in handlers :

Code: Select all

float64* l_pBufferInput1=m_oMatrixInput1Handle->getBuffer();
update S1, S2, mean :

Code: Select all

uint32 l_ui32Offset=0; 
for(uint32 i=0; i<m_ui32NbChannels; i++){
for(uint32 j=0; j<m_ui32NbSamplesPerBuffer; j++){
//...raise S1, S2
}
}
//raise N
//calculate mean and variance
the encode information through handler ?:

Code: Select all

m_oEBMLMemoryBufferHandleOutput1=l_rDynamicBoxContext.getOutputChunk(0); //...
endly mark Input as used:

Code: Select all

l_rDynamicBoxContext.markInputAsDeprecated(0,j);
Attachments
ovpCBoxAlgorithmMeanVariance.cpp
(9.95 KiB) Downloaded 270 times
ovpCBoxAlgorithmMeanVariance.h
(5.12 KiB) Downloaded 286 times
Last edited by matthieuG on Mon Nov 16, 2009 9:35 am, edited 5 times in total.

yrenard
Site Admin
Posts: 645
Joined: Fri Sep 01, 2006 3:39 pm
Contact:

Re: analyse de la box meanVariance

Post by yrenard »

matthieuG,

please, repost this message in english... I'm waiting for you to do that before removing your message.

Thank you,
Yann

Post Reply