From 00ec0485f46ee6b16c4c941ffcf49d49cf6de803 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Wed, 20 Feb 2019 04:41:28 +0000 Subject: [PATCH] Fix bits per pixel in calypTools --- tools/CalypTools.cpp | 9 +++++---- tools/CalypToolsCmdParser.cpp | 2 +- tools/CalypToolsCmdParser.h | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/tools/CalypTools.cpp b/tools/CalypTools.cpp index dd2eb33..fe123bd 100644 --- a/tools/CalypTools.cpp +++ b/tools/CalypTools.cpp @@ -27,6 +27,7 @@ #include #include +#include #include "lib/CalypFrame.h" #include "lib/CalypModuleIf.h" @@ -69,7 +70,7 @@ int CalypTools::openInputs() ClpString resolutionString( "" ); ClpString fmtString( "yuv420p" ); - unsigned int uiBitPerPixel = 8; + unsigned int uiBitsPerPixel = 8; unsigned int uiEndianness = 0; CalypStream* pcStream; @@ -85,7 +86,7 @@ int CalypTools::openInputs() } if( Opts().hasOpt( "bits_pel" ) ) { - uiBitPerPixel = GET_PARAM( m_uiBitsPerPixel, i ); + uiBitsPerPixel = std::stoi( GET_PARAM( m_strBitsPerPixel, i ).c_str() ); } if( Opts().hasOpt( "endianness" ) ) { @@ -93,7 +94,7 @@ int CalypTools::openInputs() { uiEndianness = 0; } - if( GET_PARAM( m_strEndianness, i ) == "little" ) + else if( GET_PARAM( m_strEndianness, i ) == "little" ) { uiEndianness = 1; } @@ -101,7 +102,7 @@ int CalypTools::openInputs() pcStream = new CalypStream; try { - if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitPerPixel, uiEndianness, 1, true ) ) + if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitsPerPixel, uiEndianness, 1, true ) ) { log( CLP_LOG_ERROR, "Cannot open input stream %s! ", inputFileNames[i].c_str() ); return -1; diff --git a/tools/CalypToolsCmdParser.cpp b/tools/CalypToolsCmdParser.cpp index 9fabd97..0b7d8fc 100644 --- a/tools/CalypToolsCmdParser.cpp +++ b/tools/CalypToolsCmdParser.cpp @@ -64,7 +64,7 @@ int CalypToolsCmdParser::parseToolsArgs( int argc, char* argv[] ) ( "output,o", m_strOutput, "output file" ) /**/ ( "size,s", m_strResolution, "size (WxH)" ) /**/ ( "pel_fmt,p", m_strPelFmt, "pixel format" ) /**/ - ( "bits_pel", m_uiBitsPerPixel, "bits per pixel" ) /**/ + ( "bits_pel", m_strBitsPerPixel, "bits per pixel" ) /**/ ( "endianness", m_strEndianness, "File endianness (big, little)" ) /**/ ( "frames,f", m_iFrames, "number of frames to parse" ) /**/ ( "quality", m_strQualityMetric, "select a quality metric" ) /**/ diff --git a/tools/CalypToolsCmdParser.h b/tools/CalypToolsCmdParser.h index d29b47f..837ce79 100644 --- a/tools/CalypToolsCmdParser.h +++ b/tools/CalypToolsCmdParser.h @@ -67,7 +67,7 @@ protected: std::vector m_apcInputs; std::vector m_strResolution; std::vector m_strPelFmt; - std::vector m_uiBitsPerPixel; + std::vector m_strBitsPerPixel; std::vector m_strEndianness; ClpString m_strOutput; long m_iFrames;