Refactor ClpPixelFormats enum
This commit is contained in:
29 files changed
+87
-88
No files matched your search
@@ -166,7 +166,7 @@ bool VideoStreamSubWindow::loadFile( QString cFilename, bool bForceDialog )
|
||||
ConfigureFormatDialog formatDialog( this );
|
||||
unsigned int Width = 0, Height = 0, BitsPel = 8, FrameRate = 30;
|
||||
int Endianness = CLP_LITTLE_ENDIAN;
|
||||
auto InputFormat = ClpPixelFormats::CLP_YUV420P;
|
||||
auto InputFormat = ClpPixelFormats::YUV420p;
|
||||
QSettings appSettings;
|
||||
|
||||
if( m_pCurrStream )
|
||||
@@ -427,7 +427,7 @@ bool VideoStreamSubWindow::guessFormat( const QString& filename, unsigned int& r
|
||||
rEndianness = CLP_LITTLE_ENDIAN;
|
||||
}
|
||||
|
||||
if( rWidth > 0 && rHeight > 0 && rInputFormat != ClpPixelFormats::CLP_INVALID_FMT )
|
||||
if( rWidth > 0 && rHeight > 0 && rInputFormat != ClpPixelFormats::Invalid )
|
||||
bGuessed = true && !bGuessedByFilesize;
|
||||
}
|
||||
return !bGuessed;
|
||||
|
||||
@@ -384,7 +384,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent )
|
||||
|
||||
auto findPelFormatColorSpace( ClpPixelFormats rInputFormat ) -> std::pair<int, std::int64_t>
|
||||
{
|
||||
if( rInputFormat != ClpPixelFormats::CLP_INVALID_FMT )
|
||||
if( rInputFormat != ClpPixelFormats::Invalid )
|
||||
{
|
||||
auto pelFmtName = CalypFrame::pixelFormatName( rInputFormat );
|
||||
for( unsigned int j = 0; j < CalypFrame::supportedColorSpacesListNames().size(); j++ )
|
||||
|
||||
@@ -56,7 +56,7 @@ bool AbsoluteFrameDifferenceExample::create( std::vector<CalypFrame*> apcFrameLi
|
||||
return false;
|
||||
|
||||
m_pcFrameDifference =
|
||||
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::CLP_GRAY );
|
||||
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::Gray );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ FrameBinarizationAPIv1::FrameBinarizationAPIv1()
|
||||
void FrameBinarizationAPIv1::create( CalypFrame* frame )
|
||||
{
|
||||
m_pcBinFrame = NULL;
|
||||
m_pcBinFrame = new CalypFrame( frame->getWidth(), frame->getHeight(), ClpPixelFormats::CLP_GRAY, 8 );
|
||||
m_pcBinFrame = new CalypFrame( frame->getWidth(), frame->getHeight(), ClpPixelFormats::Gray, 8 );
|
||||
}
|
||||
|
||||
CalypFrame* FrameBinarizationAPIv1::process( CalypFrame* frame )
|
||||
|
||||
+11
-11
@@ -134,12 +134,12 @@ public:
|
||||
//! Struct with the pixel format description.
|
||||
const CalypPixelFormatDescriptor* m_pcPelFormat{ nullptr };
|
||||
|
||||
unsigned int m_uiWidth{ 0 }; //!< Width of the frame
|
||||
unsigned int m_uiHeight{ 0 }; //!< Height of the frame
|
||||
ClpPixelFormats m_iPixelFormat{ ClpPixelFormats::CLP_INVALID_FMT }; //!< Pixel format number (it follows the list of supported pixel formats)
|
||||
unsigned int m_uiBitsPel{ 0 }; //!< Bits per pixel/channel
|
||||
unsigned int m_uiHalfPelValue{ 0 }; //!< Bits per pixel/channel
|
||||
bool m_bHasNegativeValues{ false }; //!< Half of the scale correspond to negative values
|
||||
unsigned int m_uiWidth{ 0 }; //!< Width of the frame
|
||||
unsigned int m_uiHeight{ 0 }; //!< Height of the frame
|
||||
ClpPixelFormats m_iPixelFormat{ ClpPixelFormats::Invalid }; //!< Pixel format number (it follows the list of supported pixel formats)
|
||||
unsigned int m_uiBitsPel{ 0 }; //!< Bits per pixel/channel
|
||||
unsigned int m_uiHalfPelValue{ 0 }; //!< Bits per pixel/channel
|
||||
bool m_bHasNegativeValues{ false }; //!< Half of the scale correspond to negative values
|
||||
|
||||
ClpPel*** m_pppcInputPel{ nullptr };
|
||||
|
||||
@@ -176,7 +176,7 @@ public:
|
||||
m_uiHalfPelValue = 1 << ( m_uiBitsPel - 1 );
|
||||
m_bHasNegativeValues = has_negative_values;
|
||||
|
||||
if( m_uiWidth == 0 || m_uiHeight == 0 || m_iPixelFormat == ClpPixelFormats::CLP_INVALID_FMT || bitsPixel > kMaxBitsPerPixel )
|
||||
if( m_uiWidth == 0 || m_uiHeight == 0 || m_iPixelFormat == ClpPixelFormats::Invalid || bitsPixel > kMaxBitsPerPixel )
|
||||
{
|
||||
throw CalypFailure( "CalypFrame", "Cannot create a CalypFrame of this type" );
|
||||
}
|
||||
@@ -851,7 +851,7 @@ void CalypFrame::fillRGBBuffer() const
|
||||
}
|
||||
else if( d->m_pcPelFormat->colorSpace == CLP_COLOR_YUV )
|
||||
{
|
||||
if( d->m_iPixelFormat == ClpPixelFormats::CLP_YUV420P )
|
||||
if( d->m_iPixelFormat == ClpPixelFormats::YUV420p )
|
||||
{
|
||||
fillRGBBufferYUV420p( d->m_pppcInputPel, pARGB, d->m_uiWidth, d->m_uiHeight, shiftBits );
|
||||
return;
|
||||
@@ -1323,15 +1323,15 @@ bool CalypFrame::fromMat( cv::Mat& cvMat, int channel )
|
||||
if( !d->m_bInit )
|
||||
{
|
||||
uchar depth = cvMat.type() & CV_MAT_DEPTH_MASK;
|
||||
if( d->m_iPixelFormat == ClpPixelFormats::CLP_INVALID_FMT )
|
||||
if( d->m_iPixelFormat == ClpPixelFormats::Invalid )
|
||||
{
|
||||
switch( cvMat.channels() )
|
||||
{
|
||||
case 1:
|
||||
d->m_iPixelFormat = ClpPixelFormats::CLP_GRAY;
|
||||
d->m_iPixelFormat = ClpPixelFormats::Gray;
|
||||
break;
|
||||
case 3:
|
||||
d->m_iPixelFormat = ClpPixelFormats::CLP_BGR24;
|
||||
d->m_iPixelFormat = ClpPixelFormats::BGR24;
|
||||
break;
|
||||
default:
|
||||
assert( false );
|
||||
|
||||
+11
-12
@@ -64,18 +64,17 @@ enum CalypColorSpace
|
||||
*/
|
||||
enum class ClpPixelFormats : int
|
||||
{
|
||||
CLP_INVALID_FMT = -1, //!< Invalid
|
||||
CLP_YUV420P = 0, //!< YUV 420 progressive
|
||||
CLP_YUV422P, //!< YUV 422 progressive
|
||||
CLP_YUV444P, //!< YUV 444 progressive
|
||||
CLP_YUYV422, //!< YUV 422 interleaved
|
||||
CLP_GRAY, //!< Grayscale
|
||||
CLP_RGB24P, //!< RGB 32 bpp progressive
|
||||
CLP_RGB24, //!< RGB 32 bpp
|
||||
CLP_BGR24, //!< BGR 32 bpp
|
||||
CLP_RGBA32, //!< RGBA 32 bpp
|
||||
CLP_BGRA32, //!< BGRA 32 bpp
|
||||
CLP_MAX_FMT = 254, //!< Account for future formats
|
||||
Invalid = -1, //!< Invalid
|
||||
YUV420p = 0, //!< YUV 420 progressive
|
||||
YUV422p, //!< YUV 422 progressive
|
||||
YUV444p, //!< YUV 444 progressive
|
||||
YUYV422, //!< YUV 422 interleaved
|
||||
Gray, //!< Grayscale
|
||||
RGB24p, //!< RGB 32 bpp progressive
|
||||
RGB24, //!< RGB 32 bpp
|
||||
BGR24, //!< BGR 32 bpp
|
||||
RGBA32, //!< RGBA 32 bpp
|
||||
BGRA32, //!< BGRA 32 bpp
|
||||
};
|
||||
|
||||
enum CLP_YUV_Components
|
||||
|
||||
@@ -42,7 +42,7 @@ bool CalypOpenCVModuleIf::create( std::vector<CalypFrame*> apcFrameList )
|
||||
Mat* outputMat = create_using_opencv( acMatList );
|
||||
if( outputMat )
|
||||
{
|
||||
auto pelFormat = m_bConvertToGray ? ClpPixelFormats::CLP_GRAY : apcFrameList[0]->getPelFormat();
|
||||
auto pelFormat = m_bConvertToGray ? ClpPixelFormats::Gray : apcFrameList[0]->getPelFormat();
|
||||
m_pcOutputFrame = std::make_unique<CalypFrame>( outputMat->cols, outputMat->rows, pelFormat, apcFrameList[0]->getBitsPel() );
|
||||
bRet = true;
|
||||
}
|
||||
|
||||
+3
-3
@@ -247,7 +247,7 @@ public:
|
||||
return isInit;
|
||||
}
|
||||
|
||||
if( handler->m_uiWidth <= 0 || handler->m_uiHeight <= 0 || handler->m_iPixelFormat == ClpPixelFormats::CLP_INVALID_FMT )
|
||||
if( handler->m_uiWidth <= 0 || handler->m_uiHeight <= 0 || handler->m_iPixelFormat == ClpPixelFormats::Invalid )
|
||||
{
|
||||
close();
|
||||
throw CalypFailure( "CalypStream", "Incorrect configuration: width, height or pixel format" );
|
||||
@@ -458,7 +458,7 @@ bool CalypStream::reload()
|
||||
d->handler->calculateFrameNumber();
|
||||
d->handler->configureBuffer( *refFrame );
|
||||
|
||||
if( d->handler->m_uiWidth <= 0 || d->handler->m_uiHeight <= 0 || d->handler->m_iPixelFormat == ClpPixelFormats::CLP_INVALID_FMT ||
|
||||
if( d->handler->m_uiWidth <= 0 || d->handler->m_uiHeight <= 0 || d->handler->m_iPixelFormat == ClpPixelFormats::Invalid ||
|
||||
d->handler->m_uiBitsPerPixel == 0 || d->handler->m_uiTotalNumberFrames == 0 )
|
||||
{
|
||||
return false;
|
||||
@@ -529,7 +529,7 @@ void CalypStream::getFormat( unsigned int& rWidth, unsigned int& rHeight, ClpPix
|
||||
{
|
||||
rWidth = 0;
|
||||
rHeight = 0;
|
||||
rInputFormat = ClpPixelFormats::CLP_YUV420P;
|
||||
rInputFormat = ClpPixelFormats::YUV420p;
|
||||
rBitsPerPel = kDefaultBitsPerPixel;
|
||||
rEndianness = 0;
|
||||
rFrameRate = kDefaultFrameRate;
|
||||
|
||||
@@ -105,7 +105,7 @@ protected:
|
||||
bool m_bNative{ true };
|
||||
unsigned int m_uiWidth{ 0 };
|
||||
unsigned int m_uiHeight{ 0 };
|
||||
ClpPixelFormats m_iPixelFormat{ ClpPixelFormats::CLP_INVALID_FMT };
|
||||
ClpPixelFormats m_iPixelFormat{ ClpPixelFormats::Invalid };
|
||||
unsigned int m_uiBitsPerPixel{ 8 };
|
||||
int m_iEndianness{ CLP_INVALID_ENDIANESS };
|
||||
double m_dFrameRate{ 30 };
|
||||
|
||||
+10
-10
@@ -45,7 +45,7 @@
|
||||
|
||||
const std::map<ClpPixelFormats, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
|
||||
{
|
||||
ClpPixelFormats::CLP_YUV420P,
|
||||
ClpPixelFormats::YUV420p,
|
||||
{
|
||||
"YUV420p"sv,
|
||||
CLP_COLOR_YUV,
|
||||
@@ -62,7 +62,7 @@ const std::map<ClpPixelFormats, CalypPixelFormatDescriptor> g_CalypPixFmtDescrip
|
||||
},
|
||||
},
|
||||
{
|
||||
ClpPixelFormats::CLP_YUV422P,
|
||||
ClpPixelFormats::YUV422p,
|
||||
{
|
||||
"YUV422p"sv,
|
||||
CLP_COLOR_YUV,
|
||||
@@ -79,7 +79,7 @@ const std::map<ClpPixelFormats, CalypPixelFormatDescriptor> g_CalypPixFmtDescrip
|
||||
},
|
||||
},
|
||||
{
|
||||
ClpPixelFormats::CLP_YUV444P,
|
||||
ClpPixelFormats::YUV444p,
|
||||
{
|
||||
"YUV444p"sv,
|
||||
CLP_COLOR_YUV,
|
||||
@@ -96,7 +96,7 @@ const std::map<ClpPixelFormats, CalypPixelFormatDescriptor> g_CalypPixFmtDescrip
|
||||
},
|
||||
},
|
||||
{
|
||||
ClpPixelFormats::CLP_YUYV422,
|
||||
ClpPixelFormats::YUYV422,
|
||||
{
|
||||
"YUYV422"sv,
|
||||
CLP_COLOR_YUV,
|
||||
@@ -113,7 +113,7 @@ const std::map<ClpPixelFormats, CalypPixelFormatDescriptor> g_CalypPixFmtDescrip
|
||||
},
|
||||
},
|
||||
{
|
||||
ClpPixelFormats::CLP_GRAY,
|
||||
ClpPixelFormats::Gray,
|
||||
{
|
||||
"GRAY"sv,
|
||||
CLP_COLOR_GRAY,
|
||||
@@ -126,7 +126,7 @@ const std::map<ClpPixelFormats, CalypPixelFormatDescriptor> g_CalypPixFmtDescrip
|
||||
},
|
||||
},
|
||||
{
|
||||
ClpPixelFormats::CLP_RGB24P,
|
||||
ClpPixelFormats::RGB24p,
|
||||
{
|
||||
"RGBp"sv,
|
||||
CLP_COLOR_RGB,
|
||||
@@ -143,7 +143,7 @@ const std::map<ClpPixelFormats, CalypPixelFormatDescriptor> g_CalypPixFmtDescrip
|
||||
},
|
||||
},
|
||||
{
|
||||
ClpPixelFormats::CLP_RGB24,
|
||||
ClpPixelFormats::RGB24,
|
||||
{
|
||||
"RGB"sv,
|
||||
CLP_COLOR_RGB,
|
||||
@@ -160,7 +160,7 @@ const std::map<ClpPixelFormats, CalypPixelFormatDescriptor> g_CalypPixFmtDescrip
|
||||
},
|
||||
},
|
||||
{
|
||||
ClpPixelFormats::CLP_BGR24,
|
||||
ClpPixelFormats::BGR24,
|
||||
{
|
||||
"BGR"sv,
|
||||
CLP_COLOR_RGB,
|
||||
@@ -177,7 +177,7 @@ const std::map<ClpPixelFormats, CalypPixelFormatDescriptor> g_CalypPixFmtDescrip
|
||||
},
|
||||
},
|
||||
{
|
||||
ClpPixelFormats::CLP_RGBA32,
|
||||
ClpPixelFormats::RGBA32,
|
||||
{
|
||||
"RGBA"sv,
|
||||
CLP_COLOR_RGBA,
|
||||
@@ -195,7 +195,7 @@ const std::map<ClpPixelFormats, CalypPixelFormatDescriptor> g_CalypPixFmtDescrip
|
||||
},
|
||||
},
|
||||
{
|
||||
ClpPixelFormats::CLP_BGRA32,
|
||||
ClpPixelFormats::BGRA32,
|
||||
{
|
||||
"BGRA"sv,
|
||||
CLP_COLOR_RGBA,
|
||||
|
||||
@@ -197,7 +197,7 @@ bool StreamHandlerLibav::openHandler( std::string strFilename, bool bInput )
|
||||
auxPixFmt = AV_PIX_FMT_GRAY8;
|
||||
}
|
||||
|
||||
m_iPixelFormat = ClpPixelFormats::CLP_INVALID_FMT;
|
||||
m_iPixelFormat = ClpPixelFormats::Invalid;
|
||||
m_bNative = false;
|
||||
auto found_fmt = std::find_if( g_CalypPixFmtDescriptorsMap.begin(), g_CalypPixFmtDescriptorsMap.end(),
|
||||
[auxPixFmt]( const auto& fmt ) {
|
||||
@@ -245,27 +245,27 @@ bool StreamHandlerLibav::openHandler( std::string strFilename, bool bInput )
|
||||
|
||||
if( !m_bNative )
|
||||
{
|
||||
ClpPixelFormats newPelFmt{ ClpPixelFormats::CLP_INVALID_FMT };
|
||||
ClpPixelFormats newPelFmt{ ClpPixelFormats::Invalid };
|
||||
const AVPixFmtDescriptor* ffPelDesc = av_pix_fmt_desc_get( AVPixelFormat( m_ffPixFmt ) );
|
||||
if( ffPelDesc->flags & AV_PIX_FMT_FLAG_PAL )
|
||||
{
|
||||
newPelFmt = ClpPixelFormats::CLP_RGB24;
|
||||
newPelFmt = ClpPixelFormats::RGB24;
|
||||
}
|
||||
else if( ffPelDesc->flags & AV_PIX_FMT_FLAG_ALPHA )
|
||||
{
|
||||
newPelFmt = ClpPixelFormats::CLP_RGBA32;
|
||||
newPelFmt = ClpPixelFormats::RGBA32;
|
||||
}
|
||||
else if( ffPelDesc->flags & AV_PIX_FMT_FLAG_RGB )
|
||||
{
|
||||
newPelFmt = ClpPixelFormats::CLP_RGB24;
|
||||
newPelFmt = ClpPixelFormats::RGB24;
|
||||
}
|
||||
else if( ffPelDesc->nb_components == 1 )
|
||||
{
|
||||
newPelFmt = ClpPixelFormats::CLP_GRAY;
|
||||
newPelFmt = ClpPixelFormats::Gray;
|
||||
}
|
||||
else
|
||||
{
|
||||
newPelFmt = ClpPixelFormats::CLP_YUV444P;
|
||||
newPelFmt = ClpPixelFormats::YUV444p;
|
||||
}
|
||||
m_iPixelFormat = newPelFmt;
|
||||
|
||||
|
||||
@@ -105,7 +105,7 @@ bool StreamHandlerOpenCV::openHandler( std::string strFilename, bool bInput )
|
||||
m_dFrameRate = 1;
|
||||
}
|
||||
m_uiBitsPerPixel = 8;
|
||||
m_iPixelFormat = ClpPixelFormats::CLP_BGR24;
|
||||
m_iPixelFormat = ClpPixelFormats::BGR24;
|
||||
|
||||
m_uiTotalNumberFrames = 1;
|
||||
if( m_pcVideoCapture )
|
||||
|
||||
@@ -80,7 +80,7 @@ bool StreamHandlerPortableMap::openHandler( std::string strFilename, bool bInput
|
||||
}
|
||||
}
|
||||
m_uiBitsPerPixel = log( m_iMaxValue + 1 ) / log( 2 );
|
||||
m_iPixelFormat = m_iMagicNumber == 1 || m_iMagicNumber == 2 || m_iMagicNumber == 5 ? ClpPixelFormats::CLP_GRAY : ClpPixelFormats::CLP_RGB24;
|
||||
m_iPixelFormat = m_iMagicNumber == 1 || m_iMagicNumber == 2 || m_iMagicNumber == 5 ? ClpPixelFormats::Gray : ClpPixelFormats::RGB24;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -89,17 +89,17 @@ bool StreamHandlerPortableMap::openHandler( std::string strFilename, bool bInput
|
||||
if( m_uiBitsPerPixel == 1 )
|
||||
{
|
||||
m_iMagicNumber = 1;
|
||||
m_iPixelFormat = ClpPixelFormats::CLP_GRAY;
|
||||
m_iPixelFormat = ClpPixelFormats::Gray;
|
||||
}
|
||||
else if( colorSpace == CLP_COLOR_GRAY )
|
||||
{
|
||||
m_iMagicNumber = 5;
|
||||
m_iPixelFormat = ClpPixelFormats::CLP_GRAY;
|
||||
m_iPixelFormat = ClpPixelFormats::Gray;
|
||||
}
|
||||
else if( colorSpace == CLP_COLOR_RGB )
|
||||
{
|
||||
m_iMagicNumber = 6;
|
||||
m_iPixelFormat = ClpPixelFormats::CLP_RGB24;
|
||||
m_iPixelFormat = ClpPixelFormats::RGB24;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -29,32 +29,32 @@
|
||||
TEST_CASE( "create a 256x128 frame with 8 bits in YUV420 format", "CalypFrame" )
|
||||
{
|
||||
// Constructor: CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel = 8 );
|
||||
CalypFrame testFrame( 256, 128, ClpPixelFormats::CLP_YUV420P, 8 );
|
||||
CalypFrame testFrame( 256, 128, ClpPixelFormats::YUV420p, 8 );
|
||||
|
||||
CHECK( testFrame.getWidth() == 256 );
|
||||
CHECK( testFrame.getHeight() == 128 );
|
||||
CHECK( testFrame.getPelFormat() == ClpPixelFormats::CLP_YUV420P );
|
||||
CHECK( testFrame.getPelFormat() == ClpPixelFormats::YUV420p );
|
||||
CHECK( testFrame.getBitsPel() == 8 );
|
||||
}
|
||||
|
||||
TEST_CASE( "create a 256x128 frame with 10 bits in YUV420 format", "CalypFrame" )
|
||||
{
|
||||
// Constructor: CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel = 8 );
|
||||
CalypFrame testFrame( 256, 128, ClpPixelFormats::CLP_YUV420P, 10 );
|
||||
CalypFrame testFrame( 256, 128, ClpPixelFormats::YUV420p, 10 );
|
||||
|
||||
CHECK( testFrame.getWidth() == 256 );
|
||||
CHECK( testFrame.getHeight() == 128 );
|
||||
CHECK( testFrame.getPelFormat() == ClpPixelFormats::CLP_YUV420P );
|
||||
CHECK( testFrame.getPelFormat() == ClpPixelFormats::YUV420p );
|
||||
CHECK( testFrame.getBitsPel() == 10 );
|
||||
}
|
||||
|
||||
TEST_CASE( "create a 256x128 frame with 16 bits in YUV420 format", "CalypFrame" )
|
||||
{
|
||||
// Constructor: CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel = 8 );
|
||||
CalypFrame testFrame( 256, 128, ClpPixelFormats::CLP_YUV420P, 16 );
|
||||
CalypFrame testFrame( 256, 128, ClpPixelFormats::YUV420p, 16 );
|
||||
|
||||
CHECK( testFrame.getWidth() == 256 );
|
||||
CHECK( testFrame.getHeight() == 128 );
|
||||
CHECK( testFrame.getPelFormat() == ClpPixelFormats::CLP_YUV420P );
|
||||
CHECK( testFrame.getPelFormat() == ClpPixelFormats::YUV420p );
|
||||
CHECK( testFrame.getBitsPel() == 16 );
|
||||
}
|
||||
@@ -42,7 +42,7 @@ TEST_CASE( "Can open a YUV 420p file", "CalypStream" )
|
||||
{
|
||||
constexpr int kWidth{ 352 };
|
||||
constexpr int kHeight{ 288 };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::CLP_YUV420P };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::YUV420p };
|
||||
constexpr int kBitsPel{ 8 };
|
||||
constexpr auto KEndianness{ CLP_INVALID_ENDIANESS };
|
||||
|
||||
@@ -85,7 +85,7 @@ TEST_CASE( "Can open a YUV file", "CalypStream" )
|
||||
};
|
||||
SECTION( "YUV420p" )
|
||||
{
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::CLP_YUV420P };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::YUV420p };
|
||||
const auto kFilename = getFileTestFilename( "Foreman.yuv" );
|
||||
REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) );
|
||||
|
||||
@@ -101,7 +101,7 @@ TEST_CASE( "Can open a YUV file", "CalypStream" )
|
||||
}
|
||||
SECTION( "YUV422p" )
|
||||
{
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::CLP_YUV422P };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::YUV422p };
|
||||
const auto kFilename = getFileTestFilename( "Foreman_352x288_yuv422p.yuv" );
|
||||
REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) );
|
||||
|
||||
@@ -117,7 +117,7 @@ TEST_CASE( "Can open a YUV file", "CalypStream" )
|
||||
}
|
||||
SECTION( "YUV444p" )
|
||||
{
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::CLP_YUV444P };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::YUV444p };
|
||||
const auto kFilename = getFileTestFilename( "Foreman_352x288_yuv444p.yuv" );
|
||||
REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) );
|
||||
|
||||
@@ -133,7 +133,7 @@ TEST_CASE( "Can open a YUV file", "CalypStream" )
|
||||
}
|
||||
SECTION( "YUYV422" )
|
||||
{
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::CLP_YUYV422 };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::YUYV422 };
|
||||
const auto kFilename = getFileTestFilename( "Foreman_352x288_yuyv422.yuv" );
|
||||
REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) );
|
||||
|
||||
@@ -166,7 +166,7 @@ TEST_CASE( "Can open a RGB file", "CalypStream" )
|
||||
};
|
||||
SECTION( "RGB24" )
|
||||
{
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::CLP_RGB24 };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::RGB24 };
|
||||
const auto kFilename = getFileTestFilename( "Foreman_352x288_rgb24.yuv" );
|
||||
REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) );
|
||||
CalypStream test_stream;
|
||||
@@ -183,7 +183,7 @@ TEST_CASE( "Can open a RGB file", "CalypStream" )
|
||||
|
||||
SECTION( "BGR24" )
|
||||
{
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::CLP_BGR24 };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::BGR24 };
|
||||
const auto kFilename = getFileTestFilename( "Foreman_352x288_bgr24.yuv" );
|
||||
REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) );
|
||||
CalypStream test_stream;
|
||||
@@ -212,7 +212,7 @@ TEST_CASE( "Can open a GRAY file", "CalypStream" )
|
||||
stream.getCodecName() == "Raw Video" &&
|
||||
stream.getEndianess() == CLP_BIG_ENDIAN;
|
||||
};
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::CLP_GRAY };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::Gray };
|
||||
const auto kFilename = getFileTestFilename( "Foreman_352x288_gray.yuv" );
|
||||
REQUIRE( std::filesystem::exists( std::filesystem::path( kFilename ) ) );
|
||||
CalypStream test_stream;
|
||||
@@ -229,7 +229,7 @@ TEST_CASE( "Can open .batatas file as RAW video", "CalypStream" )
|
||||
{
|
||||
constexpr int kWidth{ 352 };
|
||||
constexpr int kHeight{ 288 };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::CLP_YUV420P };
|
||||
constexpr auto kInputFormat{ ClpPixelFormats::YUV420p };
|
||||
constexpr int kBitsPel{ 8 };
|
||||
constexpr auto KEndianness{ CLP_INVALID_ENDIANESS };
|
||||
|
||||
|
||||
@@ -35,12 +35,12 @@ protected:
|
||||
static void SetUpTestCase()
|
||||
{
|
||||
pcStreamPast = std::make_unique<CalypStream>();
|
||||
pcStreamPast->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, ClpPixelFormats::CLP_YUV420P, 8,
|
||||
pcStreamPast->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, ClpPixelFormats::YUV420p, 8,
|
||||
CLP_BIG_ENDIAN, 1, CalypStream::Type::Input );
|
||||
pcFramePast = pcStreamPast->getCurrFrame();
|
||||
|
||||
pcStreamFuture = std::make_unique<CalypStream>();
|
||||
pcStreamFuture->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F15_832x480_yuv420p.yuv" ), 832, 480, ClpPixelFormats::CLP_YUV420P, 8,
|
||||
pcStreamFuture->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F15_832x480_yuv420p.yuv" ), 832, 480, ClpPixelFormats::YUV420p, 8,
|
||||
CLP_BIG_ENDIAN, 1, CalypStream::Type::Input );
|
||||
pcFrameFuture = pcStreamFuture->getCurrFrame();
|
||||
}
|
||||
|
||||
@@ -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(), ClpPixelFormats::CLP_GRAY, apcFrameList[0]->getBitsPel() );
|
||||
m_pcFrameDifference = std::make_unique<CalypFrame>( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::Gray, apcFrameList[0]->getBitsPel() );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,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(), ClpPixelFormats::CLP_GRAY );
|
||||
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::Gray );
|
||||
if( ( m_uiBlockSize % 2 ) == 0 )
|
||||
{
|
||||
m_uiBlockSize++;
|
||||
|
||||
@@ -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(), ClpPixelFormats::CLP_GRAY );
|
||||
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::Gray );
|
||||
if( ( m_uiBlockSize % 2 ) == 0 )
|
||||
{
|
||||
m_uiBlockSize++;
|
||||
|
||||
@@ -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, ClpPixelFormats::CLP_GRAY, bitsPixel );
|
||||
m_pcFilteredFrame = new CalypFrame( uiWidth, uiHeight, ClpPixelFormats::Gray, bitsPixel );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ FrameBinarization::FrameBinarization()
|
||||
void FrameBinarization::create( CalypFrame* frame )
|
||||
{
|
||||
m_pcBinFrame = NULL;
|
||||
m_pcBinFrame = new CalypFrame( frame->getWidth(), frame->getHeight(), ClpPixelFormats::CLP_GRAY, 8 );
|
||||
m_pcBinFrame = new CalypFrame( frame->getWidth(), frame->getHeight(), ClpPixelFormats::Gray, 8 );
|
||||
}
|
||||
|
||||
CalypFrame* FrameBinarization::process( CalypFrame* frame )
|
||||
|
||||
@@ -61,7 +61,7 @@ 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;
|
||||
|
||||
auto iPelFmt = ClpPixelFormats::CLP_INVALID_FMT;
|
||||
auto iPelFmt = ClpPixelFormats::Invalid;
|
||||
int iColorSpace = apcFrameList[0]->getColorSpace();
|
||||
if( iColorSpace == CLP_COLOR_GRAY )
|
||||
{
|
||||
@@ -70,13 +70,13 @@ bool FrameMask::create( std::vector<CalypFrame*> apcFrameList )
|
||||
switch( iColorSpace )
|
||||
{
|
||||
case CLP_COLOR_GRAY:
|
||||
iPelFmt = ClpPixelFormats::CLP_GRAY;
|
||||
iPelFmt = ClpPixelFormats::Gray;
|
||||
break;
|
||||
case CLP_COLOR_YUV:
|
||||
iPelFmt = ClpPixelFormats::CLP_YUV444P;
|
||||
iPelFmt = ClpPixelFormats::YUV444p;
|
||||
break;
|
||||
case CLP_COLOR_RGB:
|
||||
iPelFmt = ClpPixelFormats::CLP_RGB24;
|
||||
iPelFmt = ClpPixelFormats::RGB24;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -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, ClpPixelFormats::CLP_GRAY, apcFrameList[0]->getBitsPel() );
|
||||
m_pcPredBlock = new CalypFrame( m_iBlockSize * 2 + 1, m_iBlockSize * 2 + 1, ClpPixelFormats::Gray, apcFrameList[0]->getBitsPel() );
|
||||
|
||||
m_referenceMem.resize( m_iBlockSize * 4 );
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ bool InterFrameVariance::create( std::vector<CalypFrame*> apcFrameList )
|
||||
return false;
|
||||
|
||||
m_pcFrameVariance =
|
||||
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::CLP_GRAY, 8 );
|
||||
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::Gray, 8 );
|
||||
|
||||
m_pVariance = CalypPlane<double>{ apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight() };
|
||||
|
||||
|
||||
@@ -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(), ClpPixelFormats::CLP_GRAY );
|
||||
m_pcOutputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::Gray );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -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(), ClpPixelFormats::CLP_GRAY );
|
||||
m_pcOutputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::Gray );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ bool ThreeSixtyDownsampling::createDownsamplingMask( CalypFrame* pcInputFrame )
|
||||
return false;
|
||||
|
||||
// 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_pcDownsampled = new CalypFrame( m_iWidth, m_iHeight, ClpPixelFormats::Gray, pcInputFrame->getBitsPel() );
|
||||
|
||||
m_isOdd = !( m_iHeight % 2 );
|
||||
for( unsigned ch = 0; ch < m_pcDownsampled->getNumberChannels(); ch++ )
|
||||
|
||||
@@ -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, ClpPixelFormats::CLP_YUV420P, 8,
|
||||
pcStream->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, ClpPixelFormats::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, ClpPixelFormats::CLP_YUV420P, 8,
|
||||
pcStream->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, ClpPixelFormats::YUV420p, 8,
|
||||
CLP_BIG_ENDIAN, 1, CalypStream::Type::Input );
|
||||
|
||||
CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap();
|
||||
|
||||
Reference in new issue
Block a user