Author SHA1 Message Date
jfmcarreira dd49089309 Add new functions to stream modules 2018-11-21 21:22:33 +00:00
jfmcarreira 3489deda20 Changes to start implement stream modules 2018-10-18 21:59:36 +01:00
166 changed files with 12256 additions and 15228 deletions

No files matched your search

-45
View File
@@ -1,45 +0,0 @@
image: Visual Studio 2017
configuration: Release
platform:
- x64
environment:
access_token:
secure: SMxOWNKN0RkPvICWhIet2FJM5g/zx5mguM/XAPjM2OrC3U2/LAqcBZw0veS9peS4
clone_folder: C:\Projects\calyp
init:
- ps: Add-Content "$HOME\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n"
- git config --global credential.helper store
- git config --global user.email "jfmcarreira@gmail.com"
- git config --global user.name "AppVeyor"
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
install:
- '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64'
- choco install nsis
- choco install opencv
- 'C:\Tools\opencv\build\setup_vars_opencv4.cmd'
- cd C:\Projects
- ps: Start-FileDownload 'https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z' ffmpeg.7z
- 7z x ffmpeg.7z -y -offmpeg
- git clone https://github.com/pixlra/calyp-deployment.git
- CALL calyp-deployment/scripts/extract_ffmpeg.bat
build_script:
- mv C:\Projects\calyp C:\Projects\calyp-deployment\cmake-helper\
- mkdir C:\Projects\calyp-build
- cd C:\Projects\calyp-build
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DUSE_DYNLOAD=OFF -DOpenCV_DIR="C:/Tools/opencv/build" -DOpenCV_DLL_DIR="C:/Tools/opencv/build/x64/vc15/bin" -DOpenCV_INSTALL_MODULES="world" -DQT_DIR="C:\Qt\latest\msvc2017_64" -DQt5_DIR="C:\Qt\latest\msvc2017_64\lib\cmake\Qt5" -DUSE_QTDBUS=OFF -DAVFORMAT_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avformat.lib -DAVFORMAT_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DAVCODEC_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avcodec.lib -DAVCODEC_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DAVUTIL_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avutil.lib -DAVUTIL_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DSWSCALE_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/swscale.lib -DSWSCALE_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -G "Visual Studio 15 2017 Win64" C:\Projects\calyp-deployment\cmake-helper
- cmake --build . --target ALL_BUILD -- /p:Configuration=Release > log_build
- cmake --build . --target INSTALL -- /p:Configuration=Release > log_install
- cmake --build . --target PACKAGE -- /p:Configuration=Release > log_pkg
after_build:
- IF "%APPVEYOR_REPO_BRANCH%" == "master" (CALL ..\calyp-deployment\scripts\deploy-to-github.bat)
on_failure:
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
-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'
-145
View File
@@ -1,145 +0,0 @@
# Created by https://www.gitignore.io/api/c++,clion,linux
# Edit at https://www.gitignore.io/?templates=c++,clion,linux
### C++ ###
# Prerequisites
*.d
# Clang
.cache/
# Compiled Object files
*.slo
*.lo
*.o
*.obj
# Precompiled Headers
*.gch
*.pch
# Compiled Dynamic libraries
*.so
*.dylib
*.dll
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
*.la
*.a
*.lib
# Executables
*.exe
*.out
*.app
### CLion ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# CMake
bin/
build/
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
### CLion Patch ###
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
# *.iml
# modules.xml
# .idea/misc.xml
# *.ipr
# Sonarlint plugin
.idea/sonarlint
### Linux ###
*~
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### vscode ###
.vscode/*
*.code-workspace
# Documentation
doc/
# CLang
compile_commands.json
-27
View File
@@ -1,27 +0,0 @@
fail_fast: false
repos:
- 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
- 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]
+2 -3
View File
@@ -2,6 +2,5 @@ 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 - sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev
script: script: mkdir -p build && cd build && cmake .. && make && cd ..
- mkdir -p build && cd build && cmake -DBUILD_TESTS=ON .. && make && && make test && cd ..
+142 -180
View File
@@ -1,265 +1,227 @@
# ###
# CMakeLists for calyp ### CMakeLists for calyp
# ###
CMAKE_MINIMUM_REQUIRED(VERSION 3.2.0) cmake_minimum_required( VERSION 3.2.0 )
# #################################################################################################################################################### ######################################################################################
# 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 # Project Definition
# #################################################################################################################################################### ######################################################################################
SET(PROJECT_NAME SET( PROJECT_NAME "calyp" CACHE INTERNAL "" FORCE )
"calyp" SET( PROJECT_LIBRARY "Calyp" CACHE INTERNAL "" FORCE )
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
)
# #################################################################################################################################################### PROJECT( ${PROJECT_NAME} )
SET( CALYP_VERSION_MAJOR "1" )
SET( CALYP_VERSION_MINOR "0" )
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(USE_FERVOR "Add Fervor support" OFF) OPTION( USE_FERVOR "Add Fervor support" OFF )
OPTION(USE_DYNLOAD "Use dynamic load of modules" ON) OPTION( USE_DYNLOAD "Use dynamic load of modules" ON )
OPTION(USE_SSE "Build with SSE support" OFF) 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)
SET(BUILD_DOC ${GTEST_FOUND}) SET( BUILD_DOC ${GTEST_FOUND} )
IF(GTEST_FOUND) IF( GTEST_FOUND )
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() ENDIF()
OPTION(USE_OPENCV "Add OpenCV support" ON) OPTION( USE_OPENCV "Add OpenCV support" ON )
IF(USE_OPENCV) IF( USE_OPENCV )
LIST(APPEND OPENCV_MODULES core highgui imgproc video videoio )
FIND_PACKAGE(OpenCV COMPONENTS core highgui imgproc video) FIND_PACKAGE( OpenCV COMPONENTS ${OPENCV_MODULES} )
IF(${OpenCV_FOUND}) SET(USE_OPENCV ${OpenCV_FOUND})
SET(USE_OPENCV TRUE)
LIST(APPEND OPENCV_MODULES core highgui imgproc video)
FIND_PACKAGE(OpenCV COMPONENTS videoio photo)
IF(${OPENCV_VIDEOIO_FOUND})
LIST(APPEND OPENCV_MODULES videoio)
ENDIF()
IF(${OPENCV_PHOTO_FOUND})
LIST(APPEND OPENCV_MODULES photo)
ENDIF()
ELSE()
SET(USE_OPENCV FALSE)
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") IF( "${AVCODEC_VERSION}" VERSION_LESS "56.0.0" )
SET(FFMPEG_FOUND FALSE) SET(FFMPEG_FOUND FALSE )
SET(FFmpeg_FOUND FALSE) SET(FFmpeg_FOUND FALSE )
ENDIF() 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/"
DESCRIPTION "Libav library support in CalypStream"
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
# ####################################################################################################################################################
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) ######################################################################################
# CMake Defin1itions
######################################################################################
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()
SET(CMAKE_CXX_FLAGS "") 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()
IF (NOT CMAKE_BUILD_TYPE )
MESSAGE(STATUS "No build type selected, default to Release")
SET(CMAKE_BUILD_TYPE "Release")
ENDIF() ENDIF()
IF(NOT CMAKE_BUILD_TYPE) SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
MESSAGE(STATUS "No build type selected, default to Release")
SET(CMAKE_BUILD_TYPE "Release") ADD_DEFINITIONS(-DQT_NO_CAST_TO_ASCII
#-DQT_NO_CAST_FROM_ASCII
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY
#-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")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op" )
endif()
endif()
IF( USE_WERROR )
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" )
ENDIF() ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0" )
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2" )
ADD_DEFINITIONS(
-DQT_NO_CAST_TO_ASCII
# -DQT_NO_CAST_FROM_ASCII
-DQT_NO_URL_CAST_FROM_STRING
-DQT_NO_CAST_FROM_BYTEARRAY
# -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")
IF(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op")
ENDIF()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
ENDIF()
IF(USE_WERROR)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
ENDIF()
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
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" )
ADD_FEATURE_INFO(DynLoad USE_DYNLOAD "Support for dynamic module load") ADD_FEATURE_INFO(DynLoad USE_DYNLOAD "Support for dynamic module load" )
ADD_FEATURE_INFO(SSE USE_SSE "SSE instructions support") ADD_FEATURE_INFO(SSE USE_SSE "SSE instructions support" )
ADD_FEATURE_INFO(WErrors USE_WERROR "Warnings as errors") ADD_FEATURE_INFO(WErrors USE_WERROR "Warnings as errors" )
ADD_SUBDIRECTORY(lib) ADD_SUBDIRECTORY( lib )
ADD_SUBDIRECTORY(modules) ADD_SUBDIRECTORY( modules )
IF(${BUILD_TOOLS}) IF( ${BUILD_TOOLS} )
ADD_SUBDIRECTORY(tools) ADD_SUBDIRECTORY( tools )
ENDIF() ENDIF()
IF(${BUILD_APP}) IF( ${BUILD_APP} )
ADD_SUBDIRECTORY(app) ADD_SUBDIRECTORY( app )
ENDIF() ENDIF()
IF(${BUILD_EXAMPLES}) 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}" )
MESSAGE(STATUS "Configuration:") MESSAGE( STATUS "Configuration:" )
MESSAGE(STATUS " Static libs: " "${USE_STATIC}") MESSAGE( STATUS " Static libs: " "${USE_STATIC}" )
MESSAGE(STATUS " Build type: " "${CMAKE_BUILD_TYPE}") MESSAGE( STATUS " Build type: " "${CMAKE_BUILD_TYPE}" )
MESSAGE(STATUS " Build flags: " "${CMAKE_CXX_FLAGS}") MESSAGE( STATUS " Build flags: " "${CMAKE_CXX_FLAGS}" )
FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
+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
```
*/ */
+8 -17
View File
@@ -1,12 +1,6 @@
# Calyp # Calyp
## Enhanced YUV video player based on Qt focusing on image/video analysis ## Enhanced YUV video player based on Qt focusing on image/video analysis
## Build Status
Master branch | Development branch
------------ | -------------
[![Linux Status](https://travis-ci.org/pixlra/calyp.svg?branch=master)](https://travis-ci.org/pixlra/calyp.svg?branch=master) [![Windows status](https://ci.appveyor.com/api/projects/status/ea2ktvtg7uqwrika/branch/master?svg=true)](https://ci.appveyor.com/project/jfmcarreira/calyp/branch/master) | Comming soon!
## Features ## Features
- Support for libavformat and libavcodec; - Support for libavformat and libavcodec;
@@ -29,10 +23,9 @@ Master branch | Development branch
- CalypTools: High level command line interface - CalypTools: High level command line interface
## 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
@@ -60,16 +53,14 @@ Master branch | Development branch
* Windows Bitmap (bmp) * Windows Bitmap (bmp)
* Tagged Image File Format (tiff) * Tagged Image File Format (tiff)
## Development Team ## 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)
### Binaries and Build ### Binaries and Build
* Packages are available for [Debian](https://launchpad.net/~pixlra/+archive/ubuntu/ppa) * Packages are available for [Debian](https://launchpad.net/~pixlra/+archive/ubuntu/ppa) and [openSUSE](https://software.opensuse.org/package/playuver)
* **Daily builds** available for [Windows](https://github.com/pixlra/calyp-releases/blob/master/installers/win/calyp-latest.exe) * **Daily builds** available for Windows and Linux in our [SourceForge page](https://sourceforge.net/projects/playuver/)
* **Dependencies** * **Dependencies**
1. an ordinary C++ development environment (g++, make, C++ libraries and headers, ...) 1. an ordinary C++ development environment (g++, make, C++ libraries and headers, ...)
2. cmake 2. cmake
+73 -80
View File
@@ -1,155 +1,148 @@
# ###
# 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 )
ADD_SUBDIRECTORY(external) ADD_SUBDIRECTORY( external )
FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent) FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent )
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent) LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent )
LIST(APPEND QT_MODULES Core Gui Widgets Concurrent) 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 IF( ${Qt5DBus_FOUND} )
DESCRIPTION "Support for Qt5 DBus messages between instances" SET( USE_QTDBUS ${Qt5DBus_FOUND} ) # TODO: fix this stupid variable
TYPE OPTIONAL SET( USE_QTDBUS ${Qt5DBus_FOUND} PARENT_SCOPE)
) LIST(APPEND QT_LINKER_LIBS Qt5::DBus )
IF(${Qt5DBus_FOUND}) LIST(APPEND QT_MODULES DBus )
SET(USE_QTDBUS ${Qt5DBus_FOUND}) # TODO: fix this stupid variable
SET(USE_QTDBUS
${Qt5DBus_FOUND}
PARENT_SCOPE
)
LIST(APPEND QT_LINKER_LIBS Qt5::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
# Module SubWindow # Module SubWindow
SubWindowHandle.cpp SubWindowHandle.cpp
MdiSubWindow.cpp MdiSubWindow.cpp
SubWindowAbstract.cpp SubWindowAbstract.cpp
# Module Video # Module Video
VideoHandle.cpp VideoHandle.cpp
VideoSubWindow.cpp VideoSubWindow.cpp
ViewArea.cpp ViewArea.cpp
GridManager.cpp GridManager.cpp
# Module Quality # Module Quality
QualityHandle.cpp QualityHandle.cpp
PlotSubWindow.cpp PlotSubWindow.cpp
external/qcustomplot/qcustomplot.cpp external/qcustomplot/qcustomplot.cpp
# Module Plugins # Module Plugins
ModulesHandle.cpp ModulesHandle.cpp
CalypAppModuleIf.cpp CalypAppModuleIf.cpp
# Dialogs # Dialogs
dialog/AboutDialog.cpp dialog/AboutDialog.cpp
dialog/ConfigureFormatDialog.cpp dialog/ConfigureFormatDialog.cpp
dialog/SubWindowSelectorDialog.cpp dialog/SubWindowSelectorDialog.cpp
dialog/ProgressBar.cpp dialog/ProgressBar.cpp
dialog/SeekStreamDialog.cpp dialog/SeekStreamDialog.cpp
dialog/ModulesHandleOptDialog.cpp dialog/ModulesHandleOptDialog.cpp
# Widgets # Widgets
widgets/HistogramWidget.cpp widgets/HistogramWidget.cpp
widgets/FrameNumberWidget.cpp widgets/FrameNumberWidget.cpp
# Docks # Docks
docks/FramePropertiesDock.cpp docks/FramePropertiesDock.cpp
docks/ModuleHandleDock.cpp docks/ModuleHandleDock.cpp
docks/QualityMeasurementSidebar.cpp docks/QualityMeasurementSidebar.cpp
) )
IF(USE_QTDBUS) 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 "" )
IF(USE_FERVOR) set(Calyp_App_RCC
resources/${PROJECT_NAME}.qrc
)
SET(FERVOR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/fervor)
IF(EXISTS ${FERVOR_DIR}) IF( USE_FERVOR )
SET(FERVOR_APP_NAME ${PROJECT_NAME}) SET( FERVOR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/fervor )
SET(FERVOR_APP_VERSION ${CALYP_VERSION_STRING})
ADD_SUBDIRECTORY(${FERVOR_DIR}) IF(EXISTS ${FERVOR_DIR} )
INCLUDE_DIRECTORIES(${FERVOR_DIR}) SET( FERVOR_APP_NAME ${PROJECT_NAME} )
SET( FERVOR_APP_VERSION ${CALYP_VERSION_STRING} )
LIST(APPEND APP_LINKER_LIBS Fervor) ADD_SUBDIRECTORY( ${FERVOR_DIR} )
FIND_PACKAGE(Qt5 REQUIRED Network WebKit WebKitWidgets) INCLUDE_DIRECTORIES( ${FERVOR_DIR} )
LIST(APPEND QT_LINKER_LIBS Qt5::Network Qt5::WebKit Qt5::WebKitWidgets) LIST(APPEND APP_LINKER_LIBS Fervor )
LIST(APPEND QT_MODULES Network WebKit WebKitWidgets)
# LIST(APPEND APP_LINKER_LIBS ${FERVOR_DEPENDENCIES} ) FIND_PACKAGE( Qt5 REQUIRED Network WebKit WebKitWidgets )
INCLUDE_DIRECTORIES(${FERVOR_INCLUDE_DIRS})
LIST(APPEND QT_LINKER_LIBS Qt5::Network Qt5::WebKit Qt5::WebKitWidgets )
LIST(APPEND QT_MODULES Network WebKit WebKitWidgets )
# LIST(APPEND APP_LINKER_LIBS ${FERVOR_DEPENDENCIES} )
INCLUDE_DIRECTORIES( ${FERVOR_INCLUDE_DIRS} )
SET(QT_USE_QTNETWORK true) SET(QT_USE_QTNETWORK true)
SET(QT_USE_QTWEBKIT true) SET(QT_USE_QTWEBKIT true)
ELSE() ELSE()
MESSAGE("Fervor lib source code is not find in ${FERVOR_DIR}... Disabling it!") MESSAGE( "Fervor lib source code is not find in ${FERVOR_DIR}... Disabling it!" )
SET(USE_FERVOR False) SET( USE_FERVOR False )
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} )
QT5_ADD_RESOURCES(Calyp_App_RCC ${Calyp_App_RCC}) QT5_ADD_RESOURCES( Calyp_App_RCC ${Calyp_App_RCC} )
# Instruct CMake to run moc automatically when needed. # Instruct CMake to run moc automatically when needed.
SET(CMAKE_AUTOMOC ON) 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()
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) 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 )
# QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} ) # QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} )
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin) 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 )
+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-2018 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 )
@@ -74,19 +74,19 @@ bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
bool bRet = false; bool bRet = false;
QApplication::setOverrideCursor( Qt::WaitCursor ); QApplication::setOverrideCursor( Qt::WaitCursor );
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
{
if( m_pcDisplaySubWindow )
{
m_pcDisplaySubWindow->setFillWindow( true );
}
else
{
m_pcSubWindow[0]->setFillWindow( true );
}
}
if( !( isPlaying && ( m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY ) ) ) if( !( isPlaying && ( m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY ) ) )
{ {
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
{
if( m_pcDisplaySubWindow )
{
m_pcDisplaySubWindow->setFillWindow( true );
}
else
{
m_pcSubWindow[0]->setFillWindow( true );
}
}
#ifdef CALYP_THREADED_MODULES #ifdef CALYP_THREADED_MODULES
if( !disableThreads ) if( !disableThreads )
{ {
@@ -123,27 +123,27 @@ void CalypAppModuleIf::run()
apcFrameList.push_back( m_pcSubWindow[i]->getCurrFrame() ); apcFrameList.push_back( m_pcSubWindow[i]->getCurrFrame() );
} }
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE ) if( m_pcModule->m_iModuleAPI == CLP_MODULE_API_1 )
{ {
if( m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 ) if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
{
m_pcProcessedFrame = m_pcModule->process( apcFrameList[0] );
}
else if( m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
{
m_dMeasurementResult = m_pcModule->measure( apcFrameList[0] );
}
}
else if( m_pcModule->m_iModuleAPI == CLP_MODULE_API_2 )
{
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
{ {
m_pcProcessedFrame = m_pcModule->process( apcFrameList ); m_pcProcessedFrame = m_pcModule->process( apcFrameList );
} }
else else if( m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
{
m_pcProcessedFrame = m_pcModule->process( m_pcSubWindow[0]->getCurrFrame() );
}
}
else if( m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
{
if( m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
{ {
m_dMeasurementResult = m_pcModule->measure( apcFrameList ); m_dMeasurementResult = m_pcModule->measure( apcFrameList );
} }
else
{
m_dMeasurementResult = m_pcModule->measure( m_pcSubWindow[0]->getCurrFrame() );
}
} }
else else
{ {
+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-2018 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,6 @@
#ifndef __CALYPAPPMODULESIF_H__ #ifndef __CALYPAPPMODULESIF_H__
#define __CALYPAPPMODULESIF_H__ #define __CALYPAPPMODULESIF_H__
#include <QEvent>
#include <QVector>
#include <cstdio>
#include <iostream>
#include "CommonDefs.h" #include "CommonDefs.h"
#include "ModuleHandleDock.h" #include "ModuleHandleDock.h"
#include "config.h" #include "config.h"
@@ -37,6 +32,11 @@
#include "lib/CalypModuleIf.h" #include "lib/CalypModuleIf.h"
#include "lib/CalypStream.h" #include "lib/CalypStream.h"
#include <QEvent>
#include <QVector>
#include <cstdio>
#include <iostream>
class QAction; class QAction;
class QDockWidget; class QDockWidget;
+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-2018 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-2018 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
@@ -35,8 +35,8 @@ DBusAppAdaptor::DBusAppAdaptor( MainWindow* app )
: QDBusAbstractAdaptor( app ), m_app( app ) : QDBusAbstractAdaptor( app ), m_app( app )
{ {
// application dbus interface // application dbus interface
bool isRegistered = QDBusConnection::sessionBus().registerObject( QStringLiteral( CALYP_DBUS_PATH ), QStringLiteral( CALYP_DBUS_SESSION_NAME ), bool isRegistered = QDBusConnection::sessionBus().registerObject( QStringLiteral( CALYP_DBUS_PATH ), this,
this, QDBusConnection::ExportAllSlots ); QDBusConnection::ExportAllSlots );
Q_ASSERT( isRegistered == true ); Q_ASSERT( isRegistered == 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-2018 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-2018 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-2018 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"
+12 -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-2018 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;
} }
@@ -287,7 +287,7 @@ QStringList MainWindow::showFileDialog( bool bRead )
{ {
QString fileName = QFileDialog::getSaveFileName( this, tr( "Save File" ), m_cLastOpenPath, filter.join( ";;" ) ); QString fileName = QFileDialog::getSaveFileName( this, tr( "Save File" ), m_cLastOpenPath, filter.join( ";;" ) );
if( !fileName.isEmpty() ) if( !fileName.isEmpty() )
fileNameList.append( fileName ); fileNameList.append( fileName );
} }
return fileNameList; return fileNameList;
} }
+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-2018 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-2018 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-2018 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"
+53 -43
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-2018 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,8 +24,6 @@
#include "ModulesHandle.h" #include "ModulesHandle.h"
#include <cstdio>
#include "MainWindow.h" #include "MainWindow.h"
#include "ModulesHandleOptDialog.h" #include "ModulesHandleOptDialog.h"
#include "SubWindowHandle.h" #include "SubWindowHandle.h"
@@ -34,6 +32,8 @@
#include "VideoSubWindow.h" #include "VideoSubWindow.h"
#include "modules/CalypModulesFactory.h" #include "modules/CalypModulesFactory.h"
#include <cstdio>
ModulesHandle::ModulesHandle( QWidget* parent, SubWindowHandle* windowManager, VideoHandle* moduleVideo ) ModulesHandle::ModulesHandle( QWidget* parent, SubWindowHandle* windowManager, VideoHandle* moduleVideo )
: QWidget( parent ), m_pcParent( parent ), m_pcMainWindowManager( windowManager ), m_appModuleVideo( moduleVideo ) : QWidget( parent ), m_pcParent( parent ), m_pcMainWindowManager( windowManager ), m_appModuleVideo( moduleVideo )
{ {
@@ -112,24 +112,21 @@ void ModulesHandle::buildMenu()
ModuleIfinternalName = QString::fromLocal8Bit( it->first ); ModuleIfinternalName = QString::fromLocal8Bit( it->first );
currSubMenu = NULL; currSubMenu = NULL;
if( pcCurrModuleIf->m_iModuleAPI <= CLP_MODULE_API_2 ) if( pcCurrModuleIf->m_pchModuleCategory )
{ {
if( pcCurrModuleIf->m_pchModuleCategory ) for( int j = 0; j < m_pcModulesSubMenuList.size(); j++ )
{ {
for( int j = 0; j < m_pcModulesSubMenuList.size(); j++ ) if( m_pcModulesSubMenuList.at( j )->title() == QString( pcCurrModuleIf->m_pchModuleCategory ) )
{ {
if( m_pcModulesSubMenuList.at( j )->title() == QString( pcCurrModuleIf->m_pchModuleCategory ) ) currSubMenu = m_pcModulesSubMenuList.at( j );
{ break;
currSubMenu = m_pcModulesSubMenuList.at( j );
break;
}
}
if( !currSubMenu )
{
currSubMenu = m_pcModulesMenu->addMenu( pcCurrModuleIf->m_pchModuleCategory );
m_pcModulesSubMenuList.append( currSubMenu );
} }
} }
if( !currSubMenu )
{
currSubMenu = m_pcModulesMenu->addMenu( pcCurrModuleIf->m_pchModuleCategory );
m_pcModulesSubMenuList.append( currSubMenu );
}
} }
currAction = new QAction( pcCurrModuleIf->getModuleLongName(), parent() ); currAction = new QAction( pcCurrModuleIf->getModuleLongName(), parent() );
@@ -328,9 +325,9 @@ void ModulesHandle::activateModule()
} }
} }
} }
// Check for same fmt in more than one frame modules
if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == CLP_MODULE_API_1 ) if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == CLP_MODULE_API_1 )
{ {
// Check for same fmt in more than one frame modules
for( int i = 1; i < videoSubWindowList.size(); i++ ) for( int i = 1; i < videoSubWindowList.size(); i++ )
{ {
if( !videoSubWindowList.at( i )->getCurrFrame()->haveSameFmt( videoSubWindowList.at( 0 )->getCurrFrame() ) ) if( !videoSubWindowList.at( i )->getCurrFrame()->haveSameFmt( videoSubWindowList.at( 0 )->getCurrFrame() ) )
@@ -372,28 +369,31 @@ void ModulesHandle::activateModule()
} }
} }
bool bShowModulesNewWindow = m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() | bTmpForceNewWindow; bool bRequiresWindow = ( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_STREAM_PROCESSING_MODULE ) ||
( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_NEW_WINDOW ) ||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->isChecked() ||
bTmpForceNewWindow;
bool bRequiresDock = ( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE );
QString windowName; QString windowName;
VideoSubWindow* pcModuleSubWindow = NULL; VideoSubWindow* pcModuleSubWindow = NULL;
if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
if( bRequiresWindow )
{ {
if( ( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow ) pcModuleSubWindow = new VideoSubWindow( VideoSubWindow::MODULE_SUBWINDOW );
{ windowName.append( QStringLiteral( "Module " ) );
pcModuleSubWindow = new VideoSubWindow( VideoSubWindow::MODULE_SUBWINDOW ); windowName.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleName );
windowName.append( QStringLiteral( "Module " ) ); pcCurrAppModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow;
windowName.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleLongName ); // connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo,
pcCurrAppModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow; // SLOT( updateSelectionArea( QRect ) ) );
// connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, // connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo,
// SLOT( updateSelectionArea( QRect ) ) ); // SLOT( zoomToFactorAll( double, QPoint ) ) );
// connect( pcModuleSubWindow, SIGNAL( zoomFactorChanged_SWindow( const double, const QPoint ) ), m_appModuleVideo, // connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo,
// SLOT( zoomToFactorAll( double, QPoint ) ) ); // SLOT( moveAllScrollBars( const QPoint ) ) );
// connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo,
// SLOT( moveAllScrollBars( const QPoint ) ) );
}
} }
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
if( bRequiresDock )
{ {
pcCurrAppModuleIf->m_pcDisplaySubWindow = NULL; pcCurrAppModuleIf->m_pcDisplaySubWindow = NULL;
pcCurrAppModuleIf->m_pcModuleDock = new ModuleHandleDock( m_pcParent, pcCurrAppModuleIf ); pcCurrAppModuleIf->m_pcModuleDock = new ModuleHandleDock( m_pcParent, pcCurrAppModuleIf );
@@ -423,20 +423,30 @@ void ModulesHandle::activateModule()
} }
} }
std::vector<CalypStream*> apcStreamList;
for( int i = 0; i < videoSubWindowList.size(); i++ )
{
apcStreamList.push_back( pcCurrAppModuleIf->m_pcSubWindow[i]->getCurrStream() );
}
std::vector<CalypFrame*> apcFrameList;
for( int i = 0; i < videoSubWindowList.size(); i++ )
{
apcFrameList.push_back( pcCurrAppModuleIf->m_pcSubWindow[i]->getCurrFrame() );
}
// Create Module // Create Module
bool moduleCreated = false; bool moduleCreated = false;
if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 ) if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_STREAM_PROCESSING_MODULE )
{
moduleCreated = pcCurrAppModuleIf->m_pcModule->create( apcStreamList );
}
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == CLP_MODULE_API_2 )
{ {
std::vector<CalypFrame*> apcFrameList;
for( int i = 0; i < videoSubWindowList.size(); i++ )
{
apcFrameList.push_back( pcCurrAppModuleIf->m_pcSubWindow[i]->getCurrFrame() );
}
moduleCreated = pcCurrAppModuleIf->m_pcModule->create( apcFrameList ); moduleCreated = pcCurrAppModuleIf->m_pcModule->create( apcFrameList );
} }
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == CLP_MODULE_API_1 ) else if( pcCurrAppModuleIf->m_pcModule->m_iModuleAPI == CLP_MODULE_API_1 )
{ {
pcCurrAppModuleIf->m_pcModule->create( pcCurrAppModuleIf->m_pcSubWindow[0]->getCurrFrame() ); pcCurrAppModuleIf->m_pcModule->create( apcFrameList[0] );
moduleCreated = true; moduleCreated = true;
} }
@@ -565,8 +575,8 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
if( pcCurrModuleIf->m_pcModuleStream ) if( pcCurrModuleIf->m_pcModuleStream )
{ {
unsigned int numberOfWindows = pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames; unsigned int numberOfWindows = pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames;
ClpULong currFrames = 0; unsigned long long int currFrames = 0;
ClpULong numberOfFrames = -1; unsigned long long int numberOfFrames = INT_MAX;
for( unsigned int i = 0; i < numberOfWindows; i++ ) for( unsigned int i = 0; i < numberOfWindows; i++ )
{ {
currFrames = pcCurrModuleIf->m_pcSubWindow[i]->getInputStream()->getFrameNum(); currFrames = pcCurrModuleIf->m_pcSubWindow[i]->getInputStream()->getFrameNum();
+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-2018 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;
+15 -32
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-2018 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
@@ -114,11 +114,6 @@ PlotSubWindow::PlotSubWindow( const QString& windowTitle, QWidget* parent )
m_cPlotPen.setWidthF( 2 ); m_cPlotPen.setWidthF( 2 );
setWidget( m_cPlotArea ); setWidget( m_cPlotArea );
m_aAxisRange[AXIS_HORIZONTAL][0] = 99999;
m_aAxisRange[AXIS_HORIZONTAL][1] = 0;
m_aAxisRange[AXIS_VERTICAL][0] = 99999;
m_aAxisRange[AXIS_VERTICAL][1] = 0;
} }
PlotSubWindow::~PlotSubWindow() PlotSubWindow::~PlotSubWindow()
@@ -128,8 +123,8 @@ PlotSubWindow::~PlotSubWindow()
void PlotSubWindow::normalSize() void PlotSubWindow::normalSize()
{ {
m_cPlotArea->xAxis->setRange( m_aAxisRange[AXIS_HORIZONTAL][0], m_aAxisRange[AXIS_HORIZONTAL][1] ); m_cPlotArea->xAxis->setRange( m_aAxisRange[HORIZONTAL][0], m_aAxisRange[HORIZONTAL][1] );
m_cPlotArea->yAxis->setRange( m_aAxisRange[AXIS_VERTICAL][0], m_aAxisRange[AXIS_VERTICAL][1] ); m_cPlotArea->yAxis->setRange( m_aAxisRange[VERTICAL][0], m_aAxisRange[VERTICAL][1] );
m_cPlotArea->replot(); m_cPlotArea->replot();
m_dScaleFactor = 1; m_dScaleFactor = 1;
} }
@@ -192,43 +187,29 @@ void PlotSubWindow::setAxisName( const QString& nameAxisX, const QString& nameAx
void PlotSubWindow::setAxisRange( const QLine& axisLimits ) void PlotSubWindow::setAxisRange( const QLine& axisLimits )
{ {
setAxisRange( AXIS_HORIZONTAL, axisLimits.x1(), axisLimits.x2() ); setAxisRange( HORIZONTAL, axisLimits.x1(), axisLimits.x2() );
setAxisRange( AXIS_VERTICAL, axisLimits.y1(), axisLimits.y2() ); setAxisRange( VERTICAL, axisLimits.y1(), axisLimits.y2() );
} }
void PlotSubWindow::setAxisRange( PlotSubWindow::Axis eAxis, const int& axisStart, const int& axisEnd ) void PlotSubWindow::setAxisRange( PlotSubWindow::Axis eAxis, const int& axisStart, const int& axisEnd )
{ {
if( eAxis == AXIS_HORIZONTAL ) if( eAxis == HORIZONTAL )
{ {
m_cPlotArea->xAxis->setRange( axisStart, axisEnd ); m_cPlotArea->xAxis->setRange( axisStart, axisEnd );
// horizontalScrollBar()->setRange( axisStart * 100, axisEnd * 100 ); // horizontalScrollBar()->setRange( axisStart * 100, axisEnd * 100 );
m_aAxisRange[AXIS_HORIZONTAL][0] = axisStart; m_aAxisRange[HORIZONTAL][0] = axisStart;
m_aAxisRange[AXIS_HORIZONTAL][1] = axisEnd; m_aAxisRange[HORIZONTAL][1] = axisEnd;
} }
if( eAxis == AXIS_VERTICAL ) if( eAxis == VERTICAL )
{ {
m_cPlotArea->yAxis->setRange( axisStart, axisEnd ); m_cPlotArea->yAxis->setRange( axisStart, axisEnd );
// verticalScrollBar()->setRange( axisStart * 100, axisEnd * 100 ); // verticalScrollBar()->setRange( axisStart * 100, axisEnd * 100 );
m_aAxisRange[AXIS_VERTICAL][0] = axisStart; m_aAxisRange[VERTICAL][0] = axisStart;
m_aAxisRange[AXIS_VERTICAL][1] = axisEnd; m_aAxisRange[VERTICAL][1] = axisEnd;
} }
m_cPlotArea->replot(); m_cPlotArea->replot();
} }
void PlotSubWindow::appendAxisLimit( PlotSubWindow::Axis eAxis, const int& axisStart, const int& axisEnd )
{
m_aAxisRange[eAxis][0] = std::min<double>( m_aAxisRange[eAxis][0], axisStart );
m_aAxisRange[eAxis][1] = std::max<double>( m_aAxisRange[eAxis][1], axisEnd );
if( eAxis == AXIS_HORIZONTAL )
m_cPlotArea->xAxis->setRange( m_aAxisRange[AXIS_HORIZONTAL][0], m_aAxisRange[AXIS_HORIZONTAL][1] );
if( eAxis == AXIS_VERTICAL )
m_cPlotArea->xAxis->setRange( m_aAxisRange[AXIS_VERTICAL][0], m_aAxisRange[AXIS_VERTICAL][1] );
m_cPlotArea->replot();
}
void PlotSubWindow::addPlot( const QVector<double>& arrayX, const QVector<double>& arrayY, const QString& key ) void PlotSubWindow::addPlot( const QVector<double>& arrayX, const QVector<double>& arrayY, const QString& key )
{ {
QCPGraph* newPlot = m_cPlotArea->addGraph(); QCPGraph* newPlot = m_cPlotArea->addGraph();
@@ -251,8 +232,10 @@ void PlotSubWindow::addPlot( const QVector<double>& arrayX, const QVector<double
newPlot->setName( key ); newPlot->setName( key );
} }
appendAxisLimit( AXIS_HORIZONTAL, m_cPlotArea->xAxis->range().lower, m_cPlotArea->xAxis->range().upper ); m_aAxisRange[HORIZONTAL][0] = m_cPlotArea->xAxis->range().lower;
appendAxisLimit( AXIS_VERTICAL, m_cPlotArea->yAxis->range().lower, m_cPlotArea->yAxis->range().upper ); m_aAxisRange[HORIZONTAL][1] = m_cPlotArea->xAxis->range().upper;
m_aAxisRange[VERTICAL][0] = m_cPlotArea->yAxis->range().lower;
m_aAxisRange[VERTICAL][1] = m_cPlotArea->yAxis->range().upper;
m_iNumberPlots++; m_iNumberPlots++;
} }
+5 -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-2018 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
@@ -45,8 +45,8 @@ private:
enum Axis enum Axis
{ {
AXIS_HORIZONTAL, HORIZONTAL,
AXIS_VERTICAL, VERTICAL,
}; };
double m_aAxisRange[2][2]; double m_aAxisRange[2][2];
double m_dScaleFactor; double m_dScaleFactor;
@@ -78,7 +78,6 @@ public:
void setAxisRange( const QLine& axisLimits ); void setAxisRange( const QLine& axisLimits );
void setAxisRange( PlotSubWindow::Axis eAxis, const int& axisStart, const int& axisEnd ); void setAxisRange( PlotSubWindow::Axis eAxis, const int& axisStart, const int& axisEnd );
void appendAxisLimit( PlotSubWindow::Axis eAxis, const int& axisStart, const int& axisEnd );
void setKey( const QString& key ); void setKey( const QString& key );
+25 -29
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-2018 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 )
{ {
@@ -156,12 +156,13 @@ void QualityHandle::update( VideoSubWindow* currSubWindow )
void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList ) void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
{ {
unsigned numberOfWindows = apcWindowList.size(); QVector<double>* padQualityValues;
ClpULong currFrames = 0; unsigned int numberOfWindows = apcWindowList.size();
ClpULong numberOfFrames = -1; unsigned long long int currFrames = 0;
unsigned long long int numberOfFrames = INT_MAX;
//! Check reference window //! Check reference window
for( unsigned i = 0; i < numberOfWindows; i++ ) for( unsigned int i = 0; i < numberOfWindows; i++ )
{ {
if( !apcWindowList.at( i )->getRefSubWindow() ) if( !apcWindowList.at( i )->getRefSubWindow() )
{ {
@@ -171,7 +172,7 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
VideoSubWindow* pcReferenceWindow = apcWindowList.at( 0 )->getRefSubWindow(); VideoSubWindow* pcReferenceWindow = apcWindowList.at( 0 )->getRefSubWindow();
numberOfFrames = pcReferenceWindow->getInputStream()->getFrameNum(); numberOfFrames = pcReferenceWindow->getInputStream()->getFrameNum();
for( unsigned i = 0; i < numberOfWindows; i++ ) for( unsigned int i = 0; i < numberOfWindows; i++ )
{ {
currFrames = apcWindowList.at( i )->getInputStream()->getFrameNum(); currFrames = apcWindowList.at( i )->getInputStream()->getFrameNum();
if( currFrames < numberOfFrames ) if( currFrames < numberOfFrames )
@@ -182,14 +183,7 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
ProgressBar* pcProgressBar = new ProgressBar( m_pcParet, numberOfFrames ); ProgressBar* pcProgressBar = new ProgressBar( m_pcParet, numberOfFrames );
QVector<double>* padQualityValues = new QVector<double>[numberOfWindows + 1]; padQualityValues = new QVector<double>[numberOfWindows + 1];
double* padAverageQuality = new double[numberOfWindows + 1];
double dCurrentQuality;
for( unsigned i = 0; i < numberOfWindows + 1; i++ )
{
padAverageQuality[i] = 0;
}
CalypFrame* pcReferenceFrame; CalypFrame* pcReferenceFrame;
CalypFrame* pcCurrFrame; CalypFrame* pcCurrFrame;
@@ -200,9 +194,7 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
for( unsigned int i = 0; i < numberOfWindows; i++ ) for( unsigned int i = 0; i < numberOfWindows; i++ )
{ {
pcCurrFrame = apcWindowList.at( i )->getCurrFrame(); pcCurrFrame = apcWindowList.at( i )->getCurrFrame();
dCurrentQuality = pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, CLP_LUMA ); padQualityValues[i + 1].append( pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, CLP_LUMA ) );
padAverageQuality[i + 1] = ( padAverageQuality[i + 1] * double( f ) + dCurrentQuality ) / double( f + 1 );
padQualityValues[i + 1].append( dCurrentQuality );
apcWindowList.at( i )->seekRelativeEvent( true ); apcWindowList.at( i )->seekRelativeEvent( true );
} }
pcReferenceWindow->seekRelativeEvent( true ); pcReferenceWindow->seekRelativeEvent( true );
@@ -214,23 +206,27 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
} }
pcReferenceWindow->stop(); pcReferenceWindow->stop();
QString qualityName = QString::fromStdString( CalypFrame::supportedQualityMetricsList()[m_iQualityMetricIdx] );
QString qualityUnits = QString::fromStdString( CalypFrame::supportedQualityMetricsUnitsList()[m_iQualityMetricIdx] );
QString plotWindowTitle( QStringLiteral( "Quality" ) ); QString plotWindowTitle( QStringLiteral( "Quality" ) );
if( apcWindowList.size() == 1 ) if( apcWindowList.size() == 1 )
{ {
plotWindowTitle += " - " + apcWindowList.at( 0 )->getWindowName(); plotWindowTitle += " - " + apcWindowList.at( 0 )->getWindowName();
} }
PlotSubWindow* pcPlotWindow = new PlotSubWindow( plotWindowTitle ); PlotSubWindow* pcPlotWindow = new PlotSubWindow( plotWindowTitle );
pcPlotWindow->setAxisName( "Frame Number", QString( "%1 [%2]" ).arg( qualityName ).arg( qualityUnits ) ); pcPlotWindow->setAxisName(
"Frame Number", QString::fromStdString( CalypFrame::supportedQualityMetricsList()[m_iQualityMetricIdx] ) );
QString key; if( apcWindowList.size() > 1 )
for( unsigned int i = 0; i < numberOfWindows; i++ )
{ {
key = apcWindowList.at( i )->getWindowName(); QString key;
key = QString( "[%1 %2] " ).arg( padAverageQuality[i + 1] ).arg( qualityUnits ) + key; for( unsigned int i = 0; i < numberOfWindows; i++ )
pcPlotWindow->addPlot( padQualityValues[0], padQualityValues[i + 1], key ); {
key = apcWindowList.at( i )->getWindowName();
pcPlotWindow->addPlot( padQualityValues[0], padQualityValues[i + 1], key );
}
}
else
{
pcPlotWindow->addPlot( padQualityValues[0], padQualityValues[1] );
} }
m_pcMainWindowManager->addSubWindow( pcPlotWindow ); m_pcMainWindowManager->addSubWindow( pcPlotWindow );
+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-2018 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-2018 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-2018 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"
+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-2018 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,6 +25,10 @@
#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>
@@ -37,10 +41,6 @@
#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:
+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-2018 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;
+14 -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-2018 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
@@ -320,8 +320,8 @@ void VideoHandle::update()
CalypStream* pcStream = m_pcCurrentVideoSubWindow->getInputStream(); CalypStream* pcStream = m_pcCurrentVideoSubWindow->getInputStream();
CalypFrame* pcFrame = m_pcCurrentVideoSubWindow->getCurrFrame(); CalypFrame* pcFrame = m_pcCurrentVideoSubWindow->getCurrFrame();
unsigned long frame_num = 0; int frame_num = 0;
unsigned long total_frame_num = 1; unsigned long long int total_frame_num = 1;
m_pcVideoFormatLabel->setText( m_pcCurrentVideoSubWindow->getStreamInformation() ); m_pcVideoFormatLabel->setText( m_pcCurrentVideoSubWindow->getStreamInformation() );
@@ -519,10 +519,10 @@ void VideoHandle::moveAllScrollBars( const double& horRatio, const double& verRa
} }
#endif #endif
unsigned long VideoHandle::getMaxFrameNumber() unsigned long long int VideoHandle::getMaxFrameNumber()
{ {
unsigned long currFrames; unsigned int currFrames;
unsigned long maxFrames = INT_MAX; unsigned long long int maxFrames = INT_MAX;
if( m_pcCurrentVideoSubWindow ) if( m_pcCurrentVideoSubWindow )
{ {
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
+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-2018 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,16 +25,16 @@
#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" #define _CONTROL_PLAYING_TIME_ 1
#include "config.h"
//#define _CONTROL_PLAYING_TIME_ 1
class QToolBar; class QToolBar;
class QDockWidget; class QDockWidget;
@@ -128,7 +128,7 @@ private:
QElapsedTimer* m_pcPlayControlTimer; QElapsedTimer* m_pcPlayControlTimer;
#endif #endif
unsigned long getMaxFrameNumber(); unsigned long long int getMaxFrameNumber();
void setTimerStatus(); void setTimerStatus();
Q_SIGNALS: Q_SIGNALS:
+15 -72
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-2018 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
/** /**
@@ -313,9 +311,8 @@ bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
{ {
ConfigureFormatDialog formatDialog( this ); ConfigureFormatDialog formatDialog( this );
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_BIG_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 );
@@ -324,18 +321,8 @@ bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
{ {
m_pCurrStream = new CalypStream; m_pCurrStream = new CalypStream;
} }
bool bConfig = true;
if( !bForceDialog ) bool bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness ) || bForceDialog;
{
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++ )
{ {
@@ -347,15 +334,8 @@ bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
return false; return false;
} }
} }
try bRet = m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate,
{ true );
bRet = m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate, true );
}
catch( CalypFailure& e )
{
if( iPass == 1 )
throw( e );
}
} }
m_sStreamInfo.m_cFilename = cFilename; m_sStreamInfo.m_cFilename = cFilename;
@@ -367,14 +347,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();
@@ -432,8 +404,7 @@ void VideoSubWindow::updateVideoWindowInfo()
} }
if( m_pcCurrentDisplayModule->getModuleRequirements() & CLP_MODULES_HAS_INFO ) if( m_pcCurrentDisplayModule->getModuleRequirements() & CLP_MODULES_HAS_INFO )
{ {
QStringList list = QString::fromStdString( m_pcCurrentDisplayModule->moduleInfo() ).split( '\n' ); windowInfoList.append( QString::fromStdString( m_pcCurrentDisplayModule->moduleInfo() ) );
windowInfoList.append( list );
} }
// qDebug( ) << sourceWindowList; // qDebug( ) << sourceWindowList;
if( windowInfoList.size() > 0 ) if( windowInfoList.size() > 0 )
@@ -464,7 +435,7 @@ void VideoSubWindow::updateVideoWindowInfo()
} }
bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel, bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel,
int& rEndianness, unsigned int& rFrameRate ) int& rEndianness )
{ {
std::vector<CalypStandardResolution> stdResList = CalypStream::stdResolutionSizes(); std::vector<CalypStandardResolution> stdResList = CalypStream::stdResolutionSizes();
bool bGuessed = true; bool bGuessed = true;
@@ -509,11 +480,10 @@ bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsign
} }
// Guess resolution - match %dx%d // Guess resolution - match %dx%d
//QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort ); QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort );
QRegularExpressionMatch resolutionMatch = QRegularExpression( "_[0-9]+x[0-9]+" ).match( FilenameShort );
if( resolutionMatch.hasMatch() ) if( resolutionMatch.hasMatch() )
{ {
QString resolutionString = resolutionMatch.captured( resolutionMatch.lastCapturedIndex() ); QString resolutionString = resolutionMatch.captured( 0 );
if( resolutionString.startsWith( "_" ) || resolutionString.endsWith( "_" ) ) if( resolutionString.startsWith( "_" ) || resolutionString.endsWith( "_" ) )
{ {
resolutionString.remove( "_" ); resolutionString.remove( "_" );
@@ -558,12 +528,11 @@ bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsign
} }
} }
// [.|_]
// Guess bits per pixel - match %dbpp // Guess bits per pixel - match %dbpp
QRegularExpressionMatch BppMatch = QRegularExpression( "_[0-9]+bpp" ).match( FilenameShort ); QRegularExpressionMatch BppMatch = QRegularExpression( "_\\d*bpp" ).match( FilenameShort );
if( BppMatch.hasMatch() ) if( BppMatch.hasMatch() )
{ {
QString matchString = BppMatch.captured( BppMatch.lastCapturedIndex() ); QString matchString = BppMatch.captured( 0 );
matchString.remove( "_" ); matchString.remove( "_" );
matchString.remove( "bpp" ); matchString.remove( "bpp" );
rBitsPerPixel = matchString.toUInt(); rBitsPerPixel = matchString.toUInt();
@@ -572,32 +541,6 @@ bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsign
rBitsPerPixel = -1; rBitsPerPixel = -1;
} }
} }
QRegularExpressionMatch BppOnlybMatch = QRegularExpression( "_[0-9]+b" ).match( FilenameShort );
if( BppOnlybMatch.hasMatch() )
{
QString matchString = BppOnlybMatch.captured( BppOnlybMatch.lastCapturedIndex() );
matchString.remove( "_" );
matchString.remove( "b" );
rBitsPerPixel = matchString.toUInt();
if( !( rBitsPerPixel > 0 && rBitsPerPixel < 16 ) )
{
rBitsPerPixel = -1;
}
}
// Guess frame rate - match %dbpp
QRegularExpressionMatch FpsMatch = QRegularExpression( "_[0-9]+fps" ).match( FilenameShort );
if( FpsMatch.hasMatch() )
{
QString matchString = FpsMatch.captured( FpsMatch.lastCapturedIndex() );
matchString.remove( "_" );
matchString.remove( "fps" );
rFrameRate = matchString.toUInt();
if( rFrameRate < 0 )
{
rFrameRate = 30;
}
}
// Guess Endianness // Guess Endianness
if( FilenameShort.contains( QStringLiteral( "be" ), Qt::CaseInsensitive ) ) if( FilenameShort.contains( QStringLiteral( "be" ), Qt::CaseInsensitive ) )
@@ -668,7 +611,7 @@ void VideoSubWindow::disableModule( CalypAppModuleIf* pcModule )
if( m_pcCurrentDisplayModule ) if( m_pcCurrentDisplayModule )
{ {
pcModule = m_pcCurrentDisplayModule; pcModule = m_pcCurrentDisplayModule;
m_pcCurrentDisplayModule = NULL; m_pcCurrentDisplayModule = 0;
ModulesHandle::destroyModuleIf( pcModule ); ModulesHandle::destroyModuleIf( pcModule );
setWindowName( QFileInfo( m_cFilename ).fileName() ); setWindowName( QFileInfo( m_cFilename ).fileName() );
bRefresh |= true; bRefresh |= true;
+2 -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-2018 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"
@@ -193,7 +192,7 @@ private:
bool goToNextFrame( bool bThreaded = false ); bool goToNextFrame( bool bThreaded = false );
static bool guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel, static bool guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel,
int& rEndianness, unsigned int& rFrameRate ); int& rEndianness );
bool hasRunningModule(); bool hasRunningModule();
+12 -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-2018 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;
} }
@@ -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-2018 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;
/** /**
+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-2018 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 )
+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-2018 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-2018 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-2018 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
+4 -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-2018 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
@@ -44,8 +44,7 @@ public:
m_pcChecked = NULL; m_pcChecked = NULL;
m_cName = option->opt_string; m_cName = option->opt_string;
m_pcDescription = new QLabel; m_pcDescription = new QLabel;
QString desc = QString::fromStdString( option->opt_desc ); m_pcDescription->setText( QString::fromStdString( option->opt_desc ) );
m_pcDescription->setText( desc );
QHBoxLayout* layout = new QHBoxLayout; QHBoxLayout* layout = new QHBoxLayout;
layout->addWidget( m_pcDescription, 0, Qt::AlignLeft ); layout->addWidget( m_pcDescription, 0, Qt::AlignLeft );
if( !option->isBinary() ) if( !option->isBinary() )
+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-2018 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;
/** /**
+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-2018 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,7 @@
#include <QProgressBar> #include <QProgressBar>
#include <QVBoxLayout> #include <QVBoxLayout>
ProgressBar::ProgressBar( QWidget* parent, unsigned long long int maxValue ) ProgressBar::ProgressBar( QWidget* parent, unsigned int maxValue )
: QWidget( parent ), m_uiTotalProgress( maxValue ), m_uiProgress( 0 ) : QWidget( parent ), m_uiTotalProgress( maxValue ), m_uiProgress( 0 )
{ {
QVBoxLayout* mainLayout = new QVBoxLayout( this ); QVBoxLayout* mainLayout = new QVBoxLayout( this );
+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-2018 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
@@ -37,7 +37,7 @@ class ProgressBar : public QWidget
Q_OBJECT Q_OBJECT
public: public:
ProgressBar( QWidget* parent, unsigned long long int maxValue ); ProgressBar( QWidget* parent, unsigned int maxValue );
void incrementProgress( unsigned int ); void incrementProgress( unsigned int );
+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-2018 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-2018 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-2018 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-2018 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;
+2 -23
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-2018 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
@@ -184,11 +184,6 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
labelRangeValue = new QLabel; labelRangeValue = new QLabel;
labelRangeValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter ); labelRangeValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
QLabel* nEBinsLabel = new QLabel( tr( "Non empty bins:" ) );
nEBinsLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelNEBinsValue = new QLabel;
labelNEBinsValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
QLabel* meanLabel = new QLabel( tr( "Mean:" ) ); QLabel* meanLabel = new QLabel( tr( "Mean:" ) );
meanLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter ); meanLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
labelMeanValue = new QLabel; labelMeanValue = new QLabel;
@@ -204,11 +199,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;
@@ -222,16 +212,12 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
statisticsLayout->addWidget( labelCountValue, gridRow++, 1 ); statisticsLayout->addWidget( labelCountValue, gridRow++, 1 );
statisticsLayout->addWidget( rangeLabel, gridRow, 0 ); statisticsLayout->addWidget( rangeLabel, gridRow, 0 );
statisticsLayout->addWidget( labelRangeValue, gridRow++, 1 ); statisticsLayout->addWidget( labelRangeValue, gridRow++, 1 );
statisticsLayout->addWidget( nEBinsLabel, gridRow, 0 );
statisticsLayout->addWidget( labelNEBinsValue, gridRow++, 1 );
statisticsLayout->addWidget( meanLabel, gridRow, 0 ); statisticsLayout->addWidget( meanLabel, gridRow, 0 );
statisticsLayout->addWidget( labelMeanValue, gridRow++, 1 ); statisticsLayout->addWidget( labelMeanValue, gridRow++, 1 );
statisticsLayout->addWidget( stdDevLabel, gridRow, 0 ); statisticsLayout->addWidget( stdDevLabel, gridRow, 0 );
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 );
@@ -288,7 +274,6 @@ void FramePropertiesDock::reset()
m_iLastFrameType = -1; m_iLastFrameType = -1;
labelNEBinsValue->clear();
labelMeanValue->clear(); labelMeanValue->clear();
labelPixelsValue->clear(); labelPixelsValue->clear();
labelStdDevValue->clear(); labelStdDevValue->clear();
@@ -459,9 +444,6 @@ void FramePropertiesDock::updateStatistiques()
if( frame ) if( frame )
{ {
double numBins = frame->getNEBins( channel );
labelNEBinsValue->setText( value.setNum( (float)numBins, 'f', 0 ) );
QString rangeText = QString rangeText =
"[" + QString::number( frame->getMinimumPelValue( channel ) ) + ":" + QString::number( frame->getMaximumPelValue( channel ) ) + "]"; "[" + QString::number( frame->getMinimumPelValue( channel ) ) + ":" + QString::number( frame->getMaximumPelValue( channel ) ) + "]";
labelRangeValue->setText( rangeText ); labelRangeValue->setText( rangeText );
@@ -479,10 +461,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 ) );
+3 -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-2018 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 __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" #include "lib/CalypStream.h"
#include <QtWidgets>
class FramePropertiesDock : public QWidget class FramePropertiesDock : public QWidget
{ {
Q_OBJECT Q_OBJECT
@@ -72,11 +72,9 @@ private:
QLabel* labelPixelsValue; QLabel* labelPixelsValue;
QLabel* labelCountValue; QLabel* labelCountValue;
QLabel* labelRangeValue; QLabel* labelRangeValue;
QLabel* labelNEBinsValue;
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-2018 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-2018 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 -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-2018 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 )
{ {
@@ -185,8 +185,6 @@ void QualityMeasurementSidebar::updateSidebarData()
VideoSubWindow* refSubWindow = m_pcCurrentVideoSubWindow->getRefSubWindow(); VideoSubWindow* refSubWindow = m_pcCurrentVideoSubWindow->getRefSubWindow();
if( refSubWindow ) if( refSubWindow )
{ {
QApplication::setOverrideCursor( Qt::WaitCursor );
CalypFrame* currFrame = m_pcCurrentVideoSubWindow->getCurrFrame(); CalypFrame* currFrame = m_pcCurrentVideoSubWindow->getCurrFrame();
CalypFrame* refFrame = refSubWindow->getCurrFrame(); CalypFrame* refFrame = refSubWindow->getCurrFrame();
double quality; double quality;
@@ -201,7 +199,6 @@ void QualityMeasurementSidebar::updateSidebarData()
{ {
m_ppcLabelQualityValue[component]->setText( zeroValue ); m_ppcLabelQualityValue[component]->setText( zeroValue );
} }
QApplication::restoreOverrideCursor();
return; return;
} }
else else
+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-2018 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;
+4 -4
View File
@@ -1,5 +1,5 @@
# ###
# CMakeLists for calyp external components ### CMakeLists for calyp external components
# ###
ADD_SUBDIRECTORY(qcustomplot) ADD_SUBDIRECTORY( qcustomplot )
+16 -8
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 . )
+8267 -8790
View File
File diff suppressed because it is too large. Load diff
+2315 -2571
View File
File diff suppressed because it is too large. Load diff
+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-2018 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-2018 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-2018 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
+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-2018 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
@@ -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-2018 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;
+102 -93
View File
@@ -1,138 +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
# <component>_VERSION - The components version # - 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
# #
# 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(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})
+50 -54
View File
@@ -1,68 +1,64 @@
# 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_MODULE name file)
SET(__modulename "Module${name}") MACRO(ADD_MODULE name file )
OPTION(MODULE_${name} "Use module ${name}" ON) set(__modulename "Module${name}")
ADD_FEATURE_INFO(${name} MODULE_${name} "Module ${name}") OPTION(MODULE_${name} "Use module ${name}" ON )
IF(MODULE_${name}) ADD_FEATURE_INFO(${name} MODULE_${name} "Module ${name}" )
LIST(APPEND Calyp_Mod_SRCS ${MODULE_LOCATION}${file}) if( MODULE_${name} )
LIST(APPEND MODULES_LIST_NAME ${name}) list(APPEND Calyp_Mod_SRCS ${file} )
LIST(APPEND MODULES_LIST_FILES ${file}) LIST(APPEND MODULES_LIST_NAME ${name} )
SET(Calyp_Mod_SRCS LIST(APPEND MODULES_LIST_FILES ${file} )
"${Calyp_Mod_SRCS}" file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${file}.h\"\n")
PARENT_SCOPE endif()
) unset(__modulename)
SET(MODULES_LIST_NAME
"${MODULES_LIST_NAME}"
PARENT_SCOPE
)
SET(MODULES_LIST_FILES
"${MODULES_LIST_FILES}"
PARENT_SCOPE
)
ENDIF()
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
# (OpenCV modules required) Used in modules/CMakeLists.txt 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") CMAKE_PARSE_ARGUMENTS(ADD_MODULE_USE_OPENCV "" "VERSION" "MODULES" ${ARGN} )
CMAKE_PARSE_ARGUMENTS(ADD_MODULE_USE_OPENCV "" "VERSION" "MODULES" ${ARGN}) 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)
ELSE() ELSE()
LIST(APPEND OPENCV_MODULES ${opencv_module}) LIST(APPEND OPENCV_MODULES ${opencv_module} )
ENDIF() ENDIF()
ENDFOREACH() ENDFOREACH()
IF(_HAS_MODULES) IF( _HAS_MODULES )
ADD_MODULE(${name} ${file}) ADD_MODULE( ${name} ${file} )
ENDIF() ENDIF()
UNSET(OPENCV_${opencv_moduleUP}_FOUND) UNSET( OPENCV_${opencv_moduleUP}_FOUND )
UNSET(_HAS_MODULES) UNSET( _HAS_MODULES )
ENDIF() ENDIF()
UNSET(ADD_MODULE_USE_OPENCV_VERSION) UNSET( ADD_MODULE_USE_OPENCV_VERSION )
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
#
# Create header # Create header
MACRO(CREATE_MODULE_MACROS) #
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"
)
FOREACH(module ${MODULES_LIST_FILES})
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${module}.h\"\n")
ENDFOREACH(module ${MODULES_LIST_FILES})
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#define REGISTER_ALL_MODULES \\\n") MACRO(CREATE_MODULE_MACROS )
FOREACH(module ${MODULES_LIST_NAME})
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "Register( \"${module}\", &(${module}::Create) ); \\\n") file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n"
ENDFOREACH(module ${MODULES_LIST_NAME})
"#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" )
foreach(module ${MODULES_LIST_FILES})
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${module}.h\"\n")
endforeach(module ${MODULES_LIST_FILES})
file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#define REGISTER_ALL_MODULES \\\n" )
foreach(module ${MODULES_LIST_NAME})
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "Register( \"${module}\", &(${module}::Create) ); \\\n")
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()
+49 -71
View File
@@ -1,85 +1,63 @@
# #################################################################################################################################################### #####################################################################################
# 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(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH} ${QT_DIR}" )
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(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)
INSTALL(FILES ${QT_DIR}/bin/Qt5Core${QT_DLL_POSTFIX}.dll DESTINATION bin)
INSTALL(FILES ${QT_DIR}/bin/Qt5Gui${QT_DLL_POSTFIX}.dll DESTINATION bin)
INSTALL(FILES ${QT_DIR}/bin/Qt5Widgets${QT_DLL_POSTFIX}.dll DESTINATION bin)
INSTALL(FILES ${QT_DIR}/bin/Qt5PrintSupport${QT_DLL_POSTFIX}.dll DESTINATION bin)
INSTALL(FILES ${QT_DIR}/plugins/platforms/qwindows${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms)
INSTALL(FILES ${QT_DIR}/plugins/platforms/qminimal${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms)
INSTALL(FILES ${QT_DIR}/plugins/platforms/qoffscreen${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms)
IF(USE_FERVOR) IF( NOT USE_QT4 )
INSTALL(FILES ${QT_DIR}/bin/Qt5Network${QT_DLL_POSTFIX}.dll DESTINATION bin) INSTALL(FILES ${QT_DIR}/bin/Qt5Core${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKit${QT_DLL_POSTFIX}.dll DESTINATION bin) INSTALL(FILES ${QT_DIR}/bin/Qt5Gui${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKitWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin) INSTALL(FILES ${QT_DIR}/bin/Qt5Widgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5Quick${QT_DLL_POSTFIX}.dll DESTINATION bin) INSTALL(FILES ${QT_DIR}/bin/Qt5PrintSupport${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5Qml${QT_DLL_POSTFIX}.dll DESTINATION bin) INSTALL(FILES ${QT_DIR}/plugins/platforms/qwindows${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms )
INSTALL(FILES ${QT_DIR}/bin/Qt5Multimedia${QT_DLL_POSTFIX}.dll DESTINATION bin) INSTALL(FILES ${QT_DIR}/plugins/platforms/qminimal${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms )
INSTALL(FILES ${QT_DIR}/bin/Qt5Sql${QT_DLL_POSTFIX}.dll DESTINATION bin) INSTALL(FILES ${QT_DIR}/plugins/platforms/qoffscreen${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms )
INSTALL(FILES ${QT_DIR}/bin/Qt5Positioning${QT_DLL_POSTFIX}.dll DESTINATION bin)
INSTALL(FILES ${QT_DIR}/bin/Qt5Sensors${QT_DLL_POSTFIX}.dll DESTINATION bin) IF( USE_FERVOR )
INSTALL(FILES ${QT_DIR}/bin/Qt5MultimediaWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin) INSTALL(FILES ${QT_DIR}/bin/Qt5Network${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5OpenGL${QT_DLL_POSTFIX}.dll DESTINATION bin) INSTALL(FILES ${QT_DIR}/bin/Qt5WebKit${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKitWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5Quick${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5Qml${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5Multimedia${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5Sql${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5Positioning${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5Sensors${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5MultimediaWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
INSTALL(FILES ${QT_DIR}/bin/Qt5OpenGL${QT_DLL_POSTFIX}.dll DESTINATION bin )
ENDIF() ENDIF()
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" 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 )
SET(OpenCV_INSTALL_MODULES
${OPENCV_MODULES}
CACHE STRING "List of OpenCV 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)
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(FILES ${FFMPEG_DIR}/bin/avcodec-${AVCODEC_VERSION}.dll DESTINATION bin) INSTALL(FILES ${FFMPEG_DIR}/bin/swscale-${SWSCALE_VERSION}.dll DESTINATION bin )
INSTALL(FILES ${FFMPEG_DIR}/bin/avformat-${AVFORMAT_VERSION}.dll DESTINATION bin) INSTALL(FILES ${FFMPEG_DIR}/bin/swresample-${SWRESAMPLE_VERSION}.dll DESTINATION bin )
INSTALL(FILES ${FFMPEG_DIR}/bin/avutil-${AVUTIL_VERSION}.dll DESTINATION bin)
INSTALL(FILES ${FFMPEG_DIR}/bin/swscale-${SWSCALE_VERSION}.dll DESTINATION bin)
INSTALL(FILES ${FFMPEG_DIR}/bin/swresample-${SWRESAMPLE_VERSION}.dll DESTINATION bin)
ENDIF() ENDIF()
+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-2018 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,10 +26,10 @@
#define __CONFIG_CALYP_H__ #define __CONFIG_CALYP_H__
/* Version definition */ /* Version definition */
#define CALYP_VERSION_MAJOR @CALYP_VERSION_MAJOR @ #define CALYP_VERSION_MAJOR @CALYP_VERSION_MAJOR@
#define CALYP_VERSION_MINOR @CALYP_VERSION_MINOR @ #define CALYP_VERSION_MINOR @CALYP_VERSION_MINOR@
#define CALYP_VERSION_PATCH @CALYP_VERSION_PATCH @ #define CALYP_VERSION_PATCH @CALYP_VERSION_PATCH@
#define CALYP_VERSION @CALYP_VERSION @ #define CALYP_VERSION @CALYP_VERSION@
#define CALYP_VERSION_STRING "@CALYP_VERSION_STRING@" #define CALYP_VERSION_STRING "@CALYP_VERSION_STRING@"
#define UPDATE_CHANNEL "@UPDATE_CHANNEL@" #define UPDATE_CHANNEL "@UPDATE_CHANNEL@"
+6 -4
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-2018 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-2018 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 )
+14 -9
View File
@@ -1,16 +1,21 @@
# ###
# CMakeLists for modules_example ### CMakeLists for modules_example
# ###
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.9)
PROJECT("modules_example") CMAKE_MINIMUM_REQUIRED( VERSION 2.8.9 )
# THIS FIND_PACKAGE( Calyp ) INCLUDE_DIRECTORIES( ${CALYP_INCLUDE_DIRS} ) OR PROJECT( "modules_example" )
INCLUDE_DIRECTORIES(../../lib)
# THIS
# FIND_PACKAGE( Calyp )
#INCLUDE_DIRECTORIES( ${CALYP_INCLUDE_DIRS} )
# OR
INCLUDE_DIRECTORIES( ../../lib )
ADD_LIBRARY(FrameBinarization SHARED FrameBinarization_APIv1.cpp) ADD_LIBRARY(FrameBinarization SHARED FrameBinarization_APIv1.cpp)
TARGET_LINK_LIBRARIES(FrameBinarization ${CALYP_LINKER_LIBS}) 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-2018 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-2018 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,4 +1,4 @@
#!/bin/bash #!/bin/sh
export LC_ALL=en_GB.utf8 export LC_ALL=en_GB.utf8
export LANG=C export LANG=C
@@ -8,7 +8,7 @@ MY_NAME="$(basename "$0")"
SET_VERBOSE=0 SET_VERBOSE=0
ALL_FILES=0 ALL_FILES=0
function parsearguments() { function parsearguments {
local ARGS=$(getopt -o "h" -l "verbose,all,help" -n "${MY_NAME}" -- "$@") local ARGS=$(getopt -o "h" -l "verbose,all,help" -n "${MY_NAME}" -- "$@")
local PRINT_HELP=0 local PRINT_HELP=0
@@ -123,5 +123,5 @@ while read filename ; do
# only change/touch original file if it has been changed # only change/touch original file if it has been changed
diff -q ${TEMPFILE} "${filename}" >/dev/null || { echo "Updating \"${filename}\"" ; cp -p ${TEMPFILE} "${filename}" || echo "Cannot copy \"${TEMPFILE}\" \"${filename}\"" ; } diff -q ${TEMPFILE} "${filename}" >/dev/null || { echo "Updating \"${filename}\"" ; cp -p ${TEMPFILE} "${filename}" || echo "Cannot copy \"${TEMPFILE}\" \"${filename}\"" ; }
# rm -f ${TEMPFILE} rm -f ${TEMPFILE}
done done
+68 -54
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,72 +24,78 @@ SET(Calyp_Lib_Stream_SRCS
StreamHandlerRaw.cpp StreamHandlerRaw.cpp
StreamHandlerPortableMap.h StreamHandlerPortableMap.h
StreamHandlerPortableMap.cpp StreamHandlerPortableMap.cpp
# Options Parser
CalypOptions.h
CalypOptions.cpp
# Modules
CalypModuleIf.h
) )
SET(Calyp_Lib_OptionParser_SRCS CalypOptions.h CalypOptions.cpp) LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${PROJECT_LIBRARY} )
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} )
SET(Calyp_Lib_Modules_SRCS CalypOptions.h CalypOptions.cpp)
SET(Calyp_Lib_SRCS IF( USE_FFMPEG )
LibMemory.h LIST( APPEND Calyp_Lib_SRCS StreamHandlerLibav.h )
CalypLib.h LIST( APPEND Calyp_Lib_SRCS StreamHandlerLibav.cpp )
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${FFMPEG_LIBRARIES} )
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} )
ENDIF()
IF( USE_OPENCV )
LIST( APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.h )
LIST( APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.cpp )
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${OpenCV_LIBRARIES} )
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} )
ENDIF()
set(Calyp_Lib_HEADERS
CalypDefs.h CalypDefs.h
${Calyp_Lib_Frame_SRCS} CalypFrame.h
${Calyp_Lib_Stream_SRCS} CalypStream.h
${Calyp_Lib_OptionParser_SRCS} CalypOptions.h
${Calyp_Lib_Modules_SRCS} CalypModuleIf.h
) )
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${PROJECT_LIBRARY}) CONFIGURE_FILE( CalypConfig.cmake.in CalypConfig.cmake @ONLY)
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
IF(USE_FFMPEG) INCLUDE_DIRECTORIES( ${FFMPEG_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )
LIST(APPEND Calyp_Lib_SRCS StreamHandlerLibav.h)
LIST(APPEND Calyp_Lib_SRCS StreamHandlerLibav.cpp)
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${FFMPEG_LIBRARIES}) IF( USE_STATIC )
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS}) ADD_LIBRARY( ${PROJECT_LIBRARY} STATIC ${Calyp_Lib_SRCS} )
ENDIF()
IF(USE_OPENCV)
LIST(APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.h)
LIST(APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.cpp)
LIST(APPEND Calyp_Lib_SRCS CalypOpenCVModuleIf.cpp)
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${OpenCV_LIBRARIES})
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS})
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)
INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS})
IF(USE_STATIC)
ADD_LIBRARY(${PROJECT_LIBRARY} STATIC ${Calyp_Lib_SRCS})
ELSE() 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}
)
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}/..>
)
IF(NOT USE_STATIC) SET_TARGET_PROPERTIES( ${PROJECT_LIBRARY}
INSTALL( PROPERTIES VERSION ${CALYP_VERSION}
TARGETS ${PROJECT_LIBRARY} SOVERSION ${CALYP_VERSION_MAJOR}
)
IF( NOT USE_STATIC )
INSTALL( 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}"
) )
INSTALL(FILES ${Calyp_Lib_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") INSTALL(FILES ${Calyp_Lib_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" )
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CalypConfig.cmake DESTINATION share/calyp) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CalypConfig.cmake DESTINATION share/calyp )
ENDIF() ENDIF()
IF(BUILD_TESTS) IF( BUILD_TESTS )
ADD_SUBDIRECTORY(tests) ADD_SUBDIRECTORY( tests )
ENDIF() ENDIF()
+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-2018 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,13 +27,11 @@
#define __CALYPDEFS_H__ #define __CALYPDEFS_H__
#include <algorithm> #include <algorithm>
#include <iterator>
#include <string> #include <string>
#include <vector> #include <vector>
typedef unsigned short ClpPel; ///< 16-bit pixel type typedef unsigned short ClpPel; ///< 16-bit pixel type
typedef unsigned char ClpByte; typedef unsigned char ClpByte;
typedef unsigned long long ClpULong;
typedef std::string ClpString; typedef std::string ClpString;
@@ -102,9 +100,6 @@ enum CLP_Endianness
CLP_LITTLE_ENDIAN = 1, CLP_LITTLE_ENDIAN = 1,
}; };
static const double S_PI = 3.14159265358979323846;
static const double S_PI_2 = 1.57079632679489661923;
inline ClpString clpLowercase( const ClpString& in ) inline ClpString clpLowercase( const ClpString& in )
{ {
ClpString out; ClpString out;
+122 -334
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-2018 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,17 +24,15 @@
#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/imgproc/imgproc.hpp>
#endif #endif
std::vector<ClpString> CalypFrame::supportedColorSpacesListNames() std::vector<ClpString> CalypFrame::supportedColorSpacesListNames()
@@ -83,11 +81,6 @@ int CalypFrame::findPixelFormat( const ClpString& name )
return -1; return -1;
} }
int CalypFrame::pelformatColorSpace( const int idx )
{
return g_CalypPixFmtDescriptorsMap.at( idx ).colorSpace;
}
struct CalypFramePrivate struct CalypFramePrivate
{ {
public: public:
@@ -102,7 +95,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,12 +111,15 @@ 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;
void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel ) /**
{ * Common constructor function of a frame
init( width, height, pel_format, bitsPixel, false ); *
} * @param width width of the frame
* @param height height of the frame
void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel, bool has_negative_values ) * @param pel_format pixel format index (always use PixelFormats enum)
*
*/
void init( unsigned int width, unsigned int height, int pel_format, int bitsPixel )
{ {
m_bInit = false; m_bInit = false;
m_bHasRGBPel = false; m_bHasRGBPel = false;
@@ -135,7 +130,6 @@ public:
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 )
{ {
@@ -258,22 +252,16 @@ public:
* \brief Constructors * \brief Constructors
*/ */
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel ) CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, int 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( 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 );
} }
@@ -282,7 +270,7 @@ 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 );
} }
} }
@@ -358,8 +346,6 @@ bool CalypFrame::haveSameFmt( const CalypFrame& other, unsigned int match ) cons
bRet &= ( getBitsPel() == other.getBitsPel() ); bRet &= ( getBitsPel() == other.getBitsPel() );
if( match & MATCH_COLOR_SPACE_IGNORE_GRAY ) if( match & MATCH_COLOR_SPACE_IGNORE_GRAY )
bRet &= ( getColorSpace() == CLP_COLOR_GRAY || getColorSpace() == other.getColorSpace() ); bRet &= ( getColorSpace() == CLP_COLOR_GRAY || getColorSpace() == other.getColorSpace() );
if( match & MATCH_BYTES_PER_FRAME )
bRet &= ( getBytesPerFrame() == other.getBytesPerFrame() );
return bRet; return bRet;
} }
@@ -393,46 +379,31 @@ unsigned int CalypFrame::getNumberChannels() const
return d->m_pcPelFormat->numberChannels; return d->m_pcPelFormat->numberChannels;
} }
unsigned CalypFrame::getWidth( unsigned channel ) const unsigned int CalypFrame::getWidth( int channel ) const
{ {
return CHROMASHIFT( d->m_uiWidth, channel > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0 ); return CHROMASHIFT( d->m_uiWidth, channel > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0 );
} }
unsigned CalypFrame::getHeight( unsigned channel ) const unsigned int CalypFrame::getHeight( int 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 unsigned int CalypFrame::getPixels( int channel ) const
{ {
return d->m_bHasNegativeValues; return getWidth( channel ) * getWidth( channel );
} }
ClpULong CalypFrame::getPixels( unsigned channel ) const unsigned char CalypFrame::getChromaWidthRatio() const
{
return getWidth( channel ) * getHeight( channel );
}
ClpULong CalypFrame::getTotalNumberOfPixels() const
{
ClpULong numberPixels = 0;
for( unsigned i = 0; i < getNumberChannels(); i++ )
{
numberPixels += getPixels( i );
}
return numberPixels;
}
unsigned CalypFrame::getChromaWidthRatio() const
{ {
return d->m_pcPelFormat->log2ChromaWidth; return d->m_pcPelFormat->log2ChromaWidth;
} }
unsigned CalypFrame::getChromaHeightRatio() const unsigned char CalypFrame::getChromaHeightRatio() const
{ {
return d->m_pcPelFormat->log2ChromaHeight; return d->m_pcPelFormat->log2ChromaHeight;
} }
ClpULong CalypFrame::getChromaLength() const unsigned int CalypFrame::getChromaLength() const
{ {
return getWidth( 1 ) * getHeight( 1 ); return getWidth( 1 ) * getHeight( 1 );
} }
@@ -442,19 +413,19 @@ unsigned int CalypFrame::getBitsPel() const
return d->m_uiBitsPel; return d->m_uiBitsPel;
} }
ClpULong CalypFrame::getBytesPerFrame() const unsigned long CalypFrame::getBytesPerFrame()
{ {
return getBytesPerFrame( d->m_uiWidth, d->m_uiHeight, d->m_iPixelFormat, d->m_uiBitsPel ); return getBytesPerFrame( d->m_uiWidth, d->m_uiHeight, d->m_iPixelFormat, d->m_uiBitsPel );
} }
ClpULong CalypFrame::getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel ) unsigned long CalypFrame::getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel )
{ {
const CalypPixelFormatDescriptor* pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( iPixelFormat ) ); const CalypPixelFormatDescriptor* pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( iPixelFormat ) );
unsigned int bytesPerPixel = ( bitsPixel - 1 ) / 8 + 1; unsigned int bytesPerPixel = ( bitsPixel - 1 ) / 8 + 1;
ClpULong numberBytes = uiWidth * uiHeight; unsigned long long int numberBytes = uiWidth * uiHeight;
if( pcPelFormat->numberChannels > 1 ) if( pcPelFormat->numberChannels > 1 )
{ {
ClpULong numberBytesChroma = unsigned long long int numberBytesChroma =
CHROMASHIFT( uiWidth, pcPelFormat->log2ChromaWidth ) * CHROMASHIFT( uiHeight, pcPelFormat->log2ChromaHeight ); CHROMASHIFT( uiWidth, pcPelFormat->log2ChromaWidth ) * CHROMASHIFT( uiHeight, pcPelFormat->log2ChromaHeight );
numberBytes += ( pcPelFormat->numberChannels - 1 ) * numberBytesChroma; numberBytes += ( pcPelFormat->numberChannels - 1 ) * numberBytesChroma;
} }
@@ -500,24 +471,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++ )
@@ -548,11 +514,11 @@ void CalypFrame::setPixel( unsigned int xPos, unsigned int yPos, CalypPixel pixe
void CalypFrame::copyFrom( const CalypFrame& other ) void CalypFrame::copyFrom( const CalypFrame& other )
{ {
if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_BYTES_PER_FRAME | MATCH_BITS ) ) if( haveSameFmt( other, MATCH_ALL ) )
return; return;
d->m_bHasRGBPel = false; d->m_bHasRGBPel = false;
d->m_bHasHistogram = false; d->m_bHasHistogram = false;
memcpy( &( d->m_pppcInputPel[0][0][0] ), &( other.getPelBufferYUV()[0][0][0] ), getTotalNumberOfPixels() * sizeof( ClpPel ) ); memcpy( *d->m_pppcInputPel[CLP_LUMA], other.getPelBufferYUV()[CLP_LUMA][0], getBytesPerFrame() * sizeof( ClpPel ) );
} }
void CalypFrame::copyFrom( const CalypFrame* other ) void CalypFrame::copyFrom( const CalypFrame* other )
@@ -561,11 +527,10 @@ void CalypFrame::copyFrom( const CalypFrame* other )
copyFrom( *other ); copyFrom( *other );
} }
void CalypFrame::copyFrom( const CalypFrame& other, unsigned x, unsigned y ) void CalypFrame::copyFrom( const CalypFrame& other, unsigned int xPos, unsigned int yPos )
{ {
if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_BITS ) ) if( haveSameFmt( other, MATCH_ALL ) )
return; return;
// TODO: Protect width and height
ClpPel*** pInput = other.getPelBufferYUV(); ClpPel*** pInput = other.getPelBufferYUV();
for( unsigned int ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ ) for( unsigned int ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
{ {
@@ -573,7 +538,7 @@ void CalypFrame::copyFrom( const CalypFrame& other, unsigned x, unsigned y )
int ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0; int ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
for( unsigned int i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ); i++ ) for( unsigned int i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ); i++ )
{ {
memcpy( &( d->m_pppcInputPel[ch][i][0] ), &( pInput[ch][( y >> ratioH ) + i][( x >> ratioW )] ), memcpy( d->m_pppcInputPel[ch][i], &( pInput[ch][( yPos >> ratioH ) + i][( xPos >> ratioW )] ),
( d->m_uiWidth >> ratioW ) * sizeof( ClpPel ) ); ( d->m_uiWidth >> ratioW ) * sizeof( ClpPel ) );
} }
} }
@@ -581,39 +546,12 @@ void CalypFrame::copyFrom( const CalypFrame& other, unsigned x, unsigned y )
d->m_bHasHistogram = false; d->m_bHasHistogram = false;
} }
void CalypFrame::copyFrom( const CalypFrame* other, unsigned x, unsigned y ) void CalypFrame::copyFrom( const CalypFrame* other, unsigned int x, unsigned int y )
{ {
if( other ) if( other )
copyFrom( *other, x, y ); copyFrom( *other, x, y );
} }
void CalypFrame::copyTo( const CalypFrame& other, unsigned x, unsigned y )
{
if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_PEL_FMT | MATCH_BITS ) )
return;
ClpPel*** pInput = other.getPelBufferYUV();
unsigned width = other.getWidth();
// TODO: Protect width and height
for( unsigned int ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
{
int ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
int ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
for( unsigned int i = 0; i < other.getHeight( ch ); i++ )
{
memcpy( &( d->m_pppcInputPel[ch][( y >> ratioH ) + i][( x >> ratioW )] ), &( pInput[ch][i][0] ),
( width >> ratioW ) * sizeof( ClpPel ) );
}
}
d->m_bHasRGBPel = false;
d->m_bHasHistogram = false;
}
void CalypFrame::copyTo( const CalypFrame* other, unsigned x, unsigned y )
{
if( other )
copyTo( *other, x, y );
}
void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness, unsigned long uiBuffSize ) void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness, unsigned long uiBuffSize )
{ {
if( uiBuffSize != getBytesPerFrame() ) if( uiBuffSize != getBytesPerFrame() )
@@ -636,7 +574,7 @@ void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness )
int b; int b;
int maxval = pow( 2, d->m_uiBitsPel ) - 1; int maxval = pow( 2, d->m_uiBitsPel ) - 1;
if( iEndianness == CLP_BIG_ENDIAN ) if( iEndianness == 0 )
{ {
startByte = bytesPixel - 1; startByte = bytesPixel - 1;
endByte = -1; endByte = -1;
@@ -655,10 +593,10 @@ void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness )
{ {
ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0; ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0; ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
step = ( d->m_pcPelFormat->comp[ch].step_minus1 ) * bytesPixel; step = d->m_pcPelFormat->comp[ch].step_minus1;
pPel = d->m_pppcInputPel[ch][0]; pPel = d->m_pppcInputPel[ch][0];
pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 ) * bytesPixel; pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 );
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ ) for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ )
{ {
@@ -694,7 +632,7 @@ void CalypFrame::frameToBuffer( ClpByte* output_buffer, int iEndianness )
int incByte = 1; int incByte = 1;
int b; int b;
if( iEndianness == CLP_BIG_ENDIAN ) if( iEndianness == 0 )
{ {
startByte = bytesPixel - 1; startByte = bytesPixel - 1;
endByte = -1; endByte = -1;
@@ -713,10 +651,10 @@ void CalypFrame::frameToBuffer( ClpByte* output_buffer, int iEndianness )
{ {
ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0; ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0; ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
step = ( d->m_pcPelFormat->comp[ch].step_minus1 ) * bytesPixel; step = d->m_pcPelFormat->comp[ch].step_minus1;
pTmpPel = d->m_pppcInputPel[ch][0]; pTmpPel = d->m_pppcInputPel[ch][0];
pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 ) * bytesPixel; pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane];
for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ ) for( i = 0; i < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); i++ )
{ {
@@ -731,12 +669,12 @@ void CalypFrame::frameToBuffer( ClpByte* output_buffer, int iEndianness )
} }
} }
void CalypFrame::fillRGBBuffer() 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 ); \
@@ -871,7 +809,7 @@ int CalypFrame::getNumHistogramSegment()
return d->m_uiHistoSegments; return d->m_uiHistoSegments;
} }
unsigned int CalypFrame::getMinimumPelValue( unsigned channel ) unsigned int CalypFrame::getMinimumPelValue( int channel )
{ {
if( !d->m_bHasHistogram ) if( !d->m_bHasHistogram )
return 0; return 0;
@@ -903,7 +841,7 @@ unsigned int CalypFrame::getMinimumPelValue( unsigned channel )
return 0; return 0;
} }
unsigned int CalypFrame::getMaximumPelValue( unsigned channel ) unsigned int CalypFrame::getMaximumPelValue( int channel )
{ {
if( !d->m_bHasHistogram ) if( !d->m_bHasHistogram )
return 0; return 0;
@@ -929,46 +867,13 @@ unsigned int CalypFrame::getMaximumPelValue( unsigned channel )
{ {
if( d->m_puiHistogram[i] > 0 ) if( d->m_puiHistogram[i] > 0 )
{ {
return i - indexEnd - 1; return i - indexEnd + 1;
} }
} }
return 0; return 0;
} }
unsigned int CalypFrame::getNEBins( unsigned channel ) unsigned int CalypFrame::getMaximum( int channel )
{
if( !d->m_bHasHistogram )
return 0;
channel = d->getRealHistogramChannel( channel );
if( channel < 0 )
return 0;
int indexStart;
int indexEnd;
if( channel == HIST_ALL_CHANNELS )
{
indexStart = 0;
indexEnd = d->m_uiHistoChannels * d->m_uiHistoSegments;
}
else
{
indexStart = channel * d->m_uiHistoSegments;
indexEnd = indexStart + d->m_uiHistoSegments;
}
int nEBins = 0;
for( int i = indexStart; i < indexEnd; i++ )
{
if( d->m_puiHistogram[i] > 0 )
{
nEBins++;
}
}
return nEBins;
}
unsigned int CalypFrame::getMaximum( unsigned channel )
{ {
if( !d->m_bHasHistogram ) if( !d->m_bHasHistogram )
return 0; return 0;
@@ -1001,7 +906,7 @@ unsigned int CalypFrame::getMaximum( unsigned channel )
return maxValue; return maxValue;
} }
unsigned int CalypFrame::getNumPixelsRange( unsigned channel, unsigned int start, unsigned int end ) unsigned int CalypFrame::getNumPixelsRange( int channel, unsigned int start, unsigned int end )
{ {
if( !d->m_bHasHistogram || start < 0 || end > d->m_uiHistoSegments - 1 || start > end ) if( !d->m_bHasHistogram || start < 0 || end > d->m_uiHistoSegments - 1 || start > end )
{ {
@@ -1023,7 +928,7 @@ unsigned int CalypFrame::getNumPixelsRange( unsigned channel, unsigned int start
return count; return count;
} }
double CalypFrame::getMean( unsigned channel, unsigned int start, unsigned int end ) double CalypFrame::getMean( int channel, unsigned int start, unsigned int end )
{ {
if( !d->m_bHasHistogram || start < 0 || end > d->m_uiHistoSegments - 1 || start > end ) if( !d->m_bHasHistogram || start < 0 || end > d->m_uiHistoSegments - 1 || start > end )
{ {
@@ -1053,7 +958,7 @@ double CalypFrame::getMean( unsigned channel, unsigned int start, unsigned int e
return mean; return mean;
} }
int CalypFrame::getMedian( unsigned channel, unsigned int start, unsigned int end ) int CalypFrame::getMedian( int channel, unsigned int start, unsigned int end )
{ {
if( !d->m_bHasHistogram || start < 0 || end > d->m_uiHistoSegments - 1 || start > end ) if( !d->m_bHasHistogram || start < 0 || end > d->m_uiHistoSegments - 1 || start > end )
{ {
@@ -1079,7 +984,7 @@ int CalypFrame::getMedian( unsigned channel, unsigned int start, unsigned int en
return 0; return 0;
} }
double CalypFrame::getStdDev( unsigned channel, unsigned int start, unsigned int end ) double CalypFrame::getStdDev( int channel, unsigned int start, unsigned int end )
{ {
if( !d->m_bHasHistogram || start < 0 || end > d->m_uiHistoSegments - 1 || start > end ) if( !d->m_bHasHistogram || start < 0 || end > d->m_uiHistoSegments - 1 || start > end )
{ {
@@ -1101,14 +1006,14 @@ double CalypFrame::getStdDev( unsigned channel, unsigned int start, unsigned int
/*------------ original /*------------ original
for ( i = start ; i <= end ; i++ ) for ( i = start ; i <= end ; i++ )
{ {
dev += ( i - mean ) * ( i - mean ) * d->m_puiHistogram[indexStart +i]; dev += ( i - mean ) * ( i - mean ) * d->m_puiHistogram[indexStart +i];
} }
return sqrt( dev / count ); return sqrt( dev / count );
-----------------------*/ -----------------------*/
for( unsigned int i = start; i <= end; i++ ) for( unsigned int i = start; i <= end; i++ )
{ {
@@ -1118,7 +1023,7 @@ double CalypFrame::getStdDev( unsigned channel, unsigned int start, unsigned int
return sqrt( ( dev - count * mean * mean ) / ( count - 1 ) ); return sqrt( ( dev - count * mean * mean ) / ( count - 1 ) );
} }
double CalypFrame::getHistogramValue( unsigned channel, unsigned int bin ) double CalypFrame::getHistogramValue( int channel, unsigned int bin )
{ {
if( !d->m_bHasHistogram || bin < 0 || bin > d->m_uiHistoSegments - 1 ) if( !d->m_bHasHistogram || bin < 0 || bin > d->m_uiHistoSegments - 1 )
return 0.0; return 0.0;
@@ -1133,39 +1038,13 @@ 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
************************************************************** **************************************************************
*/ */
bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray, bool scale, unsigned channel ) bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray )
{ {
bool bRet = false; bool bRet = false;
#ifdef USE_OPENCV #ifdef USE_OPENCV
@@ -1174,78 +1053,46 @@ bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray, bool scale, unsigned
{ {
return bRet; return bRet;
} }
unsigned int cvPrecision = getBitsPel() > 8 ? CV_16U : CV_8U; int cvType = CV_MAKETYPE( CV_8U, convertToGray ? 1 : d->m_pcPelFormat->numberChannels );
unsigned numBytes = getBitsPel() > 8 ? 2 : 1; cvMat.create( d->m_uiHeight, d->m_uiWidth, cvType );
unsigned numChannels = getNumberChannels(); unsigned char* pCvPel = cvMat.data;
unsigned scaleFactor = 1 << ( numBytes * 8 - getBitsPel() ); if( !convertToGray && ( d->m_pcPelFormat->colorSpace == CLP_COLOR_YUV ||
if( !scale ) d->m_pcPelFormat->colorSpace == CLP_COLOR_RGB ) )
scaleFactor = 1;
if( convertToGray )
{ {
channel = channel >= numChannels ? 0 : channel; fillRGBBuffer();
numChannels = 1; unsigned char* pARGB = d->m_pcARGB32;
for( unsigned int i = 0; i < d->m_uiWidth * d->m_uiHeight; i++ )
{
*pCvPel++ = *pARGB++;
*pCvPel++ = *pARGB++;
*pCvPel++ = *pARGB++;
pARGB++;
}
bRet = true;
} }
else if( convertToGray || d->m_pcPelFormat->colorSpace == CLP_COLOR_GRAY )
unsigned imgWidth = getWidth( channel );
unsigned imgHeight = getHeight( channel );
cvMat.create( imgHeight, imgWidth, CV_MAKETYPE( cvPrecision, numChannels ) );
if( numChannels > 1 )
{ {
cv::Mat tmpMat( imgHeight, imgWidth, CV_MAKETYPE( cvPrecision, numChannels ) ); ClpPel* pPel = d->m_pppcInputPel[CLP_LUMA][0];
for( unsigned int i = 0; i < d->m_uiWidth * d->m_uiHeight; i++ )
unsigned char* cv_data = tmpMat.data;
CalypPixel currPel;
for( unsigned y = 0; y < imgHeight; y++ )
{ {
for( unsigned x = 0; x < imgWidth; x++ ) *pCvPel++ = *pPel++;
{
currPel = getPixel( x, y ) * scaleFactor;
for( unsigned int ch = 0; ch < numChannels; ch++ )
for( unsigned b = 0; b < numBytes; b++ )
{
unsigned char pel = currPel[ch] >> ( 8 * b );
*cv_data++ = pel;
}
}
}
if( getNumberChannels() >= 1 )
{
// TODO: check for other formats
switch( getColorSpace() )
{
case CLP_COLOR_YUV:
cv::cvtColor( tmpMat, cvMat, cv::COLOR_YCrCb2RGB );
break;
}
} }
bRet = true;
} }
else else
{ {
unsigned char* cv_data = cvMat.data; return false;
ClpPel* pel = getPelBufferYUV()[channel][0];
for( unsigned y = 0; y < imgHeight * imgWidth; y++ )
{
ClpPel currPel = ( *pel++ ) * scaleFactor;
for( unsigned b = 0; b < numBytes; b++ )
*cv_data++ = currPel >> ( 8 * b );
}
} }
bRet = true;
#endif #endif
return bRet; return bRet;
} }
bool CalypFrame::fromMat( cv::Mat& cvMat, int channel ) bool CalypFrame::fromMat( cv::Mat& cvMat )
{ {
bool bRet = false; bool bRet = false;
#ifdef USE_OPENCV #ifdef USE_OPENCV
unsigned numBytes = getBitsPel() > 8 ? 2 : 1;
unsigned numChannels = getNumberChannels();
unsigned int cvPrecision = getBitsPel() > 8 ? CV_16U : CV_8U;
if( !d->m_bInit ) if( !d->m_bInit )
{ {
uchar depth = cvMat.type() & CV_MAT_DEPTH_MASK;
if( d->m_iPixelFormat == CLP_INVALID_FMT ) if( d->m_iPixelFormat == CLP_INVALID_FMT )
{ {
switch( cvMat.channels() ) switch( cvMat.channels() )
@@ -1260,69 +1107,35 @@ bool CalypFrame::fromMat( cv::Mat& cvMat, int channel )
return false; return false;
} }
} }
d->m_uiBitsPel = depth == CV_8U ? 8 : 16; d->init( cvMat.cols, cvMat.rows, d->m_iPixelFormat, 8 );
d->init( cvMat.cols, cvMat.rows, d->m_iPixelFormat, d->m_uiBitsPel );
} }
d->m_bHasRGBPel = false; d->m_bHasRGBPel = false;
d->m_bHasHistogram = false; d->m_bHasHistogram = false;
if( channel >= 0 ) unsigned char* pCvPel = cvMat.data;
numChannels = 1; if( d->m_iPixelFormat != CLP_GRAY )
else
channel = 0;
if( cvMat.channels() != int( numChannels ) )
{ {
return false; ClpPel* pInputPelR = d->m_pppcInputPel[CLP_COLOR_R][0];
} ClpPel* pInputPelG = d->m_pppcInputPel[CLP_COLOR_G][0];
ClpPel* pInputPelB = d->m_pppcInputPel[CLP_COLOR_B][0];
unsigned imgWidth = getWidth( channel ); for( unsigned int i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ )
unsigned imgHeight = getHeight( channel );
if( numChannels > 1 )
{
cv::Mat tmpMat( imgHeight, imgWidth, CV_MAKETYPE( cvPrecision, numChannels ) );
switch( getColorSpace() )
{ {
case CLP_COLOR_YUV: *pInputPelB++ = *pCvPel++;
cv::cvtColor( tmpMat, cvMat, cv::COLOR_RGB2YCrCb ); *pInputPelG++ = *pCvPel++;
break; *pInputPelR++ = *pCvPel++;
}
unsigned char* cv_data = tmpMat.data;
unsigned int cv_step = tmpMat.step;
CalypPixel currPel;
for( unsigned int y = 0; y < imgHeight; y++ )
{
for( unsigned int x = 0; x < imgWidth; x++ )
{
for( unsigned int ch = 0; ch < numChannels; ch++ )
{
currPel[ch] = 0;
for( unsigned b = 0; b < numBytes; b++ )
{
currPel[ch] = currPel[ch] + ( *( cv_data + y * cv_step + x * numChannels * numBytes + ch + b ) << ( 8 * b ) );
}
}
setPixel( x, y, currPel );
}
} }
bRet = true;
} }
else else
{ {
unsigned char* cv_data = cvMat.data; ClpPel* pPel = d->m_pppcInputPel[CLP_LUMA][0];
ClpPel curr_pel; for( unsigned int i = 0; i < d->m_uiWidth * d->m_uiHeight; i++ )
ClpPel* pel = getPelBufferYUV()[channel][0];
for( unsigned int y = 0; y < imgHeight * imgWidth; y++ )
{ {
curr_pel = 0; *pPel++ = *pCvPel++;
for( unsigned b = 0; b < numBytes; b++ )
curr_pel += ( *cv_data++ ) << ( 8 * b );
*pel++ = curr_pel;
} }
bRet = true;
} }
bRet = true;
#endif #endif
return bRet; return bRet;
} }
@@ -1339,17 +1152,6 @@ std::vector<ClpString> CalypFrame::supportedQualityMetricsList()
"PSNR", "PSNR",
"MSE", "MSE",
"SSIM", "SSIM",
"WS-PSNR",
};
}
std::vector<ClpString> CalypFrame::supportedQualityMetricsUnitsList()
{
return std::vector<ClpString>{
"dB",
"",
"",
"dB",
}; };
} }
@@ -1370,9 +1172,6 @@ double CalypFrame::getQuality( int Metric, CalypFrame* Org, unsigned int compone
case SSIM_METRIC: case SSIM_METRIC:
return getSSIM( Org, component ); return getSSIM( Org, component );
break; break;
case WSPSNR_METRIC:
return getWSPNR( Org, component );
break;
default: default:
assert( 0 ); assert( 0 );
}; };
@@ -1383,27 +1182,43 @@ double CalypFrame::getMSE( CalypFrame* Org, unsigned int component )
{ {
ClpPel* pPelYUV = getPelBufferYUV()[component][0]; ClpPel* pPelYUV = getPelBufferYUV()[component][0];
ClpPel* pOrgPelYUV = Org->getPelBufferYUV()[component][0]; ClpPel* pOrgPelYUV = Org->getPelBufferYUV()[component][0];
ClpULong numberOfPixels = Org->getHeight( component ) * Org->getWidth( component );
ClpULong ssd = 0; int aux_pel_1, aux_pel_2;
int diff = 0;
double ssd = 0;
unsigned int numberOfPixels = 0;
if( component == CLP_LUMA )
{
numberOfPixels = Org->getHeight() * Org->getWidth();
}
else
{
numberOfPixels = getChromaLength();
}
for( unsigned int i = 0; i < numberOfPixels; i++ ) for( unsigned int i = 0; i < numberOfPixels; i++ )
{ {
int diff = int( *pPelYUV++ ) - int( *pOrgPelYUV++ ); aux_pel_1 = *pPelYUV++;
ssd += diff * diff; aux_pel_2 = *pOrgPelYUV++;
diff = aux_pel_1 - aux_pel_2;
ssd += (double)( diff * diff );
} }
if( ssd == 0.0 ) if( ssd == 0.0 )
{ {
return 0.0; return 0.0;
} }
return double( ssd ) / double( numberOfPixels ); return ssd / double( numberOfPixels );
} }
double CalypFrame::getPSNR( CalypFrame* Org, unsigned int component ) double CalypFrame::getPSNR( CalypFrame* Org, unsigned int component )
{ {
ClpULong uiMaxValue = ( 1 << Org->getBitsPel() ) - 1; unsigned int uiMaxValue = ( 1 << Org->getBitsPel() ) - 1;
double uiMaxValueSquare = uiMaxValue * uiMaxValue;
double dPSNR = 100; double dPSNR = 100;
double dMSE = getMSE( Org, component ); double dMSE = getMSE( Org, component );
if( dMSE != 0 ) if( dMSE != 0 )
dPSNR = 10 * log10( double( uiMaxValue * uiMaxValue ) / dMSE ); dPSNR = 10 * log10( uiMaxValueSquare / dMSE );
return dPSNR; return dPSNR;
} }
@@ -1489,30 +1304,3 @@ double CalypFrame::getSSIM( CalypFrame* Org, unsigned int component )
} }
return dSSIM; return dSSIM;
} }
double CalypFrame::getWSPNR( CalypFrame* Org, unsigned int component )
{
ClpPel* pPelYUV = getPelBufferYUV()[component][0];
ClpPel* pOrgPelYUV = Org->getPelBufferYUV()[component][0];
unsigned height = getHeight( component );
unsigned width = getWidth( component );
double ssd = 0;
double weight_sum = 0;
for( unsigned y = 0; y < height; y++ )
for( unsigned x = 0; x < width; x++ )
{
int diff = int( *pPelYUV++ ) - int( *pOrgPelYUV++ );
double weight = cos( double( ( y + 0.5 - height / 2.0 ) * S_PI / height ) );
ssd += (double)( diff * diff * 1000 ) * weight;
weight_sum += weight * 1000;
}
if( ssd == 0.0 )
{
return 100.00;
}
unsigned long uiMaxValue = ( 1 << Org->getBitsPel() ) - 1;
return 10 * log10( double( uiMaxValue * uiMaxValue ) * weight_sum / ssd );
}
+30 -82
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-2018 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
@@ -100,7 +100,6 @@ public:
static std::vector<ClpString> supportedPixelFormatListNames( int colorSpace ); static std::vector<ClpString> supportedPixelFormatListNames( int colorSpace );
static int numberOfFormats(); static int numberOfFormats();
static int findPixelFormat( const ClpString& name ); static int findPixelFormat( const ClpString& name );
static int pelformatColorSpace( const int idx );
/** /**
* Creates a new frame using the following configuration * Creates a new frame using the following configuration
@@ -111,18 +110,7 @@ public:
* *
* @note this function might misbehave if the pixel format enum is not correct * @note this function might misbehave if the pixel format enum is not correct
*/ */
CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel = 8 ); CalypFrame( unsigned int width, unsigned int height, int pelFormat, int 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 );
/** /**
* Copy contructor * Copy contructor
@@ -157,7 +145,6 @@ public:
MATCH_PEL_FMT = 4, MATCH_PEL_FMT = 4,
MATCH_BITS = 8, MATCH_BITS = 8,
MATCH_COLOR_SPACE_IGNORE_GRAY = 16, MATCH_COLOR_SPACE_IGNORE_GRAY = 16,
MATCH_BYTES_PER_FRAME = 32,
MATCH_ALL = 0xFFFF, MATCH_ALL = 0xFFFF,
}; };
@@ -192,58 +179,46 @@ public:
* Get the number of channels * Get the number of channels
* @return number of channels * @return number of channels
*/ */
unsigned getNumberChannels() const; unsigned int getNumberChannels() const;
/** /**
* Get width of the frame * Get width of the frame
* @param channel/component * @param channel/component
* @return number of pixels * @return number of pixels
*/ */
unsigned int getWidth( unsigned channel = 0 ) const; unsigned int getWidth( int channel = 0 ) const;
/** /**
* Get height of the frame * Get height of the frame
* @param channel/component * @param channel/component
* @return number of pixels * @return number of pixels
*/ */
unsigned int getHeight( unsigned channel = 0 ) const; unsigned int getHeight( int 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
* @return number of pixels * @return number of pixels
*/ */
ClpULong getPixels( unsigned channel = 0 ) const; unsigned int getPixels( int channel = 0 ) const;
/**
* Get the total number of pixels of the frame
* @return number of pixels
*/
ClpULong getTotalNumberOfPixels() const;
/** /**
* Get chroma width ratio * Get chroma width ratio
* @return ratio multiple of 2 * @return ratio multiple of 2
*/ */
unsigned getChromaWidthRatio() const; unsigned char getChromaWidthRatio() const;
/** /**
* Get chroma height ratio * Get chroma height ratio
* @return ratio multiple of 2 * @return ratio multiple of 2
*/ */
unsigned getChromaHeightRatio() const; unsigned char getChromaHeightRatio() const;
/** /**
* Get number of pixels in each chroma channel * Get number of pixels in each chroma channel
* @return number of pixels * @return number of pixels
*/ */
ClpULong getChromaLength() const; unsigned int getChromaLength() const;
/** /**
* Get number of bits per pixel * Get number of bits per pixel
@@ -255,13 +230,13 @@ public:
* Get number of bytes per frame of an existing frame * Get number of bytes per frame of an existing frame
* @return number of bytes per frame * @return number of bytes per frame
*/ */
ClpULong getBytesPerFrame() const; unsigned long getBytesPerFrame();
/** /**
* Get number of bytes per frame of a specific pixel format * Get number of bytes per frame of a specific pixel format
* @return number of bytes per frame * @return number of bytes per frame
*/ */
static ClpULong getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel ); static unsigned long getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel );
/** /**
* Reset frame pixels to zero * Reset frame pixels to zero
@@ -274,14 +249,13 @@ public:
unsigned char* getRGBBuffer() const; unsigned char* getRGBBuffer() const;
/** /**
* Get pixel value at coordinates * Get pixel value at coordinates
* @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
@@ -289,7 +263,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
@@ -297,7 +271,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
@@ -316,32 +290,10 @@ public:
*/ */
void setPixel( unsigned int xPos, unsigned int yPos, CalypPixel pixel ); void setPixel( unsigned int xPos, unsigned int yPos, CalypPixel pixel );
/** void copyFrom( const CalypFrame& );
* Copy a frame into the current buffer void copyFrom( const CalypFrame* );
* @param other frame to be copied void copyFrom( const CalypFrame&, unsigned int, unsigned int );
*/ void copyFrom( const CalypFrame*, unsigned int, unsigned int );
void copyFrom( const CalypFrame& other );
void copyFrom( const CalypFrame* other );
/**
* Copy a region from a reference corresponding to the size
* of the size of the current frame
* @param other frame to be copied
* @param x x position on the reference frame
* @param y y position on the reference frame
*/
void copyFrom( const CalypFrame& other, unsigned x, unsigned y );
void copyFrom( const CalypFrame* other, unsigned x, unsigned y );
/**
* Copy a reference frame to a specific location on the current frame
* The whole reference frame is copied
* @param other frame to be copied
* @param x x position on the current frame
* @param y y position on the current frame
*/
void copyTo( const CalypFrame& other, unsigned x, unsigned y );
void copyTo( const CalypFrame* other, unsigned x, unsigned y );
void frameFromBuffer( ClpByte*, int, unsigned long ); void frameFromBuffer( ClpByte*, int, unsigned long );
void frameFromBuffer( ClpByte*, int ); void frameFromBuffer( ClpByte*, int );
@@ -370,24 +322,22 @@ public:
}; };
void calcHistogram(); void calcHistogram();
unsigned int getMinimumPelValue( unsigned channel ); unsigned int getMinimumPelValue( int channel );
unsigned int getMaximumPelValue( unsigned channel ); unsigned int getMaximumPelValue( int channel );
unsigned int getMaximum( unsigned channel ); unsigned int getMaximum( int channel );
unsigned int getNumPixelsRange( unsigned channel, unsigned int start, unsigned int end ); unsigned int getNumPixelsRange( int channel, unsigned int start, unsigned int end );
double getMean( unsigned channel, unsigned int start, unsigned int end ); double getMean( int channel, unsigned int start, unsigned int end );
int getMedian( unsigned channel, unsigned int start, unsigned int end ); int getMedian( int channel, unsigned int start, unsigned int end );
double getStdDev( unsigned channel, unsigned int start, unsigned int end ); double getStdDev( int channel, unsigned int start, unsigned int end );
double getHistogramValue( unsigned channel, unsigned int bin ); double getHistogramValue( int channel, unsigned int bin );
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
*/ */
bool toMat( cv::Mat& cvMat, bool convertToGray = false, bool scale = true, unsigned channel = 0 ); bool toMat( cv::Mat& cvMat, bool convertToGray = false );
bool fromMat( cv::Mat& cvMat, int iChannel = -1 ); bool fromMat( cv::Mat& cvMat );
/** /**
* \ingroup CalypFrameGrp * \ingroup CalypFrameGrp
@@ -403,17 +353,15 @@ public:
PSNR_METRIC = 0, PSNR_METRIC = 0,
MSE_METRIC, MSE_METRIC,
SSIM_METRIC, SSIM_METRIC,
WSPSNR_METRIC,
NUMBER_METRICS, NUMBER_METRICS,
}; };
static std::vector<ClpString> supportedQualityMetricsList(); static std::vector<ClpString> supportedQualityMetricsList();
static std::vector<ClpString> supportedQualityMetricsUnitsList();
double getQuality( int Metric, CalypFrame* Org, unsigned int component ); double getQuality( int Metric, CalypFrame* Org, unsigned int component );
double getMSE( CalypFrame* Org, unsigned int component ); double getMSE( CalypFrame* Org, unsigned int component );
double getPSNR( CalypFrame* Org, unsigned int component ); double getPSNR( CalypFrame* Org, unsigned int component );
double getSSIM( CalypFrame* Org, unsigned int component ); double getSSIM( CalypFrame* Org, unsigned int component );
double getWSPNR( CalypFrame* Org, unsigned int component );
/** @} */ /** @} */
private: private:
+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-2018 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
+7 -23
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-2018 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
@@ -36,6 +36,7 @@
#include "CalypFrame.h" #include "CalypFrame.h"
#include "CalypOptions.h" #include "CalypOptions.h"
#include "CalypStream.h"
#define REGISTER_CLASS_MAKER( X ) \ #define REGISTER_CLASS_MAKER( X ) \
extern "C" CalypModuleIf* Maker() { return new X; } extern "C" CalypModuleIf* Maker() { return new X; }
@@ -50,11 +51,6 @@ public: \
if( !apcFrameList[i] ) \ if( !apcFrameList[i] ) \
return false; return false;
#define _BASIC_MODULE_API_3_BREAK_CONDITION_ \
if( m_iFrameBufferCount == 0 ) \
if( apcFrameList.size() <= 0 ) \
return NULL;
/** Module_API_Version Enum /** Module_API_Version Enum
* \ingroup Calyp_Modules * \ingroup Calyp_Modules
* Version of the modules API required * Version of the modules API required
@@ -64,7 +60,6 @@ enum Module_API_Version
{ {
CLP_MODULE_API_1, CLP_MODULE_API_1,
CLP_MODULE_API_2, CLP_MODULE_API_2,
CLP_MODULE_API_3,
}; };
/** Module_Type Enum /** Module_Type Enum
@@ -76,6 +71,7 @@ enum Module_Type
{ {
CLP_FRAME_PROCESSING_MODULE, CLP_FRAME_PROCESSING_MODULE,
CLP_FRAME_MEASUREMENT_MODULE, CLP_FRAME_MEASUREMENT_MODULE,
CLP_STREAM_PROCESSING_MODULE,
CLP_MODULE_TYPE_MAX = 255, CLP_MODULE_TYPE_MAX = 255,
}; };
@@ -124,9 +120,6 @@ public:
//! Features/Requirements //! Features/Requirements
unsigned int m_uiModuleRequirements; unsigned int m_uiModuleRequirements;
unsigned int m_iFrameBufferCount;
CalypFrame* m_pcOutputFrame;
CalypOptions m_cModuleOptions; CalypOptions m_cModuleOptions;
CalypModuleIf() CalypModuleIf()
@@ -134,8 +127,6 @@ public:
m_iModuleAPI = CLP_MODULE_API_1; m_iModuleAPI = CLP_MODULE_API_1;
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING; m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING;
m_pchModuleLongName = NULL; m_pchModuleLongName = NULL;
m_pcOutputFrame = NULL;
m_iFrameBufferCount = 0;
} }
virtual ~CalypModuleIf() {} virtual ~CalypModuleIf() {}
virtual void Delete() = 0; virtual void Delete() = 0;
@@ -155,21 +146,14 @@ public:
/** /**
* Module API version 2 * Module API version 2
*/ */
virtual bool create( std::vector<CalypFrame*> apcFrameList ) { return false; } virtual bool create( std::vector<CalypFrame*> ) { return false; }
virtual CalypFrame* process( std::vector<CalypFrame*> ) { return NULL; } virtual CalypFrame* process( std::vector<CalypFrame*> ) { return NULL; }
virtual double measure( std::vector<CalypFrame*> ) { return 0; } virtual double measure( std::vector<CalypFrame*> ) { return 0; }
virtual bool keyPressed( enum Module_Key_Supported ) { return false; } virtual bool keyPressed( enum Module_Key_Supported ) { return false; }
virtual ClpString moduleInfo() { return ClpString(); } virtual ClpString moduleInfo() { return ClpString(); }
/**
* Module API version 3 virtual bool create( std::vector<CalypStream*> ) { return false; };
*/ virtual CalypStream* process( std::vector<CalypStream*> ) { return NULL; }
virtual CalypFrame* getProcessedFrame() { return m_pcOutputFrame; }
virtual bool needFrame() { return m_iFrameBufferCount == 0 ? true : false; };
virtual bool flush()
{
m_iFrameBufferCount = 0;
return true;
};
}; };
#endif // __CALYPMODULESIF_H__ #endif // __CALYPMODULESIF_H__
-83
View File
@@ -1,83 +0,0 @@
/* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* \file CalypOpenCVModuleIf.cpp
* \brief Calyp modules interface for OpenCV
*/
#include "CalypOpenCVModuleIf.h"
// OpenCV
#include <opencv2/opencv.hpp>
using cv::Mat;
bool CalypOpenCVModuleIf::create( std::vector<CalypFrame*> apcFrameList )
{
_BASIC_MODULE_API_2_CHECK_
bool bRet = false;
std::vector<Mat*> acMatList( apcFrameList.size() );
for( unsigned i = 0; i < apcFrameList.size(); i++ )
{
acMatList[i] = new Mat;
apcFrameList[i]->toMat( *acMatList[i], m_bConvertToGray );
}
Mat* outputMat = create_using_opencv( acMatList );
if( outputMat )
{
unsigned pelFormat = m_bConvertToGray ? CalypFrame::findPixelFormat( "GRAY" ) : apcFrameList[0]->getPelFormat();
m_pcOutputFrame = new CalypFrame( outputMat->cols, outputMat->rows, pelFormat, apcFrameList[0]->getBitsPel() );
bRet = true;
}
else
{
return false;
}
for( unsigned i = 0; i < apcFrameList.size(); i++ )
{
delete acMatList[i];
}
return bRet;
}
CalypFrame* CalypOpenCVModuleIf::process( std::vector<CalypFrame*> apcFrameList )
{
m_pcOutputFrame->reset();
std::vector<Mat*> acMatList( apcFrameList.size() );
for( unsigned i = 0; i < apcFrameList.size(); i++ )
{
acMatList[i] = new Mat;
apcFrameList[i]->toMat( *acMatList[i], m_bConvertToGray );
}
Mat* cvOutput = process_using_opencv( acMatList );
m_pcOutputFrame->fromMat( *cvOutput );
for( unsigned i = 0; i < apcFrameList.size(); i++ )
{
delete acMatList[i];
}
return m_pcOutputFrame;
}
void CalypOpenCVModuleIf::destroy()
{
if( m_pcOutputFrame )
delete m_pcOutputFrame;
m_pcOutputFrame = NULL;
}
-65
View File
@@ -1,65 +0,0 @@
/* This file is a part of Calyp project
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
/**
* \file CalypOpenCVModuleIf.h
* \ingroup CalypLibGroup
* \brief Calyp modules interface for OpenCV
*/
#ifndef __CALYPOPENCVMODULEIF_H__
#define __CALYPOPENCVMODULEIF_H__
#include "CalypModuleIf.h"
namespace cv
{
class Mat;
}
/**
* \class CalypOpenCVModuleIf
* \ingroup CalypLib Calyp_Modules
* \brief Abstract class for modules using OpenCV library
*/
class CalypOpenCVModuleIf : public CalypModuleIf
{
protected:
const char* m_pchPythonFunctionName;
bool m_bConvertToGray;
public:
CalypOpenCVModuleIf()
{
m_bConvertToGray = false;
};
virtual ~CalypOpenCVModuleIf() {}
// Common API
bool create( std::vector<CalypFrame*> apcFrameList );
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
void destroy();
// API using OpenCV
virtual cv::Mat* create_using_opencv( std::vector<cv::Mat*> apcFrameList ) { return NULL; };
virtual cv::Mat* process_using_opencv( std::vector<cv::Mat*> apcFrameList ) = 0;
virtual void destroy_using_opencv(){};
};
#endif // __CALYPOPENCVMODULEIF_H__
+14 -20
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
@@ -62,7 +62,7 @@ class boolOption : public OptionBase
{ {
public: public:
boolOption( const ClpString& name, const ClpString& desc ) boolOption( const ClpString& name, const ClpString& desc )
: OptionBase( name, desc, "(1-0)" ) { is_binary = true; } : OptionBase( name, desc ) { is_binary = true; }
void parse( const ClpString& arg ) { arg_count++; } void parse( const ClpString& arg ) { arg_count++; }
}; };
@@ -71,8 +71,8 @@ template <typename T>
class StandardOption : public OptionBase class StandardOption : public OptionBase
{ {
public: public:
StandardOption( const ClpString& name, T& storage, const ClpString& desc, const ClpString& def ) StandardOption( const ClpString& name, T& storage, const ClpString& desc )
: OptionBase( name, desc, def ), opt_storage( storage ) : OptionBase( name, desc ), opt_storage( storage )
{ {
is_binary = false; is_binary = false;
} }
@@ -160,8 +160,8 @@ struct FunctionOption : public OptionBase
public: public:
typedef void( Func )( CalypOptions&, const ClpString& ); typedef void( Func )( CalypOptions&, const ClpString& );
FunctionOption( const ClpString& name, CalypOptions& parent_, Func* func_, const ClpString& desc, const ClpString& def ) FunctionOption( const ClpString& name, CalypOptions& parent_, Func* func_, const ClpString& desc )
: OptionBase( name, desc, def ), parent( parent_ ), func( func_ ) : OptionBase( name, desc ), parent( parent_ ), func( func_ )
{ {
is_binary = false; is_binary = false;
} }
@@ -198,13 +198,6 @@ CalypOptions& CalypOptions::operator()( const ClpString& name, const ClpString&
*/ */
template <typename T> template <typename T>
CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc ) CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc )
{
addOption( new StandardOption<T>( name, storage, desc, ClpString( "" ) ) );
return *this;
}
template <typename T>
CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc, const ClpString& defaults )
{ {
addOption( new StandardOption<T>( name, storage, desc ) ); addOption( new StandardOption<T>( name, storage, desc ) );
return *this; return *this;
@@ -284,7 +277,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 +470,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[] )
+6 -10
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
@@ -55,8 +55,8 @@
class OptionBase class OptionBase
{ {
public: public:
OptionBase( const ClpString& name, const ClpString& desc, const ClpString& def ) OptionBase( const ClpString& name, const ClpString& desc )
: arg_count( 0 ), opt_string( name ), opt_desc( desc ), opt_defaults( def ) {} : arg_count( 0 ), opt_string( name ), opt_desc( desc ) {}
virtual ~OptionBase() {} virtual ~OptionBase() {}
/* parse argument arg, to obtain a value for the option */ /* parse argument arg, to obtain a value for the option */
virtual void parse( const ClpString& arg ) = 0; virtual void parse( const ClpString& arg ) = 0;
@@ -65,7 +65,6 @@ public:
int arg_count; int arg_count;
ClpString opt_string; ClpString opt_string;
ClpString opt_desc; ClpString opt_desc;
ClpString opt_defaults;
bool is_binary; bool is_binary;
}; };
@@ -90,7 +89,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; }
@@ -118,14 +117,11 @@ public:
* Add option described by name to the parent Options list, * Add option described by name to the parent Options list,
* with storage for the option's value * with storage for the option's value
* with default_val as the default value * with default_val as the default value
* description and range along with default value * with desc as an optional help description
*/ */
template <typename T> template <typename T>
CalypOptions& operator()( const ClpString& name, T& storage, const ClpString& desc ); CalypOptions& operator()( const ClpString& name, T& storage, const ClpString& desc );
template <typename T>
CalypOptions& operator()( const ClpString& name, T& storage, const ClpString& desc, const ClpString& defaults );
bool checkListingOpts(); bool checkListingOpts();
private: private:
+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-2018 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 )
+18 -31
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-2018 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
@@ -78,7 +78,6 @@ std::vector<CalypStandardResolution> CalypStream::stdResolutionSizes()
std::vector<CalypStandardResolution> stdResList; std::vector<CalypStandardResolution> stdResList;
CalypStandardResolution stdResElement; CalypStandardResolution stdResElement;
REGIST_CALYP_STANDARD_RESOLUTION( "QCIF", 176, 144 );
REGIST_CALYP_STANDARD_RESOLUTION( "CIF", 352, 288 ); REGIST_CALYP_STANDARD_RESOLUTION( "CIF", 352, 288 );
REGIST_CALYP_STANDARD_RESOLUTION( "VGA", 640, 480 ); REGIST_CALYP_STANDARD_RESOLUTION( "VGA", 640, 480 );
REGIST_CALYP_STANDARD_RESOLUTION( "WVGA", 832, 480 ); REGIST_CALYP_STANDARD_RESOLUTION( "WVGA", 832, 480 );
@@ -90,9 +89,7 @@ std::vector<CalypStandardResolution> CalypStream::stdResolutionSizes()
REGIST_CALYP_STANDARD_RESOLUTION( "FullHD", 1920, 1080 ); REGIST_CALYP_STANDARD_RESOLUTION( "FullHD", 1920, 1080 );
REGIST_CALYP_STANDARD_RESOLUTION( "WQXGA", 2560, 1600 ); REGIST_CALYP_STANDARD_RESOLUTION( "WQXGA", 2560, 1600 );
REGIST_CALYP_STANDARD_RESOLUTION( "UltraHD", 3840, 2160 ); REGIST_CALYP_STANDARD_RESOLUTION( "UltraHD", 3840, 2160 );
REGIST_CALYP_STANDARD_RESOLUTION( "6K 2:1", 6144, 3072 ); REGIST_CALYP_STANDARD_RESOLUTION( "8K", 8192, 4608 );
REGIST_CALYP_STANDARD_RESOLUTION( "8K", 7680, 4320 );
REGIST_CALYP_STANDARD_RESOLUTION( "8K 2:1", 8192, 4096 );
return stdResList; return stdResList;
} }
@@ -103,11 +100,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;
@@ -229,16 +226,16 @@ CalypStream::~CalypStream()
close(); close();
} }
ClpString CalypStream::getFormatName() const ClpString CalypStream::getFormatName()
{ {
return !d->handler ? "" : d->handler->getFormatName(); return !d->handler ? "" : d->handler->getFormatName();
} }
ClpString CalypStream::getCodecName() const ClpString CalypStream::getCodecName()
{ {
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 +258,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 +311,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 )
{ {
@@ -398,17 +389,17 @@ void CalypStream::close()
d->isInit = false; d->isInit = false;
} }
ClpString CalypStream::getFileName() const ClpString CalypStream::getFileName()
{ {
return d->cFilename; return d->cFilename;
} }
bool CalypStream::isNative() const bool CalypStream::isNative()
{ {
return d->handler->m_bNative; return d->handler->m_bNative;
} }
ClpULong CalypStream::getFrameNum() const unsigned int CalypStream::getFrameNum()
{ {
return d->handler->m_uiTotalNumberFrames; return d->handler->m_uiTotalNumberFrames;
} }
@@ -420,26 +411,22 @@ unsigned int CalypStream::getHeight() const
{ {
return d->handler->m_uiHeight; return d->handler->m_uiHeight;
} }
unsigned int CalypStream::getBitsPerPixel() const
{
return d->handler->m_uiBitsPerPixel;
}
int CalypStream::getEndianess() const int CalypStream::getEndianess() const
{ {
return d->handler->m_iEndianness; return d->handler->m_iEndianness;
} }
double CalypStream::getFrameRate() const double CalypStream::getFrameRate()
{ {
return d->handler->m_dFrameRate; return d->handler->m_dFrameRate;
} }
long CalypStream::getCurrFrameNum() const int CalypStream::getCurrFrameNum()
{ {
return d->iCurrFrameNum; return d->iCurrFrameNum;
} }
void CalypStream::getFormat( unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPel, int& rEndianness, void CalypStream::getFormat( unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPel, int& rEndianness,
unsigned int& rFrameRate ) const unsigned int& rFrameRate )
{ {
if( d->isInit ) if( d->isInit )
{ {
@@ -485,7 +472,7 @@ void CalypStream::loadAll()
d->iCurrFrameNum = 0; d->iCurrFrameNum = 0;
} }
void CalypStream::getDuration( int* duration_array ) const void CalypStream::getDuration( int* duration_array )
{ {
// int hours, mins, secs = 0; // int hours, mins, secs = 0;
// #ifdef USE_FFMPEG // #ifdef USE_FFMPEG
@@ -584,7 +571,7 @@ void CalypStream::readNextFrameFillRGBBuffer()
return; return;
} }
CalypFrame* CalypStream::getCurrFrame( CalypFrame* pyuv_image ) const CalypFrame* CalypStream::getCurrFrame( CalypFrame* pyuv_image )
{ {
if( pyuv_image == NULL ) if( pyuv_image == NULL )
pyuv_image = new CalypFrame( d->frameBuffer->current() ); pyuv_image = new CalypFrame( d->frameBuffer->current() );
@@ -593,7 +580,7 @@ CalypFrame* CalypStream::getCurrFrame( CalypFrame* pyuv_image ) const
return pyuv_image; return pyuv_image;
} }
CalypFrame* CalypStream::getCurrFrame() const CalypFrame* CalypStream::getCurrFrame()
{ {
return d->frameBuffer->current(); return d->frameBuffer->current();
} }
+13 -19
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-2018 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
@@ -67,32 +67,26 @@ public:
CalypStream(); CalypStream();
~CalypStream(); ~CalypStream();
ClpString getFormatName() const; ClpString getFormatName();
; ClpString getCodecName();
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();
bool isNative() const; bool isNative();
ClpString getFileName() const; ClpString getFileName();
ClpULong getFrameNum() const; unsigned int getFrameNum();
unsigned int getWidth() const; unsigned int getWidth() const;
unsigned int getHeight() const; unsigned int getHeight() const;
unsigned int getBitsPerPixel() const;
int getEndianess() const; int getEndianess() const;
long getCurrFrameNum() const; int getCurrFrameNum();
double getFrameRate() const; double getFrameRate();
void getFormat( unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPel, int& rEndianness, void getFormat( unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPel, int& rEndianness,
unsigned int& rFrameRate ) const; unsigned int& rFrameRate );
void loadAll(); void loadAll();
@@ -102,18 +96,18 @@ public:
bool saveFrame( const ClpString& filename ); bool saveFrame( const ClpString& filename );
static bool saveFrame( const ClpString& filename, CalypFrame* saveFrame ); static bool saveFrame( const ClpString& filename, CalypFrame* saveFrame );
CalypFrame* getCurrFrame( CalypFrame* ) const; CalypFrame* getCurrFrame( CalypFrame* );
// continuous read control // continuous read control
bool setNextFrame(); bool setNextFrame();
void readNextFrame(); void readNextFrame();
void readNextFrameFillRGBBuffer(); void readNextFrameFillRGBBuffer();
CalypFrame* getCurrFrame() const; CalypFrame* getCurrFrame();
bool seekInputRelative( bool bIsFoward ); bool seekInputRelative( bool bIsFoward );
bool seekInput( unsigned long new_frame_num ); bool seekInput( unsigned long new_frame_num );
void getDuration( int* duration_array ) const; void getDuration( int* duration_array );
private: private:
bool readFrame( CalypFrame* frame ); bool readFrame( CalypFrame* frame );
+7 -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-2018 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
@@ -37,7 +37,7 @@
formatElem.formatName = name; \ formatElem.formatName = name; \
formatElem.formatExt = clpLowercase( ext ); \ formatElem.formatExt = clpLowercase( ext ); \
formatElem.formatFct = handler; \ formatElem.formatFct = handler; \
formatsList.push_back( formatElem ) formatsList.push_back( formatElem );
#define REGIST_CALYP_SUPPORTED_ABSTRACT_FMT( handler, name, pattern ) \ #define REGIST_CALYP_SUPPORTED_ABSTRACT_FMT( handler, name, pattern ) \
formatElem.formatPattern = pattern; \ formatElem.formatPattern = pattern; \
@@ -70,13 +70,13 @@ public:
CalypStreamHandlerIf() CalypStreamHandlerIf()
: m_bIsInput( true ) : m_bIsInput( true )
, m_bNative( true ) , m_bNative( true )
, m_uiCurrFrameFileIdx( 0 )
, m_uiWidth( 0 ) , m_uiWidth( 0 )
, m_uiHeight( 0 ) , m_uiHeight( 0 )
, m_iPixelFormat( -1 ) , m_iPixelFormat( -1 )
, m_uiBitsPerPixel( 8 ) , m_uiBitsPerPixel( 8 )
, m_iEndianness( -1 ) , m_iEndianness( -1 )
, m_dFrameRate( 30 ) , m_dFrameRate( 30 )
, m_uiCurrFrameFileIdx( 0 )
, m_uiTotalNumberFrames( 0 ) , m_uiTotalNumberFrames( 0 )
, m_pStreamBuffer( NULL ) , m_pStreamBuffer( NULL )
, m_uiNBytesPerFrame( 0 ) , m_uiNBytesPerFrame( 0 )
@@ -89,7 +89,7 @@ public:
virtual bool openHandler( ClpString strFilename, bool bInput ) = 0; virtual bool openHandler( ClpString strFilename, bool bInput ) = 0;
virtual void closeHandler() = 0; virtual void closeHandler() = 0;
virtual bool configureBuffer( CalypFrame* pcFrame ) = 0; virtual bool configureBuffer( CalypFrame* pcFrame ) = 0;
virtual bool seek( ClpULong iFrameNum ) = 0; virtual bool seek( unsigned long long int iFrameNum ) = 0;
virtual bool read( CalypFrame* pcFrame ) = 0; virtual bool read( CalypFrame* pcFrame ) = 0;
virtual bool write( CalypFrame* pcFrame ) = 0; virtual bool write( CalypFrame* pcFrame ) = 0;
@@ -105,6 +105,7 @@ protected:
ClpString m_strCodecName; ClpString m_strCodecName;
bool m_bIsInput; bool m_bIsInput;
bool m_bNative; bool m_bNative;
unsigned long m_uiCurrFrameFileIdx;
ClpString m_cFilename; ClpString m_cFilename;
unsigned int m_uiWidth; unsigned int m_uiWidth;
unsigned int m_uiHeight; unsigned int m_uiHeight;
@@ -112,10 +113,9 @@ protected:
unsigned int m_uiBitsPerPixel; unsigned int m_uiBitsPerPixel;
int m_iEndianness; int m_iEndianness;
double m_dFrameRate; double m_dFrameRate;
ClpULong m_uiCurrFrameFileIdx; unsigned long m_uiTotalNumberFrames;
ClpULong m_uiTotalNumberFrames;
ClpByte* m_pStreamBuffer; ClpByte* m_pStreamBuffer;
ClpULong m_uiNBytesPerFrame; unsigned long m_uiNBytesPerFrame;
bool m_isEOF; bool m_isEOF;
}; };
+2 -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-2018 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
@@ -55,8 +55,7 @@ static inline void* xCallocMem( size_t nitems, size_t size )
{ {
size_t padded_size = nitems * size; size_t padded_size = nitems * size;
void* d = xMallocMem( padded_size ); void* d = xMallocMem( padded_size );
if( d ) memset( d, 0, (int)padded_size );
memset( d, 0, (int)padded_size );
return d; return d;
} }
+48 -31
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-2018 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
@@ -56,9 +56,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
1, 1,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV420P ), ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV420P ),
{ {
{ 0, 0, 1 }, /* Y */ {0, 0, 1}, /* Y */
{ 1, 0, 1 }, /* U */ {1, 0, 1}, /* U */
{ 2, 0, 1 }, /* V */ {2, 0, 1}, /* V */
}, },
}, },
}, },
@@ -73,9 +73,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0, 0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV422P ), ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV422P ),
{ {
{ 0, 0, 1 }, /* Y */ {0, 0, 1}, /* Y */
{ 1, 0, 1 }, /* U */ {1, 0, 1}, /* U */
{ 2, 0, 1 }, /* V */ {2, 0, 1}, /* V */
}, },
}, },
}, },
@@ -90,9 +90,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0, 0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV444P ), ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUV444P ),
{ {
{ 0, 0, 1 }, /* Y */ {0, 0, 1}, /* Y */
{ 1, 0, 1 }, /* U */ {1, 0, 1}, /* U */
{ 2, 0, 1 }, /* V */ {2, 0, 1}, /* V */
}, },
}, },
}, },
@@ -107,9 +107,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0, 0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUYV422 ), ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_YUYV422 ),
{ {
{ 0, 1, 1 }, /* Y */ {0, 1, 1}, /* Y */
{ 0, 3, 2 }, /* U */ {0, 3, 2}, /* U */
{ 0, 3, 4 }, /* V */ {0, 3, 4}, /* V */
}, },
}, },
}, },
@@ -123,7 +123,7 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0, 0,
0, 0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_GRAY8 ), ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_GRAY8 ),
{ { 0, 0, 1 } }, /* Y */ {{0, 0, 1}}, /* Y */
}, },
}, },
{ {
@@ -137,9 +137,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0, 0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_NONE ), ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_NONE ),
{ {
{ 0, 0, 1 }, /* R */ {0, 0, 1}, /* R */
{ 1, 0, 1 }, /* G */ {1, 0, 1}, /* G */
{ 2, 0, 1 }, /* B */ {2, 0, 1}, /* B */
}, },
}, },
}, },
@@ -154,9 +154,9 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0, 0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGB24 ), ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGB24 ),
{ {
{ 0, 2, 1 }, /* R */ {0, 2, 1}, /* R */
{ 0, 2, 2 }, /* G */ {0, 2, 2}, /* G */
{ 0, 2, 3 }, /* B */ {0, 2, 3}, /* B */
}, },
}, },
}, },
@@ -171,9 +171,26 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0, 0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGR24 ), ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGR24 ),
{ {
{ 0, 2, 3 }, /* R */ {0, 2, 3}, /* R */
{ 0, 2, 2 }, /* G */ {0, 2, 2}, /* G */
{ 0, 2, 1 }, /* B */ {0, 2, 1}, /* B */
},
},
},
{
CLP_BGR24,
{
"BGR",
CLP_COLOR_RGB,
3,
1,
0,
0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGR24 ),
{
{0, 2, 3}, /* R */
{0, 2, 2}, /* G */
{0, 2, 1}, /* B */
}, },
}, },
}, },
@@ -188,10 +205,10 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0, 0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGBA ), ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_RGBA ),
{ {
{ 0, 3, 1 }, /* R */ {0, 3, 1}, /* R */
{ 0, 3, 2 }, /* G */ {0, 3, 2}, /* G */
{ 0, 3, 3 }, /* B */ {0, 3, 3}, /* B */
{ 0, 3, 4 }, /* A */ {0, 3, 4}, /* A */
}, },
}, },
}, },
@@ -206,10 +223,10 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
0, 0,
ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGRA ), ADD_FFMPEG_PEL_FMT( AV_PIX_FMT_BGRA ),
{ {
{ 0, 3, 3 }, /* R */ {0, 3, 3}, /* R */
{ 0, 3, 2 }, /* G */ {0, 3, 2}, /* G */
{ 0, 3, 1 }, /* B */ {0, 3, 1}, /* B */
{ 0, 3, 4 }, /* A */ {0, 3, 4}, /* A */
}, },
}, },
}, },
+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-2018 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 )
+7 -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-2018 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 "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"
#if( ( LIBAVCODEC_VERSION_MAJOR > 57 ) || ( LIBAVCODEC_VERSION_MAJOR == 57 ) && ( LIBAVCODEC_VERSION_MINOR >= 37 ) ) #include <cstdio>
#include <iostream>
#if( ( 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
#endif #endif
@@ -335,7 +335,7 @@ bool StreamHandlerLibav::configureBuffer( CalypFrame* pcFrame )
void StreamHandlerLibav::calculateFrameNumber() void StreamHandlerLibav::calculateFrameNumber()
{ {
ClpULong num_frames; unsigned long long int num_frames;
/*if( m_cStream->nb_frames ) /*if( m_cStream->nb_frames )
{ {
num_frames = m_cStream->nb_frames; num_frames = m_cStream->nb_frames;
@@ -442,7 +442,7 @@ bool StreamHandlerLibav::write( CalypFrame* pcFrame )
return false; return false;
} }
bool StreamHandlerLibav::seek( ClpULong iFrameNum ) bool StreamHandlerLibav::seek( unsigned long long int iFrameNum )
{ {
if( m_uiTotalNumberFrames == 1 ) if( m_uiTotalNumberFrames == 1 )
return true; return true;
+2 -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-2018 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>
@@ -67,7 +66,7 @@ public:
void closeHandler(); void closeHandler();
bool configureBuffer( CalypFrame* pcFrame ); bool configureBuffer( CalypFrame* pcFrame );
void calculateFrameNumber(); void calculateFrameNumber();
bool seek( ClpULong iFrameNum ); bool seek( unsigned long long int iFrameNum );
bool read( CalypFrame* pcFrame ); bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame ); bool write( CalypFrame* pcFrame );
+16 -27
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-2018 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,11 @@
#include "StreamHandlerOpenCV.h" #include "StreamHandlerOpenCV.h"
#include <cstdio>
#include <opencv2/opencv.hpp>
#include "CalypFrame.h" #include "CalypFrame.h"
#include "LibMemory.h" #include "LibMemory.h"
#if CV_MAJOR_VERSION >= 3
#include <opencv2/videoio.hpp> #include <cstdio>
#endif #include <opencv2/opencv.hpp>
using cv::Mat; using cv::Mat;
using cv::VideoCapture; using cv::VideoCapture;
@@ -40,8 +37,7 @@ std::vector<CalypStreamFormat> StreamHandlerOpenCV::supportedReadFormats()
{ {
INI_REGIST_CALYP_SUPPORTED_FMT; INI_REGIST_CALYP_SUPPORTED_FMT;
#if( CV_MAJOR_VERSION >= 3 ) #if( CV_MAJOR_VERSION >= 3 )
REGIST_CALYP_SUPPORTED_ABSTRACT_FMT( &StreamHandlerOpenCV::Create, "Device", REGIST_CALYP_SUPPORTED_ABSTRACT_FMT( &StreamHandlerOpenCV::Create, "Device", "/dev/video*" );
"/dev/video*" );
#endif #endif
END_REGIST_CALYP_SUPPORTED_FMT; END_REGIST_CALYP_SUPPORTED_FMT;
} }
@@ -49,12 +45,10 @@ std::vector<CalypStreamFormat> StreamHandlerOpenCV::supportedReadFormats()
std::vector<CalypStreamFormat> StreamHandlerOpenCV::supportedWriteFormats() std::vector<CalypStreamFormat> StreamHandlerOpenCV::supportedWriteFormats()
{ {
INI_REGIST_CALYP_SUPPORTED_FMT; INI_REGIST_CALYP_SUPPORTED_FMT;
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Portable PixMap ", "ppm" );
"Portable Network Graphics", "png" ); REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Portable Network Graphics", "png" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Joint Photographic Experts Group", "jpg" );
"Joint Photographic Experts Group", "jpg" ); REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Windows Bitmap", "bmp" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Windows Bitmap",
"bmp" );
END_REGIST_CALYP_SUPPORTED_FMT; END_REGIST_CALYP_SUPPORTED_FMT;
} }
@@ -84,20 +78,14 @@ bool StreamHandlerOpenCV::openHandler( ClpString strFilename, bool bInput )
m_strFormatName = "DEV"; m_strFormatName = "DEV";
m_strCodecName = "Raw Video"; m_strCodecName = "Raw Video";
pcVideoCapture = new VideoCapture( iDeviceId ); pcVideoCapture = new VideoCapture( iDeviceId );
#if CV_MAJOR_VERSION >= 4
m_uiWidth = pcVideoCapture->get( cv::CAP_PROP_FRAME_WIDTH );
m_uiHeight = pcVideoCapture->get( cv::CAP_PROP_FRAME_HEIGHT );
#else
m_uiWidth = pcVideoCapture->get( CV_CAP_PROP_FRAME_WIDTH ); m_uiWidth = pcVideoCapture->get( CV_CAP_PROP_FRAME_WIDTH );
m_uiHeight = pcVideoCapture->get( CV_CAP_PROP_FRAME_HEIGHT ); m_uiHeight = pcVideoCapture->get( CV_CAP_PROP_FRAME_HEIGHT );
#endif
m_dFrameRate = 25; m_dFrameRate = 25;
} }
else else
#endif #endif
{ {
m_strCodecName = m_strFormatName = m_strCodecName = m_strFormatName = clpUppercase( strFilename.substr( strFilename.find_last_of( "." ) + 1 ) );
clpUppercase( strFilename.substr( strFilename.find_last_of( "." ) + 1 ) );
Mat cvMat = cv::imread( m_cFilename ); Mat cvMat = cv::imread( m_cFilename );
m_uiWidth = cvMat.cols; m_uiWidth = cvMat.cols;
m_uiHeight = cvMat.rows; m_uiHeight = cvMat.rows;
@@ -131,7 +119,7 @@ bool StreamHandlerOpenCV::configureBuffer( CalypFrame* pcFrame )
return true; return true;
} }
bool StreamHandlerOpenCV::seek( ClpULong iFrameNum ) bool StreamHandlerOpenCV::seek( unsigned long long int iFrameNum )
{ {
// m_uiCurrFrameFileIdx = // m_uiCurrFrameFileIdx =
return true; return true;
@@ -161,9 +149,10 @@ bool StreamHandlerOpenCV::write( CalypFrame* pcFrame )
{ {
bool bRet = false; bool bRet = false;
Mat cvFrame; Mat cvFrame;
bRet = pcFrame->toMat( cvFrame, false, true ); bRet = pcFrame->toMat( cvFrame );
if( !bRet ) if( bRet )
return bRet; {
bRet = cv::imwrite( m_cFilename, cvFrame ); bRet = cv::imwrite( m_cFilename, cvFrame );
}
return bRet; return bRet;
} }
+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-2018 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
@@ -43,7 +43,7 @@ public:
bool openHandler( ClpString strFilename, bool bInput ); bool openHandler( ClpString strFilename, bool bInput );
void closeHandler(); void closeHandler();
bool configureBuffer( CalypFrame* pcFrame ); bool configureBuffer( CalypFrame* pcFrame );
bool seek( ClpULong iFrameNum ); bool seek( unsigned long long int iFrameNum );
bool read( CalypFrame* pcFrame ); bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame ); bool write( CalypFrame* pcFrame );
+30 -44
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-2018 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 "StreamHandlerPortableMap.h" #include "StreamHandlerPortableMap.h"
#include <cmath>
#include <cstdio>
#include "CalypFrame.h" #include "CalypFrame.h"
#include "LibMemory.h" #include "LibMemory.h"
#include <cmath>
#include <cstdio>
std::vector<CalypStreamFormat> StreamHandlerPortableMap::supportedReadFormats() std::vector<CalypStreamFormat> StreamHandlerPortableMap::supportedReadFormats()
{ {
INI_REGIST_CALYP_SUPPORTED_FMT; INI_REGIST_CALYP_SUPPORTED_FMT;
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable BitMap ", "pbm" ); //REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable BitMap ", "pbm" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable GrayMap ", "pgm" ); REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable GrayMap ", "pgm" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable PixMap ", "ppm" ); REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable PixMap ", "ppm" );
END_REGIST_CALYP_SUPPORTED_FMT; END_REGIST_CALYP_SUPPORTED_FMT;
@@ -42,9 +42,7 @@ std::vector<CalypStreamFormat> StreamHandlerPortableMap::supportedReadFormats()
std::vector<CalypStreamFormat> StreamHandlerPortableMap::supportedWriteFormats() std::vector<CalypStreamFormat> StreamHandlerPortableMap::supportedWriteFormats()
{ {
INI_REGIST_CALYP_SUPPORTED_FMT; INI_REGIST_CALYP_SUPPORTED_FMT;
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable BitMap ", "pbm" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable GrayMap ", "pgm" ); REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable GrayMap ", "pgm" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerPortableMap::Create, "Portable PixMap ", "ppm" );
END_REGIST_CALYP_SUPPORTED_FMT; END_REGIST_CALYP_SUPPORTED_FMT;
} }
@@ -52,71 +50,62 @@ bool StreamHandlerPortableMap::openHandler( ClpString strFilename, bool bInput )
{ {
m_bIsInput = bInput; m_bIsInput = bInput;
m_pFile = NULL; m_pFile = NULL;
m_pFile = fopen( strFilename.c_str(), bInput ? "rb" : "wb" );
if( m_pFile == NULL )
{
return false;
}
m_strFormatName = "PGM"; m_strFormatName = "PGM";
m_strCodecName = "Raw Video"; m_strCodecName = "Raw Video";
if( m_bIsInput ) if( m_bIsInput )
{ {
m_pFile = fopen( strFilename.c_str(), "rb" );
char line[101]; char line[101];
while( fgets( line, 100, m_pFile ) && line[0] == '#' ) while( fgets( line, 100, m_pFile ) && line[0] == '#' )
; ;
sscanf( line, "P%d", &m_iMagicNumber );
while( fgets( line, 100, m_pFile ) && line[0] == '#' )
;
sscanf( line, "%u %u", &m_uiWidth, &m_uiHeight );
if( sscanf( line, "P%d %u %u %d", &m_iMagicNumber, &m_uiWidth, &m_uiHeight, &m_iMaxValue ) != 4 ) if( m_iMagicNumber == 1 || m_iMagicNumber == 4 )
{
m_uiBitsPerPixel = 1;
m_iMaxValue = 1;
m_iPixelFormat = CLP_GRAY;
}
else
{ {
sscanf( line, "P%d", &m_iMagicNumber );
while( fgets( line, 100, m_pFile ) && line[0] == '#' ) while( fgets( line, 100, m_pFile ) && line[0] == '#' )
; ;
sscanf( line, "%u %u", &m_uiWidth, &m_uiHeight ); sscanf( line, "%d", &m_iMaxValue );
m_uiBitsPerPixel = log( m_iMaxValue + 1 ) / log( 2 );
if( m_iMagicNumber == 1 ) m_iPixelFormat = m_iMagicNumber == 2 || m_iMagicNumber == 5 ? CLP_GRAY : CLP_RGB24;
{
m_iMaxValue = 1;
}
else
{
while( fgets( line, 100, m_pFile ) && line[0] == '#' )
;
sscanf( line, "%d", &m_iMaxValue );
}
} }
m_uiBitsPerPixel = log( m_iMaxValue + 1 ) / log( 2 );
m_iPixelFormat = m_iMagicNumber == 1 || m_iMagicNumber == 2 || m_iMagicNumber == 5 ? CLP_GRAY : CLP_RGB24;
} }
else else
{ {
int colorSpace = CalypFrame::pelformatColorSpace( m_iPixelFormat );
m_iMaxValue = ( 1 << m_uiBitsPerPixel ) - 1; m_iMaxValue = ( 1 << m_uiBitsPerPixel ) - 1;
if( m_uiBitsPerPixel == 1 ) if( m_uiBitsPerPixel == 1 )
{ {
m_iMagicNumber = 1; m_iMagicNumber = 4;
m_iPixelFormat = CalypFrame::findPixelFormat( "GRAY" );
} }
else if( colorSpace == CLP_COLOR_GRAY ) else if( m_iPixelFormat == CLP_GRAY )
{ {
m_iMagicNumber = 5; m_iMagicNumber = 5;
m_iPixelFormat = CalypFrame::findPixelFormat( "GRAY" );
} }
else if( colorSpace == CLP_COLOR_RGB ) else if( m_iPixelFormat == CLP_RGB24 )
{ {
m_iMagicNumber = 6; m_iMagicNumber = 6;
m_iPixelFormat = CalypFrame::findPixelFormat( "RGB" );
} }
else else
{ {
closeHandler(); closeHandler();
throw CalypFailure( "CalypStream", "Invalid format for portable map" );
return false; return false;
} }
m_pFile = fopen( strFilename.c_str(), "wb" );
} }
m_iEndianness = CLP_BIG_ENDIAN; m_iEndianness = 0;
m_dFrameRate = 1; m_dFrameRate = 1;
m_uiTotalNumberFrames = 1; m_uiTotalNumberFrames = 1;
if( m_pFile == NULL )
{
closeHandler();
return false;
}
return true; return true;
} }
@@ -134,7 +123,7 @@ bool StreamHandlerPortableMap::configureBuffer( CalypFrame* pcFrame )
return getMem1D<ClpByte>( &m_pStreamBuffer, pcFrame->getBytesPerFrame() ); return getMem1D<ClpByte>( &m_pStreamBuffer, pcFrame->getBytesPerFrame() );
} }
bool StreamHandlerPortableMap::seek( ClpULong iFrameNum ) bool StreamHandlerPortableMap::seek( unsigned long long int iFrameNum )
{ {
// m_uiCurrFrameFileIdx = // m_uiCurrFrameFileIdx =
return true; return true;
@@ -152,16 +141,13 @@ bool StreamHandlerPortableMap::read( CalypFrame* pcFrame )
bool StreamHandlerPortableMap::write( CalypFrame* pcFrame ) bool StreamHandlerPortableMap::write( CalypFrame* pcFrame )
{ {
CalypFrame pcRGBFrame( pcFrame->getWidth(), pcFrame->getHeight(),
m_iPixelFormat, pcFrame->getBitsPel() );
pcRGBFrame.copyFrom( pcFrame );
fseek( m_pFile, 0, SEEK_SET ); fseek( m_pFile, 0, SEEK_SET );
fprintf( m_pFile, "P%d\n%d %d\n", m_iMagicNumber, m_uiWidth, m_uiHeight ); fprintf( m_pFile, "P%d\n%d %d\n", m_iMagicNumber, m_uiWidth, m_uiHeight );
if( m_iMagicNumber > 4 ) if( m_iMagicNumber > 4 )
{ {
fprintf( m_pFile, "%d\n", m_iMaxValue ); fprintf( m_pFile, "%d\n", m_iMaxValue );
} }
pcRGBFrame.frameToBuffer( m_pStreamBuffer, m_iEndianness ); pcFrame->frameToBuffer( m_pStreamBuffer, CLP_BIG_ENDIAN );
unsigned long long int processed_bytes = fwrite( m_pStreamBuffer, sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile ); unsigned long long int processed_bytes = fwrite( m_pStreamBuffer, sizeof( ClpByte ), m_uiNBytesPerFrame, m_pFile );
if( processed_bytes != m_uiNBytesPerFrame ) if( processed_bytes != m_uiNBytesPerFrame )
return false; return false;
+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-2018 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
@@ -38,7 +38,7 @@ public:
bool openHandler( ClpString strFilename, bool bInput ); bool openHandler( ClpString strFilename, bool bInput );
void closeHandler(); void closeHandler();
bool configureBuffer( CalypFrame* pcFrame ); bool configureBuffer( CalypFrame* pcFrame );
bool seek( ClpULong iFrameNum ); bool seek( unsigned long long int iFrameNum );
bool read( CalypFrame* pcFrame ); bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame ); bool write( CalypFrame* pcFrame );
+5 -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-2018 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 "StreamHandlerRaw.h" #include "StreamHandlerRaw.h"
#include <cstdio>
#include "CalypFrame.h" #include "CalypFrame.h"
#include "LibMemory.h" #include "LibMemory.h"
#include <cstdio>
std::vector<CalypStreamFormat> StreamHandlerRaw::supportedReadFormats() std::vector<CalypStreamFormat> StreamHandlerRaw::supportedReadFormats()
{ {
INI_REGIST_CALYP_SUPPORTED_FMT; INI_REGIST_CALYP_SUPPORTED_FMT;
@@ -57,7 +57,6 @@ bool StreamHandlerRaw::openHandler( ClpString strFilename, bool bInput )
calculateFrameNumber(); calculateFrameNumber();
m_strFormatName = "YUV"; m_strFormatName = "YUV";
m_strCodecName = "Raw Video"; m_strCodecName = "Raw Video";
m_dFrameRate = 30;
return true; return true;
} }
@@ -79,13 +78,13 @@ void StreamHandlerRaw::calculateFrameNumber()
if( m_pFile && m_uiNBytesPerFrame > 0 ) if( m_pFile && m_uiNBytesPerFrame > 0 )
{ {
fseek( m_pFile, 0, SEEK_END ); fseek( m_pFile, 0, SEEK_END );
unsigned long long fileSize = ftell( m_pFile ); unsigned long long int fileSize = ftell( m_pFile );
fseek( m_pFile, 0, SEEK_SET ); fseek( m_pFile, 0, SEEK_SET );
m_uiTotalNumberFrames = fileSize / m_uiNBytesPerFrame; m_uiTotalNumberFrames = fileSize / m_uiNBytesPerFrame;
} }
} }
bool StreamHandlerRaw::seek( ClpULong iFrameNum ) bool StreamHandlerRaw::seek( unsigned long long int iFrameNum )
{ {
if( m_bIsInput && m_pFile ) if( m_bIsInput && m_pFile )
{ {
+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-2018 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
@@ -46,7 +46,7 @@ public:
void closeHandler(); void closeHandler();
bool configureBuffer( CalypFrame* pcFrame ); bool configureBuffer( CalypFrame* pcFrame );
void calculateFrameNumber(); void calculateFrameNumber();
bool seek( ClpULong iFrameNum ); bool seek( unsigned long long int iFrameNum );
bool read( CalypFrame* pcFrame ); bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame ); bool write( CalypFrame* pcFrame );
}; };
+7 -7
View File
@@ -1,10 +1,10 @@
# ###
# CMakeLists for playuver lib tests component ### CMakeLists for playuver lib tests component
# ###
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS}) INCLUDE_DIRECTORIES( ${GTEST_INCLUDE_DIRS} )
ADD_DEFINITIONS(-DCALYP_TEST_DATA_DIR=\"${CALYP_TEST_DATA_DIR}\") ADD_EXECUTABLE(PlaYUVerFrameQualityTests PlaYUVerFrameQualityTests.cpp )
ADD_EXECUTABLE(PlaYUVerFrameQualityTests PlaYUVerFrameQualityTests.cpp) TARGET_LINK_LIBRARIES(PlaYUVerFrameQualityTests ${PROJECT_LIBRARY} ${PlaYUVerLib_DEPS} gtest gtest_main )
TARGET_LINK_LIBRARIES(PlaYUVerFrameQualityTests ${PROJECT_LIBRARY} gtest gtest_main)
ADD_TEST(PlaYUVerFrameQualityTests PlaYUVerFrameQualityTests) ADD_TEST(PlaYUVerFrameQualityTests PlaYUVerFrameQualityTests)
Loaded 100 of 166 files, more files were not shown because too many files have changed in this diff. Show more