diff --git a/app/ModuleHandleDock.cpp b/app/ModuleHandleDock.cpp index 6d0557e..8de18ea 100644 --- a/app/ModuleHandleDock.cpp +++ b/app/ModuleHandleDock.cpp @@ -34,13 +34,10 @@ ModuleHandleDock::ModuleHandleDock( QWidget* parent, PlaYUVerAppModuleIf* module QWidget( parent ), m_pcCurrModuleIf( moduleIf ) { - - PlaYUVerModuleDefinition ModuleDef = moduleIf->m_pcModule->getModuleDefinition(); - // ----------------- Dock definition ----------------- QString labelStr; - labelStr.append( ModuleDef.m_pchModuleName ); + labelStr.append( moduleIf->m_pcModule->m_pchModuleName ); labelStr.append( " Result:" ); labelModulueValueLabel = new QLabel( labelStr ); labelModulueValueLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 0b9ff9e..9117676 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -95,11 +95,11 @@ QMenu* ModulesHandle::createMenu() ModuleIfInternalName = QString::fromLocal8Bit( it->first ); currSubMenu = NULL; - if( pcCurrModuleIf->m_cModuleDef.m_pchModuleCategory ) + if( pcCurrModuleIf->m_pchModuleCategory ) { for( Int j = 0; j < m_pcModulesSubMenuList.size(); j++ ) { - if( m_pcModulesSubMenuList.at( j )->title() == QString( pcCurrModuleIf->m_cModuleDef.m_pchModuleCategory ) ) + if( m_pcModulesSubMenuList.at( j )->title() == QString( pcCurrModuleIf->m_pchModuleCategory ) ) { currSubMenu = m_pcModulesSubMenuList.at( j ); break; @@ -107,13 +107,13 @@ QMenu* ModulesHandle::createMenu() } if( !currSubMenu ) { - currSubMenu = m_pcModulesMenu->addMenu( pcCurrModuleIf->m_cModuleDef.m_pchModuleCategory ); + currSubMenu = m_pcModulesMenu->addMenu( pcCurrModuleIf->m_pchModuleCategory ); m_pcModulesSubMenuList.append( currSubMenu ); } } - currAction = new QAction( pcCurrModuleIf->m_cModuleDef.m_pchModuleName, parent() ); - currAction->setStatusTip( pcCurrModuleIf->m_cModuleDef.m_pchModuleTooltip ); + currAction = new QAction( pcCurrModuleIf->m_pchModuleName, parent() ); + currAction->setStatusTip( pcCurrModuleIf->m_pchModuleTooltip ); currAction->setData( ModuleIfInternalName ); currAction->setCheckable( true ); connect( currAction, SIGNAL( triggered() ), this, SLOT( activateModule() ) ); @@ -223,7 +223,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) QString windowName; QVector subWindowList; - UInt numberOfFrames = pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiNumberOfFrames; + UInt numberOfFrames = pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames; if( numberOfFrames > MODULE_REQUIRES_ONE_FRAME ) // Show dialog to select sub windows { DialogSubWindowSelector dialogWindowsSelection( m_pcParent, m_pcMdiArea, numberOfFrames, numberOfFrames ); @@ -269,7 +269,7 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) } windowName.append( " <" ); - windowName.append( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_pchModuleName ); + windowName.append( pcCurrModuleIf->m_pcModule->m_pchModuleName ); windowName.append( ">" ); for( Int i = 0; i < subWindowList.size(); i++ ) @@ -280,9 +280,9 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) pcCurrModuleIf->m_pcDisplaySubWindow = NULL; - if( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_iModuleType == FRAME_PROCESSING_MODULE ) + if( pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_PROCESSING_MODULE ) { - if( ( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow ) + if( ( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow ) { VideoSubWindow* interfaceChild = new VideoSubWindow( m_pcParent, true ); interfaceChild->setWindowName( windowName ); @@ -295,13 +295,13 @@ Void ModulesHandle::enableModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) m_pcMdiArea->addSubWindow( interfaceChild ); } } - else if( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) + else if( pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE ) { - if( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_SIDEBAR ) + if( pcCurrModuleIf->m_pcModule->m_uiModuleRequirements & MODULE_REQUIRES_SIDEBAR ) { pcCurrModuleIf->m_pcModuleDock = new ModuleHandleDock( m_pcParent, pcCurrModuleIf ); QString titleDockWidget; - titleDockWidget.append( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_pchModuleName ); + titleDockWidget.append( pcCurrModuleIf->m_pcModule->m_pchModuleName ); titleDockWidget.append( " Information" ); pcCurrModuleIf->m_pcDockWidget = new QDockWidget( titleDockWidget, m_pcParent ); pcCurrModuleIf->m_pcDockWidget->setFeatures( QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable ); @@ -376,7 +376,7 @@ Void ModulesHandle::destroyAllModulesIf() Bool ModulesHandle::applyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Bool isPlaying, Bool disableThreads ) { Bool bRet = false; - if( !isPlaying || ( isPlaying && pcCurrModuleIf->m_pcModule->m_cModuleDef.m_bApplyWhilePlaying ) ) + if( !isPlaying || ( isPlaying && pcCurrModuleIf->m_pcModule->m_bApplyWhilePlaying ) ) { #ifdef PLAYUVER_THREADED_MODULES if( !disableThreads ) @@ -385,7 +385,7 @@ Bool ModulesHandle::applyModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Bool isP #endif pcCurrModuleIf->run(); - if( pcCurrModuleIf->m_pcDisplaySubWindow || pcCurrModuleIf->m_pcModule->m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) + if( pcCurrModuleIf->m_pcDisplaySubWindow || pcCurrModuleIf->m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE ) { bRet = true; } @@ -447,7 +447,7 @@ Void ModulesHandle::applyAllModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) } if( pcCurrModuleIf->m_pcModuleStream ) { - UInt numberOfWindows = pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiNumberOfFrames; + UInt numberOfWindows = pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames; UInt64 currFrames = 0; UInt64 numberOfFrames = INT_MAX; for( UInt i = 0; i < numberOfWindows; i++ ) @@ -504,7 +504,7 @@ Bool ModulesHandle::showModuleIf( PlaYUVerAppModuleIf *pcCurrModuleIf, Double mo Void ModulesHandle::swapModulesWindowsIf( PlaYUVerAppModuleIf *pcCurrModuleIf ) { - if( pcCurrModuleIf->m_pcModule->m_cModuleDef.m_uiNumberOfFrames == MODULE_REQUIRES_TWO_FRAMES ) + if( pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames == MODULE_REQUIRES_TWO_FRAMES ) { VideoSubWindow* auxWindowHandle = pcCurrModuleIf->m_pcSubWindow[0]; pcCurrModuleIf->m_pcSubWindow[0] = pcCurrModuleIf->m_pcSubWindow[1]; @@ -522,7 +522,7 @@ Void ModulesHandle::customEvent( QEvent *event ) PlaYUVerAppModuleIf::EventData *eventData = ( PlaYUVerAppModuleIf::EventData* )event; if( eventData->m_bSuccess ) { - switch( eventData->m_pcModule->m_pcModule->m_cModuleDef.m_iModuleType ) + switch( eventData->m_pcModule->m_pcModule->m_iModuleType ) { case FRAME_PROCESSING_MODULE: showModuleIf( eventData->m_pcModule, eventData->m_pcModule->m_pcProcessedFrame ); diff --git a/app/PlaYUVerAppModuleIf.cpp b/app/PlaYUVerAppModuleIf.cpp index b350eb5..6037435 100644 --- a/app/PlaYUVerAppModuleIf.cpp +++ b/app/PlaYUVerAppModuleIf.cpp @@ -50,9 +50,9 @@ void PlaYUVerAppModuleIf::run() m_pcProcessedFrame = NULL; m_dMeasurementResult = 0; - if( m_pcModule->m_cModuleDef.m_iModuleType == FRAME_PROCESSING_MODULE ) + if( m_pcModule->m_iModuleType == FRAME_PROCESSING_MODULE ) { - switch( m_pcModule->m_cModuleDef.m_uiNumberOfFrames ) + switch( m_pcModule->m_uiNumberOfFrames ) { case MODULE_REQUIRES_ONE_FRAME: m_pcProcessedFrame = m_pcModule->process( m_pcSubWindow[0]->getCurrFrame() ); @@ -65,9 +65,9 @@ void PlaYUVerAppModuleIf::run() break; } } - else if( m_pcModule->m_cModuleDef.m_iModuleType == FRAME_MEASUREMENT_MODULE ) + else if( m_pcModule->m_iModuleType == FRAME_MEASUREMENT_MODULE ) { - switch( m_pcModule->m_cModuleDef.m_uiNumberOfFrames ) + switch( m_pcModule->m_uiNumberOfFrames ) { case MODULE_REQUIRES_ONE_FRAME: m_dMeasurementResult = m_pcModule->measure( m_pcSubWindow[0]->getCurrFrame() ); diff --git a/modules/AbsoluteFrameDifference.cpp b/modules/AbsoluteFrameDifference.cpp index cf7df89..298239c 100644 --- a/modules/AbsoluteFrameDifference.cpp +++ b/modules/AbsoluteFrameDifference.cpp @@ -27,16 +27,6 @@ namespace plaYUVer { -static PlaYUVerModuleDefinition AbsoluteFrameDifferenceDef = -{ - FRAME_PROCESSING_MODULE, - "Measurements", - "AbsoluteFrameDifference", - "Measure the absolute difference between two images (Y plane), e. g., abs( Y1 - Y2 )", - MODULE_REQUIRES_TWO_FRAMES, - MODULE_REQUIRES_NEW_WINDOW, - APPLY_WHILE_PLAYING, }; - AbsoluteFrameDifference::AbsoluteFrameDifference() { /* Module Definition */ @@ -49,7 +39,6 @@ AbsoluteFrameDifference::AbsoluteFrameDifference() m_bApplyWhilePlaying = APPLY_WHILE_PLAYING; m_pcFrameDifference = NULL; - setModuleDefinition( AbsoluteFrameDifferenceDef ); } Void AbsoluteFrameDifference::create( PlaYUVerFrame* Input ) diff --git a/modules/DisparityStereoVar.cpp b/modules/DisparityStereoVar.cpp index 2b75788..d34e6d0 100644 --- a/modules/DisparityStereoVar.cpp +++ b/modules/DisparityStereoVar.cpp @@ -29,19 +29,9 @@ namespace plaYUVer { -static PlaYUVerModuleDefinition DisparityStereoVarDef = -{ - FRAME_PROCESSING_MODULE, - "Disparity", - "StereoVar", - "Measure the disparity between two images using the Stereo Var method (OpenCV)", - MODULE_REQUIRES_TWO_FRAMES, - MODULE_REQUIRES_NEW_WINDOW, - !APPLY_WHILE_PLAYING, -}; - DisparityStereoVar::DisparityStereoVar() { + /* Module Definition */ m_iModuleType = FRAME_PROCESSING_MODULE; m_pchModuleCategory = "Disparity"; m_pchModuleName = "StereoVar"; @@ -50,7 +40,6 @@ DisparityStereoVar::DisparityStereoVar() m_uiModuleRequirements = MODULE_REQUIRES_NEW_WINDOW; m_bApplyWhilePlaying = !APPLY_WHILE_PLAYING; - setModuleDefinition( DisparityStereoVarDef ); m_pcDisparityFrame = NULL; m_cStereoVar.levels = 3; // ignored with USE_AUTO_PARAMS m_cStereoVar.pyrScale = 0.5; // ignored with USE_AUTO_PARAMS diff --git a/modules/FilterComponent.cpp b/modules/FilterComponent.cpp index cb4ab8e..4030fa8 100644 --- a/modules/FilterComponent.cpp +++ b/modules/FilterComponent.cpp @@ -54,22 +54,18 @@ Void FilterComponent::destroy() m_pcFilteredFrame = NULL; } - -PlaYUVerModuleDefinition FilterComponentLumaDef = { - FRAME_PROCESSING_MODULE, // Apply module to the frames or to the whole sequence. - // Currently only support for frame - "Filter Component", // Category (sub-menu) - "Luma", // Name - "Filter Y matrix of YUV frame", // Description - MODULE_REQUIRES_ONE_FRAME, // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES) - MODULE_REQUIRES_NOTHING, // Module requirements (check PlaYUVerModulesIf.h). - // Several requirements should be "or" between each others. - APPLY_WHILE_PLAYING, // Apply module while playing -}; - FilterComponentLuma::FilterComponentLuma() { - setModuleDefinition( FilterComponentLumaDef ); + /* Module Definition */ + m_iModuleType = FRAME_PROCESSING_MODULE; // Apply module to the frames or to the whole sequence. + // Currently only support for frame + m_pchModuleCategory = "Filter Component"; // Category (sub-menu) + m_pchModuleName = "Luma"; // Name + m_pchModuleTooltip = "Filter Y matrix of YUV frame"; // Description + m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME; // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES) + m_uiModuleRequirements = MODULE_REQUIRES_NOTHING; // Module requirements (check PlaYUVerModulesIf.h). + // Several requirements should be "or" between each others. + m_bApplyWhilePlaying = APPLY_WHILE_PLAYING; // Apply module while playing } Void FilterComponentLuma::create( PlaYUVerFrame* InputFrame ) @@ -82,21 +78,16 @@ PlaYUVerFrame* FilterComponentLuma::process( PlaYUVerFrame* InputFrame ) return filterComponent( InputFrame, LUMA ); } -PlaYUVerModuleDefinition FilterComponentCbDef = { - FRAME_PROCESSING_MODULE, // Apply module to the frames or to the whole sequence. - // Currently only support for frame - "Filter Component", // Category (sub-menu) - "Chroma U", // Name - "Filter Y matrix of YUV frame", // Description - MODULE_REQUIRES_ONE_FRAME, // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES) - MODULE_REQUIRES_NOTHING, // Module requirements (check PlaYUVerModulesIf.h). - // Several requirements should be "or" between each others. - APPLY_WHILE_PLAYING, // Apply module while playing -}; - FilterComponentChromaU::FilterComponentChromaU() { - setModuleDefinition( FilterComponentCbDef ); + /* Module Definition */ + m_iModuleType = FRAME_PROCESSING_MODULE; + m_pchModuleCategory = "Filter Component"; + m_pchModuleName = "Chroma U"; + m_pchModuleTooltip = "Filter U matrix of YUV frame"; + m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME; + m_uiModuleRequirements = MODULE_REQUIRES_NOTHING; + m_bApplyWhilePlaying = !APPLY_WHILE_PLAYING; } Void FilterComponentChromaU::create( PlaYUVerFrame* InputFrame ) @@ -109,21 +100,16 @@ PlaYUVerFrame* FilterComponentChromaU::process( PlaYUVerFrame* InputFrame ) return filterComponent( InputFrame, CHROMA_U ); } -PlaYUVerModuleDefinition FilterComponentCrDef = { - FRAME_PROCESSING_MODULE, // Apply module to the frames or to the whole sequence. - // Currently only support for frame - "Filter Component", // Category (sub-menu) - "Chroma R", // Name - "Filter Y matrix of YUV frame", // Description - MODULE_REQUIRES_ONE_FRAME, // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES) - MODULE_REQUIRES_NOTHING, // Module requirements (check PlaYUVerModulesIf.h). - // Several requirements should be "or" between each others. - APPLY_WHILE_PLAYING, // Apply module while playing -}; - FilterComponentChromaV::FilterComponentChromaV() { - setModuleDefinition( FilterComponentCrDef ); + /* Module Definition */ + m_iModuleType = FRAME_PROCESSING_MODULE; + m_pchModuleCategory = "Filter Component"; + m_pchModuleName = "Chroma V"; + m_pchModuleTooltip = "Filter V matrix of YUV frame"; + m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME; + m_uiModuleRequirements = MODULE_REQUIRES_NOTHING; + m_bApplyWhilePlaying = !APPLY_WHILE_PLAYING; } Void FilterComponentChromaV::create( PlaYUVerFrame* InputFrame ) diff --git a/modules/FrameDifference.cpp b/modules/FrameDifference.cpp index 5b4c4e2..df76bb0 100644 --- a/modules/FrameDifference.cpp +++ b/modules/FrameDifference.cpp @@ -28,17 +28,6 @@ namespace plaYUVer { -static PlaYUVerModuleDefinition FrameDifferenceDef = -{ - FRAME_PROCESSING_MODULE, - "Measurements", - "FrameDifference", - "Measure the difference between two images (Y plane), Y1 - Y2, with max absolute diff of 128", - MODULE_REQUIRES_TWO_FRAMES, - MODULE_REQUIRES_NEW_WINDOW, - APPLY_WHILE_PLAYING, -}; - FrameDifference::FrameDifference() { /* Module Definition */ @@ -51,7 +40,6 @@ FrameDifference::FrameDifference() m_bApplyWhilePlaying = APPLY_WHILE_PLAYING; m_pcFrameDifference = NULL; - setModuleDefinition( FrameDifferenceDef ); } Void FrameDifference::create( PlaYUVerFrame* Input ) diff --git a/modules/MeasurePSNR.cpp b/modules/MeasurePSNR.cpp index 065a51d..583e614 100644 --- a/modules/MeasurePSNR.cpp +++ b/modules/MeasurePSNR.cpp @@ -27,19 +27,16 @@ namespace plaYUVer { -static PlaYUVerModuleDefinition MeasurePSNRDef = -{ - FRAME_MEASUREMENT_MODULE, - "Quality", - "PSNR Y", - "Measure the PSNR between two images", - MODULE_REQUIRES_TWO_FRAMES, - MODULE_REQUIRES_SIDEBAR, - APPLY_WHILE_PLAYING, }; - MeasurePSNR::MeasurePSNR() { - setModuleDefinition( MeasurePSNRDef ); + /* Module Definition */ + m_iModuleType = FRAME_PROCESSING_MODULE; + m_pchModuleCategory = "Quality"; + m_pchModuleName = "PSNR Y"; + m_pchModuleTooltip = "Measure the PSNR between two images"; + m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES; + m_uiModuleRequirements = MODULE_REQUIRES_SIDEBAR; + m_bApplyWhilePlaying = APPLY_WHILE_PLAYING; } Void MeasurePSNR::create( PlaYUVerFrame* Org ) diff --git a/modules/PlaYUVerModuleIf.h b/modules/PlaYUVerModuleIf.h index 4db5a54..ddc2722 100644 --- a/modules/PlaYUVerModuleIf.h +++ b/modules/PlaYUVerModuleIf.h @@ -84,8 +84,6 @@ public: UInt m_uiModuleRequirements; Bool m_bApplyWhilePlaying; - PlaYUVerModuleDefinition m_cModuleDef; - PlaYUVerModuleIf() {} virtual ~PlaYUVerModuleIf() {} @@ -104,9 +102,6 @@ public: virtual Void destroy() { } - Void setModuleDefinition( PlaYUVerModuleDefinition def ) { m_cModuleDef = def; } - PlaYUVerModuleDefinition getModuleDefinition() { return m_cModuleDef; } - }; } // NAMESPACE