Add a macro to perform basic verification to frame input list of modules

This commit is contained in:
jfmcarreira committed 2015-04-06 00:51:27 +01:00
1 parent de1606e302
commit 155d54d3bd
4 files changed
+16 -2

No files matched your search

+1
View File
@@ -43,6 +43,7 @@ AbsoluteFrameDifference::AbsoluteFrameDifference()
Bool AbsoluteFrameDifference::create( std::vector<PlaYUVerFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcFrameDifference = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
return true;
}
+1
View File
@@ -57,6 +57,7 @@ DisparityStereoVar::DisparityStereoVar()
Bool DisparityStereoVar::create( std::vector<PlaYUVerFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcDisparityFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
m_cStereoVar.minDisp = -( ( ( apcFrameList[0]->getWidth() / 8 ) + 15 ) & -16 );
return true;
+1
View File
@@ -44,6 +44,7 @@ FrameDifference::FrameDifference()
Bool FrameDifference::create( std::vector<PlaYUVerFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
UInt bitsPixel = ( apcFrameList[0]->getBitsPel() + 1 ) & 0x0F;
m_iMaxDiffValue = ( 1 << ( bitsPixel - 1 ) );
m_pcFrameDifference = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY, bitsPixel );
+13 -2
View File
@@ -39,6 +39,13 @@ public: \
static PlaYUVerModuleIf* Create() { return new X(); } \
void Delete() { delete this; }
#define _BASIC_MODULE_API_2_CHECK_ \
if( apcFrameList.size() != m_uiNumberOfFrames ) \
return false; \
for( UInt i = 0; i < apcFrameList.size(); i++ ) \
if( !apcFrameList[i] ) \
return false;
enum // Module API
{
MODULE_API_1,
@@ -57,8 +64,11 @@ enum // Module type
enum Module_NumberOfFrames
{
MODULE_REQUIRES_ONE_FRAME = 1,
MODULE_REQUIRES_TWO_FRAMES = 2,
MODULE_REQUIRES_THREE_FRAMES = 3,
MODULE_REQUIRES_TWO_FRAMES,
MODULE_REQUIRES_THREE_FRAMES,
MODULE_REQUIRES_FOUR_FRAMES,
MODULE_REQUIRES_FIVE_FRAMES,
MODULE_REQUIRES_SIX_FRAMES,
};
enum Module_Requirements
@@ -86,6 +96,7 @@ public:
PlaYUVerModuleIf()
{
m_iModuleAPI = MODULE_API_1;
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING;
}
virtual ~PlaYUVerModuleIf()
{