Merge branch 'develCommanline' into devel
This commit is contained in:
commit
2a8073f2ce
19 files changed
+995
-72
No files matched your search
+21
-50
@@ -17,7 +17,7 @@ SET( PLAYUVER_VERSION_PATCH "1" )
|
||||
SET( PLAYUVER_VERSION "${PLAYUVER_VERSION_MAJOR}.${PLAYUVER_VERSION_MINOR}.${PLAYUVER_VERSION_PATCH}")
|
||||
|
||||
######################################################################################
|
||||
# CMake Definitions
|
||||
# CMake Defin1itions
|
||||
######################################################################################
|
||||
|
||||
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
|
||||
@@ -30,62 +30,23 @@ IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
|
||||
ENDIF()
|
||||
SET( CMAKE_CXX_FLAGS "" )
|
||||
|
||||
|
||||
######################################################################################
|
||||
# Variables
|
||||
######################################################################################
|
||||
|
||||
OPTION( USE_FERVOR "Add Fervor support" OFF )
|
||||
OPTION( PLAYUVER_LONGVERSIONNAME "Use long version name in deb" OFF )
|
||||
OPTION( PLAYUVER_WERROR "Warnings as errors" OFF )
|
||||
OPTION( PLAYUVER_THREADED_MODULES "Use threads for modules" OFF )
|
||||
OPTION( USE_QT4 "Build with QT4" OFF )
|
||||
OPTION( PLAYUVER_BUILD_APP "Build GUI Application" ON )
|
||||
OPTION( PLAYUVER_BUILD_TOOLS "Build Command Line Application" ON )
|
||||
OPTION( USE_SSE "Build with SSE support" OFF )
|
||||
|
||||
#####################################################################################
|
||||
# Qt library
|
||||
######################################################################################
|
||||
|
||||
IF( USE_QT4 )
|
||||
SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT4" )
|
||||
FIND_PACKAGE( Qt4 REQUIRED COMPONENTS QtCore QtGui QtDBus QtNetwork QtWebKit )
|
||||
|
||||
SET( USE_QTDBUS TRUE )
|
||||
|
||||
IF( NOT QT4_FOUND )
|
||||
SET(USE_QT4 FALSE)
|
||||
ELSE()
|
||||
INCLUDE( ${QT_USE_FILE} )
|
||||
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
|
||||
SET( QT_LINKER_LIBS ${QT_LIBRARIES} )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF( NOT USE_QT4 )
|
||||
|
||||
SET( DEPENDENCIES_STRING "${DEPENDENCIES_STRING}QT5" )
|
||||
|
||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport )
|
||||
FIND_PACKAGE( Qt5DBus )
|
||||
|
||||
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport )
|
||||
LIST(APPEND QT_MODULES Core Gui Widgets )
|
||||
IF( ${Qt5DBus_FOUND} )
|
||||
SET( USE_QTDBUS ${Qt5DBus_FOUND} )
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::DBus )
|
||||
LIST(APPEND QT_MODULES DBus )
|
||||
ENDIF()
|
||||
|
||||
INCLUDE_DIRECTORIES( ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
|
||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}" )
|
||||
|
||||
ENDIF()
|
||||
OPTION( USE_FERVOR "Add Fervor support" OFF )
|
||||
OPTION( USE_WERROR "Warnings as errors" OFF )
|
||||
|
||||
######################################################################################
|
||||
# Dependencies
|
||||
######################################################################################
|
||||
|
||||
FIND_PACKAGE(Boost COMPONENTS program_options )
|
||||
SET_PACKAGE_PROPERTIES(Boost PROPERTIES URL "http://www.boost.org" DESCRIPTION "Boost library support" TYPE REQUIRED)
|
||||
|
||||
OPTION( USE_OPENCV "Add OpenCV support" ON )
|
||||
IF( USE_OPENCV )
|
||||
FIND_PACKAGE( OpenCV )
|
||||
@@ -130,10 +91,20 @@ SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
|
||||
SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g" )
|
||||
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2" )
|
||||
|
||||
|
||||
ADD_FEATURE_INFO(PlaYUVerApp PLAYUVER_BUILD_TOOLS "Build Graphical Interface")
|
||||
ADD_FEATURE_INFO(PlaYUVerTools PLAYUVER_BUILD_APP "Build Command line tool" )
|
||||
|
||||
ADD_SUBDIRECTORY( lib )
|
||||
ADD_SUBDIRECTORY( modules )
|
||||
ADD_SUBDIRECTORY( app )
|
||||
|
||||
IF( PLAYUVER_BUILD_TOOLS )
|
||||
ADD_SUBDIRECTORY( tools )
|
||||
ENDIF()
|
||||
|
||||
IF( PLAYUVER_BUILD_APP )
|
||||
ADD_SUBDIRECTORY( app )
|
||||
ENDIF()
|
||||
|
||||
|
||||
|
||||
@@ -144,8 +115,8 @@ MESSAGE("")
|
||||
MESSAGE( STATUS "${PROJECT_NAME} INFORMATION" )
|
||||
MESSAGE( STATUS "Version: " "${PLAYUVER_VERSION}" )
|
||||
MESSAGE( STATUS "Configuration:" )
|
||||
MESSAGE( STATUS " Build type:" "${CMAKE_BUILD_TYPE}" )
|
||||
MESSAGE( STATUS " Build flags:" "${CMAKE_CXX_FLAGS}" )
|
||||
MESSAGE( STATUS " Build type: " "${CMAKE_BUILD_TYPE}" )
|
||||
MESSAGE( STATUS " Build flags:" "${CMAKE_CXX_FLAGS}" )
|
||||
|
||||
|
||||
FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||
@@ -10,6 +10,41 @@ INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../modules
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../modules )
|
||||
|
||||
#####################################################################################
|
||||
# Qt library
|
||||
######################################################################################
|
||||
|
||||
OPTION( USE_QT4 "Build with QT4" OFF )
|
||||
|
||||
IF( USE_QT4 )
|
||||
|
||||
FIND_PACKAGE( Qt4 REQUIRED COMPONENTS QtCore QtGui QtDBus QtNetwork QtWebKit )
|
||||
SET( USE_QTDBUS TRUE )
|
||||
IF( NOT QT4_FOUND )
|
||||
SET(USE_QT4 FALSE)
|
||||
ELSE()
|
||||
INCLUDE( ${QT_USE_FILE} )
|
||||
ADD_DEFINITIONS( ${QT_DEFINITIONS} )
|
||||
SET( QT_LINKER_LIBS ${QT_LIBRARIES} )
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF( NOT USE_QT4 )
|
||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport )
|
||||
FIND_PACKAGE( Qt5DBus )
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport )
|
||||
LIST(APPEND QT_MODULES Core Gui Widgets )
|
||||
IF( ${Qt5DBus_FOUND} )
|
||||
SET( USE_QTDBUS ${Qt5DBus_FOUND} )
|
||||
LIST(APPEND QT_LINKER_LIBS Qt5::DBus )
|
||||
LIST(APPEND QT_MODULES DBus )
|
||||
ENDIF()
|
||||
|
||||
#INCLUDE_DIRECTORIES( ${Qt5Core_INCLUDE_DIRS} ${Qt5Gui_INCLUDE_DIRS} ${Qt5Widgets_INCLUDE_DIRS} ${Qt5DBus_INCLUDE_DIRS})
|
||||
#SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Core_EXECUTABLE_COMPILE_FLAGS}" )
|
||||
|
||||
ENDIF()
|
||||
|
||||
set(plaYUver_App_SRCS
|
||||
# Main
|
||||
main.cpp
|
||||
|
||||
@@ -487,7 +487,6 @@ Void VideoHandle::stop()
|
||||
}
|
||||
}
|
||||
emit changed();
|
||||
//update();
|
||||
m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false );
|
||||
}
|
||||
|
||||
@@ -524,7 +523,6 @@ Void VideoHandle::playEvent()
|
||||
m_pcCurrentVideoSubWindow->close();
|
||||
}
|
||||
emit changed();
|
||||
//update();
|
||||
}
|
||||
|
||||
Void VideoHandle::seekEvent( Int direction )
|
||||
|
||||
+5
-1
@@ -4,6 +4,8 @@
|
||||
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}/../ )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${Boost_INCLUDE_DIRS} )
|
||||
|
||||
set(plaYUver_Lib_SRCS
|
||||
# Frame
|
||||
PlaYUVerFrame.cpp
|
||||
@@ -11,6 +13,8 @@ set(plaYUver_Lib_SRCS
|
||||
PlaYUVerFrameStats.cpp
|
||||
# Stream
|
||||
PlaYUVerStream.cpp
|
||||
# Command Line Parser
|
||||
PlaYUVerCmdParser.cpp
|
||||
)
|
||||
|
||||
IF( USE_FFMPEG )
|
||||
@@ -38,7 +42,7 @@ CONFIGURE_FILE( PlaYUVerConfig.cmake.in ${CMAKE_BINARY_DIR}/PlaYUVerConfig.cmake
|
||||
ADD_LIBRARY( PlaYUVerLib STATIC ${plaYUver_Lib_SRCS} )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${FFMPEG_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )
|
||||
TARGET_LINK_LIBRARIES( PlaYUVerLib ${FFMPEG_LIBRARIES} ${OpenCV_LIBRARIES} )
|
||||
TARGET_LINK_LIBRARIES( PlaYUVerLib ${FFMPEG_LIBRARIES} ${OpenCV_LIBRARIES} ${Boost_LIBRARIES} )
|
||||
|
||||
INSTALL(FILES ${plaYUver_Lib_HEADERS} DESTINATION include )
|
||||
# INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libPlaYUVerLib${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION lib )
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@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 PlaYUVerCmdParser.cpp
|
||||
* \brief Command parser
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "PlaYUVerCmdParser.h"
|
||||
#include "PlaYUVerFrame.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
PlaYUVerCmdParser::PlaYUVerCmdParser()
|
||||
{
|
||||
m_iArgc = 0;
|
||||
m_apcArgv = NULL;
|
||||
m_ParserOptions.add( GetCommandOpts() );
|
||||
}
|
||||
|
||||
PlaYUVerCmdParser::~PlaYUVerCmdParser()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Void PlaYUVerCmdParser::Config( Int argc, Char *argv[] )
|
||||
{
|
||||
m_iArgc = argc;
|
||||
m_apcArgv = argv;
|
||||
}
|
||||
|
||||
po::options_description PlaYUVerCmdParser::GetCommandOpts()
|
||||
{
|
||||
po::options_description inputOpts( "Input" );
|
||||
inputOpts.add_options()/**/
|
||||
( "input,i", po::value<std::vector<std::string> >(), "input file" ) /**/
|
||||
( "output,o", po::value<std::vector<std::string> >(), "output file" ) /**/
|
||||
( "size,s", po::value<std::string>(), "size (WxH)" ) /**/
|
||||
( "pel_fmt", po::value<std::string>(), "pixel format" ) /**/
|
||||
( "pel_fmts", "list pixel formats" ) /**/
|
||||
( "frames,f", po::value<UInt>(), "number of frames" );
|
||||
|
||||
po::options_description commonOpts( "Common" );
|
||||
commonOpts.add_options()/**/
|
||||
( "help", "produce help message" )/**/
|
||||
( "version", "show version and exit" );
|
||||
commonOpts.add( inputOpts );
|
||||
return commonOpts;
|
||||
}
|
||||
|
||||
Void PlaYUVerCmdParser::addOptions( po::options_description opts )
|
||||
{
|
||||
m_ParserOptions.add( opts );
|
||||
}
|
||||
|
||||
Bool PlaYUVerCmdParser::parse()
|
||||
{
|
||||
try
|
||||
{
|
||||
po::store( po::command_line_parser( m_iArgc, m_apcArgv ).options( m_ParserOptions ).allow_unregistered().run(), m_cOptionsMap );
|
||||
po::notify( m_cOptionsMap );
|
||||
|
||||
if( m_cOptionsMap.count( "help" ) )
|
||||
{
|
||||
std::cout << m_ParserOptions
|
||||
<< "\n";
|
||||
return false;
|
||||
}
|
||||
if( m_cOptionsMap.count( "version" ) )
|
||||
{
|
||||
std::cout << "PlaYUVer version "
|
||||
<< PLAYUVER_VERSION_STRING
|
||||
<< "\n";
|
||||
return false;
|
||||
}
|
||||
if( checkListingOpts() )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch( std::exception& e )
|
||||
{
|
||||
std::cerr << "error: "
|
||||
<< e.what()
|
||||
<< "\n";
|
||||
return false;
|
||||
}
|
||||
catch( ... )
|
||||
{
|
||||
std::cerr << "Exception of unknown type!\n";
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Bool PlaYUVerCmdParser::checkListingOpts()
|
||||
{
|
||||
Bool bRet = false;
|
||||
if( m_cOptionsMap.count( "pel_fmts" ) )
|
||||
{
|
||||
printf( "PlaYUVer supported pixel formats: \n" );
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedPixelFormatListNames().size(); i++ )
|
||||
{
|
||||
printf( " %s\n", PlaYUVerFrame::supportedPixelFormatListNames()[i].c_str() );
|
||||
}
|
||||
bRet |= true;
|
||||
}
|
||||
return bRet;
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
@@ -0,0 +1,58 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@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 PlaYUVerCmdParser.h
|
||||
* \brief Command parser
|
||||
*/
|
||||
|
||||
#include "PlaYUVerDefs.h"
|
||||
#include <boost/program_options.hpp>
|
||||
namespace po = boost::program_options;
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
class PlaYUVerCmdParser
|
||||
{
|
||||
public:
|
||||
PlaYUVerCmdParser();
|
||||
~PlaYUVerCmdParser();
|
||||
|
||||
Void Config( Int argc, Char *argv[] );
|
||||
Void addOptions( po::options_description );
|
||||
Bool parse();
|
||||
|
||||
po::variables_map getOptionsMap()
|
||||
{
|
||||
return m_cOptionsMap;
|
||||
}
|
||||
|
||||
static po::options_description GetCommandOpts();
|
||||
|
||||
private:
|
||||
Int m_iArgc;
|
||||
Char** m_apcArgv;
|
||||
po::options_description m_ParserOptions;
|
||||
po::variables_map m_cOptionsMap;
|
||||
|
||||
Bool checkListingOpts();
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
@@ -163,7 +163,7 @@ Void PlaYUVerFrame::frameFromBuffer( Pel *Buff, UInt64 uiBuffSize )
|
||||
m_pcPelFormat->frameFromBuffer( Buff, m_pppcInputPel, m_uiWidth, m_uiHeight );
|
||||
m_bHasRGBPel = false;
|
||||
m_bHasHistogram = false;
|
||||
fillRGBBuffer();
|
||||
//fillRGBBuffer();
|
||||
}
|
||||
|
||||
Void PlaYUVerFrame::frameToBuffer( Pel *output_buffer )
|
||||
|
||||
+43
-11
@@ -37,7 +37,7 @@ class PixFcSSE;
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
class PlaYUVerFrame : public PlaYUVerFrameStats
|
||||
class PlaYUVerFrame: public PlaYUVerFrameStats
|
||||
{
|
||||
public:
|
||||
class Pixel
|
||||
@@ -60,14 +60,38 @@ public:
|
||||
PixelComponents[1] = c1;
|
||||
PixelComponents[2] = c2;
|
||||
}
|
||||
Int ColorSpace() { return m_iColorSpace; }
|
||||
Pel* Components() { return PixelComponents; }
|
||||
Pel& Y() { return PixelComponents[0]; }
|
||||
Pel& Cb() { return PixelComponents[1]; }
|
||||
Pel& Cr() { return PixelComponents[2]; }
|
||||
Pel& R() { return PixelComponents[0]; }
|
||||
Pel& G() { return PixelComponents[1]; }
|
||||
Pel& B() { return PixelComponents[2]; }
|
||||
Int ColorSpace()
|
||||
{
|
||||
return m_iColorSpace;
|
||||
}
|
||||
Pel* Components()
|
||||
{
|
||||
return PixelComponents;
|
||||
}
|
||||
Pel& Y()
|
||||
{
|
||||
return PixelComponents[0];
|
||||
}
|
||||
Pel& Cb()
|
||||
{
|
||||
return PixelComponents[1];
|
||||
}
|
||||
Pel& Cr()
|
||||
{
|
||||
return PixelComponents[2];
|
||||
}
|
||||
Pel& R()
|
||||
{
|
||||
return PixelComponents[0];
|
||||
}
|
||||
Pel& G()
|
||||
{
|
||||
return PixelComponents[1];
|
||||
}
|
||||
Pel& B()
|
||||
{
|
||||
return PixelComponents[2];
|
||||
}
|
||||
};
|
||||
|
||||
enum ColorSpace
|
||||
@@ -161,8 +185,16 @@ public:
|
||||
m_bHasRGBPel = false;
|
||||
return m_pppcInputPel;
|
||||
}
|
||||
UChar* getRGBBuffer() const
|
||||
// UChar* getRGBBuffer() const
|
||||
// {
|
||||
// return m_pcRGB32;
|
||||
// }
|
||||
UChar* getRGBBuffer()
|
||||
{
|
||||
if( !m_bHasRGBPel )
|
||||
{
|
||||
fillRGBBuffer();
|
||||
}
|
||||
return m_pcRGB32;
|
||||
}
|
||||
|
||||
@@ -185,7 +217,7 @@ public:
|
||||
NUMBER_METRICS,
|
||||
};
|
||||
|
||||
static std::vector<std::string> supportedQualityMetricsList()
|
||||
static std::vector<std::string> supportedQualityMetricsList()
|
||||
{
|
||||
std::vector<std::string> metrics;
|
||||
metrics.push_back( "PSNR" );
|
||||
|
||||
@@ -172,7 +172,7 @@ Bool PlaYUVerStream::open( std::string filename, std::string resolution, std::st
|
||||
}
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedPixelFormatListNames().size(); i++ )
|
||||
{
|
||||
if( PlaYUVerFrame::supportedPixelFormatListNames()[i] == input_format_name )
|
||||
if( lowercase( PlaYUVerFrame::supportedPixelFormatListNames()[i] ) == lowercase( input_format_name ) )
|
||||
{
|
||||
input_format = i;
|
||||
break;
|
||||
@@ -636,6 +636,12 @@ PlaYUVerFrame* PlaYUVerStream::getCurrFrame()
|
||||
return m_pcCurrFrame;
|
||||
}
|
||||
|
||||
PlaYUVerFrame* PlaYUVerStream::getNextFrame()
|
||||
{
|
||||
return m_pcNextFrame;
|
||||
}
|
||||
|
||||
|
||||
Bool PlaYUVerStream::seekInput( UInt64 new_frame_num )
|
||||
{
|
||||
if( !m_bInit || new_frame_num < 0 || new_frame_num >= m_uiTotalFrameNum || ( Int64 )new_frame_num == m_iCurrFrameNum )
|
||||
|
||||
@@ -136,6 +136,7 @@ public:
|
||||
Bool setNextFrame();
|
||||
PlaYUVerFrame* getCurrFrame();
|
||||
PlaYUVerFrame* getCurrFrame( PlaYUVerFrame * );
|
||||
PlaYUVerFrame* getNextFrame();
|
||||
|
||||
Bool seekInput( UInt64 new_frame_num );
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
### CMakeLists for playuver modules component
|
||||
###
|
||||
|
||||
OPTION( MODULE_THREADED_MODULES "Use threads for modules" OFF )
|
||||
|
||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/../ ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
|
||||
|
||||
set(plaYUver_Mod_SRCS
|
||||
|
||||
@@ -60,7 +60,7 @@ FilterComponentLuma::FilterComponentLuma()
|
||||
/* Module Definition */
|
||||
m_iModuleType = FRAME_PROCESSING_MODULE; // Apply module to the frames or to the whole sequence.
|
||||
// Currently only support for frame
|
||||
m_pchModuleCategory = "Filter Component"; // Category (sub-menu)
|
||||
m_pchModuleCategory = "FilterComponent"; // Category (sub-menu)
|
||||
m_pchModuleName = "Luma"; // Name
|
||||
m_pchModuleTooltip = "Filter Y matrix of YUV frame"; // Description
|
||||
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME; // Number of Frames required (ONE_FRAME, TWO_FRAMES, THREE_FRAMES)
|
||||
@@ -83,8 +83,8 @@ FilterComponentChromaU::FilterComponentChromaU()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleType = FRAME_PROCESSING_MODULE;
|
||||
m_pchModuleCategory = "Filter Component";
|
||||
m_pchModuleName = "Chroma U";
|
||||
m_pchModuleCategory = "FilterComponent";
|
||||
m_pchModuleName = "ChromaU";
|
||||
m_pchModuleTooltip = "Filter U matrix of YUV frame";
|
||||
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
|
||||
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING;
|
||||
@@ -105,8 +105,8 @@ FilterComponentChromaV::FilterComponentChromaV()
|
||||
{
|
||||
/* Module Definition */
|
||||
m_iModuleType = FRAME_PROCESSING_MODULE;
|
||||
m_pchModuleCategory = "Filter Component";
|
||||
m_pchModuleName = "Chroma V";
|
||||
m_pchModuleCategory = "FilterComponent";
|
||||
m_pchModuleName = "ChromaV";
|
||||
m_pchModuleTooltip = "Filter V matrix of YUV frame";
|
||||
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
|
||||
m_uiModuleRequirements = MODULE_REQUIRES_NOTHING;
|
||||
|
||||
@@ -32,7 +32,7 @@ LumaAverage::LumaAverage()
|
||||
/* Module Definition */
|
||||
m_iModuleType = FRAME_MEASUREMENT_MODULE;
|
||||
m_pchModuleCategory = "Measurements";
|
||||
m_pchModuleName = "Luma Average";
|
||||
m_pchModuleName = "LumaAverage";
|
||||
m_pchModuleTooltip = "Measure the average of luma component";
|
||||
m_uiNumberOfFrames = MODULE_REQUIRES_ONE_FRAME;
|
||||
m_uiModuleRequirements = MODULE_REQUIRES_SIDEBAR;
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
###
|
||||
### CMakeLists for playuver app component
|
||||
###
|
||||
|
||||
# This is hard way - please fix
|
||||
INCLUDE_DIRECTORIES(
|
||||
${CMAKE_CURRENT_BINARY_DIR}/../
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../ )
|
||||
|
||||
set(plaYUver_Tools_SRCS
|
||||
main.cpp
|
||||
PlaYUVerTools.cpp
|
||||
CommandLineHandle.cpp
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE( ${PROJECT_NAME}Tools ${plaYUver_Tools_SRCS} )
|
||||
|
||||
TARGET_LINK_LIBRARIES( ${PROJECT_NAME}Tools PlaYUVerLib PlaYUVerModules )
|
||||
|
||||
INSTALL(TARGETS ${PROJECT_NAME}Tools DESTINATION bin )
|
||||
|
||||
|
||||
@@ -0,0 +1,143 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@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 CommandLineHandle.cpp
|
||||
* \brief Handle for command line
|
||||
*/
|
||||
|
||||
#include <cstring>
|
||||
#include "CommandLineHandle.h"
|
||||
#include "lib/PlaYUVerFrame.h"
|
||||
#include "modules/PlaYUVerModuleIf.h"
|
||||
#include "modules/PlaYUVerModuleFactory.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
CommandLineHandle::CommandLineHandle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CommandLineHandle::~CommandLineHandle()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
Int CommandLineHandle::parseToolsArgs()
|
||||
{
|
||||
Int iRet = 0;
|
||||
|
||||
po::options_description qualityOpts( "Quality" );
|
||||
qualityOpts.add_options() /**/
|
||||
( "quality", po::value<std::string>(), "select a quality metric" ) /**/
|
||||
( "quality_metrics", "list supported quality metrics" );
|
||||
|
||||
po::options_description moduleOpts( "Module" );
|
||||
moduleOpts.add_options() /**/
|
||||
( "module", po::value<std::string>(), "select a module (use internal name)" ) /**/
|
||||
( "module_list", "list supported modules" ) /**/
|
||||
( "module_list_full", "detailed list supported modules" );
|
||||
|
||||
addOptions( qualityOpts );
|
||||
addOptions( moduleOpts );
|
||||
|
||||
if( !parse() )
|
||||
{
|
||||
iRet = 1;
|
||||
}
|
||||
|
||||
if( getOptionsMap().count( "quality_metrics" ) )
|
||||
{
|
||||
printf( "PlaYUVer supported quality metrics: \n" );
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedQualityMetricsList().size(); i++ )
|
||||
{
|
||||
printf( " %s\n", PlaYUVerFrame::supportedQualityMetricsList()[i].c_str() );
|
||||
}
|
||||
iRet = 1;
|
||||
}
|
||||
|
||||
if( getOptionsMap().count( "module_list" ) || getOptionsMap().count( "module_list_full" ) )
|
||||
{
|
||||
listModules();
|
||||
iRet = 1;
|
||||
}
|
||||
|
||||
return iRet;
|
||||
}
|
||||
|
||||
Void CommandLineHandle::listModules()
|
||||
{
|
||||
Bool bDetailed = false;
|
||||
|
||||
if( getOptionsMap().count( "module_list_full" ) )
|
||||
bDetailed = true;
|
||||
|
||||
PlaYUVerModuleIf* pcCurrModuleIf;
|
||||
PlaYUVerModuleFactoryMap& PlaYUVerModuleFactoryMap = PlaYUVerModuleFactory::Get()->getMap();
|
||||
PlaYUVerModuleFactoryMap::iterator it = PlaYUVerModuleFactoryMap.begin();
|
||||
|
||||
printf( "PlaYUVer available modules: \n" );
|
||||
//printf( " " );
|
||||
printf( " [Internal Name] " );
|
||||
if( bDetailed )
|
||||
{
|
||||
printf( " [Full Name] " );
|
||||
printf( " [Type] " );
|
||||
printf( " [Description]" );
|
||||
}
|
||||
printf( " \n" );
|
||||
|
||||
Char ModuleNameString[40];
|
||||
|
||||
for( UInt i = 0; it != PlaYUVerModuleFactoryMap.end(); ++it, i++ )
|
||||
{
|
||||
printf( " " );
|
||||
printf( "%-30s", it->first );
|
||||
if( bDetailed )
|
||||
{
|
||||
ModuleNameString[0] = '\0';
|
||||
pcCurrModuleIf = it->second();
|
||||
|
||||
if( pcCurrModuleIf->m_pchModuleCategory )
|
||||
{
|
||||
strcat( ModuleNameString, pcCurrModuleIf->m_pchModuleCategory );
|
||||
strcat( ModuleNameString, "/" );
|
||||
}
|
||||
strcat( ModuleNameString, pcCurrModuleIf->m_pchModuleName );
|
||||
printf( " %-40s", ModuleNameString );
|
||||
switch( pcCurrModuleIf->m_iModuleType )
|
||||
{
|
||||
case FRAME_PROCESSING_MODULE:
|
||||
printf( " Processing " );
|
||||
break;
|
||||
case FRAME_MEASUREMENT_MODULE:
|
||||
printf( " Measurement " );
|
||||
break;
|
||||
}
|
||||
printf( " %s", pcCurrModuleIf->m_pchModuleTooltip );
|
||||
pcCurrModuleIf->Delete();
|
||||
}
|
||||
printf( "\n" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
@@ -0,0 +1,48 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@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 CommandLineHandle.h
|
||||
* \brief Handle for command line
|
||||
*/
|
||||
|
||||
#ifndef __COMMANDLINEHANDLE_H__
|
||||
#define __COMMANDLINEHANDLE_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "lib/PlaYUVerDefs.h"
|
||||
#include "lib/PlaYUVerCmdParser.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
class CommandLineHandle: public PlaYUVerCmdParser
|
||||
{
|
||||
public:
|
||||
CommandLineHandle();
|
||||
~CommandLineHandle();
|
||||
|
||||
Int parseToolsArgs();
|
||||
Void listModules();
|
||||
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
#endif // __COMMANDLINEHANDLE_H__
|
||||
@@ -0,0 +1,331 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@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 PlaYUVerTools.cpp
|
||||
* \brief Main definition of the PlaYUVerTools APp
|
||||
*/
|
||||
|
||||
#include "PlaYUVerTools.h"
|
||||
#include "modules/PlaYUVerModuleIf.h"
|
||||
#include "modules/PlaYUVerModuleFactory.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
PlaYUVerTools::PlaYUVerTools()
|
||||
{
|
||||
m_uiOperation = INVALID_OPERATION;
|
||||
m_uiNumberOfFrames = -1;
|
||||
|
||||
m_uiQualityMetric = -1;
|
||||
|
||||
m_pcCurrModuleIf = NULL;
|
||||
}
|
||||
|
||||
PlaYUVerTools::~PlaYUVerTools()
|
||||
{
|
||||
for( UInt i = 0; i < m_apcInputStreams.size(); i++ )
|
||||
{
|
||||
m_apcInputStreams[i]->close();
|
||||
}
|
||||
for( UInt i = 0; i < m_apcOutputStreams.size(); i++ )
|
||||
{
|
||||
m_apcOutputStreams[i]->close();
|
||||
}
|
||||
}
|
||||
|
||||
Int PlaYUVerTools::openInputs()
|
||||
{
|
||||
/**
|
||||
* Create input streams
|
||||
*/
|
||||
if( m_cCommandLineParser.getOptionsMap().count( "input" ) )
|
||||
{
|
||||
std::string resolutionString( "" );
|
||||
if( m_cCommandLineParser.getOptionsMap().count( "size" ) )
|
||||
{
|
||||
resolutionString = m_cCommandLineParser.getOptionsMap()["size"].as<std::string>();
|
||||
}
|
||||
std::string fmtString( "yuv420p" );
|
||||
if( m_cCommandLineParser.getOptionsMap().count( "pel_fmt" ) )
|
||||
{
|
||||
fmtString = m_cCommandLineParser.getOptionsMap()["pel_fmt"].as<std::string>();
|
||||
}
|
||||
|
||||
std::vector<std::string> inputFileNames = m_cCommandLineParser.getOptionsMap()["input"].as<std::vector<std::string> >();
|
||||
|
||||
PlaYUVerStream* pcStream;
|
||||
for( UInt i = 0; i < inputFileNames.size(); i++ )
|
||||
{
|
||||
pcStream = new PlaYUVerStream;
|
||||
try
|
||||
{
|
||||
if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, 1 ) )
|
||||
{
|
||||
printf( "Cannot open input stream %s! ", inputFileNames[i].c_str() );
|
||||
return 2;
|
||||
}
|
||||
m_apcInputStreams.push_back( pcStream );
|
||||
}
|
||||
catch( const char *msg )
|
||||
{
|
||||
printf( "Cannot open input stream %s with the following error: \n%s\n", inputFileNames[i].c_str(), msg );
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
m_uiNumberOfFrames = MAX_UINT;
|
||||
if( m_cCommandLineParser.getOptionsMap().count( "frames" ) )
|
||||
{
|
||||
m_uiNumberOfFrames = m_cCommandLineParser.getOptionsMap()["frames"].as<UInt>();
|
||||
}
|
||||
|
||||
m_uiNumberOfComponents = MAX_UINT;
|
||||
for( UInt i = 0; i < m_apcInputStreams.size(); i++ )
|
||||
{
|
||||
if( m_apcInputStreams[i]->getFrameNum() < m_uiNumberOfFrames )
|
||||
m_uiNumberOfFrames = m_apcInputStreams[i]->getFrameNum();
|
||||
if( m_apcInputStreams[i]->getCurrFrame()->getNumberChannels() < m_uiNumberOfComponents )
|
||||
m_uiNumberOfComponents = m_apcInputStreams[i]->getCurrFrame()->getNumberChannels();
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Int PlaYUVerTools::openOutputs()
|
||||
{
|
||||
if( m_cCommandLineParser.getOptionsMap().count( "output" ) )
|
||||
{
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
Int PlaYUVerTools::Open( Int argc, Char *argv[] )
|
||||
{
|
||||
Int iRet = 0;
|
||||
|
||||
m_cCommandLineParser.Config( argc, argv );
|
||||
if( ( iRet = m_cCommandLineParser.parseToolsArgs() ) > 0 )
|
||||
{
|
||||
return iRet;
|
||||
}
|
||||
|
||||
if( openInputs() > 0 )
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Quality operation
|
||||
*/
|
||||
if( m_cCommandLineParser.getOptionsMap().count( "quality" ) )
|
||||
{
|
||||
std::string qualityMetric = m_cCommandLineParser.getOptionsMap()["quality"].as<std::string>();
|
||||
if( m_apcInputStreams.size() != 2 )
|
||||
{
|
||||
printf( "Invalid number of inputs! " );
|
||||
return 2;
|
||||
}
|
||||
for( UInt i = 0; i < PlaYUVerFrame::supportedQualityMetricsList().size(); i++ )
|
||||
{
|
||||
if( lowercase( PlaYUVerFrame::supportedQualityMetricsList()[i] ) == lowercase( qualityMetric ) )
|
||||
{
|
||||
m_uiQualityMetric = i;
|
||||
}
|
||||
}
|
||||
if( m_uiQualityMetric == -1 )
|
||||
{
|
||||
printf( "Invalid quality metric! " );
|
||||
return 2;
|
||||
}
|
||||
m_uiOperation = QUALITY_OPERATION;
|
||||
m_fpProcess = &PlaYUVerTools::QualityOperation;
|
||||
printf( "PlaYUVer Quality\n" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Check Module operation
|
||||
*/
|
||||
if( m_cCommandLineParser.getOptionsMap().count( "module" ) )
|
||||
{
|
||||
std::string moduleName = m_cCommandLineParser.getOptionsMap()["module"].as<std::string>();
|
||||
|
||||
PlaYUVerModuleFactoryMap& PlaYUVerModuleFactoryMap = PlaYUVerModuleFactory::Get()->getMap();
|
||||
PlaYUVerModuleFactoryMap::iterator it = PlaYUVerModuleFactoryMap.begin();
|
||||
for( UInt i = 0; it != PlaYUVerModuleFactoryMap.end(); ++it, i++ )
|
||||
{
|
||||
if( strcmp( it->first, moduleName.c_str() ) == 0 )
|
||||
{
|
||||
m_pcCurrModuleIf = it->second();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( m_apcInputStreams.size() != m_pcCurrModuleIf->m_uiNumberOfFrames )
|
||||
{
|
||||
printf( "Invalid number of inputs! " );
|
||||
return 2;
|
||||
}
|
||||
|
||||
m_pcCurrModuleIf->create( m_apcInputStreams[0]->getCurrFrame() );
|
||||
|
||||
m_uiOperation = MODULE_OPERATION;
|
||||
m_fpProcess = &PlaYUVerTools::ModuleOperation;
|
||||
printf( "PlaYUVer Module\n" );
|
||||
}
|
||||
|
||||
if( m_uiOperation == INVALID_OPERATION )
|
||||
{
|
||||
printf( "No operation was selected! " );
|
||||
return 2;
|
||||
}
|
||||
return iRet;
|
||||
}
|
||||
|
||||
Int PlaYUVerTools::Process()
|
||||
{
|
||||
return ( this->*m_fpProcess )();
|
||||
}
|
||||
|
||||
Int PlaYUVerTools::Close()
|
||||
{
|
||||
// Finish
|
||||
return 0;
|
||||
}
|
||||
|
||||
Int PlaYUVerTools::QualityOperation()
|
||||
{
|
||||
PlaYUVerFrame* apcCurrFrame[m_apcInputStreams.size()];
|
||||
Bool abEOF[m_apcInputStreams.size()];
|
||||
Double adAverageQuality[m_apcInputStreams.size() - 1][m_uiNumberOfComponents];
|
||||
Double dQuality;
|
||||
|
||||
printf( " Measuring Quality using %s ... \n", PlaYUVerFrame::supportedQualityMetricsList()[m_uiQualityMetric].c_str() );
|
||||
|
||||
for( UInt s = 0; s < m_apcInputStreams.size(); s++ )
|
||||
{
|
||||
abEOF[s] = false;
|
||||
for( UInt c = 0; c < m_uiNumberOfComponents; c++ )
|
||||
{
|
||||
adAverageQuality[s][c] = 0;
|
||||
}
|
||||
}
|
||||
for( UInt frame = 0; frame < m_uiNumberOfFrames; frame++ )
|
||||
{
|
||||
printf( " %3d", frame );
|
||||
for( UInt s = 0; s < m_apcInputStreams.size(); s++ )
|
||||
apcCurrFrame[s] = m_apcInputStreams[s]->getCurrFrame();
|
||||
|
||||
for( UInt s = 1; s < m_apcInputStreams.size(); s++ )
|
||||
{
|
||||
printf( " " );
|
||||
for( UInt c = 0; c < m_uiNumberOfComponents; c++ )
|
||||
{
|
||||
dQuality = apcCurrFrame[s]->getQuality( m_uiQualityMetric, apcCurrFrame[0], c );
|
||||
adAverageQuality[s - 1][c] = ( adAverageQuality[s - 1][c] * Double( frame ) + dQuality ) / Double( frame + 1 );
|
||||
printf( " %5.3f", dQuality );
|
||||
}
|
||||
}
|
||||
printf( "\n" );
|
||||
for( UInt s = 0; s < m_apcInputStreams.size(); s++ )
|
||||
{
|
||||
abEOF[s] = m_apcInputStreams[s]->setNextFrame();
|
||||
if( !abEOF[s] )
|
||||
{
|
||||
m_apcInputStreams[s]->readFrame();
|
||||
}
|
||||
}
|
||||
}
|
||||
printf( "\n Mean Values: \n " );
|
||||
for( UInt s = 0; s < m_apcInputStreams.size() - 1; s++ )
|
||||
{
|
||||
for( UInt c = 0; c < m_uiNumberOfComponents; c++ )
|
||||
{
|
||||
printf( " %5.3f", adAverageQuality[s][c] );
|
||||
}
|
||||
}
|
||||
printf( "\n" );
|
||||
return 0;
|
||||
}
|
||||
|
||||
Int PlaYUVerTools::ModuleOperation()
|
||||
{
|
||||
printf( " Applying Module %s/%s ... \n", m_pcCurrModuleIf->m_pchModuleCategory, m_pcCurrModuleIf->m_pchModuleName );
|
||||
|
||||
PlaYUVerFrame* pcProcessedFrame = NULL;
|
||||
Double dMeasurementResult = 0.0;
|
||||
Double dAveragedMeasurementResult = 0;
|
||||
Bool abEOF[m_apcInputStreams.size()];
|
||||
|
||||
for( UInt s = 0; s < m_apcInputStreams.size(); s++ )
|
||||
{
|
||||
abEOF[s] = false;
|
||||
}
|
||||
|
||||
for( UInt frame = 0; frame < m_uiNumberOfFrames; frame++ )
|
||||
{
|
||||
|
||||
if( m_pcCurrModuleIf->m_iModuleType == FRAME_PROCESSING_MODULE )
|
||||
{
|
||||
switch( m_pcCurrModuleIf->m_uiNumberOfFrames )
|
||||
{
|
||||
case MODULE_REQUIRES_ONE_FRAME:
|
||||
pcProcessedFrame = m_pcCurrModuleIf->process( m_apcInputStreams[0]->getCurrFrame() );
|
||||
break;
|
||||
case MODULE_REQUIRES_TWO_FRAMES:
|
||||
pcProcessedFrame = m_pcCurrModuleIf->process( m_apcInputStreams[0]->getCurrFrame(), m_apcInputStreams[1]->getCurrFrame() );
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if( m_pcCurrModuleIf->m_iModuleType == FRAME_MEASUREMENT_MODULE )
|
||||
{
|
||||
switch( m_pcCurrModuleIf->m_uiNumberOfFrames )
|
||||
{
|
||||
case MODULE_REQUIRES_ONE_FRAME:
|
||||
dMeasurementResult = m_pcCurrModuleIf->measure( m_apcInputStreams[0]->getCurrFrame() );
|
||||
break;
|
||||
case MODULE_REQUIRES_TWO_FRAMES:
|
||||
dMeasurementResult = m_pcCurrModuleIf->measure( m_apcInputStreams[0]->getCurrFrame(), m_apcInputStreams[1]->getCurrFrame() );
|
||||
break;
|
||||
}
|
||||
printf( " %3d %8.3f \n", frame, dMeasurementResult );
|
||||
dAveragedMeasurementResult = ( dAveragedMeasurementResult * Double( frame ) + dMeasurementResult ) / Double( frame + 1 );
|
||||
}
|
||||
|
||||
for( UInt s = 0; s < m_apcInputStreams.size(); s++ )
|
||||
{
|
||||
abEOF[s] = m_apcInputStreams[s]->setNextFrame();
|
||||
if( !abEOF[s] )
|
||||
{
|
||||
m_apcInputStreams[s]->readFrame();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if( m_pcCurrModuleIf->m_iModuleType == FRAME_MEASUREMENT_MODULE )
|
||||
{
|
||||
printf( "\n Mean Value: \n %8.3f\n", dAveragedMeasurementResult );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // NAMESPACE
|
||||
@@ -0,0 +1,81 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
* Joao Carreira (jfmcarreira@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 PlaYUVerTools.h
|
||||
* \brief Main definition of the PlaYUVerTools app
|
||||
*/
|
||||
|
||||
#ifndef __PLAYUVERTOOLS_H__
|
||||
#define __PLAYUVERTOOLS_H__
|
||||
|
||||
#include "config.h"
|
||||
#include "lib/PlaYUVerDefs.h"
|
||||
#include "lib/PlaYUVerFrame.h"
|
||||
#include "lib/PlaYUVerStream.h"
|
||||
#include "CommandLineHandle.h"
|
||||
|
||||
namespace plaYUVer
|
||||
{
|
||||
|
||||
class PlaYUVerModuleIf;
|
||||
|
||||
class PlaYUVerTools
|
||||
{
|
||||
public:
|
||||
PlaYUVerTools();
|
||||
~PlaYUVerTools();
|
||||
|
||||
Int Open( Int argc, Char *argv[] );
|
||||
Int Process();
|
||||
Int Close();
|
||||
|
||||
private:
|
||||
CommandLineHandle m_cCommandLineParser;
|
||||
|
||||
UInt m_uiOperation;
|
||||
enum TOOLS_OPERATIONS_LIST
|
||||
{
|
||||
INVALID_OPERATION,
|
||||
QUALITY_OPERATION,
|
||||
MODULE_OPERATION,
|
||||
};
|
||||
|
||||
UInt m_uiNumberOfFrames;
|
||||
UInt m_uiNumberOfComponents;
|
||||
std::vector<PlaYUVerStream*> m_apcInputStreams;
|
||||
std::vector<PlaYUVerStream*> m_apcOutputStreams;
|
||||
|
||||
Int openInputs();
|
||||
Int openOutputs();
|
||||
|
||||
typedef Int (PlaYUVerTools::*FpProcess) ();
|
||||
FpProcess m_fpProcess;
|
||||
|
||||
|
||||
Int m_uiQualityMetric;
|
||||
Int QualityOperation();
|
||||
|
||||
PlaYUVerModuleIf* m_pcCurrModuleIf;
|
||||
Int ModuleOperation();
|
||||
};
|
||||
|
||||
} // NAMESPACE
|
||||
|
||||
#endif // __PLAYUVERTOOLS_H__
|
||||
@@ -0,0 +1,58 @@
|
||||
/* This file is a part of plaYUVer project
|
||||
* Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com)
|
||||
*
|
||||
* Joao Carreira (jfmcarreira@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 main.cpp
|
||||
* \brief main file
|
||||
*/
|
||||
|
||||
#include "PlaYUVerTools.h"
|
||||
|
||||
using namespace plaYUVer;
|
||||
|
||||
int main( int argc, char *argv[] )
|
||||
{
|
||||
Int iRet = 0;
|
||||
PlaYUVerTools PlaYUVerToolsApp;
|
||||
|
||||
iRet = PlaYUVerToolsApp.Open( argc, argv );
|
||||
if( iRet == 1 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if( iRet > 1 )
|
||||
{
|
||||
printf( "Exiting\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( PlaYUVerToolsApp.Process() > 1 )
|
||||
{
|
||||
printf( "Exiting\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( PlaYUVerToolsApp.Close() > 1 )
|
||||
{
|
||||
printf( "Exiting\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user