Remove some files from the Calyp lib and clean up code
This commit is contained in:
@@ -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();
|
||||
|
||||
+5
-5
@@ -95,9 +95,9 @@ bool MainWindow::parseArgs( int argc, char* argv[] )
|
||||
bool bRet = false;
|
||||
CalypOptions pcCmdParser;
|
||||
|
||||
std::vector<ClpString> m_apcInputs;
|
||||
ClpString strResolution( "" );
|
||||
ClpString strPelFmt( "" );
|
||||
std::vector<std::string> 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<ClpString> arrayExt = supportedFmts[i].getExts();
|
||||
std::vector<std::string> arrayExt = supportedFmts[i].getExts();
|
||||
if( arrayExt.size() > 0 )
|
||||
{
|
||||
QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) );
|
||||
currFmt.append( " (" );
|
||||
for( std::vector<ClpString>::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
|
||||
for( std::vector<std::string>::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
|
||||
{
|
||||
supported.append( " *." );
|
||||
currFmt.append( "*." );
|
||||
|
||||
@@ -510,12 +510,12 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
||||
|
||||
for( unsigned int i = 0; i < supportedFmts.size(); i++ )
|
||||
{
|
||||
std::vector<ClpString> arrayExt = supportedFmts[i].getExts();
|
||||
std::vector<std::string> arrayExt = supportedFmts[i].getExts();
|
||||
if( arrayExt.size() > 0 )
|
||||
{
|
||||
QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) );
|
||||
currFmt.append( " (" );
|
||||
for( std::vector<ClpString>::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
|
||||
for( std::vector<std::string>::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();
|
||||
|
||||
@@ -156,8 +156,8 @@ void QualityHandle::update( VideoSubWindow* currSubWindow )
|
||||
void QualityHandle::measureQuality( QVector<VideoSubWindow*> 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++ )
|
||||
|
||||
@@ -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] )
|
||||
|
||||
@@ -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<ClpString> argsArray;
|
||||
ClpString optionString;
|
||||
std::vector<std::string> argsArray;
|
||||
std::string optionString;
|
||||
QString valueString( "" );
|
||||
|
||||
for( int i = 0; i < m_apcOptionList.size(); i++ )
|
||||
|
||||
@@ -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 )
|
||||
{
|
||||
|
||||
+2
-2
@@ -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)
|
||||
|
||||
|
||||
+9
-72
@@ -27,16 +27,10 @@
|
||||
#define __CALYPDEFS_H__
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstdint>
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
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();
|
||||
}
|
||||
};
|
||||
|
||||
+25
-25
@@ -28,9 +28,9 @@
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <cstring>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
#include "CalypDefs.h"
|
||||
#include "config.h"
|
||||
|
||||
#ifdef USE_OPENCV
|
||||
@@ -54,9 +54,9 @@
|
||||
constexpr auto kMinBitsPerPixel = 8;
|
||||
constexpr auto kMaxBitsPerPixel = 16;
|
||||
|
||||
std::vector<ClpString> CalypFrame::supportedColorSpacesListNames()
|
||||
std::vector<std::string> CalypFrame::supportedColorSpacesListNames()
|
||||
{
|
||||
return std::vector<ClpString>{
|
||||
return std::vector<std::string>{
|
||||
"YUV",
|
||||
"RGB",
|
||||
"GRAY",
|
||||
@@ -64,9 +64,9 @@ std::vector<ClpString> CalypFrame::supportedColorSpacesListNames()
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<ClpString> CalypFrame::supportedPixelFormatListNames()
|
||||
std::vector<std::string> CalypFrame::supportedPixelFormatListNames()
|
||||
{
|
||||
std::vector<ClpString> formatsList;
|
||||
std::vector<std::string> formatsList;
|
||||
for( int i = 0; i < numberOfFormats(); i++ )
|
||||
{
|
||||
formatsList.push_back( g_CalypPixFmtDescriptorsMap.at( i ).name );
|
||||
@@ -74,9 +74,9 @@ std::vector<ClpString> CalypFrame::supportedPixelFormatListNames()
|
||||
return formatsList;
|
||||
}
|
||||
|
||||
std::vector<ClpString> CalypFrame::supportedPixelFormatListNames( int colorSpace )
|
||||
std::vector<std::string> CalypFrame::supportedPixelFormatListNames( int colorSpace )
|
||||
{
|
||||
std::vector<ClpString> formatsList;
|
||||
std::vector<std::string> 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<int>( 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<ClpString> CalypFrame::supportedQualityMetricsList()
|
||||
std::vector<std::string> CalypFrame::supportedQualityMetricsList()
|
||||
{
|
||||
return std::vector<ClpString>{
|
||||
return std::vector<std::string>{
|
||||
"PSNR",
|
||||
"MSE",
|
||||
"SSIM",
|
||||
@@ -1410,9 +1410,9 @@ std::vector<ClpString> CalypFrame::supportedQualityMetricsList()
|
||||
};
|
||||
}
|
||||
|
||||
std::vector<ClpString> CalypFrame::supportedQualityMetricsUnitsList()
|
||||
std::vector<std::string> CalypFrame::supportedQualityMetricsUnitsList()
|
||||
{
|
||||
return std::vector<ClpString>{
|
||||
return std::vector<std::string>{
|
||||
"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 )
|
||||
|
||||
+118
-14
@@ -26,15 +26,77 @@
|
||||
#ifndef __CALYPFRAME_H__
|
||||
#define __CALYPFRAME_H__
|
||||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#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<CalypPixelPrivate> d;
|
||||
};
|
||||
|
||||
/**
|
||||
* \class CalypPlane
|
||||
* \ingroup CalypLibGrp CalypPlaneGrp
|
||||
* \brief Frame handling class
|
||||
*/
|
||||
template <typename T>
|
||||
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<T>& { return m_rows[row]; }
|
||||
auto operator[]( std::size_t row ) & noexcept -> std::span<T>& { 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<T>( m_data ); }
|
||||
auto data() const noexcept { return std::span<const T>( 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<T>( m_data ).subspan( y * width, width );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<T> m_data;
|
||||
std::vector<std::span<T>> 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<ClpString> supportedColorSpacesListNames();
|
||||
static std::vector<std::string> supportedColorSpacesListNames();
|
||||
|
||||
/**
|
||||
* Function that handles the supported pixel formats
|
||||
* of CalypFrame
|
||||
* @return vector of strings with pixel formats names
|
||||
*/
|
||||
static std::vector<ClpString> supportedPixelFormatListNames();
|
||||
static std::vector<ClpString> supportedPixelFormatListNames( int colorSpace );
|
||||
static std::vector<std::string> supportedPixelFormatListNames();
|
||||
static std::vector<std::string> 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<ClpString> supportedQualityMetricsList();
|
||||
static std::vector<ClpString> supportedQualityMetricsUnitsList();
|
||||
static std::vector<std::string> supportedQualityMetricsList();
|
||||
static std::vector<std::string> supportedQualityMetricsUnitsList();
|
||||
double getQuality( int Metric, CalypFrame* Org, unsigned int component );
|
||||
double getMSE( CalypFrame* Org, unsigned int component );
|
||||
double getPSNR( CalypFrame* Org, unsigned int component );
|
||||
|
||||
+38
-1
@@ -161,7 +161,7 @@ public:
|
||||
virtual CalypFrame* process( std::vector<CalypFrame*> ) { return NULL; }
|
||||
virtual double measure( std::vector<CalypFrame*> ) { 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<CalypFrame> m_pcOutputFrame;
|
||||
bool m_bConvertToGray;
|
||||
|
||||
public:
|
||||
CalypOpenCVModuleIf()
|
||||
{
|
||||
m_bConvertToGray = false;
|
||||
};
|
||||
virtual ~CalypOpenCVModuleIf() {}
|
||||
|
||||
// Common API
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
void destroy();
|
||||
|
||||
// API using OpenCV
|
||||
virtual cv::Mat* create_using_opencv( const std::vector<Mat>& apcFrameList ) { return nullptr; };
|
||||
virtual Mat* process_using_opencv( const std::vector<Mat>& apcFrameList ) = 0;
|
||||
virtual void destroy_using_opencv(){};
|
||||
};
|
||||
|
||||
using CalypModulePtr = std::unique_ptr<CalypModuleIf>;
|
||||
|
||||
#endif // __CALYPMODULESIF_H__
|
||||
|
||||
@@ -22,10 +22,9 @@
|
||||
* \brief Calyp modules interface for OpenCV
|
||||
*/
|
||||
|
||||
#include "CalypOpenCVModuleIf.h"
|
||||
#include "CalypModuleIf.h"
|
||||
|
||||
// OpenCV
|
||||
#include <memory>
|
||||
#include <opencv2/opencv.hpp>
|
||||
|
||||
bool CalypOpenCVModuleIf::create( std::vector<CalypFrame*> apcFrameList )
|
||||
|
||||
@@ -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 <memory>
|
||||
|
||||
#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<CalypFrame> m_pcOutputFrame;
|
||||
bool m_bConvertToGray;
|
||||
|
||||
public:
|
||||
CalypOpenCVModuleIf()
|
||||
{
|
||||
m_bConvertToGray = false;
|
||||
};
|
||||
virtual ~CalypOpenCVModuleIf() {}
|
||||
|
||||
// Common API
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
void destroy();
|
||||
|
||||
// API using OpenCV
|
||||
virtual cv::Mat* create_using_opencv( const std::vector<Mat>& apcFrameList ) { return nullptr; };
|
||||
virtual Mat* process_using_opencv( const std::vector<Mat>& apcFrameList ) = 0;
|
||||
virtual void destroy_using_opencv(){};
|
||||
};
|
||||
|
||||
#endif // __CALYPOPENCVMODULEIF_H__
|
||||
+37
-37
@@ -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 <typename T>
|
||||
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<T> opt_storage_array;
|
||||
};
|
||||
|
||||
/* Generic parsing */
|
||||
template <typename T>
|
||||
inline void StandardOption<T>::parse( const ClpString& arg )
|
||||
inline void StandardOption<T>::parse( const std::string& arg )
|
||||
{
|
||||
if( !is_binary )
|
||||
{
|
||||
@@ -103,7 +103,7 @@ inline void StandardOption<T>::parse( const ClpString& arg )
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void StandardOption<std::vector<unsigned int>>::parse( const ClpString& arg )
|
||||
inline void StandardOption<std::vector<unsigned int>>::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<std::vector<unsigned int>>::parse( const ClpString& a
|
||||
}
|
||||
|
||||
template <>
|
||||
inline void StandardOption<std::vector<int>>::parse( const ClpString& arg )
|
||||
inline void StandardOption<std::vector<int>>::parse( const std::string& arg )
|
||||
{
|
||||
int aux_opt_storage;
|
||||
std::istringstream arg_ss( arg, std::istringstream::in );
|
||||
@@ -140,7 +140,7 @@ inline void StandardOption<std::vector<int>>::parse( const ClpString& arg )
|
||||
|
||||
/* string parsing is specialized */
|
||||
template <>
|
||||
inline void StandardOption<ClpString>::parse( const ClpString& arg )
|
||||
inline void StandardOption<std::string>::parse( const std::string& arg )
|
||||
{
|
||||
opt_storage = arg;
|
||||
arg_count++;
|
||||
@@ -148,7 +148,7 @@ inline void StandardOption<ClpString>::parse( const ClpString& arg )
|
||||
|
||||
/* string vector parsing is specialized */
|
||||
template <>
|
||||
inline void StandardOption<std::vector<ClpString>>::parse( const ClpString& arg )
|
||||
inline void StandardOption<std::vector<std::string>>::parse( const std::string& arg )
|
||||
{
|
||||
opt_storage.push_back( arg );
|
||||
arg_count++;
|
||||
@@ -158,15 +158,15 @@ inline void StandardOption<std::vector<ClpString>>::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 <typename T>
|
||||
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<T>( name, storage, desc, ClpString( "" ) ) );
|
||||
addOption( new StandardOption<T>( name, storage, desc, std::string( "" ) ) );
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
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<T>( 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<unsigned int>& storage,
|
||||
const ClpString& desc );
|
||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, std::vector<int>& storage,
|
||||
const ClpString& desc );
|
||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, std::vector<ClpString>& 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<unsigned int>& storage,
|
||||
const std::string& desc );
|
||||
template CalypOptions& CalypOptions::operator()( const std::string& name, std::vector<int>& storage,
|
||||
const std::string& desc );
|
||||
template CalypOptions& CalypOptions::operator()( const std::string& name, std::vector<std::string>& 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<const char*> CalypOptions::scanArgv( unsigned int argc, char* argv[] )
|
||||
return non_option_arguments;
|
||||
}
|
||||
|
||||
void CalypOptions::parse( std::vector<ClpString> args_array )
|
||||
void CalypOptions::parse( std::vector<std::string> args_array )
|
||||
{
|
||||
for( unsigned int i = 0; i < args_array.size(); i++ )
|
||||
{
|
||||
|
||||
+20
-20
@@ -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<ClpString> opt_long;
|
||||
std::list<ClpString> opt_short;
|
||||
std::list<std::string> opt_long;
|
||||
std::list<std::string> opt_short;
|
||||
OptionBase* opt;
|
||||
};
|
||||
typedef std::list<Option*> OptionsList;
|
||||
|
||||
CalypOptions( const ClpString& name = "" );
|
||||
CalypOptions( const std::string& name = "" );
|
||||
~CalypOptions();
|
||||
|
||||
int parse( unsigned int argc, char* argv[] );
|
||||
void parse( std::vector<ClpString> args_array );
|
||||
void parse( std::vector<std::string> args_array );
|
||||
|
||||
std::list<const char*>& 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 <typename T>
|
||||
CalypOptions& operator()( const ClpString& name, T& storage, const ClpString& desc );
|
||||
CalypOptions& operator()( const std::string& name, T& storage, const std::string& desc );
|
||||
|
||||
template <typename T>
|
||||
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<ClpString, OptionsList> OptionMap;
|
||||
typedef std::map<std::string, OptionsList> OptionMap;
|
||||
OptionMap opt_long_map;
|
||||
OptionMap opt_short_map;
|
||||
|
||||
OptionsList opt_list;
|
||||
|
||||
ClpString m_cOptionGroupName;
|
||||
std::string m_cOptionGroupName;
|
||||
bool m_bAllowUnkonw;
|
||||
std::list<const char*> 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<const char*> scanArgv( unsigned int argc, char* argv[] );
|
||||
};
|
||||
|
||||
@@ -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 <span>
|
||||
#include <vector>
|
||||
|
||||
#include "CalypDefs.h"
|
||||
|
||||
/**
|
||||
* \class CalypPlane
|
||||
* \ingroup CalypLibGrp CalypPlaneGrp
|
||||
* \brief Frame handling class
|
||||
*/
|
||||
template <typename T>
|
||||
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<T>& { return m_rows[row]; }
|
||||
auto operator[]( std::size_t row ) & noexcept -> std::span<T>& { 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<T>( m_data ); }
|
||||
auto data() const noexcept { return std::span<const T>( 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<T>( m_data ).subspan( y * width, width );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<T> m_data;
|
||||
std::vector<std::span<T>> m_rows;
|
||||
};
|
||||
|
||||
#endif // __CALYPPLANE_H__
|
||||
+21
-21
@@ -176,7 +176,7 @@ public:
|
||||
// std::deque<std::shared_ptr<CalypFrame>> frameFifo;
|
||||
// std::size_t bufferIdx{ 0 };
|
||||
|
||||
ClpString cFilename;
|
||||
std::string cFilename;
|
||||
long long int iCurrFrameNum;
|
||||
bool bLoadAll;
|
||||
|
||||
@@ -239,13 +239,13 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
std::vector<ClpString> CalypStreamFormat::getExts()
|
||||
std::vector<std::string> CalypStreamFormat::getExts()
|
||||
{
|
||||
std::vector<ClpString> arrayExt;
|
||||
ClpString::size_type prev_pos = 0, pos = 0;
|
||||
while( ( pos = formatExt.find( ',', pos ) ) != ClpString::npos )
|
||||
std::vector<std::string> 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<ClpString> 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<CalypStreamFormat> supportedFmts;
|
||||
@@ -269,14 +269,14 @@ CreateStreamHandlerFn CalypStream::findStreamHandler( ClpString strFilename, boo
|
||||
}
|
||||
for( unsigned int i = 0; i < supportedFmts.size(); i++ )
|
||||
{
|
||||
std::vector<ClpString> arrayExt = supportedFmts[i].getExts();
|
||||
for( std::vector<ClpString>::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
|
||||
std::vector<std::string> arrayExt = supportedFmts[i].getExts();
|
||||
for( std::vector<std::string>::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(),
|
||||
|
||||
+15
-15
@@ -38,16 +38,16 @@ typedef CalypStreamHandlerIf* ( *CreateStreamHandlerFn )( void );
|
||||
|
||||
struct CalypStreamFormat
|
||||
{
|
||||
ClpString formatName;
|
||||
ClpString formatExt;
|
||||
std::vector<ClpString> getExts();
|
||||
ClpString formatPattern;
|
||||
std::string formatName;
|
||||
std::string formatExt;
|
||||
std::vector<std::string> 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<CalypStreamFormat> supportedReadFormats();
|
||||
static std::vector<CalypStreamFormat> supportedWriteFormats();
|
||||
|
||||
static CreateStreamHandlerFn findStreamHandler( ClpString strFilename, bool bRead );
|
||||
static CreateStreamHandlerFn findStreamHandler( std::string strFilename, bool bRead );
|
||||
|
||||
static std::vector<CalypStandardResolution> 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 );
|
||||
|
||||
+10
-10
@@ -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<ClpByte> m_pStreamBuffer;
|
||||
ClpULong m_uiNBytesPerFrame;
|
||||
std::uint64_t m_uiNBytesPerFrame;
|
||||
bool m_isEOF;
|
||||
};
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ std::vector<CalypStreamFormat> 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;
|
||||
|
||||
@@ -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 );
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ std::vector<CalypStreamFormat> 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 )
|
||||
{
|
||||
|
||||
@@ -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 );
|
||||
};
|
||||
|
||||
@@ -35,12 +35,12 @@ protected:
|
||||
static void SetUpTestCase()
|
||||
{
|
||||
pcStreamPast = std::make_unique<CalypStream>();
|
||||
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<CalypStream>();
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
bool keyPressed( enum Module_Key_Supported value );
|
||||
ClpString moduleInfo();
|
||||
std::string moduleInfo();
|
||||
void destroy();
|
||||
};
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
|
||||
// CalypLib
|
||||
#include "lib/CalypModuleIf.h"
|
||||
#include "lib/CalypPlane.h"
|
||||
|
||||
class InterFrameVariance : public CalypModuleIf
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#define __SALIENCYDETECTION_H__
|
||||
|
||||
// CalypLib
|
||||
#include "lib/CalypOpenCVModuleIf.h"
|
||||
#include "lib/CalypModuleIf.h"
|
||||
|
||||
// OpenCV
|
||||
#include <opencv2/core/core.hpp>
|
||||
|
||||
@@ -88,9 +88,9 @@ ThreeSixtyDownsampling::ThreeSixtyDownsampling()
|
||||
//#endif
|
||||
}
|
||||
|
||||
ClpString ThreeSixtyDownsampling::moduleInfo()
|
||||
std::string ThreeSixtyDownsampling::moduleInfo()
|
||||
{
|
||||
ClpString info( "" );
|
||||
std::string info( "" );
|
||||
info += "Interpolation: ";
|
||||
switch( m_iInterpolation )
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ public:
|
||||
virtual ~ThreeSixtyDownsampling() {}
|
||||
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||
ClpString moduleInfo();
|
||||
std::string moduleInfo();
|
||||
bool keyPressed( enum Module_Key_Supported value );
|
||||
void destroy();
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<CalypStream>();
|
||||
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();
|
||||
|
||||
@@ -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<CalypStream>();
|
||||
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();
|
||||
|
||||
@@ -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<ClpString> inputFileNames = m_apcInputs;
|
||||
std::vector<std::string> 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<ClpString> outputFileNames;
|
||||
std::vector<std::string> 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:
|
||||
|
||||
+3
-3
@@ -79,12 +79,12 @@ private:
|
||||
STATISTICS_OPERATION,
|
||||
};
|
||||
|
||||
ClpULong m_uiNumberOfFrames;
|
||||
std::uint64_t m_uiNumberOfFrames;
|
||||
unsigned int m_uiNumberOfComponents;
|
||||
std::vector<CalypStream*> m_apcInputStreams;
|
||||
std::vector<CalypStream*> m_apcOutputStreams;
|
||||
|
||||
void reportStreamInfo( const CalypStream* stream, ClpString strPrefix = "" );
|
||||
void reportStreamInfo( const CalypStream* stream, std::string strPrefix = "" );
|
||||
int openInputs();
|
||||
std::vector<CalypFrame*> readInput();
|
||||
|
||||
@@ -92,7 +92,7 @@ private:
|
||||
FpProcess m_fpProcess;
|
||||
|
||||
long long int m_iFrameNum;
|
||||
std::vector<ClpString> m_pcOutputFileNames;
|
||||
std::vector<std::string> m_pcOutputFileNames;
|
||||
int SaveOperation();
|
||||
|
||||
int RateReductionOperation();
|
||||
|
||||
@@ -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 )
|
||||
|
||||
@@ -66,19 +66,19 @@ protected:
|
||||
bool m_bShowVersion;
|
||||
bool m_bQuiet;
|
||||
|
||||
std::vector<ClpString> m_apcInputs;
|
||||
std::vector<ClpString> m_strResolution;
|
||||
std::vector<ClpString> m_strPelFmt;
|
||||
std::vector<ClpString> m_strBitsPerPixel;
|
||||
std::vector<ClpString> m_strEndianness;
|
||||
std::vector<ClpString> m_strHasNegativeValues;
|
||||
ClpString m_strOutput;
|
||||
std::vector<std::string> m_apcInputs;
|
||||
std::vector<std::string> m_strResolution;
|
||||
std::vector<std::string> m_strPelFmt;
|
||||
std::vector<std::string> m_strBitsPerPixel;
|
||||
std::vector<std::string> m_strEndianness;
|
||||
std::vector<std::string> 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;
|
||||
|
||||
Reference in New Issue
Block a user