Update FilterComponent modules to version 2 of modules' API
This commit is contained in:
1 parent
0baf0c1701
commit
1768d39877
4 files changed
+82
-65
No files matched your search
+28
-26
@@ -267,7 +267,6 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
{
|
||||
dialogWindowsSelection.selectSubWindow( pcVideoSubWindow );
|
||||
}
|
||||
|
||||
if( dialogWindowsSelection.exec() == QDialog::Accepted )
|
||||
{
|
||||
VideoSubWindow *videoSubWindow;
|
||||
@@ -277,7 +276,6 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
||||
videoSubWindowList.append( videoSubWindow );
|
||||
}
|
||||
|
||||
}
|
||||
// Check for same fmt in more than one frame modules
|
||||
for( Int i = 1; i < videoSubWindowList.size(); i++ )
|
||||
@@ -312,31 +310,12 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
if( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_OPTIONS )
|
||||
{
|
||||
ModulesHandleOptDialog moduleOptDialog( m_pcParent, pcCurrModuleIf );
|
||||
moduleOptDialog.runConfiguration();
|
||||
}
|
||||
|
||||
// Create Module
|
||||
Bool moduleCreated = false;
|
||||
if( pcCurrModuleIf->m_pcModule->m_iModuleAPI == MODULE_API_2 )
|
||||
{
|
||||
std::vector<PlaYUVerFrame*> apcFrameList;
|
||||
for( UInt i = 0; i < pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames; i++ )
|
||||
if( moduleOptDialog.runConfiguration() == QDialog::Rejected )
|
||||
{
|
||||
apcFrameList.push_back( pcCurrModuleIf->m_pcSubWindow[i]->getCurrFrame() );
|
||||
qobject_cast<PlaYUVerApp*>( m_pcParent )->printMessage( "Module canceled by user!", LOG_WARNINGS );
|
||||
destroyModuleIf( pcCurrModuleIf );
|
||||
return;
|
||||
}
|
||||
moduleCreated = pcCurrModuleIf->m_pcModule->create( apcFrameList );
|
||||
}
|
||||
else if( pcCurrModuleIf->m_pcModule->m_iModuleAPI == MODULE_API_1 )
|
||||
{
|
||||
pcCurrModuleIf->m_pcModule->create( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() );
|
||||
moduleCreated = true;
|
||||
}
|
||||
|
||||
if( !moduleCreated )
|
||||
{
|
||||
qobject_cast<PlaYUVerApp*>( m_pcParent )->printMessage( "Error! Module cannot be applied", LOG_ERROR );
|
||||
destroyModuleIf( pcCurrModuleIf );
|
||||
return;
|
||||
}
|
||||
|
||||
if( pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_PROCESSING_MODULE )
|
||||
@@ -354,7 +333,6 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
|
||||
pcCurrModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow;
|
||||
}
|
||||
|
||||
}
|
||||
else if( pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE )
|
||||
{
|
||||
@@ -385,6 +363,30 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf )
|
||||
}
|
||||
}
|
||||
|
||||
// Create Module
|
||||
Bool moduleCreated = false;
|
||||
if( pcCurrModuleIf->m_pcModule->m_iModuleAPI == MODULE_API_2 )
|
||||
{
|
||||
std::vector<PlaYUVerFrame*> apcFrameList;
|
||||
for( UInt i = 0; i < pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames; i++ )
|
||||
{
|
||||
apcFrameList.push_back( pcCurrModuleIf->m_pcSubWindow[i]->getCurrFrame() );
|
||||
}
|
||||
moduleCreated = pcCurrModuleIf->m_pcModule->create( apcFrameList );
|
||||
}
|
||||
else if( pcCurrModuleIf->m_pcModule->m_iModuleAPI == MODULE_API_1 )
|
||||
{
|
||||
pcCurrModuleIf->m_pcModule->create( pcCurrModuleIf->m_pcSubWindow[0]->getCurrFrame() );
|
||||
moduleCreated = true;
|
||||
}
|
||||
|
||||
if( !moduleCreated )
|
||||
{
|
||||
qobject_cast<PlaYUVerApp*>( m_pcParent )->printMessage( "Error! Module cannot be applied", LOG_ERROR );
|
||||
destroyModuleIf( pcCurrModuleIf );
|
||||
return;
|
||||
}
|
||||
|
||||
applyModuleIf( pcCurrModuleIf, false, true );
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
|
||||
+25
-13
@@ -34,10 +34,11 @@ FilterComponentModule::FilterComponentModule()
|
||||
m_pcFilteredFrame = NULL;
|
||||
}
|
||||
|
||||
Void FilterComponentModule::createFilter( UInt uiWidth, UInt uiHeight, UInt bitsPixel )
|
||||
Bool FilterComponentModule::createFilter( UInt uiWidth, UInt uiHeight, UInt bitsPixel )
|
||||
{
|
||||
m_pcFilteredFrame = NULL;
|
||||
m_pcFilteredFrame = new PlaYUVerFrame( uiWidth, uiHeight, PlaYUVerFrame::GRAY, bitsPixel );
|
||||
return true;
|
||||
}
|
||||
|
||||
PlaYUVerFrame* FilterComponentModule::filterComponent( PlaYUVerFrame* InputFrame, Int Component )
|
||||
@@ -58,6 +59,7 @@ Void FilterComponentModule::destroy()
|
||||
FilterComponentLuma::FilterComponentLuma()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = MODULE_API_2;
|
||||
m_iModuleType = FRAME_PROCESSING_MODULE; // Apply module to the frames or to the whole sequence.
|
||||
// Currently only support for frame
|
||||
m_pchModuleCategory = "FilterComponent"; // Category (sub-menu)
|
||||
@@ -68,19 +70,20 @@ FilterComponentLuma::FilterComponentLuma()
|
||||
// Several requirements should be "or" between each others.
|
||||
}
|
||||
|
||||
Void FilterComponentLuma::create( PlaYUVerFrame* InputFrame )
|
||||
Bool FilterComponentLuma::create( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
{
|
||||
createFilter( InputFrame->getWidth(), InputFrame->getHeight(), InputFrame->getBitsPel() );
|
||||
return createFilter( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), apcFrameList[0]->getBitsPel() );
|
||||
}
|
||||
|
||||
PlaYUVerFrame* FilterComponentLuma::process( PlaYUVerFrame* InputFrame )
|
||||
PlaYUVerFrame* FilterComponentLuma::process( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
{
|
||||
return filterComponent( InputFrame, LUMA );
|
||||
return filterComponent( apcFrameList[0], LUMA );
|
||||
}
|
||||
|
||||
FilterComponentChromaU::FilterComponentChromaU()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = MODULE_API_2;
|
||||
m_iModuleType = FRAME_PROCESSING_MODULE;
|
||||
m_pchModuleCategory = "FilterComponent";
|
||||
m_pchModuleName = "ChromaU";
|
||||
@@ -89,19 +92,24 @@ FilterComponentChromaU::FilterComponentChromaU()
|
||||
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING;
|
||||
}
|
||||
|
||||
Void FilterComponentChromaU::create( PlaYUVerFrame* InputFrame )
|
||||
Bool FilterComponentChromaU::create( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
{
|
||||
createFilter( InputFrame->getChromaWidth(), InputFrame->getChromaHeight(), InputFrame->getBitsPel() );
|
||||
if( apcFrameList[0]->getNumberChannels() > 1 )
|
||||
{
|
||||
return createFilter( apcFrameList[0]->getChromaWidth(), apcFrameList[0]->getChromaHeight(), apcFrameList[0]->getBitsPel() );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
PlaYUVerFrame* FilterComponentChromaU::process( PlaYUVerFrame* InputFrame )
|
||||
PlaYUVerFrame* FilterComponentChromaU::process( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
{
|
||||
return filterComponent( InputFrame, CHROMA_U );
|
||||
return filterComponent( apcFrameList[0], CHROMA_U );
|
||||
}
|
||||
|
||||
FilterComponentChromaV::FilterComponentChromaV()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleAPI = MODULE_API_2;
|
||||
m_iModuleType = FRAME_PROCESSING_MODULE;
|
||||
m_pchModuleCategory = "FilterComponent";
|
||||
m_pchModuleName = "ChromaV";
|
||||
@@ -110,14 +118,18 @@ FilterComponentChromaV::FilterComponentChromaV()
|
||||
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING;
|
||||
}
|
||||
|
||||
Void FilterComponentChromaV::create( PlaYUVerFrame* InputFrame )
|
||||
Bool FilterComponentChromaV::create( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
{
|
||||
createFilter( InputFrame->getChromaWidth(), InputFrame->getChromaHeight(), InputFrame->getBitsPel() );
|
||||
if( apcFrameList[0]->getNumberChannels() > 1 )
|
||||
{
|
||||
return createFilter( apcFrameList[0]->getChromaWidth(), apcFrameList[0]->getChromaHeight(), apcFrameList[0]->getBitsPel() );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
PlaYUVerFrame* FilterComponentChromaV::process( PlaYUVerFrame* InputFrame )
|
||||
PlaYUVerFrame* FilterComponentChromaV::process( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
{
|
||||
return filterComponent( InputFrame, CHROMA_V );
|
||||
return filterComponent( apcFrameList[0], CHROMA_V );
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
+13
-13
@@ -39,48 +39,48 @@ public:
|
||||
virtual ~FilterComponentModule()
|
||||
{
|
||||
}
|
||||
Void create( PlaYUVerFrame* ) = 0;
|
||||
PlaYUVerFrame* process( PlaYUVerFrame* ) = 0;
|
||||
Bool create( std::vector<PlaYUVerFrame*> apcFrameList ) = 0;
|
||||
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList ) = 0;
|
||||
Void destroy();
|
||||
|
||||
Void createFilter( UInt uiWidth, UInt uiHeight, UInt bitsPixel );
|
||||
PlaYUVerFrame* filterComponent( PlaYUVerFrame* InputFrame, Int Component );
|
||||
Bool createFilter( UInt uiWidth, UInt uiHeight, UInt bitsPixel );
|
||||
PlaYUVerFrame* filterComponent( PlaYUVerFrame* InputFrame, Int Component );
|
||||
};
|
||||
|
||||
class FilterComponentLuma: public FilterComponentModule
|
||||
{
|
||||
REGISTER_CLASS_FACTORY( FilterComponentLuma )
|
||||
REGISTER_CLASS_FACTORY( FilterComponentLuma )
|
||||
public:
|
||||
FilterComponentLuma();
|
||||
virtual ~FilterComponentLuma()
|
||||
{
|
||||
}
|
||||
Void create( PlaYUVerFrame* InputFrame );
|
||||
PlaYUVerFrame* process( PlaYUVerFrame* InputFrame );
|
||||
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
|
||||
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
|
||||
};
|
||||
|
||||
class FilterComponentChromaU: public FilterComponentModule
|
||||
{
|
||||
REGISTER_CLASS_FACTORY( FilterComponentChromaU )
|
||||
REGISTER_CLASS_FACTORY( FilterComponentChromaU )
|
||||
public:
|
||||
FilterComponentChromaU();
|
||||
virtual ~FilterComponentChromaU()
|
||||
{
|
||||
}
|
||||
Void create( PlaYUVerFrame* InputFrame );
|
||||
PlaYUVerFrame* process( PlaYUVerFrame* InputFrame );
|
||||
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
|
||||
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
|
||||
};
|
||||
|
||||
class FilterComponentChromaV: public FilterComponentModule
|
||||
{
|
||||
REGISTER_CLASS_FACTORY( FilterComponentChromaV )
|
||||
REGISTER_CLASS_FACTORY( FilterComponentChromaV )
|
||||
public:
|
||||
FilterComponentChromaV();
|
||||
virtual ~FilterComponentChromaV()
|
||||
{
|
||||
}
|
||||
Void create( PlaYUVerFrame* InputFrame );
|
||||
PlaYUVerFrame* process( PlaYUVerFrame* InputFrame );
|
||||
Bool create( std::vector<PlaYUVerFrame*> apcFrameList );
|
||||
PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> apcFrameList );
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
+16
-13
@@ -103,36 +103,39 @@ public:
|
||||
}
|
||||
|
||||
virtual void Delete() = 0;
|
||||
virtual Void destroy() = 0;
|
||||
|
||||
virtual Void create()
|
||||
{
|
||||
}
|
||||
/**
|
||||
* Module API version 1
|
||||
*/
|
||||
virtual Void create( PlaYUVerFrame* )
|
||||
{
|
||||
}
|
||||
virtual Bool create( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual PlaYUVerFrame* process( PlaYUVerFrame* )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
virtual PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
virtual Double measure( PlaYUVerFrame* )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Module API version 2
|
||||
*/
|
||||
virtual Bool create( std::vector<PlaYUVerFrame*> apcFrameList )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
virtual PlaYUVerFrame* process( std::vector<PlaYUVerFrame*> )
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
virtual Double measure( std::vector<PlaYUVerFrame*> )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
virtual Void destroy() = 0;
|
||||
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
Reference in new issue
Block a user