Author SHA1 Message Date
João Santos d4dddda2c2 Optimise display module now doesn't require a new window. 2019-11-12 16:24:56 +00:00
jfmcarreiraandGitHub 753c4cca3f Update README.md 2019-11-03 20:52:15 +00:00
jfmcarreira 67b0406f86 Increase CalypTools input limit to 255 2019-10-25 11:23:42 +01:00
João Santos abff4f3aa7 OptimiseDisplay now works for all of the image channels. 2019-10-22 16:12:00 +01:00
João Santos 7d83009f4b Fixed the reading of Portable Map images header. 2019-10-22 16:00:35 +01:00
jfmcarreira 2933269ea4 Improve ThreeSixtyFaceConcatenation and ThreeSixtyFaceExtraction 2019-10-21 15:07:53 +01:00
jfmcarreira 20b6edd667 Fix pixel format in OptimiseDisplay module 2019-10-14 15:35:50 +01:00
jfmcarreira 64153e572f Add opencv photo module 2019-09-20 22:49:45 +01:00
jfmcarreira 19cc7002e6 Merge branch 'master' of github.com:pixlra/calyp 2019-09-19 21:00:41 +01:00
jfmcarreira 115a5edec2 Add new modules from private repository 2019-09-19 21:00:31 +01:00
jfmcarreira 50b4ef20ce Add memory checks in xCallocMem 2019-07-29 15:25:01 +01:00
jfmcarreira 5f28b90811 Update binaries and dev in README.md 2019-06-14 17:14:30 +01:00
jfmcarreira 9fb445288c Change function outputs 2019-06-05 00:11:42 +01:00
João Santos 08d9fd1d5d Changed module window title to use the long name. 2019-05-30 16:42:37 +01:00
João Santos 3e186e9685 Added OptimiseDisplay module. 2019-05-30 16:42:09 +01:00
jfmcarreira c26e7c2265 Fix bpp match 2019-05-30 16:40:32 +01:00
João Santos b10a593e01 Improved statistics:
- Fixed issue with the range maximum value calculation
- Added the number of actual used values
2019-05-30 11:21:17 +01:00
jfmcarreira 63442d58b9 Complete last commig 2019-05-28 19:05:16 +01:00
jfmcarreira b36bbeef7a Support for variable number of inputs 2019-05-28 18:55:34 +01:00
jfmcarreira 2adfd28e48 Change module to enable frame re-sampling 2019-05-07 22:12:44 +01:00
jfmcarreira d76d2082ca Add prefix string before dumping stream information 2019-05-06 14:06:53 +01:00
jfmcarreira 10dec18118 Change the definition of the output endinness 2019-05-06 13:32:08 +01:00
jfmcarreira 39618ca7d5 Fix minor bug in the modules API and change input params in CalypFrame 2019-05-06 11:25:21 +01:00
jfmcarreira 833bd5f1c9 Use the same endianess for output as the input 2019-05-06 11:24:54 +01:00
jfmcarreira 937669d3c9 Finishing adding log information about input and output streams 2019-04-16 15:43:33 +01:00
jfmcarreira 63a9e2d22d Change CalypStream methods to support const 2019-04-16 15:42:37 +01:00
jfmcarreira 14bd963046 Start adding support for extended information in calypTools 2019-04-16 14:31:02 +01:00
jfmcarreira d6676b3eaf Fix copyTo and copyFrom functions 2019-04-15 16:37:44 +01:00
jfmcarreira 8152e82129 Fix bug introduced in the CalypFrame->toMat function 2019-04-12 16:58:16 +01:00
jfmcarreira a8ead5dcf6 Remove unused variable 2019-04-12 13:45:04 +01:00
jfmcarreira 35dcb020e6 Remove extra ; 2019-04-12 03:35:58 +01:00
jfmcarreira 68faafc9ed Improve conversion to OpenCv Mat with more than 8 bits 2019-04-12 03:35:42 +01:00
jfmcarreira 0989810e1f Add error message for portable map when pixel format is not supported 2019-04-10 22:15:04 +01:00
jfmcarreira 8620e3ddf2 Fix error in copy from function in CalypFrame 2019-04-08 15:00:15 +01:00
jfmcarreira b5c5c837e8 Add new information in modules 2019-04-07 18:29:04 +01:00
jfmcarreira 291b0b3890 Fix quality metrics 2019-04-04 19:51:28 +01:00
jfmcarreira 9a24ba2236 Fix CalypFrame to OpenCV 2019-04-04 12:41:24 +01:00
jfmcarreira f502dcc70a Add support for WS-PSNR quality metric 2019-04-03 23:37:16 +01:00
jfmcarreira cf2109e016 Change opencv to optional 2019-04-03 21:45:45 +01:00
jfmcarreira eff57f2fec Fix opencv include 2019-04-03 19:49:08 +01:00
jfmcarreira 608cc20508 Change the condtion checking the extra modules location 2019-04-03 19:43:23 +01:00
jfmcarreira e4e4994f25 Fix cmake code to correctly add extra modules 2019-04-03 19:38:36 +01:00
jfmcarreira a8a8043ced Fix the cmake code to support external modules 2019-04-03 18:51:36 +01:00
jfmcarreira e42f0d02bb Major changes in OpenCV handling
CalypFrame to Mat conversion
Remove custom modules
2019-04-03 16:37:32 +01:00
jfmcarreira 97c2fccf1a Fix comments in 360 modules 2019-03-27 14:56:43 +00:00
jfmcarreira 2d1af68418 Reverse change to use calyp-deployment repo 2019-03-21 23:12:03 +00:00
jfmcarreira 9b82ed0e88 Appveyor: do not lock the VM in the end 2019-03-21 13:58:26 +00:00
jfmcarreira 9a05fa3e62 Finish appveyor CI and add badge 2019-03-21 02:20:17 +00:00
jfmcarreira 57c82be827 Add BuildPkg.cmake with instruction to build Windows and Linux pkgs 2019-03-21 01:43:21 +00:00
jfmcarreira 3bcc61780b Improve AppVeyor and change opencv dep 2019-03-21 01:29:37 +00:00
jfmcarreira 5b633f7bda Fix lack of opencv dep in some modules 2019-03-20 22:55:32 +00:00
jfmcarreira 777f39ff9d Re-add appveyor configuration 2019-03-20 22:31:35 +00:00
jfmcarreiraandGitHub 518cd558e3 Delete .appveyor.yml 2019-03-20 15:24:49 +00:00
jfmcarreira 6bebaf0e2e Add AppVeyor configuration 2019-03-20 14:34:32 +00:00
jfmcarreira 2eead20ef0 Update travis CI and add badge 2019-03-20 14:11:23 +00:00
jfmcarreira cff796a4b7 Add different interpolation techniques to the ERP to NxN conversion 2019-03-12 02:18:11 +00:00
jfmcarreira 432d2c6cad Add module to convert ERP to NxN 2019-03-12 02:05:49 +00:00
jfmcarreira 183052148e Merge branch 'master' into private 2019-03-11 23:53:29 +00:00
jfmcarreira fda7e0f0c6 Fix frameToBuffer when using interleaved formats 2019-03-08 18:16:38 +00:00
jfmcarreira 75f16c2b34 Bugfix: Do not guess format if forcing config 2019-03-07 21:54:16 +00:00
jfmcarreira 0013190d27 Allow to save ppm using the StreamHandlerPortableMap 2019-03-07 16:01:15 +00:00
jfmcarreira ea613e097f Move warning flag to GNU compilers
Move -Wno-deprecated-declarations flag to GNU compilers only. This does not exist on windows
2019-03-06 19:06:00 +00:00
jfmcarreiraandGitHub a0fa4364e3 Merge pull request #1 from JNSFilipe/master
Improvements in guessing the sequence format form the name of the file
2019-03-06 18:37:44 +00:00
JFilipe df38f3d832 Name of the file is now read form the end to the begining, in order to guess seuqence format 2019-02-28 21:42:29 +00:00
JFilipe be0c5dca74 Merge branch 'master' of https://github.com/JNSFilipe/calyp 2019-02-28 21:26:47 +00:00
JFilipe f24adede0f add qcif format support and frame rate guessing on opening sequence 2019-02-28 21:25:34 +00:00
jfmcarreira b671596a24 Show configuration windows when it fails to open using a guess 2019-02-28 18:05:15 +00:00
jfmcarreira 805cee6fbc Improve frame difference to support multiple channels 2019-02-28 18:04:47 +00:00
jfmcarreira b3340bb13b Fix StreamHandlerLibav ffmpeg version check 2019-02-27 22:02:19 +00:00
JFilipe 2eec03b23f Enable OpenCV4 compability 2019-02-25 18:09:43 +00:00
jfmcarreira 2b00cceb09 Add a log including the frame num 2019-02-22 17:44:40 +00:00
jfmcarreira b20d5aef49 Fix CalypTools loop with the new module API 2019-02-22 17:31:53 +00:00
jfmcarreira 1dfbc06d7f Fix re-using instance using QDBus 2019-02-22 14:49:21 +00:00
jfmcarreira bad10649e3 Test some code 2019-02-21 02:41:16 +00:00
jfmcarreira c47192f5f3 Add module to reverse transform from video to cube map projection
Add module and fix bug in CalypFrame and add new feature to modules API 3
2019-02-20 23:26:28 +00:00
jfmcarreira ca562ae9f4 Bugfixes and improvements
Uniform the use of unsigned long in the frame number by defining a ClpULong type
CalypFrame Add function to copyTo a specific position
2019-02-20 22:22:43 +00:00
jfmcarreira 00ec0485f4 Fix bits per pixel in calypTools 2019-02-20 04:41:28 +00:00
jfmcarreira b5a5bb90f9 Fix bugs in CalypFrame 2019-02-20 04:41:07 +00:00
jfmcarreira 2129d05e6e Add new API for modules 2019-02-20 03:26:44 +00:00
jfmcarreira 710731db55 Change resolution list 2019-02-08 14:02:34 +00:00
jfmcarreira f2d8b06db2 Fix support for interlaced formats with more than 1 byte / pixel 2019-02-01 18:25:39 +00:00
jfmcarreira 37e14ff1bb Fix axis limits when using several plots 2019-01-06 23:17:24 +00:00
jfmcarreira c0b0388b02 Add average quality into the plot window 2019-01-06 22:37:48 +00:00
jfmcarreira 40d1189275 Add quality metrics units 2019-01-06 22:37:15 +00:00
jfmcarreira 17dbd59338 News year formating
Update copyrights to 2019
Minor code formating while passing formating script to all files
2019-01-06 21:59:04 +00:00
149 changed files with 1969 additions and 584 deletions
+45
View File
@@ -0,0 +1,45 @@
image: Visual Studio 2017
configuration: Release
platform:
- x64
environment:
access_token:
secure: WAV5LfCSAtwE1JuZh4HrDlxOOClimLoslYAJlf5KRgc3f7WIkX591PrSSua/Zo2C
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'
#- '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64'
- choco install nsis
- choco install opencv
- 'C:\Tools\opencv\build\setup_vars_opencv4.cmd'
- cd C:\Projects
- ps: Start-FileDownload 'https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-4.1.1-win64-dev.zip'
- 7z x ffmpeg-4.1.1-win64-dev.zip -y
- git clone https://github.com/pixlra/calyp-deployment.git
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-4.1.1-win64-dev/lib/avformat.lib -DAVFORMAT_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -DAVCODEC_LIBRARIES=C:/Projects/ffmpeg-4.1.1-win64-dev/lib/avcodec.lib -DAVCODEC_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -DAVUTIL_LIBRARIES=C:/Projects/ffmpeg-4.1.1-win64-dev/lib/avutil.lib -DAVUTIL_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -DSWSCALE_LIBRARIES=C:/Projects/ffmpeg-4.1.1-win64-dev/lib/swscale.lib -DSWSCALE_INCLUDE_DIRS=C:/Projects/ffmpeg-4.1.1-win64-dev/include -G "Visual Studio 15 2017 Win64" C:\Projects\calyp-deployment\cmake-helper
- cmake --build . --target ALL_BUILD -- /p:Configuration=Release > log_build
- cmake --build . --target 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'))
+135
View File
@@ -0,0 +1,135 @@
# Created by https://www.gitignore.io/api/c++,clion,linux
# Edit at https://www.gitignore.io/?templates=c++,clion,linux
### C++ ###
# Prerequisites
*.d
# 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*
# End of https://www.gitignore.io/api/c++,clion,linux
+2
View File
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<module classpath="CMake" type="CPP_MODULE" version="4" />
+4
View File
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
+7
View File
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeWorkspace" PROJECT_DIR="$PROJECT_DIR$" />
<component name="JavaScriptSettings">
<option name="languageLevel" value="ES6" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/calyp.iml" filepath="$PROJECT_DIR$/.idea/calyp.iml" />
</modules>
</component>
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
+3 -2
View File
@@ -2,5 +2,6 @@ language: cpp
dist: xenial dist: xenial
before_install: before_install:
- sudo apt-get -qq update - sudo apt-get -qq update
- sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev - sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev libopencv-contrib-dev
script: mkdir -p build && cd build && cmake .. && make && cd .. script:
- mkdir -p build && cd build && cmake .. && make && cd ..
+20 -7
View File
@@ -22,7 +22,7 @@ SET( PROJECT_LIBRARY "Calyp" CACHE INTERNAL "" FORCE )
PROJECT( ${PROJECT_NAME} ) PROJECT( ${PROJECT_NAME} )
SET( CALYP_VERSION_MAJOR "1" ) SET( CALYP_VERSION_MAJOR "1" )
SET( CALYP_VERSION_MINOR "0" ) SET( CALYP_VERSION_MINOR "1" )
SET( CALYP_VERSION_PATCH "0" ) SET( CALYP_VERSION_PATCH "0" )
SET( CALYP_VERSION "${CALYP_VERSION_MAJOR}.${CALYP_VERSION_MINOR}.${CALYP_VERSION_PATCH}" CACHE INTERNAL "" FORCE ) SET( CALYP_VERSION "${CALYP_VERSION_MAJOR}.${CALYP_VERSION_MINOR}.${CALYP_VERSION_PATCH}" CACHE INTERNAL "" FORCE )
@@ -104,9 +104,21 @@ 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 ${OPENCV_MODULES} ) FIND_PACKAGE( OpenCV COMPONENTS core highgui imgproc video )
SET(USE_OPENCV ${OpenCV_FOUND}) IF( ${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(OpenCV PROPERTIES URL "http://opencv.willowgarage.com" DESCRIPTION "OpenCV library support in CalypFrame" TYPE OPTIONAL) SET_PACKAGE_PROPERTIES(OpenCV PROPERTIES URL "http://opencv.willowgarage.com" DESCRIPTION "OpenCV library support in CalypFrame" TYPE OPTIONAL)
@@ -167,14 +179,15 @@ ADD_DEFINITIONS(-DQT_NO_CAST_TO_ASCII
#-DQT_USE_QSTRINGBUILDER #-DQT_USE_QSTRINGBUILDER
) )
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") # if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
endif() # endif()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op" ) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op" )
endif() endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" )
endif() endif()
IF( USE_WERROR ) IF( USE_WERROR )
+17 -8
View File
@@ -1,6 +1,12 @@
# 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;
@@ -23,9 +29,10 @@
- CalypTools: High level command line interface - CalypTools: High level command line interface
## Supported Quality Metrics ## Supported Quality Metrics
- PSNR - Peak Signal-to-Noise Ratio (PSNR)
- SSIM - Structural SIMilarity (SSIM)
- MSE - Mean Square Error (MSE)
- Weighted Spherical PSNR (WS-PSNR)
## Frame Processing Modules ## Frame Processing Modules
- Component filtering - Component filtering
@@ -53,14 +60,16 @@
* Windows Bitmap (bmp) * Windows Bitmap (bmp)
* Tagged Image File Format (tiff) * Tagged Image File Format (tiff)
## Developers ## Development Team
- **Joao Carreira** (jfmcarreira@gmail.com) - [**Joao Carreira**](https://github.com/jfmcarreira) (Founder, Main Developer)
- **Lui­s Lucas** (luisfrlucas@gmail.com) - [**Lui­s Lucas** ](https://github.com/lfrlucas) (Founder, Developer)
- [**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) and [openSUSE](https://software.opensuse.org/package/playuver) * Packages are available for [Debian](https://launchpad.net/~pixlra/+archive/ubuntu/ppa)
* **Daily builds** available for Windows and Linux in our [SourceForge page](https://sourceforge.net/projects/playuver/) * **Daily builds** available for [Windows](https://github.com/pixlra/calyp-releases/blob/master/installers/win/calyp-latest.exe)
* **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
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -125,7 +125,7 @@ void CalypAppModuleIf::run()
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE ) if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
{ {
if( m_pcModule->m_iModuleAPI == CLP_MODULE_API_2 ) if( m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
{ {
m_pcProcessedFrame = m_pcModule->process( apcFrameList ); m_pcProcessedFrame = m_pcModule->process( apcFrameList );
} }
@@ -136,7 +136,7 @@ void CalypAppModuleIf::run()
} }
else if( m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE ) else if( m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
{ {
if( m_pcModule->m_iModuleAPI == CLP_MODULE_API_2 ) if( m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
{ {
m_dMeasurementResult = m_pcModule->measure( apcFrameList ); m_dMeasurementResult = m_pcModule->measure( apcFrameList );
} }
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -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 ), this, bool isRegistered = QDBusConnection::sessionBus().registerObject( QStringLiteral( CALYP_DBUS_PATH ), QStringLiteral( CALYP_DBUS_SESSION_NAME ),
QDBusConnection::ExportAllSlots ); this, 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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* Joao Santos (joaompssantos@gmail.com) * Joao Santos (joaompssantos@gmail.com)
* *
@@ -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+5 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -380,7 +380,7 @@ void ModulesHandle::activateModule()
{ {
pcModuleSubWindow = new VideoSubWindow( VideoSubWindow::MODULE_SUBWINDOW ); pcModuleSubWindow = new VideoSubWindow( VideoSubWindow::MODULE_SUBWINDOW );
windowName.append( QStringLiteral( "Module " ) ); windowName.append( QStringLiteral( "Module " ) );
windowName.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleName ); windowName.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleLongName );
pcCurrAppModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow; pcCurrAppModuleIf->m_pcDisplaySubWindow = pcModuleSubWindow;
// connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo, // connect( pcModuleSubWindow->getViewArea(), SIGNAL( selectionChanged( QRect ) ), m_appModuleVideo,
// SLOT( updateSelectionArea( QRect ) ) ); // SLOT( updateSelectionArea( QRect ) ) );
@@ -422,7 +422,7 @@ void ModulesHandle::activateModule()
// 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_iModuleAPI >= CLP_MODULE_API_2 )
{ {
std::vector<CalypFrame*> apcFrameList; std::vector<CalypFrame*> apcFrameList;
for( int i = 0; i < videoSubWindowList.size(); i++ ) for( int i = 0; i < videoSubWindowList.size(); i++ )
@@ -562,8 +562,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;
unsigned long long int currFrames = 0; ClpULong currFrames = 0;
unsigned long long int numberOfFrames = INT_MAX; ClpULong numberOfFrames = -1;
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();
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+32 -15
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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -114,6 +114,11 @@ 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()
@@ -123,8 +128,8 @@ PlotSubWindow::~PlotSubWindow()
void PlotSubWindow::normalSize() void PlotSubWindow::normalSize()
{ {
m_cPlotArea->xAxis->setRange( m_aAxisRange[HORIZONTAL][0], m_aAxisRange[HORIZONTAL][1] ); m_cPlotArea->xAxis->setRange( m_aAxisRange[AXIS_HORIZONTAL][0], m_aAxisRange[AXIS_HORIZONTAL][1] );
m_cPlotArea->yAxis->setRange( m_aAxisRange[VERTICAL][0], m_aAxisRange[VERTICAL][1] ); m_cPlotArea->yAxis->setRange( m_aAxisRange[AXIS_VERTICAL][0], m_aAxisRange[AXIS_VERTICAL][1] );
m_cPlotArea->replot(); m_cPlotArea->replot();
m_dScaleFactor = 1; m_dScaleFactor = 1;
} }
@@ -187,29 +192,43 @@ void PlotSubWindow::setAxisName( const QString& nameAxisX, const QString& nameAx
void PlotSubWindow::setAxisRange( const QLine& axisLimits ) void PlotSubWindow::setAxisRange( const QLine& axisLimits )
{ {
setAxisRange( HORIZONTAL, axisLimits.x1(), axisLimits.x2() ); setAxisRange( AXIS_HORIZONTAL, axisLimits.x1(), axisLimits.x2() );
setAxisRange( VERTICAL, axisLimits.y1(), axisLimits.y2() ); setAxisRange( AXIS_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 == HORIZONTAL ) if( eAxis == AXIS_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[HORIZONTAL][0] = axisStart; m_aAxisRange[AXIS_HORIZONTAL][0] = axisStart;
m_aAxisRange[HORIZONTAL][1] = axisEnd; m_aAxisRange[AXIS_HORIZONTAL][1] = axisEnd;
} }
if( eAxis == VERTICAL ) if( eAxis == AXIS_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[VERTICAL][0] = axisStart; m_aAxisRange[AXIS_VERTICAL][0] = axisStart;
m_aAxisRange[VERTICAL][1] = axisEnd; m_aAxisRange[AXIS_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();
@@ -232,10 +251,8 @@ void PlotSubWindow::addPlot( const QVector<double>& arrayX, const QVector<double
newPlot->setName( key ); newPlot->setName( key );
} }
m_aAxisRange[HORIZONTAL][0] = m_cPlotArea->xAxis->range().lower; appendAxisLimit( AXIS_HORIZONTAL, m_cPlotArea->xAxis->range().lower, m_cPlotArea->xAxis->range().upper );
m_aAxisRange[HORIZONTAL][1] = m_cPlotArea->xAxis->range().upper; appendAxisLimit( AXIS_VERTICAL, m_cPlotArea->yAxis->range().lower, m_cPlotArea->yAxis->range().upper );
m_aAxisRange[VERTICAL][0] = m_cPlotArea->yAxis->range().lower;
m_aAxisRange[VERTICAL][1] = m_cPlotArea->yAxis->range().upper;
m_iNumberPlots++; m_iNumberPlots++;
} }
+4 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -45,8 +45,8 @@ private:
enum Axis enum Axis
{ {
HORIZONTAL, AXIS_HORIZONTAL,
VERTICAL, AXIS_VERTICAL,
}; };
double m_aAxisRange[2][2]; double m_aAxisRange[2][2];
double m_dScaleFactor; double m_dScaleFactor;
@@ -78,6 +78,7 @@ 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 );
+26 -22
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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -156,13 +156,12 @@ void QualityHandle::update( VideoSubWindow* currSubWindow )
void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList ) void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
{ {
QVector<double>* padQualityValues; unsigned numberOfWindows = apcWindowList.size();
unsigned int numberOfWindows = apcWindowList.size(); ClpULong currFrames = 0;
unsigned long long int currFrames = 0; ClpULong numberOfFrames = -1;
unsigned long long int numberOfFrames = INT_MAX;
//! Check reference window //! Check reference window
for( unsigned int i = 0; i < numberOfWindows; i++ ) for( unsigned i = 0; i < numberOfWindows; i++ )
{ {
if( !apcWindowList.at( i )->getRefSubWindow() ) if( !apcWindowList.at( i )->getRefSubWindow() )
{ {
@@ -172,7 +171,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 int i = 0; i < numberOfWindows; i++ ) for( unsigned i = 0; i < numberOfWindows; i++ )
{ {
currFrames = apcWindowList.at( i )->getInputStream()->getFrameNum(); currFrames = apcWindowList.at( i )->getInputStream()->getFrameNum();
if( currFrames < numberOfFrames ) if( currFrames < numberOfFrames )
@@ -183,7 +182,14 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
ProgressBar* pcProgressBar = new ProgressBar( m_pcParet, numberOfFrames ); ProgressBar* pcProgressBar = new ProgressBar( m_pcParet, numberOfFrames );
padQualityValues = new QVector<double>[numberOfWindows + 1]; QVector<double>* 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;
@@ -194,7 +200,9 @@ 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();
padQualityValues[i + 1].append( pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, CLP_LUMA ) ); dCurrentQuality = 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 );
@@ -206,27 +214,23 @@ 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( pcPlotWindow->setAxisName( "Frame Number", QString( "%1 [%2]" ).arg( qualityName ).arg( qualityUnits ) );
"Frame Number", QString::fromStdString( CalypFrame::supportedQualityMetricsList()[m_iQualityMetricIdx] ) );
if( apcWindowList.size() > 1 ) QString key;
for( unsigned int i = 0; i < numberOfWindows; i++ )
{ {
QString key; key = apcWindowList.at( i )->getWindowName();
for( unsigned int i = 0; i < numberOfWindows; i++ ) key = QString( "[%1 %2] " ).arg( padAverageQuality[i + 1] ).arg( qualityUnits ) + key;
{ 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 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* Joao Santos (joaompssantos@gmail.com) * Joao Santos (joaompssantos@gmail.com)
* *
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -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();
int frame_num = 0; unsigned long frame_num = 0;
unsigned long long int total_frame_num = 1; unsigned long 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 long int VideoHandle::getMaxFrameNumber() unsigned long VideoHandle::getMaxFrameNumber()
{ {
unsigned int currFrames; unsigned long currFrames;
unsigned long long int maxFrames = INT_MAX; unsigned long maxFrames = INT_MAX;
if( m_pcCurrentVideoSubWindow ) if( m_pcCurrentVideoSubWindow )
{ {
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) ) if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -34,7 +34,7 @@
#include <QVector> #include <QVector>
#include <QWidget> #include <QWidget>
#define _CONTROL_PLAYING_TIME_ 1 //#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 long int getMaxFrameNumber(); unsigned long getMaxFrameNumber();
void setTimerStatus(); void setTimerStatus();
Q_SIGNALS: Q_SIGNALS:
+50 -13
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -311,7 +311,7 @@ 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_BIG_ENDIAN; int Endianness = CLP_LITTLE_ENDIAN;
int InputFormat = CLP_YUV420P; int InputFormat = CLP_YUV420P;
if( m_pCurrStream ) if( m_pCurrStream )
@@ -321,8 +321,9 @@ bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
{ {
m_pCurrStream = new CalypStream; m_pCurrStream = new CalypStream;
} }
bool bConfig = true;
bool bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness ) || bForceDialog; if( !bForceDialog )
bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness, FrameRate );
bool bRet = false; bool bRet = false;
for( int iPass = 0; iPass < 2 && !bRet; iPass++ ) for( int iPass = 0; iPass < 2 && !bRet; iPass++ )
{ {
@@ -334,8 +335,15 @@ bool VideoSubWindow::loadFile( QString cFilename, bool bForceDialog )
return false; return false;
} }
} }
bRet = m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate, try
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;
@@ -404,7 +412,8 @@ void VideoSubWindow::updateVideoWindowInfo()
} }
if( m_pcCurrentDisplayModule->getModuleRequirements() & CLP_MODULES_HAS_INFO ) if( m_pcCurrentDisplayModule->getModuleRequirements() & CLP_MODULES_HAS_INFO )
{ {
windowInfoList.append( QString::fromStdString( m_pcCurrentDisplayModule->moduleInfo() ) ); QStringList list = QString::fromStdString( m_pcCurrentDisplayModule->moduleInfo() ).split( '\n' );
windowInfoList.append( list );
} }
// qDebug( ) << sourceWindowList; // qDebug( ) << sourceWindowList;
if( windowInfoList.size() > 0 ) if( windowInfoList.size() > 0 )
@@ -435,7 +444,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 ) int& rEndianness, unsigned int& rFrameRate )
{ {
std::vector<CalypStandardResolution> stdResList = CalypStream::stdResolutionSizes(); std::vector<CalypStandardResolution> stdResList = CalypStream::stdResolutionSizes();
bool bGuessed = true; bool bGuessed = true;
@@ -480,10 +489,11 @@ 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( 0 ); QString resolutionString = resolutionMatch.captured( resolutionMatch.lastCapturedIndex() );
if( resolutionString.startsWith( "_" ) || resolutionString.endsWith( "_" ) ) if( resolutionString.startsWith( "_" ) || resolutionString.endsWith( "_" ) )
{ {
resolutionString.remove( "_" ); resolutionString.remove( "_" );
@@ -528,11 +538,12 @@ bool VideoSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsign
} }
} }
// [.|_]
// Guess bits per pixel - match %dbpp // Guess bits per pixel - match %dbpp
QRegularExpressionMatch BppMatch = QRegularExpression( "_\\d*bpp" ).match( FilenameShort ); QRegularExpressionMatch BppMatch = QRegularExpression( "_[0-9]+bpp" ).match( FilenameShort );
if( BppMatch.hasMatch() ) if( BppMatch.hasMatch() )
{ {
QString matchString = BppMatch.captured( 0 ); QString matchString = BppMatch.captured( BppMatch.lastCapturedIndex() );
matchString.remove( "_" ); matchString.remove( "_" );
matchString.remove( "bpp" ); matchString.remove( "bpp" );
rBitsPerPixel = matchString.toUInt(); rBitsPerPixel = matchString.toUInt();
@@ -541,6 +552,32 @@ 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 ) )
@@ -611,7 +648,7 @@ void VideoSubWindow::disableModule( CalypAppModuleIf* pcModule )
if( m_pcCurrentDisplayModule ) if( m_pcCurrentDisplayModule )
{ {
pcModule = m_pcCurrentDisplayModule; pcModule = m_pcCurrentDisplayModule;
m_pcCurrentDisplayModule = 0; m_pcCurrentDisplayModule = NULL;
ModulesHandle::destroyModuleIf( pcModule ); ModulesHandle::destroyModuleIf( pcModule );
setWindowName( QFileInfo( m_cFilename ).fileName() ); setWindowName( QFileInfo( m_cFilename ).fileName() );
bRefresh |= true; bRefresh |= true;
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -192,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 ); int& rEndianness, unsigned int& rFrameRate );
bool hasRunningModule(); bool hasRunningModule();
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* Joao Santos (joaompssantos@gmail.com) * Joao Santos (joaompssantos@gmail.com)
* *
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+3 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -44,7 +44,8 @@ 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;
m_pcDescription->setText( QString::fromStdString( option->opt_desc ) ); QString desc = 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() )
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -30,7 +30,7 @@
#include <QProgressBar> #include <QProgressBar>
#include <QVBoxLayout> #include <QVBoxLayout>
ProgressBar::ProgressBar( QWidget* parent, unsigned int maxValue ) ProgressBar::ProgressBar( QWidget* parent, unsigned long long 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 );
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -37,7 +37,7 @@ class ProgressBar : public QWidget
Q_OBJECT Q_OBJECT
public: public:
ProgressBar( QWidget* parent, unsigned int maxValue ); ProgressBar( QWidget* parent, unsigned long long int maxValue );
void incrementProgress( unsigned int ); void incrementProgress( unsigned int );
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+12 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -184,6 +184,11 @@ 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;
@@ -212,6 +217,8 @@ 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 );
@@ -274,6 +281,7 @@ void FramePropertiesDock::reset()
m_iLastFrameType = -1; m_iLastFrameType = -1;
labelNEBinsValue->clear();
labelMeanValue->clear(); labelMeanValue->clear();
labelPixelsValue->clear(); labelPixelsValue->clear();
labelStdDevValue->clear(); labelStdDevValue->clear();
@@ -444,6 +452,9 @@ 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 );
+2 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -72,6 +72,7 @@ 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;
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+4 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -185,6 +185,8 @@ 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;
@@ -199,6 +201,7 @@ void QualityMeasurementSidebar::updateSidebarData()
{ {
m_ppcLabelQualityValue[component]->setText( zeroValue ); m_ppcLabelQualityValue[component]->setText( zeroValue );
} }
QApplication::restoreOverrideCursor();
return; return;
} }
else else
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+14 -11
View File
@@ -1,16 +1,24 @@
MACRO(ADD_EXTRA_MODULES dir)
SET( MODULE_LOCATION "${dir}/" )
ADD_SUBDIRECTORY( ${dir} ${CMAKE_CURRENT_BINARY_DIR}/extra-modules )
INCLUDE_DIRECTORIES( ${dir} )
SET( MODULE_LOCATION "${dir}/" PARENT_SCOPE )
ENDMACRO()
MACRO(ADD_MODULE name file ) MACRO(ADD_MODULE name file )
set(__modulename "Module${name}") SET(__modulename "Module${name}")
OPTION(MODULE_${name} "Use module ${name}" ON ) OPTION(MODULE_${name} "Use module ${name}" ON )
ADD_FEATURE_INFO(${name} MODULE_${name} "Module ${name}" ) ADD_FEATURE_INFO(${name} MODULE_${name} "Module ${name}" )
if( MODULE_${name} ) IF( MODULE_${name} )
list(APPEND Calyp_Mod_SRCS ${file} ) list(APPEND Calyp_Mod_SRCS ${MODULE_LOCATION}${file} )
LIST(APPEND MODULES_LIST_NAME ${name} ) LIST(APPEND MODULES_LIST_NAME ${name} )
LIST(APPEND MODULES_LIST_FILES ${file} ) LIST(APPEND MODULES_LIST_FILES ${file} )
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${file}.h\"\n") SET( Calyp_Mod_SRCS "${Calyp_Mod_SRCS}" PARENT_SCOPE )
endif() SET( MODULES_LIST_NAME "${MODULES_LIST_NAME}" PARENT_SCOPE )
unset(__modulename) SET( MODULES_LIST_FILES "${MODULES_LIST_FILES}" PARENT_SCOPE )
ENDIF()
UNSET(__modulename)
ENDMACRO() ENDMACRO()
@@ -43,13 +51,9 @@ ENDMACRO()
# #
# Create header # Create header
# #
MACRO(CREATE_MODULE_MACROS ) MACRO(CREATE_MODULE_MACROS )
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n" file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n"
"#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" ) "#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" )
foreach(module ${MODULES_LIST_FILES}) foreach(module ${MODULES_LIST_FILES})
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${module}.h\"\n") file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${module}.h\"\n")
endforeach(module ${MODULES_LIST_FILES}) endforeach(module ${MODULES_LIST_FILES})
@@ -60,5 +64,4 @@ MACRO(CREATE_MODULE_MACROS )
endforeach(module ${MODULES_LIST_NAME}) endforeach(module ${MODULES_LIST_NAME})
file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "\n#endif // __MODULESLISTHEADER_H__\n" ) file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "\n#endif // __MODULESLISTHEADER_H__\n" )
ENDMACRO() ENDMACRO()
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+3 -3
View File
@@ -1,4 +1,4 @@
#!/bin/sh #!/bin/bash
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
+6 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -29,9 +29,11 @@
#include <algorithm> #include <algorithm>
#include <string> #include <string>
#include <vector> #include <vector>
#include <iterator>
typedef unsigned short ClpPel; ///< 16-bit pixel type typedef unsigned short ClpPel; ///< 16-bit pixel type
typedef unsigned char ClpByte; typedef unsigned char ClpByte;
typedef unsigned long long ClpULong;
typedef std::string ClpString; typedef std::string ClpString;
@@ -100,6 +102,9 @@ 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;
+280 -110
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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -33,6 +33,8 @@
#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()
@@ -81,6 +83,11 @@ 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:
@@ -112,14 +119,14 @@ public:
unsigned int m_uiHistoSegments; unsigned int m_uiHistoSegments;
/** /**
* Common constructor function of a frame * Common constructor function of a frame
* *
* @param width width of the frame * @param width width of the frame
* @param height height of the frame * @param height height of the frame
* @param pel_format pixel format index (always use PixelFormats enum) * @param pel_format pixel format index (always use PixelFormats enum)
* *
*/ */
void init( unsigned int width, unsigned int height, int pel_format, int bitsPixel ) void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel )
{ {
m_bInit = false; m_bInit = false;
m_bHasRGBPel = false; m_bHasRGBPel = false;
@@ -252,7 +259,7 @@ public:
* \brief Constructors * \brief Constructors
*/ */
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, int bitsPixel ) CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel )
: d( new CalypFramePrivate ) : d( new CalypFramePrivate )
{ {
d->init( width, height, pelFormat, bitsPixel ); d->init( width, height, pelFormat, bitsPixel );
@@ -346,6 +353,8 @@ 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;
} }
@@ -379,31 +388,41 @@ unsigned int CalypFrame::getNumberChannels() const
return d->m_pcPelFormat->numberChannels; return d->m_pcPelFormat->numberChannels;
} }
unsigned int CalypFrame::getWidth( int channel ) const unsigned CalypFrame::getWidth( unsigned 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 int CalypFrame::getHeight( int channel ) const unsigned CalypFrame::getHeight( unsigned channel ) const
{ {
return CHROMASHIFT( d->m_uiHeight, channel > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0 ); return CHROMASHIFT( d->m_uiHeight, channel > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0 );
} }
unsigned int CalypFrame::getPixels( int channel ) const ClpULong CalypFrame::getPixels( unsigned channel ) const
{ {
return getWidth( channel ) * getWidth( channel ); return getWidth( channel ) * getHeight( channel );
} }
unsigned char CalypFrame::getChromaWidthRatio() const 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 char CalypFrame::getChromaHeightRatio() const unsigned CalypFrame::getChromaHeightRatio() const
{ {
return d->m_pcPelFormat->log2ChromaHeight; return d->m_pcPelFormat->log2ChromaHeight;
} }
unsigned int CalypFrame::getChromaLength() const ClpULong CalypFrame::getChromaLength() const
{ {
return getWidth( 1 ) * getHeight( 1 ); return getWidth( 1 ) * getHeight( 1 );
} }
@@ -413,19 +432,19 @@ unsigned int CalypFrame::getBitsPel() const
return d->m_uiBitsPel; return d->m_uiBitsPel;
} }
unsigned long CalypFrame::getBytesPerFrame() ClpULong CalypFrame::getBytesPerFrame() const
{ {
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 );
} }
unsigned long CalypFrame::getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel ) ClpULong 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;
unsigned long long int numberBytes = uiWidth * uiHeight; ClpULong numberBytes = uiWidth * uiHeight;
if( pcPelFormat->numberChannels > 1 ) if( pcPelFormat->numberChannels > 1 )
{ {
unsigned long long int numberBytesChroma = ClpULong 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;
} }
@@ -514,11 +533,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_ALL ) ) if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_BYTES_PER_FRAME | MATCH_BITS ) )
return; return;
d->m_bHasRGBPel = false; d->m_bHasRGBPel = false;
d->m_bHasHistogram = false; d->m_bHasHistogram = false;
memcpy( *d->m_pppcInputPel[CLP_LUMA], other.getPelBufferYUV()[CLP_LUMA][0], getBytesPerFrame() * sizeof( ClpPel ) ); memcpy( &( d->m_pppcInputPel[0][0][0] ), &( other.getPelBufferYUV()[0][0][0] ), getTotalNumberOfPixels() * sizeof( ClpPel ) );
} }
void CalypFrame::copyFrom( const CalypFrame* other ) void CalypFrame::copyFrom( const CalypFrame* other )
@@ -527,10 +546,11 @@ void CalypFrame::copyFrom( const CalypFrame* other )
copyFrom( *other ); copyFrom( *other );
} }
void CalypFrame::copyFrom( const CalypFrame& other, unsigned int xPos, unsigned int yPos ) void CalypFrame::copyFrom( const CalypFrame& other, unsigned x, unsigned y )
{ {
if( haveSameFmt( other, MATCH_ALL ) ) if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_BITS ) )
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++ )
{ {
@@ -538,7 +558,7 @@ void CalypFrame::copyFrom( const CalypFrame& other, unsigned int xPos, unsigned
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], &( pInput[ch][( yPos >> ratioH ) + i][( xPos >> ratioW )] ), memcpy( &( d->m_pppcInputPel[ch][i][0] ), &( pInput[ch][( y >> ratioH ) + i][( x >> ratioW )] ),
( d->m_uiWidth >> ratioW ) * sizeof( ClpPel ) ); ( d->m_uiWidth >> ratioW ) * sizeof( ClpPel ) );
} }
} }
@@ -546,12 +566,39 @@ void CalypFrame::copyFrom( const CalypFrame& other, unsigned int xPos, unsigned
d->m_bHasHistogram = false; d->m_bHasHistogram = false;
} }
void CalypFrame::copyFrom( const CalypFrame* other, unsigned int x, unsigned int y ) void CalypFrame::copyFrom( const CalypFrame* other, unsigned x, unsigned 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() )
@@ -574,7 +621,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 == 0 ) if( iEndianness == CLP_BIG_ENDIAN )
{ {
startByte = bytesPixel - 1; startByte = bytesPixel - 1;
endByte = -1; endByte = -1;
@@ -593,10 +640,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; step = ( d->m_pcPelFormat->comp[ch].step_minus1 ) * bytesPixel;
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 ); pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 ) * bytesPixel;
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++ )
{ {
@@ -632,7 +679,7 @@ void CalypFrame::frameToBuffer( ClpByte* output_buffer, int iEndianness )
int incByte = 1; int incByte = 1;
int b; int b;
if( iEndianness == 0 ) if( iEndianness == CLP_BIG_ENDIAN )
{ {
startByte = bytesPixel - 1; startByte = bytesPixel - 1;
endByte = -1; endByte = -1;
@@ -651,10 +698,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; step = ( d->m_pcPelFormat->comp[ch].step_minus1 ) * bytesPixel;
pTmpPel = d->m_pppcInputPel[ch][0]; pTmpPel = d->m_pppcInputPel[ch][0];
pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane]; pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 ) * bytesPixel;
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++ )
{ {
@@ -669,7 +716,6 @@ 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 )
@@ -809,7 +855,7 @@ int CalypFrame::getNumHistogramSegment()
return d->m_uiHistoSegments; return d->m_uiHistoSegments;
} }
unsigned int CalypFrame::getMinimumPelValue( int channel ) unsigned int CalypFrame::getMinimumPelValue( unsigned channel )
{ {
if( !d->m_bHasHistogram ) if( !d->m_bHasHistogram )
return 0; return 0;
@@ -841,7 +887,7 @@ unsigned int CalypFrame::getMinimumPelValue( int channel )
return 0; return 0;
} }
unsigned int CalypFrame::getMaximumPelValue( int channel ) unsigned int CalypFrame::getMaximumPelValue( unsigned channel )
{ {
if( !d->m_bHasHistogram ) if( !d->m_bHasHistogram )
return 0; return 0;
@@ -867,13 +913,46 @@ unsigned int CalypFrame::getMaximumPelValue( int 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::getMaximum( int channel ) unsigned int CalypFrame::getNEBins( unsigned 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;
@@ -906,7 +985,7 @@ unsigned int CalypFrame::getMaximum( int channel )
return maxValue; return maxValue;
} }
unsigned int CalypFrame::getNumPixelsRange( int channel, unsigned int start, unsigned int end ) unsigned int CalypFrame::getNumPixelsRange( unsigned 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 )
{ {
@@ -928,7 +1007,7 @@ unsigned int CalypFrame::getNumPixelsRange( int channel, unsigned int start, uns
return count; return count;
} }
double CalypFrame::getMean( int channel, unsigned int start, unsigned int end ) double CalypFrame::getMean( unsigned 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 )
{ {
@@ -958,7 +1037,7 @@ double CalypFrame::getMean( int channel, unsigned int start, unsigned int end )
return mean; return mean;
} }
int CalypFrame::getMedian( int channel, unsigned int start, unsigned int end ) int CalypFrame::getMedian( unsigned 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 )
{ {
@@ -984,7 +1063,7 @@ int CalypFrame::getMedian( int channel, unsigned int start, unsigned int end )
return 0; return 0;
} }
double CalypFrame::getStdDev( int channel, unsigned int start, unsigned int end ) double CalypFrame::getStdDev( unsigned 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 )
{ {
@@ -1006,14 +1085,14 @@ double CalypFrame::getStdDev( int channel, unsigned int start, unsigned int end
/*------------ 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++ )
{ {
@@ -1023,7 +1102,7 @@ double CalypFrame::getStdDev( int channel, unsigned int start, unsigned int end
return sqrt( ( dev - count * mean * mean ) / ( count - 1 ) ); return sqrt( ( dev - count * mean * mean ) / ( count - 1 ) );
} }
double CalypFrame::getHistogramValue( int channel, unsigned int bin ) double CalypFrame::getHistogramValue( unsigned 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;
@@ -1044,7 +1123,7 @@ double CalypFrame::getHistogramValue( int channel, unsigned int bin )
************************************************************** **************************************************************
*/ */
bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray ) bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray, bool scale, unsigned channel )
{ {
bool bRet = false; bool bRet = false;
#ifdef USE_OPENCV #ifdef USE_OPENCV
@@ -1053,46 +1132,78 @@ bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray )
{ {
return bRet; return bRet;
} }
int cvType = CV_MAKETYPE( CV_8U, convertToGray ? 1 : d->m_pcPelFormat->numberChannels ); unsigned int cvPrecision = getBitsPel() > 8 ? CV_16U : CV_8U;
cvMat.create( d->m_uiHeight, d->m_uiWidth, cvType ); unsigned numBytes = getBitsPel() > 8 ? 2 : 1;
unsigned char* pCvPel = cvMat.data; unsigned numChannels = getNumberChannels();
if( !convertToGray && ( d->m_pcPelFormat->colorSpace == CLP_COLOR_YUV || unsigned scaleFactor = 1 << ( numBytes * 8 - getBitsPel() );
d->m_pcPelFormat->colorSpace == CLP_COLOR_RGB ) ) if( !scale )
scaleFactor = 1;
if( convertToGray )
{ {
fillRGBBuffer(); channel = channel >= numChannels ? 0 : channel;
unsigned char* pARGB = d->m_pcARGB32; numChannels = 1;
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 )
{ {
ClpPel* pPel = d->m_pppcInputPel[CLP_LUMA][0]; cv::Mat tmpMat( imgHeight, imgWidth, CV_MAKETYPE( cvPrecision, numChannels ) );
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++ )
{ {
*pCvPel++ = *pPel++; for( unsigned x = 0; x < imgWidth; x++ )
{
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
{ {
return false; unsigned char* cv_data = cvMat.data;
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 ) bool CalypFrame::fromMat( cv::Mat& cvMat, int channel )
{ {
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() )
@@ -1107,35 +1218,69 @@ bool CalypFrame::fromMat( cv::Mat& cvMat )
return false; return false;
} }
} }
d->init( cvMat.cols, cvMat.rows, d->m_iPixelFormat, 8 ); d->m_uiBitsPel = depth == CV_8U ? 8 : 16;
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;
unsigned char* pCvPel = cvMat.data; if( channel >= 0 )
if( d->m_iPixelFormat != CLP_GRAY ) numChannels = 1;
else
channel = 0;
if( cvMat.channels() != int( numChannels ) )
{ {
ClpPel* pInputPelR = d->m_pppcInputPel[CLP_COLOR_R][0]; return false;
ClpPel* pInputPelG = d->m_pppcInputPel[CLP_COLOR_G][0]; }
ClpPel* pInputPelB = d->m_pppcInputPel[CLP_COLOR_B][0];
for( unsigned int i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ ) unsigned imgWidth = getWidth( channel );
unsigned imgHeight = getHeight( channel );
if( numChannels > 1 )
{
cv::Mat tmpMat( imgHeight, imgWidth, CV_MAKETYPE( cvPrecision, numChannels ) );
switch( getColorSpace() )
{ {
*pInputPelB++ = *pCvPel++; case CLP_COLOR_YUV:
*pInputPelG++ = *pCvPel++; cv::cvtColor( tmpMat, cvMat, cv::COLOR_RGB2YCrCb );
*pInputPelR++ = *pCvPel++; break;
}
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
{ {
ClpPel* pPel = d->m_pppcInputPel[CLP_LUMA][0]; unsigned char* cv_data = cvMat.data;
for( unsigned int i = 0; i < d->m_uiWidth * d->m_uiHeight; i++ ) ClpPel curr_pel;
ClpPel* pel = getPelBufferYUV()[channel][0];
for( unsigned int y = 0; y < imgHeight * imgWidth; y++ )
{ {
*pPel++ = *pCvPel++; curr_pel = 0;
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;
} }
@@ -1152,6 +1297,17 @@ std::vector<ClpString> CalypFrame::supportedQualityMetricsList()
"PSNR", "PSNR",
"MSE", "MSE",
"SSIM", "SSIM",
"WS-PSNR",
};
}
std::vector<ClpString> CalypFrame::supportedQualityMetricsUnitsList()
{
return std::vector<ClpString>{
"dB",
"",
"",
"dB",
}; };
} }
@@ -1172,6 +1328,9 @@ 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 );
}; };
@@ -1182,43 +1341,27 @@ 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 );
int aux_pel_1, aux_pel_2; ClpULong ssd = 0;
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++ )
{ {
aux_pel_1 = *pPelYUV++; int diff = int( *pPelYUV++ ) - int( *pOrgPelYUV++ );
aux_pel_2 = *pOrgPelYUV++; ssd += diff * diff;
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 ssd / double( numberOfPixels ); return double( ssd ) / double( numberOfPixels );
} }
double CalypFrame::getPSNR( CalypFrame* Org, unsigned int component ) double CalypFrame::getPSNR( CalypFrame* Org, unsigned int component )
{ {
unsigned int uiMaxValue = ( 1 << Org->getBitsPel() ) - 1; ClpULong 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( uiMaxValueSquare / dMSE ); dPSNR = 10 * log10( double( uiMaxValue * uiMaxValue ) / dMSE );
return dPSNR; return dPSNR;
} }
@@ -1304,3 +1447,30 @@ 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 );
}
+59 -26
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -100,6 +100,7 @@ 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
@@ -110,7 +111,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, int bitsPixel = 8 ); CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel = 8 );
/** /**
* Copy contructor * Copy contructor
@@ -145,6 +146,7 @@ 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,
}; };
@@ -179,46 +181,52 @@ public:
* Get the number of channels * Get the number of channels
* @return number of channels * @return number of channels
*/ */
unsigned int getNumberChannels() const; unsigned 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( int channel = 0 ) const; unsigned int getWidth( unsigned 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( int channel = 0 ) const; unsigned int getHeight( unsigned channel = 0 ) 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
*/ */
unsigned int getPixels( int channel = 0 ) const; ClpULong getPixels( unsigned 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 char getChromaWidthRatio() const; unsigned getChromaWidthRatio() const;
/** /**
* Get chroma height ratio * Get chroma height ratio
* @return ratio multiple of 2 * @return ratio multiple of 2
*/ */
unsigned char getChromaHeightRatio() const; unsigned 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
*/ */
unsigned int getChromaLength() const; ClpULong getChromaLength() const;
/** /**
* Get number of bits per pixel * Get number of bits per pixel
@@ -230,13 +238,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
*/ */
unsigned long getBytesPerFrame(); ClpULong getBytesPerFrame() const;
/** /**
* 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 unsigned long getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel ); static ClpULong getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel );
/** /**
* Reset frame pixels to zero * Reset frame pixels to zero
@@ -290,10 +298,32 @@ 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& ); /**
void copyFrom( const CalypFrame* ); * Copy a frame into the current buffer
void copyFrom( const CalypFrame&, unsigned int, unsigned int ); * @param other frame to be copied
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 );
@@ -322,22 +352,23 @@ public:
}; };
void calcHistogram(); void calcHistogram();
unsigned int getMinimumPelValue( int channel ); unsigned int getMinimumPelValue( unsigned channel );
unsigned int getMaximumPelValue( int channel ); unsigned int getMaximumPelValue( unsigned channel );
unsigned int getMaximum( int channel ); unsigned int getMaximum( unsigned channel );
unsigned int getNumPixelsRange( int channel, unsigned int start, unsigned int end ); unsigned int getNumPixelsRange( unsigned channel, unsigned int start, unsigned int end );
double getMean( int channel, unsigned int start, unsigned int end ); double getMean( unsigned channel, unsigned int start, unsigned int end );
int getMedian( int channel, unsigned int start, unsigned int end ); int getMedian( unsigned channel, unsigned int start, unsigned int end );
double getStdDev( int channel, unsigned int start, unsigned int end ); double getStdDev( unsigned channel, unsigned int start, unsigned int end );
double getHistogramValue( int channel, unsigned int bin ); double getHistogramValue( unsigned channel, unsigned int bin );
unsigned int getNEBins( unsigned channel );
int getNumHistogramSegment(); int getNumHistogramSegment();
/** /**
* interface with OpenCV lib * interface with OpenCV lib
*/ */
bool toMat( cv::Mat& cvMat, bool convertToGray = false ); bool toMat( cv::Mat& cvMat, bool convertToGray = false, bool scale = true, unsigned channel = 0 );
bool fromMat( cv::Mat& cvMat ); bool fromMat( cv::Mat& cvMat, int iChannel = -1 );
/** /**
* \ingroup CalypFrameGrp * \ingroup CalypFrameGrp
@@ -353,15 +384,17 @@ 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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+22 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -50,6 +50,11 @@ 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
@@ -59,6 +64,7 @@ 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
@@ -118,6 +124,9 @@ 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()
@@ -125,6 +134,8 @@ 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;
@@ -149,6 +160,16 @@ public:
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 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__
+12 -5
View File
@@ -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 ) { is_binary = true; } : OptionBase( name, desc, "(1-0)" ) { 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 ) StandardOption( const ClpString& name, T& storage, const ClpString& desc, const ClpString& def )
: OptionBase( name, desc ), opt_storage( storage ) : OptionBase( name, desc, def ), 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 ) FunctionOption( const ClpString& name, CalypOptions& parent_, Func* func_, const ClpString& desc, const ClpString& def )
: OptionBase( name, desc ), parent( parent_ ), func( func_ ) : OptionBase( name, desc, def ), parent( parent_ ), func( func_ )
{ {
is_binary = false; is_binary = false;
} }
@@ -198,6 +198,13 @@ 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;
+7 -3
View File
@@ -55,8 +55,8 @@
class OptionBase class OptionBase
{ {
public: public:
OptionBase( const ClpString& name, const ClpString& desc ) OptionBase( const ClpString& name, const ClpString& desc, const ClpString& def )
: arg_count( 0 ), opt_string( name ), opt_desc( desc ) {} : arg_count( 0 ), opt_string( name ), opt_desc( desc ), opt_defaults( def ) {}
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,6 +65,7 @@ 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;
}; };
@@ -117,11 +118,14 @@ 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
* with desc as an optional help description * description and range along with default value
*/ */
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:
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+20 -13
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -78,6 +78,7 @@ 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 );
@@ -89,7 +90,9 @@ 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( "8K", 8192, 4608 ); REGIST_CALYP_STANDARD_RESOLUTION( "6K 2:1", 6144, 3072 );
REGIST_CALYP_STANDARD_RESOLUTION( "8K", 7680, 4320 );
REGIST_CALYP_STANDARD_RESOLUTION( "8K 2:1", 8192, 4096 );
return stdResList; return stdResList;
} }
@@ -226,11 +229,11 @@ CalypStream::~CalypStream()
close(); close();
} }
ClpString CalypStream::getFormatName() ClpString CalypStream::getFormatName() const
{ {
return !d->handler ? "" : d->handler->getFormatName(); return !d->handler ? "" : d->handler->getFormatName();
} }
ClpString CalypStream::getCodecName() ClpString CalypStream::getCodecName() const
{ {
return !d->handler ? "" : d->handler->getCodecName(); return !d->handler ? "" : d->handler->getCodecName();
} }
@@ -389,17 +392,17 @@ void CalypStream::close()
d->isInit = false; d->isInit = false;
} }
ClpString CalypStream::getFileName() ClpString CalypStream::getFileName() const
{ {
return d->cFilename; return d->cFilename;
} }
bool CalypStream::isNative() bool CalypStream::isNative() const
{ {
return d->handler->m_bNative; return d->handler->m_bNative;
} }
unsigned int CalypStream::getFrameNum() ClpULong CalypStream::getFrameNum() const
{ {
return d->handler->m_uiTotalNumberFrames; return d->handler->m_uiTotalNumberFrames;
} }
@@ -411,22 +414,26 @@ 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() double CalypStream::getFrameRate() const
{ {
return d->handler->m_dFrameRate; return d->handler->m_dFrameRate;
} }
int CalypStream::getCurrFrameNum() long CalypStream::getCurrFrameNum() const
{ {
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 ) unsigned int& rFrameRate ) const
{ {
if( d->isInit ) if( d->isInit )
{ {
@@ -472,7 +479,7 @@ void CalypStream::loadAll()
d->iCurrFrameNum = 0; d->iCurrFrameNum = 0;
} }
void CalypStream::getDuration( int* duration_array ) void CalypStream::getDuration( int* duration_array ) const
{ {
// int hours, mins, secs = 0; // int hours, mins, secs = 0;
// #ifdef USE_FFMPEG // #ifdef USE_FFMPEG
@@ -571,7 +578,7 @@ void CalypStream::readNextFrameFillRGBBuffer()
return; return;
} }
CalypFrame* CalypStream::getCurrFrame( CalypFrame* pyuv_image ) CalypFrame* CalypStream::getCurrFrame( CalypFrame* pyuv_image ) const
{ {
if( pyuv_image == NULL ) if( pyuv_image == NULL )
pyuv_image = new CalypFrame( d->frameBuffer->current() ); pyuv_image = new CalypFrame( d->frameBuffer->current() );
@@ -580,7 +587,7 @@ CalypFrame* CalypStream::getCurrFrame( CalypFrame* pyuv_image )
return pyuv_image; return pyuv_image;
} }
CalypFrame* CalypStream::getCurrFrame() CalypFrame* CalypStream::getCurrFrame() const
{ {
return d->frameBuffer->current(); return d->frameBuffer->current();
} }
+15 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -67,8 +67,10 @@ public:
CalypStream(); CalypStream();
~CalypStream(); ~CalypStream();
ClpString getFormatName(); ClpString getFormatName() const;
ClpString getCodecName(); ;
ClpString getCodecName() const;
;
bool open( ClpString filename, ClpString resolution, ClpString input_format, unsigned int bitsPel, int endianness, 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 );
@@ -77,16 +79,17 @@ public:
bool reload(); bool reload();
void close(); void close();
bool isNative(); bool isNative() const;
ClpString getFileName(); ClpString getFileName() const;
unsigned int getFrameNum(); ClpULong getFrameNum() const;
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;
int getCurrFrameNum(); long getCurrFrameNum() const;
double getFrameRate(); double getFrameRate() const;
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 ); unsigned int& rFrameRate ) const;
void loadAll(); void loadAll();
@@ -96,18 +99,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* ); CalypFrame* getCurrFrame( CalypFrame* ) const;
// continuous read control // continuous read control
bool setNextFrame(); bool setNextFrame();
void readNextFrame(); void readNextFrame();
void readNextFrameFillRGBBuffer(); void readNextFrameFillRGBBuffer();
CalypFrame* getCurrFrame(); CalypFrame* getCurrFrame() const;
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 ); void getDuration( int* duration_array ) const;
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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -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( unsigned long long int iFrameNum ) = 0; virtual bool seek( ClpULong 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,7 +105,6 @@ 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;
@@ -113,9 +112,10 @@ protected:
unsigned int m_uiBitsPerPixel; unsigned int m_uiBitsPerPixel;
int m_iEndianness; int m_iEndianness;
double m_dFrameRate; double m_dFrameRate;
unsigned long m_uiTotalNumberFrames; ClpULong m_uiCurrFrameFileIdx;
ClpULong m_uiTotalNumberFrames;
ClpByte* m_pStreamBuffer; ClpByte* m_pStreamBuffer;
unsigned long m_uiNBytesPerFrame; ClpULong m_uiNBytesPerFrame;
bool m_isEOF; bool m_isEOF;
}; };
+3 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -55,7 +55,8 @@ 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 );
memset( d, 0, (int)padded_size ); if( d )
memset( d, 0, (int)padded_size );
return d; return d;
} }
+1 -18
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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -177,23 +177,6 @@ const std::map<int, CalypPixelFormatDescriptor> g_CalypPixFmtDescriptorsMap = {
}, },
}, },
}, },
{
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 */
},
},
},
{ {
CLP_RGBA32, CLP_RGBA32,
{ {
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -31,7 +31,7 @@
#include <cstdio> #include <cstdio>
#include <iostream> #include <iostream>
#if( ( LIBAVCODEC_VERSION_MAJOR >= 57 ) && ( LIBAVCODEC_VERSION_MINOR >= 37 ) ) #if( ( LIBAVCODEC_VERSION_MAJOR > 57 ) || ( LIBAVCODEC_VERSION_MAJOR == 57 ) && ( LIBAVCODEC_VERSION_MINOR >= 37 ) )
#define FF_SEND_RECEIVE_API #define FF_SEND_RECEIVE_API
#define FF_USER_CODEC_PARAM #define FF_USER_CODEC_PARAM
#endif #endif
@@ -335,7 +335,7 @@ bool StreamHandlerLibav::configureBuffer( CalypFrame* pcFrame )
void StreamHandlerLibav::calculateFrameNumber() void StreamHandlerLibav::calculateFrameNumber()
{ {
unsigned long long int num_frames; ClpULong 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( unsigned long long int iFrameNum ) bool StreamHandlerLibav::seek( ClpULong iFrameNum )
{ {
if( m_uiTotalNumberFrames == 1 ) if( m_uiTotalNumberFrames == 1 )
return true; return true;
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -66,7 +66,7 @@ public:
void closeHandler(); void closeHandler();
bool configureBuffer( CalypFrame* pcFrame ); bool configureBuffer( CalypFrame* pcFrame );
void calculateFrameNumber(); void calculateFrameNumber();
bool seek( unsigned long long int iFrameNum ); bool seek( ClpULong iFrameNum );
bool read( CalypFrame* pcFrame ); bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame ); bool write( CalypFrame* pcFrame );
+24 -13
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -29,6 +29,9 @@
#include <cstdio> #include <cstdio>
#include <opencv2/opencv.hpp> #include <opencv2/opencv.hpp>
#if CV_MAJOR_VERSION >= 3
#include <opencv2/videoio.hpp>
#endif
using cv::Mat; using cv::Mat;
using cv::VideoCapture; using cv::VideoCapture;
@@ -37,7 +40,8 @@ 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", "/dev/video*" ); REGIST_CALYP_SUPPORTED_ABSTRACT_FMT( &StreamHandlerOpenCV::Create, "Device",
"/dev/video*" );
#endif #endif
END_REGIST_CALYP_SUPPORTED_FMT; END_REGIST_CALYP_SUPPORTED_FMT;
} }
@@ -45,10 +49,12 @@ 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, "Portable PixMap ", "ppm" ); REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create,
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Portable Network Graphics", "png" ); "Portable Network Graphics", "png" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Joint Photographic Experts Group", "jpg" ); REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create,
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Windows Bitmap", "bmp" ); "Joint Photographic Experts Group", "jpg" );
REGIST_CALYP_SUPPORTED_FMT( &StreamHandlerOpenCV::Create, "Windows Bitmap",
"bmp" );
END_REGIST_CALYP_SUPPORTED_FMT; END_REGIST_CALYP_SUPPORTED_FMT;
} }
@@ -78,14 +84,20 @@ 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 = clpUppercase( strFilename.substr( strFilename.find_last_of( "." ) + 1 ) ); m_strCodecName = m_strFormatName =
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;
@@ -119,7 +131,7 @@ bool StreamHandlerOpenCV::configureBuffer( CalypFrame* pcFrame )
return true; return true;
} }
bool StreamHandlerOpenCV::seek( unsigned long long int iFrameNum ) bool StreamHandlerOpenCV::seek( ClpULong iFrameNum )
{ {
// m_uiCurrFrameFileIdx = // m_uiCurrFrameFileIdx =
return true; return true;
@@ -149,10 +161,9 @@ bool StreamHandlerOpenCV::write( CalypFrame* pcFrame )
{ {
bool bRet = false; bool bRet = false;
Mat cvFrame; Mat cvFrame;
bRet = pcFrame->toMat( cvFrame ); bRet = pcFrame->toMat( cvFrame, false, true );
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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -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( unsigned long long int iFrameNum ); bool seek( ClpULong iFrameNum );
bool read( CalypFrame* pcFrame ); bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame ); bool write( CalypFrame* pcFrame );
+41 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -33,7 +33,7 @@
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,7 +42,9 @@ 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;
} }
@@ -50,62 +52,71 @@ 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( m_iMagicNumber == 1 || m_iMagicNumber == 4 ) if( sscanf( line, "P%d %u %u %d", &m_iMagicNumber, &m_uiWidth, &m_uiHeight, &m_iMaxValue ) != 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, "%d", &m_iMaxValue ); sscanf( line, "%u %u", &m_uiWidth, &m_uiHeight );
m_uiBitsPerPixel = log( m_iMaxValue + 1 ) / log( 2 );
m_iPixelFormat = m_iMagicNumber == 2 || m_iMagicNumber == 5 ? CLP_GRAY : CLP_RGB24; if( m_iMagicNumber == 1 )
{
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 = 4; m_iMagicNumber = 1;
m_iPixelFormat = CalypFrame::findPixelFormat( "GRAY" );
} }
else if( m_iPixelFormat == CLP_GRAY ) else if( colorSpace == CLP_COLOR_GRAY )
{ {
m_iMagicNumber = 5; m_iMagicNumber = 5;
m_iPixelFormat = CalypFrame::findPixelFormat( "GRAY" );
} }
else if( m_iPixelFormat == CLP_RGB24 ) else if( colorSpace == CLP_COLOR_RGB )
{ {
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 = 0; m_iEndianness = CLP_BIG_ENDIAN;
m_dFrameRate = 1; m_dFrameRate = 1;
m_uiTotalNumberFrames = 1; m_uiTotalNumberFrames = 1;
if( m_pFile == NULL )
{
closeHandler();
return false;
}
return true; return true;
} }
@@ -123,7 +134,7 @@ bool StreamHandlerPortableMap::configureBuffer( CalypFrame* pcFrame )
return getMem1D<ClpByte>( &m_pStreamBuffer, pcFrame->getBytesPerFrame() ); return getMem1D<ClpByte>( &m_pStreamBuffer, pcFrame->getBytesPerFrame() );
} }
bool StreamHandlerPortableMap::seek( unsigned long long int iFrameNum ) bool StreamHandlerPortableMap::seek( ClpULong iFrameNum )
{ {
// m_uiCurrFrameFileIdx = // m_uiCurrFrameFileIdx =
return true; return true;
@@ -141,13 +152,16 @@ 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 );
} }
pcFrame->frameToBuffer( m_pStreamBuffer, CLP_BIG_ENDIAN ); pcRGBFrame.frameToBuffer( m_pStreamBuffer, m_iEndianness );
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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -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( unsigned long long int iFrameNum ); bool seek( ClpULong iFrameNum );
bool read( CalypFrame* pcFrame ); bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame ); bool write( CalypFrame* pcFrame );
+4 -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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -57,6 +57,7 @@ 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;
} }
@@ -78,13 +79,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 int fileSize = ftell( m_pFile ); unsigned long long 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( unsigned long long int iFrameNum ) bool StreamHandlerRaw::seek( ClpULong 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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -46,7 +46,7 @@ public:
void closeHandler(); void closeHandler();
bool configureBuffer( CalypFrame* pcFrame ); bool configureBuffer( CalypFrame* pcFrame );
void calculateFrameNumber(); void calculateFrameNumber();
bool seek( unsigned long long int iFrameNum ); bool seek( ClpULong iFrameNum );
bool read( CalypFrame* pcFrame ); bool read( CalypFrame* pcFrame );
bool write( CalypFrame* pcFrame ); bool write( CalypFrame* pcFrame );
}; };
+5 -5
View File
@@ -1,6 +1,6 @@
/* This file is a part of plaYUVer project /* This file is a part of plaYUVer project
* Copyright (C) 2014-2017 by Luis Lucas (luisfrlucas@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Joao Carreira (jfmcarreira@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
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
@@ -22,13 +22,13 @@
* \brief CalypFrame quality metrics tests * \brief CalypFrame quality metrics tests
*/ */
#include "gtest/gtest.h"
#include "CalypStream.h"
#include "CalypFrame.h" #include "CalypFrame.h"
#include "CalypStream.h"
#include "gtest/gtest.h"
class CalypFrameQualityTest : public ::testing::Test class CalypFrameQualityTest : public ::testing::Test
{ {
protected: protected:
// Per-test-case set-up. // Per-test-case set-up.
// Called before the first test in this test case. // Called before the first test in this test case.
// Can be omitted if not needed. // Can be omitted if not needed.
+14 -11
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -49,13 +49,11 @@ bool AbsoluteFrameDifference::create( std::vector<CalypFrame*> apcFrameList )
_BASIC_MODULE_API_2_CHECK_ _BASIC_MODULE_API_2_CHECK_
for( unsigned int i = 1; i < apcFrameList.size(); i++ ) for( unsigned int i = 1; i < apcFrameList.size(); i++ )
if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE | if( !apcFrameList[i]->haveSameFmt( apcFrameList[0], CalypFrame::MATCH_COLOR_SPACE_IGNORE_GRAY
CalypFrame::MATCH_RESOLUTION | | CalypFrame::MATCH_COLOR_SPACE | CalypFrame::MATCH_RESOLUTION | CalypFrame::MATCH_BITS ) )
CalypFrame::MATCH_BITS ) )
return false; return false;
m_pcFrameDifference = m_pcFrameDifference = new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY, apcFrameList[0]->getBitsPel() );
new CalypFrame( apcFrameList[0]->getWidth(), apcFrameList[0]->getHeight(), CLP_GRAY );
return true; return true;
} }
@@ -68,13 +66,18 @@ CalypFrame* AbsoluteFrameDifference::process( std::vector<CalypFrame*> apcFrameL
ClpPel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0]; ClpPel* pOutputPelYUV = m_pcFrameDifference->getPelBufferYUV()[0][0];
int aux_pel_1, aux_pel_2; int aux_pel_1, aux_pel_2;
for( unsigned int y = 0; y < m_pcFrameDifference->getHeight(); y++ ) for( unsigned int ch = 0; ch < m_pcFrameDifference->getNumberChannels(); ch++ )
for( unsigned int x = 0; x < m_pcFrameDifference->getWidth(); x++ ) {
for( unsigned int y = 0; y < m_pcFrameDifference->getHeight(); y++ )
{ {
aux_pel_1 = *pInput1PelYUV++; for( unsigned int x = 0; x < m_pcFrameDifference->getWidth(); x++ )
aux_pel_2 = *pInput2PelYUV++; {
*pOutputPelYUV++ = abs( aux_pel_1 - aux_pel_2 ); aux_pel_1 = *pInput1PelYUV++;
aux_pel_2 = *pInput2PelYUV++;
*pOutputPelYUV++ = abs( aux_pel_1 - aux_pel_2 );
}
} }
}
return m_pcFrameDifference; return m_pcFrameDifference;
} }
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+12 -1
View File
@@ -3,6 +3,7 @@
### ###
OPTION( CALYP_THREADED_MODULES "Use threads for modules" OFF ) OPTION( CALYP_THREADED_MODULES "Use threads for modules" OFF )
SET( CALYP_EXTRA_MODULES_DIR "CALYP_EXTRA_MODULES_DIR" CACHE PATH "Location of extra Calyp modules")
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} )
@@ -13,6 +14,8 @@ set(Calyp_Mod_SRCS
# #
# Modules List # Modules List
# #
# SET( MODULE_LOCATION "")
ADD_MODULE( FilterComponentLuma "FilterComponent" ) ADD_MODULE( FilterComponentLuma "FilterComponent" )
ADD_MODULE( FilterComponentChromaU "FilterComponent" ) ADD_MODULE( FilterComponentChromaU "FilterComponent" )
ADD_MODULE( FilterComponentChromaV "FilterComponent" ) ADD_MODULE( FilterComponentChromaV "FilterComponent" )
@@ -30,8 +33,9 @@ ADD_MODULE( FrameCrop "FrameCrop" )
ADD_MODULE( LumaAverage "LumaAverage" ) ADD_MODULE( LumaAverage "LumaAverage" )
ADD_MODULE( WeightedPSNR "WeightedPSNR" ) ADD_MODULE( WeightedPSNR "WeightedPSNR" )
ADD_MODULE( HEVCIntraPrediction "HEVCIntraPrediction" ) ADD_MODULE( HEVCIntraPrediction "HEVCIntraPrediction" )
ADD_MODULE( OptimiseDisplay "OptimiseDisplay" )
ADD_MODULE_USE_OPENCV( MeasureOpticalFlowDualTVL1 "MeasureOpticalFlowDualTVL1" VERSION 2.4.13.0 MODULES video ) ADD_MODULE_USE_OPENCV( MeasureOpticalFlowDualTVL1 "MeasureOpticalFlowDualTVL1" VERSION 2.4.13.0 MODULES video optflow )
ADD_MODULE_USE_OPENCV( DisparityStereoBM "DisparityStereoBM" VERSION 2.4.13.0 MODULES calib3d ) ADD_MODULE_USE_OPENCV( DisparityStereoBM "DisparityStereoBM" VERSION 2.4.13.0 MODULES calib3d )
ADD_MODULE_USE_OPENCV( DisparityStereoSGBM "DisparityStereoSGBM" VERSION 2.4.13.0 MODULES calib3d ) ADD_MODULE_USE_OPENCV( DisparityStereoSGBM "DisparityStereoSGBM" VERSION 2.4.13.0 MODULES calib3d )
ADD_MODULE_USE_OPENCV( OpticalFlowDualTVL1 "OpticalFlow" VERSION 3.1.0 MODULES optflow ) ADD_MODULE_USE_OPENCV( OpticalFlowDualTVL1 "OpticalFlow" VERSION 3.1.0 MODULES optflow )
@@ -42,6 +46,13 @@ ADD_MODULE_USE_OPENCV( SaliencyDetectionSpectral "SaliencyDetection" VERSION 3.3
ADD_MODULE_USE_OPENCV( SaliencyDetectionFineGrained "SaliencyDetection" VERSION 3.3.0 MODULES saliency ) ADD_MODULE_USE_OPENCV( SaliencyDetectionFineGrained "SaliencyDetection" VERSION 3.3.0 MODULES saliency )
ADD_MODULE_USE_OPENCV( SaliencyDetectionBinWangApr2014 "SaliencyDetection" VERSION 3.3.0 MODULES saliency ) ADD_MODULE_USE_OPENCV( SaliencyDetectionBinWangApr2014 "SaliencyDetection" VERSION 3.3.0 MODULES saliency )
ADD_MODULE_USE_OPENCV( ThreeSixtySpatialtoTemporal "ThreeSixtySpatialtoTemporal" VERSION 3.1.0 MODULES core )
ADD_MODULE_USE_OPENCV( ThreeSixtyFaceExtraction "ThreeSixtyFaceExtraction" VERSION 3.1.0 MODULES core )
ADD_MODULE_USE_OPENCV( ThreeSixtyFaceConcatenation "ThreeSixtyFaceConcatenation" VERSION 3.1.0 MODULES core )
IF(EXISTS ${CALYP_EXTRA_MODULES_DIR} )
ADD_EXTRA_MODULES( ${CALYP_EXTRA_MODULES_DIR} )
ENDIF()
# #
# Create header and auxiliar files # Create header and auxiliar files
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+1 -1
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -90,6 +90,7 @@ CalypFrame* DisparityStereoBM::process( std::vector<CalypFrame*> apcFrameList )
{ {
return m_pcDisparityFrame; return m_pcDisparityFrame;
} }
cv::Mat disparityImage, disparityImage8; cv::Mat disparityImage, disparityImage8;
#if( CV_MAJOR_VERSION == 2 ) #if( CV_MAJOR_VERSION == 2 )
@@ -99,7 +100,6 @@ CalypFrame* DisparityStereoBM::process( std::vector<CalypFrame*> apcFrameList )
#endif #endif
disparityImage.convertTo( disparityImage8, CV_8U ); disparityImage.convertTo( disparityImage8, CV_8U );
m_pcDisparityFrame->fromMat( disparityImage8 ); m_pcDisparityFrame->fromMat( disparityImage8 );
return m_pcDisparityFrame; return m_pcDisparityFrame;
} }
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
+3 -3
View File
@@ -1,5 +1,5 @@
/* This file is a part of Calyp project /* This file is a part of Calyp project
* Copyright (C) 2014-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -58,7 +58,7 @@ bool DisparityStereoSGBM::create( std::vector<CalypFrame*> apcFrameList )
} }
m_uiNumberOfDisparities = ( ( apcFrameList[0]->getWidth() / 8 ) + 15 ) & -16; m_uiNumberOfDisparities = ( ( apcFrameList[0]->getWidth() / 8 ) + 15 ) & -16;
int cn = apcFrameList[0]->getNumberChannels(); int cn = apcFrameList[0]->getNumberChannels();
#if( CV_MAJOR_VERSION == 3 ) #if( CV_MAJOR_VERSION >= 3 )
m_cStereoMatch = cv::StereoSGBM::create( 0, 16, m_uiBlockSize ); m_cStereoMatch = cv::StereoSGBM::create( 0, 16, m_uiBlockSize );
m_cStereoMatch->setPreFilterCap( 63 ); m_cStereoMatch->setPreFilterCap( 63 );
@@ -99,7 +99,7 @@ CalypFrame* DisparityStereoSGBM::process( std::vector<CalypFrame*> apcFrameList
return m_pcDisparityFrame; return m_pcDisparityFrame;
} }
cv::Mat disparityImage, disparityImage8; cv::Mat disparityImage, disparityImage8;
#if( CV_MAJOR_VERSION == 3 ) #if( CV_MAJOR_VERSION >= 3 )
m_cStereoMatch->compute( leftImage, rightImage, disparityImage ); m_cStereoMatch->compute( leftImage, rightImage, disparityImage );
#else #else
m_cStereoMatch( leftImage, rightImage, disparityImage ); m_cStereoMatch( leftImage, rightImage, disparityImage );
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@@ -60,7 +60,7 @@ private:
bool m_bUseHH; bool m_bUseHH;
int m_uiNumberOfDisparities; int m_uiNumberOfDisparities;
unsigned int m_uiBlockSize; unsigned int m_uiBlockSize;
#if( CV_MAJOR_VERSION == 3 ) #if( CV_MAJOR_VERSION >= 3 )
cv::Ptr<cv::StereoSGBM> m_cStereoMatch; cv::Ptr<cv::StereoSGBM> m_cStereoMatch;
#else #else
cv::StereoSGBM m_cStereoMatch; cv::StereoSGBM m_cStereoMatch;
+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-2018 by Joao Carreira (jfmcarreira@gmail.com) * Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
* Luis Lucas (luisfrlucas@gmail.com) * Luis Lucas (luisfrlucas@gmail.com)
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify

Some files were not shown because too many files have changed in this diff Show More