Improve modules code and add a requirements variable
This commit is contained in:
1 parent
61ad53a23a
commit
945d0334c1
5 files changed
+32
-26
No files matched your search
@@ -77,7 +77,7 @@ SubWindowHandle* ModulesHandle::toggleSelectedModuleIf()
|
||||
if( currModuleIf->m_pcAction->isChecked() )
|
||||
{
|
||||
currModuleIf->m_pcDisplaySubWindow = NULL;
|
||||
if( currModuleIf->m_cModuleDef.m_bRequiresNewWindow || bShowModulesNewWindow )
|
||||
if( ( currModuleIf->m_cModuleDef.m_uiModuleRequirements & MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow )
|
||||
{
|
||||
QString windowName;
|
||||
interfaceChild = new SubWindowHandle( m_pcParent );
|
||||
|
||||
@@ -49,7 +49,9 @@ enum __PlaYUVerModuleRequirements
|
||||
{
|
||||
MODULE_REQUIRES_FRAME = 1,
|
||||
MODULE_REQUIRES_TWOFRAMES = 2,
|
||||
MODULE_REQUIRES_SIDEBAR = 4,
|
||||
MODULE_REQUIRES_NEW_WINDOW = 4,
|
||||
MODULE_REQUIRES_SIDEBAR = 8,
|
||||
MODULES_REQUIREMENTS_TOTAL,
|
||||
};
|
||||
|
||||
#define REGISTER_MODULE(X) \
|
||||
@@ -63,39 +65,41 @@ enum __PlaYUVerModuleRequirements
|
||||
|
||||
typedef struct __PlaYUVerModuleDefinition
|
||||
{
|
||||
int m_iModuleType;
|
||||
const char* m_pchModuleCategory;
|
||||
const char* m_pchModuleName;
|
||||
const char* m_pchModuleTooltip;
|
||||
bool m_bRequiresNewWindow;
|
||||
}PlaYUVerModuleDefinition;
|
||||
Int m_iModuleType;
|
||||
const Char* m_pchModuleCategory;
|
||||
const Char* m_pchModuleName;
|
||||
const Char* m_pchModuleTooltip;
|
||||
UInt m_uiModuleRequirements;
|
||||
} PlaYUVerModuleDefinition;
|
||||
|
||||
class SubWindowHandle;
|
||||
|
||||
class PlaYUVerModuleIf
|
||||
{
|
||||
friend class ModulesHandle;
|
||||
|
||||
public:
|
||||
PlaYUVerModuleDefinition m_cModuleDef;
|
||||
private:
|
||||
QAction* m_pcAction;
|
||||
SubWindowHandle* m_pcSubWindow;
|
||||
SubWindowHandle* m_pcDisplaySubWindow;
|
||||
|
||||
PlaYUVerModuleDefinition m_cModuleDef;
|
||||
public:
|
||||
PlaYUVerModuleIf() { }
|
||||
PlaYUVerModuleIf() :
|
||||
m_pcAction( NULL ),
|
||||
m_pcSubWindow( NULL ),
|
||||
m_pcDisplaySubWindow( NULL )
|
||||
{ }
|
||||
virtual ~PlaYUVerModuleIf() { }
|
||||
|
||||
virtual Void create() {};
|
||||
virtual Void create( PlaYUVerFrame* ) {};
|
||||
virtual Void create() { }
|
||||
virtual Void create( PlaYUVerFrame* ) { }
|
||||
|
||||
virtual Void process() {};
|
||||
virtual PlaYUVerFrame* process( PlaYUVerFrame* ) { return NULL; };
|
||||
virtual PlaYUVerFrame* process( PlaYUVerFrame* , PlaYUVerFrame* ) { return NULL; };
|
||||
virtual Void process() { }
|
||||
virtual PlaYUVerFrame* process( PlaYUVerFrame* ) { return NULL; }
|
||||
virtual PlaYUVerFrame* process( PlaYUVerFrame*, PlaYUVerFrame* ) { return NULL; }
|
||||
|
||||
virtual Void destroy() {};
|
||||
virtual Void destroy(){ }
|
||||
|
||||
Void setModuleDefinition( PlaYUVerModuleDefinition def ) { m_cModuleDef = def; }
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
@@ -35,12 +35,12 @@ PlaYUVerModuleDefinition FilterFrameDef = {
|
||||
"Filters",
|
||||
"Y_Filter",
|
||||
"Filter Y matrix of YUV frame",
|
||||
false,
|
||||
MODULE_REQUIRES_FRAME,
|
||||
};
|
||||
|
||||
FilterFrame::FilterFrame()
|
||||
{
|
||||
m_cModuleDef = FilterFrameDef;
|
||||
setModuleDefinition( FilterFrameDef );
|
||||
m_pcFilteredFrame = NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,12 +36,13 @@ static PlaYUVerModuleDefinition FrameDifferenceDef =
|
||||
"Measurements",
|
||||
"FrameDifference",
|
||||
"Measure the difference between two images (Y plane)",
|
||||
true, };
|
||||
MODULE_REQUIRES_TWOFRAMES | MODULE_REQUIRES_NEW_WINDOW,
|
||||
};
|
||||
|
||||
FrameDifference::FrameDifference()
|
||||
{
|
||||
m_pcFrameDifference = NULL;
|
||||
m_cModuleDef = FrameDifferenceDef;
|
||||
setModuleDefinition( FrameDifferenceDef );
|
||||
}
|
||||
|
||||
Void FrameDifference::create( PlaYUVerFrame* Input )
|
||||
|
||||
@@ -35,13 +35,14 @@ static PlaYUVerModuleDefinition MeasurePSNRDef =
|
||||
FRAME_LEVEL_MODULE,
|
||||
"Measurements",
|
||||
"PSNR",
|
||||
"MEasure the PSNR between two images",
|
||||
true, };
|
||||
"Measure the PSNR between two images",
|
||||
MODULE_REQUIRES_TWOFRAMES | MODULE_REQUIRES_SIDEBAR,
|
||||
};
|
||||
|
||||
MeasurePSNR::MeasurePSNR()
|
||||
{
|
||||
m_pcFilteredFrame = NULL;
|
||||
m_cModuleDef = MeasurePSNRDef;
|
||||
setModuleDefinition( MeasurePSNRDef );
|
||||
}
|
||||
|
||||
Void MeasurePSNR::create( PlaYUVerFrame* InputFrame )
|
||||
|
||||
Reference in new issue
Block a user