From 900c9c0418c2dd0e9f7f7def175b2ecef707680f Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Sun, 3 Oct 2021 14:30:15 +0100 Subject: [PATCH] Remove some files from the Calyp lib and clean up code --- app/CalypAppModuleIf.h | 2 +- app/MainWindow.cpp | 10 +- app/ModulesHandle.cpp | 8 +- app/QualityHandle.cpp | 4 +- app/dialog/ConfigureFormatDialog.cpp | 4 +- app/dialog/ModulesHandleOptDialog.cpp | 8 +- examples/stream/testStreamReading.cpp | 2 +- lib/CMakeLists.txt | 4 +- lib/CalypDefs.h | 81 ++--------- lib/CalypFrame.cpp | 50 +++---- lib/CalypFrame.h | 132 ++++++++++++++++-- lib/CalypModuleIf.h | 39 +++++- lib/CalypOpenCVModuleIf.cpp | 3 +- lib/CalypOpenCVModuleIf.h | 70 ---------- lib/CalypOptions.cpp | 74 +++++----- lib/CalypOptions.h | 40 +++--- lib/CalypPlane.h | 76 ---------- lib/CalypStream.cpp | 42 +++--- lib/CalypStream.h | 30 ++-- lib/CalypStreamHandlerIf.h | 20 +-- lib/StreamHandlerLibav.cpp | 6 +- lib/StreamHandlerLibav.h | 4 +- lib/StreamHandlerOpenCV.cpp | 10 +- lib/StreamHandlerOpenCV.h | 4 +- lib/StreamHandlerPortableMap.cpp | 4 +- lib/StreamHandlerPortableMap.h | 4 +- lib/StreamHandlerRaw.cpp | 4 +- lib/StreamHandlerRaw.h | 4 +- lib/tests/PlaYUVerFrameQualityTests.cpp | 4 +- modules/HEVCIntraPrediction.cpp | 4 +- modules/HEVCIntraPrediction.h | 2 +- modules/InterFrameVariance.h | 1 - modules/SaliencyDetection.h | 2 +- modules/ThreeSixtyDownsampling.cpp | 4 +- modules/ThreeSixtyDownsampling.h | 2 +- modules/ThreeSixtyDynamicDownsampling.cpp | 2 +- modules/ThreeSixtyDynamicDownsampling.h | 4 +- modules/tests/TestModuleCreate.cpp | 6 +- .../tests/TestModuleProcessNumberOfFrames.cpp | 4 +- tools/CalypTools.cpp | 16 +-- tools/CalypTools.h | 6 +- tools/CalypToolsCmdParser.cpp | 4 +- tools/CalypToolsCmdParser.h | 18 +-- 43 files changed, 374 insertions(+), 444 deletions(-) delete mode 100644 lib/CalypOpenCVModuleIf.h delete mode 100644 lib/CalypPlane.h diff --git a/app/CalypAppModuleIf.h b/app/CalypAppModuleIf.h index 6958c9a..bdd77af 100644 --- a/app/CalypAppModuleIf.h +++ b/app/CalypAppModuleIf.h @@ -84,7 +84,7 @@ public: CalypModuleIf* getModule() { return m_pcModule.get(); } unsigned int getModuleRequirements() { return m_pcModule->m_uiModuleRequirements; } - ClpString moduleInfo() { return m_pcModule->moduleInfo(); } + std::string moduleInfo() { return m_pcModule->moduleInfo(); } void update( bool isPlaying ); bool apply( bool isPlaying = false, bool disableThreads = false ); bool process(); diff --git a/app/MainWindow.cpp b/app/MainWindow.cpp index e87b96a..ae6b3b7 100644 --- a/app/MainWindow.cpp +++ b/app/MainWindow.cpp @@ -95,9 +95,9 @@ bool MainWindow::parseArgs( int argc, char* argv[] ) bool bRet = false; CalypOptions pcCmdParser; - std::vector m_apcInputs; - ClpString strResolution( "" ); - ClpString strPelFmt( "" ); + std::vector m_apcInputs; + std::string strResolution( "" ); + std::string strPelFmt( "" ); pcCmdParser.addOptions() /**/ ( "input,i", m_apcInputs, "input file" ) /**/ @@ -261,12 +261,12 @@ QStringList MainWindow::showFileDialog( bool bRead ) for( unsigned int i = 0; i < supportedFmts.size(); i++ ) { - std::vector arrayExt = supportedFmts[i].getExts(); + std::vector arrayExt = supportedFmts[i].getExts(); if( arrayExt.size() > 0 ) { QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) ); currFmt.append( " (" ); - for( std::vector::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e ) + for( std::vector::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e ) { supported.append( " *." ); currFmt.append( "*." ); diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index bef67ac..b96ed8d 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -510,12 +510,12 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf ) for( unsigned int i = 0; i < supportedFmts.size(); i++ ) { - std::vector arrayExt = supportedFmts[i].getExts(); + std::vector arrayExt = supportedFmts[i].getExts(); if( arrayExt.size() > 0 ) { QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) ); currFmt.append( " (" ); - for( std::vector::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e ) + for( std::vector::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e ) { supported.append( " *." ); currFmt.append( "*." ); @@ -554,8 +554,8 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf ) if( pcCurrModuleIf->m_pcModuleStream ) { unsigned int numberOfWindows = pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames; - ClpULong currFrames = 0; - ClpULong numberOfFrames = -1; + std::uint64_t currFrames = 0; + std::uint64_t numberOfFrames = -1; for( unsigned int i = 0; i < numberOfWindows; i++ ) { currFrames = pcCurrModuleIf->m_pcSubWindow[i]->getInputStream()->getFrameNum(); diff --git a/app/QualityHandle.cpp b/app/QualityHandle.cpp index 5ec7828..1c6cb36 100644 --- a/app/QualityHandle.cpp +++ b/app/QualityHandle.cpp @@ -156,8 +156,8 @@ void QualityHandle::update( VideoSubWindow* currSubWindow ) void QualityHandle::measureQuality( QVector apcWindowList ) { unsigned numberOfWindows = apcWindowList.size(); - ClpULong currFrames = 0; - ClpULong numberOfFrames = -1; + std::uint64_t currFrames = 0; + std::uint64_t numberOfFrames = -1; //! Check reference window for( unsigned i = 0; i < numberOfWindows; i++ ) diff --git a/app/dialog/ConfigureFormatDialog.cpp b/app/dialog/ConfigureFormatDialog.cpp index 8d53ab4..d305320 100644 --- a/app/dialog/ConfigureFormatDialog.cpp +++ b/app/dialog/ConfigureFormatDialog.cpp @@ -395,7 +395,7 @@ int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, un int sampling = 0; if( rInputFormat >= 0 ) { - ClpString pelFmtName = CalypFrame::supportedPixelFormatListNames()[rInputFormat]; + std::string pelFmtName = CalypFrame::supportedPixelFormatListNames()[rInputFormat]; for( unsigned int j = 0; j < CalypFrame::supportedColorSpacesListNames().size(); j++ ) { for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames( j ).size(); i++ ) @@ -442,7 +442,7 @@ int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, un rHeight = m_spinBoxheight->value(); colorSpace = m_comboBoxColorSpace->currentIndex(); sampling = m_comboBoxPixelFormat->currentIndex(); - ClpString pelFmtName = CalypFrame::supportedPixelFormatListNames( colorSpace )[sampling]; + std::string pelFmtName = CalypFrame::supportedPixelFormatListNames( colorSpace )[sampling]; for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames().size(); i++ ) { if( pelFmtName == CalypFrame::supportedPixelFormatListNames()[i] ) diff --git a/app/dialog/ModulesHandleOptDialog.cpp b/app/dialog/ModulesHandleOptDialog.cpp index 6b8e8b2..be79e92 100644 --- a/app/dialog/ModulesHandleOptDialog.cpp +++ b/app/dialog/ModulesHandleOptDialog.cpp @@ -72,13 +72,13 @@ public: } return m_pcValue->text(); } - const ClpString& getName() { return m_cName; } + const std::string& getName() { return m_cName; } private: QLineEdit* m_pcValue; QCheckBox* m_pcChecked; QLabel* m_pcDescription; - ClpString m_cName; + std::string m_cName; }; ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget* parent, CalypAppModuleIf* pcCurrModuleIf ) @@ -121,8 +121,8 @@ int ModulesHandleOptDialog::runConfiguration() return QDialog::Rejected; } - std::vector argsArray; - ClpString optionString; + std::vector argsArray; + std::string optionString; QString valueString( "" ); for( int i = 0; i < m_apcOptionList.size(); i++ ) diff --git a/examples/stream/testStreamReading.cpp b/examples/stream/testStreamReading.cpp index 43d9973..bead06a 100644 --- a/examples/stream/testStreamReading.cpp +++ b/examples/stream/testStreamReading.cpp @@ -38,7 +38,7 @@ int main( int argc, char* argv[] ) double n = 0; CalypStream stream; - stream.open( ClpString( CALYP_TEST_DATA_DIR ) + ClpString( "/Foreman.yuv" ), 352, 288, 0, 8, CLP_BIG_ENDIAN, 1, true ); + stream.open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/Foreman.yuv" ), 352, 288, 0, 8, CLP_BIG_ENDIAN, 1, true ); while( 1 ) { diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 84a2323..dd44ad0 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -8,7 +8,7 @@ EXPORT(PACKAGE MyLib) INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..) -SET(Calyp_Lib_Frame_SRCS CalypPixel.cpp PixelFormats.h PixelFormats.cpp CalypFrame.h CalypFrame.cpp CalypPlane.h) +SET(Calyp_Lib_Frame_SRCS CalypPixel.cpp PixelFormats.h PixelFormats.cpp CalypFrame.h CalypFrame.cpp) SET(Calyp_Lib_Stream_SRCS CalypStream.h @@ -57,7 +57,7 @@ IF(USE_OPENCV) LIST(APPEND CALYP_LIB_LINKER_DEPENDENCIES ${OpenCV_LIBRARIES}) ENDIF() -SET(Calyp_Lib_HEADERS CalypDefs.h CalypFrame.h CalypStream.h CalypOptions.h CalypModuleIf.h CalypOpenCVModuleIf.h) +SET(Calyp_Lib_HEADERS CalypFrame.h CalypStream.h CalypOptions.h CalypModuleIf.h) INCLUDE(CMakePackageConfigHelpers) diff --git a/lib/CalypDefs.h b/lib/CalypDefs.h index b8f6c72..af43923 100644 --- a/lib/CalypDefs.h +++ b/lib/CalypDefs.h @@ -27,16 +27,10 @@ #define __CALYPDEFS_H__ #include -#include #include #include #include -using ClpByte = std::uint8_t; -using ClpPel = std::uint16_t; -using ClpULong = std::uint64_t; -using ClpString = std::string; - enum CLP_LOG_LEVEL { CLP_LOG_INFO = 1, @@ -45,94 +39,37 @@ enum CLP_LOG_LEVEL CLP_LOG_ERROR = 4, }; -/** - * \enum CalypColorSpace - * \brief List of supported color spaces - * \ingroup CalypLibGrp - */ -enum CalypColorSpace -{ - CLP_COLOR_INVALID = -1, //!< Invalid - CLP_COLOR_YUV = 0, //!< YUV - CLP_COLOR_RGB = 1, //!< RGB - CLP_COLOR_GRAY = 2, //!< Grayscale - CLP_COLOR_RGBA = 3, //!< RGB + Alpha - CLP_COLOR_MAX = 255, //!< Account for future formats -}; - -/** - * \enum CalypPixelFormats - * \brief List of supported pixel formats - * \ingroup CalypLibGrp - */ -enum CalypPixelFormats -{ - 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 = 255, //!< Account for future formats -}; - -enum CLP_YUV_Components -{ - CLP_LUMA = 0, - CLP_CHROMA_U, - CLP_CHROMA_V, -}; - -enum CLP_RGB_Components -{ - CLP_COLOR_R = 0, - CLP_COLOR_G, - CLP_COLOR_B, - CLP_COLOR_A, -}; - -enum CLP_Endianness -{ - CLP_BIG_ENDIAN = 0, - CLP_LITTLE_ENDIAN = 1, -}; - static const double S_PI = 3.14159265358979323846; static const double S_PI_2 = 1.57079632679489661923; -inline ClpString clpLowercase( const ClpString& in ) +inline std::string clpLowercase( const std::string& in ) { - ClpString out; + std::string out; std::transform( in.begin(), in.end(), std::back_inserter( out ), tolower ); return out; } -inline ClpString clpUppercase( const ClpString& in ) +inline std::string clpUppercase( const std::string& in ) { - ClpString out; + std::string out; std::transform( in.begin(), in.end(), std::back_inserter( out ), toupper ); return out; } struct CalypFailure : public std::exception { - ClpString m_class_name; - ClpString m_error_msg; - CalypFailure( ClpString error_msg ) throw() + std::string m_class_name; + std::string m_error_msg; + CalypFailure( std::string error_msg ) throw() : m_error_msg( error_msg ) {} - CalypFailure( ClpString class_name, ClpString error_msg ) throw() + CalypFailure( std::string class_name, std::string error_msg ) throw() : m_class_name( class_name ), m_error_msg( error_msg ) { } ~CalypFailure() throw() {} const char* what() const throw() { - ClpString* msg = new ClpString( "[" + m_class_name + "] " + m_error_msg ); + std::string* msg = new std::string( "[" + m_class_name + "] " + m_error_msg ); return msg->c_str(); } }; diff --git a/lib/CalypFrame.cpp b/lib/CalypFrame.cpp index c39f070..f7adcdd 100644 --- a/lib/CalypFrame.cpp +++ b/lib/CalypFrame.cpp @@ -28,9 +28,9 @@ #include #include #include -#include #include +#include "CalypDefs.h" #include "config.h" #ifdef USE_OPENCV @@ -54,9 +54,9 @@ constexpr auto kMinBitsPerPixel = 8; constexpr auto kMaxBitsPerPixel = 16; -std::vector CalypFrame::supportedColorSpacesListNames() +std::vector CalypFrame::supportedColorSpacesListNames() { - return std::vector{ + return std::vector{ "YUV", "RGB", "GRAY", @@ -64,9 +64,9 @@ std::vector CalypFrame::supportedColorSpacesListNames() }; } -std::vector CalypFrame::supportedPixelFormatListNames() +std::vector CalypFrame::supportedPixelFormatListNames() { - std::vector formatsList; + std::vector formatsList; for( int i = 0; i < numberOfFormats(); i++ ) { formatsList.push_back( g_CalypPixFmtDescriptorsMap.at( i ).name ); @@ -74,9 +74,9 @@ std::vector CalypFrame::supportedPixelFormatListNames() return formatsList; } -std::vector CalypFrame::supportedPixelFormatListNames( int colorSpace ) +std::vector CalypFrame::supportedPixelFormatListNames( int colorSpace ) { - std::vector formatsList; + std::vector formatsList; for( int i = 0; i < numberOfFormats(); i++ ) { if( g_CalypPixFmtDescriptorsMap.at( i ).colorSpace == colorSpace ) @@ -90,7 +90,7 @@ int CalypFrame::numberOfFormats() return static_cast( g_CalypPixFmtDescriptorsMap.size() ); } -int CalypFrame::findPixelFormat( const ClpString& name ) +int CalypFrame::findPixelFormat( const std::string& name ) { for( int i = 0; i < numberOfFormats(); i++ ) { @@ -112,7 +112,7 @@ public: //! Struct with the pixel format description. const CalypPixelFormatDescriptor* m_pcPelFormat{ nullptr }; - ClpString m_cPelFmtName; + std::string m_cPelFmtName; unsigned int m_uiWidth{ 0 }; //!< Width of the frame unsigned int m_uiHeight{ 0 }; //!< Height of the frame @@ -418,7 +418,7 @@ int CalypFrame::getPelFormat() const return d->m_iPixelFormat; } -ClpString CalypFrame::getPelFmtName() +std::string CalypFrame::getPelFmtName() { return d->m_pcPelFormat->name; } @@ -447,14 +447,14 @@ bool CalypFrame::getHasNegativeValues() const return d->m_bHasNegativeValues; } -ClpULong CalypFrame::getPixels( unsigned channel ) const +std::uint64_t CalypFrame::getPixels( unsigned channel ) const { return getWidth( channel ) * getHeight( channel ); } -ClpULong CalypFrame::getTotalNumberOfPixels() const +std::uint64_t CalypFrame::getTotalNumberOfPixels() const { - ClpULong numberPixels = 0; + std::uint64_t numberPixels = 0; for( unsigned i = 0; i < getNumberChannels(); i++ ) { numberPixels += getPixels( i ); @@ -472,7 +472,7 @@ unsigned CalypFrame::getChromaHeightRatio() const return d->m_pcPelFormat->log2ChromaHeight; } -ClpULong CalypFrame::getChromaLength() const +std::uint64_t CalypFrame::getChromaLength() const { return getWidth( 1 ) * getHeight( 1 ); } @@ -482,19 +482,19 @@ unsigned int CalypFrame::getBitsPel() const return d->m_uiBitsPel; } -ClpULong CalypFrame::getBytesPerFrame() const +std::uint64_t CalypFrame::getBytesPerFrame() const { return getBytesPerFrame( d->m_uiWidth, d->m_uiHeight, d->m_iPixelFormat, d->m_uiBitsPel ); } -ClpULong CalypFrame::getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel ) +std::uint64_t CalypFrame::getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel ) { const CalypPixelFormatDescriptor* pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( iPixelFormat ) ); unsigned int bytesPerPixel = ( bitsPixel - 1 ) / 8 + 1; - ClpULong numberBytes = uiWidth * uiHeight; + std::uint64_t numberBytes = uiWidth * uiHeight; if( pcPelFormat->numberChannels > 1 ) { - ClpULong numberBytesChroma = + std::uint64_t numberBytesChroma = CHROMASHIFT( uiWidth, pcPelFormat->log2ChromaWidth ) * CHROMASHIFT( uiHeight, pcPelFormat->log2ChromaHeight ); numberBytes += ( pcPelFormat->numberChannels - 1 ) * numberBytesChroma; } @@ -1400,9 +1400,9 @@ bool CalypFrame::fromMat( cv::Mat& cvMat, int channel ) ************************************************************** */ -std::vector CalypFrame::supportedQualityMetricsList() +std::vector CalypFrame::supportedQualityMetricsList() { - return std::vector{ + return std::vector{ "PSNR", "MSE", "SSIM", @@ -1410,9 +1410,9 @@ std::vector CalypFrame::supportedQualityMetricsList() }; } -std::vector CalypFrame::supportedQualityMetricsUnitsList() +std::vector CalypFrame::supportedQualityMetricsUnitsList() { - return std::vector{ + return std::vector{ "dB", "", "", @@ -1450,8 +1450,8 @@ double CalypFrame::getMSE( CalypFrame* Org, unsigned int component ) { ClpPel* pPelYUV = getPelBufferYUV()[component][0]; ClpPel* pOrgPelYUV = Org->getPelBufferYUV()[component][0]; - ClpULong numberOfPixels = Org->getHeight( component ) * Org->getWidth( component ); - ClpULong ssd = 0; + std::uint64_t numberOfPixels = Org->getHeight( component ) * Org->getWidth( component ); + std::uint64_t ssd = 0; for( unsigned int i = 0; i < numberOfPixels; i++ ) { int diff = int( *pPelYUV++ ) - int( *pOrgPelYUV++ ); @@ -1466,7 +1466,7 @@ double CalypFrame::getMSE( CalypFrame* Org, unsigned int component ) double CalypFrame::getPSNR( CalypFrame* Org, unsigned int component ) { - ClpULong uiMaxValue = ( 1 << Org->getBitsPel() ) - 1; + std::uint64_t uiMaxValue = ( 1 << Org->getBitsPel() ) - 1; double dPSNR = 100; double dMSE = getMSE( Org, component ); if( dMSE != 0 ) diff --git a/lib/CalypFrame.h b/lib/CalypFrame.h index 8f5f58c..6aa209a 100644 --- a/lib/CalypFrame.h +++ b/lib/CalypFrame.h @@ -26,15 +26,77 @@ #ifndef __CALYPFRAME_H__ #define __CALYPFRAME_H__ +#include +#include +#include +#include #include -#include "CalypDefs.h" - namespace cv { class Mat; } +using ClpPel = std::uint16_t; +using ClpByte = std::uint8_t; + +/** + * \enum CalypColorSpace + * \brief List of supported color spaces + * \ingroup CalypLibGrp + */ +enum CalypColorSpace +{ + CLP_COLOR_INVALID = -1, //!< Invalid + CLP_COLOR_YUV = 0, //!< YUV + CLP_COLOR_RGB = 1, //!< RGB + CLP_COLOR_GRAY = 2, //!< Grayscale + CLP_COLOR_RGBA = 3, //!< RGB + Alpha + CLP_COLOR_MAX = 255, //!< Account for future formats +}; + +/** + * \enum CalypPixelFormats + * \brief List of supported pixel formats + * \ingroup CalypLibGrp + */ +enum CalypPixelFormats +{ + 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 = 255, //!< Account for future formats +}; + +enum CLP_YUV_Components +{ + CLP_LUMA = 0, + CLP_CHROMA_U, + CLP_CHROMA_V, +}; + +enum CLP_RGB_Components +{ + CLP_COLOR_R = 0, + CLP_COLOR_G, + CLP_COLOR_B, + CLP_COLOR_A, +}; + +enum CLP_Endianness +{ + CLP_BIG_ENDIAN = 0, + CLP_LITTLE_ENDIAN = 1, +}; + #define CHROMASHIFT( SIZE, SHIFT ) (unsigned int)( -( ( -( (int)( SIZE ) ) ) >> ( SHIFT ) ) ) /** @@ -79,6 +141,48 @@ private: std::unique_ptr d; }; +/** + * \class CalypPlane + * \ingroup CalypLibGrp CalypPlaneGrp + * \brief Frame handling class + */ +template +class CalypPlane +{ +public: + CalypPlane() noexcept = default; + CalypPlane( std::size_t width, std::size_t height ) noexcept { resize( width, height ); } + + ~CalypPlane() noexcept = default; + CalypPlane( const CalypPlane& buffer ) noexcept = default; + CalypPlane( CalypPlane&& buffer ) noexcept = default; + auto operator=( const CalypPlane& buffer ) -> CalypPlane& = default; + auto operator=( CalypPlane&& buffer ) noexcept -> CalypPlane& = default; + + auto operator[]( std::size_t row ) const& noexcept -> const std::span& { return m_rows[row]; } + auto operator[]( std::size_t row ) & noexcept -> std::span& { return m_rows[row]; } + + auto operator[]( std::size_t row ) const&& noexcept { return m_rows[row]; } + auto operator[]( std::size_t row ) && noexcept { return m_rows[row]; } + + auto data() noexcept { return std::span( m_data ); } + auto data() const noexcept { return std::span( m_data ); } + + void resize( std::size_t width, std::size_t height ) noexcept + { + m_data.resize( width * height ); + m_rows.resize( height ); + for( std::size_t y = 0; y < height; y++ ) + { + m_rows[y] = std::span( m_data ).subspan( y * width, width ); + } + } + +private: + std::vector m_data; + std::vector> m_rows; +}; + /** * \class CalypFrame * \ingroup CalypLibGrp CalypFrameGrp @@ -92,17 +196,17 @@ public: * of CalypFrame * @return vector of strings with pixel formats names */ - static std::vector supportedColorSpacesListNames(); + static std::vector supportedColorSpacesListNames(); /** * Function that handles the supported pixel formats * of CalypFrame * @return vector of strings with pixel formats names */ - static std::vector supportedPixelFormatListNames(); - static std::vector supportedPixelFormatListNames( int colorSpace ); + static std::vector supportedPixelFormatListNames(); + static std::vector supportedPixelFormatListNames( int colorSpace ); static int numberOfFormats(); - static int findPixelFormat( const ClpString& name ); + static int findPixelFormat( const std::string& name ); static int pelformatColorSpace( const int idx ); /** @@ -203,7 +307,7 @@ public: * Get pixel format information * @return pixel format name */ - ClpString getPelFmtName(); + std::string getPelFmtName(); /** * Get color space information @@ -242,13 +346,13 @@ public: * @param channel/component * @return number of pixels */ - ClpULong getPixels( unsigned channel = 0 ) const; + std::uint64_t getPixels( unsigned channel = 0 ) const; /** * Get the total number of pixels of the frame * @return number of pixels */ - ClpULong getTotalNumberOfPixels() const; + std::uint64_t getTotalNumberOfPixels() const; /** * Get chroma width ratio @@ -266,7 +370,7 @@ public: * Get number of pixels in each chroma channel * @return number of pixels */ - ClpULong getChromaLength() const; + std::uint64_t getChromaLength() const; /** * Get number of bits per pixel @@ -278,13 +382,13 @@ public: * Get number of bytes per frame of an existing frame * @return number of bytes per frame */ - ClpULong getBytesPerFrame() const; + std::uint64_t getBytesPerFrame() const; /** * Get number of bytes per frame of a specific pixel format * @return number of bytes per frame */ - static ClpULong getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel ); + static std::uint64_t getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel ); /** * Reset frame pixels to zero @@ -430,8 +534,8 @@ public: NUMBER_METRICS, }; - static std::vector supportedQualityMetricsList(); - static std::vector supportedQualityMetricsUnitsList(); + static std::vector supportedQualityMetricsList(); + static std::vector supportedQualityMetricsUnitsList(); double getQuality( int Metric, CalypFrame* Org, unsigned int component ); double getMSE( CalypFrame* Org, unsigned int component ); double getPSNR( CalypFrame* Org, unsigned int component ); diff --git a/lib/CalypModuleIf.h b/lib/CalypModuleIf.h index b115b56..b04ddf3 100644 --- a/lib/CalypModuleIf.h +++ b/lib/CalypModuleIf.h @@ -161,7 +161,7 @@ public: virtual CalypFrame* process( std::vector ) { return NULL; } virtual double measure( std::vector ) { return 0; } virtual bool keyPressed( enum Module_Key_Supported ) { return false; } - virtual ClpString moduleInfo() { return ClpString(); } + virtual std::string moduleInfo() { return std::string(); } /** * Module API version 3 */ @@ -174,6 +174,43 @@ public: }; }; +namespace cv +{ +class Mat; +} + +/** + * \class CalypOpenCVModuleIf + * \ingroup CalypLib Calyp_Modules + * \brief Abstract class for modules using OpenCV library + */ +class CalypOpenCVModuleIf : public CalypModuleIf +{ + using Mat = cv::Mat; + +protected: + //const char* m_pchPythonFunctionName; + std::unique_ptr m_pcOutputFrame; + bool m_bConvertToGray; + +public: + CalypOpenCVModuleIf() + { + m_bConvertToGray = false; + }; + virtual ~CalypOpenCVModuleIf() {} + + // Common API + bool create( std::vector apcFrameList ); + CalypFrame* process( std::vector apcFrameList ); + void destroy(); + + // API using OpenCV + virtual cv::Mat* create_using_opencv( const std::vector& apcFrameList ) { return nullptr; }; + virtual Mat* process_using_opencv( const std::vector& apcFrameList ) = 0; + virtual void destroy_using_opencv(){}; +}; + using CalypModulePtr = std::unique_ptr; #endif // __CALYPMODULESIF_H__ diff --git a/lib/CalypOpenCVModuleIf.cpp b/lib/CalypOpenCVModuleIf.cpp index ea07d76..112df74 100644 --- a/lib/CalypOpenCVModuleIf.cpp +++ b/lib/CalypOpenCVModuleIf.cpp @@ -22,10 +22,9 @@ * \brief Calyp modules interface for OpenCV */ -#include "CalypOpenCVModuleIf.h" +#include "CalypModuleIf.h" // OpenCV -#include #include bool CalypOpenCVModuleIf::create( std::vector apcFrameList ) diff --git a/lib/CalypOpenCVModuleIf.h b/lib/CalypOpenCVModuleIf.h deleted file mode 100644 index 6ecf17b..0000000 --- a/lib/CalypOpenCVModuleIf.h +++ /dev/null @@ -1,70 +0,0 @@ -/* This file is a part of Calyp project - * Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) - * Luis Lucas (luisfrlucas@gmail.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/** - * \file CalypOpenCVModuleIf.h - * \ingroup CalypLibGroup - * \brief Calyp modules interface for OpenCV - */ - -#ifndef __CALYPOPENCVMODULEIF_H__ -#define __CALYPOPENCVMODULEIF_H__ - -#include - -#include "CalypModuleIf.h" - -namespace cv -{ -class Mat; -} - -/** - * \class CalypOpenCVModuleIf - * \ingroup CalypLib Calyp_Modules - * \brief Abstract class for modules using OpenCV library - */ -class CalypOpenCVModuleIf : public CalypModuleIf -{ - using Mat = cv::Mat; - -protected: - //const char* m_pchPythonFunctionName; - std::unique_ptr m_pcOutputFrame; - bool m_bConvertToGray; - -public: - CalypOpenCVModuleIf() - { - m_bConvertToGray = false; - }; - virtual ~CalypOpenCVModuleIf() {} - - // Common API - bool create( std::vector apcFrameList ); - CalypFrame* process( std::vector apcFrameList ); - void destroy(); - - // API using OpenCV - virtual cv::Mat* create_using_opencv( const std::vector& apcFrameList ) { return nullptr; }; - virtual Mat* process_using_opencv( const std::vector& apcFrameList ) = 0; - virtual void destroy_using_opencv(){}; -}; - -#endif // __CALYPOPENCVMODULEIF_H__ diff --git a/lib/CalypOptions.cpp b/lib/CalypOptions.cpp index 493b85e..bec3f2a 100644 --- a/lib/CalypOptions.cpp +++ b/lib/CalypOptions.cpp @@ -49,9 +49,9 @@ using namespace std; struct ParseFailure : public std::exception { - ClpString arg; - ClpString val; - ParseFailure( ClpString arg0, ClpString val0 ) throw() + std::string arg; + std::string val; + ParseFailure( std::string arg0, std::string val0 ) throw() : arg( arg0 ), val( val0 ) {} ~ParseFailure() throw() {} const char* what() const throw() { return "Option Parse Failure"; } @@ -61,9 +61,9 @@ struct ParseFailure : public std::exception class boolOption : public OptionBase { public: - boolOption( const ClpString& name, const ClpString& desc ) + boolOption( const std::string& name, const std::string& desc ) : OptionBase( name, desc, "(1-0)" ) { is_binary = true; } - void parse( const ClpString& arg ) { arg_count++; } + void parse( const std::string& arg ) { arg_count++; } }; /** Type specific option storage */ @@ -71,20 +71,20 @@ template class StandardOption : public OptionBase { public: - StandardOption( const ClpString& name, T& storage, const ClpString& desc, const ClpString& def ) + StandardOption( const std::string& name, T& storage, const std::string& desc, const std::string& def ) : OptionBase( name, desc, def ), opt_storage( storage ) { is_binary = false; } - void parse( const ClpString& arg ); + void parse( const std::string& arg ); T& opt_storage; std::vector opt_storage_array; }; /* Generic parsing */ template -inline void StandardOption::parse( const ClpString& arg ) +inline void StandardOption::parse( const std::string& arg ) { if( !is_binary ) { @@ -103,7 +103,7 @@ inline void StandardOption::parse( const ClpString& arg ) } template <> -inline void StandardOption>::parse( const ClpString& arg ) +inline void StandardOption>::parse( const std::string& arg ) { unsigned int aux_opt_storage; std::istringstream arg_ss( arg, std::istringstream::in ); @@ -121,7 +121,7 @@ inline void StandardOption>::parse( const ClpString& a } template <> -inline void StandardOption>::parse( const ClpString& arg ) +inline void StandardOption>::parse( const std::string& arg ) { int aux_opt_storage; std::istringstream arg_ss( arg, std::istringstream::in ); @@ -140,7 +140,7 @@ inline void StandardOption>::parse( const ClpString& arg ) /* string parsing is specialized */ template <> -inline void StandardOption::parse( const ClpString& arg ) +inline void StandardOption::parse( const std::string& arg ) { opt_storage = arg; arg_count++; @@ -148,7 +148,7 @@ inline void StandardOption::parse( const ClpString& arg ) /* string vector parsing is specialized */ template <> -inline void StandardOption>::parse( const ClpString& arg ) +inline void StandardOption>::parse( const std::string& arg ) { opt_storage.push_back( arg ); arg_count++; @@ -158,15 +158,15 @@ inline void StandardOption>::parse( const ClpString& arg struct FunctionOption : public OptionBase { public: - typedef void( Func )( CalypOptions&, const ClpString& ); + typedef void( Func )( CalypOptions&, const std::string& ); - FunctionOption( const ClpString& name, CalypOptions& parent_, Func* func_, const ClpString& desc, const ClpString& def ) + FunctionOption( const std::string& name, CalypOptions& parent_, Func* func_, const std::string& desc, const std::string& def ) : OptionBase( name, desc, def ), parent( parent_ ), func( func_ ) { is_binary = false; } - void parse( const ClpString& arg ) + void parse( const std::string& arg ) { func( parent, arg ); arg_count++; @@ -174,7 +174,7 @@ public: private: CalypOptions& parent; - void ( *func )( CalypOptions&, const ClpString& ); + void ( *func )( CalypOptions&, const std::string& ); }; /* Helper method to initiate adding options to Options */ @@ -185,7 +185,7 @@ private: * with default_val as the default value * with desc as an optional help description */ -CalypOptions& CalypOptions::operator()( const ClpString& name, const ClpString& desc ) +CalypOptions& CalypOptions::operator()( const std::string& name, const std::string& desc ) { addOption( new boolOption( name, desc ) ); return *this; @@ -197,31 +197,31 @@ CalypOptions& CalypOptions::operator()( const ClpString& name, const ClpString& * with desc as an optional help description */ template -CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc ) +CalypOptions& CalypOptions::operator()( const std::string& name, T& storage, const std::string& desc ) { - addOption( new StandardOption( name, storage, desc, ClpString( "" ) ) ); + addOption( new StandardOption( name, storage, desc, std::string( "" ) ) ); return *this; } template -CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc, const ClpString& defaults ) +CalypOptions& CalypOptions::operator()( const std::string& name, T& storage, const std::string& desc, const std::string& defaults ) { addOption( new StandardOption( name, storage, desc ) ); return *this; } -template CalypOptions& CalypOptions::operator()( const ClpString& name, bool& storage, const ClpString& desc ); -template CalypOptions& CalypOptions::operator()( const ClpString& name, unsigned int& storage, const ClpString& desc ); -template CalypOptions& CalypOptions::operator()( const ClpString& name, int& storage, const ClpString& desc ); -template CalypOptions& CalypOptions::operator()( const ClpString& name, long& storage, const ClpString& desc ); -template CalypOptions& CalypOptions::operator()( const ClpString& name, long long int& storage, const ClpString& desc ); -template CalypOptions& CalypOptions::operator()( const ClpString& name, ClpString& storage, const ClpString& desc ); -template CalypOptions& CalypOptions::operator()( const ClpString& name, std::vector& storage, - const ClpString& desc ); -template CalypOptions& CalypOptions::operator()( const ClpString& name, std::vector& storage, - const ClpString& desc ); -template CalypOptions& CalypOptions::operator()( const ClpString& name, std::vector& storage, - const ClpString& desc ); +template CalypOptions& CalypOptions::operator()( const std::string& name, bool& storage, const std::string& desc ); +template CalypOptions& CalypOptions::operator()( const std::string& name, unsigned int& storage, const std::string& desc ); +template CalypOptions& CalypOptions::operator()( const std::string& name, int& storage, const std::string& desc ); +template CalypOptions& CalypOptions::operator()( const std::string& name, long& storage, const std::string& desc ); +template CalypOptions& CalypOptions::operator()( const std::string& name, long long int& storage, const std::string& desc ); +template CalypOptions& CalypOptions::operator()( const std::string& name, std::string& storage, const std::string& desc ); +template CalypOptions& CalypOptions::operator()( const std::string& name, std::vector& storage, + const std::string& desc ); +template CalypOptions& CalypOptions::operator()( const std::string& name, std::vector& storage, + const std::string& desc ); +template CalypOptions& CalypOptions::operator()( const std::string& name, std::vector& storage, + const std::string& desc ); CalypOptions::Option::Option() : opt( 0 ) {} @@ -232,7 +232,7 @@ CalypOptions::Option::~Option() delete opt; } -CalypOptions::CalypOptions( const ClpString& name ) +CalypOptions::CalypOptions( const std::string& name ) { m_cOptionGroupName = name; m_bAllowUnkonw = true; @@ -246,12 +246,12 @@ CalypOptions::~CalypOptions() } } -OptionBase* CalypOptions::operator[]( const ClpString& optName ) +OptionBase* CalypOptions::operator[]( const std::string& optName ) { return getOption( optName ); } -OptionBase* CalypOptions::getOption( const ClpString& optName ) +OptionBase* CalypOptions::getOption( const std::string& optName ) { CalypOptions::OptionMap::iterator opt_it; opt_it = opt_short_map.find( optName ); @@ -275,7 +275,7 @@ OptionBase* CalypOptions::getOption( const ClpString& optName ) return NULL; } -bool CalypOptions::hasOpt( const ClpString& optName ) +bool CalypOptions::hasOpt( const std::string& optName ) { OptionBase* opt = getOption( optName ); return opt ? opt->count() > 0 ? true : false : false; @@ -545,7 +545,7 @@ list CalypOptions::scanArgv( unsigned int argc, char* argv[] ) return non_option_arguments; } -void CalypOptions::parse( std::vector args_array ) +void CalypOptions::parse( std::vector args_array ) { for( unsigned int i = 0; i < args_array.size(); i++ ) { diff --git a/lib/CalypOptions.h b/lib/CalypOptions.h index 5325d93..bb95101 100644 --- a/lib/CalypOptions.h +++ b/lib/CalypOptions.h @@ -56,17 +56,17 @@ class OptionBase { public: - OptionBase( const ClpString& name, const ClpString& desc, const ClpString& def ) + OptionBase( const std::string& name, const std::string& desc, const std::string& def ) : arg_count( 0 ), opt_string( name ), opt_desc( desc ), opt_defaults( def ) {} virtual ~OptionBase() {} /* parse argument arg, to obtain a value for the option */ - virtual void parse( const ClpString& arg ) = 0; + virtual void parse( const std::string& arg ) = 0; int count() { return arg_count; } bool isBinary() { return is_binary; } int arg_count; - ClpString opt_string; - ClpString opt_desc; - ClpString opt_defaults; + std::string opt_string; + std::string opt_desc; + std::string opt_defaults; bool is_binary; }; @@ -82,25 +82,25 @@ public: { Option(); ~Option(); - std::list opt_long; - std::list opt_short; + std::list opt_long; + std::list opt_short; OptionBase* opt; }; typedef std::list OptionsList; - CalypOptions( const ClpString& name = "" ); + CalypOptions( const std::string& name = "" ); ~CalypOptions(); int parse( unsigned int argc, char* argv[] ); - void parse( std::vector args_array ); + void parse( std::vector args_array ); std::list& getUnhandledArgs() { return m_aUnhandledArgs; } void doHelp( std::ostream& out, unsigned columns = 80 ); - OptionBase* operator[]( const ClpString& optName ); - OptionBase* getOption( const ClpString& optName ); + OptionBase* operator[]( const std::string& optName ); + OptionBase* getOption( const std::string& optName ); - bool hasOpt( const ClpString& optName ); + bool hasOpt( const std::string& optName ); OptionsList getOptionList() { return opt_list; } void addDefaultOptions(); @@ -113,7 +113,7 @@ public: * with default_val as the default value * with desc as an optional help description */ - CalypOptions& operator()( const ClpString& name, const ClpString& desc ); + CalypOptions& operator()( const std::string& name, const std::string& desc ); /** * Add option described by name to the parent Options list, @@ -122,28 +122,28 @@ public: * description and range along with default value */ template - CalypOptions& operator()( const ClpString& name, T& storage, const ClpString& desc ); + CalypOptions& operator()( const std::string& name, T& storage, const std::string& desc ); template - CalypOptions& operator()( const ClpString& name, T& storage, const ClpString& desc, const ClpString& defaults ); + CalypOptions& operator()( const std::string& name, T& storage, const std::string& desc, const std::string& defaults ); bool checkListingOpts(); private: - typedef std::map OptionMap; + typedef std::map OptionMap; OptionMap opt_long_map; OptionMap opt_short_map; OptionsList opt_list; - ClpString m_cOptionGroupName; + std::string m_cOptionGroupName; bool m_bAllowUnkonw; std::list m_aUnhandledArgs; - bool storePair( bool allow_long, bool allow_short, const ClpString& name, const ClpString& value ); - bool storePair( const ClpString& name, const ClpString& value ); + bool storePair( bool allow_long, bool allow_short, const std::string& name, const std::string& value ); + bool storePair( const std::string& name, const std::string& value ); unsigned int parseLONG( unsigned int argc, char* argv[] ); - unsigned int parseLONG( ClpString arg ); + unsigned int parseLONG( std::string arg ); unsigned int parseSHORT( unsigned int argc, char* argv[] ); std::list scanArgv( unsigned int argc, char* argv[] ); }; diff --git a/lib/CalypPlane.h b/lib/CalypPlane.h deleted file mode 100644 index 898a4ce..0000000 --- a/lib/CalypPlane.h +++ /dev/null @@ -1,76 +0,0 @@ -/* This file is a part of Calyp project - * Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) - * Luis Lucas (luisfrlucas@gmail.com) - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -/** - * \file CalypPlane.h - * \ingroup CalypFrameGrp - * \brief Video Frame Plane handling - */ - -#ifndef __CALYPPLANE_H__ -#define __CALYPPLANE_H__ - -#include -#include - -#include "CalypDefs.h" - -/** - * \class CalypPlane - * \ingroup CalypLibGrp CalypPlaneGrp - * \brief Frame handling class - */ -template -class CalypPlane -{ -public: - CalypPlane() noexcept = default; - CalypPlane( std::size_t width, std::size_t height ) noexcept { resize( width, height ); } - - ~CalypPlane() noexcept = default; - CalypPlane( const CalypPlane& buffer ) noexcept = default; - CalypPlane( CalypPlane&& buffer ) noexcept = default; - auto operator=( const CalypPlane& buffer ) -> CalypPlane& = default; - auto operator=( CalypPlane&& buffer ) noexcept -> CalypPlane& = default; - - auto operator[]( std::size_t row ) const& noexcept -> const std::span& { return m_rows[row]; } - auto operator[]( std::size_t row ) & noexcept -> std::span& { return m_rows[row]; } - - auto operator[]( std::size_t row ) const&& noexcept { return m_rows[row]; } - auto operator[]( std::size_t row ) && noexcept { return m_rows[row]; } - - auto data() noexcept { return std::span( m_data ); } - auto data() const noexcept { return std::span( m_data ); } - - void resize( std::size_t width, std::size_t height ) noexcept - { - m_data.resize( width * height ); - m_rows.resize( height ); - for( std::size_t y = 0; y < height; y++ ) - { - m_rows[y] = std::span( m_data ).subspan( y * width, width ); - } - } - -private: - std::vector m_data; - std::vector> m_rows; -}; - -#endif // __CALYPPLANE_H__ diff --git a/lib/CalypStream.cpp b/lib/CalypStream.cpp index cd3efd4..28893f6 100644 --- a/lib/CalypStream.cpp +++ b/lib/CalypStream.cpp @@ -176,7 +176,7 @@ public: // std::deque> frameFifo; // std::size_t bufferIdx{ 0 }; - ClpString cFilename; + std::string cFilename; long long int iCurrFrameNum; bool bLoadAll; @@ -239,13 +239,13 @@ public: } }; -std::vector CalypStreamFormat::getExts() +std::vector CalypStreamFormat::getExts() { - std::vector arrayExt; - ClpString::size_type prev_pos = 0, pos = 0; - while( ( pos = formatExt.find( ',', pos ) ) != ClpString::npos ) + std::vector arrayExt; + std::string::size_type prev_pos = 0, pos = 0; + while( ( pos = formatExt.find( ',', pos ) ) != std::string::npos ) { - ClpString substring( formatExt.substr( prev_pos, pos - prev_pos ) ); + std::string substring( formatExt.substr( prev_pos, pos - prev_pos ) ); arrayExt.push_back( substring ); prev_pos = ++pos; } @@ -253,9 +253,9 @@ std::vector CalypStreamFormat::getExts() return arrayExt; } -CreateStreamHandlerFn CalypStream::findStreamHandler( ClpString strFilename, bool bRead ) +CreateStreamHandlerFn CalypStream::findStreamHandler( std::string strFilename, bool bRead ) { - ClpString currExt = strFilename.substr( strFilename.find_last_of( "." ) + 1 ); + std::string currExt = strFilename.substr( strFilename.find_last_of( "." ) + 1 ); currExt = clpLowercase( currExt ); std::vector supportedFmts; @@ -269,14 +269,14 @@ CreateStreamHandlerFn CalypStream::findStreamHandler( ClpString strFilename, boo } for( unsigned int i = 0; i < supportedFmts.size(); i++ ) { - std::vector arrayExt = supportedFmts[i].getExts(); - for( std::vector::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e ) + std::vector arrayExt = supportedFmts[i].getExts(); + for( std::vector::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e ) { if( currExt != "" && currExt == *e ) { return supportedFmts[i].formatFct; } - else if( strFilename.find( *e ) != ClpString::npos ) + else if( strFilename.find( *e ) != std::string::npos ) { return supportedFmts[i].formatFct; } @@ -297,16 +297,16 @@ CalypStream::CalypStream() CalypStream::~CalypStream() = default; -ClpString CalypStream::getFormatName() const +std::string CalypStream::getFormatName() const { return !d->handler ? "" : d->handler->getFormatName(); } -ClpString CalypStream::getCodecName() const +std::string CalypStream::getCodecName() const { return !d->handler ? "" : d->handler->getCodecName(); } -bool CalypStream::open( ClpString filename, ClpString resolution, ClpString input_format_name, unsigned int bitsPel, int endianness, bool hasNegative, +bool CalypStream::open( std::string filename, std::string resolution, std::string input_format_name, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate, bool bInput ) { unsigned int width = 0; @@ -332,13 +332,13 @@ bool CalypStream::open( ClpString filename, ClpString resolution, ClpString inpu return open( filename, width, height, input_format, bitsPel, endianness, hasNegative, frame_rate, bInput ); } -bool CalypStream::open( ClpString filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, +bool CalypStream::open( std::string filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, unsigned int frame_rate, bool bInput ) { return open( filename, width, height, input_format, bitsPel, endianness, false, frame_rate, bInput ); } -bool CalypStream::open( ClpString filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, bool hasNegative, +bool CalypStream::open( std::string filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate, bool bInput ) { if( d->isInit ) @@ -441,7 +441,7 @@ bool CalypStream::reload() if( !d->handler->openHandler( d->cFilename, d->isInput ) ) { throw CalypFailure( "CalypStream", "Cannot open stream " + d->cFilename + " with the " + - ClpString( d->handler->m_pchHandlerName ) + " handler" ); + std::string( d->handler->m_pchHandlerName ) + " handler" ); } const CalypFrame* refFrame = d->frameBuffer->ref(); d->handler->m_uiNBytesPerFrame = refFrame->getBytesPerFrame(); @@ -463,7 +463,7 @@ bool CalypStream::reload() return true; } -ClpString CalypStream::getFileName() const +std::string CalypStream::getFileName() const { return d->cFilename; } @@ -473,7 +473,7 @@ bool CalypStream::isNative() const return d->handler->m_bNative; } -ClpULong CalypStream::getFrameNum() const +std::uint64_t CalypStream::getFrameNum() const { return d->handler->m_uiTotalNumberFrames; } @@ -633,12 +633,12 @@ void CalypStream::writeFrame( const CalypFrame& pcFrame ) return; } -bool CalypStream::saveFrame( const ClpString& filename ) +bool CalypStream::saveFrame( const std::string& filename ) { return saveFrame( filename, *getCurrFrame() ); } -bool CalypStream::saveFrame( const ClpString& filename, const CalypFrame& saveFrame ) +bool CalypStream::saveFrame( const std::string& filename, const CalypFrame& saveFrame ) { CalypStream auxSaveStream; if( !auxSaveStream.open( filename, saveFrame.getWidth(), saveFrame.getHeight(), saveFrame.getPelFormat(), diff --git a/lib/CalypStream.h b/lib/CalypStream.h index b420bb6..4718351 100644 --- a/lib/CalypStream.h +++ b/lib/CalypStream.h @@ -38,16 +38,16 @@ typedef CalypStreamHandlerIf* ( *CreateStreamHandlerFn )( void ); struct CalypStreamFormat { - ClpString formatName; - ClpString formatExt; - std::vector getExts(); - ClpString formatPattern; + std::string formatName; + std::string formatExt; + std::vector getExts(); + std::string formatPattern; CreateStreamHandlerFn formatFct; }; struct CalypStandardResolution { - ClpString shortName; + std::string shortName; unsigned int uiWidth; unsigned int uiHeight; }; @@ -63,7 +63,7 @@ public: static std::vector supportedReadFormats(); static std::vector supportedWriteFormats(); - static CreateStreamHandlerFn findStreamHandler( ClpString strFilename, bool bRead ); + static CreateStreamHandlerFn findStreamHandler( std::string strFilename, bool bRead ); static std::vector stdResolutionSizes(); @@ -74,21 +74,21 @@ public: CalypStream& operator=( const CalypStream& other ) = delete; ~CalypStream(); - ClpString getFormatName() const; - ClpString getCodecName() const; + std::string getFormatName() const; + std::string getCodecName() const; - bool open( ClpString filename, ClpString resolution, ClpString input_format, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate, + bool open( std::string filename, std::string resolution, std::string input_format, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate, bool bInput ); - bool open( ClpString filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, unsigned int frame_rate, + bool open( std::string filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, unsigned int frame_rate, bool bInput ); - bool open( ClpString filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate, + bool open( std::string filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate, bool bInput ); bool reload(); bool isNative() const; - ClpString getFileName() const; - ClpULong getFrameNum() const; + std::string getFileName() const; + std::uint64_t getFrameNum() const; unsigned int getWidth() const; unsigned int getHeight() const; unsigned int getBitsPerPixel() const; @@ -112,8 +112,8 @@ public: void writeFrame( const CalypFrame& pcFrame ); - bool saveFrame( const ClpString& filename ); - static bool saveFrame( const ClpString& filename, const CalypFrame& saveFrame ); + bool saveFrame( const std::string& filename ); + static bool saveFrame( const std::string& filename, const CalypFrame& saveFrame ); bool seekInputRelative( bool bIsFoward ); bool seekInput( unsigned long new_frame_num ); diff --git a/lib/CalypStreamHandlerIf.h b/lib/CalypStreamHandlerIf.h index 9207226..f8467f6 100644 --- a/lib/CalypStreamHandlerIf.h +++ b/lib/CalypStreamHandlerIf.h @@ -87,36 +87,36 @@ public: virtual ~CalypStreamHandlerIf() {} virtual void Delete() = 0; - virtual bool openHandler( ClpString strFilename, bool bInput ) = 0; + virtual bool openHandler( std::string strFilename, bool bInput ) = 0; virtual void closeHandler() = 0; virtual bool configureBuffer( const CalypFrame& pcFrame ) = 0; - virtual bool seek( ClpULong iFrameNum ) = 0; + virtual bool seek( std::uint64_t iFrameNum ) = 0; virtual bool read( CalypFrame& pcFrame ) = 0; virtual bool write( const CalypFrame& pcFrame ) = 0; virtual void calculateFrameNumber(){}; - ClpString getFormatName() { return m_strFormatName; } - ClpString getCodecName() { return m_strCodecName; } + std::string getFormatName() { return m_strFormatName; } + std::string getCodecName() { return m_strCodecName; } protected: const char* m_pchHandlerName; - ClpString m_strFormatName; - ClpString m_strCodecName; + std::string m_strFormatName; + std::string m_strCodecName; bool m_bIsInput; bool m_bNative; - ClpString m_cFilename; + std::string m_cFilename; unsigned int m_uiWidth; unsigned int m_uiHeight; int m_iPixelFormat; unsigned int m_uiBitsPerPixel; int m_iEndianness; double m_dFrameRate; - ClpULong m_uiCurrFrameFileIdx; - ClpULong m_uiTotalNumberFrames; + std::uint64_t m_uiCurrFrameFileIdx; + std::uint64_t m_uiTotalNumberFrames; std::vector m_pStreamBuffer; - ClpULong m_uiNBytesPerFrame; + std::uint64_t m_uiNBytesPerFrame; bool m_isEOF; }; diff --git a/lib/StreamHandlerLibav.cpp b/lib/StreamHandlerLibav.cpp index bc1e0bb..89c0b36 100644 --- a/lib/StreamHandlerLibav.cpp +++ b/lib/StreamHandlerLibav.cpp @@ -63,7 +63,7 @@ StreamHandlerLibav::StreamHandlerLibav() m_pchHandlerName = "FFmpeg"; } -bool StreamHandlerLibav::openHandler( ClpString strFilename, bool bInput ) +bool StreamHandlerLibav::openHandler( std::string strFilename, bool bInput ) { const char* filename = strFilename.c_str(); @@ -332,7 +332,7 @@ bool StreamHandlerLibav::configureBuffer( const CalypFrame& pcFrame ) void StreamHandlerLibav::calculateFrameNumber() { - ClpULong num_frames; + std::uint64_t num_frames; /*if( m_cStream->nb_frames ) { num_frames = m_cStream->nb_frames; @@ -439,7 +439,7 @@ bool StreamHandlerLibav::write( const CalypFrame& pcFrame ) return false; } -bool StreamHandlerLibav::seek( ClpULong iFrameNum ) +bool StreamHandlerLibav::seek( std::uint64_t iFrameNum ) { if( m_uiTotalNumberFrames == 1 ) return true; diff --git a/lib/StreamHandlerLibav.h b/lib/StreamHandlerLibav.h index afa5599..7b3988f 100644 --- a/lib/StreamHandlerLibav.h +++ b/lib/StreamHandlerLibav.h @@ -63,11 +63,11 @@ class StreamHandlerLibav : public CalypStreamHandlerIf public: StreamHandlerLibav(); ~StreamHandlerLibav() {} - bool openHandler( ClpString strFilename, bool bInput ); + bool openHandler( std::string strFilename, bool bInput ); void closeHandler(); bool configureBuffer( const CalypFrame& pcFrame ); void calculateFrameNumber(); - bool seek( ClpULong iFrameNum ); + bool seek( std::uint64_t iFrameNum ); bool read( CalypFrame& pcFrame ); bool write( const CalypFrame& pcFrame ); diff --git a/lib/StreamHandlerOpenCV.cpp b/lib/StreamHandlerOpenCV.cpp index 3565484..d9530c3 100644 --- a/lib/StreamHandlerOpenCV.cpp +++ b/lib/StreamHandlerOpenCV.cpp @@ -63,7 +63,7 @@ StreamHandlerOpenCV::StreamHandlerOpenCV() pcVideoCapture = NULL; } -bool StreamHandlerOpenCV::openHandler( ClpString strFilename, bool bInput ) +bool StreamHandlerOpenCV::openHandler( std::string strFilename, bool bInput ) { m_cFilename = strFilename; if( bInput ) @@ -72,12 +72,12 @@ bool StreamHandlerOpenCV::openHandler( ClpString strFilename, bool bInput ) /* * Special filename to handle webcam input */ - if( m_cFilename.find( "/dev/video" ) != ClpString::npos ) + if( m_cFilename.find( "/dev/video" ) != std::string::npos ) { int iDeviceId = 0; - if( m_cFilename.find( "/dev/video0" ) != ClpString::npos ) + if( m_cFilename.find( "/dev/video0" ) != std::string::npos ) iDeviceId = 0; - else if( m_cFilename.find( "/dev/video1" ) != ClpString::npos ) + else if( m_cFilename.find( "/dev/video1" ) != std::string::npos ) iDeviceId = 1; m_strFormatName = "DEV"; @@ -130,7 +130,7 @@ bool StreamHandlerOpenCV::configureBuffer( const CalypFrame& pcFrame ) return true; } -bool StreamHandlerOpenCV::seek( ClpULong iFrameNum ) +bool StreamHandlerOpenCV::seek( std::uint64_t iFrameNum ) { // m_uiCurrFrameFileIdx = return true; diff --git a/lib/StreamHandlerOpenCV.h b/lib/StreamHandlerOpenCV.h index e1e083c..14c407b 100644 --- a/lib/StreamHandlerOpenCV.h +++ b/lib/StreamHandlerOpenCV.h @@ -40,10 +40,10 @@ class StreamHandlerOpenCV : public CalypStreamHandlerIf public: StreamHandlerOpenCV(); ~StreamHandlerOpenCV() {} - bool openHandler( ClpString strFilename, bool bInput ); + bool openHandler( std::string strFilename, bool bInput ); void closeHandler(); bool configureBuffer( const CalypFrame& pcFrame ); - bool seek( ClpULong iFrameNum ); + bool seek( std::uint64_t iFrameNum ); bool read( CalypFrame& pcFrame ); bool write( const CalypFrame& pcFrame ); diff --git a/lib/StreamHandlerPortableMap.cpp b/lib/StreamHandlerPortableMap.cpp index 4ecb345..075999a 100644 --- a/lib/StreamHandlerPortableMap.cpp +++ b/lib/StreamHandlerPortableMap.cpp @@ -47,7 +47,7 @@ std::vector StreamHandlerPortableMap::supportedWriteFormats() END_REGIST_CALYP_SUPPORTED_FMT; } -bool StreamHandlerPortableMap::openHandler( ClpString strFilename, bool bInput ) +bool StreamHandlerPortableMap::openHandler( std::string strFilename, bool bInput ) { m_bIsInput = bInput; m_pFile = NULL; @@ -131,7 +131,7 @@ bool StreamHandlerPortableMap::configureBuffer( const CalypFrame& pcFrame ) return true; } -bool StreamHandlerPortableMap::seek( ClpULong iFrameNum ) +bool StreamHandlerPortableMap::seek( std::uint64_t iFrameNum ) { // m_uiCurrFrameFileIdx = return true; diff --git a/lib/StreamHandlerPortableMap.h b/lib/StreamHandlerPortableMap.h index 007ec36..e7c63bb 100644 --- a/lib/StreamHandlerPortableMap.h +++ b/lib/StreamHandlerPortableMap.h @@ -35,10 +35,10 @@ class StreamHandlerPortableMap : public CalypStreamHandlerIf public: StreamHandlerPortableMap() { m_pchHandlerName = "PortableMaps"; } ~StreamHandlerPortableMap() {} - bool openHandler( ClpString strFilename, bool bInput ); + bool openHandler( std::string strFilename, bool bInput ); void closeHandler(); bool configureBuffer( const CalypFrame& pcFrame ); - bool seek( ClpULong iFrameNum ); + bool seek( std::uint64_t iFrameNum ); bool read( CalypFrame& pcFrame ); bool write( const CalypFrame& pcFrame ); diff --git a/lib/StreamHandlerRaw.cpp b/lib/StreamHandlerRaw.cpp index 5f7262d..ff468ac 100644 --- a/lib/StreamHandlerRaw.cpp +++ b/lib/StreamHandlerRaw.cpp @@ -44,7 +44,7 @@ std::vector StreamHandlerRaw::supportedWriteFormats() END_REGIST_CALYP_SUPPORTED_FMT; } -bool StreamHandlerRaw::openHandler( ClpString strFilename, bool bInput ) +bool StreamHandlerRaw::openHandler( std::string strFilename, bool bInput ) { m_bIsInput = bInput; m_pFile = NULL; @@ -82,7 +82,7 @@ void StreamHandlerRaw::calculateFrameNumber() } } -bool StreamHandlerRaw::seek( ClpULong iFrameNum ) +bool StreamHandlerRaw::seek( std::uint64_t iFrameNum ) { if( m_bIsInput && m_pFile ) { diff --git a/lib/StreamHandlerRaw.h b/lib/StreamHandlerRaw.h index 095a5bb..44c3b6d 100644 --- a/lib/StreamHandlerRaw.h +++ b/lib/StreamHandlerRaw.h @@ -42,11 +42,11 @@ private: public: StreamHandlerRaw() { m_pchHandlerName = "RawVideo"; } ~StreamHandlerRaw() {} - bool openHandler( ClpString strFilename, bool bInput ); + bool openHandler( std::string strFilename, bool bInput ); void closeHandler(); bool configureBuffer( const CalypFrame& pcFrame ); void calculateFrameNumber(); - bool seek( ClpULong iFrameNum ); + bool seek( std::uint64_t iFrameNum ); bool read( CalypFrame& pcFrame ); bool write( const CalypFrame& pcFrame ); }; diff --git a/lib/tests/PlaYUVerFrameQualityTests.cpp b/lib/tests/PlaYUVerFrameQualityTests.cpp index 9ec1827..0587431 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( ClpString( CALYP_TEST_DATA_DIR ) + ClpString( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8, + pcStreamPast->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8, CLP_BIG_ENDIAN, 1, true ); pcFramePast = pcStreamPast->getCurrFrame(); pcStreamFuture = std::make_unique(); - pcStreamFuture->open( ClpString( CALYP_TEST_DATA_DIR ) + ClpString( "/BasketballDrill_F15_832x480_yuv420p.yuv" ), 832, 480, 0, 8, + pcStreamFuture->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F15_832x480_yuv420p.yuv" ), 832, 480, 0, 8, CLP_BIG_ENDIAN, 1, true ); pcFrameFuture = pcStreamFuture->getCurrFrame(); } diff --git a/modules/HEVCIntraPrediction.cpp b/modules/HEVCIntraPrediction.cpp index 00c8ee1..14eac12 100644 --- a/modules/HEVCIntraPrediction.cpp +++ b/modules/HEVCIntraPrediction.cpp @@ -199,9 +199,9 @@ bool HEVCIntraPrediction::keyPressed( enum Module_Key_Supported value ) return false; } -ClpString HEVCIntraPrediction::moduleInfo() +std::string HEVCIntraPrediction::moduleInfo() { - return ClpString( "Intra mode: " ) + std::to_string( m_uiMode ); + return std::string( "Intra mode: " ) + std::to_string( m_uiMode ); } void HEVCIntraPrediction::destroy() diff --git a/modules/HEVCIntraPrediction.h b/modules/HEVCIntraPrediction.h index 9e3756a..8d6455c 100644 --- a/modules/HEVCIntraPrediction.h +++ b/modules/HEVCIntraPrediction.h @@ -47,7 +47,7 @@ public: bool create( std::vector apcFrameList ); CalypFrame* process( std::vector apcFrameList ); bool keyPressed( enum Module_Key_Supported value ); - ClpString moduleInfo(); + std::string moduleInfo(); void destroy(); }; diff --git a/modules/InterFrameVariance.h b/modules/InterFrameVariance.h index ecbbe20..93f7110 100644 --- a/modules/InterFrameVariance.h +++ b/modules/InterFrameVariance.h @@ -27,7 +27,6 @@ // CalypLib #include "lib/CalypModuleIf.h" -#include "lib/CalypPlane.h" class InterFrameVariance : public CalypModuleIf { diff --git a/modules/SaliencyDetection.h b/modules/SaliencyDetection.h index 50e3b02..1e1848c 100644 --- a/modules/SaliencyDetection.h +++ b/modules/SaliencyDetection.h @@ -26,7 +26,7 @@ #define __SALIENCYDETECTION_H__ // CalypLib -#include "lib/CalypOpenCVModuleIf.h" +#include "lib/CalypModuleIf.h" // OpenCV #include diff --git a/modules/ThreeSixtyDownsampling.cpp b/modules/ThreeSixtyDownsampling.cpp index a64f67e..122998c 100644 --- a/modules/ThreeSixtyDownsampling.cpp +++ b/modules/ThreeSixtyDownsampling.cpp @@ -88,9 +88,9 @@ ThreeSixtyDownsampling::ThreeSixtyDownsampling() //#endif } -ClpString ThreeSixtyDownsampling::moduleInfo() +std::string ThreeSixtyDownsampling::moduleInfo() { - ClpString info( "" ); + std::string info( "" ); info += "Interpolation: "; switch( m_iInterpolation ) { diff --git a/modules/ThreeSixtyDownsampling.h b/modules/ThreeSixtyDownsampling.h index 2948dc3..809c428 100644 --- a/modules/ThreeSixtyDownsampling.h +++ b/modules/ThreeSixtyDownsampling.h @@ -68,7 +68,7 @@ public: virtual ~ThreeSixtyDownsampling() {} bool create( std::vector apcFrameList ); CalypFrame* process( std::vector apcFrameList ); - ClpString moduleInfo(); + std::string moduleInfo(); bool keyPressed( enum Module_Key_Supported value ); void destroy(); }; diff --git a/modules/ThreeSixtyDynamicDownsampling.cpp b/modules/ThreeSixtyDynamicDownsampling.cpp index 14a018a..142b1c5 100644 --- a/modules/ThreeSixtyDynamicDownsampling.cpp +++ b/modules/ThreeSixtyDynamicDownsampling.cpp @@ -59,7 +59,7 @@ ThreeSixtyDynamicDownsampling::ThreeSixtyDynamicDownsampling() m_uiFaceHeight = 0; } -void processFPSString( const ClpString& fps, ClpVideoFPStruct* pcFPSStruct ) +void processFPSString( const std::string& fps, ClpVideoFPStruct* pcFPSStruct ) { std::istringstream ss( fps ); ss >> pcFPSStruct->numFaces; diff --git a/modules/ThreeSixtyDynamicDownsampling.h b/modules/ThreeSixtyDynamicDownsampling.h index a18a30d..b79a422 100644 --- a/modules/ThreeSixtyDynamicDownsampling.h +++ b/modules/ThreeSixtyDynamicDownsampling.h @@ -48,8 +48,8 @@ class ThreeSixtyDynamicDownsampling : public CalypModuleIf REGISTER_CLASS_FACTORY( ThreeSixtyDynamicDownsampling ) private: - ClpString m_arrayInputDefinitionString; - ClpString m_arrayOutputDefinitionString; + std::string m_arrayInputDefinitionString; + std::string m_arrayOutputDefinitionString; ClpVideoFPStruct m_cInputFPSStruct; ClpVideoFPStruct m_cOutputFPSStruct; unsigned m_uiFaceWidth; diff --git a/modules/tests/TestModuleCreate.cpp b/modules/tests/TestModuleCreate.cpp index 6c2f828..177099f 100644 --- a/modules/tests/TestModuleCreate.cpp +++ b/modules/tests/TestModuleCreate.cpp @@ -36,10 +36,10 @@ protected: // Can be omitted if not needed. static void SetUpTestCase() { - ClpString moduleName = CALYP_TEST_MODULE_NAME; + std::string moduleName = CALYP_TEST_MODULE_NAME; pcStream = std::make_unique(); - pcStream->open( ClpString( CALYP_TEST_DATA_DIR ) + ClpString( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8, + pcStream->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8, CLP_BIG_ENDIAN, 1, true ); } @@ -54,7 +54,7 @@ protected: // Called before each test void SetUp() { - ClpString moduleName = CALYP_TEST_MODULE_NAME; + std::string moduleName = CALYP_TEST_MODULE_NAME; CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap(); CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin(); diff --git a/modules/tests/TestModuleProcessNumberOfFrames.cpp b/modules/tests/TestModuleProcessNumberOfFrames.cpp index b468ea1..7fd190d 100644 --- a/modules/tests/TestModuleProcessNumberOfFrames.cpp +++ b/modules/tests/TestModuleProcessNumberOfFrames.cpp @@ -49,10 +49,10 @@ protected: // Called before each test void SetUp() { - ClpString moduleName = CALYP_TEST_MODULE_NAME; + std::string moduleName = CALYP_TEST_MODULE_NAME; pcStream = std::make_unique(); - pcStream->open( ClpString( CALYP_TEST_DATA_DIR ) + ClpString( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8, + pcStream->open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8, CLP_BIG_ENDIAN, 1, true ); CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap(); diff --git a/tools/CalypTools.cpp b/tools/CalypTools.cpp index 2ad8aa6..50a6825 100644 --- a/tools/CalypTools.cpp +++ b/tools/CalypTools.cpp @@ -49,7 +49,7 @@ CalypTools::~CalypTools() = default; #define GET_PARAM( X, i ) X[X.size() > i ? i : X.size() - 1] -void CalypTools::reportStreamInfo( const CalypStream* stream, ClpString strPrefix ) +void CalypTools::reportStreamInfo( const CalypStream* stream, std::string strPrefix ) { log( CLP_LOG_INFO, "%sStream name: %s \n", strPrefix.c_str(), stream->getFileName().c_str() ); log( CLP_LOG_INFO, "%sResolution: %dx%d@%d \n", strPrefix.c_str(), stream->getWidth(), stream->getHeight(), stream->getFrameRate() ); @@ -63,10 +63,10 @@ int CalypTools::openInputs() */ if( Opts().hasOpt( "input" ) ) { - std::vector inputFileNames = m_apcInputs; + std::vector inputFileNames = m_apcInputs; - ClpString resolutionString( "" ); - ClpString fmtString( "yuv420p" ); + std::string resolutionString( "" ); + std::string fmtString( "yuv420p" ); unsigned int uiBitsPerPixel = 8; unsigned int uiEndianness = 0; bool hasNegativeValues = false; @@ -273,7 +273,7 @@ int CalypTools::Open( int argc, char* argv[] ) */ if( Opts().hasOpt( "quality" ) ) { - ClpString qualityMetric = m_strQualityMetric; + std::string qualityMetric = m_strQualityMetric; if( m_apcInputStreams.size() < 2 ) { log( CLP_LOG_ERROR, "Invalid number of inputs! " ); @@ -301,7 +301,7 @@ int CalypTools::Open( int argc, char* argv[] ) */ if( Opts().hasOpt( "module" ) ) { - ClpString moduleName = m_strModule; + std::string moduleName = m_strModule; CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap(); CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin(); @@ -359,7 +359,7 @@ int CalypTools::Open( int argc, char* argv[] ) if( m_pcCurrModuleIf->m_iModuleType == CLP_FRAME_PROCESSING_MODULE ) { // Check outputs - std::vector outputFileNames; + std::vector outputFileNames; if( Opts().hasOpt( "output" ) ) outputFileNames.push_back( m_strOutput ); @@ -488,7 +488,7 @@ int CalypTools::QualityOperation() double adAverageQuality[MAX_NUMBER_INPUTS - 1][MAX_NUMBER_CHANNELS]; double dQuality; - ClpString metric_fmt = " "; + std::string metric_fmt = " "; switch( m_uiQualityMetric ) { case CalypFrame::PSNR_METRIC: diff --git a/tools/CalypTools.h b/tools/CalypTools.h index 87fc39a..0e572fb 100644 --- a/tools/CalypTools.h +++ b/tools/CalypTools.h @@ -79,12 +79,12 @@ private: STATISTICS_OPERATION, }; - ClpULong m_uiNumberOfFrames; + std::uint64_t m_uiNumberOfFrames; unsigned int m_uiNumberOfComponents; std::vector m_apcInputStreams; std::vector m_apcOutputStreams; - void reportStreamInfo( const CalypStream* stream, ClpString strPrefix = "" ); + void reportStreamInfo( const CalypStream* stream, std::string strPrefix = "" ); int openInputs(); std::vector readInput(); @@ -92,7 +92,7 @@ private: FpProcess m_fpProcess; long long int m_iFrameNum; - std::vector m_pcOutputFileNames; + std::vector m_pcOutputFileNames; int SaveOperation(); int RateReductionOperation(); diff --git a/tools/CalypToolsCmdParser.cpp b/tools/CalypToolsCmdParser.cpp index d875931..7164138 100644 --- a/tools/CalypToolsCmdParser.cpp +++ b/tools/CalypToolsCmdParser.cpp @@ -109,7 +109,7 @@ int CalypToolsCmdParser::parseToolsArgs( int argc, char* argv[] ) void CalypToolsCmdParser::listModuleHelp() { - ClpString moduleName = m_strModule; + std::string moduleName = m_strModule; CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap(); CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin(); @@ -154,7 +154,7 @@ void CalypToolsCmdParser::listModules() printf( "%-33s", it->first ); if( bDetailed ) { - ClpString ModuleNameString; + std::string ModuleNameString; auto pcCurrModuleIf = it->second(); if( pcCurrModuleIf->m_pchModuleCategory ) diff --git a/tools/CalypToolsCmdParser.h b/tools/CalypToolsCmdParser.h index 0447a06..b50c601 100644 --- a/tools/CalypToolsCmdParser.h +++ b/tools/CalypToolsCmdParser.h @@ -66,19 +66,19 @@ protected: bool m_bShowVersion; bool m_bQuiet; - std::vector m_apcInputs; - std::vector m_strResolution; - std::vector m_strPelFmt; - std::vector m_strBitsPerPixel; - std::vector m_strEndianness; - std::vector m_strHasNegativeValues; - ClpString m_strOutput; + std::vector m_apcInputs; + std::vector m_strResolution; + std::vector m_strPelFmt; + std::vector m_strBitsPerPixel; + std::vector m_strEndianness; + std::vector m_strHasNegativeValues; + std::string m_strOutput; long m_iFrames; unsigned m_uiOutEndianness; int m_iRateReductionFactor; - ClpString m_strQualityMetric; - ClpString m_strModule; + std::string m_strQualityMetric; + std::string m_strModule; bool m_bListPelFmts; bool m_bListQuality;