diff --git a/CMakeLists.txt b/CMakeLists.txt index 07f5e04..1779dac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -117,8 +117,13 @@ IF( WIN32 ) ENDIF() ###################################################################################### -# Target App +# Configure targets ###################################################################################### + +if(CMAKE_COMPILER_IS_GNUCXX) + ADD_DEFINITIONS(-std=gnu++0x) +endif() + IF (NOT CMAKE_BUILD_TYPE ) MESSAGE(STATUS "No build type selected, default to Release") SET(CMAKE_BUILD_TYPE "Release") diff --git a/lib/PlaYUVerFrame.cpp b/lib/PlaYUVerFrame.cpp index d3dc3a8..78afef7 100644 --- a/lib/PlaYUVerFrame.cpp +++ b/lib/PlaYUVerFrame.cpp @@ -39,18 +39,17 @@ */ std::vector PlaYUVerFrame::supportedColorSpacesListNames() { - std::vector colorSpaceList; - colorSpaceList.push_back( "YUV" ); - colorSpaceList.push_back( "RGB" ); - colorSpaceList.push_back( "GRAY" ); - return colorSpaceList; + return std::vector{ + "YUV", + "RGB", + "GRAY", + }; } std::vector PlaYUVerFrame::supportedPixelFormatListNames() { std::vector formatsList; - Int numberFormats = PLAYUVER_NUMBER_FORMATS; - for( Int i = 0; i < numberFormats; i++ ) + for( Int i = 0; i < NUMBER_PEL_FORMATS; i++ ) { formatsList.push_back( g_PlaYUVerPixFmtDescriptorsList[i].name ); } @@ -60,8 +59,7 @@ std::vector PlaYUVerFrame::supportedPixelFormatListNames() std::vector PlaYUVerFrame::supportedPixelFormatListNames( Int colorSpace ) { std::vector formatsList; - Int numberFormats = PLAYUVER_NUMBER_FORMATS; - for( Int i = 0; i < numberFormats; i++ ) + for( Int i = 0; i < NUMBER_PEL_FORMATS; i++ ) { if( g_PlaYUVerPixFmtDescriptorsList[i].colorSpace == colorSpace ) formatsList.push_back( g_PlaYUVerPixFmtDescriptorsList[i].name ); @@ -71,7 +69,7 @@ std::vector PlaYUVerFrame::supportedPixelFormatListNames( Int colorSpace Int PlaYUVerFrame::findPixelFormat( String name ) { - for( Int i = 0; i < PLAYUVER_NUMBER_FORMATS; i++ ) + for( Int i = 0; i < NUMBER_PEL_FORMATS; i++ ) { if( g_PlaYUVerPixFmtDescriptorsList[i].name == name ) return i; @@ -1137,6 +1135,15 @@ Bool PlaYUVerFrame::fromMat( cv::Mat& cvMat ) ************************************************************** */ +std::vector PlaYUVerFrame::supportedQualityMetricsList() +{ + return std::vector { + "PSNR", + "MSE", + "SSIM", + }; +} + Double PlaYUVerFrame::getQuality( Int Metric, PlaYUVerFrame* Org, Int component ) { switch( Metric ) diff --git a/lib/PlaYUVerFrame.h b/lib/PlaYUVerFrame.h index bdfd3ea..4541f3e 100644 --- a/lib/PlaYUVerFrame.h +++ b/lib/PlaYUVerFrame.h @@ -47,7 +47,7 @@ class PlaYUVerFrame { public: - /** ColorSpace Enum (deprecated) + /** ColorSpace Enum * List of supported pixel formats - do not change order */ enum PixelFormats @@ -60,7 +60,7 @@ public: GRAY, RGB24, BGR24, - NUMBER_FORMATS + NUMBER_PEL_FORMATS }; /** Format match opts @@ -249,15 +249,7 @@ public: NUMBER_METRICS, }; - static std::vector supportedQualityMetricsList() - { - std::vector metrics; - metrics.push_back( "PSNR" ); - metrics.push_back( "MSE" ); - metrics.push_back( "SSIM" ); - return metrics; - } - + static std::vector supportedQualityMetricsList(); Double getQuality( Int Metric, PlaYUVerFrame* Org, Int component ); Double getMSE( PlaYUVerFrame* Org, Int component ); Double getPSNR( PlaYUVerFrame* Org, Int component ); diff --git a/lib/PlaYUVerFramePixelFormats.cpp b/lib/PlaYUVerFramePixelFormats.cpp index 2e67c8b..2bd4374 100644 --- a/lib/PlaYUVerFramePixelFormats.cpp +++ b/lib/PlaYUVerFramePixelFormats.cpp @@ -199,7 +199,7 @@ Void fillARGB32bufferYUV420p( Pel*** in, UChar* out, UInt width, UInt height, UI } #endif -const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PlaYUVerFrame::NUMBER_FORMATS] = +const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[PlaYUVerFrame::NUMBER_PEL_FORMATS] = { { "YUV420p", diff --git a/lib/PlaYUVerFramePixelFormats.h b/lib/PlaYUVerFramePixelFormats.h index dbb2bec..fa8426b 100644 --- a/lib/PlaYUVerFramePixelFormats.h +++ b/lib/PlaYUVerFramePixelFormats.h @@ -33,26 +33,6 @@ #define CHROMARATIO( SIZE, RATIO ) ( RATIO > 1 ? ( ( SIZE + 1 ) / RATIO ) : SIZE ) -inline Int pelRed( UInt rgb ) // get red part of RGB -{ - return ( ( rgb >> 16 ) & 0xff ); -} - -inline Int pelGreen( UInt rgb ) // get green part of RGB -{ - return ( ( rgb >> 8 ) & 0xff ); -} - -inline Int pelBlue( UInt rgb ) // get blue part of RGB -{ - return ( rgb & 0xff ); -} - -inline Int pelAlpha( UInt rgb ) // get alpha part of RGBA -{ - return rgb >> 24; -} - #define PEL_RGB( r, g, b ) \ ( 0xffu << 24 ) | ( ( r & 0xff ) << 16 ) | ( ( g & 0xff ) << 8 ) | ( b & 0xff ) @@ -130,7 +110,6 @@ typedef struct PlaYUVerPixFmtDescriptor #define MAX_NUMBER_PLANES 3 -#define PLAYUVER_NUMBER_FORMATS 3 extern const PlaYUVerPixFmtDescriptor g_PlaYUVerPixFmtDescriptorsList[]; #endif // __PLAYUVERFRAMEPIXELFORMATS_H__ diff --git a/lib/StreamHandlerLibav.cpp b/lib/StreamHandlerLibav.cpp index 58b2db5..accfec4 100644 --- a/lib/StreamHandlerLibav.cpp +++ b/lib/StreamHandlerLibav.cpp @@ -204,7 +204,7 @@ Bool StreamHandlerLibav::openHandler( String strFilename, Bool bInput ) m_uiHeight = m_cCodecCtx->height; m_iPixelFormat = PlaYUVerFrame::NO_FMT; - for( Int i = 0; i < PLAYUVER_NUMBER_FORMATS; i++ ) + for( Int i = 0; i < PlaYUVerFrame::NUMBER_PEL_FORMATS; i++ ) { if( g_PlaYUVerPixFmtDescriptorsList[i].ffmpegPelFormat == pix_fmt ) {