Change some initialization to port to C++11

This commit is contained in:
2016-05-05 00:08:10 +01:00
parent 3adb6e659c
commit 52643ff306
6 changed files with 28 additions and 45 deletions
+6 -1
View File
@@ -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")
+17 -10
View File
@@ -39,18 +39,17 @@
*/
std::vector<String> PlaYUVerFrame::supportedColorSpacesListNames()
{
std::vector<String> colorSpaceList;
colorSpaceList.push_back( "YUV" );
colorSpaceList.push_back( "RGB" );
colorSpaceList.push_back( "GRAY" );
return colorSpaceList;
return std::vector<String>{
"YUV",
"RGB",
"GRAY",
};
}
std::vector<String> PlaYUVerFrame::supportedPixelFormatListNames()
{
std::vector<String> 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<String> PlaYUVerFrame::supportedPixelFormatListNames()
std::vector<String> PlaYUVerFrame::supportedPixelFormatListNames( Int colorSpace )
{
std::vector<String> 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<String> 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<String> PlaYUVerFrame::supportedQualityMetricsList()
{
return std::vector<String> {
"PSNR",
"MSE",
"SSIM",
};
}
Double PlaYUVerFrame::getQuality( Int Metric, PlaYUVerFrame* Org, Int component )
{
switch( Metric )
+3 -11
View File
@@ -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<String> supportedQualityMetricsList()
{
std::vector<String> metrics;
metrics.push_back( "PSNR" );
metrics.push_back( "MSE" );
metrics.push_back( "SSIM" );
return metrics;
}
static std::vector<String> supportedQualityMetricsList();
Double getQuality( Int Metric, PlaYUVerFrame* Org, Int component );
Double getMSE( PlaYUVerFrame* Org, Int component );
Double getPSNR( PlaYUVerFrame* Org, Int component );
+1 -1
View File
@@ -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",
-21
View File
@@ -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__
+1 -1
View File
@@ -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 )
{