Change format ext api and re-format code

This commit is contained in:
jfmcarreira committed 2017-11-27 20:13:05 +00:00
1 parent 327f5921f5
commit 6fe8a0f69e
62 files changed
+1422 -2579

No files matched your search

+3 -5
View File
@@ -51,13 +51,11 @@ Bool AbsoluteFrameDifference::create( std::vector<PlaYUVerFrame*> apcFrameList )
_BASIC_MODULE_API_2_CHECK_
for( UInt i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE |
PlaYUVerFrame::MATCH_RESOLUTION |
PlaYUVerFrame::MATCH_BITS ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0],
PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_RESOLUTION | PlaYUVerFrame::MATCH_BITS ) )
return false;
m_pcFrameDifference = new PlaYUVerFrame( apcFrameList[0]->getWidth(),
apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
m_pcFrameDifference = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
return true;
}
+2 -4
View File
@@ -36,8 +36,7 @@ DisparityStereoBM::DisparityStereoBM()
"Measure the disparity between two images using the "
"Stereo BM method (OpenCV)";
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
m_uiModuleRequirements =
MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_uiModuleRequirements = MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "block_size", m_uiBlockSize, "Block Size (positive odd number) [9]" );
@@ -49,8 +48,7 @@ DisparityStereoBM::DisparityStereoBM()
Bool DisparityStereoBM::create( std::vector<PlaYUVerFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcDisparityFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
PlaYUVerFrame::GRAY );
m_pcDisparityFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
if( ( m_uiBlockSize % 2 ) == 0 )
{
m_uiBlockSize++;
+3 -6
View File
@@ -36,12 +36,10 @@ DisparityStereoSGBM::DisparityStereoSGBM()
"Measure the disparity between two images using the "
"Stereo SGBM method (OpenCV)";
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
m_uiModuleRequirements =
MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_uiModuleRequirements = MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "block_size", m_uiBlockSize, "Block Size (positive odd number) [3]" )(
"HHAlgorithm", m_bUseHH, "Use HH algorithm [false]" );
( "block_size", m_uiBlockSize, "Block Size (positive odd number) [3]" )( "HHAlgorithm", m_bUseHH, "Use HH algorithm [false]" );
m_pcDisparityFrame = NULL;
m_uiBlockSize = 3;
@@ -51,8 +49,7 @@ DisparityStereoSGBM::DisparityStereoSGBM()
Bool DisparityStereoSGBM::create( std::vector<PlaYUVerFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcDisparityFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
PlaYUVerFrame::GRAY );
m_pcDisparityFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
if( ( m_uiBlockSize % 2 ) == 0 )
{
m_uiBlockSize++;
+3 -4
View File
@@ -50,15 +50,14 @@ DisparityStereoVar::DisparityStereoVar()
m_cStereoVar.lambda = 0.03f;
m_cStereoVar.penalization = m_cStereoVar.PENALIZATION_TICHONOV; // ignored with USE_AUTO_PARAMS
m_cStereoVar.cycle = m_cStereoVar.CYCLE_V; // ignored with USE_AUTO_PARAMS
m_cStereoVar.flags = m_cStereoVar.USE_SMART_ID | m_cStereoVar.USE_AUTO_PARAMS |
m_cStereoVar.USE_INITIAL_DISPARITY | m_cStereoVar.USE_MEDIAN_FILTERING;
m_cStereoVar.flags =
m_cStereoVar.USE_SMART_ID | m_cStereoVar.USE_AUTO_PARAMS | m_cStereoVar.USE_INITIAL_DISPARITY | m_cStereoVar.USE_MEDIAN_FILTERING;
}
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_pcDisparityFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
m_cStereoVar.minDisp = -( ( ( apcFrameList[0]->getWidth() / 8 ) + 15 ) & -16 );
return true;
}
+1 -3
View File
@@ -43,9 +43,7 @@ Bool EightBitsSampling::create( std::vector<PlaYUVerFrame*> apcFrameList )
if( apcFrameList[0]->getBitsPel() > 8 )
{
m_pcSubSampledFrame = NULL;
m_pcSubSampledFrame =
new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
apcFrameList[0]->getPelFormat(), 8 );
m_pcSubSampledFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), apcFrameList[0]->getPelFormat(), 8 );
return true;
}
return false;
+4 -8
View File
@@ -42,8 +42,7 @@ PlaYUVerFrame* FilterComponentModule::filterComponent( PlaYUVerFrame* InputFrame
{
Pel*** pppOutputPelYUV = m_pcFilteredFrame->getPelBufferYUV();
Pel*** pppInputPelYUV = InputFrame->getPelBufferYUV();
memcpy( pppOutputPelYUV[LUMA][0], pppInputPelYUV[Component][0],
m_pcFilteredFrame->getWidth() * m_pcFilteredFrame->getHeight() * sizeof( Pel ) );
memcpy( pppOutputPelYUV[LUMA][0], pppInputPelYUV[Component][0], m_pcFilteredFrame->getWidth() * m_pcFilteredFrame->getHeight() * sizeof( Pel ) );
return m_pcFilteredFrame;
}
@@ -75,8 +74,7 @@ FilterComponentLuma::FilterComponentLuma()
Bool FilterComponentLuma::create( std::vector<PlaYUVerFrame*> apcFrameList )
{
return createFilter( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
apcFrameList[0]->getBitsPel() );
return createFilter( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), apcFrameList[0]->getBitsPel() );
}
PlaYUVerFrame* FilterComponentLuma::process( std::vector<PlaYUVerFrame*> apcFrameList )
@@ -100,8 +98,7 @@ Bool FilterComponentChromaU::create( std::vector<PlaYUVerFrame*> apcFrameList )
{
if( apcFrameList[0]->getNumberChannels() > 1 )
{
return createFilter( apcFrameList[0]->getChromaWidth(), apcFrameList[0]->getChromaHeight(),
apcFrameList[0]->getBitsPel() );
return createFilter( apcFrameList[0]->getChromaWidth(), apcFrameList[0]->getChromaHeight(), apcFrameList[0]->getBitsPel() );
}
return false;
}
@@ -127,8 +124,7 @@ Bool FilterComponentChromaV::create( std::vector<PlaYUVerFrame*> apcFrameList )
{
if( apcFrameList[0]->getNumberChannels() > 1 )
{
return createFilter( apcFrameList[0]->getChromaWidth(), apcFrameList[0]->getChromaHeight(),
apcFrameList[0]->getBitsPel() );
return createFilter( apcFrameList[0]->getChromaWidth(), apcFrameList[0]->getChromaHeight(), apcFrameList[0]->getBitsPel() );
}
return false;
}
+5 -8
View File
@@ -34,12 +34,10 @@ FrameCrop::FrameCrop()
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
m_uiModuleRequirements = MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "xPosition", m_uiXPosition,
"X cordinate of the left-top corner of the crop region [0]" ) /**/
( "yPosition", m_uiYPosition,
"Y cordinate of the left-top corner of the crop region [0]" ) /**/
( "width", m_iXSize, "Width of the crop region [-1]" ) /**/
m_cModuleOptions.addOptions() /**/
( "xPosition", m_uiXPosition, "X cordinate of the left-top corner of the crop region [0]" ) /**/
( "yPosition", m_uiYPosition, "Y cordinate of the left-top corner of the crop region [0]" ) /**/
( "width", m_iXSize, "Width of the crop region [-1]" ) /**/
( "height", m_iYSize, "Height of the crop region [-1]" );
m_pcCropedFrame = NULL;
@@ -60,8 +58,7 @@ Void FrameCrop::create( PlaYUVerFrame* frame )
{
m_iYSize = frame->getHeight() - m_uiYPosition;
}
m_pcCropedFrame =
new PlaYUVerFrame( m_iXSize, m_iYSize, frame->getPelFormat(), frame->getBitsPel() );
m_pcCropedFrame = new PlaYUVerFrame( m_iXSize, m_iYSize, frame->getPelFormat(), frame->getBitsPel() );
}
PlaYUVerFrame* FrameCrop::process( PlaYUVerFrame* frame )
+2 -5
View File
@@ -52,8 +52,7 @@ Bool FrameDifference::create( std::vector<PlaYUVerFrame*> apcFrameList )
UInt uiMaxBitsPixel = 0;
for( UInt i = 0; i < apcFrameList.size(); i++ )
{
if( !apcFrameList[i]->haveSameFmt(
apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_RESOLUTION ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_RESOLUTION ) )
return false;
if( apcFrameList[i]->getBitsPel() > uiMaxBitsPixel )
{
@@ -69,9 +68,7 @@ Bool FrameDifference::create( std::vector<PlaYUVerFrame*> apcFrameList )
m_iDiffBitShift = ( uiMaxBitsPixel + 1 ) - m_uiBitsPixel;
m_iMaxDiffValue = ( 1 << ( m_uiBitsPixel - 1 ) );
m_pcFrameDifference =
new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
PlaYUVerFrame::GRAY, m_uiBitsPixel );
m_pcFrameDifference = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY, m_uiBitsPixel );
return true;
}
+3 -5
View File
@@ -49,9 +49,8 @@ Bool FrameMask::create( std::vector<PlaYUVerFrame*> apcFrameList )
for( UInt i = 1; i < apcFrameList.size(); i++ )
{
if( !apcFrameList[i]->haveSameFmt(
apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE_IGNORE_GRAY |
PlaYUVerFrame::MATCH_RESOLUTION | PlaYUVerFrame::MATCH_BITS ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0],
PlaYUVerFrame::MATCH_COLOR_SPACE_IGNORE_GRAY | PlaYUVerFrame::MATCH_RESOLUTION | PlaYUVerFrame::MATCH_BITS ) )
{
return false;
}
@@ -79,8 +78,7 @@ Bool FrameMask::create( std::vector<PlaYUVerFrame*> apcFrameList )
break;
}
m_pcFrameProcessed = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
iPelFmt, apcFrameList[0]->getBitsPel() );
m_pcFrameProcessed = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), iPelFmt, apcFrameList[0]->getBitsPel() );
return true;
}
+4 -8
View File
@@ -58,13 +58,11 @@ PlaYUVerFrame* FrameShift::process( std::vector<PlaYUVerFrame*> apcFrameList )
UInt xStartOut = m_iShiftHor >= 0 ? m_iShiftHor : 0;
UInt xStartIn = m_iShiftHor >= 0 ? 0 : -m_iShiftHor;
UInt xEndOut = m_iShiftHor >= 0 ? m_pcProcessedFrame->getWidth()
: m_pcProcessedFrame->getWidth() + m_iShiftHor;
UInt xEndOut = m_iShiftHor >= 0 ? m_pcProcessedFrame->getWidth() : m_pcProcessedFrame->getWidth() + m_iShiftHor;
UInt yStartOut = m_iShiftVer >= 0 ? m_iShiftVer : 0;
UInt yStartIn = m_iShiftVer >= 0 ? 0 : -m_iShiftVer;
UInt yEndOut = m_iShiftVer >= 0 ? m_pcProcessedFrame->getHeight()
: m_pcProcessedFrame->getHeight() + m_iShiftVer;
UInt yEndOut = m_iShiftVer >= 0 ? m_pcProcessedFrame->getHeight() : m_pcProcessedFrame->getHeight() + m_iShiftVer;
m_pcProcessedFrame->clear();
@@ -85,13 +83,11 @@ PlaYUVerFrame* FrameShift::process( std::vector<PlaYUVerFrame*> apcFrameList )
xStartOut = iShiftHorChroma >= 0 ? iShiftHorChroma : 0;
xStartIn = iShiftHorChroma >= 0 ? 0 : -iShiftHorChroma;
xEndOut = iShiftHorChroma >= 0 ? m_pcProcessedFrame->getChromaWidth()
: m_pcProcessedFrame->getChromaWidth() + iShiftHorChroma;
xEndOut = iShiftHorChroma >= 0 ? m_pcProcessedFrame->getChromaWidth() : m_pcProcessedFrame->getChromaWidth() + iShiftHorChroma;
yStartOut = iShiftVerChroma >= 0 ? iShiftVerChroma : 0;
yStartIn = iShiftVerChroma >= 0 ? 0 : -iShiftVerChroma;
yEndOut = iShiftVerChroma >= 0 ? m_pcProcessedFrame->getChromaHeight()
: m_pcProcessedFrame->getChromaHeight() + iShiftVerChroma;
yEndOut = iShiftVerChroma >= 0 ? m_pcProcessedFrame->getChromaHeight() : m_pcProcessedFrame->getChromaHeight() + iShiftVerChroma;
for( UInt c = 1; c < m_pcProcessedFrame->getNumberChannels(); c++ )
{
+3 -5
View File
@@ -51,13 +51,11 @@ Bool InterFrameVariance::create( std::vector<PlaYUVerFrame*> apcFrameList )
_BASIC_MODULE_API_2_CHECK_
for( UInt i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE |
PlaYUVerFrame::MATCH_RESOLUTION |
PlaYUVerFrame::MATCH_BITS ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0],
PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_RESOLUTION | PlaYUVerFrame::MATCH_BITS ) )
return false;
m_pcFrameVariance = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
PlaYUVerFrame::GRAY, 8 );
m_pcFrameVariance = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY, 8 );
getMem2D( &m_pVariance, apcFrameList[0]->getHeight(), apcFrameList[0]->getWidth() );
return true;
+5 -9
View File
@@ -40,12 +40,10 @@ MeasureOpticalFlowDualTVL1::MeasureOpticalFlowDualTVL1()
m_pchModuleName = "MeasureOpticalFlowDualTVL1";
m_pchModuleTooltip = "Measure optical flow";
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
m_uiModuleRequirements =
MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_uiModuleRequirements = MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "Show reconstruction", m_bShowReconstruction,
"Show reconstructed frame instead of MVs [false]" );
( "Show reconstruction", m_bShowReconstruction, "Show reconstructed frame instead of MVs [false]" );
m_bShowReconstruction = false;
m_pcOutputFrame = NULL;
@@ -56,15 +54,13 @@ Bool MeasureOpticalFlowDualTVL1::create( std::vector<PlaYUVerFrame*> apcFrameLis
_BASIC_MODULE_API_2_CHECK_
for( UInt i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE |
PlaYUVerFrame::MATCH_RESOLUTION |
PlaYUVerFrame::MATCH_BITS ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0],
PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_RESOLUTION | PlaYUVerFrame::MATCH_BITS ) )
return false;
m_iStep = 16;
m_cTvl1 = cv::createOptFlow_DualTVL1();
m_pcOutputFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
PlaYUVerFrame::GRAY );
m_pcOutputFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
return true;
}
+5 -9
View File
@@ -45,12 +45,10 @@ OpticalFlowModule::OpticalFlowModule()
m_iModuleType = FRAME_PROCESSING_MODULE;
m_pchModuleCategory = "OpticalFlow";
m_uiNumberOfFrames = MODULE_REQUIRES_TWO_FRAMES;
m_uiModuleRequirements =
MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_uiModuleRequirements = MODULE_REQUIRES_SKIP_WHILE_PLAY | MODULE_REQUIRES_NEW_WINDOW | MODULE_REQUIRES_OPTIONS;
m_cModuleOptions.addOptions() /**/
( "Show reconstruction", m_bShowReconstruction,
"Show reconstructed frame instead of MVs [false]" );
( "Show reconstruction", m_bShowReconstruction, "Show reconstructed frame instead of MVs [false]" );
m_bShowReconstruction = false;
m_pcOutputFrame = NULL;
@@ -61,14 +59,12 @@ Bool OpticalFlowModule::commonCreate( std::vector<PlaYUVerFrame*> apcFrameList )
_BASIC_MODULE_API_2_CHECK_
for( UInt i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], PlaYUVerFrame::MATCH_COLOR_SPACE |
PlaYUVerFrame::MATCH_RESOLUTION |
PlaYUVerFrame::MATCH_BITS ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0],
PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_RESOLUTION | PlaYUVerFrame::MATCH_BITS ) )
return false;
m_iStep = 16;
m_pcOutputFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(),
PlaYUVerFrame::GRAY );
m_pcOutputFrame = new PlaYUVerFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), PlaYUVerFrame::GRAY );
return true;
}
+1 -2
View File
@@ -40,8 +40,7 @@ SetChromaHalfScale::SetChromaHalfScale()
Void SetChromaHalfScale::create( PlaYUVerFrame* frame )
{
m_pcProcessedFrame = NULL;
m_pcProcessedFrame = new PlaYUVerFrame( frame->getWidth(), frame->getHeight(),
frame->getPelFormat(), frame->getBitsPel() );
m_pcProcessedFrame = new PlaYUVerFrame( frame->getWidth(), frame->getHeight(), frame->getPelFormat(), frame->getBitsPel() );
}
PlaYUVerFrame* SetChromaHalfScale::process( PlaYUVerFrame* frame )
+1 -2
View File
@@ -57,8 +57,7 @@ Bool WeightedPSNR::create( std::vector<PlaYUVerFrame*> apcFrameList )
}
for( UInt i = 1; i < apcFrameList.size(); i++ )
{
if( !apcFrameList[i]->haveSameFmt(
apcFrameList[1], PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_BITS ) )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[1], PlaYUVerFrame::MATCH_COLOR_SPACE | PlaYUVerFrame::MATCH_BITS ) )
return false;
}
return true;