Re-format code

This commit is contained in:
2017-03-23 04:29:34 +00:00
parent fd68d340bd
commit ebc10d1b84
85 changed files with 8092 additions and 4419 deletions
+33 -23
View File
@@ -22,16 +22,16 @@
* \brief Main definition of the PlaYUVerTools APp
*/
#include "config.h"
#include "PlaYUVerTools.h"
#include "config.h"
#include <cstring>
#include <climits>
#include <cstring>
#include "lib/PlaYUVerPixel.h"
#include "lib/PlaYUVerFrame.h"
#include "lib/PlaYUVerStream.h"
#include "lib/PlaYUVerModuleIf.h"
#include "lib/PlaYUVerPixel.h"
#include "lib/PlaYUVerStream.h"
#include "modules/PlaYUVerModuleFactory.h"
PlaYUVerTools::PlaYUVerTools()
@@ -102,7 +102,8 @@ Int PlaYUVerTools::openInputs()
pcStream = new PlaYUVerStream;
try
{
if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitPerPixel, uiEndianness, 1, true ) )
if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitPerPixel,
uiEndianness, 1, true ) )
{
log( LOG_ERROR, "Cannot open input stream %s! ", inputFileNames[i].c_str() );
return 2;
@@ -111,8 +112,8 @@ Int PlaYUVerTools::openInputs()
}
catch( const char* msg )
{
log( LOG_ERROR, "Cannot open input stream %s with the following error: \n%s\n", inputFileNames[i].c_str(),
msg );
log( LOG_ERROR, "Cannot open input stream %s with the following error: \n%s\n",
inputFileNames[i].c_str(), msg );
return 2;
}
}
@@ -128,8 +129,8 @@ Int PlaYUVerTools::openInputs()
for( UInt i = 0; i < m_apcInputStreams.size(); i++ )
{
m_uiNumberOfFrames = std::min( m_uiNumberOfFrames, m_apcInputStreams[i]->getFrameNum() );
m_uiNumberOfComponents =
std::min( m_uiNumberOfComponents, m_apcInputStreams[i]->getCurrFrame()->getNumberChannels() );
m_uiNumberOfComponents = std::min( m_uiNumberOfComponents,
m_apcInputStreams[i]->getCurrFrame()->getNumberChannels() );
}
return 0;
@@ -174,7 +175,9 @@ Int PlaYUVerTools::Open( Int argc, Char* argv[] )
m_pcOutputFileNames.push_back( m_strOutput );
if( m_pcOutputFileNames.size() != m_apcInputStreams.size() )
{
log( LOG_ERROR, "Invalid number of outputs! Each input must have an output filename. " );
log( LOG_ERROR,
"Invalid number of outputs! Each input must have an "
"output filename. " );
return 2;
}
@@ -211,14 +214,14 @@ Int PlaYUVerTools::Open( Int argc, Char* argv[] )
PlaYUVerStream* pcOutputStream = new PlaYUVerStream;
try
{
pcOutputStream->open( m_pcOutputFileNames[0], pcInputFrame->getWidth(), pcInputFrame->getHeight(),
pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel(), PLAYUVER_LITTLE_ENDIAN, 1,
false );
pcOutputStream->open( m_pcOutputFileNames[0], pcInputFrame->getWidth(),
pcInputFrame->getHeight(), pcInputFrame->getPelFormat(),
pcInputFrame->getBitsPel(), PLAYUVER_LITTLE_ENDIAN, 1, false );
}
catch( const char* msg )
{
log( LOG_ERROR, "Cannot open input stream %s with the following error %s!\n", m_pcOutputFileNames[0].c_str(),
msg );
log( LOG_ERROR, "Cannot open input stream %s with the following error %s!\n",
m_pcOutputFileNames[0].c_str(), msg );
delete pcOutputStream;
pcOutputStream = NULL;
return 2;
@@ -227,7 +230,9 @@ Int PlaYUVerTools::Open( Int argc, Char* argv[] )
if( m_apcOutputStreams.size() != m_apcInputStreams.size() )
{
log( LOG_ERROR, "Invalid number of outputs! Each input must have an output filename. " );
log( LOG_ERROR,
"Invalid number of outputs! Each input must have an "
"output filename. " );
return 2;
}
@@ -249,7 +254,8 @@ Int PlaYUVerTools::Open( Int argc, Char* argv[] )
}
for( UInt i = 0; i < PlaYUVerFrame::supportedQualityMetricsList().size(); i++ )
{
if( lowercase( PlaYUVerFrame::supportedQualityMetricsList()[i] ) == lowercase( qualityMetric ) )
if( lowercase( PlaYUVerFrame::supportedQualityMetricsList()[i] ) ==
lowercase( qualityMetric ) )
{
m_uiQualityMetric = i;
}
@@ -339,12 +345,13 @@ Int PlaYUVerTools::Open( Int argc, Char* argv[] )
try
{
pcModStream->open( outputFileNames[0], pcModFrame->getWidth(), pcModFrame->getHeight(),
pcModFrame->getPelFormat(), pcModFrame->getBitsPel(), PLAYUVER_LITTLE_ENDIAN, 1, false );
pcModFrame->getPelFormat(), pcModFrame->getBitsPel(),
PLAYUVER_LITTLE_ENDIAN, 1, false );
}
catch( const char* msg )
{
log( LOG_ERROR, "Cannot open input stream %s with the following error %s!\n", outputFileNames[0].c_str(),
msg );
log( LOG_ERROR, "Cannot open input stream %s with the following error %s!\n",
outputFileNames[0].c_str(), msg );
delete pcModStream;
pcModStream = NULL;
return 2;
@@ -420,7 +427,8 @@ Int PlaYUVerTools::RateReductionOperation()
Int PlaYUVerTools::QualityOperation()
{
const char* pchQualityMetricName = PlaYUVerFrame::supportedQualityMetricsList()[m_uiQualityMetric].c_str();
const char* pchQualityMetricName =
PlaYUVerFrame::supportedQualityMetricsList()[m_uiQualityMetric].c_str();
PlaYUVerFrame* apcCurrFrame[MAX_NUMBER_INPUTS];
Bool abEOF[MAX_NUMBER_INPUTS];
Double adAverageQuality[MAX_NUMBER_INPUTS - 1][PlaYUVerPixel::MAX_NUMBER_COMPONENTS];
@@ -480,7 +488,8 @@ Int PlaYUVerTools::QualityOperation()
for( UInt c = 0; c < m_uiNumberOfComponents; c++ )
{
dQuality = apcCurrFrame[s]->getQuality( m_uiQualityMetric, apcCurrFrame[0], c );
adAverageQuality[s - 1][c] = ( adAverageQuality[s - 1][c] * Double( frame ) + dQuality ) / Double( frame + 1 );
adAverageQuality[s - 1][c] =
( adAverageQuality[s - 1][c] * Double( frame ) + dQuality ) / Double( frame + 1 );
log( LOG_RESULT, metric_fmt.c_str(), dQuality );
}
log( LOG_RESULT, " " );
@@ -566,7 +575,8 @@ Int PlaYUVerTools::ModuleOperation()
log( LOG_INFO, " %3d", frame );
log( LOG_RESULT, " %8.3f \n", dMeasurementResult );
dAveragedMeasurementResult =
( dAveragedMeasurementResult * Double( frame ) + dMeasurementResult ) / Double( frame + 1 );
( dAveragedMeasurementResult * Double( frame ) + dMeasurementResult ) /
Double( frame + 1 );
}
for( UInt s = 0; s < m_apcInputStreams.size(); s++ )