From 480a7f1d387011678b477a32f3f0190358cc19d9 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Wed, 27 Oct 2021 23:17:32 +0100 Subject: [PATCH] Refactor ClpPixelFormats enum --- app/VideoStreamSubWindow.cpp | 4 ++-- app/dialog/ConfigureFormatDialog.cpp | 2 +- .../AbsoluteFrameDifferenceExample.cpp | 2 +- examples/modules/FrameBinarizationAPIv1.cpp | 2 +- lib/CalypFrame.cpp | 22 +++++++++--------- lib/CalypFrame.h | 23 +++++++++---------- lib/CalypOpenCVModuleIf.cpp | 2 +- lib/CalypStream.cpp | 6 ++--- lib/CalypStreamHandlerIf.h | 2 +- lib/PixelFormats.cpp | 20 ++++++++-------- lib/StreamHandlerLibav.cpp | 14 +++++------ lib/StreamHandlerOpenCV.cpp | 2 +- lib/StreamHandlerPortableMap.cpp | 8 +++---- lib/catch2/CalypFrameTests.cpp | 12 +++++----- lib/catch2/CalypStreamTests.cpp | 18 +++++++-------- lib/tests/PlaYUVerFrameQualityTests.cpp | 4 ++-- modules/AbsoluteFrameDifference.cpp | 2 +- modules/DisparityStereoBM.cpp | 2 +- modules/DisparityStereoSGBM.cpp | 2 +- modules/FilterComponent.cpp | 2 +- modules/FrameBinarization.cpp | 2 +- modules/FrameMask.cpp | 8 +++---- modules/HEVCIntraPrediction.cpp | 2 +- modules/InterFrameVariance.cpp | 2 +- modules/MeasureOpticalFlowDualTVL1.cpp | 2 +- modules/OpticalFlow.cpp | 2 +- modules/ThreeSixtyDownsampling.cpp | 2 +- modules/tests/TestModuleCreate.cpp | 2 +- .../tests/TestModuleProcessNumberOfFrames.cpp | 2 +- 29 files changed, 87 insertions(+), 88 deletions(-) diff --git a/app/VideoStreamSubWindow.cpp b/app/VideoStreamSubWindow.cpp index af6f283..f844c2c 100644 --- a/app/VideoStreamSubWindow.cpp +++ b/app/VideoStreamSubWindow.cpp @@ -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; diff --git a/app/dialog/ConfigureFormatDialog.cpp b/app/dialog/ConfigureFormatDialog.cpp index 9ec18d5..818d367 100644 --- a/app/dialog/ConfigureFormatDialog.cpp +++ b/app/dialog/ConfigureFormatDialog.cpp @@ -384,7 +384,7 @@ ConfigureFormatDialog::ConfigureFormatDialog( QWidget* parent ) auto findPelFormatColorSpace( ClpPixelFormats rInputFormat ) -> std::pair { - 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++ ) diff --git a/examples/modules/AbsoluteFrameDifferenceExample.cpp b/examples/modules/AbsoluteFrameDifferenceExample.cpp index f5803ce..be2fbfa 100644 --- a/examples/modules/AbsoluteFrameDifferenceExample.cpp +++ b/examples/modules/AbsoluteFrameDifferenceExample.cpp @@ -56,7 +56,7 @@ bool AbsoluteFrameDifferenceExample::create( std::vector 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; } diff --git a/examples/modules/FrameBinarizationAPIv1.cpp b/examples/modules/FrameBinarizationAPIv1.cpp index 90c3fe8..dd47eff 100644 --- a/examples/modules/FrameBinarizationAPIv1.cpp +++ b/examples/modules/FrameBinarizationAPIv1.cpp @@ -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 ) diff --git a/lib/CalypFrame.cpp b/lib/CalypFrame.cpp index 2811bdc..bcbe951 100644 --- a/lib/CalypFrame.cpp +++ b/lib/CalypFrame.cpp @@ -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 ); diff --git a/lib/CalypFrame.h b/lib/CalypFrame.h index c8a9eb3..d8ba4db 100644 --- a/lib/CalypFrame.h +++ b/lib/CalypFrame.h @@ -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 diff --git a/lib/CalypOpenCVModuleIf.cpp b/lib/CalypOpenCVModuleIf.cpp index 78aaa10..1defa0f 100644 --- a/lib/CalypOpenCVModuleIf.cpp +++ b/lib/CalypOpenCVModuleIf.cpp @@ -42,7 +42,7 @@ bool CalypOpenCVModuleIf::create( std::vector 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( outputMat->cols, outputMat->rows, pelFormat, apcFrameList[0]->getBitsPel() ); bRet = true; } diff --git a/lib/CalypStream.cpp b/lib/CalypStream.cpp index c2d359d..ddb7e32 100644 --- a/lib/CalypStream.cpp +++ b/lib/CalypStream.cpp @@ -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; diff --git a/lib/CalypStreamHandlerIf.h b/lib/CalypStreamHandlerIf.h index d27bf6b..5034c37 100644 --- a/lib/CalypStreamHandlerIf.h +++ b/lib/CalypStreamHandlerIf.h @@ -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 }; diff --git a/lib/PixelFormats.cpp b/lib/PixelFormats.cpp index 341698e..1885601 100644 --- a/lib/PixelFormats.cpp +++ b/lib/PixelFormats.cpp @@ -45,7 +45,7 @@ const std::map g_CalypPixFmtDescriptorsMap = { { - ClpPixelFormats::CLP_YUV420P, + ClpPixelFormats::YUV420p, { "YUV420p"sv, CLP_COLOR_YUV, @@ -62,7 +62,7 @@ const std::map g_CalypPixFmtDescrip }, }, { - ClpPixelFormats::CLP_YUV422P, + ClpPixelFormats::YUV422p, { "YUV422p"sv, CLP_COLOR_YUV, @@ -79,7 +79,7 @@ const std::map g_CalypPixFmtDescrip }, }, { - ClpPixelFormats::CLP_YUV444P, + ClpPixelFormats::YUV444p, { "YUV444p"sv, CLP_COLOR_YUV, @@ -96,7 +96,7 @@ const std::map g_CalypPixFmtDescrip }, }, { - ClpPixelFormats::CLP_YUYV422, + ClpPixelFormats::YUYV422, { "YUYV422"sv, CLP_COLOR_YUV, @@ -113,7 +113,7 @@ const std::map g_CalypPixFmtDescrip }, }, { - ClpPixelFormats::CLP_GRAY, + ClpPixelFormats::Gray, { "GRAY"sv, CLP_COLOR_GRAY, @@ -126,7 +126,7 @@ const std::map g_CalypPixFmtDescrip }, }, { - ClpPixelFormats::CLP_RGB24P, + ClpPixelFormats::RGB24p, { "RGBp"sv, CLP_COLOR_RGB, @@ -143,7 +143,7 @@ const std::map g_CalypPixFmtDescrip }, }, { - ClpPixelFormats::CLP_RGB24, + ClpPixelFormats::RGB24, { "RGB"sv, CLP_COLOR_RGB, @@ -160,7 +160,7 @@ const std::map g_CalypPixFmtDescrip }, }, { - ClpPixelFormats::CLP_BGR24, + ClpPixelFormats::BGR24, { "BGR"sv, CLP_COLOR_RGB, @@ -177,7 +177,7 @@ const std::map g_CalypPixFmtDescrip }, }, { - ClpPixelFormats::CLP_RGBA32, + ClpPixelFormats::RGBA32, { "RGBA"sv, CLP_COLOR_RGBA, @@ -195,7 +195,7 @@ const std::map g_CalypPixFmtDescrip }, }, { - ClpPixelFormats::CLP_BGRA32, + ClpPixelFormats::BGRA32, { "BGRA"sv, CLP_COLOR_RGBA, diff --git a/lib/StreamHandlerLibav.cpp b/lib/StreamHandlerLibav.cpp index 992ab40..7a7224c 100644 --- a/lib/StreamHandlerLibav.cpp +++ b/lib/StreamHandlerLibav.cpp @@ -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; diff --git a/lib/StreamHandlerOpenCV.cpp b/lib/StreamHandlerOpenCV.cpp index 3a41663..93bb90a 100644 --- a/lib/StreamHandlerOpenCV.cpp +++ b/lib/StreamHandlerOpenCV.cpp @@ -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 ) diff --git a/lib/StreamHandlerPortableMap.cpp b/lib/StreamHandlerPortableMap.cpp index 5b581a0..70be6ae 100644 --- a/lib/StreamHandlerPortableMap.cpp +++ b/lib/StreamHandlerPortableMap.cpp @@ -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 { diff --git a/lib/catch2/CalypFrameTests.cpp b/lib/catch2/CalypFrameTests.cpp index 7ec9c6d..f3b26f7 100644 --- a/lib/catch2/CalypFrameTests.cpp +++ b/lib/catch2/CalypFrameTests.cpp @@ -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 ); } diff --git a/lib/catch2/CalypStreamTests.cpp b/lib/catch2/CalypStreamTests.cpp index f4f8d08..32bc5b9 100644 --- a/lib/catch2/CalypStreamTests.cpp +++ b/lib/catch2/CalypStreamTests.cpp @@ -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 }; diff --git a/lib/tests/PlaYUVerFrameQualityTests.cpp b/lib/tests/PlaYUVerFrameQualityTests.cpp index 71a7398..0cd5634 100644 --- a/lib/tests/PlaYUVerFrameQualityTests.cpp +++ b/lib/tests/PlaYUVerFrameQualityTests.cpp @@ -35,12 +35,12 @@ protected: static void SetUpTestCase() { pcStreamPast = std::make_unique(); - 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(); - 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(); } diff --git a/modules/AbsoluteFrameDifference.cpp b/modules/AbsoluteFrameDifference.cpp index a8635b2..65d2c5c 100644 --- a/modules/AbsoluteFrameDifference.cpp +++ b/modules/AbsoluteFrameDifference.cpp @@ -52,7 +52,7 @@ bool AbsoluteFrameDifference::create( std::vector 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( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::CLP_GRAY, apcFrameList[0]->getBitsPel() ); + m_pcFrameDifference = std::make_unique( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), ClpPixelFormats::Gray, apcFrameList[0]->getBitsPel() ); return true; } diff --git a/modules/DisparityStereoBM.cpp b/modules/DisparityStereoBM.cpp index 47e0918..f1df5de 100644 --- a/modules/DisparityStereoBM.cpp +++ b/modules/DisparityStereoBM.cpp @@ -51,7 +51,7 @@ bool DisparityStereoBM::create( std::vector 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++; diff --git a/modules/DisparityStereoSGBM.cpp b/modules/DisparityStereoSGBM.cpp index a435740..24e3c54 100644 --- a/modules/DisparityStereoSGBM.cpp +++ b/modules/DisparityStereoSGBM.cpp @@ -51,7 +51,7 @@ bool DisparityStereoSGBM::create( std::vector 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++; diff --git a/modules/FilterComponent.cpp b/modules/FilterComponent.cpp index deef2e9..2338236 100644 --- a/modules/FilterComponent.cpp +++ b/modules/FilterComponent.cpp @@ -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; } diff --git a/modules/FrameBinarization.cpp b/modules/FrameBinarization.cpp index dcaed1d..740ccbb 100644 --- a/modules/FrameBinarization.cpp +++ b/modules/FrameBinarization.cpp @@ -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 ) diff --git a/modules/FrameMask.cpp b/modules/FrameMask.cpp index bfb950e..5bbf606 100644 --- a/modules/FrameMask.cpp +++ b/modules/FrameMask.cpp @@ -61,7 +61,7 @@ bool FrameMask::create( std::vector 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 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; } diff --git a/modules/HEVCIntraPrediction.cpp b/modules/HEVCIntraPrediction.cpp index 65c011a..5b9748d 100644 --- a/modules/HEVCIntraPrediction.cpp +++ b/modules/HEVCIntraPrediction.cpp @@ -61,7 +61,7 @@ bool HEVCIntraPrediction::create( std::vector 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 ); diff --git a/modules/InterFrameVariance.cpp b/modules/InterFrameVariance.cpp index d03c6a1..aadb148 100644 --- a/modules/InterFrameVariance.cpp +++ b/modules/InterFrameVariance.cpp @@ -53,7 +53,7 @@ bool InterFrameVariance::create( std::vector 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{ apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight() }; diff --git a/modules/MeasureOpticalFlowDualTVL1.cpp b/modules/MeasureOpticalFlowDualTVL1.cpp index 5208ee0..23b0a82 100644 --- a/modules/MeasureOpticalFlowDualTVL1.cpp +++ b/modules/MeasureOpticalFlowDualTVL1.cpp @@ -69,7 +69,7 @@ bool MeasureOpticalFlowDualTVL1::create( std::vector 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; } diff --git a/modules/OpticalFlow.cpp b/modules/OpticalFlow.cpp index e09310e..14fea0f 100644 --- a/modules/OpticalFlow.cpp +++ b/modules/OpticalFlow.cpp @@ -62,7 +62,7 @@ bool OpticalFlowModule::commonCreate( std::vector 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; } diff --git a/modules/ThreeSixtyDownsampling.cpp b/modules/ThreeSixtyDownsampling.cpp index c0e7203..e7eb0dc 100644 --- a/modules/ThreeSixtyDownsampling.cpp +++ b/modules/ThreeSixtyDownsampling.cpp @@ -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++ ) diff --git a/modules/tests/TestModuleCreate.cpp b/modules/tests/TestModuleCreate.cpp index 91a1b86..fc218bd 100644 --- a/modules/tests/TestModuleCreate.cpp +++ b/modules/tests/TestModuleCreate.cpp @@ -39,7 +39,7 @@ protected: std::string moduleName = CALYP_TEST_MODULE_NAME; pcStream = std::make_unique(); - 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 ); } diff --git a/modules/tests/TestModuleProcessNumberOfFrames.cpp b/modules/tests/TestModuleProcessNumberOfFrames.cpp index f679501..eb7bc16 100644 --- a/modules/tests/TestModuleProcessNumberOfFrames.cpp +++ b/modules/tests/TestModuleProcessNumberOfFrames.cpp @@ -52,7 +52,7 @@ protected: std::string moduleName = CALYP_TEST_MODULE_NAME; pcStream = std::make_unique(); - 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();