184 changed files with 3402 additions and 6022 deletions

No files matched your search

+5 -6
View File
@@ -4,7 +4,7 @@ platform:
- x64 - x64
environment: environment:
access_token: access_token:
secure: SMxOWNKN0RkPvICWhIet2FJM5g/zx5mguM/XAPjM2OrC3U2/LAqcBZw0veS9peS4 secure: WAV5LfCSAtwE1JuZh4HrDlxOOClimLoslYAJlf5KRgc3f7WIkX591PrSSua/Zo2C
clone_folder: C:\Projects\calyp clone_folder: C:\Projects\calyp
@@ -17,22 +17,21 @@ init:
install: install:
- '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64' - '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64'
#- '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64'
- choco install nsis - choco install nsis
- choco install opencv - choco install opencv
- 'C:\Tools\opencv\build\setup_vars_opencv4.cmd' - 'C:\Tools\opencv\build\setup_vars_opencv4.cmd'
- cd C:\Projects - cd C:\Projects
- ps: Start-FileDownload 'https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z' ffmpeg.7z - ps: Start-FileDownload 'https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-4.1.1-win64-dev.zip'
- 7z x ffmpeg.7z -y -offmpeg - 7z x ffmpeg-4.1.1-win64-dev.zip -y
- git clone https://github.com/pixlra/calyp-deployment.git - 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: build_script:
- mv C:\Projects\calyp C:\Projects\calyp-deployment\cmake-helper\ - mv C:\Projects\calyp C:\Projects\calyp-deployment\cmake-helper\
- mkdir C:\Projects\calyp-build - mkdir C:\Projects\calyp-build
- cd 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 -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 -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-4.1.1-win64-dev/lib/avformat.lib -DAVFORMAT_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -DAVCODEC_LIBRARIES=C:/Projects/ffmpeg-4.1.1-win64-dev/lib/avcodec.lib -DAVCODEC_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -DAVUTIL_LIBRARIES=C:/Projects/ffmpeg-4.1.1-win64-dev/lib/avutil.lib -DAVUTIL_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -DSWSCALE_LIBRARIES=C:/Projects/ffmpeg-4.1.1-win64-dev/lib/swscale.lib -DSWSCALE_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/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 ALL_BUILD -- /p:Configuration=Release > log_build
- cmake --build . --target INSTALL -- /p:Configuration=Release > log_install - cmake --build . --target INSTALL -- /p:Configuration=Release > log_install
- cmake --build . --target PACKAGE -- /p:Configuration=Release > log_pkg - cmake --build . --target PACKAGE -- /p:Configuration=Release > log_pkg
-117
View File
@@ -1,117 +0,0 @@
# ----------------------------------
# Options affecting listfile parsing
# ----------------------------------
with section("parse"):
# Specify structure for custom cmake functions
additional_commands = { 'foo': { 'flags': ['BAR', 'BAZ'],
'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}}
## Override configurations per-command where available
#override_spec = {}
# Specify variable tags.
vartags = []
# Specify property tags.
proptags = []
# -----------------------------
# Options affecting formatting.
# -----------------------------
with section("format"):
# How wide to allow formatted cmake files
line_width = 150
# How many spaces to tab for indent
tab_size = 2
# If an argument group contains more than this many sub-groups (parg or kwarg
# groups) then force it to a vertical layout.
max_subgroups_hwrap = 2
# If a positional argument group contains more than this many arguments, then
# force it to a vertical layout.
max_pargs_hwrap = 6
dangle_parens = True
# Format command names consistently as 'lower' or 'upper' case
command_case = 'upper'
# Format keywords consistently as 'lower' or 'upper' case
keyword_case = 'upper'
# ----------------------------
# Options affecting the linter
# ----------------------------
with section("lint"):
# a list of lint codes to disable
disabled_codes = ["C0103"]
# regular expression pattern describing valid function names
function_pattern = '[0-9a-z_]+'
# regular expression pattern describing valid macro names
macro_pattern = '[0-9A-Z_]+'
# regular expression pattern describing valid names for variables with global
# (cache) scope
global_var_pattern = '[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for variables with global
# scope (but internal semantic)
internal_var_pattern = '_[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for variables with local
# scope
local_var_pattern = '[a-z][a-z0-9_]+'
# regular expression pattern describing valid names for privatedirectory
# variables
private_var_pattern = '_[0-9a-z_]+'
# regular expression pattern describing valid names for public directory
# variables
public_var_pattern = '[A-Z][0-9A-Z_]+'
# regular expression pattern describing valid names for function/macro
# arguments and loop variables.
argument_var_pattern = '[a-z][a-z0-9_]+'
# regular expression pattern describing valid names for keywords used in
# functions or macros
keyword_pattern = '[A-Z][0-9A-Z_]+'
# In the heuristic for C0201, how many conditionals to match within a loop in
# before considering the loop a parser.
max_conditionals_custom_parser = 2
# Require at least this many newlines between statements
min_statement_spacing = 1
# Require no more than this many newlines between statements
max_statement_spacing = 2
max_returns = 6
max_branches = 12
max_arguments = 5
max_localvars = 15
max_statements = 50
# -------------------------------
# Options affecting file encoding
# -------------------------------
with section("encode"):
# If true, emit the unicode byte-order mark (BOM) at the start of the file
emit_byteorder_mark = False
# Specify the encoding of the input file. Defaults to utf-8
input_encoding = 'utf-8'
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake
# only claims to support utf-8 so be careful when using anything else
output_encoding = 'utf-8'
-31
View File
@@ -1,31 +0,0 @@
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
+1 -12
View File
@@ -4,8 +4,6 @@
### C++ ### ### C++ ###
# Prerequisites # Prerequisites
*.d *.d
# Clang
.cache/
# Compiled Object files # Compiled Object files
*.slo *.slo
@@ -76,7 +74,6 @@
# CMake # CMake
bin/ bin/
build/ build/
build-*
cmake-build-*/ cmake-build-*/
# Mongo Explorer plugin # Mongo Explorer plugin
@@ -135,12 +132,4 @@ fabric.properties
# .nfs files are created when an open file is removed but is still being accessed # .nfs files are created when an open file is removed but is still being accessed
.nfs* .nfs*
### vscode ### # End of https://www.gitignore.io/api/c++,clion,linux
.vscode/*
*.code-workspace
# Documentation
doc/
# CLang
compile_commands.json
+2
View File
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/calyp.iml" filepath="$PROJECT_DIR$/.idea/calyp.iml" />
</modules>
</component>
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
-29
View File
@@ -1,29 +0,0 @@
fail_fast: false
repos:
- repo: https://github.com/cheshirekow/cmake-format-precommit
rev: v0.6.10
hooks:
- id: cmake-format
- id: cmake-lint
- repo: https://github.com/pocc/pre-commit-hooks
rev: v1.1.1
hooks:
- id: clang-format
args: [--style=file, -i]
- repo: local
hooks:
- id: cmake-configure
name: Cmake Configure
entry: cmake -B build
pass_filenames: false
language: system
- id: cmake-build
name: Cmake Build
entry: cmake --build build
pass_filenames: false
language: system
+1 -1
View File
@@ -2,6 +2,6 @@ language: cpp
dist: xenial dist: xenial
before_install: before_install:
- sudo apt-get -qq update - 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 libgtest-dev - sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev libopencv-contrib-dev
script: script:
- mkdir -p build && cd build && cmake .. && make && cd .. - mkdir -p build && cd build && cmake .. && make && cd ..
+86 -123
View File
@@ -1,54 +1,40 @@
# ###
# CMakeLists for calyp ### CMakeLists for calyp
# ###
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.0) cmake_minimum_required( VERSION 3.2.0 )
# #################################################################################################################################################### ######################################################################################
# Project Definition
# ####################################################################################################################################################
SET(PROJECT_NAME
"calyp"
CACHE INTERNAL "" FORCE
)
SET(PROJECT_LIBRARY
"Calyp"
CACHE INTERNAL "" FORCE
)
SET(CALYP_VERSION_MAJOR "1")
SET(CALYP_VERSION_MINOR "2")
SET(CALYP_VERSION_PATCH "1")
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 # CMake functions
# #################################################################################################################################################### ######################################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
INCLUDE( cmake/ModulesFct.cmake ) INCLUDE( cmake/ModulesFct.cmake )
INCLUDE(FeatureSummary) INCLUDE(FeatureSummary)
INCLUDE(GNUInstallDirs) INCLUDE(GNUInstallDirs)
# #################################################################################################################################################### ######################################################################################
# Project Definition
######################################################################################
SET( PROJECT_NAME "calyp" CACHE INTERNAL "" FORCE )
SET( PROJECT_LIBRARY "Calyp" CACHE INTERNAL "" FORCE )
PROJECT( ${PROJECT_NAME} )
SET( CALYP_VERSION_MAJOR "1" )
SET( CALYP_VERSION_MINOR "1" )
SET( CALYP_VERSION_PATCH "0" )
SET( CALYP_VERSION "${CALYP_VERSION_MAJOR}.${CALYP_VERSION_MINOR}.${CALYP_VERSION_PATCH}" CACHE INTERNAL "" FORCE )
######################################################################################
# Variables # Variables
# #################################################################################################################################################### ######################################################################################
OPTION( BUILD_APP "Build GUI Application" ON ) OPTION( BUILD_APP "Build GUI Application" ON )
OPTION( BUILD_TOOLS "Build Command Line Application" ON ) OPTION( BUILD_TOOLS "Build Command Line Application" ON )
OPTION( BUILD_EXAMPLES "Build Examples" OFF ) OPTION( BUILD_EXAMPLES "Build Examples" OFF )
OPTION( BUILD_DOC "Build Documentation" OFF ) OPTION( BUILD_DOC "Build Documentation" OFF )
OPTION( BUILD_TESTS "Build Google Tests" OFF ) OPTION( BUILD_TESTS "Build Google Tests" OFF )
OPTION(BUILD_TESTS_CATCH2 "Build Catch2 Tests" OFF)
OPTION( USE_FERVOR "Add Fervor support" OFF ) OPTION( USE_FERVOR "Add Fervor support" OFF )
@@ -57,60 +43,55 @@ OPTION(USE_SSE "Build with SSE support" OFF)
OPTION( USE_WERROR "Warnings as errors" OFF ) OPTION( USE_WERROR "Warnings as errors" OFF )
OPTION( USE_STATIC "Use static libs" OFF ) OPTION( USE_STATIC "Use static libs" OFF )
# ####################################################################################################################################################
######################################################################################
# Release configuration # Release configuration
# #################################################################################################################################################### ######################################################################################
# To be switched on when releasing. # To be switched on when releasing.
OPTION(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" ON) OPTION(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" ON)
# Get current version. # Get current version.
SET(CALYP_VERSION_STRING "${CALYP_VERSION}") set(CALYP_VERSION_STRING "${CALYP_VERSION}")
IF(NOT RELEASE_BUILD AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git) if(NOT RELEASE_BUILD AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
# Probably a Git workspace; determine the revision. # Probably a Git workspace; determine the revision.
FIND_PACKAGE(Git QUIET) FIND_PACKAGE(Git QUIET)
IF(GIT_FOUND) if(GIT_FOUND)
EXEC_PROGRAM( exec_program(${GIT_EXECUTABLE}
${GIT_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
ARGS "describe --tags" ARGS "describe --tags"
OUTPUT_VARIABLE CALYP_GIT_REVISION OUTPUT_VARIABLE CALYP_GIT_REVISION
RETURN_VALUE TAG_RESULT RETURN_VALUE TAG_RESULT
) )
# git describe --tags failed; maybe the repository was checked with depth=1. # git describe --tags failed; maybe the repository was checked with depth=1.
IF(NOT ${TAG_RESULT} EQUAL 0) if(NOT ${TAG_RESULT} EQUAL 0)
EXEC_PROGRAM( exec_program(${GIT_EXECUTABLE}
${GIT_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
ARGS "describe --always" ARGS "describe --always"
OUTPUT_VARIABLE CALYP_GIT_REVISION OUTPUT_VARIABLE CALYP_GIT_REVISION
) )
ENDIF() endif()
MESSAGE(STATUS "Calyp Git revision: ${CALYP_GIT_REVISION}") message(STATUS "Calyp Git revision: ${CALYP_GIT_REVISION}")
SET(CALYP_VERSION_STRING "${CALYP_VERSION} (rev. ${CALYP_GIT_REVISION})") set(CALYP_VERSION_STRING "${CALYP_VERSION} (rev. ${CALYP_GIT_REVISION})")
ELSE() else()
MESSAGE(STATUS "Calyp Git revision could not be determined") message(STATUS "Calyp Git revision could not be determined")
ENDIF() endif()
ENDIF() endif()
SET(UPDATE_CHANNEL SET(UPDATE_CHANNEL "stable" CACHE STRING "Update channel" )
"stable"
CACHE STRING "Update channel"
)
# CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/CalypUpdate.xml.in ${CMAKE_CURRENT_BINARY_DIR}/CalypUpdate-${UPDATE_CHANNEL}.xml ) # CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/CalypUpdate.xml.in ${CMAKE_CURRENT_BINARY_DIR}/CalypUpdate-${UPDATE_CHANNEL}.xml )
# ####################################################################################################################################################
######################################################################################
# Dependencies # Dependencies
# #################################################################################################################################################### ######################################################################################
IF( BUILD_DOC ) IF( BUILD_DOC )
FIND_PACKAGE(Doxygen) FIND_PACKAGE(Doxygen)
SET( BUILD_DOC ${Doxygen_FOUND} ) SET( BUILD_DOC ${Doxygen_FOUND} )
ENDIF() ENDIF()
SET_PACKAGE_PROPERTIES( SET_PACKAGE_PROPERTIES(Doxygen PROPERTIES URL "http://www.doxygen.org/" DESCRIPTION "Doxygen" TYPE OPTIONAL)
Doxygen PROPERTIES
URL "http://www.doxygen.org/"
DESCRIPTION "Doxygen"
TYPE OPTIONAL
)
IF( BUILD_TESTS ) IF( BUILD_TESTS )
FIND_PACKAGE(GTest) FIND_PACKAGE(GTest)
@@ -119,28 +100,6 @@ IF(BUILD_TESTS)
ENABLE_TESTING() ENABLE_TESTING()
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
ENDIF() ENDIF()
SET(CALYP_TEST_DATA_DIR
"CALYP_TEST_DATA_DIR"
CACHE PATH "Location of video information for testing"
)
ENDIF()
IF(BUILD_TESTS_CATCH2)
INCLUDE(FetchContent)
FETCHCONTENT_DECLARE(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v2.13.1
)
FETCHCONTENT_MAKEAVAILABLE(Catch2)
SET_PACKAGE_PROPERTIES(
Catch2 PROPERTIES
URL "https://github.com/catchorg/Catch2"
DESCRIPTION "Catch2 unit tests"
TYPE OPTIONAL
)
INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/_deps/catch2-src/contrib/Catch.cmake)
ENABLE_TESTING()
ENDIF() ENDIF()
OPTION( USE_OPENCV "Add OpenCV support" ON ) OPTION( USE_OPENCV "Add OpenCV support" ON )
@@ -161,42 +120,42 @@ IF(USE_OPENCV)
SET(USE_OPENCV FALSE ) SET(USE_OPENCV FALSE )
ENDIF() ENDIF()
ENDIF() ENDIF()
SET_PACKAGE_PROPERTIES( SET_PACKAGE_PROPERTIES(OpenCV PROPERTIES URL "http://opencv.willowgarage.com" DESCRIPTION "OpenCV library support in CalypFrame" TYPE OPTIONAL)
OpenCV PROPERTIES
URL "http://opencv.willowgarage.com"
DESCRIPTION "OpenCV library support in CalypFrame"
TYPE OPTIONAL
)
OPTION( USE_FFMPEG "Add FFMPEG support" ON ) OPTION( USE_FFMPEG "Add FFMPEG support" ON )
IF( USE_FFMPEG ) IF( USE_FFMPEG )
FIND_PACKAGE( FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE ) 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}) SET(USE_FFMPEG ${FFMPEG_FOUND})
ENDIF() ENDIF()
SET_PACKAGE_PROPERTIES( SET_PACKAGE_PROPERTIES(FFmpeg PROPERTIES URL "http://ffmpeg.org/" DESCRIPTION "Libav library support in CalypStream" TYPE OPTIONAL)
FFmpeg PROPERTIES
URL "http://ffmpeg.org/" OPTION( USE_PYTHON "Add Python support" ON )
DESCRIPTION "Libav library support in CalypStream" IF( USE_PYTHON )
TYPE OPTIONAL #FIND_PACKAGE(Python2 REQUIRED COMPONENTS Development NumPy)
) FIND_PACKAGE(Python3 REQUIRED COMPONENTS Development NumPy)
LIST(APPEND PYTHON_LINKER_LIBRARIES Python3::Python Python3::NumPy )
ENDIF()
SET_PACKAGE_PROPERTIES(Python PROPERTIES URL "http://ffmpeg.org/" DESCRIPTION "Python support in Calyp modules" TYPE OPTIONAL)
IF( WIN32 ) IF( WIN32 )
SET( USE_STATIC ON ) SET( USE_STATIC ON )
INCLUDE( cmake/Win32.cmake ) INCLUDE( cmake/Win32.cmake )
ENDIF() ENDIF()
# ####################################################################################################################################################
######################################################################################
# CMake Defin1itions # CMake Defin1itions
# #################################################################################################################################################### ######################################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake ) SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
INCLUDE(FeatureSummary) INCLUDE(FeatureSummary)
# must go before the project command # must go before the project command
SET(CMAKE_CONFIGURATION_TYPES SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
"Debug;Release"
CACHE STRING "Configs" FORCE
)
IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8") IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
SET_PROPERTY( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} ) SET_PROPERTY( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
ENDIF() ENDIF()
@@ -204,14 +163,14 @@ SET(CMAKE_CXX_FLAGS "")
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
# #################################################################################################################################################### ######################################################################################
# Compiler options # Compiler options
# #################################################################################################################################################### ######################################################################################
SET(CMAKE_CXX_STANDARD 14) SET(CMAKE_CXX_STANDARD 14)
IF(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
ADD_DEFINITIONS(-std=gnu++0x) ADD_DEFINITIONS(-std=gnu++0x)
ENDIF() endif()
IF (NOT CMAKE_BUILD_TYPE ) IF (NOT CMAKE_BUILD_TYPE )
MESSAGE(STATUS "No build type selected, default to Release") MESSAGE(STATUS "No build type selected, default to Release")
@@ -220,22 +179,24 @@ ENDIF()
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" ) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
ADD_DEFINITIONS( ADD_DEFINITIONS(-DQT_NO_CAST_TO_ASCII
-DQT_NO_CAST_TO_ASCII
#-DQT_NO_CAST_FROM_ASCII #-DQT_NO_CAST_FROM_ASCII
-DQT_NO_URL_CAST_FROM_STRING -DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_FROM_BYTEARRAY
# -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_USE_QSTRINGBUILDER #-DQT_NO_SIGNALS_SLOTS_KEYWORDS
#-DQT_USE_QSTRINGBUILDER
) )
# if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") endif() # if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
# endif()
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op" )
ENDIF() endif()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" )
ENDIF() endif()
IF( USE_WERROR ) IF( USE_WERROR )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" ) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" )
@@ -244,9 +205,10 @@ ENDIF()
SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0" ) SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0" )
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2" ) SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2" )
# ####################################################################################################################################################
######################################################################################
# Configure targets # Configure targets
# #################################################################################################################################################### ######################################################################################
ADD_FEATURE_INFO(CalypApp BUILD_APP "Build Graphical interface") ADD_FEATURE_INFO(CalypApp BUILD_APP "Build Graphical interface")
ADD_FEATURE_INFO(CalypTools BUILD_TOOLS "Build Command line tool" ) ADD_FEATURE_INFO(CalypTools BUILD_TOOLS "Build Command line tool" )
@@ -269,11 +231,12 @@ IF(${BUILD_EXAMPLES})
ADD_SUBDIRECTORY( examples ) ADD_SUBDIRECTORY( examples )
ENDIF() ENDIF()
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h ) CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h )
# #################################################################################################################################################### ######################################################################################
# Final information dump # Final information dump
# #################################################################################################################################################### ######################################################################################
MESSAGE("") MESSAGE("")
MESSAGE( STATUS "${PROJECT_NAME} INFORMATION" ) MESSAGE( STATUS "${PROJECT_NAME} INFORMATION" )
MESSAGE( STATUS "Version: " "${CALYP_VERSION_STRING}" ) MESSAGE( STATUS "Version: " "${CALYP_VERSION_STRING}" )
+36 -12
View File
@@ -27,21 +27,19 @@ Modules
Supported Quality Metrics Supported Quality Metrics
---------------------------------------------------------------- ----------------------------------------------------------------
- Peak Signal-to-Noise Ratio (PSNR) - PSNR
- Structural SIMilarity (SSIM) - SSIM
- Mean Square Error (MSE) - MSE
- Weighted Spherical PSNR (WS-PSNR)
Frame Processing Modules Frame Processing Modules
---------------------------------------------------------------- ----------------------------------------------------------------
- Component filtering - Component filtering
- Frame difference, crop, shift, binarization and rotation - Frame difference, crop, shift, binarization
- Sub-sampling operations - Sub-sampling operations
- Measuring modules - Measuring modules
- Modules based on opencv: - Modules based on opencv:
- Disparity estimation * Disparity estimation
- Motion estimation * Motion estimation
Supported Formats Supported Formats
---------------------------------------------------------------- ----------------------------------------------------------------
@@ -64,9 +62,35 @@ Supported Formats
Developers Developers
---------------------------------------------------------------- ----------------------------------------------------------------
- [**Joao Carreira**](https://github.com/jfmcarreira) (Founder, Main Developer) - Joao Carreira (jfmcarreira@gmail.com)
- [**Lui­s Lucas** ](https://github.com/lfrlucas) (Founder, Developer) - Lui­s Lucas (luisfrlucas@gmail.com)
- [**Joao Santos** ](https://github.com/jpataias) (Contributor)
- [**JNSFilipe** ](https://github.com/JNSFilipe) (Contributor) Builds
----------------------------------------------------------------
Download update build for windows and linux from our <a href="https://sourceforge.net/projects/playuver/">SourceForge project page</a>
Build/Install using cmake
----------------------------------------------------------------
1. The following are required for compilation:
- an ordinary C++ development environment (g++, make, C++ libraries and headers, ...)
- cmake
- a Qt development environment (libraries, headers, qmake, ...): only QtCore, QtGui and QtWidgets are required, at least in version 4
2. Optional Dependencies:
- QtDBus
- OpenCv
- FFmpeg
3. Run the following commands: (this will create an executable named calyp)
```
mkdir build
cd build
cmake -DUSE_QT4=OFF -DUSE_FFMPEG=ON -DUSE_OPENCV=ON .. (for FFmpeg and OpenCV support)
make
make install
```
*/ */
+27 -43
View File
@@ -1,11 +1,12 @@
# ###
# CMakeLists for calyp app component ### CMakeLists for calyp app component
# ###
INCLUDE_DIRECTORIES( INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/dialog ${CMAKE_CURRENT_SOURCE_DIR}/docks ${CMAKE_CURRENT_SOURCE_DIR}/external
${CMAKE_CURRENT_SOURCE_DIR}/widgets ${CMAKE_CURRENT_SOURCE_DIR}/dialog
) ${CMAKE_CURRENT_SOURCE_DIR}/docks
${CMAKE_CURRENT_SOURCE_DIR}/widgets )
OPTION( USE_QTDBUS "Build with QtDBus" ON ) OPTION( USE_QTDBUS "Build with QtDBus" ON )
OPTION( USE_FERVOR "Add Fervor support" OFF ) OPTION( USE_FERVOR "Add Fervor support" OFF )
@@ -18,23 +19,16 @@ LIST(APPEND QT_MODULES Core Gui Widgets Concurrent)
IF( USE_QTDBUS ) IF( USE_QTDBUS )
FIND_PACKAGE( Qt5DBus ) FIND_PACKAGE( Qt5DBus )
SET_PACKAGE_PROPERTIES( SET_PACKAGE_PROPERTIES(Qt5DBus PROPERTIES DESCRIPTION "Support for Qt5 DBus messages between instances" TYPE OPTIONAL )
Qt5DBus PROPERTIES
DESCRIPTION "Support for Qt5 DBus messages between instances"
TYPE OPTIONAL
)
IF( ${Qt5DBus_FOUND} ) IF( ${Qt5DBus_FOUND} )
SET( USE_QTDBUS ${Qt5DBus_FOUND} ) # TODO: fix this stupid variable SET( USE_QTDBUS ${Qt5DBus_FOUND} ) # TODO: fix this stupid variable
SET(USE_QTDBUS SET( USE_QTDBUS ${Qt5DBus_FOUND} PARENT_SCOPE)
${Qt5DBus_FOUND}
PARENT_SCOPE
)
LIST(APPEND QT_LINKER_LIBS Qt5::DBus ) LIST(APPEND QT_LINKER_LIBS Qt5::DBus )
LIST(APPEND QT_MODULES DBus ) LIST(APPEND QT_MODULES DBus )
ENDIF() ENDIF()
ENDIF() ENDIF()
SET(Calyp_App_SRCS set(Calyp_App_SRCS
# Main # Main
main.cpp main.cpp
MainWindow.cpp MainWindow.cpp
@@ -74,9 +68,13 @@ IF(USE_QTDBUS)
LIST( APPEND Calyp_App_SRCS DBusAppAdaptor.cpp ) LIST( APPEND Calyp_App_SRCS DBusAppAdaptor.cpp )
ENDIF() ENDIF()
SET(Calyp_App_UI "")
SET(Calyp_App_RCC resources/${PROJECT_NAME}.qrc) set(Calyp_App_UI "" )
set(Calyp_App_RCC
resources/${PROJECT_NAME}.qrc
)
IF( USE_FERVOR ) IF( USE_FERVOR )
@@ -110,12 +108,7 @@ IF(USE_FERVOR)
ENDIF() ENDIF()
ENDIF() ENDIF()
SET_PACKAGE_PROPERTIES( SET_PACKAGE_PROPERTIES(Fervor PROPERTIES URL "https://github.com/pypt/fervor" DESCRIPTION "Fervor lib includes check for updates feature" TYPE OPTIONAL )
Fervor PROPERTIES
URL "https://github.com/pypt/fervor"
DESCRIPTION "Fervor lib includes check for updates feature"
TYPE OPTIONAL
)
ADD_FEATURE_INFO(Fervor USE_FERVOR "Fervor lib includes check for updates feature.") ADD_FEATURE_INFO(Fervor USE_FERVOR "Fervor lib includes check for updates feature.")
QT5_WRAP_UI( Calyp_App_UI_Wrap ${Calyp_App_UI} ) QT5_WRAP_UI( Calyp_App_UI_Wrap ${Calyp_App_UI} )
@@ -126,34 +119,22 @@ SET(CMAKE_AUTOMOC ON)
# Windows application icon # Windows application icon
IF( WIN32 ) IF( WIN32 )
SET(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj) set(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj)
IF( MSVC ) IF( MSVC )
ADD_CUSTOM_COMMAND( add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
OUTPUT ${WINDOWS_RES_FILE}
COMMAND rc.exe /fo ${WINDOWS_RES_FILE} ${PROJECT_NAME}.rc COMMAND rc.exe /fo ${WINDOWS_RES_FILE} ${PROJECT_NAME}.rc
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources
COMMENT "Add icon on windows platform"
) )
ELSE() ELSE()
ADD_CUSTOM_COMMAND( add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
OUTPUT ${WINDOWS_RES_FILE}
COMMAND windres.exe ${PROJECT_NAME}.rc ${WINDOWS_RES_FILE} COMMAND windres.exe ${PROJECT_NAME}.rc ${WINDOWS_RES_FILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources
COMMENT "Add icon on windows platform"
) )
ENDIF() ENDIF()
ADD_EXECUTABLE(${PROJECT_NAME} ${Calyp_App_SRCS} ${HEADERS_MOC_FILES} ${Calyp_App_UI_Wrap} ${Calyp_App_RCC} ${WINDOWS_RES_FILE})
ELSEIF(CMAKE_HOST_APPLE)
SET(CMAKE_MACOSX_BUNDLE ON)
SET(MACOSX_BUNDLE_EXECUTABLE_NAME ${PROJECT_NAME})
SET(MACOSX_BUNDLE_ICON_FILE Contents/Resources/calyp.icns)
SET(MACOSX_BUNDLE_BUNDLE_NAME Calyp)
SET(APP_ICON_MACOSX ${CMAKE_CURRENT_SOURCE_DIR}/resources/calyp.icns)
SET_SOURCE_FILES_PROPERTIES(${APP_ICON_MACOSX} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
ADD_EXECUTABLE(${PROJECT_NAME} MACOSX_BUNDLE ${Calyp_App_SRCS} ${HEADERS_MOC_FILES} ${Calyp_App_UI_Wrap} ${Calyp_App_RCC} ${APP_ICON_MACOSX})
ELSE()
ADD_EXECUTABLE(${PROJECT_NAME} ${Calyp_App_SRCS} ${HEADERS_MOC_FILES} ${Calyp_App_UI_Wrap} ${Calyp_App_RCC})
ENDIF() ENDIF()
ADD_EXECUTABLE( ${PROJECT_NAME} ${Calyp_App_SRCS} ${HEADERS_MOC_FILES} ${Calyp_App_UI_Wrap} ${Calyp_App_RCC} ${WINDOWS_RES_FILE} )
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${PROJECT_LIBRARY} CalypModules ${APP_LINKER_LIBS} ${QT_LINKER_LIBS} QCustomPlotLib ) TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${PROJECT_LIBRARY} CalypModules ${APP_LINKER_LIBS} ${QT_LINKER_LIBS} QCustomPlotLib )
# QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} ) # QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} )
@@ -162,3 +143,6 @@ INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
INSTALL(FILES resources/calyp.desktop DESTINATION share/applications ) INSTALL(FILES resources/calyp.desktop DESTINATION share/applications )
INSTALL(FILES resources/calyp.png DESTINATION share/pixmaps ) INSTALL(FILES resources/calyp.png DESTINATION share/pixmaps )
INSTALL(FILES resources/calyp.xml DESTINATION share/mime/packages ) INSTALL(FILES resources/calyp.xml DESTINATION share/mime/packages )
+5 -5
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,12 +24,12 @@
#include "CalypAppModuleIf.h" #include "CalypAppModuleIf.h"
#include "VideoSubWindow.h"
#include <QAction> #include <QAction>
#include <QApplication> #include <QApplication>
#include <QDockWidget> #include <QDockWidget>
#include "VideoSubWindow.h"
CalypAppModuleIf::CalypAppModuleIf( QObject* parent, QAction* action, CalypModuleIf* module ) CalypAppModuleIf::CalypAppModuleIf( QObject* parent, QAction* action, CalypModuleIf* module )
: m_bIsRunning( false ) : m_bIsRunning( false )
, m_pcModuleAction( action ) , m_pcModuleAction( action )
@@ -48,7 +48,7 @@ CalypAppModuleIf::CalypAppModuleIf( QObject* parent, QAction* action, CalypModul
} }
} }
void CalypAppModuleIf::update( bool isPlaying ) void CalypAppModuleIf::update()
{ {
if( m_pcDisplaySubWindow ) if( m_pcDisplaySubWindow )
{ {
@@ -56,7 +56,7 @@ void CalypAppModuleIf::update( bool isPlaying )
} }
else else
{ {
apply( isPlaying ); apply();
} }
} }
+9 -14
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,23 +25,18 @@
#ifndef __CALYPAPPMODULESIF_H__ #ifndef __CALYPAPPMODULESIF_H__
#define __CALYPAPPMODULESIF_H__ #define __CALYPAPPMODULESIF_H__
#include "CommonDefs.h"
#include "ModuleHandleDock.h"
#include "config.h"
#include "lib/CalypFrame.h"
#include "lib/CalypModuleIf.h"
#include "lib/CalypStream.h"
#include <QEvent> #include <QEvent>
#include <QVector> #include <QVector>
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
#include "config.h"
#ifdef CALYP_THREADED_MODULES
#include <QThread>
#endif
#include "CommonDefs.h"
#include "ModuleHandleDock.h"
#include "lib/CalypFrame.h"
#include "lib/CalypModuleIf.h"
#include "lib/CalypStream.h"
class QAction; class QAction;
class QDockWidget; class QDockWidget;
@@ -106,7 +101,7 @@ public:
CalypModuleIf* getModule() { return m_pcModule; } CalypModuleIf* getModule() { return m_pcModule; }
unsigned int getModuleRequirements() { return m_pcModule->m_uiModuleRequirements; } unsigned int getModuleRequirements() { return m_pcModule->m_uiModuleRequirements; }
ClpString moduleInfo() { return m_pcModule->moduleInfo(); } ClpString moduleInfo() { return m_pcModule->moduleInfo(); }
void update( bool isPlaying ); void update();
bool apply( bool isPlaying = false, bool disableThreads = false ); bool apply( bool isPlaying = false, bool disableThreads = false );
bool isRunning(); bool isRunning();
void show(); void show();
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+5 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -71,7 +71,8 @@ void GridManager::drawGrid( QPixmap& image, const QRect& area, QPainter* painter
switch( style ) switch( style )
{ {
case intersectionDot: case intersectionDot:
case intersectionCross: { case intersectionCross:
{
painter->setPen( mainPen ); painter->setPen( mainPen );
// Draw crosses or dots on intersections // Draw crosses or dots on intersections
for( int x = offsetx; x <= area.right(); x += hSpacing ) for( int x = offsetx; x <= area.right(); x += hSpacing )
@@ -98,7 +99,8 @@ void GridManager::drawGrid( QPixmap& image, const QRect& area, QPainter* painter
} }
break; break;
} }
case Dashed: { case Dashed:
{
// Change pen to the dashed line // Change pen to the dashed line
mainPen.setStyle( Qt::DashLine ); mainPen.setStyle( Qt::DashLine );
} }
+1 -2
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -29,7 +29,6 @@
#include <QColor> #include <QColor>
#include <QPen> #include <QPen>
#include <QRect> #include <QRect>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "config.h" #include "config.h"
+11 -11
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* Joao Santos (joaompssantos@gmail.com) * Joao Santos (joaompssantos@gmail.com)
* *
@@ -25,15 +25,6 @@
#include "MainWindow.h" #include "MainWindow.h"
#include <QAction>
#include <QActionGroup>
#include <QCloseEvent>
#include <QDoubleSpinBox>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QSignalMapper>
#include <QtDebug>
#include "AboutDialog.h" #include "AboutDialog.h"
#include "ModulesHandle.h" #include "ModulesHandle.h"
#include "QualityHandle.h" #include "QualityHandle.h"
@@ -43,6 +34,15 @@
#include "VideoHandle.h" #include "VideoHandle.h"
#include "VideoSubWindow.h" #include "VideoSubWindow.h"
#include "lib/CalypOptions.h" #include "lib/CalypOptions.h"
#include <QAction>
#include <QActionGroup>
#include <QCloseEvent>
#include <QDoubleSpinBox>
#include <QDragEnterEvent>
#include <QDropEvent>
#include <QSignalMapper>
#include <QtDebug>
#ifdef USE_FERVOR #ifdef USE_FERVOR
#include "fvupdater.h" #include "fvupdater.h"
#endif #endif
@@ -101,7 +101,7 @@ bool MainWindow::parseArgs( int argc, char* argv[] )
( "size,s", strResolution, "size (WxH)" ) /**/ ( "size,s", strResolution, "size (WxH)" ) /**/
( "pel_fmt", strPelFmt, "pixel format" ); ( "pel_fmt", strPelFmt, "pixel format" );
if( pcCmdParser.parse( argc, argv ) < 0 ) if( !pcCmdParser.parse( argc, argv ) )
{ {
bRet |= true; bRet |= true;
} }
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,10 +24,10 @@
#include "MdiSubWindow.h" #include "MdiSubWindow.h"
#include <QCloseEvent>
#include "SubWindowAbstract.h" #include "SubWindowAbstract.h"
#include <QCloseEvent>
MdiSubWindow::MdiSubWindow( QWidget* parent ) MdiSubWindow::MdiSubWindow( QWidget* parent )
: QMdiSubWindow( parent ) : QMdiSubWindow( parent )
{ {
+1 -2
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -26,7 +26,6 @@
#define __MDISUBWINDOW_H_ #define __MDISUBWINDOW_H_
#include <QMdiSubWindow> #include <QMdiSubWindow>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "config.h" #include "config.h"
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+5 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,14 +24,15 @@
#ifndef __MODULESHANDLE_H__ #ifndef __MODULESHANDLE_H__
#define __MODULESHANDLE_H__ #define __MODULESHANDLE_H__
#include <QtCore> #include "config.h"
#include <QtWidgets>
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
#include <QtCore>
#include <QtWidgets>
#include "CalypAppModuleIf.h" #include "CalypAppModuleIf.h"
#include "CommonDefs.h" #include "CommonDefs.h"
#include "config.h"
#include "lib/CalypFrame.h" #include "lib/CalypFrame.h"
class VideoHandle; class VideoHandle;
+2 -6
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,10 +24,6 @@
#include "PlotSubWindow.h" #include "PlotSubWindow.h"
#include <QGuiApplication>
#include <QScreen>
#include <QSize>
#include "qcustomplot.h" #include "qcustomplot.h"
//#include "external/qcustomplot/qcustomplot.h" //#include "external/qcustomplot/qcustomplot.h"
@@ -178,7 +174,7 @@ QSize PlotSubWindow::sizeHint() const
} }
else else
{ {
maxSize = QGuiApplication::screens()[0]->availableGeometry().size(); maxSize = QApplication::desktop()->availableGeometry().size();
} }
return sizeHint( maxSize ); return sizeHint( maxSize );
} }
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,12 +25,12 @@
#ifndef __PLOTWINDOWHANDLE_H__ #ifndef __PLOTWINDOWHANDLE_H__
#define __PLOTWINDOWHANDLE_H__ #define __PLOTWINDOWHANDLE_H__
#include <QtWidgets>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "SubWindowAbstract.h" #include "SubWindowAbstract.h"
#include "config.h" #include "config.h"
#include <QtWidgets>
class QCustomPlot; class QCustomPlot;
class PlotSubWindow : public SubWindowAbstract class PlotSubWindow : public SubWindowAbstract
+4 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,16 +24,16 @@
#include "QualityHandle.h" #include "QualityHandle.h"
#include <QtGui>
#include "PlotSubWindow.h" #include "PlotSubWindow.h"
#include "ProgressBar.h" #include "ProgressBar.h"
#include "QtConcurrent/qtconcurrentrun.h"
#include "SubWindowHandle.h" #include "SubWindowHandle.h"
#include "SubWindowSelectorDialog.h" #include "SubWindowSelectorDialog.h"
#include "VideoSubWindow.h" #include "VideoSubWindow.h"
#include "lib/LibMemory.h" #include "lib/LibMemory.h"
#include <QtGui>
#include "QtConcurrent/qtconcurrentrun.h"
QualityHandle::QualityHandle( QWidget* parent, SubWindowHandle* windowManager ) QualityHandle::QualityHandle( QWidget* parent, SubWindowHandle* windowManager )
: m_pcParet( parent ), m_pcMainWindowManager( windowManager ) : m_pcParet( parent ), m_pcMainWindowManager( windowManager )
{ {
+1 -2
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -27,7 +27,6 @@
#include <QtCore> #include <QtCore>
#include <QtWidgets> #include <QtWidgets>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "QFuture" #include "QFuture"
#include "QualityMeasurementSidebar.h" #include "QualityMeasurementSidebar.h"
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,14 +24,14 @@
#include "SubWindowAbstract.h" #include "SubWindowAbstract.h"
#include "MdiSubWindow.h"
#include <QCloseEvent> #include <QCloseEvent>
#include <QFocusEvent> #include <QFocusEvent>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QIcon> #include <QIcon>
#include <QScrollBar> #include <QScrollBar>
#include "MdiSubWindow.h"
SubWindowAbstract::SubWindowAbstract( QWidget* parent, unsigned int category ) SubWindowAbstract::SubWindowAbstract( QWidget* parent, unsigned int category )
: QWidget( parent ), m_cSubWindow( NULL ) : QWidget( parent ), m_cSubWindow( NULL )
{ {
+1 -2
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -41,7 +41,6 @@
#include <QSize> #include <QSize>
#include <QString> #include <QString>
#include <QWidget> #include <QWidget>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "config.h" #include "config.h"
+10 -14
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* Joao Santos (joaompssantos@gmail.com) * Joao Santos (joaompssantos@gmail.com)
* *
@@ -25,24 +25,22 @@
#include "SubWindowHandle.h" #include "SubWindowHandle.h"
#include "MainWindow.h"
#include "MdiSubWindow.h"
#include "SubWindowAbstract.h"
#include <QAction> #include <QAction>
#include <QActionGroup> #include <QActionGroup>
#include <QApplication> #include <QApplication>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QGuiApplication>
#include <QHBoxLayout> #include <QHBoxLayout>
#include <QMdiArea> #include <QMdiArea>
#include <QMenu> #include <QMenu>
#include <QPainter> #include <QPainter>
#include <QScreen>
#include <QSettings> #include <QSettings>
#include <QSignalMapper> #include <QSignalMapper>
#include <QStyle> #include <QStyle>
#include "MainWindow.h"
#include "MdiSubWindow.h"
#include "SubWindowAbstract.h"
class MdiArea : public QMdiArea class MdiArea : public QMdiArea
{ {
public: public:
@@ -156,7 +154,7 @@ void SubWindowHandle::setWindowMode( int iWindowMode )
parentWidget()->update(); parentWidget()->update();
m_pcApp->showNormal(); m_pcApp->showNormal();
qApp->processEvents(); qApp->processEvents();
QSize screenSize = QGuiApplication::screens()[0]->availableGeometry().size(); QSize screenSize = QApplication::desktop()->availableGeometry().size();
m_pcApp->move( 0, 0 ); m_pcApp->move( 0, 0 );
m_pcApp->resize( screenSize.width(), 5 ); m_pcApp->resize( screenSize.width(), 5 );
m_pcApp->setWindowTitle( QApplication::applicationName() ); m_pcApp->setWindowTitle( QApplication::applicationName() );
@@ -232,14 +230,12 @@ void SubWindowHandle::addMdiSubWindow( SubWindowAbstract* window )
SLOT( removeMdiSubWindow( MdiSubWindow* ) ) ); SLOT( removeMdiSubWindow( MdiSubWindow* ) ) );
} }
void SubWindowHandle::addSubWindow( SubWindowAbstract* window ) void SubWindowHandle::addSubWindow( SubWindowAbstract* window, Qt::WindowFlags flags )
{ {
if( window ) if( window )
{ {
connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp, connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp, SLOT( printMessage( const QString& ) ) );
SLOT( printMessage( const QString& ) ) ); connect( window, SIGNAL( zoomFactorChanged( const double, const QPoint ) ), m_pcApp, SLOT( updateZoomFactorSBox() ) );
connect( window, SIGNAL( zoomFactorChanged( const double, const QPoint ) ), m_pcApp,
SLOT( updateZoomFactorSBox() ) );
if( m_iWindowMode == DETACHEDSUBWINDOWMODE ) if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
{ {
connect( window, SIGNAL( aboutToActivate( SubWindowAbstract* ) ), this, connect( window, SIGNAL( aboutToActivate( SubWindowAbstract* ) ), this,
@@ -382,7 +378,7 @@ void SubWindowHandle::tileSubWindows()
if( m_iWindowMode == DETACHEDSUBWINDOWMODE ) if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
{ {
QSize screenSize = QGuiApplication::screens()[0]->availableGeometry().size(); QSize screenSize = QApplication::desktop()->availableGeometry().size();
unsigned int minWindowsInRow = 1; unsigned int minWindowsInRow = 1;
while( ( screenSize.width() / minWindowsInRow ) > 500 ) while( ( screenSize.width() / minWindowsInRow ) > 500 )
{ {
+4 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,12 +25,12 @@
#ifndef __SUBWINDOWHANDLE_H__ #ifndef __SUBWINDOWHANDLE_H__
#define __SUBWINDOWHANDLE_H__ #define __SUBWINDOWHANDLE_H__
#include "CommonDefs.h"
#include <QString> #include <QString>
#include <QVector> #include <QVector>
#include <QWidget> #include <QWidget>
#include "CommonDefs.h"
class QAction; class QAction;
class QActionGroup; class QActionGroup;
class QHBoxLayout; class QHBoxLayout;
@@ -51,7 +51,7 @@ public:
void processLogMsg( const QString& msg ); void processLogMsg( const QString& msg );
void addSubWindow( SubWindowAbstract* widget ); void addSubWindow( SubWindowAbstract* widget, Qt::WindowFlags flags = 0 );
SubWindowAbstract* activeSubWindow() const; SubWindowAbstract* activeSubWindow() const;
+9 -9
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,14 +24,6 @@
#include "VideoHandle.h" #include "VideoHandle.h"
#include <QDockWidget>
#include <QElapsedTimer>
#include <QLabel>
#include <QSignalMapper>
#include <QSlider>
#include <QToolBar>
#include <QtGui>
#include "FrameNumberWidget.h" #include "FrameNumberWidget.h"
#include "FramePropertiesDock.h" #include "FramePropertiesDock.h"
#include "MainWindow.h" #include "MainWindow.h"
@@ -39,6 +31,14 @@
#include "SubWindowHandle.h" #include "SubWindowHandle.h"
#include "SubWindowSelectorDialog.h" #include "SubWindowSelectorDialog.h"
#include "VideoSubWindow.h" #include "VideoSubWindow.h"
#include <QDockWidget>
#include <QElapsedTimer>
#include <QLabel>
#include <QSignalMapper>
#include <QSlider>
#include <QToolBar>
#include <QtGui>
#if( _CONTROL_PLAYING_TIME_ == 1 ) #if( _CONTROL_PLAYING_TIME_ == 1 )
#include <QElapsedTimer> #include <QElapsedTimer>
#endif #endif
+4 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,15 +25,15 @@
#ifndef __VIDEOHANDLE_H__ #ifndef __VIDEOHANDLE_H__
#define __VIDEOHANDLE_H__ #define __VIDEOHANDLE_H__
#include "CommonDefs.h"
#include "config.h"
#include <QMenu> #include <QMenu>
#include <QPoint> #include <QPoint>
#include <QThread> #include <QThread>
#include <QVector> #include <QVector>
#include <QWidget> #include <QWidget>
#include "CommonDefs.h"
#include "config.h"
//#define _CONTROL_PLAYING_TIME_ 1 //#define _CONTROL_PLAYING_TIME_ 1
class QToolBar; class QToolBar;
+5 -26
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -23,17 +23,15 @@
*/ */
#include "VideoSubWindow.h" #include "VideoSubWindow.h"
#include <QScrollArea> #include <QScrollArea>
#include <QSettings>
#include <QStaticText> #include <QStaticText>
#include <cassert>
#include "ConfigureFormatDialog.h" #include "ConfigureFormatDialog.h"
#include "ModulesHandle.h" #include "ModulesHandle.h"
#include "QtConcurrent/qtconcurrentrun.h" #include "QtConcurrent/qtconcurrentrun.h"
#include "SubWindowAbstract.h" #include "SubWindowAbstract.h"
#include <cassert>
#define QT_NO_CONCURRENT #define QT_NO_CONCURRENT
/** /**
@@ -259,7 +257,7 @@ QSize VideoSubWindow::sizeHint() const
} }
else else
{ {
maxSize = QGuiApplication::screens()[0]->availableGeometry().size(); maxSize = QApplication::desktop()->availableGeometry().size();
} }
return sizeHint( maxSize ); return sizeHint( maxSize );
} }
@@ -315,7 +313,6 @@ bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
unsigned int Width = 0, Height = 0, BitsPel = 8, FrameRate = 30; unsigned int Width = 0, Height = 0, BitsPel = 8, FrameRate = 30;
int Endianness = CLP_LITTLE_ENDIAN; int Endianness = CLP_LITTLE_ENDIAN;
int InputFormat = CLP_YUV420P; int InputFormat = CLP_YUV420P;
QSettings appSettings;
if( m_pCurrStream ) if( m_pCurrStream )
m_pCurrStream->getFormat( Width, Height, InputFormat, BitsPel, Endianness, FrameRate ); m_pCurrStream->getFormat( Width, Height, InputFormat, BitsPel, Endianness, FrameRate );
@@ -326,16 +323,7 @@ bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
} }
bool bConfig = true; bool bConfig = true;
if( !bForceDialog ) if( !bForceDialog )
{
bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness, FrameRate ); bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness, FrameRate );
if( bConfig )
{
// Pre-load values with last opened file
Width = appSettings.value( "VideoSubWindow/LastWidth" ).value<unsigned int>();
Height = appSettings.value( "VideoSubWindow/LastHeight" ).value<unsigned int>();
BitsPel = appSettings.value( "VideoSubWindow/LastBitsPerPixel" ).value<unsigned int>();
}
}
bool bRet = false; bool bRet = false;
for( int iPass = 0; iPass < 2 && !bRet; iPass++ ) for( int iPass = 0; iPass < 2 && !bRet; iPass++ )
{ {
@@ -367,14 +355,6 @@ bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
m_sStreamInfo.m_uiFrameRate = FrameRate; m_sStreamInfo.m_uiFrameRate = FrameRate;
m_sStreamInfo.m_uiFileSize = QFileInfo( cFilename ).size(); m_sStreamInfo.m_uiFileSize = QFileInfo( cFilename ).size();
QVariant var;
var.setValue<unsigned int>( Width );
appSettings.setValue( "VideoSubWindow/LastWidth", var );
var.setValue<unsigned int>( Height );
appSettings.setValue( "VideoSubWindow/LastHeight", var );
var.setValue<unsigned int>( BitsPel );
appSettings.setValue( "VideoSubWindow/LastBitsPerPixel", var );
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
refreshFrame(); refreshFrame();
@@ -703,7 +683,6 @@ bool VideoSubWindow::hasRunningModule()
void VideoSubWindow::setFillWindow( bool bFlag ) void VideoSubWindow::setFillWindow( bool bFlag )
{ {
m_pcVideoInfo->setBusyWindow( bFlag ); m_pcVideoInfo->setBusyWindow( bFlag );
m_pcVideoInfo->repaint();
} }
void VideoSubWindow::setCurrFrame( CalypFrame* pcCurrFrame ) void VideoSubWindow::setCurrFrame( CalypFrame* pcCurrFrame )
@@ -732,7 +711,7 @@ void VideoSubWindow::refreshFrameOperation()
} }
for( int i = 0; i < m_apcCurrentModule.size(); i++ ) for( int i = 0; i < m_apcCurrentModule.size(); i++ )
{ {
m_apcCurrentModule.at( i )->update( m_bIsPlaying ); m_apcCurrentModule.at( i )->update();
} }
} }
+2 -2
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -30,7 +30,6 @@
#include <QRect> #include <QRect>
#include <QString> #include <QString>
#include <QVector> #include <QVector>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "SubWindowAbstract.h" #include "SubWindowAbstract.h"
#include "ViewArea.h" #include "ViewArea.h"
@@ -182,6 +181,7 @@ public:
QSize sizeHint( const QSize& ) const; QSize sizeHint( const QSize& ) const;
QString getCurrentFileName() { return m_cFilename; } QString getCurrentFileName() { return m_cFilename; }
bool getIsModule() { return getCategory() | SubWindowAbstract::MODULE_SUBWINDOW; }
void clearWindowBusy() { m_bWindowBusy = false; } void clearWindowBusy() { m_bWindowBusy = false; }
void setFillWindow( bool bFlag ); void setFillWindow( bool bFlag );
+13 -8
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,6 +25,8 @@
#include "ViewArea.h" #include "ViewArea.h"
#include "GridManager.h"
#include <QColor> #include <QColor>
#include <QCoreApplication> #include <QCoreApplication>
#include <QDebug> #include <QDebug>
@@ -36,9 +38,8 @@
#include <QRectF> #include <QRectF>
#include <QString> #include <QString>
#include <QWidget> #include <QWidget>
#include <cmath>
#include "GridManager.h" #include <cmath>
static const QColor selectionColor = Qt::cyan; static const QColor selectionColor = Qt::cyan;
static const QColor imageMaskColor = Qt::green; static const QColor imageMaskColor = Qt::green;
@@ -687,7 +688,8 @@ void ViewArea::paintEvent( QPaintEvent* event )
{ {
switch( tool() ) switch( tool() )
{ {
case MaskTool: { case MaskTool:
{
if( m_maskColor.isValid() ) if( m_maskColor.isValid() )
color = m_maskColor; color = m_maskColor;
else else
@@ -695,7 +697,8 @@ void ViewArea::paintEvent( QPaintEvent* event )
break; break;
} }
case EraserTool: { case EraserTool:
{
color = eraserColor; color = eraserColor;
break; break;
} }
@@ -730,7 +733,7 @@ void ViewArea::wheelEvent( QWheelEvent* event )
if( event->modifiers() & Qt::ControlModifier ) if( event->modifiers() & Qt::ControlModifier )
{ {
scale = 0.001 * event->angleDelta().y(); scale = 0.001 * event->delta();
if( scale > 0 ) if( scale > 0 )
scale = 1.25; scale = 1.25;
else else
@@ -1072,7 +1075,8 @@ void ViewArea::updateMask( const QRect& rect )
{ {
switch( tool() ) switch( tool() )
{ {
case MaskTool: { case MaskTool:
{
// Add rect to the mask // Add rect to the mask
QPainter painter( &m_mask ); QPainter painter( &m_mask );
painter.setBrush( Qt::color1 ); painter.setBrush( Qt::color1 );
@@ -1081,7 +1085,8 @@ void ViewArea::updateMask( const QRect& rect )
painter.end(); painter.end();
break; break;
} }
case EraserTool: { case EraserTool:
{
// Clears rect area in the mask // Clears rect area in the mask
QPainter painter( &m_mask ); QPainter painter( &m_mask );
painter.setBrush( Qt::color0 ); painter.setBrush( Qt::color0 );
+6 -6
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -26,17 +26,17 @@
#ifndef __VIEWAREA_H__ #ifndef __VIEWAREA_H__
#define __VIEWAREA_H__ #define __VIEWAREA_H__
#include "CommonDefs.h"
#include "GridManager.h"
#include "config.h"
#include "lib/CalypFrame.h"
#include <QBitmap> #include <QBitmap>
#include <QColor> #include <QColor>
#include <QPixmap> #include <QPixmap>
#include <QTimer> #include <QTimer>
#include <QWidget> #include <QWidget>
#include "CommonDefs.h"
#include "GridManager.h"
#include "config.h"
#include "lib/CalypFrame.h"
class CalypStream; class CalypStream;
/** /**
+6 -13
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* Joao Santos (joaompssantos@gmail.com) * Joao Santos (joaompssantos@gmail.com)
* *
@@ -27,14 +27,14 @@
#include "AboutDialog.h" #include "AboutDialog.h"
#include "config.h"
#include <QApplication> #include <QApplication>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QLabel> #include <QLabel>
#include <QTextEdit> #include <QTextEdit>
#include <QVBoxLayout> #include <QVBoxLayout>
#include "config.h"
#define TAB_FROM_SPACES "&nbsp;&nbsp;&nbsp;" #define TAB_FROM_SPACES "&nbsp;&nbsp;&nbsp;"
AboutDialog::AboutDialog( QWidget* parent ) AboutDialog::AboutDialog( QWidget* parent )
@@ -49,7 +49,7 @@ AboutDialog::AboutDialog( QWidget* parent )
.arg( QApplication::applicationVersion() ) ); .arg( QApplication::applicationVersion() ) );
label->setWordWrap( false ); label->setWordWrap( false );
QString featuresList = QStringLiteral( "<p><h4><b>Features:</b></h4><ul>" ); QString featuresList = QStringLiteral( "<p><h3><b>Features:</b></h3><ul>" );
#ifdef USE_QTDBUS #ifdef USE_QTDBUS
featuresList.append( QStringLiteral( "<li>Support for Qt DBus messages" ) ); featuresList.append( QStringLiteral( "<li>Support for Qt DBus messages" ) );
@@ -63,21 +63,14 @@ AboutDialog::AboutDialog( QWidget* parent )
featuresList.append( QStringLiteral( "</ul></p>" ) ); featuresList.append( QStringLiteral( "</ul></p>" ) );
QLabel* labelFeatures = new QLabel( featuresList ); QLabel* labelFeatures = new QLabel( featuresList );
QString thanksList = QStringLiteral( "<p><h4><b>Thanks to:</b></h4><ul>" ); QLabel* labelCopyright = new QLabel( QStringLiteral( "Copyright © 2014–2018 Joao Carreira and Luis Lucas" ) );
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; QWidget* topWidget = new QWidget;
QVBoxLayout* topLayout = new QVBoxLayout; QVBoxLayout* topLayout = new QVBoxLayout;
topLayout->addWidget( pixmapLabel, 0, Qt::AlignHCenter ); topLayout->addWidget( pixmapLabel, 0, Qt::AlignHCenter );
topLayout->addWidget( label ); topLayout->addWidget( label );
topLayout->addWidget( labelCopyright );
topLayout->addWidget( labelFeatures ); topLayout->addWidget( labelFeatures );
topLayout->addWidget( labelContributors ); topLayout->addWidget( labelCopyright );
topWidget->setLayout( topLayout ); topWidget->setLayout( topLayout );
// QTextEdit *textEdit = new QTextEdit(tr("<p>This program is free " // QTextEdit *textEdit = new QTextEdit(tr("<p>This program is free "
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,8 @@
#include "ConfigureFormatDialog.h" #include "ConfigureFormatDialog.h"
#include "lib/CalypFrame.h"
#include <QComboBox> #include <QComboBox>
#include <QDebug> #include <QDebug>
#include <QDialogButtonBox> #include <QDialogButtonBox>
@@ -37,8 +39,6 @@
#include <QString> #include <QString>
#include <QWidget> #include <QWidget>
#include "lib/CalypFrame.h"
#define MAX_SUPPORTED_RESOLUTION 99999 #define MAX_SUPPORTED_RESOLUTION 99999
QDataStream& operator<<( QDataStream& out, const CalypStandardResolutionVector& array ) QDataStream& operator<<( QDataStream& out, const CalypStandardResolutionVector& array )
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,8 @@
#include "ModulesHandleOptDialog.h" #include "ModulesHandleOptDialog.h"
#include "lib/CalypOptions.h"
#include <QCheckBox> #include <QCheckBox>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QLabel> #include <QLabel>
@@ -32,8 +34,6 @@
#include <QVector> #include <QVector>
#include <QWidget> #include <QWidget>
#include "lib/CalypOptions.h"
class QLineEdit; class QLineEdit;
class OpionConfiguration : public QWidget class OpionConfiguration : public QWidget
+4 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,13 +25,13 @@
#ifndef __MODULEHANDLEOPTDIALOG_H__ #ifndef __MODULEHANDLEOPTDIALOG_H__
#define __MODULEHANDLEOPTDIALOG_H__ #define __MODULEHANDLEOPTDIALOG_H__
#include <QDialog>
#include <QVector>
#include "CalypAppModuleIf.h" #include "CalypAppModuleIf.h"
#include "CommonDefs.h" #include "CommonDefs.h"
#include "config.h" #include "config.h"
#include <QDialog>
#include <QVector>
class OpionConfiguration; class OpionConfiguration;
/** /**
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,11 +25,11 @@
#ifndef __PROGRESSBAR_H__ #ifndef __PROGRESSBAR_H__
#define __PROGRESSBAR_H__ #define __PROGRESSBAR_H__
#include "CommonDefs.h"
#include <QDialog> #include <QDialog>
#include <QWidget> #include <QWidget>
#include "CommonDefs.h"
class QProgressBar; class QProgressBar;
class ProgressBar : public QWidget class ProgressBar : public QWidget
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,6 +24,8 @@
#include "SeekStreamDialog.h" #include "SeekStreamDialog.h"
#include "lib/CalypStream.h"
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QGridLayout> #include <QGridLayout>
#include <QLabel> #include <QLabel>
@@ -31,8 +33,6 @@
#include <QVector> #include <QVector>
#include <QWidget> #include <QWidget>
#include "lib/CalypStream.h"
SeekStreamDialog::SeekStreamDialog( CalypStream* pcCurrStream, QWidget* parent ) SeekStreamDialog::SeekStreamDialog( CalypStream* pcCurrStream, QWidget* parent )
: QDialog( parent, Qt::Dialog | Qt::WindowTitleHint ), m_iSelectedFrameNum() : QDialog( parent, Qt::Dialog | Qt::WindowTitleHint ), m_iSelectedFrameNum()
{ {
+4 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,13 +25,13 @@
#ifndef __SEEKSTREAMDIALOG_H__ #ifndef __SEEKSTREAMDIALOG_H__
#define __SEEKSTREAMDIALOG_H__ #define __SEEKSTREAMDIALOG_H__
#include <QDialog>
#include <QVector>
#include "CalypAppModuleIf.h" #include "CalypAppModuleIf.h"
#include "CommonDefs.h" #include "CommonDefs.h"
#include "config.h" #include "config.h"
#include <QDialog>
#include <QVector>
class QSpinBox; class QSpinBox;
/** /**
+4 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,12 +24,12 @@
#include "SubWindowSelectorDialog.h" #include "SubWindowSelectorDialog.h"
#include <QCheckBox>
#include <QGroupBox>
#include "SubWindowHandle.h" #include "SubWindowHandle.h"
#include "VideoSubWindow.h" #include "VideoSubWindow.h"
#include <QCheckBox>
#include <QGroupBox>
SubWindowSelectorDialog::SubWindowSelectorDialog( QWidget* parent, SubWindowHandle* windowManager, SubWindowSelectorDialog::SubWindowSelectorDialog( QWidget* parent, SubWindowHandle* windowManager,
unsigned int uiCategory, int minWindowsSelected, int maxWindowsSelected ) unsigned int uiCategory, int minWindowsSelected, int maxWindowsSelected )
: QDialog( parent ) : QDialog( parent )
+5 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,12 +25,13 @@
#ifndef __DIALOGSUBWINDOWSELECTOR_H__ #ifndef __DIALOGSUBWINDOWSELECTOR_H__
#define __DIALOGSUBWINDOWSELECTOR_H__ #define __DIALOGSUBWINDOWSELECTOR_H__
#include <QVector> #include "CommonDefs.h"
#include "config.h"
#include <QtCore> #include <QtCore>
#include <QtWidgets> #include <QtWidgets>
#include "CommonDefs.h" #include <QVector>
#include "config.h"
class QPixmap; class QPixmap;
class QColor; class QColor;
+28 -28
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -28,12 +28,12 @@
#include <QtGui> #include <QtGui>
#include <cmath> #include <cmath>
#include "lib/CalypStream.h"
FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitch ) FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitch )
: QWidget( parent ), m_pbIsPlaying( pbMainPlaySwitch ), m_bHasFrame( false ) : QWidget( parent ), m_pbIsPlaying( pbMainPlaySwitch )
{ {
// -------------- Variables definition -------------- // -------------- Variables definition --------------
m_pcFrame = NULL;
m_pcSelectedFrame = NULL;
m_iLastFrameType = -1; m_iLastFrameType = -1;
// Histogram area ----------------------------------------------------- // Histogram area -----------------------------------------------------
@@ -204,11 +204,6 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
labelMedianValue = new QLabel; labelMedianValue = new QLabel;
labelMedianValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); labelMedianValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
QLabel* entropyLabel = new QLabel( tr( "Entropy:" ) );
entropyLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelEntropyValue = new QLabel;
labelEntropyValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
QLabel* percentileLabel = new QLabel( tr( "Percentile:" ) ); QLabel* percentileLabel = new QLabel( tr( "Percentile:" ) );
percentileLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); percentileLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelPercentileValue = new QLabel; labelPercentileValue = new QLabel;
@@ -230,8 +225,6 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
statisticsLayout->addWidget( labelStdDevValue, gridRow++, 1 ); statisticsLayout->addWidget( labelStdDevValue, gridRow++, 1 );
statisticsLayout->addWidget( medianLabel, gridRow, 0 ); statisticsLayout->addWidget( medianLabel, gridRow, 0 );
statisticsLayout->addWidget( labelMedianValue, gridRow++, 1 ); statisticsLayout->addWidget( labelMedianValue, gridRow++, 1 );
statisticsLayout->addWidget( entropyLabel, gridRow, 0 );
statisticsLayout->addWidget( labelEntropyValue, gridRow++, 1 );
QGroupBox* statisticsGroup = new QGroupBox( tr( "Statistics" ) ); QGroupBox* statisticsGroup = new QGroupBox( tr( "Statistics" ) );
statisticsGroup->setLayout( statisticsLayout ); statisticsGroup->setLayout( statisticsLayout );
@@ -278,8 +271,13 @@ QSize FramePropertiesDock::sizeHint() const
void FramePropertiesDock::reset() void FramePropertiesDock::reset()
{ {
m_bHasFrame = false; m_pcFrame = NULL;
m_cSelectionArea = QRect(); m_cSelectionArea = QRect();
if( m_pcSelectedFrame )
{
delete m_pcSelectedFrame;
m_pcSelectedFrame = NULL;
}
m_iLastFrameType = -1; m_iLastFrameType = -1;
@@ -359,29 +357,34 @@ void FramePropertiesDock::setFrame( CalypFrame* pcFrame )
} }
} }
setEnabled( true ); setEnabled( true );
if( pcFrame && !( *m_pbIsPlaying ) ) if( m_pcFrame || !( *m_pbIsPlaying ) )
{ {
m_bHasFrame = true; m_pcFrame = pcFrame;
m_cFrame = CalypFrame( pcFrame );
updateDataHistogram(); updateDataHistogram();
} }
} }
void FramePropertiesDock::setSelection( const QRect& selectionArea ) void FramePropertiesDock::setSelection( const QRect& selectionArea )
{ {
if( m_bHasFrame ) if( m_pcFrame )
{ {
bool bSelectionChanged = !( selectionArea.size() == m_cSelectionArea.size() ); bool bSelectionChanged = !( selectionArea.size() == m_cSelectionArea.size() );
m_cSelectionArea = selectionArea;
if( selectionArea.isValid() ) if( selectionArea.isValid() )
{ {
m_cSelectionArea = selectionArea;
histogramWidget->stopHistogramComputation(); histogramWidget->stopHistogramComputation();
/* /*
* Crop selection from frame * Allocate a new image for the selection
* or just copy information
*/ */
if( bSelectionChanged ) if( bSelectionChanged )
{ {
m_cSelectedFrame = CalypFrame( m_cFrame, selectionArea.x(), selectionArea.y(), selectionArea.width(), if( m_pcSelectedFrame )
{
delete m_pcSelectedFrame;
}
m_pcSelectedFrame = new CalypFrame( m_pcFrame, selectionArea.x(), selectionArea.y(), selectionArea.width(),
selectionArea.height() ); selectionArea.height() );
} }
updateDataHistogram(); updateDataHistogram();
@@ -399,13 +402,13 @@ void FramePropertiesDock::setSelection( const QRect& selectionArea )
void FramePropertiesDock::updateDataHistogram() void FramePropertiesDock::updateDataHistogram()
{ {
if( m_bHasFrame && isVisible() ) if( m_pcFrame && isVisible() )
{ {
if( !*m_pbIsPlaying ) if( !*m_pbIsPlaying )
{ {
if( m_cSelectionArea.isValid() ) if( m_pcSelectedFrame )
{ {
m_cSelectedFrame = CalypFrame( m_cFrame, m_cSelectionArea.x(), m_cSelectionArea.y(), m_cSelectionArea.width(), m_cSelectionArea.height() ); m_pcSelectedFrame->copyFrom( m_pcFrame, m_cSelectionArea.x(), m_cSelectionArea.y() );
fullImageButton->show(); fullImageButton->show();
selectionImageButton->show(); selectionImageButton->show();
} }
@@ -414,7 +417,7 @@ void FramePropertiesDock::updateDataHistogram()
fullImageButton->hide(); fullImageButton->hide();
selectionImageButton->hide(); selectionImageButton->hide();
} }
histogramWidget->updateData( &m_cFrame, m_cSelectionArea.isValid() ? &m_cSelectedFrame : nullptr ); histogramWidget->updateData( m_pcFrame, m_pcSelectedFrame );
} }
else else
{ {
@@ -469,10 +472,7 @@ void FramePropertiesDock::updateStatistiques()
labelCountValue->setText( value.setNum( (float)counts, 'f', 0 ) ); labelCountValue->setText( value.setNum( (float)counts, 'f', 0 ) );
double median = frame->getMedian( channel, min, max ); double median = frame->getMedian( channel, min, max );
labelMedianValue->setText( value.setNum( median, 'f', 0 ) ); labelMedianValue->setText( value.setNum( median, 'f', 1 ) );
double entropy = frame->getEntropy( channel, min, max );
labelEntropyValue->setText( value.setNum( entropy, 'f', 2 ) );
double percentile = ( pixels > 0 ? ( 100.0 * counts / pixels ) : 0.0 ); double percentile = ( pixels > 0 ? ( 100.0 * counts / pixels ) : 0.0 );
labelPercentileValue->setText( value.setNum( percentile, 'f', 1 ) ); labelPercentileValue->setText( value.setNum( percentile, 'f', 1 ) );
@@ -513,7 +513,7 @@ void FramePropertiesDock::slotRefreshOptions( int range )
void FramePropertiesDock::slotHistogramComputationFailed() void FramePropertiesDock::slotHistogramComputationFailed()
{ {
m_bHasFrame = false; m_pcFrame = NULL;
} }
void FramePropertiesDock::slotChannelChanged( int index ) void FramePropertiesDock::slotChannelChanged( int index )
+6 -8
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,14 +25,13 @@
#ifndef __FRAMEPROPERTIESDOCK_H__ #ifndef __FRAMEPROPERTIESDOCK_H__
#define __FRAMEPROPERTIESDOCK_H__ #define __FRAMEPROPERTIESDOCK_H__
#include <QtWidgets>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "HistogramWidget.h" #include "HistogramWidget.h"
#include "config.h" #include "config.h"
#include "lib/CalypFrame.h" #include "lib/CalypFrame.h"
#include "lib/CalypStream.h"
class CalypStream; #include <QtWidgets>
class FramePropertiesDock : public QWidget class FramePropertiesDock : public QWidget
{ {
@@ -49,10 +48,10 @@ public:
void stopHistogram(); void stopHistogram();
private: private:
CalypFrame m_cFrame; CalypFrame* m_pcFrame;
CalypFrame m_cSelectedFrame; CalypFrame* m_pcSelectedFrame;
int m_iLastFrameType; int m_iLastFrameType;
bool m_bHasFrame;
bool* m_pbIsPlaying; bool* m_pbIsPlaying;
QComboBox* channelCB; QComboBox* channelCB;
@@ -77,7 +76,6 @@ private:
QLabel* labelMeanValue; QLabel* labelMeanValue;
QLabel* labelStdDevValue; QLabel* labelStdDevValue;
QLabel* labelMedianValue; QLabel* labelMedianValue;
QLabel* labelEntropyValue;
QLabel* labelPercentileValue; QLabel* labelPercentileValue;
QLabel* colorsLabel; QLabel* colorsLabel;
+4 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,14 +24,14 @@
#include "ModuleHandleDock.h" #include "ModuleHandleDock.h"
#include "CalypAppModuleIf.h"
#include "ModulesHandle.h"
#include <QGridLayout> #include <QGridLayout>
#include <QLabel> #include <QLabel>
#include <QString> #include <QString>
#include <QtGui> #include <QtGui>
#include "CalypAppModuleIf.h"
#include "ModulesHandle.h"
ModuleHandleDock::ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf ) ModuleHandleDock::ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf )
: QWidget( parent ), m_pcCurrModuleIf( moduleIf ) : QWidget( parent ), m_pcCurrModuleIf( moduleIf )
{ {
+4 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,12 +25,12 @@
#ifndef __MODULEHANDLEDOCK_H__ #ifndef __MODULEHANDLEDOCK_H__
#define __MODULEHANDLEDOCK_H__ #define __MODULEHANDLEDOCK_H__
#include <QSize>
#include <QWidget>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "config.h" #include "config.h"
#include <QSize>
#include <QWidget>
class QLabel; class QLabel;
class CalypAppModuleIf; class CalypAppModuleIf;
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,11 +24,11 @@
#include "QualityMeasurementSidebar.h" #include "QualityMeasurementSidebar.h"
#include <QtGui>
#include "SubWindowHandle.h" #include "SubWindowHandle.h"
#include "VideoSubWindow.h" #include "VideoSubWindow.h"
#include <QtGui>
QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, SubWindowHandle* windowManager ) QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, SubWindowHandle* windowManager )
: QWidget( parent ), m_pcMainWindowManager( windowManager ), m_pcCurrentVideoSubWindow( NULL ) : QWidget( parent ), m_pcMainWindowManager( windowManager ), m_pcCurrentVideoSubWindow( NULL )
{ {
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,14 +25,14 @@
#ifndef __QUALITYMEASUREMENTSIDEBAR_H__ #ifndef __QUALITYMEASUREMENTSIDEBAR_H__
#define __QUALITYMEASUREMENTSIDEBAR_H__ #define __QUALITYMEASUREMENTSIDEBAR_H__
#include <QtWidgets>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "HistogramWidget.h" #include "HistogramWidget.h"
#include "config.h" #include "config.h"
#include "lib/CalypFrame.h" #include "lib/CalypFrame.h"
#include "lib/CalypStream.h" #include "lib/CalypStream.h"
#include <QtWidgets>
class SubWindowHandle; class SubWindowHandle;
class VideoSubWindow; class VideoSubWindow;
+3 -3
View File
@@ -1,5 +1,5 @@
# ###
# CMakeLists for calyp external components ### CMakeLists for calyp external components
# ###
ADD_SUBDIRECTORY( qcustomplot ) ADD_SUBDIRECTORY( qcustomplot )
+13 -5
View File
@@ -1,12 +1,20 @@
# ###
# CMakeLists for qcustomplot ### CMakeLists for qcustomplot
# ###
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport ) FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport )
SET(qcustomplot_SRCS qcustomplot.cpp qcustomplot.h) set(qcustomplot_SRCS
qcustomplot.cpp
qcustomplot.h
)
ADD_LIBRARY( QCustomPlotLib STATIC ${qcustomplot_SRCS} ) ADD_LIBRARY( QCustomPlotLib STATIC ${qcustomplot_SRCS} )
TARGET_LINK_LIBRARIES(QCustomPlotLib Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport) TARGET_LINK_LIBRARIES( QCustomPlotLib
Qt5::Core
Qt5::Gui
Qt5::Widgets
Qt5::PrintSupport
)
TARGET_INCLUDE_DIRECTORIES(QCustomPlotLib PUBLIC . ) TARGET_INCLUDE_DIRECTORIES(QCustomPlotLib PUBLIC . )
+1577 -2100
View File
File diff suppressed because it is too large. Load diff
+354 -610
View File
File diff suppressed because it is too large. Load diff
+1 -6
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,6 @@
#include "DBusAppAdaptor.h" #include "DBusAppAdaptor.h"
#endif #endif
#include <QApplication> #include <QApplication>
#include <QStyleFactory>
#ifdef USE_FERVOR #ifdef USE_FERVOR
#include "fvupdater.h" #include "fvupdater.h"
#endif #endif
@@ -52,10 +51,6 @@ int main( int argc, char* argv[] )
QApplication::setApplicationVersion( QStringLiteral( CALYP_VERSION_STRING ) ); QApplication::setApplicationVersion( QStringLiteral( CALYP_VERSION_STRING ) );
QApplication::setOrganizationName( QStringLiteral( "PixLRA" ) ); QApplication::setOrganizationName( QStringLiteral( "PixLRA" ) );
#if _WIN32
application.setStyle( QStyleFactory::create( "Fusion" ) );
#endif
#ifdef USE_QTDBUS #ifdef USE_QTDBUS
/** /**
* use dbus, if available * use dbus, if available
Binary file not shown.
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,11 +25,11 @@
#ifndef __WIDGETFRAMENUMBER_H__ #ifndef __WIDGETFRAMENUMBER_H__
#define __WIDGETFRAMENUMBER_H__ #define __WIDGETFRAMENUMBER_H__
#include <QWidget>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "config.h" #include "config.h"
#include <QWidget>
class QLabel; class QLabel;
class FrameNumberWidget : public QWidget class FrameNumberWidget : public QWidget
+4 -8
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -53,8 +53,8 @@ public:
void setup( CalypFrame* frame ) void setup( CalypFrame* frame )
{ {
m_pcFrame = frame; m_pcFrame = frame;
run(); // run();
//start(); start();
} }
void run() void run()
{ {
@@ -938,11 +938,7 @@ void HistogramWidget::paintEvent( QPaintEvent* )
tipText += cellBeg + tr( "Median:" ) + cellMid; tipText += cellBeg + tr( "Median:" ) + cellMid;
double median = frame->getMedian( m_channelType, 0, frame->getNumHistogramSegment() - 1 ); double median = frame->getMedian( m_channelType, 0, frame->getNumHistogramSegment() - 1 );
tipText += value.setNum( median, 'f', 0 ) + cellEnd; tipText += value.setNum( median, 'f', 1 ) + cellEnd;
tipText += cellBeg + tr( "Entropy:" ) + cellMid;
double entropy = frame->getEntropy( m_channelType, 0, frame->getNumHistogramSegment() - 1 );
tipText += value.setNum( entropy, 'f', 2 ) + cellEnd;
tipText += cellBeg + tr( "Percent:" ) + cellMid; tipText += cellBeg + tr( "Percent:" ) + cellMid;
double percentile = ( pixels > 0 ? ( 100.0 * counts / pixels ) : 0.0 ); double percentile = ( pixels > 0 ? ( 100.0 * counts / pixels ) : 0.0 );
+4 -4
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -26,13 +26,13 @@
#ifndef __HISTOGRAMWIDGET_H__ #ifndef __HISTOGRAMWIDGET_H__
#define __HISTOGRAMWIDGET_H__ #define __HISTOGRAMWIDGET_H__
#include <QColor>
#include <QWidget>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "config.h" #include "config.h"
#include "lib/CalypFrame.h" #include "lib/CalypFrame.h"
#include <QColor>
#include <QWidget>
class QEvent; class QEvent;
class HistogramWorker; class HistogramWorker;
+101 -93
View File
@@ -1,139 +1,147 @@
# * Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC) # - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
# #
# Once done this will define FFMPEG_FOUND - System has the all required components. FFMPEG_INCLUDE_DIRS - Include directory necessary for # Once done this will define
# using the required components headers. FFMPEG_LIBRARIES - Link these to use the required ffmpeg components. FFMPEG_DEFINITIONS - Compiler # FFMPEG_FOUND - System has the all required components.
# switches required for using the required ffmpeg components. # FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers.
# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components.
# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components.
# #
# For each of the components it will additionally set. - AVCODEC - AVDEVICE - AVFORMAT - AVUTIL - POSTPROCESS - SWSCALE the following variables will # For each of the components it will additionally set.
# be defined <component>_FOUND - System has <component> <component>_INCLUDE_DIRS - Include directory necessary for using the <component> # - AVCODEC
# headers <component>_LIBRARIES - Link these to use <component> <component>_DEFINITIONS - Compiler switches required for using <component> # - AVDEVICE
# - AVFORMAT
# - AVUTIL
# - POSTPROCESS
# - SWSCALE
# the following variables will be defined
# <component>_FOUND - System has <component>
# <component>_INCLUDE_DIRS - Include directory necessary for using the <component> headers
# <component>_LIBRARIES - Link these to use <component>
# <component>_DEFINITIONS - Compiler switches required for using <component>
# <component>_VERSION - The components version # <component>_VERSION - The components version
# #
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org> Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org> Copyright (c) 2011, Michael Jansen, # Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
# <kde@michael-jansen.biz> # Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
# Copyright (c) 2011, Michael Jansen, <kde@michael-jansen.biz>
# #
# Redistribution and use is allowed according to the terms of the BSD license. For details see the accompanying COPYING-CMAKE-SCRIPTS file. # Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
INCLUDE(FindPackageHandleStandardArgs) include(FindPackageHandleStandardArgs)
# The default components were taken from a survey over other FindFFMPEG.cmake files # The default components were taken from a survey over other FindFFMPEG.cmake files
IF(NOT FFmpeg_FIND_COMPONENTS) if (NOT FFmpeg_FIND_COMPONENTS)
SET(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL) set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
ENDIF() endif ()
# #
# Macro: set_component_found ### Macro: set_component_found
# #
# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present. # Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
# #
MACRO(set_component_found _component) macro(set_component_found _component )
IF(${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS) if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
# message(STATUS " - ${_component} found.") # message(STATUS " - ${_component} found.")
SET(${_component}_FOUND TRUE) set(${_component}_FOUND TRUE)
ELSE() else ()
# message(STATUS " - ${_component} not found.") # message(STATUS " - ${_component} not found.")
ENDIF() endif ()
ENDMACRO() endmacro()
# #
# Macro: find_component ### Macro: find_component
# #
# Checks for the given component by invoking pkgconfig and then looking up the libraries and include directories. # Checks for the given component by invoking pkgconfig and then looking up the libraries and
# include directories.
# #
MACRO(find_component _component _pkgconfig _library _header) macro(find_component _component _pkgconfig _library _header)
IF(NOT WIN32) if (NOT WIN32)
# use pkg-config to get the directories and then use these values in the FIND_PATH() and FIND_LIBRARY() calls # use pkg-config to get the directories and then use these values
FIND_PACKAGE(PkgConfig) # in the FIND_PATH() and FIND_LIBRARY() calls
IF(PKG_CONFIG_FOUND) find_package(PkgConfig)
PKG_CHECK_MODULES(PC_${_component} ${_pkgconfig}) if (PKG_CONFIG_FOUND)
ENDIF() pkg_check_modules(PC_${_component} ${_pkgconfig})
ENDIF(NOT WIN32) endif ()
endif (NOT WIN32)
FIND_PATH( find_path(${_component}_INCLUDE_DIRS ${_header}
${_component}_INCLUDE_DIRS ${_header} HINTS
HINTS ${PC_LIB${_component}_INCLUDEDIR} ${PC_LIB${_component}_INCLUDE_DIRS} ${PC_LIB${_component}_INCLUDEDIR}
PATH_SUFFIXES ffmpeg ${PC_LIB${_component}_INCLUDE_DIRS}
PATH_SUFFIXES
ffmpeg
) )
FIND_LIBRARY( find_library(${_component}_LIBRARIES NAMES ${_library}
HINTS
${PC_LIB${_component}_LIBDIR}
${PC_LIB${_component}_LIBRARY_DIRS}
)
set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
set_component_found(${_component})
mark_as_advanced(
${_component}_INCLUDE_DIRS
${_component}_LIBRARIES ${_component}_LIBRARIES
NAMES ${_library} ${_component}_DEFINITIONS
HINTS ${PC_LIB${_component}_LIBDIR} ${PC_LIB${_component}_LIBRARY_DIRS} ${_component}_VERSION)
)
SET(${_component}_DEFINITIONS endmacro()
${PC_${_component}_CFLAGS_OTHER}
CACHE STRING "The ${_component} CFLAGS."
)
SET(${_component}_VERSION
${PC_${_component}_VERSION}
CACHE STRING "The ${_component} version number."
)
SET_COMPONENT_FOUND(${_component})
MARK_AS_ADVANCED(${_component}_INCLUDE_DIRS ${_component}_LIBRARIES ${_component}_DEFINITIONS ${_component}_VERSION)
ENDMACRO()
# Check for cached results. If there are skip the costly part. # Check for cached results. If there are skip the costly part.
IF(NOT FFMPEG_LIBRARIES) if (NOT FFMPEG_LIBRARIES)
# Check for all possible component. # Check for all possible component.
FIND_COMPONENT(AVCODEC libavcodec avcodec libavcodec/avcodec.h) find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
FIND_COMPONENT(AVFORMAT libavformat avformat libavformat/avformat.h) find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
FIND_COMPONENT(AVDEVICE libavdevice avdevice libavdevice/avdevice.h) find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
FIND_COMPONENT(AVUTIL libavutil avutil libavutil/avutil.h) find_component(AVUTIL libavutil avutil libavutil/avutil.h)
FIND_COMPONENT(SWSCALE libswscale swscale libswscale/swscale.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)
FIND_COMPONENT(POSTPROC libpostproc postproc libpostproc/postprocess.h)
# Check if the required components were found and add their stuff to the FFMPEG_* vars. # Check if the required components were found and add their stuff to the FFMPEG_* vars.
FOREACH(_component ${FFmpeg_FIND_COMPONENTS}) foreach (_component ${FFmpeg_FIND_COMPONENTS})
IF(${_component}_FOUND) if (${_component}_FOUND)
# message(STATUS "Required component ${_component} present.") # message(STATUS "Required component ${_component} present.")
SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES}) set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
SET(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS}) set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
LIST(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS}) list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
ELSE() else ()
# message(STATUS "Required component ${_component} missing.") # message(STATUS "Required component ${_component} missing.")
ENDIF() endif ()
ENDFOREACH() endforeach ()
# Build the include path with duplicates removed. # Build the include path with duplicates removed.
IF(FFMPEG_INCLUDE_DIRS) if (FFMPEG_INCLUDE_DIRS)
LIST(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS) list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
ENDIF() endif ()
# cache the vars. # cache the vars.
SET(FFMPEG_INCLUDE_DIRS set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE)
${FFMPEG_INCLUDE_DIRS} set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE)
CACHE STRING "The FFmpeg include directories." FORCE set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE)
)
SET(FFMPEG_LIBRARIES
${FFMPEG_LIBRARIES}
CACHE STRING "The FFmpeg libraries." FORCE
)
SET(FFMPEG_DEFINITIONS
${FFMPEG_DEFINITIONS}
CACHE STRING "The FFmpeg cflags." FORCE
)
MARK_AS_ADVANCED(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS) mark_as_advanced(FFMPEG_INCLUDE_DIRS
FFMPEG_LIBRARIES
FFMPEG_DEFINITIONS)
ENDIF() endif ()
# Now set the noncached _FOUND vars for the components. # Now set the noncached _FOUND vars for the components.
FOREACH(_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE) foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE)
SET_COMPONENT_FOUND(${_component}) set_component_found(${_component})
ENDFOREACH() endforeach ()
# Compile the list of required vars # Compile the list of required vars
SET(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS) set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
FOREACH(_component ${FFmpeg_FIND_COMPONENTS}) foreach (_component ${FFmpeg_FIND_COMPONENTS})
LIST(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS) list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
ENDFOREACH() endforeach ()
# Give a nice error message if some of the required vars are missing. # Give a nice error message if some of the required vars are missing.
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS}) find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})
+32 -28
View File
@@ -1,30 +1,32 @@
# General function to add a module It receives the name of the module and the filename where it is defined. Used in modules/CMakeLists.txt
MACRO(ADD_EXTRA_MODULES dir)
SET( MODULE_LOCATION "${dir}/" )
ADD_SUBDIRECTORY( ${dir} ${CMAKE_CURRENT_BINARY_DIR}/extra-modules )
INCLUDE_DIRECTORIES( ${dir} )
SET( MODULE_LOCATION "${dir}/" PARENT_SCOPE )
ENDMACRO()
MACRO(ADD_MODULE name file ) MACRO(ADD_MODULE name file )
SET(__modulename "Module${name}") SET(__modulename "Module${name}")
OPTION(MODULE_${name} "Use module ${name}" ON ) OPTION(MODULE_${name} "Use module ${name}" ON )
ADD_FEATURE_INFO(${name} MODULE_${name} "Module ${name}" ) ADD_FEATURE_INFO(${name} MODULE_${name} "Module ${name}" )
IF( MODULE_${name} ) IF( MODULE_${name} )
LIST(APPEND Calyp_Mod_SRCS ${MODULE_LOCATION}${file}.cpp) list(APPEND Calyp_Mod_SRCS ${MODULE_LOCATION}${file} )
LIST(APPEND MODULES_LIST_NAME ${name} ) LIST(APPEND MODULES_LIST_NAME ${name} )
LIST(APPEND MODULES_LIST_FILES ${file} ) LIST(APPEND MODULES_LIST_FILES ${file} )
SET(Calyp_Mod_SRCS SET( Calyp_Mod_SRCS "${Calyp_Mod_SRCS}" PARENT_SCOPE )
"${Calyp_Mod_SRCS}" SET( MODULES_LIST_NAME "${MODULES_LIST_NAME}" PARENT_SCOPE )
PARENT_SCOPE SET( MODULES_LIST_FILES "${MODULES_LIST_FILES}" PARENT_SCOPE )
)
SET(MODULES_LIST_NAME
"${MODULES_LIST_NAME}"
PARENT_SCOPE
)
SET(MODULES_LIST_FILES
"${MODULES_LIST_FILES}"
PARENT_SCOPE
)
ENDIF() ENDIF()
UNSET(__modulename) UNSET(__modulename)
ENDMACRO() ENDMACRO()
# General function to add a module It receives the name of the module and the filename where it is defined. Moreover it receives a VERSION and MODULES MACRO(ADD_PYTHON_MODULE name file )
# (OpenCV modules required) Used in modules/CMakeLists.txt IF( ${Python3_FOUND} )
ADD_MODULE( ${name} ${file} )
ENDIF()
ENDMACRO()
MACRO(ADD_MODULE_USE_OPENCV name file ) MACRO(ADD_MODULE_USE_OPENCV name file )
IF( USE_OPENCV ) IF( USE_OPENCV )
SET( ADD_MODULE_USE_OPENCV_VERSION "2.4" ) SET( ADD_MODULE_USE_OPENCV_VERSION "2.4" )
@@ -32,7 +34,7 @@ MACRO(ADD_MODULE_USE_OPENCV name file)
IF( NOT ( ${OpenCV_VERSION} VERSION_LESS ${ADD_MODULE_USE_OPENCV_VERSION} ) ) IF( NOT ( ${OpenCV_VERSION} VERSION_LESS ${ADD_MODULE_USE_OPENCV_VERSION} ) )
SET( _HAS_MODULES TRUE ) SET( _HAS_MODULES TRUE )
FOREACH(opencv_module IN LISTS ADD_MODULE_USE_OPENCV_MODULES ) FOREACH(opencv_module IN LISTS ADD_MODULE_USE_OPENCV_MODULES )
STRING(TOUPPER "${opencv_module}" opencv_moduleUP) string(TOUPPER "${opencv_module}" opencv_moduleUP)
FIND_PACKAGE( OpenCV QUIET COMPONENTS ${opencv_module} ) FIND_PACKAGE( OpenCV QUIET COMPONENTS ${opencv_module} )
IF( NOT ${OPENCV_${opencv_moduleUP}_FOUND} EQUAL "1" ) IF( NOT ${OPENCV_${opencv_moduleUP}_FOUND} EQUAL "1" )
SET( _HAS_MODULES FALSE ) SET( _HAS_MODULES FALSE )
@@ -50,19 +52,21 @@ MACRO(ADD_MODULE_USE_OPENCV name file)
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
#
# Create header # Create header
#
MACRO(CREATE_MODULE_MACROS ) MACRO(CREATE_MODULE_MACROS )
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n" file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n"
"#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" "#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" )
) foreach(module ${MODULES_LIST_FILES})
FOREACH(module ${MODULES_LIST_FILES}) file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${module}.h\"\n")
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${module}.h\"\n") endforeach(module ${MODULES_LIST_FILES})
ENDFOREACH(module ${MODULES_LIST_FILES})
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#define REGISTER_ALL_MODULES \\\n") file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#define REGISTER_ALL_MODULES \\\n" )
FOREACH(module ${MODULES_LIST_NAME}) foreach(module ${MODULES_LIST_NAME})
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "Register( \"${module}\", &(${module}::Create) ); \\\n") file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "Register( \"${module}\", &(${module}::Create) ); \\\n")
ENDFOREACH(module ${MODULES_LIST_NAME}) endforeach(module ${MODULES_LIST_NAME})
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "\n#endif // __MODULESLISTHEADER_H__\n") file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "\n#endif // __MODULESLISTHEADER_H__\n" )
ENDMACRO() ENDMACRO()
+24 -42
View File
@@ -1,38 +1,25 @@
# #################################################################################################################################################### #####################################################################################
# DLLs and Win32 specific code # DLLs and Win32 specific code
# #################################################################################################################################################### ######################################################################################
FOREACH(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES}) foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
STRING(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG) string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ".") set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "." )
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ".") set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "." )
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ".") set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "." )
ENDFOREACH(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES) endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
SET(MSVC_DLL_DIR SET(MSVC_DLL_DIR "MSVC_DLL_DIR" CACHE PATH "Where to find MSVC dlls")
"MSVC_DLL_DIR" #INSTALL(FILES ${MSVC_DLL_DIR}/msvcr120.dll DESTINATION bin )
CACHE PATH "Where to find MSVC dlls" #INSTALL(FILES ${MSVC_DLL_DIR}/msvcp120.dll DESTINATION bin )
)
# INSTALL(FILES ${MSVC_DLL_DIR}/msvcr120.dll DESTINATION bin ) INSTALL(FILES ${MSVC_DLL_DIR}/msvcp120.dll DESTINATION bin )
SET(QT_DIR SET(QT_DIR "QT-Dir" CACHE PATH "Where to find QT Lib on Windows")
"QT-Dir" SET(QT_ICU_VERSION "" CACHE STRING "Qt ICU version of dll's" )
CACHE PATH "Where to find QT Lib on Windows" SET(QT_DLL_POSTFIX "" CACHE STRING "Postfix to dll's name for debug" )
)
SET(QT_ICU_VERSION
""
CACHE STRING "Qt ICU version of dll's"
)
SET(QT_DLL_POSTFIX
""
CACHE STRING "Postfix to dll's name for debug"
)
SET(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH} ${QT_DIR}" ) SET(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH} ${QT_DIR}" )
SET(WINDLLIB SET(WINDLLIB "Dl-location" CACHE PATH "Where to find DL Lib on Windows")
"Dl-location"
CACHE PATH "Where to find DL Lib on Windows"
)
IF( NOT USE_QT4 ) IF( NOT USE_QT4 )
INSTALL(FILES ${QT_DIR}/bin/Qt5Core${QT_DLL_POSTFIX}.dll DESTINATION bin ) INSTALL(FILES ${QT_DIR}/bin/Qt5Core${QT_DLL_POSTFIX}.dll DESTINATION bin )
@@ -59,23 +46,18 @@ IF(NOT USE_QT4)
ENDIF() ENDIF()
IF( USE_OPENCV ) IF( USE_OPENCV )
SET(OpenCV_DLL_DIR SET(OpenCV_DLL_DIR "${OpenCV_DIR}/bin" CACHE PATH "Where to find OpenCV dlls")
"${OpenCV_DIR}/bin" SET(OpenCV_INSTALL_MODULES ${OPENCV_MODULES} CACHE STRING "List of OpenCV modules")
CACHE PATH "Where to find OpenCV dlls"
)
SET(OpenCV_INSTALL_MODULES
${OPENCV_MODULES}
CACHE STRING "List of OpenCV modules"
)
FOREACH(opencv_module IN LISTS OpenCV_INSTALL_MODULES ) FOREACH(opencv_module IN LISTS OpenCV_INSTALL_MODULES )
INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_${opencv_module}${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin ) INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_${opencv_module}${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin )
ENDFOREACH() ENDFOREACH()
ENDIF() ENDIF()
IF( USE_FFMPEG ) IF( USE_FFMPEG )
SET(FFMPEG_DIR SET(FFMPEG_DIR "FFmpeg-Dir" CACHE PATH "Where to find FFmpeg Lib on Windows")
"FFmpeg-Dir" INSTALL(FILES ${FFMPEG_DIR}/bin/avcodec-${AVCODEC_VERSION}.dll DESTINATION bin )
CACHE PATH "Where to find FFmpeg Lib on Windows" INSTALL(FILES ${FFMPEG_DIR}/bin/avformat-${AVFORMAT_VERSION}.dll DESTINATION bin )
) INSTALL(FILES ${FFMPEG_DIR}/bin/avutil-${AVUTIL_VERSION}.dll DESTINATION bin )
INSTALL(DIRECTORY ${FFMPEG_DIR}/bin/ DESTINATION bin) INSTALL(FILES ${FFMPEG_DIR}/bin/swscale-${SWSCALE_VERSION}.dll DESTINATION bin )
INSTALL(FILES ${FFMPEG_DIR}/bin/swresample-${SWRESAMPLE_VERSION}.dll DESTINATION bin )
ENDIF() ENDIF()
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+5 -3
View File
@@ -1,5 +1,7 @@
# ###
# CMakeLists for examples ### CMakeLists for examples
# ###
ADD_SUBDIRECTORY( modules ) ADD_SUBDIRECTORY( modules )
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -23,7 +23,6 @@
*/ */
#include "AbsoluteFrameDifferenceExample.h" #include "AbsoluteFrameDifferenceExample.h"
#include <cstdlib> #include <cstdlib>
REGISTER_CLASS_MAKER( AbsoluteFrameDifferenceExample ) REGISTER_CLASS_MAKER( AbsoluteFrameDifferenceExample )
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,10 +25,10 @@
#ifndef __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__ #ifndef __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__
#define __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__ #define __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__
#include <cassert>
#include "CalypModuleIf.h" #include "CalypModuleIf.h"
#include <cassert>
class AbsoluteFrameDifferenceExample : public CalypModuleIf class AbsoluteFrameDifferenceExample : public CalypModuleIf
{ {
REGISTER_CLASS_FACTORY( AbsoluteFrameDifferenceExample ) REGISTER_CLASS_FACTORY( AbsoluteFrameDifferenceExample )
+9 -4
View File
@@ -1,12 +1,16 @@
# ###
# CMakeLists for modules_example ### CMakeLists for modules_example
# ###
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.9 ) CMAKE_MINIMUM_REQUIRED( VERSION 2.8.9 )
PROJECT( "modules_example" ) PROJECT( "modules_example" )
# THIS FIND_PACKAGE( Calyp ) INCLUDE_DIRECTORIES( ${CALYP_INCLUDE_DIRS} ) OR # THIS
# FIND_PACKAGE( Calyp )
#INCLUDE_DIRECTORIES( ${CALYP_INCLUDE_DIRS} )
# OR
INCLUDE_DIRECTORIES( ../../lib ) INCLUDE_DIRECTORIES( ../../lib )
ADD_LIBRARY(FrameBinarization SHARED FrameBinarization_APIv1.cpp) ADD_LIBRARY(FrameBinarization SHARED FrameBinarization_APIv1.cpp)
@@ -14,3 +18,4 @@ TARGET_LINK_LIBRARIES(FrameBinarization ${CALYP_LINKER_LIBS})
ADD_LIBRARY(AbsoluteFrameDifferenceExample SHARED AbsoluteFrameDifferenceExample.cpp) ADD_LIBRARY(AbsoluteFrameDifferenceExample SHARED AbsoluteFrameDifferenceExample.cpp)
TARGET_LINK_LIBRARIES( AbsoluteFrameDifferenceExample ${PROJECT_LIBRARY} ${CALYP_LINKER_LIBS} ) TARGET_LINK_LIBRARIES( AbsoluteFrameDifferenceExample ${PROJECT_LIBRARY} ${CALYP_LINKER_LIBS} )
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+50 -30
View File
@@ -1,14 +1,22 @@
# ###
# CMakeLists for calyp lib component ### CMakeLists for calyp lib component
# ###
INCLUDE(GNUInstallDirs) INCLUDE(GNUInstallDirs)
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
SET(Calyp_Lib_Frame_SRCS CalypPixel.cpp PixelFormats.h PixelFormats.cpp CalypFrame.h CalypFrame.cpp) set(Calyp_Lib_SRCS
LibMemory.h
SET(Calyp_Lib_Stream_SRCS CalypLib.h
CalypDefs.h
# Frame
CalypFrame.h
CalypFrame.cpp
CalypPixel.cpp
PixelFormats.h
PixelFormats.cpp
# Stream
CalypStream.h CalypStream.h
CalypStream.cpp CalypStream.cpp
CalypStreamHandlerIf.h CalypStreamHandlerIf.h
@@ -16,20 +24,12 @@ SET(Calyp_Lib_Stream_SRCS
StreamHandlerRaw.cpp StreamHandlerRaw.cpp
StreamHandlerPortableMap.h StreamHandlerPortableMap.h
StreamHandlerPortableMap.cpp StreamHandlerPortableMap.cpp
) # Options Parser
CalypOptions.h
SET(Calyp_Lib_OptionParser_SRCS CalypOptions.h CalypOptions.cpp) CalypOptions.cpp
# Modules
SET(Calyp_Lib_Modules_SRCS CalypOptions.h CalypOptions.cpp) CalypModuleIf.h
CalypOpenCVModuleIf.h
SET(Calyp_Lib_SRCS
LibMemory.h
CalypLib.h
CalypDefs.h
${Calyp_Lib_Frame_SRCS}
${Calyp_Lib_Stream_SRCS}
${Calyp_Lib_OptionParser_SRCS}
${Calyp_Lib_Modules_SRCS}
) )
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${PROJECT_LIBRARY} ) LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${PROJECT_LIBRARY} )
@@ -53,7 +53,20 @@ IF(USE_OPENCV)
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} ) LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} )
ENDIF() ENDIF()
SET(Calyp_Lib_HEADERS CalypDefs.h CalypFrame.h CalypStream.h CalypOptions.h CalypModuleIf.h CalypOpenCVModuleIf.h) IF( USE_PYTHON )
LIST( APPEND Calyp_Lib_SRCS CalypPythonModuleIf.h )
LIST( APPEND Calyp_Lib_SRCS CalypPythonModuleIf.cpp )
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${PYTHON_LINKER_LIBRARIES} )
ENDIF()
set(Calyp_Lib_HEADERS
CalypDefs.h
CalypFrame.h
CalypStream.h
CalypOptions.h
CalypModuleIf.h
CalypOpenCVModuleIf.h
)
CONFIGURE_FILE( CalypConfig.cmake.in CalypConfig.cmake @ONLY) CONFIGURE_FILE( CalypConfig.cmake.in CalypConfig.cmake @ONLY)
@@ -65,15 +78,26 @@ ELSE()
ADD_LIBRARY( ${PROJECT_LIBRARY} SHARED ${Calyp_Lib_SRCS} ) ADD_LIBRARY( ${PROJECT_LIBRARY} SHARED ${Calyp_Lib_SRCS} )
ENDIF() ENDIF()
TARGET_LINK_LIBRARIES(${PROJECT_LIBRARY} ${FFMPEG_LIBRARIES} ${OpenCV_LIBRARIES})
TARGET_INCLUDE_DIRECTORIES(${PROJECT_LIBRARY} PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>) TARGET_LINK_LIBRARIES( ${PROJECT_LIBRARY}
${FFMPEG_LIBRARIES}
${OpenCV_LIBRARIES}
${PYTHON_LINKER_LIBRARIES}
)
SET_TARGET_PROPERTIES(${PROJECT_LIBRARY} PROPERTIES VERSION ${CALYP_VERSION} SOVERSION ${CALYP_VERSION_MAJOR}) TARGET_INCLUDE_DIRECTORIES(${PROJECT_LIBRARY}
PUBLIC
$<INSTALL_INTERFACE:include>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
)
SET_TARGET_PROPERTIES( ${PROJECT_LIBRARY}
PROPERTIES VERSION ${CALYP_VERSION}
SOVERSION ${CALYP_VERSION_MAJOR}
)
IF( NOT USE_STATIC ) IF( NOT USE_STATIC )
INSTALL( INSTALL( TARGETS ${PROJECT_LIBRARY}
TARGETS ${PROJECT_LIBRARY}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
@@ -85,7 +109,3 @@ ENDIF()
IF( BUILD_TESTS ) IF( BUILD_TESTS )
ADD_SUBDIRECTORY( tests ) ADD_SUBDIRECTORY( tests )
ENDIF() ENDIF()
IF(BUILD_TESTS_CATCH2)
ADD_SUBDIRECTORY(catch2)
ENDIF()
+2 -2
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -27,9 +27,9 @@
#define __CALYPDEFS_H__ #define __CALYPDEFS_H__
#include <algorithm> #include <algorithm>
#include <iterator>
#include <string> #include <string>
#include <vector> #include <vector>
#include <iterator>
typedef unsigned short ClpPel; ///< 16-bit pixel type typedef unsigned short ClpPel; ///< 16-bit pixel type
typedef unsigned char ClpByte; typedef unsigned char ClpByte;
+23 -114
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,13 +24,13 @@
#include "CalypFrame.h" #include "CalypFrame.h"
#include <cassert>
#include <cmath>
#include "LibMemory.h" #include "LibMemory.h"
#include "PixelFormats.h" #include "PixelFormats.h"
#include "config.h" #include "config.h"
#include <cassert>
#include <cmath>
#ifdef USE_OPENCV #ifdef USE_OPENCV
#include <opencv2/core/core.hpp> #include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp> #include <opencv2/highgui/highgui.hpp>
@@ -102,7 +102,6 @@ public:
int m_iPixelFormat; //!< Pixel format number (it follows the list of supported pixel formats) int m_iPixelFormat; //!< Pixel format number (it follows the list of supported pixel formats)
unsigned int m_uiBitsPel; //!< Bits per pixel/channel unsigned int m_uiBitsPel; //!< Bits per pixel/channel
unsigned int m_uiHalfPelValue; //!< Bits per pixel/channel unsigned int m_uiHalfPelValue; //!< Bits per pixel/channel
bool m_bHasNegativeValues; //!< Half of the scale correspond to negative values
ClpPel*** m_pppcInputPel; ClpPel*** m_pppcInputPel;
@@ -119,28 +118,25 @@ public:
/** Numbers of histogram segments depending of image bytes depth*/ /** Numbers of histogram segments depending of image bytes depth*/
unsigned int m_uiHistoSegments; unsigned int m_uiHistoSegments;
CalypFramePrivate() /**
* Common constructor function of a frame
*
* @param width width of the frame
* @param height height of the frame
* @param pel_format pixel format index (always use PixelFormats enum)
*
*/
void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel )
{ {
m_bInit = false; m_bInit = false;
m_bHasRGBPel = false; m_bHasRGBPel = false;
m_pppcInputPel = nullptr; m_pppcInputPel = NULL;
m_pcARGB32 = nullptr; m_pcARGB32 = NULL;
m_puiHistogram = nullptr;
}
void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel )
{
init( width, height, pel_format, bitsPixel, false );
}
void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel, bool has_negative_values )
{
m_uiWidth = width; m_uiWidth = width;
m_uiHeight = height; m_uiHeight = height;
m_iPixelFormat = pel_format; m_iPixelFormat = pel_format;
m_uiBitsPel = bitsPixel < 8 ? 8 : bitsPixel; m_uiBitsPel = bitsPixel < 8 ? 8 : bitsPixel;
m_uiHalfPelValue = 1 << ( m_uiBitsPel - 1 ); m_uiHalfPelValue = 1 << ( m_uiBitsPel - 1 );
m_bHasNegativeValues = has_negative_values;
if( m_uiWidth == 0 || m_uiHeight == 0 || m_iPixelFormat == -1 || bitsPixel > 16 ) if( m_uiWidth == 0 || m_uiHeight == 0 || m_iPixelFormat == -1 || bitsPixel > 16 )
{ {
@@ -263,49 +259,16 @@ public:
* \brief Constructors * \brief Constructors
*/ */
CalypFrame::CalypFrame()
: d( new CalypFramePrivate )
{
}
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel ) CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel )
: d( new CalypFramePrivate ) : d( new CalypFramePrivate )
{ {
d->init( width, height, pelFormat, bitsPixel ); d->init( width, height, pelFormat, bitsPixel );
} }
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel, bool has_negative_values )
: d( new CalypFramePrivate )
{
d->init( width, height, pelFormat, bitsPixel, has_negative_values );
}
CalypFrame::CalypFrame( CalypFrame&& other ) noexcept
: d( other.d )
{
other.d = nullptr; // we'll talk more about this line below
}
CalypFrame& CalypFrame::operator=( CalypFrame&& other ) noexcept
{
// Self-assignment detection
if( &other == this )
return *this;
// Release any resource we're holding
delete d;
// Transfer ownership of a.m_ptr to m_ptr
d = other.d;
other.d = nullptr;
return *this;
}
CalypFrame::CalypFrame( const CalypFrame& other ) CalypFrame::CalypFrame( const CalypFrame& other )
: d( new CalypFramePrivate ) : d( new CalypFramePrivate )
{ {
d->init( other.getWidth(), other.getHeight(), other.getPelFormat(), other.getBitsPel(), other.getHasNegativeValues() ); d->init( other.getWidth(), other.getHeight(), other.getPelFormat(), other.getBitsPel() );
copyFrom( &other ); copyFrom( &other );
} }
@@ -314,28 +277,11 @@ CalypFrame::CalypFrame( const CalypFrame* other )
{ {
if( other ) if( other )
{ {
d->init( other->getWidth(), other->getHeight(), other->getPelFormat(), other->getBitsPel(), other->getHasNegativeValues() ); d->init( other->getWidth(), other->getHeight(), other->getPelFormat(), other->getBitsPel() );
copyFrom( other ); copyFrom( other );
} }
} }
CalypFrame& CalypFrame::operator=( const CalypFrame& other )
{
// Self-assignment detection
if( &other == this )
return *this;
// Release any resource we're holding
delete d;
// Copy the resource
d = new CalypFramePrivate;
d->init( other.getWidth(), other.getHeight(), other.getPelFormat(), other.getBitsPel(), other.getHasNegativeValues() );
copyFrom( &other );
return *this;
}
CalypFrame::CalypFrame( const CalypFrame& other, unsigned int x, unsigned int y, unsigned int width, unsigned int height ) CalypFrame::CalypFrame( const CalypFrame& other, unsigned int x, unsigned int y, unsigned int width, unsigned int height )
: d( new CalypFramePrivate ) : d( new CalypFramePrivate )
{ {
@@ -451,11 +397,6 @@ unsigned CalypFrame::getHeight( unsigned channel ) const
return CHROMASHIFT( d->m_uiHeight, channel > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0 ); return CHROMASHIFT( d->m_uiHeight, channel > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0 );
} }
bool CalypFrame::getHasNegativeValues() const
{
return d->m_bHasNegativeValues;
}
ClpULong CalypFrame::getPixels( unsigned channel ) const ClpULong CalypFrame::getPixels( unsigned channel ) const
{ {
return getWidth( channel ) * getHeight( channel ); return getWidth( channel ) * getHeight( channel );
@@ -549,24 +490,19 @@ unsigned char* CalypFrame::getRGBBuffer() const
return NULL; return NULL;
} }
ClpPel CalypFrame::operator()( unsigned int ch, unsigned int xPos, unsigned int yPos, bool absolute ) const ClpPel CalypFrame::operator()( unsigned int ch, unsigned int xPos, unsigned int yPos )
{ {
int retValue = 0;
if( ch < d->m_pcPelFormat->numberChannels ) if( ch < d->m_pcPelFormat->numberChannels )
{ return d->m_pppcInputPel[ch][yPos][xPos];
retValue = d->m_pppcInputPel[ch][yPos][xPos]; return 0;
if( !absolute && d->m_bHasNegativeValues )
retValue = retValue - int( d->m_uiHalfPelValue );
}
return ClpPel( retValue );
} }
CalypPixel CalypFrame::operator()( unsigned int xPos, unsigned int yPos ) const CalypPixel CalypFrame::operator()( unsigned int xPos, unsigned int yPos )
{ {
return getPixel( xPos, yPos ); return getPixel( xPos, yPos );
} }
CalypPixel CalypFrame::getPixel( unsigned int xPos, unsigned int yPos ) const CalypPixel CalypFrame::getPixel( unsigned int xPos, unsigned int yPos )
{ {
CalypPixel PixelValue( d->m_pcPelFormat->colorSpace ); CalypPixel PixelValue( d->m_pcPelFormat->colorSpace );
for( unsigned int ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) for( unsigned int ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
@@ -784,8 +720,7 @@ void CalypFrame::fillRGBBuffer()
{ {
#define PEL_ARGB( a, r, g, b ) ( ( a & 0xff ) << 24 ) | ( ( r & 0xff ) << 16 ) | ( ( g & 0xff ) << 8 ) | ( b & 0xff ) #define PEL_ARGB( a, r, g, b ) ( ( a & 0xff ) << 24 ) | ( ( r & 0xff ) << 16 ) | ( ( g & 0xff ) << 8 ) | ( b & 0xff )
#define PEL_RGB( r, g, b ) PEL_ARGB( 0xffu, r, g, b ) #define PEL_RGB( r, g, b ) PEL_ARGB( 0xffu, r, g, b )
#define CLAMP_YUV2RGB( X ) X = X < 0 ? 0 : X > 255 ? 255 : \ #define CLAMP_YUV2RGB( X ) X = X < 0 ? 0 : X > 255 ? 255 : X;
X;
#define YUV2RGB( iY, iU, iV, iR, iG, iB ) \ #define YUV2RGB( iY, iU, iV, iR, iG, iB ) \
iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 ); \ iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 ); \
iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 ); \ iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 ); \
@@ -1182,32 +1117,6 @@ double CalypFrame::getHistogramValue( unsigned channel, unsigned int bin )
return d->m_puiHistogram[indexStart + bin]; return d->m_puiHistogram[indexStart + bin];
} }
double CalypFrame::getEntropy( unsigned channel, unsigned int start, unsigned int end )
{
if( !d->m_bHasHistogram )
return 0;
channel = d->getRealHistogramChannel( channel );
if( channel < 0 )
return 0;
int indexStart = channel * d->m_uiHistoSegments;
double numValues = getNumPixelsRange( channel, start, end );
double entropy = 0.0;
for( unsigned b = start; b <= end; b++ )
{
if( d->m_puiHistogram[indexStart + b] == 0 )
continue;
double prob = d->m_puiHistogram[indexStart + b] / numValues;
entropy -= prob * log2( prob );
}
return entropy;
}
/* /*
************************************************************** **************************************************************
* interface to other libs * interface to other libs
+4 -49
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -102,11 +102,6 @@ public:
static int findPixelFormat( const ClpString& name ); static int findPixelFormat( const ClpString& name );
static int pelformatColorSpace( const int idx ); static int pelformatColorSpace( const int idx );
/**
* Default constructor. Frame is not valid
*/
CalypFrame();
/** /**
* Creates a new frame using the following configuration * Creates a new frame using the following configuration
* *
@@ -118,31 +113,6 @@ public:
*/ */
CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel = 8 ); CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel = 8 );
/**
* Creates a new frame using the following configuration
*
* @param width width of the frame
* @param height height of the frame
* @param pel_format pixel format index (always use PixelFormats enum)
*
* @note this function might misbehave if the pixel format enum is not correct
*/
CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel, bool has_negative_values );
/**
* Move contructor
*
* @param other existing frame to copy from
*/
CalypFrame( CalypFrame&& other ) noexcept;
/**
* Move assignement contructor
*
* @param other existing frame to copy from
*/
CalypFrame& operator=( CalypFrame&& other ) noexcept;
/** /**
* Copy contructor * Copy contructor
* *
@@ -151,13 +121,6 @@ public:
CalypFrame( const CalypFrame& other ); CalypFrame( const CalypFrame& other );
CalypFrame( const CalypFrame* other ); CalypFrame( const CalypFrame* other );
/**
* Copy-assignement contructor
*
* @param other existing frame to copy from
*/
CalypFrame& operator=( const CalypFrame& other );
/** /**
* Creates and new frame with the configuration of an existing one and copy * Creates and new frame with the configuration of an existing one and copy
* its contents. This function only copies a specific region from the existing * its contents. This function only copies a specific region from the existing
@@ -234,12 +197,6 @@ public:
*/ */
unsigned int getHeight( unsigned channel = 0 ) const; unsigned int getHeight( unsigned channel = 0 ) const;
/**
* Check if frame has negative values
* @return Boolean with the flag value
*/
bool getHasNegativeValues() const;
/** /**
* Get number of pixels of the frame * Get number of pixels of the frame
* @param channel/component * @param channel/component
@@ -304,10 +261,9 @@ public:
* @param ch frame channel * @param ch frame channel
* @param xPos position in X axis * @param xPos position in X axis
* @param yPos position in Y axis * @param yPos position in Y axis
* @param absolute whether it should return positive/negative values
* @return pixel value * @return pixel value
*/ */
ClpPel operator()( unsigned int ch, unsigned int xPos, unsigned int yPos, bool absolute = true ) const; ClpPel operator()( unsigned int ch, unsigned int xPos, unsigned int yPos );
/** /**
* Get pixel value at coordinates * Get pixel value at coordinates
@@ -315,7 +271,7 @@ public:
* @param yPos position in Y axis * @param yPos position in Y axis
* @return pixel value * @return pixel value
*/ */
CalypPixel operator()( unsigned int xPos, unsigned int yPos ) const; CalypPixel operator()( unsigned int xPos, unsigned int yPos );
/** /**
* Get pixel value at coordinates * Get pixel value at coordinates
@@ -323,7 +279,7 @@ public:
* @param yPos position in Y axis * @param yPos position in Y axis
* @return pixel value * @return pixel value
*/ */
CalypPixel getPixel( unsigned int xPos, unsigned int yPos ) const; CalypPixel getPixel( unsigned int xPos, unsigned int yPos );
/** /**
* Get pixel value at coordinates * Get pixel value at coordinates
@@ -407,7 +363,6 @@ public:
double getHistogramValue( unsigned channel, unsigned int bin ); double getHistogramValue( unsigned channel, unsigned int bin );
unsigned int getNEBins( unsigned channel ); unsigned int getNEBins( unsigned channel );
int getNumHistogramSegment(); int getNumHistogramSegment();
double getEntropy( unsigned channel, unsigned int start, unsigned int end );
/** /**
* interface with OpenCV lib * interface with OpenCV lib
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+9 -8
View File
@@ -38,13 +38,13 @@
#include "CalypOptions.h" #include "CalypOptions.h"
#include "config.h"
#include "lib/CalypModuleIf.h"
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include "config.h"
#include "lib/CalypModuleIf.h"
using namespace std; using namespace std;
struct ParseFailure : public std::exception struct ParseFailure : public std::exception
@@ -284,7 +284,7 @@ bool CalypOptions::hasOpt( const ClpString& optName )
void CalypOptions::addDefaultOptions() void CalypOptions::addDefaultOptions()
{ {
addOptions() /**/ addOptions() /**/
( "help", "produce help message" ) /**/ ( "help,h", "produce help message" ) /**/
( "version", "show version and exit" ) /**/ ( "version", "show version and exit" ) /**/
( "pel_fmts", "list pixel formats" ) /**/ ( "pel_fmts", "list pixel formats" ) /**/
( "quality_metrics", "list supported quality metrics" ) /**/ ( "quality_metrics", "list supported quality metrics" ) /**/
@@ -477,26 +477,27 @@ unsigned int CalypOptions::parseSHORT( unsigned int argc, char* argv[] )
return 1; return 1;
} }
int CalypOptions::parse( unsigned int argc, char* argv[] ) bool CalypOptions::parse( unsigned int argc, char* argv[] )
{ {
try try
{ {
m_aUnhandledArgs = scanArgv( argc, argv ); m_aUnhandledArgs = scanArgv( argc, argv );
if( checkListingOpts() ) if( checkListingOpts() )
{ {
return 1; return false;
} }
} }
catch( std::exception& e ) catch( std::exception& e )
{ {
std::cerr << "error: " << e.what() << "\n"; std::cerr << "error: " << e.what() << "\n";
return -1; return false;
} }
catch( ... ) catch( ... )
{ {
std::cerr << "Exception of unknown type!\n"; std::cerr << "Exception of unknown type!\n";
} }
return 0; return true;
} }
list<const char*> CalypOptions::scanArgv( unsigned int argc, char* argv[] ) list<const char*> CalypOptions::scanArgv( unsigned int argc, char* argv[] )
+3 -3
View File
@@ -40,11 +40,11 @@
#ifndef __CALYPOPTIONS_H__ #ifndef __CALYPOPTIONS_H__
#define __CALYPOPTIONS_H__ #define __CALYPOPTIONS_H__
#include "CalypDefs.h"
#include <list> #include <list>
#include <map> #include <map>
#include "CalypDefs.h"
/** /**
* \class OptionBase * \class OptionBase
* \ingroup CalypLibGrp * \ingroup CalypLibGrp
@@ -90,7 +90,7 @@ public:
CalypOptions( const ClpString& name = "" ); CalypOptions( const ClpString& name = "" );
~CalypOptions(); ~CalypOptions();
int parse( unsigned int argc, char* argv[] ); bool parse( unsigned int argc, char* argv[] );
void parse( std::vector<ClpString> args_array ); void parse( std::vector<ClpString> args_array );
std::list<const char*>& getUnhandledArgs() { return m_aUnhandledArgs; } std::list<const char*>& getUnhandledArgs() { return m_aUnhandledArgs; }
+5 -7
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -23,6 +23,7 @@
*/ */
#include "CalypFrame.h" #include "CalypFrame.h"
#include "PixelFormats.h" #include "PixelFormats.h"
#include "config.h" #include "config.h"
@@ -50,12 +51,9 @@ static inline void yuvToRgb( const int& iY, const int& iU, const int& iV, int& i
iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 ); iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 );
iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 ); iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 );
iB = iY + ( ( 1812 * ( iU - 128 ) ) >> 10 ); iB = iY + ( ( 1812 * ( iU - 128 ) ) >> 10 );
iR = iR < 0 ? 0 : iR > 255 ? 255 : iR = iR < 0 ? 0 : iR > 255 ? 255 : iR;
iR; iG = iG < 0 ? 0 : iG > 255 ? 255 : iG;
iG = iG < 0 ? 0 : iG > 255 ? 255 : iB = iB < 0 ? 0 : iB > 255 ? 255 : iB;
iG;
iB = iB < 0 ? 0 : iB > 255 ? 255 :
iB;
} }
static inline void rgbToYuv( const int& iR, const int& iG, const int& iB, int& iY, int& iU, int& iV ) static inline void rgbToYuv( const int& iR, const int& iG, const int& iB, int& iY, int& iU, int& iV )
+500
View File
@@ -0,0 +1,500 @@
/* This file is a part of Calyp project
* Copyright (C) 2014-2019 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 CalypPythonModuleIf.cpp
* \brief Calyp modules interface for python
*/
#include "CalypPythonModuleIf.h"
bool CalypPythonModuleIf::m_sbPythonInitialized = false;
// OpenCV
#include <opencv2/core/mat.hpp>
#include <opencv2/opencv.hpp>
// Python
#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION
#include <numpy/arrayobject.h>
static PyObject* opencv_error = 0;
static int failmsg( const char* fmt, ... )
{
char str[1000];
va_list ap;
va_start( ap, fmt );
vsnprintf( str, sizeof( str ), fmt, ap );
va_end( ap );
PyErr_SetString( PyExc_TypeError, str );
return 0;
}
struct ArgInfo
{
const char* name;
bool outputarg;
// more fields may be added if necessary
ArgInfo( const char* name_, bool outputarg_ )
: name( name_ )
, outputarg( outputarg_ ) {}
// to match with older pyopencv_to function signature
operator const char*() const { return name; }
};
class PyAllowThreads
{
public:
PyAllowThreads()
: _state( PyEval_SaveThread() ) {}
~PyAllowThreads()
{
PyEval_RestoreThread( _state );
}
private:
PyThreadState* _state;
};
class PyEnsureGIL
{
public:
PyEnsureGIL()
: _state( PyGILState_Ensure() ) {}
~PyEnsureGIL()
{
PyGILState_Release( _state );
}
private:
PyGILState_STATE _state;
};
#define ERRWRAP2( expr ) \
try \
{ \
PyAllowThreads allowThreads; \
expr; \
} \
catch( const cv::Exception& e ) \
{ \
PyErr_SetString( opencv_error, e.what() ); \
return 0; \
}
using namespace cv;
class NumpyAllocator : public MatAllocator
{
public:
NumpyAllocator() { stdAllocator = Mat::getStdAllocator(); }
~NumpyAllocator() {}
UMatData* allocate( PyObject* o, int dims, const int* sizes, int type, size_t* step ) const
{
UMatData* u = new UMatData( this );
u->data = u->origdata = (uchar*)PyArray_DATA( (PyArrayObject*)o );
npy_intp* _strides = PyArray_STRIDES( (PyArrayObject*)o );
for( int i = 0; i < dims - 1; i++ )
step[i] = (size_t)_strides[i];
step[dims - 1] = CV_ELEM_SIZE( type );
u->size = sizes[0] * step[0];
u->userdata = o;
return u;
}
UMatData* allocate( int dims0, const int* sizes, int type, void* data, size_t* step, int flags, UMatUsageFlags usageFlags ) const
{
if( data != 0 )
{
// issue #6969: CV_Error(Error::StsAssert, "The data should normally be NULL!");
// probably this is safe to do in such extreme case
return stdAllocator->allocate( dims0, sizes, type, data, step, flags, usageFlags );
}
PyEnsureGIL gil;
int depth = CV_MAT_DEPTH( type );
int cn = CV_MAT_CN( type );
const int f = (int)( sizeof( size_t ) / 8 );
int typenum = depth == CV_8U ? NPY_UBYTE : depth == CV_8S ? NPY_BYTE : depth == CV_16U ? NPY_USHORT : depth == CV_16S ? NPY_SHORT : depth == CV_32S ? NPY_INT : depth == CV_32F ? NPY_FLOAT : depth == CV_64F ? NPY_DOUBLE : f * NPY_ULONGLONG + ( f ^ 1 ) * NPY_UINT;
int i, dims = dims0;
cv::AutoBuffer<npy_intp> _sizes( dims + 1 );
for( i = 0; i < dims; i++ )
_sizes[i] = sizes[i];
if( cn > 1 )
_sizes[dims++] = cn;
PyObject* o = PyArray_SimpleNew( dims, _sizes, typenum );
if( !o )
CV_Error_( Error::StsError, ( "The numpy array of typenum=%d, ndims=%d can not be created", typenum, dims ) );
return allocate( o, dims0, sizes, type, step );
}
bool allocate( UMatData* u, int accessFlags, UMatUsageFlags usageFlags ) const
{
return stdAllocator->allocate( u, accessFlags, usageFlags );
}
void deallocate( UMatData* u ) const
{
if( !u )
return;
PyEnsureGIL gil;
CV_Assert( u->urefcount >= 0 );
CV_Assert( u->refcount >= 0 );
if( u->refcount == 0 )
{
PyObject* o = (PyObject*)u->userdata;
Py_XDECREF( o );
delete u;
}
}
const MatAllocator* stdAllocator;
};
NumpyAllocator g_numpyAllocator;
template <typename T>
static bool pyopencv_to( PyObject* obj, T& p, const char* name = "<unknown>" );
template <typename T>
static PyObject* pyopencv_from( const T& src );
enum
{
ARG_NONE = 0,
ARG_MAT = 1,
ARG_SCALAR = 2
};
// special case, when the converter needs full ArgInfo structure
static bool pyopencv_to( PyObject* o, Mat& m, const ArgInfo info )
{
bool allowND = true;
if( !o || o == Py_None )
{
if( !m.data )
m.allocator = &g_numpyAllocator;
return true;
}
// if( PyInt_Check(o) )
// {
// double v[] = {static_cast<double>(PyInt_AsLong((PyObject*)o)), 0., 0., 0.};
// m = Mat(4, 1, CV_64F, v).clone();
// return true;
// }
if( PyFloat_Check( o ) )
{
double v[] = {PyFloat_AsDouble( (PyObject*)o ), 0., 0., 0.};
m = Mat( 4, 1, CV_64F, v ).clone();
return true;
}
if( PyTuple_Check( o ) )
{
int i, sz = (int)PyTuple_Size( (PyObject*)o );
m = Mat( sz, 1, CV_64F );
for( i = 0; i < sz; i++ )
{
PyObject* oi = PyTuple_GET_ITEM( o, i );
// if( PyInt_Check(oi) )
// m.at<double>(i) = (double)PyInt_AsLong(oi);
// else
if( PyFloat_Check( oi ) )
m.at<double>( i ) = (double)PyFloat_AsDouble( oi );
else
{
failmsg( "%s is not a numerical tuple", info.name );
m.release();
return false;
}
}
return true;
}
if( !PyArray_Check( o ) )
{
failmsg( "%s is not a numpy array, neither a scalar", info.name );
return false;
}
PyArrayObject* oarr = (PyArrayObject*)o;
bool needcopy = false, needcast = false;
int typenum = PyArray_TYPE( oarr ), new_typenum = typenum;
int type = typenum == NPY_UBYTE ? CV_8U :
typenum == NPY_BYTE ? CV_8S :
typenum == NPY_USHORT ? CV_16U :
typenum == NPY_SHORT ? CV_16S :
typenum == NPY_INT ? CV_32S :
typenum == NPY_INT32 ? CV_32S :
typenum == NPY_FLOAT ? CV_32F :
typenum == NPY_DOUBLE ? CV_64F : -1;
if( type < 0 )
{
if( typenum == NPY_INT64 || typenum == NPY_UINT64 || typenum == NPY_LONG )
{
needcopy = needcast = true;
new_typenum = NPY_INT;
type = CV_32S;
}
else
{
failmsg( "%s data type = %d is not supported", info.name, typenum );
return false;
}
}
#ifndef CV_MAX_DIM
const int CV_MAX_DIM = 32;
#endif
int ndims = PyArray_NDIM( oarr );
if( ndims >= CV_MAX_DIM )
{
failmsg( "%s dimensionality (=%d) is too high", info.name, ndims );
return false;
}
int size[CV_MAX_DIM + 1];
size_t step[CV_MAX_DIM + 1];
size_t elemsize = CV_ELEM_SIZE1( type );
const npy_intp* _sizes = PyArray_DIMS( oarr );
const npy_intp* _strides = PyArray_STRIDES( oarr );
bool ismultichannel = ndims == 3 && _sizes[2] <= CV_CN_MAX;
for( int i = ndims - 1; i >= 0 && !needcopy; i-- )
{
// these checks handle cases of
// a) multi-dimensional (ndims > 2) arrays, as well as simpler 1- and 2-dimensional cases
// b) transposed arrays, where _strides[] elements go in non-descending order
// c) flipped arrays, where some of _strides[] elements are negative
// the _sizes[i] > 1 is needed to avoid spurious copies when NPY_RELAXED_STRIDES is set
if( ( i == ndims - 1 && _sizes[i] > 1 && (size_t)_strides[i] != elemsize ) ||
( i < ndims - 1 && _sizes[i] > 1 && _strides[i] < _strides[i + 1] ) )
needcopy = true;
}
if( ismultichannel && _strides[1] != (npy_intp)elemsize * _sizes[2] )
needcopy = true;
if( needcopy )
{
if( info.outputarg )
{
failmsg( "Layout of the output array %s is incompatible with cv::Mat (step[ndims-1] != elemsize or step[1] != elemsize*nchannels)", info.name );
return false;
}
if( needcast )
{
o = PyArray_Cast( oarr, new_typenum );
oarr = (PyArrayObject*)o;
}
else
{
oarr = PyArray_GETCONTIGUOUS( oarr );
o = (PyObject*)oarr;
}
_strides = PyArray_STRIDES( oarr );
}
// Normalize strides in case NPY_RELAXED_STRIDES is set
size_t default_step = elemsize;
for( int i = ndims - 1; i >= 0; --i )
{
size[i] = (int)_sizes[i];
if( size[i] > 1 )
{
step[i] = (size_t)_strides[i];
default_step = step[i] * size[i];
}
else
{
step[i] = default_step;
default_step *= size[i];
}
}
// handle degenerate case
if( ndims == 0 )
{
size[ndims] = 1;
step[ndims] = elemsize;
ndims++;
}
if( ismultichannel )
{
ndims--;
type |= CV_MAKETYPE( 0, size[2] );
}
if( ndims > 2 && !allowND )
{
failmsg( "%s has more than 2 dimensions", info.name );
return false;
}
m = Mat( ndims, size, type, PyArray_DATA( oarr ), step );
m.u = g_numpyAllocator.allocate( o, ndims, size, type, step );
m.addref();
if( !needcopy )
{
Py_INCREF( o );
}
m.allocator = &g_numpyAllocator;
return true;
}
template <>
bool pyopencv_to( PyObject* o, Mat& m, const char* name )
{
return pyopencv_to( o, m, ArgInfo( name, 0 ) );
}
template <typename _Tp, int m, int n>
bool pyopencv_to( PyObject* o, Matx<_Tp, m, n>& mx, const ArgInfo info )
{
Mat tmp;
if( !pyopencv_to( o, tmp, info ) )
{
return false;
}
tmp.copyTo( mx );
return true;
}
template <typename _Tp, int m, int n>
bool pyopencv_to( PyObject* o, Matx<_Tp, m, n>& mx, const char* name )
{
return pyopencv_to( o, mx, ArgInfo( name, 0 ) );
}
template <typename T>
bool pyopencv_to( PyObject* o, Ptr<T>& p, const char* name )
{
if( !o || o == Py_None )
return true;
p = makePtr<T>();
return pyopencv_to( o, *p, name );
}
template <>
PyObject* pyopencv_from( const Mat& m )
{
if( !m.data )
Py_RETURN_NONE;
Mat temp, *p = (Mat*)&m;
if( !p->u || p->allocator != &g_numpyAllocator )
{
temp.allocator = &g_numpyAllocator;
ERRWRAP2( m.copyTo( temp ) );
p = &temp;
}
PyObject* o = (PyObject*)p->u->userdata;
Py_INCREF( o );
return o;
}
bool CalypPythonModuleIf::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
// initialize Python embedding
if( !m_sbPythonInitialized )
{
Py_Initialize();
// Initialize numpy library
import_array1( -1 );
m_sbPythonInitialized = true;
}
#if PY_MAJOR_VERSION >= 3
PyObject* pName = PyUnicode_DecodeFSDefault( m_pchPythonFunctionName );
#else
PyObject* pName = PyString_FromString( m_pchPythonFunctionName );
#endif
m_pyModule = PyImport_Import( pName );
m_pyFunction = PyObject_GetAttrString( m_pyModule, "ClpModule" );
Py_DECREF( pName );
if( !m_pyFunction || !PyCallable_Check( m_pyFunction ) )
{
return false;
}
unsigned pelFormat = m_bConvertToGray ? CalypFrame::findPixelFormat( "GRAY" ) : apcFrameList[0]->getPelFormat();
m_pcOutputFrame = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), pelFormat, apcFrameList[0]->getBitsPel() );
return true;
}
CalypFrame* CalypPythonModuleIf::process( std::vector<CalypFrame*> apcFrameList )
{
m_pcOutputFrame->reset();
if( m_pyFunction && PyCallable_Check( m_pyFunction ) )
{
Mat cvMatOutput;
Mat cvMatInput[m_uiNumberOfFrames];
PyObject* pyInputArg = PyTuple_New( apcFrameList.size() );
for( unsigned i = 0; i < apcFrameList.size(); i++ )
{
apcFrameList[0]->toMat( cvMatInput[i], m_bConvertToGray, false );
PyObject* pyMat = pyopencv_from( cvMatInput[i] );
/* pValue reference stolen here: */
PyTuple_SetItem( pyInputArg, i, pyMat );
}
// execute the function
PyObject* pyResult = PyEval_CallObject( m_pyFunction, pyInputArg );
if( !pyResult )
return m_pcOutputFrame;
pyopencv_to( pyResult, cvMatOutput );
// decrement the object references
Py_XDECREF( pyResult );
Py_XDECREF( pyInputArg );
m_pcOutputFrame->fromMat( cvMatOutput, CLP_LUMA );
}
return m_pcOutputFrame;
}
void CalypPythonModuleIf::destroy()
{
Py_XDECREF( m_pyFunction );
//#if PY_MAJOR_VERSION >= 3
// Py_FinalizeEx();
//#else
// Py_Finalize();
//#endif
if( m_pcOutputFrame )
delete m_pcOutputFrame;
m_pcOutputFrame = NULL;
}
@@ -18,36 +18,44 @@
*/ */
/** /**
* \file ThreeSixtyNxN.h * \file CalypPythonModuleIf.h
* \brief Downsampling ERP to NxN * \ingroup CalypLibGroup
* \brief Calyp modules interface for python
*/ */
#ifndef __THREESIXTYNXN_H__ #ifndef __CALYPPYTHONMODULEIF_H__
#define __THREESIXTYNXN_H__ #define __CALYPPYTHONMODULEIF_H__
// CalypLib #include "CalypModuleIf.h"
#include "lib/CalypModuleIf.h"
#include "opencv2/core/mat.hpp"
#include "opencv2/core/types.hpp"
using cv::Mat; // Python
using cv::Mat_; #include <Python.h>
using cv::Point;
class ThreeSixtyNxN : public CalypModuleIf /**
* \class CalypPythonModuleIf
* \ingroup CalypLib Calyp_Modules
* \brief Abstract class for modules using python language
*/
class CalypPythonModuleIf : public CalypModuleIf
{ {
REGISTER_CLASS_FACTORY( ThreeSixtyNxN )
private: private:
unsigned m_uiDownsampling; static bool m_sbPythonInitialized;
void downsamplingOperation( const CalypFrame* pcInputFrame ); PyObject* m_pyModule;
void upsamplingOperation( const CalypFrame* pcInputFrame ); PyObject* m_pyFunction;
protected:
const char* m_pchPythonFunctionName;
bool m_bConvertToGray;
public: public:
ThreeSixtyNxN(); CalypPythonModuleIf()
virtual ~ThreeSixtyNxN() {} {
m_bConvertToGray = false;
};
virtual ~CalypPythonModuleIf() {}
bool create( std::vector<CalypFrame*> apcFrameList ); bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList ); CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy(); void destroy();
}; };
#endif // __THREESIXTYNXN_H__ #endif // __CALYPPYTHONMODULEIF_H__
+6 -12
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -103,11 +103,11 @@ private:
unsigned int m_uiIndex; unsigned int m_uiIndex;
public: public:
CalypStreamBufferPrivate( unsigned int size, unsigned int width, unsigned int height, int pelFormat, int bitsPixel, bool hasNegative ) CalypStreamBufferPrivate( unsigned int size, unsigned int width, unsigned int height, int pelFormat, int bitsPixel )
{ {
for( unsigned int i = 0; i < size; i++ ) for( unsigned int i = 0; i < size; i++ )
{ {
CalypFrame* pFrame = new CalypFrame( width, height, pelFormat, bitsPixel, hasNegative ); CalypFrame* pFrame = new CalypFrame( width, height, pelFormat, bitsPixel );
m_apcFrameBuffer.push_back( pFrame ); m_apcFrameBuffer.push_back( pFrame );
} }
m_uiIndex = 0; m_uiIndex = 0;
@@ -238,7 +238,7 @@ ClpString CalypStream::getCodecName() const
return !d->handler ? "" : d->handler->getCodecName(); 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( ClpString filename, ClpString resolution, ClpString input_format_name, unsigned int bitsPel, int endianness,
unsigned int frame_rate, bool bInput ) unsigned int frame_rate, bool bInput )
{ {
unsigned int width = 0; unsigned int width = 0;
@@ -261,17 +261,11 @@ bool CalypStream::open( ClpString filename, ClpString resolution, ClpString inpu
break; break;
} }
} }
return open( filename, width, height, input_format, bitsPel, endianness, hasNegative, frame_rate, bInput ); return open( filename, width, height, input_format, bitsPel, endianness, 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( ClpString filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness,
unsigned int frame_rate, bool bInput ) 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,
unsigned int frame_rate, bool bInput )
{ {
if( d->isInit ) if( d->isInit )
{ {
@@ -320,7 +314,7 @@ bool CalypStream::open( ClpString filename, unsigned int width, unsigned int hei
try try
{ {
d->frameBuffer = new CalypStreamBufferPrivate( d->isInput ? 3 : 1, d->handler->m_uiWidth, d->handler->m_uiHeight, d->frameBuffer = new CalypStreamBufferPrivate( d->isInput ? 3 : 1, d->handler->m_uiWidth, d->handler->m_uiHeight,
d->handler->m_iPixelFormat, d->handler->m_uiBitsPerPixel, hasNegative ); d->handler->m_iPixelFormat, d->handler->m_uiBitsPerPixel );
} }
catch( CalypFailure& e ) catch( CalypFailure& e )
{ {
+2 -5
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -72,13 +72,10 @@ public:
ClpString getCodecName() const; ClpString getCodecName() const;
; ;
bool open( ClpString filename, ClpString resolution, ClpString input_format, unsigned int bitsPel, int endianness, bool hasNegative, unsigned int frame_rate, bool open( ClpString filename, ClpString resolution, ClpString input_format, unsigned int bitsPel, int endianness, unsigned int frame_rate,
bool bInput ); 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( ClpString filename, unsigned int width, unsigned int height, int input_format, unsigned int bitsPel, int endianness, unsigned int frame_rate,
bool bInput ); 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 bInput );
bool reload(); bool reload();
void close(); void close();
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -25,10 +25,10 @@
#ifndef __PIXELFORMATS_H__ #ifndef __PIXELFORMATS_H__
#define __PIXELFORMATS_H__ #define __PIXELFORMATS_H__
#include <map>
#include "CalypFrame.h" #include "CalypFrame.h"
#include <map>
#define CHROMA_RESAMPLING( X ) ( ( ( X + 1 ) >> 1 ) << 1 ) #define CHROMA_RESAMPLING( X ) ( ( ( X + 1 ) >> 1 ) << 1 )
#define CHROMARATIO( SIZE, RATIO ) ( RATIO > 1 ? ( ( SIZE + 1 ) / RATIO ) : SIZE ) #define CHROMARATIO( SIZE, RATIO ) ( RATIO > 1 ? ( ( SIZE + 1 ) / RATIO ) : SIZE )
+5 -5
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -24,13 +24,13 @@
#include "StreamHandlerLibav.h" #include "StreamHandlerLibav.h"
#include <cstdio>
#include <iostream>
#include "CalypFrame.h" #include "CalypFrame.h"
#include "LibMemory.h" #include "LibMemory.h"
#include "PixelFormats.h" #include "PixelFormats.h"
#include <cstdio>
#include <iostream>
#if( ( LIBAVCODEC_VERSION_MAJOR > 57 ) || ( LIBAVCODEC_VERSION_MAJOR == 57 ) && ( LIBAVCODEC_VERSION_MINOR >= 37 ) ) #if( ( LIBAVCODEC_VERSION_MAJOR > 57 ) || ( LIBAVCODEC_VERSION_MAJOR == 57 ) && ( LIBAVCODEC_VERSION_MINOR >= 37 ) )
#define FF_SEND_RECEIVE_API #define FF_SEND_RECEIVE_API
#define FF_USER_CODEC_PARAM #define FF_USER_CODEC_PARAM
@@ -91,7 +91,7 @@ bool StreamHandlerLibav::openHandler( ClpString strFilename, bool bInput )
// } // }
// Register all components of FFmpeg // Register all components of FFmpeg
//av_register_all(); av_register_all();
/* open input file, and allocate format context */ /* open input file, and allocate format context */
if( avformat_open_input( &m_cFmtCtx, filename, NULL, NULL ) < 0 ) if( avformat_open_input( &m_cFmtCtx, filename, NULL, NULL ) < 0 )
+1 -2
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -27,7 +27,6 @@
#define __STREAMHANDLERLIBAV_H__ #define __STREAMHANDLERLIBAV_H__
#include <inttypes.h> #include <inttypes.h>
#include <string> #include <string>
#include <vector> #include <vector>
Loaded 100 of 184 files, more files were not shown because too many files have changed in this diff. Show more