Refactor pixel formats enum

This commit is contained in:
jfmcarreira committed 2021-10-27 23:07:46 +01:00
1 parent 90a5c32bb6
commit bb2a1ac228
35 files changed
+289 -277

No files matched your search

+1 -1
View File
@@ -52,7 +52,7 @@ bool AbsoluteFrameDifference::create( std::vector<CalypFrame*> apcFrameList )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE_IGNORE_GRAY | CalypFrame::MATCH_COLOR_SPACE | CalypFrame::MATCH_RESOLUTION | CalypFrame::MATCH_BITS ) )
return false;
m_pcFrameDifference = std::make_unique<CalypFrame>( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY, apcFrameList[0]->getBitsPel() );
m_pcFrameDifference = std::make_unique<CalypFrame>( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::CLP_GRAY, apcFrameList[0]->getBitsPel() );
return true;
}
+3 -1
View File
@@ -25,6 +25,8 @@
#include "DisparityStereoBM.h"
#include "lib/CalypFrame.h"
DisparityStereoBM::DisparityStereoBM()
{
/* Module Definition */
@@ -49,7 +51,7 @@ bool DisparityStereoBM::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcDisparityFrame =
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::CLP_GRAY );
if( ( m_uiBlockSize % 2 ) == 0 )
{
m_uiBlockSize++;
+1 -1
View File
@@ -51,7 +51,7 @@ bool DisparityStereoSGBM::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcDisparityFrame =
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::CLP_GRAY );
if( ( m_uiBlockSize % 2 ) == 0 )
{
m_uiBlockSize++;
+1 -1
View File
@@ -41,7 +41,7 @@ FilterComponentModule::FilterComponentModule()
bool FilterComponentModule::createFilter( unsigned int uiWidth, unsigned int uiHeight, unsigned int bitsPixel )
{
m_pcFilteredFrame = NULL;
m_pcFilteredFrame = new CalypFrame( uiWidth, uiHeight, CLP_GRAY, bitsPixel );
m_pcFilteredFrame = new CalypFrame( uiWidth, uiHeight, ClpPixelFormats::CLP_GRAY, bitsPixel );
return true;
}
+1 -1
View File
@@ -45,7 +45,7 @@ FrameBinarization::FrameBinarization()
void FrameBinarization::create( CalypFrame* frame )
{
m_pcBinFrame = NULL;
m_pcBinFrame = new CalypFrame( frame->getWidth(), frame->getHeight(), CLP_GRAY, 8 );
m_pcBinFrame = new CalypFrame( frame->getWidth(), frame->getHeight(), ClpPixelFormats::CLP_GRAY, 8 );
}
CalypFrame* FrameBinarization::process( CalypFrame* frame )
+5 -5
View File
@@ -61,22 +61,22 @@ bool FrameMask::create( std::vector<CalypFrame*> apcFrameList )
m_iWeight = m_iWeight > 100 || m_iWeight < 0 ? 5 : m_iWeight;
m_iWeight = m_iWeight > 10 ? m_iWeight / 10 : m_iWeight;
int iPelFmt = 0;
auto iPelFmt = ClpPixelFormats::CLP_INVALID_FMT;
int iColorSpace = apcFrameList[0]->getColorSpace();
if( iColorSpace == CLP_COLOR_GRAY )
{
iColorSpace = apcFrameList[1]->getPelFormat();
iColorSpace = apcFrameList[1]->getColorSpace();
}
switch( iColorSpace )
{
case CLP_COLOR_GRAY:
iPelFmt = CLP_GRAY;
iPelFmt = ClpPixelFormats::CLP_GRAY;
break;
case CLP_COLOR_YUV:
iPelFmt = CLP_YUV444P;
iPelFmt = ClpPixelFormats::CLP_YUV444P;
break;
case CLP_COLOR_RGB:
iPelFmt = CLP_RGB24;
iPelFmt = ClpPixelFormats::CLP_RGB24;
break;
}
+1 -1
View File
@@ -61,7 +61,7 @@ bool HEVCIntraPrediction::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcPredBlock = NULL;
m_pcPredBlock = new CalypFrame( m_iBlockSize * 2 + 1, m_iBlockSize * 2 + 1, CLP_GRAY, apcFrameList[0]->getBitsPel() );
m_pcPredBlock = new CalypFrame( m_iBlockSize * 2 + 1, m_iBlockSize * 2 + 1, ClpPixelFormats::CLP_GRAY, apcFrameList[0]->getBitsPel() );
m_referenceMem.resize( m_iBlockSize * 4 );
+1 -1
View File
@@ -53,7 +53,7 @@ bool InterFrameVariance::create( std::vector<CalypFrame*> apcFrameList )
return false;
m_pcFrameVariance =
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY, 8 );
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::CLP_GRAY, 8 );
m_pVariance = CalypPlane<double>{ apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight() };
+1 -1
View File
@@ -69,7 +69,7 @@ bool MeasureOpticalFlowDualTVL1::create( std::vector<CalypFrame*> apcFrameList )
#else
m_cTvl1 = cv::createOptFlow_DualTVL1();
#endif
m_pcOutputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
m_pcOutputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::CLP_GRAY );
return true;
}
+1 -1
View File
@@ -62,7 +62,7 @@ bool OpticalFlowModule::commonCreate( std::vector<CalypFrame*> apcFrameList )
return false;
m_iStep = 16;
m_pcOutputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
m_pcOutputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::CLP_GRAY );
return true;
}
+5 -7
View File
@@ -29,8 +29,6 @@
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/photo.hpp>
//using cv::InputArray;
//using cv::OutputArray;
using cv::Rect;
using cv::Scalar;
using cv::Size;
@@ -201,8 +199,8 @@ bool ThreeSixtyDownsampling::createDownsamplingMask( CalypFrame* pcInputFrame )
if( m_iWidth == -1 || m_iHeight == -1 ) // output dimensions are needed
return false;
//m_pcDownsampled = new CalypFrame( m_iWidth, m_uiHeight, pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel() );
m_pcDownsampled = new CalypFrame( m_iWidth, m_iHeight, CalypFrame::findPixelFormat( "GRAY" ), pcInputFrame->getBitsPel() );
// m_pcDownsampled = new CalypFrame( m_iWidth, m_uiHeight, pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel() );
m_pcDownsampled = new CalypFrame( m_iWidth, m_iHeight, ClpPixelFormats::CLP_GRAY, pcInputFrame->getBitsPel() );
m_isOdd = !( m_iHeight % 2 );
for( unsigned ch = 0; ch < m_pcDownsampled->getNumberChannels(); ch++ )
@@ -422,7 +420,7 @@ bool ThreeSixtyDownsampling::createDownsamplingMask( CalypFrame* pcInputFrame )
cv::flip( auxPointMap, auxPointMap, -1 );
cv::flip( auxMask, auxMask, -1 );
//cv::imwrite( "auxMask.png", auxMask );
// cv::imwrite( "auxMask.png", auxMask );
auxPointMap.copyTo( topTriangleReshape, auxMask );
long shape_area = std::abs( r34_size.x ) * std::abs( r34_size.y );
@@ -493,7 +491,7 @@ bool ThreeSixtyDownsampling::createDownsamplingMask( CalypFrame* pcInputFrame )
else if( m_iRearrange == 4 )
{
intermediateReshapePoints = Mat_<Point>( 10 * p0.y, initialReshapePoints.cols, Point( -1, -1 ) );
//unsigned hor_pad = 0;
// unsigned hor_pad = 0;
unsigned ver_pad = 0;
if( m_uiY0 == 40 )
{
@@ -713,7 +711,7 @@ void ThreeSixtyDownsampling::upsamplingOperation( CalypFrame* pcInputFrame )
}
}
}
//m_pcResultedFrame->copyFrom( m_pcDownsampled );
// m_pcResultedFrame->copyFrom( m_pcDownsampled );
}
CalypFrame* ThreeSixtyDownsampling::process( std::vector<CalypFrame*> apcFrameList )
+1 -1
View File
@@ -39,7 +39,7 @@ protected:
std::string moduleName = CALYP_TEST_MODULE_NAME;
pcStream = std::make_unique<CalypStream>();
pcStream->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8,
pcStream->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, ClpPixelFormats::CLP_YUV420P, 8,
CLP_BIG_ENDIAN, 1, CalypStream::Type::Input );
}
@@ -52,7 +52,7 @@ protected:
std::string moduleName = CALYP_TEST_MODULE_NAME;
pcStream = std::make_unique<CalypStream>();
pcStream->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8,
pcStream->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, ClpPixelFormats::CLP_YUV420P, 8,
CLP_BIG_ENDIAN, 1, CalypStream::Type::Input );
CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap();