Add support for modules to use Dock widgets to show the result.

Add PSNR measurement as an example
This commit is contained in:
jfmcarreira committed 2014-06-27 05:19:51 +01:00
1 parent 7e53296cfa
commit fee9f0b161
8 files changed
+284 -35

No files matched your search

+36 -13
View File
@@ -31,6 +31,7 @@ namespace plaYUVer
PlaYUVerModuleIf::PlaYUVerModuleIf() :
m_pcAction( NULL ),
m_pcDisplaySubWindow( NULL ),
m_pcDockWidget( NULL ),
m_pcModuleDock( NULL ),
m_pcModuleStream( NULL ),
m_pcProcessedFrame( NULL )
@@ -43,28 +44,50 @@ PlaYUVerModuleIf::PlaYUVerModuleIf() :
void PlaYUVerModuleIf::run()
{
switch( m_cModuleDef.m_uiNumberOfFrames )
m_pcProcessedFrame = NULL;
m_dMeasurementResult = 0;
if( m_cModuleDef.m_iModuleType == FRAME_PROCESSING_MODULE )
{
case MODULE_REQUIRES_ONE_FRAME:
m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame() );
break;
case MODULE_REQUIRES_TWO_FRAMES:
m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() );
break;
case MODULE_REQUIRES_THREE_FRAMES:
m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() );
break;
switch( m_cModuleDef.m_uiNumberOfFrames )
{
case MODULE_REQUIRES_ONE_FRAME:
m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame() );
break;
case MODULE_REQUIRES_TWO_FRAMES:
m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() );
break;
case MODULE_REQUIRES_THREE_FRAMES:
m_pcProcessedFrame = process( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() );
break;
}
}
postProgress( true, m_pcProcessedFrame );
else if( m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE )
{
switch( m_cModuleDef.m_uiNumberOfFrames )
{
case MODULE_REQUIRES_ONE_FRAME:
m_dMeasurementResult = measure( m_pcSubWindow[0]->getCurrFrame() );
break;
case MODULE_REQUIRES_TWO_FRAMES:
m_dMeasurementResult = measure( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame() );
break;
case MODULE_REQUIRES_THREE_FRAMES:
m_dMeasurementResult = measure( m_pcSubWindow[0]->getCurrFrame(), m_pcSubWindow[1]->getCurrFrame(), m_pcSubWindow[2]->getCurrFrame() );
break;
}
}
postProgress( true, m_pcProcessedFrame, m_dMeasurementResult );
}
Void PlaYUVerModuleIf::postProgress( Bool success, PlaYUVerFrame* pcProcessedFrame )
Void PlaYUVerModuleIf::postProgress( Bool success, PlaYUVerFrame* pcProcessedFrame, Double moduleResult )
{
EventData *eventData = new EventData();
eventData->m_bSuccess = success;
eventData->m_pcProcessedFrame = pcProcessedFrame;
eventData->m_dMeasurementResult = moduleResult;
eventData->m_pcModule = this;
if( parent() && pcProcessedFrame )
if( parent() && ( pcProcessedFrame || moduleResult ) )
QCoreApplication::postEvent( parent(), eventData );
}