Author SHA1 Message Date
jfmcarreira 9e8dfc2e3d Merge remote-tracking branch 'origin/feature/CalypFrameTestingCatch2' into feature/CalypFrameTestingCatch2 2021-05-08 23:15:16 +01:00
jfmcarreira 0280200a82 Add cmake with catch tests 2021-05-08 23:03:10 +01:00
João Carreira d29f8ea215 Add src files for catch2 tests 2021-05-03 01:43:19 +01:00
João Carreira 2d8476e875 Start adding cmake code to use catch2 2021-05-03 01:43:15 +01:00
jfmcarreira 864c3253f1 Fix cmake warnings for devs 2021-05-03 01:31:21 +01:00
João Carreira 32f803ada9 Add first tests using catch2 2021-05-03 00:24:02 +01:00
João Carreira 63eb742f64 Add src files for catch2 tests 2021-05-03 00:00:54 +01:00
João Carreira 72ef7deda6 Start adding cmake code to use catch2 2021-05-02 23:55:07 +01:00
João Carreira a2d452fd64 Ignore any build dir starting with build-* 2021-05-02 23:23:42 +01:00
jfmcarreira 3732810f9e Fix deprecated Qt functions
Change the way to get the screen size
Remove Qt::WindowFlags
Change function to process events from mouse wheel
2021-05-01 01:35:28 +01:00
jfmcarreira 56fc2e45bb Remove deprecated av_register_all() 2021-05-01 01:34:38 +01:00
jfmcarreira fa23256955 Add GitHub action to build code using cmake 2021-04-17 18:33:13 +01:00
jfmcarreira ffe0c38427 Bump version 2021-04-17 18:29:08 +01:00
jfmcarreira 12bd1a4c2c Add details to about dialog and change theme for windows 2021-04-17 18:27:47 +01:00
jfmcarreira b830b700ca Define style on windows 2021-04-17 12:59:55 +01:00
jfmcarreira 3109250471 Update last commit 2021-04-17 02:19:07 +01:00
jfmcarreira c6b43ac7fa Remove ffmpeg exe before building against it 2021-04-17 02:09:27 +01:00
jfmcarreira beed955e3f Change ffmpeg installation on windows 2021-04-17 01:57:27 +01:00
jfmcarreira 1f003ec2ac Add libswresample to FindFFmpeg 2021-04-17 01:22:34 +01:00
jfmcarreira c718d01700 Complete ffmpeg def in appveyor
Add missing variable definitions for avdevice and postproc library
Define variable FFMPEG_DIR
2021-04-17 00:44:34 +01:00
jfmcarreira 847f4f06b9 Remove testing from travis ci 2021-04-16 22:47:07 +01:00
jfmcarreira 344188234b Add missing dependency to gtest in travis env 2021-04-16 22:25:40 +01:00
jfmcarreira 5439fd1af5 Revert changes to travis CI 2021-04-07 15:56:57 +01:00
jfmcarreira 2f434d269b Run tests in travisCI 2021-04-06 22:58:20 +01:00
jfmcarreira a72208f0e6 Remove unused file and update .gitignore 2021-04-06 22:57:31 +01:00
jfmcarreira c3c4e229d8 Tests: Add general tests for modules
The idea of these tests is to check whether the modules will work
with different kinds of inputs. The modules should be able to initialize
or return an error indication. But in all cases they should be able to handle
default arguments all different inputs
2021-04-06 22:57:12 +01:00
29 changed files with 361 additions and 150 deletions

No files matched your search

+2 -1
View File
@@ -25,13 +25,14 @@ install:
- 7z x ffmpeg.7z -y -offmpeg
- git clone https://github.com/pixlra/calyp-deployment.git
- CALL calyp-deployment/scripts/extract_ffmpeg.bat
- ps: rm C:\Projects\ffmpeg_libraries\bin\*.exe
build_script:
- mv C:\Projects\calyp C:\Projects\calyp-deployment\cmake-helper\
- mkdir C:\Projects\calyp-build
- cd C:\Projects\calyp-build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DUSE_DYNLOAD=OFF -DOpenCV_DIR="C:/Tools/opencv/build" -DOpenCV_DLL_DIR="C:/Tools/opencv/build/x64/vc15/bin" -DOpenCV_INSTALL_MODULES="world" -DQT_DIR="C:\Qt\latest\msvc2017_64" -DQt5_DIR="C:\Qt\latest\msvc2017_64\lib\cmake\Qt5" -DUSE_QTDBUS=OFF -DAVFORMAT_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avformat.lib -DAVFORMAT_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DAVCODEC_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avcodec.lib -DAVCODEC_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DAVUTIL_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avutil.lib -DAVUTIL_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DSWSCALE_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/swscale.lib -DSWSCALE_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -G "Visual Studio 15 2017 Win64" C:\Projects\calyp-deployment\cmake-helper
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DUSE_DYNLOAD=OFF -DOpenCV_DIR="C:/Tools/opencv/build" -DOpenCV_DLL_DIR="C:/Tools/opencv/build/x64/vc15/bin" -DOpenCV_INSTALL_MODULES="world" -DQT_DIR="C:\Qt\latest\msvc2017_64" -DQt5_DIR="C:\Qt\latest\msvc2017_64\lib\cmake\Qt5" -DUSE_QTDBUS=OFF -DAVFORMAT_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avformat.lib -DAVFORMAT_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DAVCODEC_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avcodec.lib -DAVCODEC_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DAVUTIL_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avutil.lib -DAVUTIL_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DSWSCALE_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/swscale.lib -DSWSCALE_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DAVDEVICE_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avdevice.lib -DAVDEVICE_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DPOSTPROC_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/postproc.lib -DPOSTPROC_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DFFMPEG_DIR=C:\Projects\ffmpeg_libraries -DSWRESAMPLE_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/swresample.lib -DSWRESAMPLE_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -G "Visual Studio 15 2017 Win64" C:\Projects\calyp-deployment\cmake-helper
- cmake --build . --target ALL_BUILD -- /p:Configuration=Release > log_build
- cmake --build . --target INSTALL -- /p:Configuration=Release > log_install
- cmake --build . --target PACKAGE -- /p:Configuration=Release > log_pkg
+31
View File
@@ -0,0 +1,31 @@
name: Build and Test
on:
push:
branches:
- devel
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Dependencies
run: sudo apt-get install cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev libopencv-contrib-dev
- name: Build CMake
uses: ashutoshvarma/action-cmake-build@v1
with:
build-dir: ${{ runner.workspace }}/build
# will set the CC & CXX for cmake
cc: gcc
cxx: g++
build-type: Release
# Extra options pass to cmake while configuring project
configure-options: -DBUILD_TESTS=ON -DUSE_WERROR=ON
run-test: true
#ctest-options: -R mytest
# install the build using cmake --install
install-build: true
# run build using '-j [parallel]' to use multiple threads to build
parallel: 14
+4 -4
View File
@@ -76,6 +76,7 @@
# CMake
bin/
build/
build-*
cmake-build-*/
# Mongo Explorer plugin
@@ -136,11 +137,10 @@ fabric.properties
### vscode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Documentation
doc/
# CLang
compile_commands.json
+1 -1
View File
@@ -2,6 +2,6 @@ language: cpp
dist: xenial
before_install:
- sudo apt-get -qq update
- sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev libopencv-contrib-dev
- sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev libopencv-contrib-dev libgtest-dev
script:
- mkdir -p build && cd build && cmake .. && make && cd ..
+28 -15
View File
@@ -2,15 +2,7 @@
# CMakeLists for calyp
#
CMAKE_MINIMUM_REQUIRED(VERSION 3.2.0)
# ####################################################################################################################################################
# CMake functions
# ####################################################################################################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
INCLUDE(cmake/ModulesFct.cmake)
INCLUDE(FeatureSummary)
INCLUDE(GNUInstallDirs)
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.0)
# ####################################################################################################################################################
# Project Definition
@@ -25,15 +17,28 @@ SET(PROJECT_LIBRARY
CACHE INTERNAL "" FORCE
)
PROJECT(${PROJECT_NAME})
SET(CALYP_VERSION_MAJOR "1")
SET(CALYP_VERSION_MINOR "1")
SET(CALYP_VERSION_MINOR "2")
SET(CALYP_VERSION_PATCH "0")
SET(CALYP_VERSION
"${CALYP_VERSION_MAJOR}.${CALYP_VERSION_MINOR}.${CALYP_VERSION_PATCH}"
CACHE INTERNAL "" FORCE
)
PROJECT(
${PROJECT_NAME}
VERSION ${CALYP_VERSION}
LANGUAGES "CXX"
)
# ####################################################################################################################################################
# CMake functions
# ####################################################################################################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
INCLUDE(cmake/ModulesFct.cmake)
INCLUDE(FeatureSummary)
INCLUDE(GNUInstallDirs)
# ####################################################################################################################################################
# Variables
# ####################################################################################################################################################
@@ -43,6 +48,7 @@ OPTION(BUILD_TOOLS "Build Command Line Application" ON)
OPTION(BUILD_EXAMPLES "Build Examples" OFF)
OPTION(BUILD_DOC "Build Documentation" OFF)
OPTION(BUILD_TESTS "Build Google Tests" OFF)
OPTION(BUILD_TESTS_CATCH2 "Build Catch2 Tests" OFF)
OPTION(USE_FERVOR "Add Fervor support" OFF)
@@ -119,6 +125,17 @@ IF(BUILD_TESTS)
)
ENDIF()
IF(BUILD_TESTS_CATCH2)
FIND_PACKAGE(Catch2 REQUIRED)
ENABLE_TESTING()
SET_PACKAGE_PROPERTIES(
Catch2 PROPERTIES
URL "https://github.com/catchorg/Catch2"
DESCRIPTION "Catch2 unit tests"
TYPE OPTIONAL
)
ENDIF()
OPTION(USE_OPENCV "Add OpenCV support" ON)
IF(USE_OPENCV)
@@ -147,10 +164,6 @@ SET_PACKAGE_PROPERTIES(
OPTION(USE_FFMPEG "Add FFMPEG support" ON)
IF(USE_FFMPEG)
FIND_PACKAGE(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE)
IF("${AVCODEC_VERSION}" VERSION_LESS "56.0.0")
SET(FFMPEG_FOUND FALSE)
SET(FFmpeg_FOUND FALSE)
ENDIF()
SET(USE_FFMPEG ${FFMPEG_FOUND})
ENDIF()
SET_PACKAGE_PROPERTIES(
+5 -1
View File
@@ -24,6 +24,10 @@
#include "PlotSubWindow.h"
#include <QGuiApplication>
#include <QScreen>
#include <QSize>
#include "qcustomplot.h"
//#include "external/qcustomplot/qcustomplot.h"
@@ -174,7 +178,7 @@ QSize PlotSubWindow::sizeHint() const
}
else
{
maxSize = QApplication::desktop()->availableGeometry().size();
maxSize = QGuiApplication::screens()[0]->availableGeometry().size();
}
return sizeHint( maxSize );
}
+9 -5
View File
@@ -29,10 +29,12 @@
#include <QActionGroup>
#include <QApplication>
#include <QDesktopWidget>
#include <QGuiApplication>
#include <QHBoxLayout>
#include <QMdiArea>
#include <QMenu>
#include <QPainter>
#include <QScreen>
#include <QSettings>
#include <QSignalMapper>
#include <QStyle>
@@ -154,7 +156,7 @@ void SubWindowHandle::setWindowMode( int iWindowMode )
parentWidget()->update();
m_pcApp->showNormal();
qApp->processEvents();
QSize screenSize = QApplication::desktop()->availableGeometry().size();
QSize screenSize = QGuiApplication::screens()[0]->availableGeometry().size();
m_pcApp->move( 0, 0 );
m_pcApp->resize( screenSize.width(), 5 );
m_pcApp->setWindowTitle( QApplication::applicationName() );
@@ -230,12 +232,14 @@ void SubWindowHandle::addMdiSubWindow( SubWindowAbstract* window )
SLOT( removeMdiSubWindow( MdiSubWindow* ) ) );
}
void SubWindowHandle::addSubWindow( SubWindowAbstract* window, Qt::WindowFlags flags )
void SubWindowHandle::addSubWindow( SubWindowAbstract* window )
{
if( window )
{
connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp, SLOT( printMessage( const QString& ) ) );
connect( window, SIGNAL( zoomFactorChanged( const double, const QPoint ) ), m_pcApp, SLOT( updateZoomFactorSBox() ) );
connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp,
SLOT( printMessage( const QString& ) ) );
connect( window, SIGNAL( zoomFactorChanged( const double, const QPoint ) ), m_pcApp,
SLOT( updateZoomFactorSBox() ) );
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
{
connect( window, SIGNAL( aboutToActivate( SubWindowAbstract* ) ), this,
@@ -378,7 +382,7 @@ void SubWindowHandle::tileSubWindows()
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
{
QSize screenSize = QApplication::desktop()->availableGeometry().size();
QSize screenSize = QGuiApplication::screens()[0]->availableGeometry().size();
unsigned int minWindowsInRow = 1;
while( ( screenSize.width() / minWindowsInRow ) > 500 )
{
+1 -1
View File
@@ -51,7 +51,7 @@ public:
void processLogMsg( const QString& msg );
void addSubWindow( SubWindowAbstract* widget, Qt::WindowFlags flags = 0 );
void addSubWindow( SubWindowAbstract* widget );
SubWindowAbstract* activeSubWindow() const;
+1 -1
View File
@@ -259,7 +259,7 @@ QSize VideoSubWindow::sizeHint() const
}
else
{
maxSize = QApplication::desktop()->availableGeometry().size();
maxSize = QGuiApplication::screens()[0]->availableGeometry().size();
}
return sizeHint( maxSize );
}
-1
View File
@@ -182,7 +182,6 @@ public:
QSize sizeHint( const QSize& ) const;
QString getCurrentFileName() { return m_cFilename; }
bool getIsModule() { return getCategory() | SubWindowAbstract::MODULE_SUBWINDOW; }
void clearWindowBusy() { m_bWindowBusy = false; }
void setFillWindow( bool bFlag );
+1 -1
View File
@@ -730,7 +730,7 @@ void ViewArea::wheelEvent( QWheelEvent* event )
if( event->modifiers() & Qt::ControlModifier )
{
scale = 0.001 * event->delta();
scale = 0.001 * event->angleDelta().y();
if( scale > 0 )
scale = 1.25;
else
+10 -3
View File
@@ -49,7 +49,7 @@ AboutDialog::AboutDialog( QWidget* parent )
.arg( QApplication::applicationVersion() ) );
label->setWordWrap( false );
QString featuresList = QStringLiteral( "<p><h3><b>Features:</b></h3><ul>" );
QString featuresList = QStringLiteral( "<p><h4><b>Features:</b></h4><ul>" );
#ifdef USE_QTDBUS
featuresList.append( QStringLiteral( "<li>Support for Qt DBus messages" ) );
@@ -63,14 +63,21 @@ AboutDialog::AboutDialog( QWidget* parent )
featuresList.append( QStringLiteral( "</ul></p>" ) );
QLabel* labelFeatures = new QLabel( featuresList );
QLabel* labelCopyright = new QLabel( QStringLiteral( "Copyright © 2014–2018 Joao Carreira and Luis Lucas" ) );
QString thanksList = QStringLiteral( "<p><h4><b>Thanks to:</b></h4><ul>" );
thanksList.append( QStringLiteral( "<li>Joao Santos" ) );
thanksList.append( QStringLiteral( "<li>Jose Filipe" ) );
thanksList.append( QStringLiteral( "</ul></p>" ) );
QLabel* labelContributors = new QLabel( thanksList );
QLabel* labelCopyright = new QLabel( QStringLiteral( "Copyright 2014–2021 Joao Carreira and Luis Lucas" ) );
QWidget* topWidget = new QWidget;
QVBoxLayout* topLayout = new QVBoxLayout;
topLayout->addWidget( pixmapLabel, 0, Qt::AlignHCenter );
topLayout->addWidget( label );
topLayout->addWidget( labelFeatures );
topLayout->addWidget( labelCopyright );
topLayout->addWidget( labelFeatures );
topLayout->addWidget( labelContributors );
topWidget->setLayout( topLayout );
// QTextEdit *textEdit = new QTextEdit(tr("<p>This program is free "
+4
View File
@@ -51,6 +51,10 @@ int main( int argc, char* argv[] )
QApplication::setApplicationVersion( QStringLiteral( CALYP_VERSION_STRING ) );
QApplication::setOrganizationName( QStringLiteral( "PixLRA" ) );
#if _WIN32
application.setStyle( QStyleFactory::create( "Fusion" ) );
#endif
#ifdef USE_QTDBUS
/**
* use dbus, if available
+1
View File
@@ -86,6 +86,7 @@ IF(NOT FFMPEG_LIBRARIES)
FIND_COMPONENT(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
FIND_COMPONENT(AVUTIL libavutil avutil libavutil/avutil.h)
FIND_COMPONENT(SWSCALE libswscale swscale libswscale/swscale.h)
FIND_COMPONENT(SWRESAMPLE libswresample swresample libswresample/swresample.h)
FIND_COMPONENT(POSTPROC libpostproc postproc libpostproc/postprocess.h)
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
+1 -1
View File
@@ -4,7 +4,7 @@ MACRO(ADD_MODULE name file)
OPTION(MODULE_${name} "Use module ${name}" ON)
ADD_FEATURE_INFO(${name} MODULE_${name} "Module ${name}")
IF(MODULE_${name})
LIST(APPEND Calyp_Mod_SRCS ${MODULE_LOCATION}${file})
LIST(APPEND Calyp_Mod_SRCS ${MODULE_LOCATION}${file}.cpp)
LIST(APPEND MODULES_LIST_NAME ${name})
LIST(APPEND MODULES_LIST_FILES ${file})
SET(Calyp_Mod_SRCS
+1 -5
View File
@@ -77,9 +77,5 @@ IF(USE_FFMPEG)
"FFmpeg-Dir"
CACHE PATH "Where to find FFmpeg Lib on Windows"
)
INSTALL(FILES ${FFMPEG_DIR}/bin/avcodec-${AVCODEC_VERSION}.dll DESTINATION bin)
INSTALL(FILES ${FFMPEG_DIR}/bin/avformat-${AVFORMAT_VERSION}.dll DESTINATION bin)
INSTALL(FILES ${FFMPEG_DIR}/bin/avutil-${AVUTIL_VERSION}.dll DESTINATION bin)
INSTALL(FILES ${FFMPEG_DIR}/bin/swscale-${SWSCALE_VERSION}.dll DESTINATION bin)
INSTALL(FILES ${FFMPEG_DIR}/bin/swresample-${SWRESAMPLE_VERSION}.dll DESTINATION bin)
INSTALL(DIRECTORY ${FFMPEG_DIR}/bin/ DESTINATION bin)
ENDIF()
+4
View File
@@ -85,3 +85,7 @@ ENDIF()
IF(BUILD_TESTS)
ADD_SUBDIRECTORY(tests)
ENDIF()
IF(BUILD_TESTS_CATCH2)
ADD_SUBDIRECTORY(catch2)
ENDIF()
+1 -1
View File
@@ -91,7 +91,7 @@ bool StreamHandlerLibav::openHandler( ClpString strFilename, bool bInput )
// }
// Register all components of FFmpeg
av_register_all();
//av_register_all();
/* open input file, and allocate format context */
if( avformat_open_input( &m_cFmtCtx, filename, NULL, NULL ) < 0 )
+12
View File
@@ -0,0 +1,12 @@
#
# CMakeLists for Calyp lis tests using catch2
#
# ADD_DEFINITIONS(-DCALYP_TEST_DATA_DIR=\"${CALYP_TEST_DATA_DIR}\")
SET(Calyp_Lib_Catch2_Tests_SRCS CalypFrameTests.cpp)
ADD_EXECUTABLE(CalypLibCatch2Tests ${Calyp_Lib_Catch2_Tests_SRCS})
TARGET_LINK_LIBRARIES(CalypLibCatch2Tests ${PROJECT_LIBRARY} Catch2::Catch2)
INCLUDE(CTest)
+39
View File
@@ -0,0 +1,39 @@
/* This file is a part of plaYUVer 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 CalypFrameTests.cpp
* \brief CalypFrame general tests
*/
#define CATCH_CONFIG_MAIN
#include <catch2/catch.hpp>
#include "CalypFrame.h"
TEST_CASE( "create a 256x128 frame in YUV420 format", "CalypFrame" )
{
// Constructor: CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel = 8 );
CalypFrame testFrame( 256, 128, CLP_YUV420P, 8 );
REQUIRE( testFrame.getWidth() == 256 );
REQUIRE( testFrame.getHeight() == 128 );
REQUIRE( testFrame.getPelFormat() == CLP_YUV420P );
REQUIRE( testFrame.getBitsPel() == 8 );
}
+1
View File
@@ -45,6 +45,7 @@ EightBitsSampling::EightBitsSampling()
bool EightBitsSampling::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_iBitSifting = int( apcFrameList[0]->getBitsPel() ) - m_iNumberOfBits;
if( !m_iBitSifting )
return false;
+3
View File
@@ -71,6 +71,7 @@ FilterComponentLuma::FilterComponentLuma()
bool FilterComponentLuma::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
return createFilter( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), apcFrameList[0]->getBitsPel() );
}
@@ -88,6 +89,7 @@ FilterComponentChromaU::FilterComponentChromaU()
bool FilterComponentChromaU::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
if( apcFrameList[0]->getNumberChannels() > 1 )
{
return createFilter( apcFrameList[0]->getWidth( CLP_CHROMA_U ), apcFrameList[0]->getHeight( CLP_CHROMA_U ),
@@ -111,6 +113,7 @@ FilterComponentChromaV::FilterComponentChromaV()
bool FilterComponentChromaV::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
if( apcFrameList[0]->getNumberChannels() > 1 )
{
return createFilter( apcFrameList[0]->getWidth( CLP_CHROMA_V ), apcFrameList[0]->getHeight( CLP_CHROMA_V ),
+1
View File
@@ -57,6 +57,7 @@ FrameResampling::FrameResampling()
bool FrameResampling::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
switch( m_iInterpolation )
{
case 2:
+1
View File
@@ -62,6 +62,7 @@ HEVCIntraPrediction::HEVCIntraPrediction()
bool HEVCIntraPrediction::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
m_pcPredBlock = NULL;
m_pcPredBlock = new CalypFrame( m_iBlockSize * 2 + 1, m_iBlockSize * 2 + 1, CLP_GRAY, apcFrameList[0]->getBitsPel() );
+9 -2
View File
@@ -43,7 +43,9 @@ ThreeSixtyFaceConcatenation::ThreeSixtyFaceConcatenation()
m_pchModuleName = "ThreeSixtyFaceConcatenation";
m_pchModuleTooltip = "Concatenate 360 video faces";
m_uiNumberOfFrames = 1;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY | CLP_MODULES_VARIABLE_NUM_FRAMES;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY |
CLP_MODULE_REQUIRES_OPTIONS |
CLP_MODULES_VARIABLE_NUM_FRAMES;
m_cModuleOptions.addOptions() /**/
( "projection", m_uiProjectionType, "Projection [1] \n 1: Cubemap (6 faces)" ) /**/
@@ -60,6 +62,8 @@ ThreeSixtyFaceConcatenation::ThreeSixtyFaceConcatenation()
bool ThreeSixtyFaceConcatenation::create( std::vector<CalypFrame*> apcFrameList )
{
if( apcFrameList.size() < 1 )
return false;
for( unsigned int i = 0; i < apcFrameList.size(); i++ )
if( !apcFrameList[i] )
return false;
@@ -77,9 +81,12 @@ bool ThreeSixtyFaceConcatenation::create( std::vector<CalypFrame*> apcFrameList
m_uiFacesY = 2 * m_uiNumberOfPartitionsPerFace;
break;
default:
assert( 0 );
return false;
}
if( apcFrameList.size() != m_uiFacesX * m_uiFacesY )
return false;
unsigned int width = apcFrameList[0]->getWidth() * m_uiFacesX;
unsigned int height = apcFrameList[0]->getHeight() * m_uiFacesY;
+6
View File
@@ -11,4 +11,10 @@ FOREACH(module ${MODULES_LIST_NAME})
TARGET_COMPILE_DEFINITIONS(TestModuleCreate_${module} PUBLIC -DCALYP_TEST_MODULE_NAME=\"${module}\")
TARGET_LINK_LIBRARIES(TestModuleCreate_${module} ${PROJECT_LIBRARY} CalypModules gtest gtest_main)
ADD_TEST(TestModuleCreate_${module} TestModuleCreate_${module})
ADD_EXECUTABLE(TestModuleProcessNumberOfFrames_${module} TestModuleProcessNumberOfFrames.cpp)
TARGET_COMPILE_DEFINITIONS(TestModuleProcessNumberOfFrames_${module} PUBLIC -DCALYP_TEST_MODULE_NAME=\"${module}\")
TARGET_LINK_LIBRARIES(TestModuleProcessNumberOfFrames_${module} ${PROJECT_LIBRARY} CalypModules gtest gtest_main)
ADD_TEST(TestModuleProcessNumberOfFrames_${module} TestModuleProcessNumberOfFrames_${module})
ENDFOREACH(module ${MODULES_LIST_NAME})
+74 -97
View File
@@ -19,13 +19,14 @@
/**
* \file TestModuleCreate.cpp
* \brief CalypModuleIf testing for YUV420p sequences
* \brief CalypModuleIf testing create
*/
#include "CalypFrame.h"
#include "CalypModulesFactory.h"
#include "CalypStream.h"
#include "gtest/gtest.h"
#include "lib/CalypFrame.h"
#include "lib/CalypModuleIf.h"
#include "lib/CalypStream.h"
#include "modules/CalypModulesFactory.h"
class TestModuleCreate : public ::testing::Test
{
@@ -35,6 +36,8 @@ protected:
// Can be omitted if not needed.
static void SetUpTestCase()
{
ClpString moduleName = CALYP_TEST_MODULE_NAME;
pcStream = new CalypStream;
pcStream->open( ClpString( CALYP_TEST_DATA_DIR ) + ClpString( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8,
CLP_BIG_ENDIAN, 1, true );
@@ -50,66 +53,65 @@ protected:
pcStream = NULL;
}
// Some expensive resource shared by all tests.
static CalypStream* pcStream;
static CalypFrame* pcFrame;
static CalypModuleIf* pcModule;
static ClpString sModuleName;
};
CalypStream* TestModuleCreate::pcStream = NULL;
CalypFrame* TestModuleCreate::pcFrame = NULL;
ClpString TestModuleCreate::sModuleName = CALYP_TEST_MODULE_NAME;
TEST_F( TestModuleCreate, FIND_MODULE )
{
CalypModuleIf* module;
CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap();
CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin();
for( unsigned int i = 0; it != moduleFactoryMap.end(); ++it, i++ )
// Called before each test
void SetUp()
{
if( strcmp( it->first, sModuleName.c_str() ) == 0 )
ClpString moduleName = CALYP_TEST_MODULE_NAME;
CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap();
CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin();
for( unsigned int i = 0; it != moduleFactoryMap.end(); ++it, i++ )
{
module = it->second();
break;
if( strcmp( it->first, moduleName.c_str() ) == 0 )
{
pcModule = it->second();
break;
}
}
}
EXPECT_NE( module, nullptr );
module->Delete();
void TearDown()
{
pcModule->Delete();
}
CalypModuleIf* pcModule;
// Some expensive resource shared by all tests.
static CalypStream* pcStream;
};
CalypStream* TestModuleCreate::pcStream = NULL;
TEST_F( TestModuleCreate, FIND_MODULE )
{
EXPECT_NE( pcModule, nullptr );
}
TEST_F( TestModuleCreate, CREATE_OK )
{
CalypModuleIf* module;
CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap();
CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin();
for( unsigned int i = 0; it != moduleFactoryMap.end(); ++it, i++ )
bool moduleRequireOptions = false;
if( pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_OPTIONS )
{
if( strcmp( it->first, sModuleName.c_str() ) == 0 )
{
module = it->second();
break;
}
moduleRequireOptions = true;
}
EXPECT_NE( module, nullptr );
bool moduleCreated = false;
std::vector<CalypFrame*> apcFrameList;
apcFrameList.clear();
for( unsigned int i = 0; i < module->m_uiNumberOfFrames; i++ )
for( unsigned int i = 0; i < pcModule->m_uiNumberOfFrames; i++ )
{
apcFrameList.push_back( pcStream->getCurrFrame() );
pcStream->setNextFrame();
pcStream->readNextFrame();
}
if( module->m_iModuleAPI >= CLP_MODULE_API_2 )
if( pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
{
moduleCreated = module->create( apcFrameList );
moduleCreated = pcModule->create( apcFrameList ) | moduleRequireOptions;
}
else if( module->m_iModuleAPI == CLP_MODULE_API_1 )
else if( pcModule->m_iModuleAPI == CLP_MODULE_API_1 )
{
module->create( pcStream->getCurrFrame() );
pcModule->create( pcStream->getCurrFrame() );
moduleCreated = true;
}
EXPECT_EQ( moduleCreated, true );
@@ -117,72 +119,47 @@ TEST_F( TestModuleCreate, CREATE_OK )
TEST_F( TestModuleCreate, CREATE_FAIL_LESS_ONE )
{
CalypModuleIf* module;
CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap();
CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin();
for( unsigned int i = 0; it != moduleFactoryMap.end(); ++it, i++ )
if( pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
{
if( strcmp( it->first, sModuleName.c_str() ) == 0 )
std::vector<CalypFrame*> apcFrameList;
apcFrameList.clear();
for( unsigned int i = 0; i < pcModule->m_uiNumberOfFrames - 1; i++ )
{
module = it->second();
break;
apcFrameList.push_back( pcStream->getCurrFrame() );
pcStream->setNextFrame();
pcStream->readNextFrame();
}
bool moduleCreated = pcModule->create( apcFrameList );
EXPECT_NE( moduleCreated, true );
}
EXPECT_NE( module, nullptr );
bool moduleCreated = false;
std::vector<CalypFrame*> apcFrameList;
apcFrameList.clear();
for( unsigned int i = 0; i < module->m_uiNumberOfFrames - 1; i++ )
{
apcFrameList.push_back( pcStream->getCurrFrame() );
pcStream->setNextFrame();
pcStream->readNextFrame();
}
if( module->m_iModuleAPI >= CLP_MODULE_API_2 )
{
moduleCreated = module->create( apcFrameList );
}
else if( module->m_iModuleAPI == CLP_MODULE_API_1 )
{
module->create( pcStream->getCurrFrame() );
moduleCreated = true;
}
EXPECT_NE( moduleCreated, true );
}
TEST_F( TestModuleCreate, CREATE_FAIL_PLUS_ONE )
{
CalypModuleIf* module;
CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap();
CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin();
for( unsigned int i = 0; it != moduleFactoryMap.end(); ++it, i++ )
if( pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
{
if( strcmp( it->first, sModuleName.c_str() ) == 0 )
std::vector<CalypFrame*> apcFrameList;
apcFrameList.clear();
for( unsigned int i = 0; i < pcModule->m_uiNumberOfFrames + 1; i++ )
{
module = it->second();
break;
apcFrameList.push_back( NULL );
}
bool moduleCreated = pcModule->create( apcFrameList );
EXPECT_NE( moduleCreated, true );
}
}
TEST_F( TestModuleCreate, CREATE_FAIL_NULL_FRAME )
{
if( pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
{
std::vector<CalypFrame*> apcFrameList;
apcFrameList.clear();
for( unsigned int i = 0; i < pcModule->m_uiNumberOfFrames - 1; i++ )
{
apcFrameList.push_back( NULL );
}
bool moduleCreated = pcModule->create( apcFrameList );
EXPECT_NE( moduleCreated, true );
}
EXPECT_NE( module, nullptr );
bool moduleCreated = false;
std::vector<CalypFrame*> apcFrameList;
apcFrameList.clear();
for( unsigned int i = 0; i < module->m_uiNumberOfFrames + 1; i++ )
{
apcFrameList.push_back( pcStream->getCurrFrame() );
pcStream->setNextFrame();
pcStream->readNextFrame();
}
if( module->m_iModuleAPI >= CLP_MODULE_API_2 )
{
moduleCreated = module->create( apcFrameList );
}
else if( module->m_iModuleAPI == CLP_MODULE_API_1 )
{
module->create( pcStream->getCurrFrame() );
moduleCreated = true;
}
EXPECT_NE( moduleCreated, true );
}
@@ -0,0 +1,110 @@
/* This file is a part of plaYUVer 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 TestModuleCreate.cpp
* \brief CalypModuleIf testing for YUV420p sequences
*/
#include "gtest/gtest.h"
#include "lib/CalypFrame.h"
#include "lib/CalypModuleIf.h"
#include "lib/CalypStream.h"
#include "modules/CalypModulesFactory.h"
class TestModuleProcessNumberOfFrames : public ::testing::Test
{
protected:
// Per-test-case set-up.
// Called before the first test in this test case.
// Can be omitted if not needed.
static void SetUpTestCase()
{
ClpString moduleName = CALYP_TEST_MODULE_NAME;
pcStream = new CalypStream;
pcStream->open( ClpString( CALYP_TEST_DATA_DIR ) + ClpString( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8,
CLP_BIG_ENDIAN, 1, true );
}
// Per-test-case tear-down.
// Called after the last test in this test case.
// Can be omitted if not needed.
static void TearDownTestCase()
{
pcStream->close();
delete pcStream;
pcStream = NULL;
}
// Called before each test
void SetUp()
{
ClpString moduleName = CALYP_TEST_MODULE_NAME;
pcStream = new CalypStream;
pcStream->open( ClpString( CALYP_TEST_DATA_DIR ) + ClpString( "/BasketballDrill_F10_832x480_yuv420p.yuv" ), 832, 480, 0, 8,
CLP_BIG_ENDIAN, 1, true );
CalypModulesFactoryMap& moduleFactoryMap = CalypModulesFactory::Get()->getMap();
CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin();
for( unsigned int i = 0; it != moduleFactoryMap.end(); ++it, i++ )
{
if( strcmp( it->first, moduleName.c_str() ) == 0 )
{
pcModule = it->second();
break;
}
}
}
void TearDown()
{
pcModule->Delete();
}
CalypModuleIf* pcModule;
// Some expensive resource shared by all tests.
static CalypStream* pcStream;
};
CalypStream* TestModuleProcessNumberOfFrames::pcStream = NULL;
TEST_F( TestModuleProcessNumberOfFrames, PROCESS_OK )
{
if( pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
{
std::vector<CalypFrame*> apcFrameList;
apcFrameList.clear();
for( unsigned int i = 0; i < pcModule->m_uiNumberOfFrames; i++ )
{
apcFrameList.push_back( pcStream->getCurrFrame() );
pcStream->setNextFrame();
pcStream->readNextFrame();
}
// Let's not test the modules that are not able to be created
if( pcModule->create( apcFrameList ) )
{
CalypFrame* frame = pcModule->process( apcFrameList );
EXPECT_NE( frame, nullptr );
}
}
}
-10
View File
@@ -1,10 +0,0 @@
#!/usr/bin/env bash
git checkout upstream
git pull https://github.com/pixlra/calyp.git master
git push origin upstream
git checkout master
git pull origin master
git merge upstream
git push origin master