Compare commits
169
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7ad00a4c5 | ||
|
|
fbbd77bfbf | ||
|
|
be06ca656d | ||
|
|
665cd0bb1c | ||
|
|
1c0321a705 | ||
|
|
5b9e16a708 | ||
|
|
5b6d3e9031 | ||
|
|
12c3b26580 | ||
|
|
574c712207 | ||
|
|
4deef9e11c | ||
|
|
c7c8074cf8 | ||
|
|
a7ca36d252 | ||
|
|
8940ede351 | ||
|
|
b57e887d55 | ||
|
|
3502b5df0d | ||
|
|
15007d7784 | ||
|
|
9790ef3e31 | ||
|
|
5f0bdb30b5 | ||
|
|
900c9c0418 | ||
|
|
54f9f185e2 | ||
|
|
dda88d8334 | ||
|
|
73e5608624 | ||
|
|
317123c7b9 | ||
|
|
0a40a8bdb6 | ||
|
|
5f66af794c | ||
|
|
a6e1acd406 | ||
|
|
7818dbc9e3 | ||
|
|
448b64a8e3 | ||
|
|
612f147639 | ||
|
|
53bb100ad4 | ||
|
|
d7b1d58b4b | ||
|
|
58ce738026 | ||
|
|
c8382ccaff | ||
|
|
1a00bd328c | ||
|
|
095d1863c2 | ||
|
|
3a56f532c1 | ||
|
|
2c89e47b8a | ||
|
|
4aebcb979c | ||
|
|
f8aa92b7fa | ||
|
|
a2f7f10fea | ||
|
|
223bd859a9 | ||
|
|
b148f28dab | ||
|
|
b383eff34f | ||
|
|
1ec77b64c6 | ||
|
|
237bc1cc2e | ||
|
|
d4913ed2d2 | ||
|
|
113e86e583 | ||
|
|
9ea9d845c7 | ||
|
|
48afd0be45 | ||
|
|
1e4de99fba | ||
|
|
d446ee7ac1 | ||
|
|
357971c68b | ||
|
|
6be534d00c | ||
|
|
437325c96f | ||
|
|
94444e38ec | ||
|
|
a093efce9c | ||
|
|
de80c85596 | ||
|
|
9a63a57458 | ||
|
|
2451494677 | ||
|
|
ffe1bf688d | ||
|
|
bf5235352b | ||
|
|
463e1a58b9 | ||
|
|
8ef5b31268 | ||
|
|
be82c6ca89 | ||
|
|
eaa9987314 | ||
|
|
304c0f6683 | ||
|
|
83a9decc26 | ||
|
|
2a1b0abb2f | ||
|
|
cad1f6d7a6 | ||
|
|
d330ecfd0d | ||
|
|
7b5e5d5694 | ||
|
|
f2a636baa1 | ||
|
|
9e3fb9c0a0 | ||
|
|
420aeb89a6 | ||
|
|
a1b44895b8 | ||
|
|
e1e5c4eb3c | ||
|
|
206613d08a | ||
|
|
b7e8087163 | ||
|
|
f4cf81b63c | ||
|
|
47504ff46f | ||
|
|
bdc5317ccc | ||
|
|
1dfddcf7fb | ||
|
|
cea720f8e9 | ||
|
|
48907ef614 | ||
|
|
cdff468904 | ||
|
|
dea3dd93d5 | ||
|
|
3745a687cb | ||
|
|
a1ebf62e21 | ||
|
|
3c85c96769 | ||
|
|
e7e1a8534b | ||
|
|
8807c14b59 | ||
|
|
039887f2e6 | ||
|
|
4c6a4aba65 | ||
|
|
910ab8024e | ||
|
|
6b0f7f6de3 | ||
|
|
6b8b4cbb6a | ||
|
|
0a70267ab7 | ||
|
|
4a4f985ac1 | ||
|
|
58424b8f4e | ||
|
|
3bbbf81ca2 | ||
|
|
7ea1db3202 | ||
|
|
0e26fd8964 | ||
|
|
27ecd818e8 | ||
|
|
d5d21a458f | ||
|
|
1066aaa73c | ||
|
|
ddd5eeb6b9 | ||
|
|
876e1ba9e3 | ||
|
|
47dd2ad3f9 | ||
|
|
e77e0a82fa | ||
|
|
2181fd6add | ||
|
|
eda28d1380 | ||
|
|
1599a80d46 | ||
|
|
42c4e3b388 | ||
|
|
d86ed3508b | ||
|
|
cd18227b8b | ||
|
|
fc913fdc08 | ||
|
|
f90c681788 | ||
|
|
44f7a9b02e | ||
|
|
624612d49b | ||
|
|
70db70a7cf | ||
|
|
33bf02ba0f | ||
|
|
864c3253f1 | ||
|
|
a2d452fd64 | ||
|
|
3732810f9e | ||
|
|
56fc2e45bb | ||
|
|
7ff939c33a | ||
|
|
fa23256955 | ||
|
|
ffe0c38427 | ||
|
|
12bd1a4c2c | ||
|
|
b830b700ca | ||
|
|
3109250471 | ||
|
|
c6b43ac7fa | ||
|
|
beed955e3f | ||
|
|
1f003ec2ac | ||
|
|
c718d01700 | ||
|
|
847f4f06b9 | ||
|
|
344188234b | ||
|
|
5439fd1af5 | ||
|
|
2f434d269b | ||
|
|
a72208f0e6 | ||
|
|
c3c4e229d8 | ||
|
|
fedcb2e03a | ||
|
|
e755608b02 | ||
|
|
2debe78ed8 | ||
|
|
4d1730f928 | ||
|
|
521e56202c | ||
|
|
d0933f43c9 | ||
|
|
1674ec4061 | ||
|
|
ab58ca44f2 | ||
|
|
11bf3f6bfd | ||
|
|
669f3db250 | ||
|
|
3c6e0555bc | ||
|
|
fca79a7992 | ||
|
|
b507b61ce4 | ||
|
|
72bfaf6796 | ||
|
|
0998d98375 | ||
|
|
3afa6eeb6f | ||
|
|
41c65dcac4 | ||
|
|
25d40cadbe | ||
|
|
ca68f5a78f | ||
|
|
f2e1e4bfc7 | ||
|
|
b5edc60794 | ||
|
|
6b084c1a7e | ||
|
|
7b712bb232 | ||
|
|
684cecd632 | ||
|
|
f6cc0ffd29 | ||
|
|
c1cef58de1 | ||
|
|
f9e62c73ac | ||
|
|
6486104db2 |
No files matched your search
+17
-16
@@ -1,45 +1,46 @@
|
|||||||
image: Visual Studio 2017
|
image: Visual Studio 2019
|
||||||
configuration: Release
|
configuration: Release
|
||||||
platform:
|
platform:
|
||||||
- x64
|
- x64
|
||||||
environment:
|
environment:
|
||||||
access_token:
|
access_token:
|
||||||
secure: WAV5LfCSAtwE1JuZh4HrDlxOOClimLoslYAJlf5KRgc3f7WIkX591PrSSua/Zo2C
|
secure: SMxOWNKN0RkPvICWhIet2FJM5g/zx5mguM/XAPjM2OrC3U2/LAqcBZw0veS9peS4
|
||||||
|
|
||||||
clone_folder: C:\Projects\calyp
|
clone_folder: C:\Projects\calyp
|
||||||
|
|
||||||
init:
|
init:
|
||||||
- ps: Add-Content "$HOME\.git-credentials" "https://$($env:access_token):x-oauth-basic@github.com`n"
|
- 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 credential.helper store
|
||||||
- git config --global user.email "jfmcarreira@gmail.com"
|
- git config --global user.email "jfmcarreira@gmail.com"
|
||||||
- git config --global user.name "AppVeyor"
|
- git config --global user.name "AppVeyor"
|
||||||
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
|
||||||
install:
|
install:
|
||||||
- '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64'
|
- '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" x64'
|
||||||
#- '"C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64'
|
|
||||||
- choco install nsis
|
- choco install nsis
|
||||||
- choco install opencv
|
- choco install opencv
|
||||||
- 'C:\Tools\opencv\build\setup_vars_opencv4.cmd'
|
- 'C:\Tools\opencv\build\setup_vars_opencv4.cmd'
|
||||||
- cd C:\Projects
|
- cd C:\Projects
|
||||||
- ps: Start-FileDownload 'https://ffmpeg.zeranoe.com/builds/win64/dev/ffmpeg-4.1.1-win64-dev.zip'
|
- ps: Start-FileDownload 'https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z' ffmpeg.7z
|
||||||
- 7z x ffmpeg-4.1.1-win64-dev.zip -y
|
- 7z x ffmpeg.7z -y -offmpeg
|
||||||
- git clone https://github.com/pixlra/calyp-deployment.git
|
- git clone https://github.com/pixlra/calyp-deployment.git
|
||||||
|
- CALL calyp-deployment/scripts/extract_ffmpeg.bat
|
||||||
|
- ps: rm C:\Projects\ffmpeg_libraries\bin\*.exe
|
||||||
|
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
- mv C:\Projects\calyp C:\Projects\calyp-deployment\cmake-helper\
|
- mv C:\Projects\calyp C:\Projects\calyp-deployment\cmake-helper\
|
||||||
- mkdir C:\Projects\calyp-build
|
- mkdir C:\Projects\calyp-build
|
||||||
- cd C:\Projects\calyp-build
|
- cd C:\Projects\calyp-build
|
||||||
- cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=install -DUSE_DYNLOAD=OFF -DOpenCV_DIR="C:/Tools/opencv/build" -DOpenCV_DLL_DIR="C:/Tools/opencv/build/x64/vc15/bin" -DOpenCV_INSTALL_MODULES="world" -DQT_DIR="C:\Qt\latest\msvc2017_64" -DQt5_DIR="C:\Qt\latest\msvc2017_64\lib\cmake\Qt5" -DUSE_QTDBUS=OFF -DAVFORMAT_LIBRARIES=C:/Projects/ffmpeg-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 -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\msvc2019_64" -DQt5_DIR="C:\Qt\latest\msvc2019_64\lib\cmake\Qt5" -DUSE_QTDBUS=OFF -DAVFORMAT_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avformat.lib -DAVFORMAT_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DAVCODEC_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avcodec.lib -DAVCODEC_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DAVUTIL_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avutil.lib -DAVUTIL_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DSWSCALE_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/swscale.lib -DSWSCALE_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DAVDEVICE_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/avdevice.lib -DAVDEVICE_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DPOSTPROC_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/postproc.lib -DPOSTPROC_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -DFFMPEG_DIR=C:\Projects\ffmpeg_libraries -DSWRESAMPLE_LIBRARIES=C:/Projects/ffmpeg_libraries/lib/swresample.lib -DSWRESAMPLE_INCLUDE_DIRS=C:/Projects/ffmpeg_libraries/include -G "Visual Studio 16 2019" -A x64 C:\Projects\calyp-deployment\cmake-helper
|
||||||
- cmake --build . --target ALL_BUILD -- /p:Configuration=Release > log_build
|
- cmake --build . --target ALL_BUILD -- /p:Configuration=Release
|
||||||
- cmake --build . --target INSTALL -- /p:Configuration=Release > log_install
|
- cmake --build . --target INSTALL -- /p:Configuration=Release
|
||||||
- cmake --build . --target PACKAGE -- /p:Configuration=Release > log_pkg
|
- cmake --build . --target PACKAGE -- /p:Configuration=Release
|
||||||
|
|
||||||
after_build:
|
after_build:
|
||||||
- IF "%APPVEYOR_REPO_BRANCH%" == "master" (CALL ..\calyp-deployment\scripts\deploy-to-github.bat)
|
- IF "%APPVEYOR_REPO_BRANCH%" == "master" (CALL ..\calyp-deployment\scripts\deploy-to-github.bat)
|
||||||
|
|
||||||
|
|
||||||
on_failure:
|
on_failure:
|
||||||
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
- ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
|
||||||
|
|
||||||
+43
@@ -0,0 +1,43 @@
|
|||||||
|
---
|
||||||
|
Checks: 'clang-diagnostic-*,clang-analyzer-*,cppcoreguidelines-*,-cppcoreguidelines-pro-bounds-array-to-pointer-decay,-cppcoreguidelines-pro-bounds-pointer-arithmetic,-cppcoreguidelines-non-private-member-variables-in-classes'
|
||||||
|
WarningsAsErrors: ''
|
||||||
|
HeaderFilterRegex: ''
|
||||||
|
AnalyzeTemporaryDtors: false
|
||||||
|
FormatStyle: none
|
||||||
|
CheckOptions:
|
||||||
|
- key: llvm-else-after-return.WarnOnConditionVariables
|
||||||
|
value: '0'
|
||||||
|
- key: modernize-loop-convert.MinConfidence
|
||||||
|
value: reasonable
|
||||||
|
- key: modernize-replace-auto-ptr.IncludeStyle
|
||||||
|
value: llvm
|
||||||
|
- key: cert-str34-c.DiagnoseSignedUnsignedCharComparisons
|
||||||
|
value: '0'
|
||||||
|
- key: google-readability-namespace-comments.ShortNamespaceLines
|
||||||
|
value: '10'
|
||||||
|
- key: cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField
|
||||||
|
value: '0'
|
||||||
|
- key: cppcoreguidelines-non-private-member-variables-in-classes.IgnoreClassesWithAllMemberVariablesBeingPublic
|
||||||
|
value: '1'
|
||||||
|
- key: cert-dcl16-c.NewSuffixes
|
||||||
|
value: 'L;LL;LU;LLU'
|
||||||
|
- key: google-readability-braces-around-statements.ShortStatementLines
|
||||||
|
value: '1'
|
||||||
|
- key: modernize-pass-by-value.IncludeStyle
|
||||||
|
value: llvm
|
||||||
|
- key: google-readability-namespace-comments.SpacesBeforeComments
|
||||||
|
value: '2'
|
||||||
|
- key: modernize-loop-convert.MaxCopySize
|
||||||
|
value: '16'
|
||||||
|
- key: cppcoreguidelines-explicit-virtual-functions.IgnoreDestructors
|
||||||
|
value: '1'
|
||||||
|
- key: modernize-use-nullptr.NullMacros
|
||||||
|
value: 'NULL'
|
||||||
|
- key: llvm-qualified-auto.AddConstToQualified
|
||||||
|
value: '0'
|
||||||
|
- key: modernize-loop-convert.NamingStyle
|
||||||
|
value: CamelCase
|
||||||
|
- key: llvm-else-after-return.WarnOnUnfixable
|
||||||
|
value: '0'
|
||||||
|
- key: google-readability-function-size.StatementThreshold
|
||||||
|
value: '800'
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
# ----------------------------------
|
||||||
|
# Options affecting listfile parsing
|
||||||
|
# ----------------------------------
|
||||||
|
with section("parse"):
|
||||||
|
|
||||||
|
# Specify structure for custom cmake functions
|
||||||
|
additional_commands = { 'foo': { 'flags': ['BAR', 'BAZ'],
|
||||||
|
'kwargs': {'DEPENDS': '*', 'HEADERS': '*', 'SOURCES': '*'}}}
|
||||||
|
|
||||||
|
## Override configurations per-command where available
|
||||||
|
#override_spec = {}
|
||||||
|
|
||||||
|
# Specify variable tags.
|
||||||
|
vartags = []
|
||||||
|
|
||||||
|
# Specify property tags.
|
||||||
|
proptags = []
|
||||||
|
|
||||||
|
# -----------------------------
|
||||||
|
# Options affecting formatting.
|
||||||
|
# -----------------------------
|
||||||
|
with section("format"):
|
||||||
|
|
||||||
|
# How wide to allow formatted cmake files
|
||||||
|
line_width = 150
|
||||||
|
|
||||||
|
# How many spaces to tab for indent
|
||||||
|
tab_size = 2
|
||||||
|
|
||||||
|
# If an argument group contains more than this many sub-groups (parg or kwarg
|
||||||
|
# groups) then force it to a vertical layout.
|
||||||
|
max_subgroups_hwrap = 2
|
||||||
|
|
||||||
|
# If a positional argument group contains more than this many arguments, then
|
||||||
|
# force it to a vertical layout.
|
||||||
|
max_pargs_hwrap = 6
|
||||||
|
|
||||||
|
dangle_parens = True
|
||||||
|
|
||||||
|
# Format command names consistently as 'lower' or 'upper' case
|
||||||
|
command_case = 'upper'
|
||||||
|
|
||||||
|
# Format keywords consistently as 'lower' or 'upper' case
|
||||||
|
keyword_case = 'upper'
|
||||||
|
|
||||||
|
|
||||||
|
# ----------------------------
|
||||||
|
# Options affecting the linter
|
||||||
|
# ----------------------------
|
||||||
|
with section("lint"):
|
||||||
|
|
||||||
|
# a list of lint codes to disable
|
||||||
|
disabled_codes = ["C0103"]
|
||||||
|
|
||||||
|
# regular expression pattern describing valid function names
|
||||||
|
function_pattern = '[0-9a-z_]+'
|
||||||
|
|
||||||
|
# regular expression pattern describing valid macro names
|
||||||
|
macro_pattern = '[0-9A-Z_]+'
|
||||||
|
|
||||||
|
# regular expression pattern describing valid names for variables with global
|
||||||
|
# (cache) scope
|
||||||
|
global_var_pattern = '[A-Z][0-9A-Z_]+'
|
||||||
|
|
||||||
|
# regular expression pattern describing valid names for variables with global
|
||||||
|
# scope (but internal semantic)
|
||||||
|
internal_var_pattern = '_[A-Z][0-9A-Z_]+'
|
||||||
|
|
||||||
|
# regular expression pattern describing valid names for variables with local
|
||||||
|
# scope
|
||||||
|
local_var_pattern = '[a-z][a-z0-9_]+'
|
||||||
|
|
||||||
|
# regular expression pattern describing valid names for privatedirectory
|
||||||
|
# variables
|
||||||
|
private_var_pattern = '_[0-9a-z_]+'
|
||||||
|
|
||||||
|
# regular expression pattern describing valid names for public directory
|
||||||
|
# variables
|
||||||
|
public_var_pattern = '[A-Z][0-9A-Z_]+'
|
||||||
|
|
||||||
|
# regular expression pattern describing valid names for function/macro
|
||||||
|
# arguments and loop variables.
|
||||||
|
argument_var_pattern = '[a-z][a-z0-9_]+'
|
||||||
|
|
||||||
|
# regular expression pattern describing valid names for keywords used in
|
||||||
|
# functions or macros
|
||||||
|
keyword_pattern = '[A-Z][0-9A-Z_]+'
|
||||||
|
|
||||||
|
# In the heuristic for C0201, how many conditionals to match within a loop in
|
||||||
|
# before considering the loop a parser.
|
||||||
|
max_conditionals_custom_parser = 2
|
||||||
|
|
||||||
|
# Require at least this many newlines between statements
|
||||||
|
min_statement_spacing = 1
|
||||||
|
|
||||||
|
# Require no more than this many newlines between statements
|
||||||
|
max_statement_spacing = 2
|
||||||
|
max_returns = 6
|
||||||
|
max_branches = 12
|
||||||
|
max_arguments = 5
|
||||||
|
max_localvars = 15
|
||||||
|
max_statements = 50
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Options affecting file encoding
|
||||||
|
# -------------------------------
|
||||||
|
with section("encode"):
|
||||||
|
|
||||||
|
# If true, emit the unicode byte-order mark (BOM) at the start of the file
|
||||||
|
emit_byteorder_mark = False
|
||||||
|
|
||||||
|
# Specify the encoding of the input file. Defaults to utf-8
|
||||||
|
input_encoding = 'utf-8'
|
||||||
|
|
||||||
|
# Specify the encoding of the output file. Defaults to utf-8. Note that cmake
|
||||||
|
# only claims to support utf-8 so be careful when using anything else
|
||||||
|
output_encoding = 'utf-8'
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
name: Build on Linux
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
- devel
|
||||||
|
pull_request:
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||||
|
BUILD_TYPE: Release
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
# The CMake configure and build commands are platform agnostic and should work equally
|
||||||
|
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||||
|
# cross-platform coverage.
|
||||||
|
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Install dependencies
|
||||||
|
run: sudo apt-get update && sudo apt-get install gcc-10 g++-10 cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev libopencv-contrib-dev
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Configure CMake
|
||||||
|
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
|
||||||
|
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
|
||||||
|
run: cmake -B ${{github.workspace}}/build -D CMAKE_C_COMPILER=gcc-10 -D CMAKE_CXX_COMPILER=g++-10 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DUSE_WERROR=ON
|
||||||
|
|
||||||
|
- name: Build
|
||||||
|
# Build your program with the given configuration
|
||||||
|
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
|
||||||
|
|
||||||
+15
-1
@@ -4,6 +4,8 @@
|
|||||||
### C++ ###
|
### C++ ###
|
||||||
# Prerequisites
|
# Prerequisites
|
||||||
*.d
|
*.d
|
||||||
|
# Clang
|
||||||
|
.cache/
|
||||||
|
|
||||||
# Compiled Object files
|
# Compiled Object files
|
||||||
*.slo
|
*.slo
|
||||||
@@ -74,6 +76,7 @@
|
|||||||
# CMake
|
# CMake
|
||||||
bin/
|
bin/
|
||||||
build/
|
build/
|
||||||
|
build-*
|
||||||
cmake-build-*/
|
cmake-build-*/
|
||||||
|
|
||||||
# Mongo Explorer plugin
|
# Mongo Explorer plugin
|
||||||
@@ -132,4 +135,15 @@ fabric.properties
|
|||||||
# .nfs files are created when an open file is removed but is still being accessed
|
# .nfs files are created when an open file is removed but is still being accessed
|
||||||
.nfs*
|
.nfs*
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/c++,clion,linux
|
### vscode ###
|
||||||
|
.vscode/*
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
# Documentation
|
||||||
|
doc/
|
||||||
|
|
||||||
|
# CLang
|
||||||
|
compile_commands.json
|
||||||
|
|
||||||
|
# Build dirs
|
||||||
|
build*
|
||||||
Generated
-2
@@ -1,2 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<module classpath="CMake" type="CPP_MODULE" version="4" />
|
|
||||||
Generated
-4
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
|
||||||
</project>
|
|
||||||
Generated
-7
@@ -1,7 +0,0 @@
|
|||||||
<?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>
|
|
||||||
Generated
-8
@@ -1,8 +0,0 @@
|
|||||||
<?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
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="VcsDirectoryMappings">
|
|
||||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
fail_fast: false
|
||||||
|
|
||||||
|
repos:
|
||||||
|
- repo: https://github.com/cheshirekow/cmake-format-precommit
|
||||||
|
rev: v0.6.10
|
||||||
|
hooks:
|
||||||
|
- id: cmake-format
|
||||||
|
- id: cmake-lint
|
||||||
|
|
||||||
|
- repo: https://github.com/pocc/pre-commit-hooks
|
||||||
|
rev: v1.1.1
|
||||||
|
hooks:
|
||||||
|
- id: clang-format
|
||||||
|
args: [--style=file, -i]
|
||||||
|
|
||||||
|
- repo: local
|
||||||
|
hooks:
|
||||||
|
- id: cmake-configure
|
||||||
|
name: Cmake Configure
|
||||||
|
entry: cmake -B build
|
||||||
|
pass_filenames: false
|
||||||
|
language: system
|
||||||
|
- id: cmake-build
|
||||||
|
name: Cmake Build
|
||||||
|
entry: cmake --build build
|
||||||
|
pass_filenames: false
|
||||||
|
language: system
|
||||||
|
|
||||||
|
|
||||||
+2
-2
@@ -1,7 +1,7 @@
|
|||||||
language: cpp
|
language: cpp
|
||||||
dist: xenial
|
dist: bionic
|
||||||
before_install:
|
before_install:
|
||||||
- sudo apt-get -qq update
|
- sudo apt-get -qq update
|
||||||
- sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev libopencv-contrib-dev
|
- sudo apt-get install build-essential cmake qtbase5-dev libavcodec-dev libavformat-dev libavutil-dev libopencv-dev libopencv-video-dev libopencv-contrib-dev libgtest-dev
|
||||||
script:
|
script:
|
||||||
- mkdir -p build && cd build && cmake .. && make && cd ..
|
- mkdir -p build && cd build && cmake .. && make && cd ..
|
||||||
+216
-157
@@ -1,240 +1,299 @@
|
|||||||
###
|
#
|
||||||
### CMakeLists for calyp
|
# CMakeLists for calyp
|
||||||
###
|
#
|
||||||
|
|
||||||
cmake_minimum_required( VERSION 3.2.0 )
|
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.0)
|
||||||
|
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
|
# Project Definition
|
||||||
|
# ####################################################################################################################################################
|
||||||
|
|
||||||
|
SET(PROJECT_NAME
|
||||||
|
"calyp"
|
||||||
|
CACHE INTERNAL "" FORCE
|
||||||
|
)
|
||||||
|
SET(PROJECT_LIBRARY
|
||||||
|
"Calyp"
|
||||||
|
CACHE INTERNAL "" FORCE
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(CALYP_VERSION_MAJOR "2")
|
||||||
|
SET(CALYP_VERSION_MINOR "0")
|
||||||
|
SET(CALYP_VERSION_PATCH "1")
|
||||||
|
SET(CALYP_VERSION
|
||||||
|
"${CALYP_VERSION_MAJOR}.${CALYP_VERSION_MINOR}.${CALYP_VERSION_PATCH}"
|
||||||
|
CACHE INTERNAL "" FORCE
|
||||||
|
)
|
||||||
|
|
||||||
|
PROJECT(
|
||||||
|
${PROJECT_NAME}
|
||||||
|
VERSION ${CALYP_VERSION}
|
||||||
|
LANGUAGES "CXX"
|
||||||
|
)
|
||||||
|
|
||||||
|
# ####################################################################################################################################################
|
||||||
# CMake functions
|
# CMake functions
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
|
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||||
INCLUDE( cmake/ModulesFct.cmake )
|
INCLUDE(cmake/ModulesFct.cmake)
|
||||||
INCLUDE(FeatureSummary)
|
INCLUDE(FeatureSummary)
|
||||||
INCLUDE(GNUInstallDirs)
|
INCLUDE(GNUInstallDirs)
|
||||||
|
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
# Project Definition
|
|
||||||
######################################################################################
|
|
||||||
|
|
||||||
SET( PROJECT_NAME "calyp" CACHE INTERNAL "" FORCE )
|
|
||||||
SET( PROJECT_LIBRARY "Calyp" CACHE INTERNAL "" FORCE )
|
|
||||||
|
|
||||||
|
|
||||||
PROJECT( ${PROJECT_NAME} )
|
|
||||||
SET( CALYP_VERSION_MAJOR "1" )
|
|
||||||
SET( CALYP_VERSION_MINOR "1" )
|
|
||||||
SET( CALYP_VERSION_PATCH "0" )
|
|
||||||
SET( CALYP_VERSION "${CALYP_VERSION_MAJOR}.${CALYP_VERSION_MINOR}.${CALYP_VERSION_PATCH}" CACHE INTERNAL "" FORCE )
|
|
||||||
|
|
||||||
######################################################################################
|
|
||||||
# Variables
|
# Variables
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
|
|
||||||
OPTION( BUILD_APP "Build GUI Application" ON )
|
OPTION(BUILD_APP "Build GUI Application" ON)
|
||||||
OPTION( BUILD_TOOLS "Build Command Line Application" ON )
|
OPTION(BUILD_TOOLS "Build Command Line Application" ON)
|
||||||
OPTION( BUILD_EXAMPLES "Build Examples" OFF )
|
OPTION(BUILD_EXAMPLES "Build Examples" OFF)
|
||||||
OPTION( BUILD_DOC "Build Documentation" OFF )
|
OPTION(BUILD_DOC "Build Documentation" OFF)
|
||||||
OPTION( BUILD_TESTS "Build Google Tests" OFF )
|
OPTION(BUILD_TESTS "Build Google Tests" OFF)
|
||||||
|
OPTION(BUILD_WITH_SANITIZERS "Build with sanitizers" OFF)
|
||||||
|
OPTION(BUILD_WITH_THREAD_SANITIZER "Build with thread sanitizer" OFF)
|
||||||
|
|
||||||
OPTION( USE_FERVOR "Add Fervor support" OFF )
|
OPTION(USE_FERVOR "Add Fervor support" OFF)
|
||||||
|
|
||||||
OPTION( USE_DYNLOAD "Use dynamic load of modules" ON )
|
OPTION(USE_DYNLOAD "Use dynamic load of modules" ON)
|
||||||
OPTION( USE_SSE "Build with SSE support" OFF )
|
OPTION(USE_SSE "Build with SSE support" ON)
|
||||||
OPTION( USE_WERROR "Warnings as errors" OFF )
|
OPTION(USE_WERROR "Warnings as errors" OFF)
|
||||||
OPTION( USE_STATIC "Use static libs" OFF )
|
OPTION(USE_STATIC "Use static libs" OFF)
|
||||||
|
OPTION(USE_IWYU "Use include what you use tool" OFF)
|
||||||
|
|
||||||
|
# ####################################################################################################################################################
|
||||||
######################################################################################
|
|
||||||
# Release configuration
|
# Release configuration
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
|
|
||||||
# To be switched on when releasing.
|
# To be switched on when releasing.
|
||||||
OPTION(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" ON)
|
OPTION(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" ON)
|
||||||
|
|
||||||
# Get current version.
|
# Get current version.
|
||||||
set(CALYP_VERSION_STRING "${CALYP_VERSION}")
|
SET(CALYP_VERSION_STRING "${CALYP_VERSION}")
|
||||||
if(NOT RELEASE_BUILD AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
IF(NOT RELEASE_BUILD AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/.git)
|
||||||
# Probably a Git workspace; determine the revision.
|
# Probably a Git workspace; determine the revision.
|
||||||
FIND_PACKAGE(Git QUIET)
|
FIND_PACKAGE(Git QUIET)
|
||||||
if(GIT_FOUND)
|
IF(GIT_FOUND)
|
||||||
exec_program(${GIT_EXECUTABLE}
|
EXEC_PROGRAM(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${GIT_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
ARGS "describe --tags"
|
ARGS "describe --tags"
|
||||||
OUTPUT_VARIABLE CALYP_GIT_REVISION
|
OUTPUT_VARIABLE CALYP_GIT_REVISION
|
||||||
RETURN_VALUE TAG_RESULT
|
RETURN_VALUE TAG_RESULT
|
||||||
)
|
)
|
||||||
# git describe --tags failed; maybe the repository was checked with depth=1.
|
# git describe --tags failed; maybe the repository was checked with depth=1.
|
||||||
if(NOT ${TAG_RESULT} EQUAL 0)
|
IF(NOT ${TAG_RESULT} EQUAL 0)
|
||||||
exec_program(${GIT_EXECUTABLE}
|
EXEC_PROGRAM(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}
|
${GIT_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
ARGS "describe --always"
|
ARGS "describe --always"
|
||||||
OUTPUT_VARIABLE CALYP_GIT_REVISION
|
OUTPUT_VARIABLE CALYP_GIT_REVISION
|
||||||
)
|
)
|
||||||
endif()
|
ENDIF()
|
||||||
message(STATUS "Calyp Git revision: ${CALYP_GIT_REVISION}")
|
MESSAGE(STATUS "Calyp Git revision: ${CALYP_GIT_REVISION}")
|
||||||
set(CALYP_VERSION_STRING "${CALYP_VERSION} (rev. ${CALYP_GIT_REVISION})")
|
SET(CALYP_VERSION_STRING "${CALYP_VERSION} (rev. ${CALYP_GIT_REVISION})")
|
||||||
else()
|
ELSE()
|
||||||
message(STATUS "Calyp Git revision could not be determined")
|
MESSAGE(STATUS "Calyp Git revision could not be determined")
|
||||||
endif()
|
ENDIF()
|
||||||
endif()
|
ENDIF()
|
||||||
|
|
||||||
SET(UPDATE_CHANNEL "stable" CACHE STRING "Update channel" )
|
SET(UPDATE_CHANNEL
|
||||||
|
"stable"
|
||||||
|
CACHE STRING "Update channel"
|
||||||
|
)
|
||||||
# CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/CalypUpdate.xml.in ${CMAKE_CURRENT_BINARY_DIR}/CalypUpdate-${UPDATE_CHANNEL}.xml )
|
# CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/CalypUpdate.xml.in ${CMAKE_CURRENT_BINARY_DIR}/CalypUpdate-${UPDATE_CHANNEL}.xml )
|
||||||
|
|
||||||
|
# ####################################################################################################################################################
|
||||||
######################################################################################
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
|
|
||||||
IF( BUILD_DOC )
|
IF(BUILD_DOC)
|
||||||
FIND_PACKAGE(Doxygen)
|
FIND_PACKAGE(Doxygen)
|
||||||
SET( BUILD_DOC ${Doxygen_FOUND} )
|
SET(BUILD_DOC ${Doxygen_FOUND})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
SET_PACKAGE_PROPERTIES(Doxygen PROPERTIES URL "http://www.doxygen.org/" DESCRIPTION "Doxygen" TYPE OPTIONAL)
|
SET_PACKAGE_PROPERTIES(
|
||||||
|
Doxygen PROPERTIES
|
||||||
|
URL "http://www.doxygen.org/"
|
||||||
|
DESCRIPTION "Doxygen"
|
||||||
|
TYPE OPTIONAL
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(BUILD_TESTS)
|
||||||
|
INCLUDE(FetchContent)
|
||||||
|
FETCHCONTENT_DECLARE(googletest URL https://github.com/google/googletest/archive/609281088cfefc76f9d0ce82e1ff6c30cc3591e5.zip)
|
||||||
|
# For Windows: Prevent overriding the parent project's compiler/linker settings
|
||||||
|
SET(gtest_force_shared_crt
|
||||||
|
ON
|
||||||
|
CACHE BOOL "" FORCE
|
||||||
|
)
|
||||||
|
FETCHCONTENT_MAKEAVAILABLE(googletest)
|
||||||
|
SET_PACKAGE_PROPERTIES(
|
||||||
|
googletest PROPERTIES
|
||||||
|
URL "https://github.com/google/googletest"
|
||||||
|
DESCRIPTION "Google unit tests"
|
||||||
|
TYPE OPTIONAL
|
||||||
|
)
|
||||||
|
|
||||||
IF( BUILD_TESTS )
|
FETCHCONTENT_DECLARE(
|
||||||
FIND_PACKAGE(GTest)
|
Catch2
|
||||||
SET( BUILD_DOC ${GTEST_FOUND} )
|
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
|
||||||
IF( GTEST_FOUND )
|
GIT_TAG v2.13.1
|
||||||
ENABLE_TESTING()
|
)
|
||||||
INCLUDE_DIRECTORIES(${GTEST_INCLUDE_DIRS})
|
FETCHCONTENT_MAKEAVAILABLE(Catch2)
|
||||||
ENDIF()
|
SET_PACKAGE_PROPERTIES(
|
||||||
|
Catch2 PROPERTIES
|
||||||
|
URL "https://github.com/catchorg/Catch2"
|
||||||
|
DESCRIPTION "Catch2 unit tests"
|
||||||
|
TYPE OPTIONAL
|
||||||
|
)
|
||||||
|
INCLUDE(${CMAKE_CURRENT_BINARY_DIR}/_deps/catch2-src/contrib/Catch.cmake)
|
||||||
|
INCLUDE(CTest)
|
||||||
|
ENABLE_TESTING()
|
||||||
|
|
||||||
|
SET(CALYP_TEST_DATA_DIR
|
||||||
|
"CALYP_TEST_DATA_DIR"
|
||||||
|
CACHE PATH "Location of video information for testing"
|
||||||
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
OPTION( USE_OPENCV "Add OpenCV support" ON )
|
OPTION(USE_OPENCV "Add OpenCV support" ON)
|
||||||
IF( USE_OPENCV )
|
IF(USE_OPENCV)
|
||||||
|
|
||||||
FIND_PACKAGE( OpenCV COMPONENTS core highgui imgproc video )
|
FIND_PACKAGE(OpenCV COMPONENTS core highgui imgproc video)
|
||||||
IF( ${OpenCV_FOUND} )
|
IF(${OpenCV_FOUND})
|
||||||
SET(USE_OPENCV TRUE )
|
SET(USE_OPENCV TRUE)
|
||||||
LIST(APPEND OPENCV_MODULES core highgui imgproc video )
|
LIST(APPEND OPENCV_MODULES core highgui imgproc video)
|
||||||
FIND_PACKAGE( OpenCV COMPONENTS videoio photo )
|
FIND_PACKAGE(OpenCV COMPONENTS videoio photo)
|
||||||
IF( ${OPENCV_VIDEOIO_FOUND} )
|
IF(${OPENCV_VIDEOIO_FOUND})
|
||||||
LIST(APPEND OPENCV_MODULES videoio )
|
LIST(APPEND OPENCV_MODULES videoio)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
IF( ${OPENCV_PHOTO_FOUND} )
|
IF(${OPENCV_PHOTO_FOUND})
|
||||||
LIST(APPEND OPENCV_MODULES photo )
|
LIST(APPEND OPENCV_MODULES photo)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ELSE()
|
ELSE()
|
||||||
SET(USE_OPENCV FALSE )
|
SET(USE_OPENCV FALSE)
|
||||||
ENDIF()
|
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
|
||||||
|
)
|
||||||
|
|
||||||
OPTION( USE_FFMPEG "Add FFMPEG support" ON )
|
OPTION(USE_FFMPEG "Add FFMPEG support" ON)
|
||||||
IF( USE_FFMPEG )
|
IF(USE_FFMPEG)
|
||||||
FIND_PACKAGE( FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE )
|
FIND_PACKAGE(FFmpeg COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE)
|
||||||
IF( "${AVCODEC_VERSION}" VERSION_LESS "56.0.0" )
|
|
||||||
SET(FFMPEG_FOUND FALSE )
|
|
||||||
SET(FFmpeg_FOUND FALSE )
|
|
||||||
ENDIF()
|
|
||||||
SET(USE_FFMPEG ${FFMPEG_FOUND})
|
SET(USE_FFMPEG ${FFMPEG_FOUND})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
SET_PACKAGE_PROPERTIES(FFmpeg PROPERTIES URL "http://ffmpeg.org/" DESCRIPTION "Libav library support in CalypStream" TYPE OPTIONAL)
|
SET_PACKAGE_PROPERTIES(
|
||||||
|
FFmpeg PROPERTIES
|
||||||
|
URL "http://ffmpeg.org/"
|
||||||
|
DESCRIPTION "Libav library support in CalypStream"
|
||||||
|
TYPE OPTIONAL
|
||||||
|
)
|
||||||
|
|
||||||
IF( WIN32 )
|
IF(WIN32)
|
||||||
SET( USE_STATIC ON )
|
SET(USE_STATIC ON)
|
||||||
INCLUDE( cmake/Win32.cmake )
|
INCLUDE(cmake/Win32.cmake)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
# ####################################################################################################################################################
|
||||||
######################################################################################
|
|
||||||
# CMake Defin1itions
|
# CMake Defin1itions
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
|
|
||||||
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake )
|
SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
|
||||||
INCLUDE(FeatureSummary)
|
INCLUDE(FeatureSummary)
|
||||||
|
|
||||||
# must go before the project command
|
# must go before the project command
|
||||||
SET(CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE)
|
SET(CMAKE_CONFIGURATION_TYPES
|
||||||
|
"Debug;Release"
|
||||||
|
CACHE STRING "Configs" FORCE
|
||||||
|
)
|
||||||
IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
|
IF(DEFINED CMAKE_BUILD_TYPE AND CMAKE_VERSION VERSION_GREATER "2.8")
|
||||||
SET_PROPERTY( CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
|
SET_PROPERTY(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
SET( CMAKE_CXX_FLAGS "" )
|
SET(CMAKE_CXX_FLAGS "")
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR} )
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
# Compiler options
|
# Compiler options
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
|
|
||||||
SET(CMAKE_CXX_STANDARD 14)
|
SET(CMAKE_CXX_STANDARD 20)
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
ADD_DEFINITIONS(-std=gnu++0x)
|
IF(MSVC)
|
||||||
endif()
|
ADD_COMPILE_OPTIONS(/std:c++20)
|
||||||
|
ELSE()
|
||||||
IF (NOT CMAKE_BUILD_TYPE )
|
IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0)
|
||||||
MESSAGE(STATUS "No build type selected, default to Release")
|
ADD_DEFINITIONS(-std=gnu++2a)
|
||||||
SET(CMAKE_BUILD_TYPE "Release")
|
ELSE()
|
||||||
|
ADD_DEFINITIONS(-std=c++20)
|
||||||
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall" )
|
IF(NOT CMAKE_BUILD_TYPE)
|
||||||
|
MESSAGE(STATUS "No build type selected, default to Release")
|
||||||
ADD_DEFINITIONS(-DQT_NO_CAST_TO_ASCII
|
SET(CMAKE_BUILD_TYPE "Release")
|
||||||
#-DQT_NO_CAST_FROM_ASCII
|
|
||||||
-DQT_NO_URL_CAST_FROM_STRING
|
|
||||||
-DQT_NO_CAST_FROM_BYTEARRAY
|
|
||||||
#-DQT_NO_SIGNALS_SLOTS_KEYWORDS
|
|
||||||
#-DQT_USE_QSTRINGBUILDER
|
|
||||||
)
|
|
||||||
|
|
||||||
# if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
|
||||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic")
|
|
||||||
# endif()
|
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0.0")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op" )
|
|
||||||
endif()
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations" )
|
|
||||||
endif()
|
|
||||||
|
|
||||||
IF( USE_WERROR )
|
|
||||||
SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror" )
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET( CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0" )
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -funroll-loops")
|
||||||
SET( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2" )
|
|
||||||
|
|
||||||
|
# if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pedantic") endif()
|
||||||
|
|
||||||
######################################################################################
|
IF(USE_WERROR)
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -O0")
|
||||||
|
IF(BUILD_WITH_SANITIZERS)
|
||||||
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=address -fsanitize=leak -fsanitize=undefined")
|
||||||
|
ENDIF()
|
||||||
|
IF(BUILD_WITH_THREAD_SANITIZER)
|
||||||
|
SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fsanitize=thread")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(USE_IWYU)
|
||||||
|
FIND_PROGRAM(iwyu_path NAMES include-what-you-use iwyu REQUIRED)
|
||||||
|
SET(CXX_INCLUDE_WHAT_YOU_USE ON)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# ####################################################################################################################################################
|
||||||
# Configure targets
|
# Configure targets
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
|
|
||||||
ADD_FEATURE_INFO(CalypApp BUILD_APP "Build Graphical interface")
|
ADD_FEATURE_INFO(CalypApp BUILD_APP "Build Graphical interface")
|
||||||
ADD_FEATURE_INFO(CalypTools BUILD_TOOLS "Build Command line tool" )
|
ADD_FEATURE_INFO(CalypTools BUILD_TOOLS "Build Command line tool")
|
||||||
ADD_FEATURE_INFO(DynLoad USE_DYNLOAD "Support for dynamic module load" )
|
ADD_FEATURE_INFO(DynLoad USE_DYNLOAD "Support for dynamic module load")
|
||||||
ADD_FEATURE_INFO(SSE USE_SSE "SSE instructions support" )
|
ADD_FEATURE_INFO(SSE USE_SSE "SSE instructions support")
|
||||||
ADD_FEATURE_INFO(WErrors USE_WERROR "Warnings as errors" )
|
ADD_FEATURE_INFO(WErrors USE_WERROR "Warnings as errors")
|
||||||
|
|
||||||
ADD_SUBDIRECTORY( lib )
|
ADD_SUBDIRECTORY(lib)
|
||||||
ADD_SUBDIRECTORY( modules )
|
|
||||||
|
|
||||||
IF( ${BUILD_TOOLS} )
|
IF(${BUILD_TOOLS} OR ${BUILD_APP})
|
||||||
ADD_SUBDIRECTORY( tools )
|
ADD_SUBDIRECTORY(modules)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF( ${BUILD_APP} )
|
IF(${BUILD_TOOLS})
|
||||||
ADD_SUBDIRECTORY( app )
|
ADD_SUBDIRECTORY(tools)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF( ${BUILD_EXAMPLES} )
|
IF(${BUILD_APP})
|
||||||
ADD_SUBDIRECTORY( examples )
|
ADD_SUBDIRECTORY(app)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
IF(${BUILD_EXAMPLES})
|
||||||
|
ADD_SUBDIRECTORY(examples)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h )
|
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||||
|
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
# Final information dump
|
# Final information dump
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
MESSAGE("")
|
MESSAGE("")
|
||||||
MESSAGE( STATUS "${PROJECT_NAME} INFORMATION" )
|
MESSAGE(STATUS "${PROJECT_NAME} INFORMATION")
|
||||||
MESSAGE( STATUS "Version: " "${CALYP_VERSION_STRING}" )
|
MESSAGE(STATUS "Version: " "${CALYP_VERSION_STRING}")
|
||||||
MESSAGE( STATUS "Configuration:" )
|
MESSAGE(STATUS "Configuration:")
|
||||||
MESSAGE( STATUS " Static libs: " "${USE_STATIC}" )
|
MESSAGE(STATUS " Static libs: " "${USE_STATIC}")
|
||||||
MESSAGE( STATUS " Build type: " "${CMAKE_BUILD_TYPE}" )
|
MESSAGE(STATUS " Build type: " "${CMAKE_BUILD_TYPE}")
|
||||||
MESSAGE( STATUS " Build flags: " "${CMAKE_CXX_FLAGS}" )
|
MESSAGE(STATUS " Build flags: " "${CMAKE_CXX_FLAGS}")
|
||||||
|
|
||||||
FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
FEATURE_SUMMARY(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES)
|
||||||
+12
-36
@@ -27,19 +27,21 @@ Modules
|
|||||||
|
|
||||||
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
|
||||||
- Frame difference, crop, shift, binarization
|
- Frame difference, crop, shift, binarization and rotation
|
||||||
- Sub-sampling operations
|
- Sub-sampling operations
|
||||||
- Measuring modules
|
- Measuring modules
|
||||||
- Modules based on opencv:
|
- Modules based on opencv:
|
||||||
* Disparity estimation
|
- Disparity estimation
|
||||||
* Motion estimation
|
- Motion estimation
|
||||||
|
|
||||||
Supported Formats
|
Supported Formats
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
@@ -62,35 +64,9 @@ Supported Formats
|
|||||||
Developers
|
Developers
|
||||||
----------------------------------------------------------------
|
----------------------------------------------------------------
|
||||||
|
|
||||||
- Joao Carreira (jfmcarreira@gmail.com)
|
- [**Joao Carreira**](https://github.com/jfmcarreira) (Founder, Main Developer)
|
||||||
- Luis Lucas (luisfrlucas@gmail.com)
|
- [**Luis Lucas** ](https://github.com/lfrlucas) (Founder, Developer)
|
||||||
|
- [**Joao Santos** ](https://github.com/jpataias) (Contributor)
|
||||||
Builds
|
- [**JNSFilipe** ](https://github.com/JNSFilipe) (Contributor)
|
||||||
----------------------------------------------------------------
|
|
||||||
Download update build for windows and linux from our <a href="https://sourceforge.net/projects/playuver/">SourceForge project page</a>
|
|
||||||
|
|
||||||
|
|
||||||
Build/Install using cmake
|
|
||||||
----------------------------------------------------------------
|
|
||||||
|
|
||||||
1. The following are required for compilation:
|
|
||||||
- an ordinary C++ development environment (g++, make, C++ libraries and headers, ...)
|
|
||||||
- cmake
|
|
||||||
- a Qt development environment (libraries, headers, qmake, ...): only QtCore, QtGui and QtWidgets are required, at least in version 4
|
|
||||||
|
|
||||||
2. Optional Dependencies:
|
|
||||||
- QtDBus
|
|
||||||
- OpenCv
|
|
||||||
- FFmpeg
|
|
||||||
|
|
||||||
3. Run the following commands: (this will create an executable named calyp)
|
|
||||||
```
|
|
||||||
mkdir build
|
|
||||||
cd build
|
|
||||||
cmake -DUSE_QT4=OFF -DUSE_FFMPEG=ON -DUSE_OPENCV=ON .. (for FFmpeg and OpenCV support)
|
|
||||||
make
|
|
||||||
make install
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@@ -3,9 +3,11 @@
|
|||||||
|
|
||||||
## Build Status
|
## Build Status
|
||||||
|
|
||||||
Master branch | Development branch
|
| Master | Development |
|
||||||
------------ | -------------
|
|--|--|
|
||||||
[](https://travis-ci.org/pixlra/calyp.svg?branch=master) [](https://ci.appveyor.com/project/jfmcarreira/calyp/branch/master) | Comming soon!
|
|  |  |
|
||||||
|
|
||||||
|
[](https://ci.appveyor.com/project/jfmcarreira/calyp/branch/master)
|
||||||
|
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
@@ -20,7 +22,7 @@ Master branch | Development branch
|
|||||||
- Constant growing libs for stream and frame processing (CalypStream and CalypFrame)
|
- Constant growing libs for stream and frame processing (CalypStream and CalypFrame)
|
||||||
- Advanced API for frame/video processing algorithms
|
- Advanced API for frame/video processing algorithms
|
||||||
- Frame level quality measurement API based on the CalypFrame class
|
- Frame level quality measurement API based on the CalypFrame class
|
||||||
- Powefull command-line tool for quality and frame processing algorithms (uses the referred APIs)
|
- Powerful command-line tool for quality and frame processing algorithms (uses the referred APIs)
|
||||||
|
|
||||||
## Modules
|
## Modules
|
||||||
- CalypLib: Low level library
|
- CalypLib: Low level library
|
||||||
@@ -30,7 +32,7 @@ Master branch | Development branch
|
|||||||
|
|
||||||
## Supported Quality Metrics
|
## Supported Quality Metrics
|
||||||
- Peak Signal-to-Noise Ratio (PSNR)
|
- Peak Signal-to-Noise Ratio (PSNR)
|
||||||
- Structural SIMilarity (SSIM)
|
- Structural SIMilarity (SSIM)
|
||||||
- Mean Square Error (MSE)
|
- Mean Square Error (MSE)
|
||||||
- Weighted Spherical PSNR (WS-PSNR)
|
- Weighted Spherical PSNR (WS-PSNR)
|
||||||
|
|
||||||
@@ -73,13 +75,13 @@ Master branch | Development branch
|
|||||||
* **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. a Qt development environment: QtCore, QtGui, QtWidgets, QtPrintSupport and QtConcurrent (version 4 or higher)
|
3. a Qt development environment: QtCore, QtGui, QtWidgets, QtPrintSupport and QtConcurrent (version 5 or higher)
|
||||||
4. Optional: QtDBus, OpenCV, FFmpeg
|
4. Optional: QtDBus, OpenCV, FFmpeg
|
||||||
* **List of required commands**
|
* **List of required commands**
|
||||||
```
|
```
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -DUSE_QT4=OFF -DUSE_FFMPEG=ON -DUSE_OPENCV=ON .. (for FFmpeg and OpenCV support)
|
cmake -DUSE_FFMPEG=ON -DUSE_OPENCV=ON .. (for FFmpeg and OpenCV support)
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
```
|
```
|
||||||
+115
-83
@@ -1,148 +1,180 @@
|
|||||||
###
|
#
|
||||||
### CMakeLists for calyp app component
|
# CMakeLists for calyp app component
|
||||||
###
|
#
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}
|
INCLUDE_DIRECTORIES(
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/external
|
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/external ${CMAKE_CURRENT_SOURCE_DIR}/dialog
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/dialog
|
${CMAKE_CURRENT_SOURCE_DIR}/docks ${CMAKE_CURRENT_SOURCE_DIR}/widgets
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/docks
|
)
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/widgets )
|
|
||||||
|
|
||||||
OPTION( USE_QTDBUS "Build with QtDBus" ON )
|
OPTION(USE_QTDBUS "Build with QtDBus" ON)
|
||||||
OPTION( USE_FERVOR "Add Fervor support" OFF )
|
OPTION(USE_FERVOR "Add Fervor support" OFF)
|
||||||
|
OPTION(CALYP_MANAGED_RESOURCES "Handle streams in separate threads" ON)
|
||||||
|
OPTION(CALYP_THREADED_MODULES "Use threads for modules" ON)
|
||||||
|
|
||||||
ADD_SUBDIRECTORY( external )
|
ADD_SUBDIRECTORY(external)
|
||||||
|
|
||||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent )
|
FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Gui Widgets Concurrent)
|
||||||
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent )
|
LIST(APPEND QT_LINKER_LIBS Qt5::Core Qt5::Gui Qt5::Widgets Qt5::Concurrent)
|
||||||
LIST(APPEND QT_MODULES Core Gui Widgets Concurrent )
|
LIST(APPEND QT_MODULES Core Gui Widgets Concurrent)
|
||||||
|
|
||||||
IF( USE_QTDBUS )
|
IF(USE_QTDBUS)
|
||||||
FIND_PACKAGE( Qt5DBus )
|
FIND_PACKAGE(Qt5DBus)
|
||||||
SET_PACKAGE_PROPERTIES(Qt5DBus PROPERTIES DESCRIPTION "Support for Qt5 DBus messages between instances" TYPE OPTIONAL )
|
SET_PACKAGE_PROPERTIES(
|
||||||
IF( ${Qt5DBus_FOUND} )
|
Qt5DBus PROPERTIES
|
||||||
SET( USE_QTDBUS ${Qt5DBus_FOUND} ) # TODO: fix this stupid variable
|
DESCRIPTION "Support for Qt5 DBus messages between instances"
|
||||||
SET( USE_QTDBUS ${Qt5DBus_FOUND} PARENT_SCOPE)
|
TYPE OPTIONAL
|
||||||
LIST(APPEND QT_LINKER_LIBS Qt5::DBus )
|
)
|
||||||
LIST(APPEND QT_MODULES DBus )
|
IF(${Qt5DBus_FOUND})
|
||||||
|
SET(USE_QTDBUS ${Qt5DBus_FOUND}) # TODO: fix this stupid variable
|
||||||
|
SET(USE_QTDBUS
|
||||||
|
${Qt5DBus_FOUND}
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
|
LIST(APPEND QT_LINKER_LIBS Qt5::DBus)
|
||||||
|
LIST(APPEND QT_MODULES DBus)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
set(Calyp_App_SRCS
|
ADD_DEFINITIONS(
|
||||||
# Main
|
-DQT_NO_CAST_TO_ASCII
|
||||||
|
# -DQT_NO_CAST_FROM_ASCII
|
||||||
|
-DQT_NO_URL_CAST_FROM_STRING
|
||||||
|
-DQT_NO_CAST_FROM_BYTEARRAY
|
||||||
|
# -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_USE_QSTRINGBUILDER
|
||||||
|
)
|
||||||
|
|
||||||
|
SET(Calyp_App_SRCS
|
||||||
|
# Main
|
||||||
main.cpp
|
main.cpp
|
||||||
MainWindow.cpp
|
MainWindow.cpp
|
||||||
# Module SubWindow
|
# Module SubWindow
|
||||||
SubWindowHandle.cpp
|
SubWindowHandle.cpp
|
||||||
MdiSubWindow.cpp
|
MdiSubWindow.cpp
|
||||||
SubWindowAbstract.cpp
|
SubWindowAbstract.cpp
|
||||||
# Module Video
|
# Module Video
|
||||||
|
ResourceHandle.cpp
|
||||||
VideoHandle.cpp
|
VideoHandle.cpp
|
||||||
VideoSubWindow.cpp
|
VideoSubWindow.cpp
|
||||||
|
VideoStreamSubWindow.cpp
|
||||||
|
ModuleSubWindow.cpp
|
||||||
ViewArea.cpp
|
ViewArea.cpp
|
||||||
GridManager.cpp
|
GridManager.cpp
|
||||||
# Module Quality
|
# Module Quality
|
||||||
QualityHandle.cpp
|
QualityHandle.cpp
|
||||||
PlotSubWindow.cpp
|
PlotSubWindow.cpp
|
||||||
external/qcustomplot/qcustomplot.cpp
|
# Module Plugins
|
||||||
# Module Plugins
|
|
||||||
ModulesHandle.cpp
|
ModulesHandle.cpp
|
||||||
CalypAppModuleIf.cpp
|
CalypAppModuleIf.cpp
|
||||||
# Dialogs
|
# Dialogs
|
||||||
dialog/AboutDialog.cpp
|
dialog/AboutDialog.cpp
|
||||||
dialog/ConfigureFormatDialog.cpp
|
dialog/ConfigureFormatDialog.cpp
|
||||||
dialog/SubWindowSelectorDialog.cpp
|
dialog/SubWindowSelectorDialog.cpp
|
||||||
dialog/ProgressBar.cpp
|
dialog/ProgressBar.cpp
|
||||||
dialog/SeekStreamDialog.cpp
|
dialog/SeekStreamDialog.cpp
|
||||||
dialog/ModulesHandleOptDialog.cpp
|
dialog/ModulesHandleOptDialog.cpp
|
||||||
# Widgets
|
# Widgets
|
||||||
widgets/HistogramWidget.cpp
|
widgets/HistogramWidget.cpp
|
||||||
widgets/FrameNumberWidget.cpp
|
widgets/FrameNumberWidget.cpp
|
||||||
# Docks
|
# Docks
|
||||||
docks/FramePropertiesDock.cpp
|
docks/FramePropertiesDock.cpp
|
||||||
docks/ModuleHandleDock.cpp
|
docks/ModuleHandleDock.cpp
|
||||||
docks/QualityMeasurementSidebar.cpp
|
docks/QualityMeasurementSidebar.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
IF( USE_QTDBUS )
|
IF(USE_QTDBUS)
|
||||||
LIST( APPEND Calyp_App_SRCS DBusAppAdaptor.cpp )
|
LIST(APPEND Calyp_App_SRCS DBusAppAdaptor.cpp)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
SET(Calyp_App_UI "")
|
||||||
|
|
||||||
set(Calyp_App_UI "" )
|
SET(Calyp_App_RCC resources/${PROJECT_NAME}.qrc)
|
||||||
|
|
||||||
set(Calyp_App_RCC
|
IF(USE_FERVOR)
|
||||||
resources/${PROJECT_NAME}.qrc
|
|
||||||
)
|
|
||||||
|
|
||||||
|
SET(FERVOR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/fervor)
|
||||||
|
|
||||||
IF( USE_FERVOR )
|
IF(EXISTS ${FERVOR_DIR})
|
||||||
|
|
||||||
SET( FERVOR_DIR ${CMAKE_CURRENT_SOURCE_DIR}/external/fervor )
|
SET(FERVOR_APP_NAME ${PROJECT_NAME})
|
||||||
|
SET(FERVOR_APP_VERSION ${CALYP_VERSION_STRING})
|
||||||
|
|
||||||
IF(EXISTS ${FERVOR_DIR} )
|
ADD_SUBDIRECTORY(${FERVOR_DIR})
|
||||||
|
|
||||||
SET( FERVOR_APP_NAME ${PROJECT_NAME} )
|
INCLUDE_DIRECTORIES(${FERVOR_DIR})
|
||||||
SET( FERVOR_APP_VERSION ${CALYP_VERSION_STRING} )
|
|
||||||
|
|
||||||
ADD_SUBDIRECTORY( ${FERVOR_DIR} )
|
LIST(APPEND APP_LINKER_LIBS Fervor)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES( ${FERVOR_DIR} )
|
FIND_PACKAGE(Qt5 REQUIRED Network WebKit WebKitWidgets)
|
||||||
|
|
||||||
LIST(APPEND APP_LINKER_LIBS Fervor )
|
LIST(APPEND QT_LINKER_LIBS Qt5::Network Qt5::WebKit Qt5::WebKitWidgets)
|
||||||
|
LIST(APPEND QT_MODULES Network WebKit WebKitWidgets)
|
||||||
|
|
||||||
FIND_PACKAGE( Qt5 REQUIRED Network WebKit WebKitWidgets )
|
# LIST(APPEND APP_LINKER_LIBS ${FERVOR_DEPENDENCIES} )
|
||||||
|
INCLUDE_DIRECTORIES(${FERVOR_INCLUDE_DIRS})
|
||||||
LIST(APPEND QT_LINKER_LIBS Qt5::Network Qt5::WebKit Qt5::WebKitWidgets )
|
|
||||||
LIST(APPEND QT_MODULES Network WebKit WebKitWidgets )
|
|
||||||
|
|
||||||
# LIST(APPEND APP_LINKER_LIBS ${FERVOR_DEPENDENCIES} )
|
|
||||||
INCLUDE_DIRECTORIES( ${FERVOR_INCLUDE_DIRS} )
|
|
||||||
|
|
||||||
SET(QT_USE_QTNETWORK true)
|
SET(QT_USE_QTNETWORK true)
|
||||||
SET(QT_USE_QTWEBKIT true)
|
SET(QT_USE_QTWEBKIT true)
|
||||||
|
|
||||||
ELSE()
|
ELSE()
|
||||||
MESSAGE( "Fervor lib source code is not find in ${FERVOR_DIR}... Disabling it!" )
|
MESSAGE("Fervor lib source code is not find in ${FERVOR_DIR}... Disabling it!")
|
||||||
SET( USE_FERVOR False )
|
SET(USE_FERVOR False)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET_PACKAGE_PROPERTIES(Fervor PROPERTIES URL "https://github.com/pypt/fervor" DESCRIPTION "Fervor lib includes check for updates feature" TYPE OPTIONAL )
|
SET_PACKAGE_PROPERTIES(
|
||||||
|
Fervor PROPERTIES
|
||||||
|
URL "https://github.com/pypt/fervor"
|
||||||
|
DESCRIPTION "Fervor lib includes check for updates feature"
|
||||||
|
TYPE OPTIONAL
|
||||||
|
)
|
||||||
ADD_FEATURE_INFO(Fervor USE_FERVOR "Fervor lib includes check for updates feature.")
|
ADD_FEATURE_INFO(Fervor USE_FERVOR "Fervor lib includes check for updates feature.")
|
||||||
|
|
||||||
QT5_WRAP_UI( Calyp_App_UI_Wrap ${Calyp_App_UI} )
|
QT5_WRAP_UI(Calyp_App_UI_Wrap ${Calyp_App_UI})
|
||||||
QT5_ADD_RESOURCES( Calyp_App_RCC ${Calyp_App_RCC} )
|
QT5_ADD_RESOURCES(Calyp_App_RCC ${Calyp_App_RCC})
|
||||||
|
|
||||||
# Instruct CMake to run moc automatically when needed.
|
# Instruct CMake to run moc automatically when needed.
|
||||||
SET( CMAKE_AUTOMOC ON )
|
SET(CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
# Windows application icon
|
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
IF( WIN32 )
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-enum-enum-conversion")
|
||||||
set(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj)
|
|
||||||
IF( MSVC )
|
|
||||||
add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
|
|
||||||
COMMAND rc.exe /fo ${WINDOWS_RES_FILE} ${PROJECT_NAME}.rc
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources
|
|
||||||
)
|
|
||||||
ELSE()
|
|
||||||
add_custom_command(OUTPUT ${WINDOWS_RES_FILE}
|
|
||||||
COMMAND windres.exe ${PROJECT_NAME}.rc ${WINDOWS_RES_FILE}
|
|
||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources
|
|
||||||
)
|
|
||||||
ENDIF()
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
# Windows application icon
|
||||||
ADD_EXECUTABLE( ${PROJECT_NAME} ${Calyp_App_SRCS} ${HEADERS_MOC_FILES} ${Calyp_App_UI_Wrap} ${Calyp_App_RCC} ${WINDOWS_RES_FILE} )
|
IF(WIN32)
|
||||||
TARGET_LINK_LIBRARIES( ${PROJECT_NAME} ${PROJECT_LIBRARY} CalypModules ${APP_LINKER_LIBS} ${QT_LINKER_LIBS} QCustomPlotLib )
|
SET(WINDOWS_RES_FILE ${CMAKE_CURRENT_BINARY_DIR}/resources.obj)
|
||||||
|
IF(MSVC)
|
||||||
|
ADD_CUSTOM_COMMAND(
|
||||||
|
OUTPUT ${WINDOWS_RES_FILE}
|
||||||
|
COMMAND rc.exe /fo ${WINDOWS_RES_FILE} ${PROJECT_NAME}.rc
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources
|
||||||
|
COMMENT "Add icon on windows platform"
|
||||||
|
)
|
||||||
|
ELSE()
|
||||||
|
ADD_CUSTOM_COMMAND(
|
||||||
|
OUTPUT ${WINDOWS_RES_FILE}
|
||||||
|
COMMAND windres.exe ${PROJECT_NAME}.rc ${WINDOWS_RES_FILE}
|
||||||
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/resources
|
||||||
|
COMMENT "Add icon on windows platform"
|
||||||
|
)
|
||||||
|
ENDIF()
|
||||||
|
ADD_EXECUTABLE(${PROJECT_NAME} ${Calyp_App_SRCS} ${HEADERS_MOC_FILES} ${Calyp_App_UI_Wrap} ${Calyp_App_RCC} ${WINDOWS_RES_FILE})
|
||||||
|
ELSEIF(CMAKE_HOST_APPLE)
|
||||||
|
SET(CMAKE_MACOSX_BUNDLE ON)
|
||||||
|
SET(MACOSX_BUNDLE_EXECUTABLE_NAME ${PROJECT_NAME})
|
||||||
|
SET(MACOSX_BUNDLE_ICON_FILE Contents/Resources/calyp.icns)
|
||||||
|
SET(MACOSX_BUNDLE_BUNDLE_NAME Calyp)
|
||||||
|
SET(APP_ICON_MACOSX ${CMAKE_CURRENT_SOURCE_DIR}/resources/calyp.icns)
|
||||||
|
SET_SOURCE_FILES_PROPERTIES(${APP_ICON_MACOSX} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
|
||||||
|
ADD_EXECUTABLE(${PROJECT_NAME} MACOSX_BUNDLE ${Calyp_App_SRCS} ${HEADERS_MOC_FILES} ${Calyp_App_UI_Wrap} ${Calyp_App_RCC} ${APP_ICON_MACOSX})
|
||||||
|
ELSE()
|
||||||
|
ADD_EXECUTABLE(${PROJECT_NAME} ${Calyp_App_SRCS} ${HEADERS_MOC_FILES} ${Calyp_App_UI_Wrap} ${Calyp_App_RCC})
|
||||||
|
ENDIF()
|
||||||
|
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${PROJECT_LIBRARY} CalypModules ${APP_LINKER_LIBS} ${QT_LINKER_LIBS} QCustomPlotLib)
|
||||||
|
|
||||||
# QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} )
|
# QT5_USE_MODULES( ${PROJECT_NAME} ${QT_MODULES} )
|
||||||
|
|
||||||
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin )
|
INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
|
||||||
INSTALL(FILES resources/calyp.desktop DESTINATION share/applications )
|
INSTALL(FILES resources/calyp.desktop DESTINATION share/applications)
|
||||||
INSTALL(FILES resources/calyp.png DESTINATION share/pixmaps )
|
INSTALL(FILES resources/calyp.png DESTINATION share/pixmaps)
|
||||||
INSTALL(FILES resources/calyp.xml DESTINATION share/mime/packages )
|
INSTALL(FILES resources/calyp.xml DESTINATION share/mime/packages)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
+133
-102
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,42 +24,79 @@
|
|||||||
|
|
||||||
#include "CalypAppModuleIf.h"
|
#include "CalypAppModuleIf.h"
|
||||||
|
|
||||||
#include "VideoSubWindow.h"
|
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDockWidget>
|
#include <QDockWidget>
|
||||||
|
|
||||||
CalypAppModuleIf::CalypAppModuleIf( QObject* parent, QAction* action, CalypModuleIf* module )
|
#include "ModuleHandleDock.h"
|
||||||
: m_bIsRunning( false )
|
#include "ModuleSubWindow.h"
|
||||||
, m_pcModuleAction( action )
|
#include "VideoSubWindow.h"
|
||||||
, m_pcModule( module )
|
#include "lib/CalypFrame.h"
|
||||||
, m_pcDisplaySubWindow( NULL )
|
#include "lib/CalypStream.h"
|
||||||
, m_pcDockWidget( NULL )
|
|
||||||
, m_pcModuleDock( NULL )
|
CalypAppModuleIf::CalypAppModuleIf( QObject* parent, QAction* action, CalypModulePtr&& module )
|
||||||
, m_pcModuleStream( NULL )
|
: m_pcModuleAction( action ), m_pcModule( std ::move( module ) )
|
||||||
, m_pcProcessedFrame( NULL )
|
|
||||||
, m_dMeasurementResult( 0 )
|
|
||||||
{
|
{
|
||||||
setParent( parent );
|
setParent( parent );
|
||||||
for( int i = 0; i < CLP_MODULE_MAX_NUM_FRAMES; i++ )
|
#ifdef CALYP_THREADED_MODULES
|
||||||
|
setObjectName( m_pcModule->m_pchModuleName );
|
||||||
|
#endif
|
||||||
|
m_frameList.reserve( m_pcModule->m_uiNumberOfFrames );
|
||||||
|
m_frameListPtr.reserve( m_pcModule->m_uiNumberOfFrames );
|
||||||
|
m_pcSubWindow.resize( m_pcModule->m_uiNumberOfFrames, nullptr );
|
||||||
|
}
|
||||||
|
|
||||||
|
CalypAppModuleIf::~CalypAppModuleIf()
|
||||||
|
{
|
||||||
|
#ifdef CALYP_THREADED_MODULES
|
||||||
|
wait();
|
||||||
|
#endif
|
||||||
|
if( m_pcModuleDock )
|
||||||
{
|
{
|
||||||
m_pcSubWindow[i] = NULL;
|
auto* ptr = m_pcModuleDock;
|
||||||
|
m_pcModuleDock = NULL;
|
||||||
|
ptr->close();
|
||||||
|
delete ptr;
|
||||||
|
}
|
||||||
|
if( m_pcDisplaySubWindow )
|
||||||
|
{
|
||||||
|
auto* ptr = m_pcDisplaySubWindow;
|
||||||
|
m_pcDisplaySubWindow = NULL;
|
||||||
|
ptr->closeSubWindow();
|
||||||
|
delete ptr;
|
||||||
|
}
|
||||||
|
if( m_pcDockWidget )
|
||||||
|
{
|
||||||
|
m_pcDockWidget->close();
|
||||||
|
delete m_pcDockWidget;
|
||||||
|
}
|
||||||
|
if( m_pcModule )
|
||||||
|
{
|
||||||
|
m_pcModule->destroy();
|
||||||
|
m_pcModule = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypAppModuleIf::update()
|
void CalypAppModuleIf::update( bool isPlaying )
|
||||||
{
|
{
|
||||||
if( m_pcDisplaySubWindow )
|
if( m_pcDisplaySubWindow )
|
||||||
{
|
{
|
||||||
m_pcDisplaySubWindow->refreshFrame();
|
m_pcDisplaySubWindow->refreshSubWindow();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
apply();
|
apply( isPlaying );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// void CalypAppModuleIf::setPlaying( bool isPlaying )
|
||||||
|
// {
|
||||||
|
// if( m_pcDisplaySubWindow )
|
||||||
|
// {
|
||||||
|
// m_pcDisplaySubWindow->setPlaying( isPlaying );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
bool CalypAppModuleIf::isRunning()
|
bool CalypAppModuleIf::isRunning()
|
||||||
{
|
{
|
||||||
#ifdef CALYP_THREADED_MODULES
|
#ifdef CALYP_THREADED_MODULES
|
||||||
@@ -69,11 +106,19 @@ bool CalypAppModuleIf::isRunning()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalypAppModuleIf::run()
|
||||||
|
{
|
||||||
|
bool result = process();
|
||||||
|
if( result )
|
||||||
|
{
|
||||||
|
EventData* eventData = new EventData( m_bSuccess, this );
|
||||||
|
QCoreApplication::postEvent( parent(), eventData );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool moduleExecuted = false;
|
||||||
|
|
||||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
|
||||||
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||||
{
|
{
|
||||||
if( m_pcDisplaySubWindow )
|
if( m_pcDisplaySubWindow )
|
||||||
@@ -87,6 +132,17 @@ bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
|||||||
}
|
}
|
||||||
if( !( isPlaying && ( m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY ) ) )
|
if( !( isPlaying && ( m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_SKIP_WHILE_PLAY ) ) )
|
||||||
{
|
{
|
||||||
|
m_frameList.clear();
|
||||||
|
for( unsigned int i = 0; i < m_pcModule->m_uiNumberOfFrames; i++ )
|
||||||
|
{
|
||||||
|
m_frameList.push_back( m_pcSubWindow[i]->getCurrFrameAsset() );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip module is is already running
|
||||||
|
if( isRunning() )
|
||||||
|
return moduleExecuted;
|
||||||
|
|
||||||
|
moduleExecuted = true;
|
||||||
#ifdef CALYP_THREADED_MODULES
|
#ifdef CALYP_THREADED_MODULES
|
||||||
if( !disableThreads )
|
if( !disableThreads )
|
||||||
{
|
{
|
||||||
@@ -96,49 +152,51 @@ bool CalypAppModuleIf::apply( bool isPlaying, bool disableThreads )
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
run();
|
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||||
|
process();
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
show();
|
show();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_pcDisplaySubWindow || m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
|
|
||||||
{
|
|
||||||
bRet = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
return moduleExecuted;
|
||||||
{
|
|
||||||
bRet = true;
|
|
||||||
}
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
return bRet;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypAppModuleIf::run()
|
bool CalypAppModuleIf::process()
|
||||||
{
|
{
|
||||||
m_bIsRunning = true;
|
|
||||||
m_bSuccess = false;
|
m_bSuccess = false;
|
||||||
std::vector<CalypFrame*> apcFrameList;
|
|
||||||
for( unsigned int i = 0; i < m_pcModule->m_uiNumberOfFrames; i++ )
|
if( m_frameList.empty() )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
#ifdef CALYP_THREADED_MODULES
|
||||||
|
QMutexLocker locker( &m_Mutex );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
m_frameListPtr.clear();
|
||||||
|
for( auto& frame : m_frameList )
|
||||||
{
|
{
|
||||||
apcFrameList.push_back( m_pcSubWindow[i]->getCurrFrame() );
|
m_frameListPtr.push_back( frame.get() );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
if( m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||||
{
|
{
|
||||||
|
CalypFrame* framePtr{ nullptr };
|
||||||
if( m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
|
if( m_pcModule->m_iModuleAPI >= CLP_MODULE_API_2 )
|
||||||
{
|
{
|
||||||
m_pcProcessedFrame = m_pcModule->process( apcFrameList );
|
framePtr = m_pcModule->process( m_frameListPtr );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pcProcessedFrame = m_pcModule->process( m_pcSubWindow[0]->getCurrFrame() );
|
framePtr = m_pcModule->process( m_pcSubWindow[0]->getCurrFrame() );
|
||||||
}
|
}
|
||||||
|
assert( framePtr != nullptr );
|
||||||
|
m_pcProcessedFrame = std::shared_ptr<CalypFrame>{ framePtr, []( CalypFrame* ptr ) {} };
|
||||||
}
|
}
|
||||||
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( m_frameListPtr );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -147,84 +205,57 @@ void CalypAppModuleIf::run()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
m_bSuccess = true;
|
m_bSuccess = true;
|
||||||
m_bIsRunning = false;
|
return true;
|
||||||
#ifdef CALYP_THREADED_MODULES
|
|
||||||
EventData* eventData = new EventData( m_bSuccess, this );
|
|
||||||
if( parent() )
|
|
||||||
QCoreApplication::postEvent( parent(), eventData );
|
|
||||||
#endif
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypAppModuleIf::show()
|
void CalypAppModuleIf::show()
|
||||||
{
|
{
|
||||||
|
if( m_canceling )
|
||||||
|
return;
|
||||||
switch( m_pcModule->m_iModuleType )
|
switch( m_pcModule->m_iModuleType )
|
||||||
{
|
{
|
||||||
case CLP_FRAME_PROCESSING_MODULE:
|
case CLP_FRAME_PROCESSING_MODULE: {
|
||||||
if( m_pcDisplaySubWindow )
|
auto displayWindow = qobject_cast<VideoSubWindow*>( m_pcDisplaySubWindow );
|
||||||
|
if( displayWindow == nullptr )
|
||||||
|
displayWindow = m_pcSubWindow[0];
|
||||||
|
#ifdef CALYP_THREADED_MODULES
|
||||||
|
if( m_Mutex.try_lock() )
|
||||||
{
|
{
|
||||||
m_pcDisplaySubWindow->setCurrFrame( m_pcProcessedFrame );
|
displayWindow->setFillWindow( false );
|
||||||
m_pcDisplaySubWindow->setFillWindow( false );
|
displayWindow->setCurrFrame( m_pcProcessedFrame );
|
||||||
m_pcDisplaySubWindow->clearWindowBusy();
|
m_Mutex.unlock();
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_pcSubWindow[0]->setCurrFrame( m_pcProcessedFrame );
|
|
||||||
m_pcSubWindow[0]->setFillWindow( false );
|
|
||||||
m_pcSubWindow[0]->clearWindowBusy();
|
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
displayWindow->setFillWindow( false );
|
||||||
|
displayWindow->setCurrFrame( m_pcProcessedFrame );
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case CLP_FRAME_MEASUREMENT_MODULE:
|
case CLP_FRAME_MEASUREMENT_MODULE:
|
||||||
m_pcModuleDock->setModulueReturnValue( m_dMeasurementResult );
|
m_pcModuleDock->setModuleReturnValue( m_dMeasurementResult );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypAppModuleIf::destroy()
|
void CalypAppModuleIf::disable()
|
||||||
{
|
{
|
||||||
if( m_bIsRunning )
|
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||||
|
#ifdef CALYP_THREADED_MODULES
|
||||||
|
m_canceling = true;
|
||||||
|
m_Mutex.lock();
|
||||||
|
m_Mutex.unlock();
|
||||||
|
#endif
|
||||||
|
m_frameList.clear();
|
||||||
|
m_frameListPtr.clear();
|
||||||
|
while( m_pcSubWindow.size() > 0 )
|
||||||
{
|
{
|
||||||
QApplication::setOverrideCursor( Qt::WaitCursor );
|
auto window = m_pcSubWindow.back();
|
||||||
while( m_bIsRunning )
|
m_pcSubWindow.erase( m_pcSubWindow.end() - 1 );
|
||||||
{
|
if( window != nullptr )
|
||||||
}
|
window->disableModule( this );
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
}
|
|
||||||
if( m_pcModuleDock )
|
|
||||||
{
|
|
||||||
m_pcModuleDock->close();
|
|
||||||
m_pcModuleDock = NULL;
|
|
||||||
}
|
|
||||||
if( m_pcDockWidget )
|
|
||||||
{
|
|
||||||
m_pcDockWidget->close();
|
|
||||||
m_pcDockWidget = NULL;
|
|
||||||
}
|
|
||||||
if( m_pcDisplaySubWindow )
|
|
||||||
m_pcDisplaySubWindow->closeSubWindow();
|
|
||||||
m_pcDisplaySubWindow = NULL;
|
|
||||||
|
|
||||||
for( int i = 0; i < CLP_MODULE_MAX_NUM_FRAMES; i++ )
|
|
||||||
{
|
|
||||||
if( m_pcSubWindow[i] )
|
|
||||||
{
|
|
||||||
m_pcSubWindow[i]->disableModule( this );
|
|
||||||
m_pcSubWindow[i] = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( m_pcModuleStream )
|
|
||||||
{
|
|
||||||
m_pcModuleStream->close();
|
|
||||||
delete m_pcModuleStream;
|
|
||||||
m_pcModuleStream = NULL;
|
|
||||||
}
|
|
||||||
if( m_pcModule )
|
|
||||||
{
|
|
||||||
m_pcModule->destroy();
|
|
||||||
m_pcModule->Delete();
|
|
||||||
m_pcModule = NULL;
|
|
||||||
}
|
}
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
}
|
}
|
||||||
+60
-47
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,90 +25,103 @@
|
|||||||
#ifndef __CALYPAPPMODULESIF_H__
|
#ifndef __CALYPAPPMODULESIF_H__
|
||||||
#define __CALYPAPPMODULESIF_H__
|
#define __CALYPAPPMODULESIF_H__
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
|
||||||
#include "ModuleHandleDock.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "lib/CalypFrame.h"
|
|
||||||
#include "lib/CalypModuleIf.h"
|
|
||||||
#include "lib/CalypStream.h"
|
|
||||||
|
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
#include <QPointer>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#ifdef CALYP_THREADED_MODULES
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QThread>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "CommonDefs.h"
|
||||||
|
#include "ModuleHandleDock.h"
|
||||||
|
// #include "lib/CalypFrame.h"
|
||||||
|
#include "lib/CalypModuleIf.h"
|
||||||
|
// #include "lib/CalypStream.h"
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
|
class CalypStream;
|
||||||
|
class CalypFrame;
|
||||||
|
|
||||||
#define CLP_MODULE_MAX_NUM_FRAMES 5
|
#define CLP_MODULE_MAX_NUM_FRAMES 5
|
||||||
|
|
||||||
class VideoSubWindow;
|
class VideoSubWindow;
|
||||||
|
class ModuleSubWindow;
|
||||||
|
|
||||||
class CalypAppModuleIf
|
class CalypAppModuleIf : std::enable_shared_from_this<CalypAppModuleIf>,
|
||||||
#ifdef CALYP_THREADED_MODULES
|
#ifdef CALYP_THREADED_MODULES
|
||||||
: public QThread
|
public QThread
|
||||||
#else
|
#else
|
||||||
: public QObject
|
public QObject
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
{
|
{
|
||||||
friend class ModulesHandle;
|
friend class ModulesHandle;
|
||||||
friend class ModuleHandleDock;
|
friend class ModuleHandleDock;
|
||||||
friend class ModulesHandleOptDialog;
|
friend class ModulesHandleOptDialog;
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_bIsRunning;
|
|
||||||
bool m_bSuccess;
|
|
||||||
|
|
||||||
QAction* m_pcModuleAction;
|
|
||||||
CalypModuleIf* m_pcModule;
|
|
||||||
|
|
||||||
VideoSubWindow* m_pcSubWindow[CLP_MODULE_MAX_NUM_FRAMES];
|
|
||||||
|
|
||||||
VideoSubWindow* m_pcDisplaySubWindow;
|
|
||||||
|
|
||||||
QDockWidget* m_pcDockWidget;
|
|
||||||
ModuleHandleDock* m_pcModuleDock;
|
|
||||||
|
|
||||||
CalypStream* m_pcModuleStream;
|
|
||||||
CalypFrame* m_pcProcessedFrame;
|
|
||||||
double m_dMeasurementResult;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class EventData : public QEvent
|
class EventData : public QEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EventData( bool success, CalypAppModuleIf* module )
|
EventData( bool success, CalypAppModuleIf* module )
|
||||||
: QEvent( QEvent::User )
|
: QEvent( QEvent::User ), m_bSuccess{ success }, m_pcModule{ module }
|
||||||
{
|
{
|
||||||
m_bSuccess = success;
|
|
||||||
m_pcModule = module;
|
|
||||||
}
|
}
|
||||||
bool m_bSuccess;
|
bool m_bSuccess;
|
||||||
CalypAppModuleIf* m_pcModule;
|
QPointer<CalypAppModuleIf> m_pcModule;
|
||||||
};
|
};
|
||||||
|
|
||||||
CalypAppModuleIf( QObject* parent, QAction* action, CalypModuleIf* module );
|
CalypAppModuleIf( QObject* parent, QAction* action, CalypModulePtr&& module );
|
||||||
virtual ~CalypAppModuleIf() {}
|
~CalypAppModuleIf();
|
||||||
QList<VideoSubWindow*> getSubWindowList()
|
|
||||||
{
|
|
||||||
QList<VideoSubWindow*> arraySubWindows;
|
|
||||||
for( int i = 0; i < CLP_MODULE_MAX_NUM_FRAMES; i++ )
|
|
||||||
if( m_pcSubWindow[i] )
|
|
||||||
arraySubWindows.append( m_pcSubWindow[i] );
|
|
||||||
return arraySubWindows;
|
|
||||||
}
|
|
||||||
|
|
||||||
CalypModuleIf* getModule() { return m_pcModule; }
|
auto getSubWindowList() -> const std::vector<VideoSubWindow*>& { return m_pcSubWindow; }
|
||||||
|
|
||||||
|
CalypModuleIf* getModule() { return m_pcModule.get(); }
|
||||||
unsigned int getModuleRequirements() { return m_pcModule->m_uiModuleRequirements; }
|
unsigned int getModuleRequirements() { return m_pcModule->m_uiModuleRequirements; }
|
||||||
ClpString moduleInfo() { return m_pcModule->moduleInfo(); }
|
std::string moduleInfo() { return m_pcModule->moduleInfo(); }
|
||||||
void update();
|
void update( bool isPlaying );
|
||||||
bool apply( bool isPlaying = false, bool disableThreads = false );
|
bool apply( bool isPlaying = false, bool disableThreads = false );
|
||||||
|
bool process();
|
||||||
|
// void setPlaying( bool isPlaying );
|
||||||
bool isRunning();
|
bool isRunning();
|
||||||
void show();
|
void show();
|
||||||
void destroy();
|
void disable();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void run();
|
virtual void run();
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_bSuccess{ false };
|
||||||
|
|
||||||
|
QAction* m_pcModuleAction{ nullptr };
|
||||||
|
CalypModulePtr m_pcModule{ nullptr };
|
||||||
|
|
||||||
|
std::vector<VideoSubWindow*> m_pcSubWindow;
|
||||||
|
|
||||||
|
// The module owns the related widgets
|
||||||
|
ModuleSubWindow* m_pcDisplaySubWindow{ nullptr };
|
||||||
|
QDockWidget* m_pcDockWidget{ nullptr };
|
||||||
|
ModuleHandleDock* m_pcModuleDock{ nullptr };
|
||||||
|
|
||||||
|
std::unique_ptr<CalypStream> m_pcModuleStream{ nullptr };
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<CalypFrame>> m_frameList;
|
||||||
|
std::vector<CalypFrame*> m_frameListPtr;
|
||||||
|
|
||||||
|
std::shared_ptr<CalypFrame> m_pcProcessedFrame{ nullptr };
|
||||||
|
double m_dMeasurementResult{ 0 };
|
||||||
|
|
||||||
|
#ifdef CALYP_THREADED_MODULES
|
||||||
|
QMutex m_Mutex;
|
||||||
|
std::atomic<bool> m_canceling{ false };
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __CALYPAPPMODULESIF_H__
|
#endif // __CALYPAPPMODULESIF_H__
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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
-6
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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
|
||||||
@@ -52,7 +52,7 @@ void GridManager::setGridSize( int newsize )
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Grid Drawer
|
// Grid Drawer
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void GridManager::drawGrid( QPixmap& image, const QRect& area, QPainter* painter )
|
void GridManager::drawGrid( const QImage& image, const QRect& area, QPainter* painter )
|
||||||
{
|
{
|
||||||
int offsetx = 0; // Grid offset doesn't applies to SCODE
|
int offsetx = 0; // Grid offset doesn't applies to SCODE
|
||||||
int offsety = 0; // project for now...
|
int offsety = 0; // project for now...
|
||||||
@@ -71,8 +71,7 @@ void GridManager::drawGrid( QPixmap& image, const QRect& area, QPainter* painter
|
|||||||
switch( style )
|
switch( style )
|
||||||
{
|
{
|
||||||
case intersectionDot:
|
case intersectionDot:
|
||||||
case intersectionCross:
|
case intersectionCross: {
|
||||||
{
|
|
||||||
painter->setPen( mainPen );
|
painter->setPen( mainPen );
|
||||||
// Draw crosses or dots on intersections
|
// Draw crosses or dots on intersections
|
||||||
for( int x = offsetx; x <= area.right(); x += hSpacing )
|
for( int x = offsetx; x <= area.right(); x += hSpacing )
|
||||||
@@ -99,8 +98,7 @@ void GridManager::drawGrid( QPixmap& image, const QRect& area, QPainter* painter
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Dashed:
|
case Dashed: {
|
||||||
{
|
|
||||||
// Change pen to the dashed line
|
// Change pen to the dashed line
|
||||||
mainPen.setStyle( Qt::DashLine );
|
mainPen.setStyle( Qt::DashLine );
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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,7 @@
|
|||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QPen>
|
#include <QPen>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@@ -54,7 +55,7 @@ public:
|
|||||||
|
|
||||||
void setGridSize( int newsize );
|
void setGridSize( int newsize );
|
||||||
|
|
||||||
void drawGrid( QPixmap& image, const QRect& area, QPainter* painter );
|
void drawGrid( const QImage& image, const QRect& area, QPainter* painter );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns a QRect defined by the grid that contains the point (x, y).
|
* @returns a QRect defined by the grid that contains the point (x, y).
|
||||||
|
|||||||
+37
-34
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
* Joao Santos (joaompssantos@gmail.com)
|
* Joao Santos (joaompssantos@gmail.com)
|
||||||
*
|
*
|
||||||
@@ -25,6 +25,16 @@
|
|||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
#include <QActionGroup>
|
||||||
|
#include <QCloseEvent>
|
||||||
|
#include <QDoubleSpinBox>
|
||||||
|
#include <QDragEnterEvent>
|
||||||
|
#include <QDropEvent>
|
||||||
|
#include <QSignalMapper>
|
||||||
|
#include <QtDebug>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "AboutDialog.h"
|
#include "AboutDialog.h"
|
||||||
#include "ModulesHandle.h"
|
#include "ModulesHandle.h"
|
||||||
#include "QualityHandle.h"
|
#include "QualityHandle.h"
|
||||||
@@ -34,15 +44,6 @@
|
|||||||
#include "VideoHandle.h"
|
#include "VideoHandle.h"
|
||||||
#include "VideoSubWindow.h"
|
#include "VideoSubWindow.h"
|
||||||
#include "lib/CalypOptions.h"
|
#include "lib/CalypOptions.h"
|
||||||
|
|
||||||
#include <QAction>
|
|
||||||
#include <QActionGroup>
|
|
||||||
#include <QCloseEvent>
|
|
||||||
#include <QDoubleSpinBox>
|
|
||||||
#include <QDragEnterEvent>
|
|
||||||
#include <QDropEvent>
|
|
||||||
#include <QSignalMapper>
|
|
||||||
#include <QtDebug>
|
|
||||||
#ifdef USE_FERVOR
|
#ifdef USE_FERVOR
|
||||||
#include "fvupdater.h"
|
#include "fvupdater.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -58,6 +59,8 @@ MainWindow::MainWindow()
|
|||||||
m_pDBusAdaptor = new DBusAppAdaptor( this );
|
m_pDBusAdaptor = new DBusAppAdaptor( this );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
m_appResourceHandle = std::make_unique<ResourceHandle>();
|
||||||
|
|
||||||
m_pcWindowHandle = new SubWindowHandle( this );
|
m_pcWindowHandle = new SubWindowHandle( this );
|
||||||
|
|
||||||
m_appModuleVideo = new VideoHandle( this, m_pcWindowHandle );
|
m_appModuleVideo = new VideoHandle( this, m_pcWindowHandle );
|
||||||
@@ -78,13 +81,13 @@ MainWindow::MainWindow()
|
|||||||
setUnifiedTitleAndToolBarOnMac( true );
|
setUnifiedTitleAndToolBarOnMac( true );
|
||||||
setCentralWidget( m_pcWindowHandle );
|
setCentralWidget( m_pcWindowHandle );
|
||||||
setAcceptDrops( true );
|
setAcceptDrops( true );
|
||||||
setBackgroundRole( QPalette::Background );
|
setBackgroundRole( QPalette::Window );
|
||||||
|
|
||||||
connect( m_pcWindowHandle, SIGNAL( windowActivated() ), this, SLOT( update() ) );
|
connect( m_pcWindowHandle, &SubWindowHandle::windowActivated, this, &MainWindow::update );
|
||||||
connect( m_pcWindowHandle, SIGNAL( changed() ), this, SLOT( update() ) );
|
connect( m_pcWindowHandle, &SubWindowHandle::changed, this, &MainWindow::update, Qt::QueuedConnection );
|
||||||
connect( m_appModuleVideo, SIGNAL( changed() ), this, SLOT( update() ) );
|
connect( m_appModuleVideo, &VideoHandle::changed, this, &MainWindow::update, Qt::QueuedConnection );
|
||||||
connect( m_appModuleQuality, SIGNAL( changed() ), this, SLOT( update() ) );
|
connect( m_appModuleQuality, &QualityHandle::changed, this, &MainWindow::update, Qt::QueuedConnection );
|
||||||
connect( m_appModuleExtensions, SIGNAL( changed() ), this, SLOT( update() ) );
|
connect( m_appModuleExtensions, &ModulesHandle::changed, this, &MainWindow::update, Qt::QueuedConnection );
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MainWindow::parseArgs( int argc, char* argv[] )
|
bool MainWindow::parseArgs( int argc, char* argv[] )
|
||||||
@@ -92,16 +95,16 @@ bool MainWindow::parseArgs( int argc, char* argv[] )
|
|||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
CalypOptions pcCmdParser;
|
CalypOptions pcCmdParser;
|
||||||
|
|
||||||
std::vector<ClpString> m_apcInputs;
|
std::vector<std::string> m_apcInputs;
|
||||||
ClpString strResolution( "" );
|
std::string strResolution( "" );
|
||||||
ClpString strPelFmt( "" );
|
std::string strPelFmt( "" );
|
||||||
|
|
||||||
pcCmdParser.addOptions() /**/
|
pcCmdParser.addOptions() /**/
|
||||||
( "input,i", m_apcInputs, "input file" ) /**/
|
( "input,i", m_apcInputs, "input file" ) /**/
|
||||||
( "size,s", strResolution, "size (WxH)" ) /**/
|
( "size,s", strResolution, "size (WxH)" ) /**/
|
||||||
( "pel_fmt", strPelFmt, "pixel format" );
|
( "pel_fmt", strPelFmt, "pixel format" );
|
||||||
|
|
||||||
if( !pcCmdParser.parse( argc, argv ) )
|
if( pcCmdParser.parse( argc, argv ) < 0 )
|
||||||
{
|
{
|
||||||
bRet |= true;
|
bRet |= true;
|
||||||
}
|
}
|
||||||
@@ -189,13 +192,15 @@ void MainWindow::loadFile( QString fileName, CalypFileInfo* pStreamInfo )
|
|||||||
printMessage( "File " + fileName + " do not exist!", CLP_LOG_ERROR );
|
printMessage( "File " + fileName + " do not exist!", CLP_LOG_ERROR );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
VideoSubWindow* videoSubWindow = MainWindow::findVideoStreamSubWindow( m_pcWindowHandle, fileName );
|
auto* videoSubWindow = MainWindow::findVideoStreamSubWindow( m_pcWindowHandle, fileName );
|
||||||
if( videoSubWindow )
|
if( videoSubWindow )
|
||||||
{
|
{
|
||||||
m_pcWindowHandle->setActiveSubWindow( videoSubWindow );
|
m_pcWindowHandle->setActiveSubWindow( videoSubWindow );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
videoSubWindow = new VideoSubWindow( VideoSubWindow::VIDEO_STREAM_SUBWINDOW ); // createSubWindow();
|
videoSubWindow = new VideoStreamSubWindow(); // createSubWindow();
|
||||||
|
videoSubWindow->setResourceManaget( m_appResourceHandle.get() );
|
||||||
|
|
||||||
if( !pStreamInfo )
|
if( !pStreamInfo )
|
||||||
{
|
{
|
||||||
int idx = findCalypStreamInfo( m_aRecentFileStreamInfo, fileName );
|
int idx = findCalypStreamInfo( m_aRecentFileStreamInfo, fileName );
|
||||||
@@ -256,12 +261,12 @@ QStringList MainWindow::showFileDialog( bool bRead )
|
|||||||
|
|
||||||
for( unsigned int i = 0; i < supportedFmts.size(); i++ )
|
for( unsigned int i = 0; i < supportedFmts.size(); i++ )
|
||||||
{
|
{
|
||||||
std::vector<ClpString> arrayExt = supportedFmts[i].getExts();
|
std::vector<std::string> arrayExt = supportedFmts[i].getExts();
|
||||||
if( arrayExt.size() > 0 )
|
if( arrayExt.size() > 0 )
|
||||||
{
|
{
|
||||||
QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) );
|
QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) );
|
||||||
currFmt.append( " (" );
|
currFmt.append( " (" );
|
||||||
for( std::vector<ClpString>::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
|
for( std::vector<std::string>::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
|
||||||
{
|
{
|
||||||
supported.append( " *." );
|
supported.append( " *." );
|
||||||
currFmt.append( "*." );
|
currFmt.append( "*." );
|
||||||
@@ -375,9 +380,8 @@ void MainWindow::saveStream()
|
|||||||
|
|
||||||
void MainWindow::format()
|
void MainWindow::format()
|
||||||
{
|
{
|
||||||
if( m_pcCurrentVideoSubWindow )
|
if( auto* pcVideoSubWindow = qobject_cast<VideoStreamSubWindow*>( m_pcCurrentVideoSubWindow ) )
|
||||||
{
|
{
|
||||||
VideoSubWindow* pcVideoSubWindow = m_pcCurrentVideoSubWindow;
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( pcVideoSubWindow->loadFile( pcVideoSubWindow->getCurrentFileName(), true ) )
|
if( pcVideoSubWindow->loadFile( pcVideoSubWindow->getCurrentFileName(), true ) )
|
||||||
@@ -431,10 +435,10 @@ void MainWindow::reloadAll()
|
|||||||
|
|
||||||
void MainWindow::loadAll()
|
void MainWindow::loadAll()
|
||||||
{
|
{
|
||||||
if( m_pcCurrentVideoSubWindow )
|
if( auto* pcVideoSubWindow = qobject_cast<VideoStreamSubWindow*>( m_pcCurrentVideoSubWindow ) )
|
||||||
{
|
{
|
||||||
printMessage( "Loading file into memory...", CLP_LOG_INFO );
|
printMessage( "Loading file into memory...", CLP_LOG_INFO );
|
||||||
m_pcCurrentVideoSubWindow->loadAll();
|
pcVideoSubWindow->loadAll();
|
||||||
printMessage( "File loaded", CLP_LOG_INFO );
|
printMessage( "File loaded", CLP_LOG_INFO );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -524,19 +528,18 @@ void MainWindow::dropEvent( QDropEvent* event )
|
|||||||
|
|
||||||
// ----------------------- Sub Window Functions -----------------------
|
// ----------------------- Sub Window Functions -----------------------
|
||||||
|
|
||||||
VideoSubWindow* MainWindow::findVideoStreamSubWindow( const SubWindowHandle* windowManager,
|
VideoStreamSubWindow* MainWindow::findVideoStreamSubWindow( const SubWindowHandle* windowManager,
|
||||||
const QString& fileName )
|
const QString& fileName )
|
||||||
{
|
{
|
||||||
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
|
QString canonicalFilePath = QFileInfo( fileName ).canonicalFilePath();
|
||||||
VideoSubWindow* pcSubWindow;
|
|
||||||
QList<SubWindowAbstract*> subWindowList = windowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
QList<SubWindowAbstract*> subWindowList = windowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
||||||
for( int i = 0; i < subWindowList.size(); i++ )
|
for( int i = 0; i < subWindowList.size(); i++ )
|
||||||
{
|
{
|
||||||
pcSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
auto* pcSubWindow = qobject_cast<VideoStreamSubWindow*>( subWindowList.at( i ) );
|
||||||
if( pcSubWindow->getCurrentFileName() == canonicalFilePath )
|
if( pcSubWindow->getCurrentFileName() == canonicalFilePath )
|
||||||
return qobject_cast<VideoSubWindow*>( pcSubWindow );
|
return pcSubWindow;
|
||||||
}
|
}
|
||||||
return 0;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------- Update Functions -----------------------
|
// ----------------------- Update Functions -----------------------
|
||||||
|
|||||||
+11
-7
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -36,16 +36,18 @@
|
|||||||
#ifndef __MAINWINDOW_H__
|
#ifndef __MAINWINDOW_H__
|
||||||
#define __MAINWINDOW_H__
|
#define __MAINWINDOW_H__
|
||||||
|
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QString>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
|
#include "VideoStreamSubWindow.h"
|
||||||
#include "VideoSubWindow.h"
|
#include "VideoSubWindow.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#ifdef USE_QTDBUS
|
#ifdef USE_QTDBUS
|
||||||
#include "DBusAppAdaptor.h"
|
#include "DBusAppAdaptor.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "ResourceHandle.h"
|
||||||
#include <QMainWindow>
|
|
||||||
#include <QString>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
class QDragEnterEvent;
|
class QDragEnterEvent;
|
||||||
@@ -58,6 +60,7 @@ class QSignalMapper;
|
|||||||
class CalypOptions;
|
class CalypOptions;
|
||||||
class CalypStream;
|
class CalypStream;
|
||||||
class SubWindowHandle;
|
class SubWindowHandle;
|
||||||
|
class VideoStreamSubWindow;
|
||||||
class VideoHandle;
|
class VideoHandle;
|
||||||
class QualityHandle;
|
class QualityHandle;
|
||||||
class ModulesHandle;
|
class ModulesHandle;
|
||||||
@@ -129,8 +132,8 @@ private:
|
|||||||
QString m_cLastOpenPath;
|
QString m_cLastOpenPath;
|
||||||
QStringList showFileDialog( bool bRead );
|
QStringList showFileDialog( bool bRead );
|
||||||
|
|
||||||
static VideoSubWindow* findVideoStreamSubWindow( const SubWindowHandle* windowManager,
|
static VideoStreamSubWindow* findVideoStreamSubWindow( const SubWindowHandle* windowManager,
|
||||||
const QString& fileName );
|
const QString& fileName );
|
||||||
|
|
||||||
void updateMenus();
|
void updateMenus();
|
||||||
|
|
||||||
@@ -158,6 +161,7 @@ private:
|
|||||||
* Quality
|
* Quality
|
||||||
* Modules
|
* Modules
|
||||||
*/
|
*/
|
||||||
|
std::unique_ptr<ResourceHandle> m_appResourceHandle;
|
||||||
VideoHandle* m_appModuleVideo;
|
VideoHandle* m_appModuleVideo;
|
||||||
QualityHandle* m_appModuleQuality;
|
QualityHandle* m_appModuleQuality;
|
||||||
ModulesHandle* m_appModuleExtensions;
|
ModulesHandle* m_appModuleExtensions;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,15 +24,15 @@
|
|||||||
|
|
||||||
#include "MdiSubWindow.h"
|
#include "MdiSubWindow.h"
|
||||||
|
|
||||||
#include "SubWindowAbstract.h"
|
|
||||||
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
|
|
||||||
|
#include "SubWindowAbstract.h"
|
||||||
|
|
||||||
MdiSubWindow::MdiSubWindow( QWidget* parent )
|
MdiSubWindow::MdiSubWindow( QWidget* parent )
|
||||||
: QMdiSubWindow( parent )
|
: QMdiSubWindow( parent )
|
||||||
{
|
{
|
||||||
setAttribute( Qt::WA_DeleteOnClose );
|
setAttribute( Qt::WA_DeleteOnClose );
|
||||||
setBackgroundRole( QPalette::Background );
|
setBackgroundRole( QPalette::Window );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize MdiSubWindow::sizeHint() const
|
QSize MdiSubWindow::sizeHint() const
|
||||||
|
|||||||
+2
-1
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -26,6 +26,7 @@
|
|||||||
#define __MDISUBWINDOW_H_
|
#define __MDISUBWINDOW_H_
|
||||||
|
|
||||||
#include <QMdiSubWindow>
|
#include <QMdiSubWindow>
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,114 @@
|
|||||||
|
/* This file is a part of Calyp project
|
||||||
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file ModuleSubWindow.cpp
|
||||||
|
* \brief Video Sub windows handling
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ModuleSubWindow.h"
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QStaticText>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "ModulesHandle.h"
|
||||||
|
|
||||||
|
ModuleSubWindow::ModuleSubWindow( CalypAppModuleIf* module, QWidget* parent )
|
||||||
|
: VideoSubWindow( VideoSubWindow::MODULE_SUBWINDOW, parent )
|
||||||
|
{
|
||||||
|
m_pcDisplayModule = module;
|
||||||
|
}
|
||||||
|
|
||||||
|
ModuleSubWindow::~ModuleSubWindow()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModuleSubWindow::resetWindowName()
|
||||||
|
{
|
||||||
|
QString windowName{ "Module" };
|
||||||
|
if( auto module_ptr = m_pcDisplayModule )
|
||||||
|
{
|
||||||
|
windowName.append( " " ).append( module_ptr->getModule()->m_pchModuleLongName );
|
||||||
|
}
|
||||||
|
setWindowName( windowName );
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModuleSubWindow::updateVideoWindowInfo()
|
||||||
|
{
|
||||||
|
m_cStreamInformation = "";
|
||||||
|
|
||||||
|
m_cStreamInformation = "Module";
|
||||||
|
if( auto module_ptr = m_pcDisplayModule )
|
||||||
|
{
|
||||||
|
const auto& arraySubWindows = module_ptr->getSubWindowList();
|
||||||
|
QStringList windowInfoList;
|
||||||
|
if( arraySubWindows.size() > 0 )
|
||||||
|
{
|
||||||
|
for( std::size_t i = 0; i < arraySubWindows.size(); i++ )
|
||||||
|
{
|
||||||
|
if( arraySubWindows[i]->getWindowName() != getWindowName() )
|
||||||
|
{
|
||||||
|
windowInfoList.append( QString( "Input %1 - " + arraySubWindows[i]->getWindowName() ).arg( i + 1 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( module_ptr->getModuleRequirements() & CLP_MODULES_HAS_INFO )
|
||||||
|
{
|
||||||
|
QStringList list = QString::fromStdString( module_ptr->moduleInfo() ).split( '\n' );
|
||||||
|
windowInfoList.append( list );
|
||||||
|
}
|
||||||
|
if( windowInfoList.size() > 0 )
|
||||||
|
{
|
||||||
|
m_pcVideoInfo->setInformationTopLeft( windowInfoList );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( m_pcCurrFrameAsset )
|
||||||
|
{
|
||||||
|
QString m_cPelFmtName = QString::fromStdString( m_pcCurrFrameAsset->getPelFmtName() );
|
||||||
|
m_cStreamInformation += " | " + m_cPelFmtName;
|
||||||
|
}
|
||||||
|
if( m_cStreamInformation.isEmpty() )
|
||||||
|
{
|
||||||
|
m_cStreamInformation = " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ModuleSubWindow::isPlaying()
|
||||||
|
{
|
||||||
|
if( auto module_ptr = m_pcDisplayModule )
|
||||||
|
{
|
||||||
|
for( auto window : module_ptr->getSubWindowList() )
|
||||||
|
{
|
||||||
|
if( window->isPlaying() )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModuleSubWindow::refreshSubWindow()
|
||||||
|
{
|
||||||
|
if( auto module_ptr = m_pcDisplayModule )
|
||||||
|
{
|
||||||
|
setFillWindow( true );
|
||||||
|
updateVideoWindowInfo();
|
||||||
|
module_ptr->apply( isPlaying(), false );
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
/* This file is a part of Calyp project
|
||||||
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file ModuleSubWindow.h
|
||||||
|
* \brief Video Sub windows handling
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __MODULESUBWINDOW_H__
|
||||||
|
#define __MODULESUBWINDOW_H__
|
||||||
|
|
||||||
|
#include <QDataStream>
|
||||||
|
#include <QFuture>
|
||||||
|
#include <QRect>
|
||||||
|
#include <QString>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
|
#include "CalypAppModuleIf.h"
|
||||||
|
#include "CommonDefs.h"
|
||||||
|
#include "VideoSubWindow.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "lib/CalypStream.h"
|
||||||
|
|
||||||
|
class VideoInformation;
|
||||||
|
|
||||||
|
class ModuleSubWindow : public VideoSubWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
ModuleSubWindow( CalypAppModuleIf* module, QWidget* parent = 0 );
|
||||||
|
~ModuleSubWindow();
|
||||||
|
|
||||||
|
void resetWindowName();
|
||||||
|
|
||||||
|
void updateVideoWindowInfo();
|
||||||
|
|
||||||
|
bool isPlaying();
|
||||||
|
void stop(){};
|
||||||
|
void advanceOneFrame(){};
|
||||||
|
auto getFrameNum() -> std::uint64_t { return 1; };
|
||||||
|
|
||||||
|
void refreshSubWindow();
|
||||||
|
|
||||||
|
void setCurrFrame( std::shared_ptr<CalypFrame> pcCurrFrame );
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __MODULESUBWINDOW_H__
|
||||||
+68
-81
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -27,6 +27,7 @@
|
|||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
|
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
|
#include "ModuleSubWindow.h"
|
||||||
#include "ModulesHandleOptDialog.h"
|
#include "ModulesHandleOptDialog.h"
|
||||||
#include "SubWindowHandle.h"
|
#include "SubWindowHandle.h"
|
||||||
#include "SubWindowSelectorDialog.h"
|
#include "SubWindowSelectorDialog.h"
|
||||||
@@ -91,7 +92,6 @@ QMenu* ModulesHandle::createMenu()
|
|||||||
|
|
||||||
void ModulesHandle::buildMenu()
|
void ModulesHandle::buildMenu()
|
||||||
{
|
{
|
||||||
CalypModuleIf* pcCurrModuleIf;
|
|
||||||
QString ModuleIfinternalName;
|
QString ModuleIfinternalName;
|
||||||
QAction* currAction;
|
QAction* currAction;
|
||||||
QMenu* currSubMenu;
|
QMenu* currSubMenu;
|
||||||
@@ -108,7 +108,7 @@ void ModulesHandle::buildMenu()
|
|||||||
CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin();
|
CalypModulesFactoryMap::iterator it = moduleFactoryMap.begin();
|
||||||
for( ; it != moduleFactoryMap.end(); ++it )
|
for( ; it != moduleFactoryMap.end(); ++it )
|
||||||
{
|
{
|
||||||
pcCurrModuleIf = it->second();
|
auto pcCurrModuleIf = it->second();
|
||||||
ModuleIfinternalName = QString::fromLocal8Bit( it->first );
|
ModuleIfinternalName = QString::fromLocal8Bit( it->first );
|
||||||
|
|
||||||
currSubMenu = NULL;
|
currSubMenu = NULL;
|
||||||
@@ -147,8 +147,6 @@ void ModulesHandle::buildMenu()
|
|||||||
currSubMenu->addAction( currAction );
|
currSubMenu->addAction( currAction );
|
||||||
else
|
else
|
||||||
m_pcModulesMenu->addAction( currAction );
|
m_pcModulesMenu->addAction( currAction );
|
||||||
|
|
||||||
pcCurrModuleIf->Delete();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pcModulesMenu->addAction( m_arrayActions[LOAD_EXTERNAL_ACT] );
|
m_pcModulesMenu->addAction( m_arrayActions[LOAD_EXTERNAL_ACT] );
|
||||||
@@ -183,22 +181,21 @@ void ModulesHandle::updateMenus()
|
|||||||
}
|
}
|
||||||
m_arrayActions[LOAD_EXTERNAL_ACT]->setEnabled( true );
|
m_arrayActions[LOAD_EXTERNAL_ACT]->setEnabled( true );
|
||||||
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setEnabled( hasSubWindow );
|
m_arrayActions[FORCE_NEW_WINDOW_ACT]->setEnabled( hasSubWindow );
|
||||||
m_arrayActions[DISABLE_ALL_ACT]->setEnabled( m_pcCalypAppModuleIfList.size() > 0 );
|
m_arrayActions[DISABLE_ALL_ACT]->setEnabled( true );
|
||||||
|
|
||||||
if( pcSubWindow )
|
if( pcSubWindow )
|
||||||
{
|
{
|
||||||
QList<CalypAppModuleIf*> apcCurrentModule = pcSubWindow->getModuleArray();
|
m_arrayActions[DISABLE_ACT]->setEnabled( pcSubWindow->hasModules() );
|
||||||
m_arrayActions[DISABLE_ACT]->setEnabled( apcCurrentModule.size() > 0 );
|
|
||||||
if( pcSubWindow->getDisplayModule() )
|
if( pcSubWindow->getDisplayModule() )
|
||||||
{
|
{
|
||||||
m_arrayActions[APPLY_ALL_ACT]->setEnabled( true );
|
m_arrayActions[APPLY_ALL_ACT]->setEnabled( true );
|
||||||
m_arrayActions[SWAP_FRAMES_ACT]->setEnabled( true );
|
m_arrayActions[SWAP_FRAMES_ACT]->setEnabled( true );
|
||||||
}
|
}
|
||||||
for( int i = 0; i < apcCurrentModule.size(); i++ )
|
// for( int i = 0; i < apcCurrentModule.size(); i++ )
|
||||||
{
|
// {
|
||||||
currModuleAction = apcCurrentModule.at( i )->m_pcModuleAction;
|
// currModuleAction = apcCurrentModule.at( i )->m_pcModuleAction;
|
||||||
currModuleAction->setChecked( true );
|
// currModuleAction->setChecked( true );
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -222,16 +219,15 @@ void ModulesHandle::processOpt( int index )
|
|||||||
CalypAppModuleIf* pcCurrentModule = pcSubWindow->getDisplayModule();
|
CalypAppModuleIf* pcCurrentModule = pcSubWindow->getDisplayModule();
|
||||||
if( pcCurrentModule )
|
if( pcCurrentModule )
|
||||||
{
|
{
|
||||||
CalypAppModuleIf* pcCurrModule = pcCurrentModule;
|
|
||||||
switch( index )
|
switch( index )
|
||||||
{
|
{
|
||||||
case INVALID_OPT:
|
case INVALID_OPT:
|
||||||
break;
|
break;
|
||||||
case SWAP_FRAMES_ACT:
|
case SWAP_FRAMES_ACT:
|
||||||
swapModulesWindowsIf( pcCurrModule );
|
swapModulesWindowsIf( pcCurrentModule );
|
||||||
break;
|
break;
|
||||||
case APPLY_ALL_ACT:
|
case APPLY_ALL_ACT:
|
||||||
applyAllModuleIf( pcCurrModule );
|
applyAllModuleIf( pcCurrentModule );
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
Q_ASSERT( 0 );
|
Q_ASSERT( 0 );
|
||||||
@@ -278,9 +274,12 @@ void ModulesHandle::activateModule()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString ModuleIfName = pcAction->data().toString();
|
QString ModuleIfName = pcAction->data().toString();
|
||||||
CalypModuleIf* pcCurrModuleIf =
|
auto pcCurrModuleIf = CalypModulesFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
|
||||||
CalypModulesFactory::Get()->CreateModule( ModuleIfName.toLocal8Bit().constData() );
|
if( pcCurrModuleIf == nullptr )
|
||||||
CalypAppModuleIf* pcCurrAppModuleIf = new CalypAppModuleIf( this, pcAction, pcCurrModuleIf );
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto pcCurrAppModuleIf = std::make_shared<CalypAppModuleIf>( this, pcAction, std::move( pcCurrModuleIf ) );
|
||||||
|
|
||||||
QList<VideoSubWindow*> videoSubWindowList;
|
QList<VideoSubWindow*> videoSubWindowList;
|
||||||
int numberOfFrames = pcCurrAppModuleIf->m_pcModule->m_uiNumberOfFrames;
|
int numberOfFrames = pcCurrAppModuleIf->m_pcModule->m_uiNumberOfFrames;
|
||||||
@@ -337,7 +336,7 @@ void ModulesHandle::activateModule()
|
|||||||
{
|
{
|
||||||
videoSubWindowList.clear();
|
videoSubWindowList.clear();
|
||||||
qobject_cast<MainWindow*>( m_pcParent )->printMessage( "Error! Incompatible frames", CLP_LOG_ERROR );
|
qobject_cast<MainWindow*>( m_pcParent )->printMessage( "Error! Incompatible frames", CLP_LOG_ERROR );
|
||||||
destroyModuleIf( pcCurrAppModuleIf );
|
//destroyModuleIf( pcCurrAppModuleIf );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -352,7 +351,7 @@ void ModulesHandle::activateModule()
|
|||||||
{
|
{
|
||||||
qobject_cast<MainWindow*>( m_pcParent )
|
qobject_cast<MainWindow*>( m_pcParent )
|
||||||
->printMessage( "Error! There is no windows to apply the module", CLP_LOG_ERROR );
|
->printMessage( "Error! There is no windows to apply the module", CLP_LOG_ERROR );
|
||||||
destroyModuleIf( pcCurrAppModuleIf );
|
//destroyModuleIf( pcCurrAppModuleIf );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -363,11 +362,11 @@ void ModulesHandle::activateModule()
|
|||||||
|
|
||||||
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_OPTIONS )
|
if( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_OPTIONS )
|
||||||
{
|
{
|
||||||
ModulesHandleOptDialog moduleOptDialog( m_pcParent, pcCurrAppModuleIf );
|
ModulesHandleOptDialog moduleOptDialog( m_pcParent, pcCurrAppModuleIf.get() );
|
||||||
if( moduleOptDialog.runConfiguration() == QDialog::Rejected )
|
if( moduleOptDialog.runConfiguration() == QDialog::Rejected )
|
||||||
{
|
{
|
||||||
qobject_cast<MainWindow*>( m_pcParent )->printMessage( "Module canceled by user!", CLP_LOG_WARNINGS );
|
qobject_cast<MainWindow*>( m_pcParent )->printMessage( "Module canceled by user!", CLP_LOG_WARNINGS );
|
||||||
destroyModuleIf( pcCurrAppModuleIf );
|
//destroyModuleIf( pcCurrAppModuleIf );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -376,14 +375,12 @@ void ModulesHandle::activateModule()
|
|||||||
|
|
||||||
QString windowName;
|
QString windowName;
|
||||||
|
|
||||||
VideoSubWindow* pcModuleSubWindow = NULL;
|
|
||||||
if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_PROCESSING_MODULE )
|
||||||
{
|
{
|
||||||
if( ( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow )
|
if( ( pcCurrAppModuleIf->m_pcModule->m_uiModuleRequirements & CLP_MODULE_REQUIRES_NEW_WINDOW ) || bShowModulesNewWindow )
|
||||||
{
|
{
|
||||||
pcModuleSubWindow = new VideoSubWindow( VideoSubWindow::MODULE_SUBWINDOW );
|
auto pcModuleSubWindow = new ModuleSubWindow( pcCurrAppModuleIf.get() );
|
||||||
windowName.append( QStringLiteral( "Module " ) );
|
pcModuleSubWindow->resetWindowName();
|
||||||
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 ) ) );
|
||||||
@@ -392,11 +389,15 @@ void ModulesHandle::activateModule()
|
|||||||
// connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo,
|
// connect( pcModuleSubWindow, SIGNAL( scrollBarMoved_SWindow( const QPoint ) ), m_appModuleVideo,
|
||||||
// SLOT( moveAllScrollBars( const QPoint ) ) );
|
// SLOT( moveAllScrollBars( const QPoint ) ) );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pcCurrAppModuleIf->m_pcSubWindow[0]->setDisplayModule( pcCurrAppModuleIf.get() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
|
else if( pcCurrAppModuleIf->m_pcModule->m_iModuleType == CLP_FRAME_MEASUREMENT_MODULE )
|
||||||
{
|
{
|
||||||
pcCurrAppModuleIf->m_pcDisplaySubWindow = NULL;
|
pcCurrAppModuleIf->m_pcDisplaySubWindow = NULL;
|
||||||
pcCurrAppModuleIf->m_pcModuleDock = new ModuleHandleDock( m_pcParent, pcCurrAppModuleIf );
|
pcCurrAppModuleIf->m_pcModuleDock = new ModuleHandleDock( m_pcParent, pcCurrAppModuleIf.get() );
|
||||||
QString titleDockWidget;
|
QString titleDockWidget;
|
||||||
titleDockWidget.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleName );
|
titleDockWidget.append( pcCurrAppModuleIf->m_pcModule->m_pchModuleName );
|
||||||
titleDockWidget.append( " Information" );
|
titleDockWidget.append( " Information" );
|
||||||
@@ -408,19 +409,9 @@ void ModulesHandle::activateModule()
|
|||||||
->addDockWidget( Qt::RightDockWidgetArea, pcCurrAppModuleIf->m_pcDockWidget );
|
->addDockWidget( Qt::RightDockWidgetArea, pcCurrAppModuleIf->m_pcDockWidget );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Associate module with subwindows
|
for( int i = 0; i < videoSubWindowList.size(); i++ )
|
||||||
if( !pcCurrAppModuleIf->m_pcDisplaySubWindow && !pcCurrAppModuleIf->m_pcModuleDock )
|
|
||||||
{
|
{
|
||||||
pcCurrAppModuleIf->m_pcSubWindow[0]->enableModule( pcCurrAppModuleIf );
|
pcCurrAppModuleIf->m_pcSubWindow[i]->associateModule( pcCurrAppModuleIf );
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( pcCurrAppModuleIf->m_pcDisplaySubWindow )
|
|
||||||
pcCurrAppModuleIf->m_pcDisplaySubWindow->enableModule( pcCurrAppModuleIf );
|
|
||||||
for( int i = 0; i < videoSubWindowList.size(); i++ )
|
|
||||||
{
|
|
||||||
pcCurrAppModuleIf->m_pcSubWindow[i]->associateModule( pcCurrAppModuleIf );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create Module
|
// Create Module
|
||||||
@@ -443,19 +434,19 @@ void ModulesHandle::activateModule()
|
|||||||
if( !moduleCreated )
|
if( !moduleCreated )
|
||||||
{
|
{
|
||||||
qobject_cast<MainWindow*>( m_pcParent )->printMessage( "Error! Module cannot be created", CLP_LOG_ERROR );
|
qobject_cast<MainWindow*>( m_pcParent )->printMessage( "Error! Module cannot be created", CLP_LOG_ERROR );
|
||||||
destroyModuleIf( pcCurrAppModuleIf );
|
//destroyModuleIf( pcCurrAppModuleIf );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pcCurrAppModuleIf->apply( false, true );
|
pcCurrAppModuleIf->apply( false, true );
|
||||||
|
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
|
|
||||||
if( pcModuleSubWindow )
|
if( pcCurrAppModuleIf->m_pcDisplaySubWindow )
|
||||||
{
|
{
|
||||||
pcModuleSubWindow->setWindowName( windowName );
|
m_pcMainWindowManager->addSubWindow( pcCurrAppModuleIf->m_pcDisplaySubWindow );
|
||||||
m_pcMainWindowManager->addSubWindow( pcModuleSubWindow );
|
pcCurrAppModuleIf->m_pcDisplaySubWindow->show();
|
||||||
pcModuleSubWindow->show();
|
m_appModuleVideo->addSubWindow( pcCurrAppModuleIf->m_pcDisplaySubWindow );
|
||||||
m_appModuleVideo->addSubWindow( pcModuleSubWindow );
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -465,44 +456,39 @@ void ModulesHandle::activateModule()
|
|||||||
videoSubWindowList.at( 0 )->setWindowName( windowName );
|
videoSubWindowList.at( 0 )->setWindowName( windowName );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pcCalypAppModuleIfList.append( pcCurrAppModuleIf );
|
// Change ownership of the module
|
||||||
|
// if( !pcCurrAppModuleIf->m_pcDisplaySubWindow && !pcCurrAppModuleIf->m_pcModuleDock )
|
||||||
|
// {
|
||||||
|
// pcCurrAppModuleIf->m_pcSubWindow[0]->enableModule( pcCurrAppModuleIf );
|
||||||
|
// }
|
||||||
|
// else if( pcCurrAppModuleIf->m_pcDisplaySubWindow )
|
||||||
|
// {
|
||||||
|
// pcCurrAppModuleIf->m_pcDisplaySubWindow->enableModule( pcCurrAppModuleIf );
|
||||||
|
// }
|
||||||
|
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesHandle::destroyModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
|
||||||
{
|
|
||||||
if( pcCurrModuleIf )
|
|
||||||
{
|
|
||||||
pcCurrModuleIf->destroy();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModulesHandle::destroyWindowModules()
|
void ModulesHandle::destroyWindowModules()
|
||||||
{
|
{
|
||||||
VideoSubWindow* pcVideoSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
VideoSubWindow* pcVideoSubWindow = qobject_cast<VideoSubWindow*>( m_pcMainWindowManager->activeSubWindow() );
|
||||||
if( pcVideoSubWindow )
|
if( pcVideoSubWindow )
|
||||||
{
|
{
|
||||||
pcVideoSubWindow->disableModule();
|
pcVideoSubWindow->disableAllModules();
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesHandle::destroyAllModulesIf()
|
void ModulesHandle::destroyAllModulesIf()
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_pcCalypAppModuleIfList.size(); i++ )
|
bool emit_changed = false;
|
||||||
|
QList<SubWindowAbstract*> windowsList = m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_SUBWINDOW );
|
||||||
|
for( auto window : windowsList )
|
||||||
{
|
{
|
||||||
destroyModuleIf( m_pcCalypAppModuleIfList.at( i ) );
|
emit_changed |= qobject_cast<VideoSubWindow*>( window )->disableAllModules();
|
||||||
}
|
|
||||||
emit changed();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ModulesHandle::applyModuleIf( QList<CalypAppModuleIf*> pcCurrModuleIfList, bool isPlaying, bool disableThreads )
|
|
||||||
{
|
|
||||||
for( int i = 0; i < pcCurrModuleIfList.size() && !isPlaying; i++ )
|
|
||||||
{
|
|
||||||
pcCurrModuleIfList.at( i )->apply( isPlaying, disableThreads );
|
|
||||||
}
|
}
|
||||||
|
if( emit_changed )
|
||||||
|
emit changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
||||||
@@ -520,12 +506,12 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
|||||||
|
|
||||||
for( unsigned int i = 0; i < supportedFmts.size(); i++ )
|
for( unsigned int i = 0; i < supportedFmts.size(); i++ )
|
||||||
{
|
{
|
||||||
std::vector<ClpString> arrayExt = supportedFmts[i].getExts();
|
std::vector<std::string> arrayExt = supportedFmts[i].getExts();
|
||||||
if( arrayExt.size() > 0 )
|
if( arrayExt.size() > 0 )
|
||||||
{
|
{
|
||||||
QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) );
|
QString currFmt( QString::fromStdString( supportedFmts[i].formatName ) );
|
||||||
currFmt.append( " (" );
|
currFmt.append( " (" );
|
||||||
for( std::vector<ClpString>::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
|
for( std::vector<std::string>::iterator e = arrayExt.begin(); e != arrayExt.end(); ++e )
|
||||||
{
|
{
|
||||||
supported.append( " *." );
|
supported.append( " *." );
|
||||||
currFmt.append( "*." );
|
currFmt.append( "*." );
|
||||||
@@ -550,14 +536,13 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
|||||||
Height = pcCurrModuleIf->m_pcProcessedFrame->getHeight();
|
Height = pcCurrModuleIf->m_pcProcessedFrame->getHeight();
|
||||||
InputFormat = pcCurrModuleIf->m_pcProcessedFrame->getPelFormat();
|
InputFormat = pcCurrModuleIf->m_pcProcessedFrame->getPelFormat();
|
||||||
BitsPixel = pcCurrModuleIf->m_pcProcessedFrame->getBitsPel();
|
BitsPixel = pcCurrModuleIf->m_pcProcessedFrame->getBitsPel();
|
||||||
FrameRate = pcCurrModuleIf->m_pcSubWindow[0]->getInputStream()->getFrameRate();
|
FrameRate = 30;
|
||||||
|
|
||||||
pcCurrModuleIf->m_pcModuleStream = new CalypStream;
|
pcCurrModuleIf->m_pcModuleStream = std::unique_ptr<CalypStream>();
|
||||||
if( !pcCurrModuleIf->m_pcModuleStream->open( fileName.toStdString(), Width, Height, InputFormat, BitsPixel,
|
if( !pcCurrModuleIf->m_pcModuleStream->open( fileName.toStdString(), Width, Height, InputFormat, BitsPixel,
|
||||||
CLP_LITTLE_ENDIAN, FrameRate, false ) )
|
CLP_LITTLE_ENDIAN, FrameRate, false ) )
|
||||||
{
|
{
|
||||||
delete pcCurrModuleIf->m_pcModuleStream;
|
pcCurrModuleIf->m_pcModuleStream = nullptr;
|
||||||
pcCurrModuleIf->m_pcModuleStream = NULL;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -565,11 +550,11 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
|||||||
if( pcCurrModuleIf->m_pcModuleStream )
|
if( pcCurrModuleIf->m_pcModuleStream )
|
||||||
{
|
{
|
||||||
unsigned int numberOfWindows = pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames;
|
unsigned int numberOfWindows = pcCurrModuleIf->m_pcModule->m_uiNumberOfFrames;
|
||||||
ClpULong currFrames = 0;
|
std::uint64_t currFrames = 0;
|
||||||
ClpULong numberOfFrames = -1;
|
std::uint64_t 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]->getFrameNum();
|
||||||
if( currFrames < numberOfFrames )
|
if( currFrames < numberOfFrames )
|
||||||
numberOfFrames = currFrames;
|
numberOfFrames = currFrames;
|
||||||
pcCurrModuleIf->m_pcSubWindow[i]->stop();
|
pcCurrModuleIf->m_pcSubWindow[i]->stop();
|
||||||
@@ -579,11 +564,10 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
|||||||
{
|
{
|
||||||
pcCurrModuleIf->apply( false, true );
|
pcCurrModuleIf->apply( false, true );
|
||||||
QCoreApplication::processEvents();
|
QCoreApplication::processEvents();
|
||||||
pcCurrModuleIf->m_pcModuleStream->writeFrame( pcCurrModuleIf->m_pcProcessedFrame );
|
pcCurrModuleIf->m_pcModuleStream->writeFrame( *pcCurrModuleIf->m_pcProcessedFrame );
|
||||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||||
{
|
{
|
||||||
pcCurrModuleIf->m_pcSubWindow[i]->play();
|
pcCurrModuleIf->m_pcSubWindow[i]->advanceOneFrame();
|
||||||
pcCurrModuleIf->m_pcSubWindow[i]->playEvent();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||||
@@ -609,12 +593,15 @@ void ModulesHandle::swapModulesWindowsIf( CalypAppModuleIf* pcCurrModuleIf )
|
|||||||
void ModulesHandle::customEvent( QEvent* event )
|
void ModulesHandle::customEvent( QEvent* event )
|
||||||
{
|
{
|
||||||
if( !event )
|
if( !event )
|
||||||
{
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
CalypAppModuleIf::EventData* eventData = (CalypAppModuleIf::EventData*)event;
|
CalypAppModuleIf::EventData* eventData = (CalypAppModuleIf::EventData*)event;
|
||||||
if( eventData->m_bSuccess )
|
if( eventData->m_bSuccess )
|
||||||
{
|
{
|
||||||
|
event->accept();
|
||||||
|
// The module could be freed by the time the event is processed
|
||||||
|
if( eventData->m_pcModule.isNull() )
|
||||||
|
return;
|
||||||
eventData->m_pcModule->show();
|
eventData->m_pcModule->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+4
-9
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,15 +24,14 @@
|
|||||||
#ifndef __MODULESHANDLE_H__
|
#ifndef __MODULESHANDLE_H__
|
||||||
#define __MODULESHANDLE_H__
|
#define __MODULESHANDLE_H__
|
||||||
|
|
||||||
#include "config.h"
|
#include <QtCore>
|
||||||
|
#include <QtWidgets>
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#include <QtCore>
|
|
||||||
#include <QtWidgets>
|
|
||||||
#include "CalypAppModuleIf.h"
|
#include "CalypAppModuleIf.h"
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
|
#include "config.h"
|
||||||
#include "lib/CalypFrame.h"
|
#include "lib/CalypFrame.h"
|
||||||
|
|
||||||
class VideoHandle;
|
class VideoHandle;
|
||||||
@@ -56,10 +55,6 @@ public:
|
|||||||
void readSettings();
|
void readSettings();
|
||||||
void writeSettings();
|
void writeSettings();
|
||||||
|
|
||||||
static void destroyModuleIf( CalypAppModuleIf* pcCurrModuleIf );
|
|
||||||
static void applyModuleIf( QList<CalypAppModuleIf*> pcCurrModuleIfList, bool isPlaying = false,
|
|
||||||
bool disableThreads = false );
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QWidget* m_pcParent;
|
QWidget* m_pcParent;
|
||||||
SubWindowHandle* m_pcMainWindowManager;
|
SubWindowHandle* m_pcMainWindowManager;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,8 +24,11 @@
|
|||||||
|
|
||||||
#include "PlotSubWindow.h"
|
#include "PlotSubWindow.h"
|
||||||
|
|
||||||
|
#include <QGuiApplication>
|
||||||
|
#include <QScreen>
|
||||||
|
#include <QSize>
|
||||||
|
|
||||||
#include "qcustomplot.h"
|
#include "qcustomplot.h"
|
||||||
//#include "external/qcustomplot/qcustomplot.h"
|
|
||||||
|
|
||||||
void PlotSubWindow::definePlotColors()
|
void PlotSubWindow::definePlotColors()
|
||||||
{
|
{
|
||||||
@@ -174,7 +177,7 @@ QSize PlotSubWindow::sizeHint() const
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
maxSize = QApplication::desktop()->availableGeometry().size();
|
maxSize = QGuiApplication::screens()[0]->availableGeometry().size();
|
||||||
}
|
}
|
||||||
return sizeHint( maxSize );
|
return sizeHint( maxSize );
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,12 +25,12 @@
|
|||||||
#ifndef __PLOTWINDOWHANDLE_H__
|
#ifndef __PLOTWINDOWHANDLE_H__
|
||||||
#define __PLOTWINDOWHANDLE_H__
|
#define __PLOTWINDOWHANDLE_H__
|
||||||
|
|
||||||
|
#include <QtWidgets>
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "SubWindowAbstract.h"
|
#include "SubWindowAbstract.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <QtWidgets>
|
|
||||||
|
|
||||||
class QCustomPlot;
|
class QCustomPlot;
|
||||||
|
|
||||||
class PlotSubWindow : public SubWindowAbstract
|
class PlotSubWindow : public SubWindowAbstract
|
||||||
|
|||||||
+11
-13
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,15 +24,14 @@
|
|||||||
|
|
||||||
#include "QualityHandle.h"
|
#include "QualityHandle.h"
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
#include "PlotSubWindow.h"
|
#include "PlotSubWindow.h"
|
||||||
#include "ProgressBar.h"
|
#include "ProgressBar.h"
|
||||||
|
#include "QtConcurrent/qtconcurrentrun.h"
|
||||||
#include "SubWindowHandle.h"
|
#include "SubWindowHandle.h"
|
||||||
#include "SubWindowSelectorDialog.h"
|
#include "SubWindowSelectorDialog.h"
|
||||||
#include "VideoSubWindow.h"
|
#include "VideoSubWindow.h"
|
||||||
#include "lib/LibMemory.h"
|
|
||||||
|
|
||||||
#include <QtGui>
|
|
||||||
#include "QtConcurrent/qtconcurrentrun.h"
|
|
||||||
|
|
||||||
QualityHandle::QualityHandle( QWidget* parent, SubWindowHandle* windowManager )
|
QualityHandle::QualityHandle( QWidget* parent, SubWindowHandle* windowManager )
|
||||||
: m_pcParet( parent ), m_pcMainWindowManager( windowManager )
|
: m_pcParet( parent ), m_pcMainWindowManager( windowManager )
|
||||||
@@ -157,8 +156,8 @@ void QualityHandle::update( VideoSubWindow* currSubWindow )
|
|||||||
void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
|
void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
|
||||||
{
|
{
|
||||||
unsigned numberOfWindows = apcWindowList.size();
|
unsigned numberOfWindows = apcWindowList.size();
|
||||||
ClpULong currFrames = 0;
|
std::uint64_t currFrames = 0;
|
||||||
ClpULong numberOfFrames = -1;
|
std::uint64_t numberOfFrames = -1;
|
||||||
|
|
||||||
//! Check reference window
|
//! Check reference window
|
||||||
for( unsigned i = 0; i < numberOfWindows; i++ )
|
for( unsigned i = 0; i < numberOfWindows; i++ )
|
||||||
@@ -170,10 +169,10 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
|
|||||||
}
|
}
|
||||||
VideoSubWindow* pcReferenceWindow = apcWindowList.at( 0 )->getRefSubWindow();
|
VideoSubWindow* pcReferenceWindow = apcWindowList.at( 0 )->getRefSubWindow();
|
||||||
|
|
||||||
numberOfFrames = pcReferenceWindow->getInputStream()->getFrameNum();
|
numberOfFrames = pcReferenceWindow->getFrameNum();
|
||||||
for( unsigned i = 0; i < numberOfWindows; i++ )
|
for( unsigned i = 0; i < numberOfWindows; i++ )
|
||||||
{
|
{
|
||||||
currFrames = apcWindowList.at( i )->getInputStream()->getFrameNum();
|
currFrames = apcWindowList.at( i )->getFrameNum();
|
||||||
if( currFrames < numberOfFrames )
|
if( currFrames < numberOfFrames )
|
||||||
numberOfFrames = currFrames;
|
numberOfFrames = currFrames;
|
||||||
apcWindowList.at( i )->stop();
|
apcWindowList.at( i )->stop();
|
||||||
@@ -184,7 +183,6 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
|
|||||||
|
|
||||||
QVector<double>* padQualityValues = new QVector<double>[numberOfWindows + 1];
|
QVector<double>* padQualityValues = new QVector<double>[numberOfWindows + 1];
|
||||||
double* padAverageQuality = new double[numberOfWindows + 1];
|
double* padAverageQuality = new double[numberOfWindows + 1];
|
||||||
double dCurrentQuality;
|
|
||||||
|
|
||||||
for( unsigned i = 0; i < numberOfWindows + 1; i++ )
|
for( unsigned i = 0; i < numberOfWindows + 1; i++ )
|
||||||
{
|
{
|
||||||
@@ -200,12 +198,12 @@ void QualityHandle::measureQuality( QVector<VideoSubWindow*> apcWindowList )
|
|||||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||||
{
|
{
|
||||||
pcCurrFrame = apcWindowList.at( i )->getCurrFrame();
|
pcCurrFrame = apcWindowList.at( i )->getCurrFrame();
|
||||||
dCurrentQuality = pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, CLP_LUMA );
|
double dCurrentQuality = pcCurrFrame->getQuality( m_iQualityMetricIdx, pcReferenceFrame, CLP_LUMA );
|
||||||
padAverageQuality[i + 1] = ( padAverageQuality[i + 1] * double( f ) + dCurrentQuality ) / double( f + 1 );
|
padAverageQuality[i + 1] = ( padAverageQuality[i + 1] * double( f ) + dCurrentQuality ) / double( f + 1 );
|
||||||
padQualityValues[i + 1].append( dCurrentQuality );
|
padQualityValues[i + 1].append( dCurrentQuality );
|
||||||
apcWindowList.at( i )->seekRelativeEvent( true );
|
apcWindowList.at( i )->advanceOneFrame();
|
||||||
}
|
}
|
||||||
pcReferenceWindow->seekRelativeEvent( true );
|
pcReferenceWindow->advanceOneFrame();
|
||||||
pcProgressBar->incrementProgress( 1 );
|
pcProgressBar->incrementProgress( 1 );
|
||||||
}
|
}
|
||||||
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
for( unsigned int i = 0; i < numberOfWindows; i++ )
|
||||||
|
|||||||
+3
-2
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,10 +25,11 @@
|
|||||||
#ifndef __QUALITYMEASUREMENT_H__
|
#ifndef __QUALITYMEASUREMENT_H__
|
||||||
#define __QUALITYMEASUREMENT_H__
|
#define __QUALITYMEASUREMENT_H__
|
||||||
|
|
||||||
|
#include <QFuture>
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "QFuture"
|
|
||||||
#include "QualityMeasurementSidebar.h"
|
#include "QualityMeasurementSidebar.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,167 @@
|
|||||||
|
/* This file is a part of Calyp project
|
||||||
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
|
* Joao Santos (joaompssantos@gmail.com)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file ResourceHandle.cpp
|
||||||
|
* \brief Handle resources
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ResourceHandle.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QEvent>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QThread>
|
||||||
|
#include <chrono>
|
||||||
|
#include <iostream>
|
||||||
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
|
ResourceWorker::ResourceWorker( std::shared_ptr<CalypStream> stream )
|
||||||
|
{
|
||||||
|
m_pcStream = stream;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResourceWorker::stop()
|
||||||
|
{
|
||||||
|
m_bStop = true;
|
||||||
|
wake();
|
||||||
|
wait();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResourceWorker::wake()
|
||||||
|
{
|
||||||
|
m_Mutex.lock();
|
||||||
|
m_ResourceIdle.wakeAll();
|
||||||
|
m_Mutex.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResourceWorker::run()
|
||||||
|
{
|
||||||
|
m_bStop = false;
|
||||||
|
// Loop forever
|
||||||
|
while( !m_bStop )
|
||||||
|
{
|
||||||
|
//auto start = std::chrono::steady_clock::now();
|
||||||
|
m_pcStream->readNextFrameFillRGBBuffer();
|
||||||
|
// auto end = std::chrono::steady_clock::now();
|
||||||
|
// std::cout << "Elapsed time reading and processing a frame: "
|
||||||
|
// << std::chrono::duration_cast<std::chrono::milliseconds>( end - start ).count()
|
||||||
|
// << " ms" << std::endl;
|
||||||
|
|
||||||
|
// if( !m_pcStream->hasWritingSlot() )
|
||||||
|
// {
|
||||||
|
// m_Mutex.lock();
|
||||||
|
// m_ResourceIdle.wait( &m_Mutex );
|
||||||
|
// m_Mutex.unlock();
|
||||||
|
// }
|
||||||
|
while( !m_bStop && !m_pcStream->hasWritingSlot() )
|
||||||
|
{
|
||||||
|
// Wait here
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourceHandle::ResourceHandle()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ResourceHandle::addResource() -> std::size_t
|
||||||
|
{
|
||||||
|
auto resource_id = unique_id;
|
||||||
|
unique_id++;
|
||||||
|
auto newStreamResource = std::make_shared<CalypStream>();
|
||||||
|
auto newStreamResourceWorker = std::make_unique<ResourceWorker>( newStreamResource );
|
||||||
|
m_apcStreamResourcesList[resource_id] = newStreamResource;
|
||||||
|
m_apcStreamResourcesWorkersList[resource_id] = std::move( newStreamResourceWorker );
|
||||||
|
return resource_id;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ResourceHandle::getResource( CalypStream* ptr ) -> std::size_t
|
||||||
|
{
|
||||||
|
if( ptr != nullptr )
|
||||||
|
{
|
||||||
|
for( std::size_t i = 0; i < m_apcStreamResourcesList.size(); i++ )
|
||||||
|
{
|
||||||
|
if( m_apcStreamResourcesList[i].get() == ptr )
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return addResource();
|
||||||
|
}
|
||||||
|
|
||||||
|
auto ResourceHandle::getResourceAsset( std::size_t id ) -> CalypStream*
|
||||||
|
{
|
||||||
|
if( m_apcStreamResourcesWorkersList.count( id ) )
|
||||||
|
{
|
||||||
|
return m_apcStreamResourcesList[id].get();
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResourceHandle::removeResource( std::size_t id )
|
||||||
|
{
|
||||||
|
if( !m_apcStreamResourcesWorkersList.count( id ) )
|
||||||
|
{
|
||||||
|
assert( false );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove worker first
|
||||||
|
m_apcStreamResourcesWorkersList[id]->stop();
|
||||||
|
m_apcStreamResourcesWorkersList[id] = nullptr;
|
||||||
|
|
||||||
|
// Then the underlying stream
|
||||||
|
m_apcStreamResourcesList[id] = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResourceHandle::stopResourceWorker( std::size_t id )
|
||||||
|
{
|
||||||
|
if( !m_apcStreamResourcesWorkersList.count( id ) )
|
||||||
|
{
|
||||||
|
assert( false );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_apcStreamResourcesWorkersList[id]->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResourceHandle::startResourceWorker( std::size_t id )
|
||||||
|
{
|
||||||
|
if( !m_apcStreamResourcesWorkersList.count( id ) )
|
||||||
|
{
|
||||||
|
assert( false );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_apcStreamResourcesWorkersList[id]->setObjectName(
|
||||||
|
"RW-" +
|
||||||
|
QFileInfo( QString::fromStdString( m_apcStreamResourcesList[id]->getFileName() ) ).completeBaseName() );
|
||||||
|
m_apcStreamResourcesWorkersList[id]->start();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ResourceHandle::wakeResourceWorker( std::size_t id )
|
||||||
|
{
|
||||||
|
if( !m_apcStreamResourcesWorkersList.count( id ) )
|
||||||
|
{
|
||||||
|
assert( false );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_apcStreamResourcesWorkersList[id]->wake();
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
/* This file is a part of Calyp project
|
||||||
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file ResourceHandle.h
|
||||||
|
* \brief Handle multiple sub-windows
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __RESOURCEHANDLE_H__
|
||||||
|
#define __RESOURCEHANDLE_H__
|
||||||
|
|
||||||
|
#include <QMutex>
|
||||||
|
#include <QThread>
|
||||||
|
#include <QVector>
|
||||||
|
#include <QWaitCondition>
|
||||||
|
|
||||||
|
#include "CommonDefs.h"
|
||||||
|
#include "lib/CalypStream.h"
|
||||||
|
|
||||||
|
class ResourceWorker : public QThread
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
QMutex m_Mutex;
|
||||||
|
QWaitCondition m_ResourceIdle;
|
||||||
|
std::shared_ptr<CalypStream> m_pcStream;
|
||||||
|
bool m_bStop{ false };
|
||||||
|
|
||||||
|
public:
|
||||||
|
ResourceWorker( std::shared_ptr<CalypStream> stream );
|
||||||
|
void stop();
|
||||||
|
void wake();
|
||||||
|
void run();
|
||||||
|
};
|
||||||
|
|
||||||
|
class ResourceHandle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ResourceHandle();
|
||||||
|
~ResourceHandle() = default;
|
||||||
|
|
||||||
|
auto getResource( CalypStream* ptr ) -> std::size_t;
|
||||||
|
auto getResourceAsset( std::size_t id ) -> CalypStream*;
|
||||||
|
void removeResource( std::size_t id );
|
||||||
|
void stopResourceWorker( std::size_t id );
|
||||||
|
void startResourceWorker( std::size_t id );
|
||||||
|
void wakeResourceWorker( std::size_t id );
|
||||||
|
|
||||||
|
private:
|
||||||
|
auto addResource() -> std::size_t;
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::size_t unique_id{ 0 };
|
||||||
|
std::map<std::size_t, std::shared_ptr<CalypStream>> m_apcStreamResourcesList;
|
||||||
|
std::map<std::size_t, std::unique_ptr<ResourceWorker>> m_apcStreamResourcesWorkersList;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // __RESOURCEHANDLE_H__
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,14 +24,16 @@
|
|||||||
|
|
||||||
#include "SubWindowAbstract.h"
|
#include "SubWindowAbstract.h"
|
||||||
|
|
||||||
#include "MdiSubWindow.h"
|
|
||||||
|
|
||||||
#include <QCloseEvent>
|
#include <QCloseEvent>
|
||||||
#include <QFocusEvent>
|
#include <QFocusEvent>
|
||||||
|
#include <QGuiApplication>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QIcon>
|
#include <QIcon>
|
||||||
|
#include <QScreen>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
|
||||||
|
#include "MdiSubWindow.h"
|
||||||
|
|
||||||
SubWindowAbstract::SubWindowAbstract( QWidget* parent, unsigned int category )
|
SubWindowAbstract::SubWindowAbstract( QWidget* parent, unsigned int category )
|
||||||
: QWidget( parent ), m_cSubWindow( NULL )
|
: QWidget( parent ), m_cSubWindow( NULL )
|
||||||
{
|
{
|
||||||
@@ -40,7 +42,7 @@ SubWindowAbstract::SubWindowAbstract( QWidget* parent, unsigned int category )
|
|||||||
// setFocusPolicy( Qt::WheelFocus );
|
// setFocusPolicy( Qt::WheelFocus );
|
||||||
setFocusPolicy( Qt::StrongFocus );
|
setFocusPolicy( Qt::StrongFocus );
|
||||||
setAttribute( Qt::WA_DeleteOnClose );
|
setAttribute( Qt::WA_DeleteOnClose );
|
||||||
setBackgroundRole( QPalette::Background );
|
setBackgroundRole( QPalette::Window );
|
||||||
|
|
||||||
setWindowIcon( QIcon( ":/logos/calyp-icon.png" ) );
|
setWindowIcon( QIcon( ":/logos/calyp-icon.png" ) );
|
||||||
|
|
||||||
@@ -87,10 +89,20 @@ bool SubWindowAbstract::mayClose()
|
|||||||
|
|
||||||
QSize SubWindowAbstract::sizeHint() const
|
QSize SubWindowAbstract::sizeHint() const
|
||||||
{
|
{
|
||||||
return QSize();
|
QSize maxSize;
|
||||||
|
QWidget* p = parentWidget();
|
||||||
|
if( p )
|
||||||
|
{
|
||||||
|
maxSize = p->size();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
maxSize = QGuiApplication::screens()[0]->availableGeometry().size();
|
||||||
|
}
|
||||||
|
return sizeHint( maxSize );
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize SubWindowAbstract::sizeHint( const QSize& ) const
|
QSize SubWindowAbstract::sizeHint( const QSize& maxSize ) const
|
||||||
{
|
{
|
||||||
return QSize();
|
return QSize();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -41,6 +41,7 @@
|
|||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
@@ -106,7 +107,7 @@ public:
|
|||||||
* Size related functions
|
* Size related functions
|
||||||
*/
|
*/
|
||||||
virtual QSize sizeHint() const;
|
virtual QSize sizeHint() const;
|
||||||
virtual QSize sizeHint( const QSize& ) const;
|
virtual QSize sizeHint( const QSize& maxSize ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Window name
|
* Window name
|
||||||
|
|||||||
+29
-12
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
* Joao Santos (joaompssantos@gmail.com)
|
* Joao Santos (joaompssantos@gmail.com)
|
||||||
*
|
*
|
||||||
@@ -25,29 +25,31 @@
|
|||||||
|
|
||||||
#include "SubWindowHandle.h"
|
#include "SubWindowHandle.h"
|
||||||
|
|
||||||
#include "MainWindow.h"
|
|
||||||
#include "MdiSubWindow.h"
|
|
||||||
#include "SubWindowAbstract.h"
|
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QActionGroup>
|
#include <QActionGroup>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDesktopWidget>
|
#include <QDesktopWidget>
|
||||||
|
#include <QGuiApplication>
|
||||||
#include <QHBoxLayout>
|
#include <QHBoxLayout>
|
||||||
#include <QMdiArea>
|
#include <QMdiArea>
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPainter>
|
#include <QPainter>
|
||||||
|
#include <QScreen>
|
||||||
#include <QSettings>
|
#include <QSettings>
|
||||||
#include <QSignalMapper>
|
#include <QSignalMapper>
|
||||||
#include <QStyle>
|
#include <QStyle>
|
||||||
|
|
||||||
|
#include "MainWindow.h"
|
||||||
|
#include "MdiSubWindow.h"
|
||||||
|
#include "SubWindowAbstract.h"
|
||||||
|
|
||||||
class MdiArea : public QMdiArea
|
class MdiArea : public QMdiArea
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MdiArea( QWidget* parent = 0 )
|
MdiArea( QWidget* parent = 0 )
|
||||||
: QMdiArea( parent ), m_pixmapLogo( ":/logos/calyp-logo.png" )
|
: QMdiArea( parent ), m_pixmapLogo( ":/logos/calyp-logo.png" )
|
||||||
{
|
{
|
||||||
setBackgroundRole( QPalette::Background );
|
setBackgroundRole( QPalette::Window );
|
||||||
}
|
}
|
||||||
|
|
||||||
void appendLogMessage( const QString& msg )
|
void appendLogMessage( const QString& msg )
|
||||||
@@ -154,7 +156,7 @@ void SubWindowHandle::setWindowMode( int iWindowMode )
|
|||||||
parentWidget()->update();
|
parentWidget()->update();
|
||||||
m_pcApp->showNormal();
|
m_pcApp->showNormal();
|
||||||
qApp->processEvents();
|
qApp->processEvents();
|
||||||
QSize screenSize = QApplication::desktop()->availableGeometry().size();
|
QSize screenSize = QGuiApplication::screens()[0]->availableGeometry().size();
|
||||||
m_pcApp->move( 0, 0 );
|
m_pcApp->move( 0, 0 );
|
||||||
m_pcApp->resize( screenSize.width(), 5 );
|
m_pcApp->resize( screenSize.width(), 5 );
|
||||||
m_pcApp->setWindowTitle( QApplication::applicationName() );
|
m_pcApp->setWindowTitle( QApplication::applicationName() );
|
||||||
@@ -180,6 +182,10 @@ void SubWindowHandle::setWindowMode( int iWindowMode )
|
|||||||
{
|
{
|
||||||
m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + m_pcActiveWindow->getWindowName() );
|
m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + m_pcActiveWindow->getWindowName() );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pcApp->setWindowTitle( QApplication::applicationName() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_iWindowMode = iWindowMode;
|
m_iWindowMode = iWindowMode;
|
||||||
// tileSubWindows();
|
// tileSubWindows();
|
||||||
@@ -216,6 +222,10 @@ void SubWindowHandle::updateActiveSubWindow( SubWindowAbstract* window )
|
|||||||
{
|
{
|
||||||
m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + m_pcActiveWindow->getWindowName() );
|
m_pcApp->setWindowTitle( QApplication::applicationName() + " :: " + m_pcActiveWindow->getWindowName() );
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pcApp->setWindowTitle( QApplication::applicationName() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,12 +240,14 @@ void SubWindowHandle::addMdiSubWindow( SubWindowAbstract* window )
|
|||||||
SLOT( removeMdiSubWindow( MdiSubWindow* ) ) );
|
SLOT( removeMdiSubWindow( MdiSubWindow* ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void SubWindowHandle::addSubWindow( SubWindowAbstract* window, Qt::WindowFlags flags )
|
void SubWindowHandle::addSubWindow( SubWindowAbstract* window )
|
||||||
{
|
{
|
||||||
if( window )
|
if( window )
|
||||||
{
|
{
|
||||||
connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp, SLOT( printMessage( const QString& ) ) );
|
connect( window, SIGNAL( updateStatusBar( const QString& ) ), m_pcApp,
|
||||||
connect( window, SIGNAL( zoomFactorChanged( const double, const QPoint ) ), m_pcApp, SLOT( updateZoomFactorSBox() ) );
|
SLOT( printMessage( const QString& ) ) );
|
||||||
|
connect( window, SIGNAL( zoomFactorChanged( const double, const QPoint ) ), m_pcApp,
|
||||||
|
SLOT( updateZoomFactorSBox() ) );
|
||||||
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
|
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
|
||||||
{
|
{
|
||||||
connect( window, SIGNAL( aboutToActivate( SubWindowAbstract* ) ), this,
|
connect( window, SIGNAL( aboutToActivate( SubWindowAbstract* ) ), this,
|
||||||
@@ -274,7 +286,12 @@ void SubWindowHandle::removeSubWindow( int windowIdx )
|
|||||||
if( !m_apcSubWindowList.isEmpty() )
|
if( !m_apcSubWindowList.isEmpty() )
|
||||||
m_apcSubWindowList.front()->setFocus();
|
m_apcSubWindowList.front()->setFocus();
|
||||||
else
|
else
|
||||||
m_pcActiveWindow = NULL;
|
m_pcActiveWindow = nullptr;
|
||||||
|
|
||||||
|
if( m_pcActiveWindow == nullptr )
|
||||||
|
{
|
||||||
|
m_pcApp->setWindowTitle( QApplication::applicationName() );
|
||||||
|
}
|
||||||
|
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
@@ -378,7 +395,7 @@ void SubWindowHandle::tileSubWindows()
|
|||||||
|
|
||||||
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
|
if( m_iWindowMode == DETACHEDSUBWINDOWMODE )
|
||||||
{
|
{
|
||||||
QSize screenSize = QApplication::desktop()->availableGeometry().size();
|
QSize screenSize = QGuiApplication::screens()[0]->availableGeometry().size();
|
||||||
unsigned int minWindowsInRow = 1;
|
unsigned int minWindowsInRow = 1;
|
||||||
while( ( screenSize.width() / minWindowsInRow ) > 500 )
|
while( ( screenSize.width() / minWindowsInRow ) > 500 )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,12 +25,12 @@
|
|||||||
#ifndef __SUBWINDOWHANDLE_H__
|
#ifndef __SUBWINDOWHANDLE_H__
|
||||||
#define __SUBWINDOWHANDLE_H__
|
#define __SUBWINDOWHANDLE_H__
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "CommonDefs.h"
|
||||||
|
|
||||||
class QAction;
|
class QAction;
|
||||||
class QActionGroup;
|
class QActionGroup;
|
||||||
class QHBoxLayout;
|
class QHBoxLayout;
|
||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
|
|
||||||
void processLogMsg( const QString& msg );
|
void processLogMsg( const QString& msg );
|
||||||
|
|
||||||
void addSubWindow( SubWindowAbstract* widget, Qt::WindowFlags flags = 0 );
|
void addSubWindow( SubWindowAbstract* widget );
|
||||||
|
|
||||||
SubWindowAbstract* activeSubWindow() const;
|
SubWindowAbstract* activeSubWindow() const;
|
||||||
|
|
||||||
|
|||||||
+149
-115
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,37 +24,39 @@
|
|||||||
|
|
||||||
#include "VideoHandle.h"
|
#include "VideoHandle.h"
|
||||||
|
|
||||||
|
#include <QDockWidget>
|
||||||
|
#include <QElapsedTimer>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QSignalMapper>
|
||||||
|
#include <QSlider>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QToolBar>
|
||||||
|
#include <QtGui>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
#include "FrameNumberWidget.h"
|
#include "FrameNumberWidget.h"
|
||||||
#include "FramePropertiesDock.h"
|
#include "FramePropertiesDock.h"
|
||||||
#include "MainWindow.h"
|
#include "MainWindow.h"
|
||||||
#include "SeekStreamDialog.h"
|
#include "SeekStreamDialog.h"
|
||||||
#include "SubWindowHandle.h"
|
#include "SubWindowHandle.h"
|
||||||
#include "SubWindowSelectorDialog.h"
|
#include "SubWindowSelectorDialog.h"
|
||||||
|
#include "VideoStreamSubWindow.h"
|
||||||
#include "VideoSubWindow.h"
|
#include "VideoSubWindow.h"
|
||||||
|
|
||||||
#include <QDockWidget>
|
|
||||||
#include <QElapsedTimer>
|
|
||||||
#include <QLabel>
|
|
||||||
#include <QSignalMapper>
|
|
||||||
#include <QSlider>
|
|
||||||
#include <QToolBar>
|
|
||||||
#include <QtGui>
|
|
||||||
#if( _CONTROL_PLAYING_TIME_ == 1 )
|
|
||||||
#include <QElapsedTimer>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
VideoHandle::VideoHandle( QWidget* parent, SubWindowHandle* windowManager )
|
VideoHandle::VideoHandle( QWidget* parent, SubWindowHandle* windowManager )
|
||||||
: m_pcParet( parent ), m_pcMainWindowManager( windowManager )
|
: m_pcParet( parent ), m_pcMainWindowManager( windowManager )
|
||||||
{
|
{
|
||||||
m_pcCurrentVideoSubWindow = NULL;
|
m_pcCurrentVideoSubWindow = NULL;
|
||||||
m_bIsPlaying = false;
|
m_bIsPlaying = false;
|
||||||
m_pcPlayingTimer = new QTimer;
|
m_pcPlayingTimer = new QTimer( this );
|
||||||
|
m_pcFrameRateFeedbackTimer = std::make_unique<QElapsedTimer>();
|
||||||
m_pcPlayingTimer->setTimerType( Qt::PreciseTimer );
|
m_pcPlayingTimer->setTimerType( Qt::PreciseTimer );
|
||||||
connect( m_pcPlayingTimer, SIGNAL( timeout() ), this, SLOT( playEvent() ) );
|
connect( m_pcPlayingTimer, &QTimer::timeout,
|
||||||
|
this, &VideoHandle::playEvent );
|
||||||
m_acPlayingSubWindows.clear();
|
m_acPlayingSubWindows.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoHandle::~VideoHandle() {}
|
VideoHandle::~VideoHandle() = default;
|
||||||
|
|
||||||
void VideoHandle::createActions()
|
void VideoHandle::createActions()
|
||||||
{
|
{
|
||||||
@@ -240,6 +242,12 @@ QWidget* VideoHandle::createStatusBarMessage()
|
|||||||
QWidget* pcStatusBarWidget = new QWidget;
|
QWidget* pcStatusBarWidget = new QWidget;
|
||||||
QHBoxLayout* mainlayout = new QHBoxLayout;
|
QHBoxLayout* mainlayout = new QHBoxLayout;
|
||||||
|
|
||||||
|
m_pcPlayingFPSLabel = new QLabel;
|
||||||
|
m_pcPlayingFPSLabel->setText( " " );
|
||||||
|
m_pcPlayingFPSLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
|
||||||
|
m_pcPlayingFPSLabel->setMinimumWidth( 150 );
|
||||||
|
m_pcPlayingFPSLabel->setAlignment( Qt::AlignCenter );
|
||||||
|
|
||||||
m_pcVideoFormatLabel = new QLabel;
|
m_pcVideoFormatLabel = new QLabel;
|
||||||
m_pcVideoFormatLabel->setText( " " );
|
m_pcVideoFormatLabel->setText( " " );
|
||||||
m_pcVideoFormatLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
|
m_pcVideoFormatLabel->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed ) );
|
||||||
@@ -252,6 +260,7 @@ QWidget* VideoHandle::createStatusBarMessage()
|
|||||||
m_pcResolutionLabel->setMinimumWidth( 90 );
|
m_pcResolutionLabel->setMinimumWidth( 90 );
|
||||||
m_pcResolutionLabel->setAlignment( Qt::AlignCenter );
|
m_pcResolutionLabel->setAlignment( Qt::AlignCenter );
|
||||||
|
|
||||||
|
mainlayout->addWidget( m_pcPlayingFPSLabel );
|
||||||
mainlayout->addWidget( m_pcVideoFormatLabel );
|
mainlayout->addWidget( m_pcVideoFormatLabel );
|
||||||
mainlayout->addWidget( m_pcResolutionLabel );
|
mainlayout->addWidget( m_pcResolutionLabel );
|
||||||
pcStatusBarWidget->setLayout( mainlayout );
|
pcStatusBarWidget->setLayout( mainlayout );
|
||||||
@@ -317,13 +326,16 @@ void VideoHandle::update()
|
|||||||
{
|
{
|
||||||
if( m_pcCurrentVideoSubWindow )
|
if( m_pcCurrentVideoSubWindow )
|
||||||
{
|
{
|
||||||
CalypStream* pcStream = m_pcCurrentVideoSubWindow->getInputStream();
|
bool isPlaying{ false };
|
||||||
CalypFrame* pcFrame = m_pcCurrentVideoSubWindow->getCurrFrame();
|
const CalypStream* pcStream{ nullptr };
|
||||||
|
if( auto* videoStreamSubWindow = qobject_cast<VideoStreamSubWindow*>( m_pcCurrentVideoSubWindow ) )
|
||||||
|
{
|
||||||
|
pcStream = videoStreamSubWindow->getInputStream();
|
||||||
|
isPlaying = videoStreamSubWindow->isPlaying();
|
||||||
|
}
|
||||||
|
auto pcFrame = m_pcCurrentVideoSubWindow->getCurrFrameAsset();
|
||||||
|
|
||||||
unsigned long frame_num = 0;
|
m_pcVideoFormatLabel->setText( m_pcCurrentVideoSubWindow->getVideoInformation() );
|
||||||
unsigned long total_frame_num = 1;
|
|
||||||
|
|
||||||
m_pcVideoFormatLabel->setText( m_pcCurrentVideoSubWindow->getStreamInformation() );
|
|
||||||
|
|
||||||
QString resolution;
|
QString resolution;
|
||||||
if( pcFrame )
|
if( pcFrame )
|
||||||
@@ -331,6 +343,8 @@ void VideoHandle::update()
|
|||||||
resolution.append( QString( "%1x%2" ).arg( pcFrame->getWidth() ).arg( pcFrame->getHeight() ) );
|
resolution.append( QString( "%1x%2" ).arg( pcFrame->getWidth() ).arg( pcFrame->getHeight() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unsigned long frame_num = 0;
|
||||||
|
unsigned long total_frame_num = 1;
|
||||||
if( pcStream )
|
if( pcStream )
|
||||||
{
|
{
|
||||||
frame_num = pcStream->getCurrFrameNum();
|
frame_num = pcStream->getCurrFrameNum();
|
||||||
@@ -355,8 +369,7 @@ void VideoHandle::update()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_pcResolutionLabel->setText( resolution );
|
m_pcResolutionLabel->setText( resolution );
|
||||||
|
m_pcFramePropertiesSideBar->setFrame( pcFrame, isPlaying );
|
||||||
m_pcFramePropertiesSideBar->setFrame( pcFrame );
|
|
||||||
|
|
||||||
m_pcFrameNumInfo->setTotalFrameNum( total_frame_num );
|
m_pcFrameNumInfo->setTotalFrameNum( total_frame_num );
|
||||||
m_pcFrameNumInfo->setCurrFrameNum( frame_num );
|
m_pcFrameNumInfo->setCurrFrameNum( frame_num );
|
||||||
@@ -366,6 +379,11 @@ void VideoHandle::update()
|
|||||||
m_pcFrameSlider->setValue( frame_num );
|
m_pcFrameSlider->setValue( frame_num );
|
||||||
m_pcFrameSlider->blockSignals( false );
|
m_pcFrameSlider->blockSignals( false );
|
||||||
|
|
||||||
|
if( m_uiRealAverageFrameRate > 0 )
|
||||||
|
{
|
||||||
|
m_pcPlayingFPSLabel->setText( QString( "%1 fps" ).arg( m_uiRealAverageFrameRate ) );
|
||||||
|
}
|
||||||
|
|
||||||
if( m_pcCurrentVideoSubWindow->isPlaying() )
|
if( m_pcCurrentVideoSubWindow->isPlaying() )
|
||||||
{
|
{
|
||||||
m_arrayActions[PLAY_ACT]->setText( "Pause" );
|
m_arrayActions[PLAY_ACT]->setText( "Pause" );
|
||||||
@@ -379,6 +397,7 @@ void VideoHandle::update()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_pcPlayingFPSLabel->setText( "" );
|
||||||
m_pcVideoFormatLabel->setText( "" );
|
m_pcVideoFormatLabel->setText( "" );
|
||||||
m_pcResolutionLabel->setText( "" );
|
m_pcResolutionLabel->setText( "" );
|
||||||
m_pcFramePropertiesSideBar->reset();
|
m_pcFramePropertiesSideBar->reset();
|
||||||
@@ -421,18 +440,21 @@ void VideoHandle::addSubWindow( VideoSubWindow* window )
|
|||||||
|
|
||||||
void VideoHandle::closeSubWindow( SubWindowAbstract* subWindow )
|
void VideoHandle::closeSubWindow( SubWindowAbstract* subWindow )
|
||||||
{
|
{
|
||||||
VideoSubWindow* videoSubWindow = qobject_cast<VideoSubWindow*>( subWindow );
|
auto* videoStreamSubWindow = qobject_cast<VideoStreamSubWindow*>( subWindow );
|
||||||
|
|
||||||
if( m_acPlayingSubWindows.contains( videoSubWindow ) )
|
if( m_acPlayingSubWindows.contains( videoStreamSubWindow ) )
|
||||||
{
|
{
|
||||||
int pos = m_acPlayingSubWindows.indexOf( videoSubWindow );
|
int pos = m_acPlayingSubWindows.indexOf( videoStreamSubWindow );
|
||||||
m_acPlayingSubWindows.at( pos )->stop();
|
|
||||||
m_acPlayingSubWindows.remove( pos );
|
m_acPlayingSubWindows.remove( pos );
|
||||||
if( m_acPlayingSubWindows.size() < 2 )
|
if( m_acPlayingSubWindows.size() < 2 )
|
||||||
{
|
{
|
||||||
m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false );
|
m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if( subWindow == m_pcCurrentVideoSubWindow )
|
||||||
|
{
|
||||||
|
m_pcFramePropertiesSideBar->reset();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoHandle::zoomToFactorAll( const double scale, const QPoint center )
|
void VideoHandle::zoomToFactorAll( const double scale, const QPoint center )
|
||||||
@@ -525,18 +547,18 @@ unsigned long VideoHandle::getMaxFrameNumber()
|
|||||||
unsigned long maxFrames = INT_MAX;
|
unsigned long maxFrames = INT_MAX;
|
||||||
if( m_pcCurrentVideoSubWindow )
|
if( m_pcCurrentVideoSubWindow )
|
||||||
{
|
{
|
||||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
if( m_acPlayingSubWindows.contains( qobject_cast<VideoStreamSubWindow*>( m_pcCurrentVideoSubWindow ) ) )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||||
{
|
{
|
||||||
currFrames = m_acPlayingSubWindows.at( i )->getInputStream()->getFrameNum();
|
currFrames = m_acPlayingSubWindows.at( i )->getFrameNum();
|
||||||
if( currFrames < maxFrames )
|
if( currFrames < maxFrames )
|
||||||
maxFrames = currFrames;
|
maxFrames = currFrames;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
maxFrames = m_pcCurrentVideoSubWindow->getInputStream()->getFrameNum();
|
maxFrames = m_pcCurrentVideoSubWindow->getFrameNum();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return maxFrames;
|
return maxFrames;
|
||||||
@@ -549,9 +571,9 @@ void VideoHandle::setTimerStatus()
|
|||||||
{
|
{
|
||||||
status |= m_acPlayingSubWindows.at( i )->isPlaying();
|
status |= m_acPlayingSubWindows.at( i )->isPlaying();
|
||||||
}
|
}
|
||||||
if( m_pcCurrentVideoSubWindow )
|
if( auto* videoStreamSubWindow = qobject_cast<VideoStreamSubWindow*>( m_pcCurrentVideoSubWindow ) )
|
||||||
{
|
{
|
||||||
status |= m_pcCurrentVideoSubWindow->isPlaying();
|
status |= videoStreamSubWindow->isPlaying();
|
||||||
}
|
}
|
||||||
if( status )
|
if( status )
|
||||||
{
|
{
|
||||||
@@ -559,42 +581,34 @@ void VideoHandle::setTimerStatus()
|
|||||||
{
|
{
|
||||||
m_pcPlayingTimer->start();
|
m_pcPlayingTimer->start();
|
||||||
m_bIsPlaying = true;
|
m_bIsPlaying = true;
|
||||||
#if( _CONTROL_PLAYING_TIME_ == 1 )
|
|
||||||
m_uiNumberPlayedFrames = 0;
|
m_uiNumberPlayedFrames = 0;
|
||||||
m_pcPlayControlTimer = new QElapsedTimer;
|
m_pcFrameRateFeedbackTimer->start();
|
||||||
m_pcPlayControlTimer->start();
|
m_uiRealAverageFrameRate = 0;
|
||||||
m_dAverageFps = 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if( _CONTROL_PLAYING_TIME_ == 1 )
|
|
||||||
if( m_pcPlayControlTimer && m_pcPlayingTimer->interval() > 0 )
|
|
||||||
{
|
|
||||||
qDebug() << "Desired Fps: " << 1000 / m_pcPlayingTimer->interval() << "Real Fps: " << 1000 / m_dAverageFps;
|
|
||||||
|
|
||||||
delete m_pcPlayControlTimer;
|
|
||||||
m_pcPlayControlTimer = NULL;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
m_pcPlayingTimer->stop();
|
m_pcPlayingTimer->stop();
|
||||||
m_bIsPlaying = false;
|
m_bIsPlaying = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoHandle::configureFrameRateTimer()
|
||||||
|
{
|
||||||
|
double frame_rate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate();
|
||||||
|
unsigned int time_ms = (unsigned int)( 1000.0 / frame_rate + 0.5 );
|
||||||
|
m_pcPlayingTimer->setInterval( time_ms );
|
||||||
|
}
|
||||||
|
|
||||||
void VideoHandle::play()
|
void VideoHandle::play()
|
||||||
{
|
{
|
||||||
if( !m_pcCurrentVideoSubWindow )
|
auto* videoStreamSubWindow = qobject_cast<VideoStreamSubWindow*>( m_pcCurrentVideoSubWindow );
|
||||||
|
|
||||||
|
if( videoStreamSubWindow == nullptr )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if( !m_pcCurrentVideoSubWindow->getInputStream() )
|
if( !videoStreamSubWindow->isPlaying() ) // Not playing
|
||||||
return;
|
|
||||||
|
|
||||||
if( !m_pcCurrentVideoSubWindow->isPlaying() ) // Not playing
|
|
||||||
{
|
{
|
||||||
double frameRate;
|
|
||||||
unsigned int timeinterval;
|
|
||||||
if( m_acPlayingSubWindows.size() < 2 )
|
if( m_acPlayingSubWindows.size() < 2 )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||||
@@ -602,22 +616,20 @@ void VideoHandle::play()
|
|||||||
m_acPlayingSubWindows.at( i )->pause();
|
m_acPlayingSubWindows.at( i )->pause();
|
||||||
}
|
}
|
||||||
m_acPlayingSubWindows.clear();
|
m_acPlayingSubWindows.clear();
|
||||||
m_acPlayingSubWindows.append( m_pcCurrentVideoSubWindow );
|
m_acPlayingSubWindows.append( videoStreamSubWindow );
|
||||||
}
|
}
|
||||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
if( m_acPlayingSubWindows.contains( videoStreamSubWindow ) )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||||
{
|
{
|
||||||
m_acPlayingSubWindows.at( i )->play();
|
m_acPlayingSubWindows.at( i )->play();
|
||||||
}
|
}
|
||||||
frameRate = m_acPlayingSubWindows.at( 0 )->getInputStream()->getFrameRate();
|
configureFrameRateTimer();
|
||||||
timeinterval = (unsigned int)( 1000.0 / frameRate + 0.5 );
|
|
||||||
m_pcPlayingTimer->setInterval( timeinterval );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
if( m_acPlayingSubWindows.contains( videoStreamSubWindow ) )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
||||||
{
|
{
|
||||||
@@ -626,21 +638,20 @@ void VideoHandle::play()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pcCurrentVideoSubWindow->pause();
|
videoStreamSubWindow->pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setTimerStatus();
|
setTimerStatus();
|
||||||
emit changed();
|
emit changed();
|
||||||
// update();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoHandle::stop()
|
void VideoHandle::stop()
|
||||||
{
|
{
|
||||||
if( m_acPlayingSubWindows.size() > 0 )
|
if( m_acPlayingSubWindows.size() > 0 )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
for( auto playingSubWindow : m_acPlayingSubWindows )
|
||||||
{
|
{
|
||||||
m_acPlayingSubWindows.at( i )->stop();
|
playingSubWindow->stop();
|
||||||
}
|
}
|
||||||
m_acPlayingSubWindows.clear();
|
m_acPlayingSubWindows.clear();
|
||||||
setTimerStatus();
|
setTimerStatus();
|
||||||
@@ -656,109 +667,134 @@ void VideoHandle::stop()
|
|||||||
m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false );
|
m_arrayActions[VIDEO_LOCK_ACT]->setVisible( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VideoHandle::calculateRealFrameRate()
|
||||||
|
{
|
||||||
|
double average_time_between_frames_ms = m_uiNumberPlayedFrames > 0 ? 1000.0 / m_uiRealAverageFrameRate : 0;
|
||||||
|
double time_elapsed_since_last_frame_ms = m_pcFrameRateFeedbackTimer->elapsed();
|
||||||
|
average_time_between_frames_ms = double( average_time_between_frames_ms * m_uiNumberPlayedFrames + time_elapsed_since_last_frame_ms ) / double( m_uiNumberPlayedFrames + 1 );
|
||||||
|
m_uiRealAverageFrameRate = 1000.0 / average_time_between_frames_ms;
|
||||||
|
m_uiNumberPlayedFrames++;
|
||||||
|
m_pcFrameRateFeedbackTimer->restart();
|
||||||
|
}
|
||||||
|
|
||||||
void VideoHandle::playEvent()
|
void VideoHandle::playEvent()
|
||||||
{
|
{
|
||||||
bool bEndOfSequence = false;
|
// auto start = std::chrono::steady_clock::now();
|
||||||
#if( _CONTROL_PLAYING_TIME_ == 1 )
|
|
||||||
m_dAverageFps = double( m_dAverageFps * m_uiNumberPlayedFrames + m_pcPlayControlTimer->elapsed() ) /
|
// This value should only be true if it is really needed to refresh the UI after this play event
|
||||||
double( m_uiNumberPlayedFrames + 1 );
|
// Lets assume the current window is not playing. Nothing changes in the UI expect the playing windows
|
||||||
m_uiNumberPlayedFrames++;
|
// So no changed is emmited
|
||||||
m_pcPlayControlTimer->restart();
|
bool bShouldRefreshUI = false;
|
||||||
#endif
|
calculateRealFrameRate();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
bool bEndOfSequence = false;
|
||||||
|
for( auto playingSubWindow : m_acPlayingSubWindows )
|
||||||
{
|
{
|
||||||
bEndOfSequence |= m_acPlayingSubWindows.at( i )->playEvent();
|
bEndOfSequence |= playingSubWindow->playEvent();
|
||||||
|
// If the current selected windows is playing then we need to refresh the UI
|
||||||
|
if( playingSubWindow == m_pcCurrentVideoSubWindow )
|
||||||
|
{
|
||||||
|
bShouldRefreshUI = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if( bEndOfSequence )
|
if( bEndOfSequence )
|
||||||
{
|
{
|
||||||
if( !m_arrayActions[VIDEO_REPEAT_ACT]->isChecked() )
|
if( !m_arrayActions[VIDEO_REPEAT_ACT]->isChecked() )
|
||||||
|
{
|
||||||
stop();
|
stop();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
{
|
||||||
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( 0 );
|
for( auto playingSubWindow : m_acPlayingSubWindows )
|
||||||
|
{
|
||||||
|
playingSubWindow->seekAbsoluteEvent( 0 );
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( const char* msg )
|
catch( const char* msg )
|
||||||
{
|
{
|
||||||
QString warningMsg = "Error while playing " +
|
QString warningMsg = "Error while playing " + m_pcCurrentVideoSubWindow->getWindowName() + " with the following error: \n" + msg;
|
||||||
QFileInfo( m_pcCurrentVideoSubWindow->getCurrentFileName() ).fileName() +
|
|
||||||
" with the following error: \n" + msg;
|
|
||||||
QMessageBox::warning( m_pcParet, QApplication::applicationName(), warningMsg );
|
QMessageBox::warning( m_pcParet, QApplication::applicationName(), warningMsg );
|
||||||
qDebug() << warningMsg;
|
qDebug() << warningMsg;
|
||||||
stop();
|
stop();
|
||||||
m_pcCurrentVideoSubWindow->close();
|
m_pcCurrentVideoSubWindow->close();
|
||||||
}
|
}
|
||||||
emit changed();
|
if( bShouldRefreshUI )
|
||||||
|
emit changed();
|
||||||
|
|
||||||
|
// auto end = std::chrono::steady_clock::now();
|
||||||
|
// std::cout << "Elapsed time going to next frame: "
|
||||||
|
// << std::chrono::duration_cast<std::chrono::milliseconds>( end - start ).count()
|
||||||
|
// << " ms" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoHandle::seekEvent( int direction )
|
void VideoHandle::seekEvent( int direction )
|
||||||
{
|
{
|
||||||
if( m_pcCurrentVideoSubWindow )
|
if( auto* videoStreamSubWindow = qobject_cast<VideoStreamSubWindow*>( m_pcCurrentVideoSubWindow ) )
|
||||||
{
|
{
|
||||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
if( m_acPlayingSubWindows.contains( videoStreamSubWindow ) )
|
||||||
{
|
{
|
||||||
if( !( (unsigned int)( m_pcCurrentVideoSubWindow->getInputStream()->getCurrFrameNum() + 1 ) >= getMaxFrameNumber() &&
|
if( !( (unsigned int)( videoStreamSubWindow->getInputStream()->getCurrFrameNum() + 1 ) >= getMaxFrameNumber() &&
|
||||||
direction > 0 ) )
|
direction > 0 ) )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
for( auto playingSubWindow : m_acPlayingSubWindows )
|
||||||
{
|
{
|
||||||
m_acPlayingSubWindows.at( i )->seekRelativeEvent( direction > 0 ? true : false );
|
playingSubWindow->seekRelativeEvent( direction > 0 ? true : false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pcCurrentVideoSubWindow->seekRelativeEvent( direction > 0 ? true : false );
|
videoStreamSubWindow->seekRelativeEvent( direction > 0 ? true : false );
|
||||||
}
|
}
|
||||||
emit changed();
|
emit changed();
|
||||||
// update();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoHandle::seekVideo()
|
void VideoHandle::seekVideo()
|
||||||
{
|
{
|
||||||
if( m_pcCurrentVideoSubWindow )
|
if( auto* videoStreamSubWindow = qobject_cast<VideoStreamSubWindow*>( m_pcCurrentVideoSubWindow ) )
|
||||||
{
|
{
|
||||||
if( m_pcCurrentVideoSubWindow->getInputStream() )
|
SeekStreamDialog* dialogSeekVideo = new SeekStreamDialog( videoStreamSubWindow->getInputStream(), m_pcParet );
|
||||||
|
int newFrameNum = dialogSeekVideo->runDialog();
|
||||||
|
if( newFrameNum >= 0 )
|
||||||
{
|
{
|
||||||
SeekStreamDialog* dialogSeekVideo =
|
if( m_acPlayingSubWindows.contains( videoStreamSubWindow ) )
|
||||||
new SeekStreamDialog( m_pcCurrentVideoSubWindow->getInputStream(), m_pcParet );
|
|
||||||
int newFrameNum = dialogSeekVideo->runDialog();
|
|
||||||
if( newFrameNum >= 0 )
|
|
||||||
{
|
{
|
||||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
for( auto playingSubWindow : m_acPlayingSubWindows )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
playingSubWindow->seekAbsoluteEvent( (unsigned int)newFrameNum );
|
||||||
{
|
|
||||||
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( (unsigned int)newFrameNum );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
m_pcCurrentVideoSubWindow->seekAbsoluteEvent( (unsigned int)newFrameNum );
|
|
||||||
}
|
|
||||||
emit changed();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
videoStreamSubWindow->seekAbsoluteEvent( (unsigned int)newFrameNum );
|
||||||
|
}
|
||||||
|
emit changed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void VideoHandle::seekSliderEvent( int new_frame_num )
|
void VideoHandle::seekSliderEvent( int new_frame_num )
|
||||||
{
|
{
|
||||||
if( m_pcCurrentVideoSubWindow && !m_bIsPlaying ) // TODO: Fix this slot
|
// TODO: Fix this slot
|
||||||
|
if( m_bIsPlaying )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if( auto* videoStreamSubWindow = qobject_cast<VideoStreamSubWindow*>( m_pcCurrentVideoSubWindow ) )
|
||||||
{
|
{
|
||||||
if( m_acPlayingSubWindows.contains( m_pcCurrentVideoSubWindow ) )
|
if( m_acPlayingSubWindows.contains( videoStreamSubWindow ) )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
for( auto playingSubWindow : m_acPlayingSubWindows )
|
||||||
{
|
{
|
||||||
m_acPlayingSubWindows.at( i )->seekAbsoluteEvent( (unsigned int)new_frame_num );
|
playingSubWindow->seekAbsoluteEvent( (unsigned int)new_frame_num );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_pcCurrentVideoSubWindow->seekAbsoluteEvent( (unsigned int)new_frame_num );
|
videoStreamSubWindow->seekAbsoluteEvent( (unsigned int)new_frame_num );
|
||||||
}
|
}
|
||||||
emit changed();
|
emit changed();
|
||||||
}
|
}
|
||||||
@@ -766,16 +802,14 @@ void VideoHandle::seekSliderEvent( int new_frame_num )
|
|||||||
|
|
||||||
void VideoHandle::videoSelectionButtonEvent()
|
void VideoHandle::videoSelectionButtonEvent()
|
||||||
{
|
{
|
||||||
VideoSubWindow* videoSubWindow;
|
|
||||||
|
|
||||||
Qt::KeyboardModifiers keyModifiers = QApplication::keyboardModifiers();
|
Qt::KeyboardModifiers keyModifiers = QApplication::keyboardModifiers();
|
||||||
if( keyModifiers & Qt::ControlModifier )
|
if( keyModifiers & Qt::ControlModifier )
|
||||||
{
|
{
|
||||||
QList<SubWindowAbstract*> subWindowList =
|
QList<SubWindowAbstract*> subWindowList =
|
||||||
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
m_pcMainWindowManager->findSubWindow( SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
||||||
for( int i = 0; i < subWindowList.size(); i++ )
|
for( auto subWindow : subWindowList )
|
||||||
{
|
{
|
||||||
videoSubWindow = qobject_cast<VideoSubWindow*>( subWindowList.at( i ) );
|
auto* videoSubWindow = qobject_cast<VideoStreamSubWindow*>( subWindow );
|
||||||
m_acPlayingSubWindows.append( videoSubWindow );
|
m_acPlayingSubWindows.append( videoSubWindow );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -784,18 +818,18 @@ void VideoHandle::videoSelectionButtonEvent()
|
|||||||
SubWindowSelectorDialog dialogWindowsSelection( m_pcParet, m_pcMainWindowManager,
|
SubWindowSelectorDialog dialogWindowsSelection( m_pcParet, m_pcMainWindowManager,
|
||||||
SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
SubWindowAbstract::VIDEO_STREAM_SUBWINDOW );
|
||||||
QStringList cWindowListNames;
|
QStringList cWindowListNames;
|
||||||
for( int i = 0; i < m_acPlayingSubWindows.size(); i++ )
|
for( auto playingSubWindow : m_acPlayingSubWindows )
|
||||||
{
|
{
|
||||||
dialogWindowsSelection.selectSubWindow( m_acPlayingSubWindows.at( i ) );
|
dialogWindowsSelection.selectSubWindow( playingSubWindow );
|
||||||
}
|
}
|
||||||
if( dialogWindowsSelection.exec() == QDialog::Accepted )
|
if( dialogWindowsSelection.exec() == QDialog::Accepted )
|
||||||
{
|
{
|
||||||
m_acPlayingSubWindows.clear();
|
m_acPlayingSubWindows.clear();
|
||||||
|
|
||||||
QList<SubWindowAbstract*> selectedSubWindowList = dialogWindowsSelection.getSelectedWindows();
|
QList<SubWindowAbstract*> selectedSubWindowList = dialogWindowsSelection.getSelectedWindows();
|
||||||
for( int i = 0; i < selectedSubWindowList.size(); i++ )
|
for( auto window : selectedSubWindowList )
|
||||||
{
|
{
|
||||||
videoSubWindow = qobject_cast<VideoSubWindow*>( selectedSubWindowList.at( i ) );
|
auto* videoSubWindow = qobject_cast<VideoStreamSubWindow*>( window );
|
||||||
m_acPlayingSubWindows.append( videoSubWindow );
|
m_acPlayingSubWindows.append( videoSubWindow );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -807,7 +841,7 @@ void VideoHandle::videoSelectionButtonEvent()
|
|||||||
|
|
||||||
if( m_acPlayingSubWindows.size() > 0 )
|
if( m_acPlayingSubWindows.size() > 0 )
|
||||||
{
|
{
|
||||||
m_acPlayingSubWindows.at( 0 )->activateWindow();
|
m_acPlayingSubWindows.front()->activateWindow();
|
||||||
if( m_acPlayingSubWindows.size() > 1 )
|
if( m_acPlayingSubWindows.size() > 1 )
|
||||||
{
|
{
|
||||||
m_arrayActions[VIDEO_LOCK_ACT]->setVisible( true );
|
m_arrayActions[VIDEO_LOCK_ACT]->setVisible( true );
|
||||||
|
|||||||
+17
-14
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,29 +25,29 @@
|
|||||||
#ifndef __VIDEOHANDLE_H__
|
#ifndef __VIDEOHANDLE_H__
|
||||||
#define __VIDEOHANDLE_H__
|
#define __VIDEOHANDLE_H__
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include <QElapsedTimer>
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QMenu>
|
#include <QMenu>
|
||||||
#include <QPoint>
|
#include <QPoint>
|
||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
//#define _CONTROL_PLAYING_TIME_ 1
|
#include "CommonDefs.h"
|
||||||
|
#include "VideoSubWindow.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
class QToolBar;
|
class QToolBar;
|
||||||
class QDockWidget;
|
class QDockWidget;
|
||||||
class QSignalMapper;
|
class QSignalMapper;
|
||||||
class QLabel;
|
class QLabel;
|
||||||
class QSlider;
|
class QSlider;
|
||||||
class QElapsedTimer;
|
|
||||||
|
|
||||||
class SubWindowHandle;
|
class SubWindowHandle;
|
||||||
class SubWindowAbstract;
|
class SubWindowAbstract;
|
||||||
class VideoSubWindow;
|
class VideoStreamSubWindow;
|
||||||
class FramePropertiesDock;
|
class FramePropertiesDock;
|
||||||
class FrameNumberWidget;
|
class FrameNumberWidget;
|
||||||
|
class QTimer;
|
||||||
|
|
||||||
class VideoHandle : public QObject
|
class VideoHandle : public QObject
|
||||||
{
|
{
|
||||||
@@ -113,21 +113,22 @@ private:
|
|||||||
QDockWidget* m_pcFramePropertiesDock;
|
QDockWidget* m_pcFramePropertiesDock;
|
||||||
FramePropertiesDock* m_pcFramePropertiesSideBar;
|
FramePropertiesDock* m_pcFramePropertiesSideBar;
|
||||||
|
|
||||||
|
QLabel* m_pcPlayingFPSLabel;
|
||||||
QLabel* m_pcVideoFormatLabel;
|
QLabel* m_pcVideoFormatLabel;
|
||||||
QLabel* m_pcResolutionLabel;
|
QLabel* m_pcResolutionLabel;
|
||||||
|
|
||||||
VideoSubWindow* m_pcCurrentVideoSubWindow;
|
QPointer<VideoSubWindow> m_pcCurrentVideoSubWindow;
|
||||||
QVector<VideoSubWindow*> m_acPlayingSubWindows;
|
QVector<VideoStreamSubWindow*> m_acPlayingSubWindows;
|
||||||
|
|
||||||
QTimer* m_pcPlayingTimer;
|
QTimer* m_pcPlayingTimer;
|
||||||
bool m_bIsPlaying;
|
bool m_bIsPlaying;
|
||||||
|
|
||||||
#if( _CONTROL_PLAYING_TIME_ == 1 )
|
unsigned int m_uiNumberPlayedFrames{ 0 };
|
||||||
unsigned int m_uiNumberPlayedFrames;
|
unsigned int m_uiRealAverageFrameRate{ 0 };
|
||||||
double m_dAverageFps;
|
std::unique_ptr<QElapsedTimer> m_pcFrameRateFeedbackTimer;
|
||||||
QElapsedTimer* m_pcPlayControlTimer;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
void configureFrameRateTimer();
|
||||||
|
void calculateRealFrameRate();
|
||||||
unsigned long getMaxFrameNumber();
|
unsigned long getMaxFrameNumber();
|
||||||
void setTimerStatus();
|
void setTimerStatus();
|
||||||
|
|
||||||
@@ -140,8 +141,10 @@ private Q_SLOTS:
|
|||||||
void closeSubWindow( SubWindowAbstract* subWindow );
|
void closeSubWindow( SubWindowAbstract* subWindow );
|
||||||
void zoomToFactorAll( const double factor, const QPoint center = QPoint() );
|
void zoomToFactorAll( const double factor, const QPoint center = QPoint() );
|
||||||
void moveAllScrollBars( const double&, const double& );
|
void moveAllScrollBars( const double&, const double& );
|
||||||
|
|
||||||
void play();
|
void play();
|
||||||
void stop();
|
void stop();
|
||||||
|
|
||||||
void playEvent();
|
void playEvent();
|
||||||
void seekSliderEvent( int new_frame_num );
|
void seekSliderEvent( int new_frame_num );
|
||||||
void seekEvent( int direction );
|
void seekEvent( int direction );
|
||||||
|
|||||||
@@ -0,0 +1,595 @@
|
|||||||
|
/* This file is a part of Calyp project
|
||||||
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file VideoStreamSubWindow.cpp
|
||||||
|
* \brief Video Sub windows handling
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "VideoStreamSubWindow.h"
|
||||||
|
|
||||||
|
#include <QScrollArea>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QStaticText>
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "ConfigureFormatDialog.h"
|
||||||
|
#include "ModulesHandle.h"
|
||||||
|
#include "QtConcurrent/qtconcurrentrun.h"
|
||||||
|
#include "ResourceHandle.h"
|
||||||
|
#include "SubWindowAbstract.h"
|
||||||
|
|
||||||
|
#define QT_NO_CONCURRENT
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief Functions to control data stream from stream information
|
||||||
|
*/
|
||||||
|
|
||||||
|
QDataStream& operator<<( QDataStream& out, const CalypFileInfoVector& array )
|
||||||
|
{
|
||||||
|
CalypFileInfo d;
|
||||||
|
out << array.size();
|
||||||
|
for( int i = 0; i < array.size(); i++ )
|
||||||
|
{
|
||||||
|
d = array.at( i );
|
||||||
|
out << d.m_cFilename << d.m_uiWidth << d.m_uiHeight << d.m_iPelFormat << d.m_uiBitsPelPixel << d.m_iEndianness
|
||||||
|
<< d.m_uiFrameRate << d.m_uiFileSize;
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
}
|
||||||
|
|
||||||
|
QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& array )
|
||||||
|
{
|
||||||
|
CalypFileInfo d;
|
||||||
|
int array_size{ 0 };
|
||||||
|
in >> array_size;
|
||||||
|
for( int i = 0; i < array_size; i++ )
|
||||||
|
{
|
||||||
|
in >> d.m_cFilename;
|
||||||
|
in >> d.m_uiWidth;
|
||||||
|
in >> d.m_uiHeight;
|
||||||
|
in >> d.m_iPelFormat;
|
||||||
|
in >> d.m_uiBitsPelPixel;
|
||||||
|
in >> d.m_iEndianness;
|
||||||
|
in >> d.m_uiFrameRate;
|
||||||
|
in >> d.m_uiFileSize;
|
||||||
|
array.append( d );
|
||||||
|
}
|
||||||
|
return in;
|
||||||
|
}
|
||||||
|
|
||||||
|
int findCalypStreamInfo( CalypFileInfoVector array, QString filename )
|
||||||
|
{
|
||||||
|
for( int i = 0; i < array.size(); i++ )
|
||||||
|
if( array.at( i ).m_cFilename == filename )
|
||||||
|
return i;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoStreamSubWindow::VideoStreamSubWindow( QWidget* parent )
|
||||||
|
: VideoSubWindow( VideoSubWindow::VIDEO_STREAM_SUBWINDOW, parent )
|
||||||
|
, m_pcResourceManager( nullptr )
|
||||||
|
, m_pCurrStream( NULL )
|
||||||
|
, m_bIsPlaying( false )
|
||||||
|
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoStreamSubWindow::~VideoStreamSubWindow()
|
||||||
|
{
|
||||||
|
if( m_pcResourceManager )
|
||||||
|
m_pcResourceManager->removeResource( m_uiResourceId );
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoStreamSubWindow::resetWindowName()
|
||||||
|
{
|
||||||
|
setWindowName( QFileInfo( m_cFilename ).fileName() );
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoStreamSubWindow::updateVideoWindowInfo()
|
||||||
|
{
|
||||||
|
m_cStreamInformation = "";
|
||||||
|
if( m_pcDisplayModule )
|
||||||
|
{
|
||||||
|
m_cStreamInformation = "Module";
|
||||||
|
const auto& arraySubWindows = m_pcDisplayModule->getSubWindowList();
|
||||||
|
QStringList windowInfoList;
|
||||||
|
if( arraySubWindows.size() > 0 )
|
||||||
|
{
|
||||||
|
for( std::size_t i = 0; i < arraySubWindows.size(); i++ )
|
||||||
|
{
|
||||||
|
if( arraySubWindows[i]->getWindowName() != getWindowName() )
|
||||||
|
{
|
||||||
|
windowInfoList.append( QString( "Input %1 - " + arraySubWindows[i]->getWindowName() ).arg( i + 1 ) );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( m_pcDisplayModule->getModuleRequirements() & CLP_MODULES_HAS_INFO )
|
||||||
|
{
|
||||||
|
QStringList list = QString::fromStdString( m_pcDisplayModule->moduleInfo() ).split( '\n' );
|
||||||
|
windowInfoList.append( list );
|
||||||
|
}
|
||||||
|
if( windowInfoList.size() > 0 )
|
||||||
|
{
|
||||||
|
m_pcVideoInfo->setInformationTopLeft( windowInfoList );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( m_pCurrStream )
|
||||||
|
{
|
||||||
|
QString m_cFormatName = QString::fromStdString( m_pCurrStream->getFormatName() );
|
||||||
|
QString m_cCodedName = QString::fromStdString( m_pCurrStream->getCodecName() );
|
||||||
|
m_cStreamInformation = m_cFormatName + " | " + m_cCodedName;
|
||||||
|
}
|
||||||
|
if( m_pcCurrFrameAsset )
|
||||||
|
{
|
||||||
|
QString m_cPelFmtName = QString::fromStdString( m_pcCurrFrameAsset->getPelFmtName() );
|
||||||
|
if( m_pCurrStream )
|
||||||
|
if( !m_pCurrStream->isNative() )
|
||||||
|
m_cPelFmtName += "*";
|
||||||
|
m_cStreamInformation += " | " + m_cPelFmtName;
|
||||||
|
}
|
||||||
|
if( m_cStreamInformation.isEmpty() )
|
||||||
|
{
|
||||||
|
m_cStreamInformation = " ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoStreamSubWindow::loadAll()
|
||||||
|
{
|
||||||
|
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||||
|
m_pCurrStream->loadAll();
|
||||||
|
refreshFrame();
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VideoStreamSubWindow::loadFile( QString cFilename, bool bForceDialog )
|
||||||
|
{
|
||||||
|
assert( m_pcResourceManager != nullptr );
|
||||||
|
|
||||||
|
ConfigureFormatDialog formatDialog( this );
|
||||||
|
unsigned int Width = 0, Height = 0, BitsPel = 8, FrameRate = 30;
|
||||||
|
int Endianness = CLP_LITTLE_ENDIAN;
|
||||||
|
int InputFormat = CLP_YUV420P;
|
||||||
|
QSettings appSettings;
|
||||||
|
|
||||||
|
if( m_pCurrStream )
|
||||||
|
m_pCurrStream->getFormat( Width, Height, InputFormat, BitsPel, Endianness, FrameRate );
|
||||||
|
else
|
||||||
|
m_uiResourceId = m_pcResourceManager->getResource( nullptr );
|
||||||
|
|
||||||
|
m_pCurrStream = m_pcResourceManager->getResourceAsset( m_uiResourceId );
|
||||||
|
|
||||||
|
bool bConfig = true;
|
||||||
|
if( !bForceDialog )
|
||||||
|
{
|
||||||
|
bConfig = guessFormat( cFilename, Width, Height, InputFormat, BitsPel, Endianness, FrameRate );
|
||||||
|
if( bConfig )
|
||||||
|
{
|
||||||
|
// Pre-load values with last opened file
|
||||||
|
Width = appSettings.value( "VideoStreamSubWindow/LastWidth" ).value<unsigned int>();
|
||||||
|
Height = appSettings.value( "VideoStreamSubWindow/LastHeight" ).value<unsigned int>();
|
||||||
|
BitsPel = appSettings.value( "VideoStreamSubWindow/LastBitsPerPixel" ).value<unsigned int>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bool bRet = false;
|
||||||
|
for( int iPass = 0; iPass < 2 && !bRet; iPass++ )
|
||||||
|
{
|
||||||
|
if( iPass || bConfig )
|
||||||
|
{
|
||||||
|
if( formatDialog.runConfigureFormatDialog( QFileInfo( cFilename ).fileName(), Width, Height, InputFormat, BitsPel,
|
||||||
|
Endianness, FrameRate ) == QDialog::Rejected )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
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_uiWidth = Width;
|
||||||
|
m_sStreamInfo.m_uiHeight = Height;
|
||||||
|
m_sStreamInfo.m_iPelFormat = InputFormat;
|
||||||
|
m_sStreamInfo.m_uiBitsPelPixel = BitsPel;
|
||||||
|
m_sStreamInfo.m_iEndianness = Endianness;
|
||||||
|
m_sStreamInfo.m_uiFrameRate = FrameRate;
|
||||||
|
m_sStreamInfo.m_uiFileSize = QFileInfo( cFilename ).size();
|
||||||
|
|
||||||
|
QVariant var;
|
||||||
|
var.setValue<unsigned int>( Width );
|
||||||
|
appSettings.setValue( "VideoStreamSubWindow/LastWidth", var );
|
||||||
|
var.setValue<unsigned int>( Height );
|
||||||
|
appSettings.setValue( "VideoStreamSubWindow/LastHeight", var );
|
||||||
|
var.setValue<unsigned int>( BitsPel );
|
||||||
|
appSettings.setValue( "VideoStreamSubWindow/LastBitsPerPixel", var );
|
||||||
|
|
||||||
|
#ifdef CALYP_MANAGED_RESOURCES
|
||||||
|
m_pcResourceManager->startResourceWorker( m_uiResourceId );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
|
refreshFrame();
|
||||||
|
|
||||||
|
m_cFilename = cFilename;
|
||||||
|
|
||||||
|
updateVideoWindowInfo();
|
||||||
|
setWindowName( QFileInfo( m_cFilename ).fileName() );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VideoStreamSubWindow::loadFile( CalypFileInfo* streamInfo )
|
||||||
|
{
|
||||||
|
assert( m_pcResourceManager != nullptr );
|
||||||
|
|
||||||
|
m_uiResourceId = m_pcResourceManager->getResource( m_pCurrStream );
|
||||||
|
m_pCurrStream = m_pcResourceManager->getResourceAsset( m_uiResourceId );
|
||||||
|
|
||||||
|
if( !m_pCurrStream->open( streamInfo->m_cFilename.toStdString(), streamInfo->m_uiWidth, streamInfo->m_uiHeight,
|
||||||
|
streamInfo->m_iPelFormat, streamInfo->m_uiBitsPelPixel, streamInfo->m_iEndianness,
|
||||||
|
streamInfo->m_uiFrameRate, true ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sStreamInfo = *streamInfo;
|
||||||
|
|
||||||
|
#ifdef CALYP_MANAGED_RESOURCES
|
||||||
|
m_pcResourceManager->startResourceWorker( m_uiResourceId );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
|
||||||
|
refreshFrame();
|
||||||
|
|
||||||
|
m_cFilename = streamInfo->m_cFilename;
|
||||||
|
updateVideoWindowInfo();
|
||||||
|
setWindowName( QFileInfo( m_cFilename ).fileName() );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VideoStreamSubWindow::guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel,
|
||||||
|
int& rEndianness, unsigned int& rFrameRate )
|
||||||
|
{
|
||||||
|
std::vector<CalypStandardResolution> stdResList = CalypStream::stdResolutionSizes();
|
||||||
|
bool bGuessed = true;
|
||||||
|
bool bGuessedByFilesize = false;
|
||||||
|
QString FilenameShort = QFileInfo( filename ).fileName();
|
||||||
|
QString fileExtension = QFileInfo( filename ).suffix();
|
||||||
|
|
||||||
|
if( filename.startsWith( "/dev/" ) )
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if( !fileExtension.compare( "yuv", Qt::CaseInsensitive ) || !fileExtension.compare( "rgb", Qt::CaseInsensitive ) ||
|
||||||
|
!fileExtension.compare( "gray", Qt::CaseInsensitive ) )
|
||||||
|
{
|
||||||
|
bGuessed = false;
|
||||||
|
// Guess pixel format
|
||||||
|
auto formats_list = CalypFrame::supportedPixelFormatListNames();
|
||||||
|
for( std::size_t i = 0; i < formats_list.size(); i++ )
|
||||||
|
{
|
||||||
|
if( FilenameShort.contains( formats_list[i].c_str(), Qt::CaseInsensitive ) )
|
||||||
|
{
|
||||||
|
rInputFormat = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( rWidth == 0 || rHeight == 0 )
|
||||||
|
{
|
||||||
|
// Guess resolution - match resolution name
|
||||||
|
int iMatch = -1;
|
||||||
|
for( unsigned int i = 0; i < stdResList.size(); i++ )
|
||||||
|
{
|
||||||
|
if( FilenameShort.contains( QString::fromStdString( stdResList[i].shortName ) ) )
|
||||||
|
{
|
||||||
|
iMatch = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( iMatch >= 0 )
|
||||||
|
{
|
||||||
|
rWidth = stdResList[iMatch].uiWidth;
|
||||||
|
rHeight = stdResList[iMatch].uiHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Guess resolution - match %dx%d
|
||||||
|
//QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort );
|
||||||
|
QRegularExpressionMatch resolutionMatch = QRegularExpression( "_[0-9]+x[0-9]+" ).match( FilenameShort );
|
||||||
|
if( resolutionMatch.hasMatch() )
|
||||||
|
{
|
||||||
|
QString resolutionString = resolutionMatch.captured( resolutionMatch.lastCapturedIndex() );
|
||||||
|
if( resolutionString.startsWith( "_" ) || resolutionString.endsWith( "_" ) )
|
||||||
|
{
|
||||||
|
resolutionString.remove( "_" );
|
||||||
|
QStringList resolutionArgs = resolutionString.split( "x" );
|
||||||
|
if( resolutionArgs.size() == 2 )
|
||||||
|
{
|
||||||
|
rWidth = resolutionArgs.at( 0 ).toUInt();
|
||||||
|
rHeight = resolutionArgs.at( 1 ).toUInt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Guess resolution by file size
|
||||||
|
if( rWidth == 0 && rHeight == 0 )
|
||||||
|
{
|
||||||
|
FILE* pF = fopen( filename.toStdString().c_str(), "rb" );
|
||||||
|
if( pF )
|
||||||
|
{
|
||||||
|
fseek( pF, 0, SEEK_END );
|
||||||
|
unsigned long long int uiFileSize = ftell( pF );
|
||||||
|
fclose( pF );
|
||||||
|
|
||||||
|
int count = 0, module, frame_bytes, match;
|
||||||
|
for( unsigned int i = 0; i < stdResList.size(); i++ )
|
||||||
|
{
|
||||||
|
frame_bytes =
|
||||||
|
CalypFrame::getBytesPerFrame( stdResList[i].uiWidth, stdResList[i].uiHeight, rInputFormat, 8 );
|
||||||
|
module = uiFileSize % frame_bytes;
|
||||||
|
if( module == 0 )
|
||||||
|
{
|
||||||
|
match = i;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( count == 1 )
|
||||||
|
{
|
||||||
|
rWidth = stdResList[match].uiWidth;
|
||||||
|
rHeight = stdResList[match].uiHeight;
|
||||||
|
bGuessedByFilesize = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// [.|_]
|
||||||
|
// Guess bits per pixel - match %dbpp
|
||||||
|
QRegularExpressionMatch BppMatch = QRegularExpression( "_[0-9]+bpp" ).match( FilenameShort );
|
||||||
|
if( BppMatch.hasMatch() )
|
||||||
|
{
|
||||||
|
QString matchString = BppMatch.captured( BppMatch.lastCapturedIndex() );
|
||||||
|
matchString.remove( "_" );
|
||||||
|
matchString.remove( "bpp" );
|
||||||
|
rBitsPerPixel = matchString.toUInt();
|
||||||
|
if( !( rBitsPerPixel > 0 && rBitsPerPixel < 16 ) )
|
||||||
|
{
|
||||||
|
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
|
||||||
|
if( FilenameShort.contains( QStringLiteral( "be" ), Qt::CaseInsensitive ) )
|
||||||
|
{
|
||||||
|
rEndianness = CLP_BIG_ENDIAN;
|
||||||
|
}
|
||||||
|
if( FilenameShort.contains( QStringLiteral( "le" ), Qt::CaseInsensitive ) )
|
||||||
|
{
|
||||||
|
rEndianness = CLP_LITTLE_ENDIAN;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( rWidth > 0 && rHeight > 0 && rInputFormat >= 0 )
|
||||||
|
bGuessed = true && !bGuessedByFilesize;
|
||||||
|
}
|
||||||
|
return !bGuessed;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoStreamSubWindow::refreshSubWindow()
|
||||||
|
{
|
||||||
|
#ifdef CALYP_MANAGED_RESOURCES
|
||||||
|
m_pcResourceManager->stopResourceWorker( m_uiResourceId );
|
||||||
|
#endif
|
||||||
|
if( !m_pCurrStream->reload() )
|
||||||
|
{
|
||||||
|
close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#ifdef CALYP_MANAGED_RESOURCES
|
||||||
|
m_pcResourceManager->startResourceWorker( m_uiResourceId );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
updateVideoWindowInfo();
|
||||||
|
refreshFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoStreamSubWindow::refreshFrame()
|
||||||
|
{
|
||||||
|
bool bSetFrame = true;
|
||||||
|
m_pcCurrFrameAsset = m_pCurrStream->getCurrFrameAsset();
|
||||||
|
|
||||||
|
if( m_pcDisplayModule )
|
||||||
|
{
|
||||||
|
//bool disableThreads = !m_bIsPlaying && hasAssociatedModule();
|
||||||
|
m_pcDisplayModule->apply( m_bIsPlaying, true );
|
||||||
|
bSetFrame = false;
|
||||||
|
}
|
||||||
|
if( bSetFrame )
|
||||||
|
VideoSubWindow::refreshFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoStreamSubWindow::refreshFrame( bool bThreaded )
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_CONCURRENT
|
||||||
|
m_cRefreshResult.waitForFinished();
|
||||||
|
if( bThreaded )
|
||||||
|
{
|
||||||
|
m_cRefreshResult = QtConcurrent::run( this, &VideoSubWindow::refreshFrame );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
refreshFrame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VideoStreamSubWindow::goToNextFrame( bool bThreaded )
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_CONCURRENT
|
||||||
|
m_cRefreshResult.waitForFinished();
|
||||||
|
m_cReadResult.waitForFinished();
|
||||||
|
#endif
|
||||||
|
#ifdef CALYP_MANAGED_RESOURCES
|
||||||
|
while( !m_pCurrStream->hasNextFrame() && !m_pCurrStream->isEof() )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
bool bEndOfSeq = m_pCurrStream->setNextFrame();
|
||||||
|
#ifdef CALYP_MANAGED_RESOURCES
|
||||||
|
bThreaded = false;
|
||||||
|
m_pcResourceManager->wakeResourceWorker( m_uiResourceId );
|
||||||
|
#endif
|
||||||
|
if( !bEndOfSeq )
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_CONCURRENT
|
||||||
|
m_cRefreshResult.waitForFinished();
|
||||||
|
if( bThreaded )
|
||||||
|
{
|
||||||
|
m_cReadResult = QtConcurrent::run( m_pCurrStream, &CalypStream::readNextFrameFillRGBBuffer );
|
||||||
|
refreshFrame( bThreaded );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
refreshFrame( bThreaded );
|
||||||
|
#ifndef CALYP_MANAGED_RESOURCES
|
||||||
|
m_pCurrStream->readNextFrameFillRGBBuffer();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return bEndOfSeq;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VideoStreamSubWindow::saveStream( QString filename )
|
||||||
|
{
|
||||||
|
bool iRet = false;
|
||||||
|
QApplication::setOverrideCursor( Qt::WaitCursor );
|
||||||
|
|
||||||
|
// TODO: implement this
|
||||||
|
QApplication::restoreOverrideCursor();
|
||||||
|
return iRet;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VideoStreamSubWindow::isPlaying()
|
||||||
|
{
|
||||||
|
return m_bIsPlaying;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VideoStreamSubWindow::play()
|
||||||
|
{
|
||||||
|
bool isPlaying = false;
|
||||||
|
if( m_pCurrStream && m_pCurrStream->getFrameNum() > 1 )
|
||||||
|
{
|
||||||
|
isPlaying = true;
|
||||||
|
}
|
||||||
|
m_bIsPlaying = isPlaying;
|
||||||
|
return m_bIsPlaying;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool VideoStreamSubWindow::playEvent()
|
||||||
|
{
|
||||||
|
bool bEndOfSeq = false;
|
||||||
|
if( m_pCurrStream && m_bIsPlaying )
|
||||||
|
{
|
||||||
|
bEndOfSeq = goToNextFrame( true );
|
||||||
|
}
|
||||||
|
return bEndOfSeq;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoStreamSubWindow::pause()
|
||||||
|
{
|
||||||
|
m_bIsPlaying = false;
|
||||||
|
refreshFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoStreamSubWindow::seekAbsoluteEvent( unsigned int new_frame_num )
|
||||||
|
{
|
||||||
|
if( m_pCurrStream )
|
||||||
|
{
|
||||||
|
if( m_pCurrStream->seekInput( new_frame_num ) )
|
||||||
|
refreshFrame();
|
||||||
|
|
||||||
|
#ifdef CALYP_MANAGED_RESOURCES
|
||||||
|
m_pcResourceManager->wakeResourceWorker( m_uiResourceId );
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoStreamSubWindow::seekRelativeEvent( bool bIsFoward )
|
||||||
|
{
|
||||||
|
if( m_pCurrStream )
|
||||||
|
{
|
||||||
|
if( bIsFoward )
|
||||||
|
{
|
||||||
|
goToNextFrame( true );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_pCurrStream->seekInputRelative( bIsFoward );
|
||||||
|
#ifdef CALYP_MANAGED_RESOURCES
|
||||||
|
m_pcResourceManager->wakeResourceWorker( m_uiResourceId );
|
||||||
|
#endif
|
||||||
|
refreshFrame();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoStreamSubWindow::stop()
|
||||||
|
{
|
||||||
|
#ifndef QT_NO_CONCURRENT
|
||||||
|
m_cRefreshResult.waitForFinished();
|
||||||
|
m_cReadResult.waitForFinished();
|
||||||
|
#endif
|
||||||
|
m_bIsPlaying = false;
|
||||||
|
seekAbsoluteEvent( 0 );
|
||||||
|
return;
|
||||||
|
}
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
/* This file is a part of Calyp project
|
||||||
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file VideoStreamSubWindow.h
|
||||||
|
* \brief Video Sub windows handling
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef __VIDEOSTREAMSUBWINDOW_H__
|
||||||
|
#define __VIDEOSTREAMSUBWINDOW_H__
|
||||||
|
|
||||||
|
#include <QDataStream>
|
||||||
|
#include <QFuture>
|
||||||
|
#include <QRect>
|
||||||
|
#include <QString>
|
||||||
|
#include <QVector>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#include "CommonDefs.h"
|
||||||
|
#include "VideoSubWindow.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "lib/CalypStream.h"
|
||||||
|
|
||||||
|
class QScrollArea;
|
||||||
|
|
||||||
|
class VideoInformation;
|
||||||
|
class VideoStreamSubWindow;
|
||||||
|
class ResourceHandle;
|
||||||
|
class CalypAppModuleIf;
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
QString m_cFilename;
|
||||||
|
unsigned int m_uiWidth;
|
||||||
|
unsigned int m_uiHeight;
|
||||||
|
int m_iPelFormat;
|
||||||
|
unsigned int m_uiBitsPelPixel;
|
||||||
|
unsigned int m_iEndianness;
|
||||||
|
unsigned int m_uiFrameRate;
|
||||||
|
unsigned long long int m_uiFileSize;
|
||||||
|
} CalypFileInfo;
|
||||||
|
typedef QVector<CalypFileInfo> CalypFileInfoVector;
|
||||||
|
|
||||||
|
QDataStream& operator<<( QDataStream& out, const CalypFileInfoVector& d );
|
||||||
|
QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& d );
|
||||||
|
int findCalypStreamInfo( CalypFileInfoVector array, QString filename );
|
||||||
|
|
||||||
|
class VideoStreamSubWindow : public VideoSubWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
VideoStreamSubWindow( QWidget* parent = 0 );
|
||||||
|
~VideoStreamSubWindow();
|
||||||
|
|
||||||
|
void resetWindowName() override;
|
||||||
|
void updateVideoWindowInfo() override;
|
||||||
|
|
||||||
|
bool isPlaying() override;
|
||||||
|
void stop() override;
|
||||||
|
void advanceOneFrame() override { goToNextFrame( true ); }
|
||||||
|
auto getFrameNum() -> std::uint64_t override { return m_pCurrStream->getFrameNum(); }
|
||||||
|
|
||||||
|
void setResourceManaget( ResourceHandle* resourceManager ) { m_pcResourceManager = resourceManager; }
|
||||||
|
|
||||||
|
bool loadFile( QString cFilename, bool bForceDialog = false );
|
||||||
|
bool loadFile( CalypFileInfo* streamInfo );
|
||||||
|
void loadAll();
|
||||||
|
bool saveStream( QString filename );
|
||||||
|
|
||||||
|
bool play();
|
||||||
|
void pause();
|
||||||
|
bool playEvent();
|
||||||
|
void seekAbsoluteEvent( unsigned int new_frame_num );
|
||||||
|
void seekRelativeEvent( bool bIsFoward );
|
||||||
|
|
||||||
|
CalypFileInfo getStreamInfo() { return m_sStreamInfo; }
|
||||||
|
|
||||||
|
const CalypStream* getInputStream() { return m_pCurrStream; }
|
||||||
|
const CalypStream* getCurrStream() { return m_pCurrStream; }
|
||||||
|
|
||||||
|
QString getCurrentFileName() { return m_cFilename; }
|
||||||
|
|
||||||
|
void refreshSubWindow() override;
|
||||||
|
void refreshFrame();
|
||||||
|
void refreshFrame( bool bThreaded );
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool goToNextFrame( bool bThreaded );
|
||||||
|
|
||||||
|
static bool guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel,
|
||||||
|
int& rEndianness, unsigned int& rFrameRate );
|
||||||
|
|
||||||
|
private: // NO_LINT
|
||||||
|
ResourceHandle* m_pcResourceManager;
|
||||||
|
|
||||||
|
QString m_cFilename;
|
||||||
|
CalypFileInfo m_sStreamInfo;
|
||||||
|
std::size_t m_uiResourceId;
|
||||||
|
CalypStream* m_pCurrStream;
|
||||||
|
QString m_cCurrFileName;
|
||||||
|
|
||||||
|
bool m_bIsPlaying;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Threads variables
|
||||||
|
* QtConcurrent
|
||||||
|
*/
|
||||||
|
QFuture<void> m_cRefreshResult;
|
||||||
|
QFuture<void> m_cReadResult;
|
||||||
|
};
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE( CalypFileInfo ) // NOLINT
|
||||||
|
Q_DECLARE_METATYPE( CalypFileInfoVector ) // NOLINT
|
||||||
|
|
||||||
|
#endif // __VIDEOSTREAMSUBWINDOW_H__
|
||||||
+183
-651
File diff suppressed because it is too large.
Load diff
+77
-113
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -28,8 +28,11 @@
|
|||||||
#include <QDataStream>
|
#include <QDataStream>
|
||||||
#include <QFuture>
|
#include <QFuture>
|
||||||
#include <QRect>
|
#include <QRect>
|
||||||
|
#include <QStaticText>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QVector>
|
#include <QVector>
|
||||||
|
|
||||||
|
#include "CalypAppModuleIf.h"
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "SubWindowAbstract.h"
|
#include "SubWindowAbstract.h"
|
||||||
#include "ViewArea.h"
|
#include "ViewArea.h"
|
||||||
@@ -40,67 +43,35 @@ class QScrollArea;
|
|||||||
|
|
||||||
class VideoInformation;
|
class VideoInformation;
|
||||||
class VideoSubWindow;
|
class VideoSubWindow;
|
||||||
|
class ResourceHandle;
|
||||||
class CalypAppModuleIf;
|
class CalypAppModuleIf;
|
||||||
|
|
||||||
typedef struct
|
/**
|
||||||
|
* \class VideoInformation
|
||||||
|
* \brief Shows information about video sub window
|
||||||
|
*/
|
||||||
|
class VideoInformation : public QWidget
|
||||||
{
|
{
|
||||||
QString m_cFilename;
|
public:
|
||||||
unsigned int m_uiWidth;
|
VideoInformation( QWidget* parent );
|
||||||
unsigned int m_uiHeight;
|
void setInformationTopLeft( const QStringList& textLines );
|
||||||
int m_iPelFormat;
|
void setBusyWindow( bool bFlag );
|
||||||
unsigned int m_uiBitsPelPixel;
|
|
||||||
unsigned int m_iEndianness;
|
|
||||||
unsigned int m_uiFrameRate;
|
|
||||||
unsigned long long int m_uiFileSize;
|
|
||||||
} CalypFileInfo;
|
|
||||||
typedef QVector<CalypFileInfo> CalypFileInfoVector;
|
|
||||||
|
|
||||||
QDataStream& operator<<( QDataStream& out, const CalypFileInfoVector& d );
|
protected:
|
||||||
QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& d );
|
void paintEvent( QPaintEvent* event );
|
||||||
int findCalypStreamInfo( CalypFileInfoVector array, QString filename );
|
|
||||||
|
private:
|
||||||
|
QTimer* m_pcRefreshTimer;
|
||||||
|
QList<QStaticText> m_cTopLeftTextList;
|
||||||
|
QFont m_cTopLeftTextFont;
|
||||||
|
QFont m_cCenterTextFont;
|
||||||
|
bool m_bBusyWindow;
|
||||||
|
};
|
||||||
|
|
||||||
class VideoSubWindow : public SubWindowAbstract
|
class VideoSubWindow : public SubWindowAbstract
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_bWindowBusy;
|
|
||||||
|
|
||||||
QScrollArea* m_pcScrollArea;
|
|
||||||
QPoint m_cCurrScroll;
|
|
||||||
double m_dHorScroll;
|
|
||||||
double m_dVerScroll;
|
|
||||||
|
|
||||||
ViewArea* m_cViewArea;
|
|
||||||
|
|
||||||
VideoInformation* m_pcVideoInfo;
|
|
||||||
|
|
||||||
QString m_cFilename;
|
|
||||||
QString m_cStreamInformation;
|
|
||||||
CalypFileInfo m_sStreamInfo;
|
|
||||||
CalypStream* m_pCurrStream;
|
|
||||||
|
|
||||||
CalypFrame* m_pcCurrFrame;
|
|
||||||
QRect m_cSelectedArea;
|
|
||||||
|
|
||||||
CalypAppModuleIf* m_pcCurrentDisplayModule;
|
|
||||||
QList<CalypAppModuleIf*> m_apcCurrentModule;
|
|
||||||
|
|
||||||
VideoSubWindow* m_pcReferenceSubWindow;
|
|
||||||
|
|
||||||
// QString m_cWindowShortName;
|
|
||||||
QString m_cCurrFileName;
|
|
||||||
|
|
||||||
bool m_bIsPlaying;
|
|
||||||
|
|
||||||
QTimer* m_pcUpdateTimer;
|
|
||||||
/**
|
|
||||||
* Threads variables
|
|
||||||
* QtConcurrent
|
|
||||||
*/
|
|
||||||
QFuture<void> m_cRefreshResult;
|
|
||||||
QFuture<void> m_cReadResult;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
enum VideoSubWindowCategories
|
enum VideoSubWindowCategories
|
||||||
{
|
{
|
||||||
@@ -110,90 +81,63 @@ public:
|
|||||||
VideoSubWindow( enum VideoSubWindowCategories category, QWidget* parent = 0 );
|
VideoSubWindow( enum VideoSubWindowCategories category, QWidget* parent = 0 );
|
||||||
~VideoSubWindow();
|
~VideoSubWindow();
|
||||||
|
|
||||||
void updateVideoWindowInfo();
|
virtual void resetWindowName() = 0;
|
||||||
|
virtual void updateVideoWindowInfo() = 0;
|
||||||
|
|
||||||
bool loadFile( QString cFilename, bool bForceDialog = false );
|
virtual bool isPlaying() = 0;
|
||||||
bool loadFile( CalypFileInfo* streamInfo );
|
virtual void stop() = 0;
|
||||||
void loadAll();
|
virtual void advanceOneFrame() = 0;
|
||||||
|
virtual auto getFrameNum() -> std::uint64_t { return 1; };
|
||||||
|
|
||||||
|
QString getVideoInformation() { return m_cStreamInformation; }
|
||||||
bool save( QString filename );
|
bool save( QString filename );
|
||||||
bool saveStream( QString filename );
|
|
||||||
|
|
||||||
void refreshSubWindow();
|
void setCurrFrame( std::shared_ptr<CalypFrame> pcCurrFrame );
|
||||||
void refreshFrame( bool bThreaded = false );
|
|
||||||
|
|
||||||
bool play();
|
auto getCurrFrame() -> CalypFrame* { return m_pcCurrFrameAsset.get(); }
|
||||||
void pause();
|
auto getCurrFrameAsset() -> std::shared_ptr<CalypFrame> { return m_pcCurrFrameAsset; };
|
||||||
bool playEvent();
|
auto getViewArea() -> ViewArea* { return m_cViewArea; }
|
||||||
void stop();
|
|
||||||
|
|
||||||
bool isPlaying() { return m_bIsPlaying; }
|
VideoSubWindow* getRefSubWindow() { return m_pcReferenceSubWindow; }
|
||||||
void seekAbsoluteEvent( unsigned int new_frame_num );
|
|
||||||
void seekRelativeEvent( bool bIsFoward );
|
|
||||||
|
|
||||||
void setCurrFrame( CalypFrame* pcCurrFrame );
|
|
||||||
|
|
||||||
CalypFileInfo getStreamInfo() { return m_sStreamInfo; }
|
|
||||||
QString getStreamInformation() { return m_cStreamInformation; }
|
|
||||||
CalypStream* getInputStream() { return m_pCurrStream; }
|
|
||||||
CalypStream* getCurrStream() { return m_pCurrStream; }
|
|
||||||
CalypFrame* getCurrFrame() { return m_pcCurrFrame; }
|
|
||||||
ViewArea* getViewArea() { return m_cViewArea; }
|
|
||||||
void setRefSubWindow( VideoSubWindow* subWindow )
|
void setRefSubWindow( VideoSubWindow* subWindow )
|
||||||
{
|
{
|
||||||
m_pcReferenceSubWindow = NULL;
|
m_pcReferenceSubWindow = NULL;
|
||||||
if( subWindow )
|
if( subWindow )
|
||||||
if( m_pcCurrFrame->haveSameFmt( subWindow->getCurrFrame() ) )
|
if( m_pcCurrFrameAsset->haveSameFmt( subWindow->getCurrFrame() ) )
|
||||||
m_pcReferenceSubWindow = subWindow;
|
m_pcReferenceSubWindow = subWindow;
|
||||||
}
|
}
|
||||||
|
|
||||||
VideoSubWindow* getRefSubWindow() { return m_pcReferenceSubWindow; }
|
|
||||||
/**
|
/**
|
||||||
* Functions to enable a module in the
|
* Functions to enable a module in the
|
||||||
* current SubWindow
|
* current SubWindow
|
||||||
*/
|
*/
|
||||||
void enableModule( CalypAppModuleIf* pcModule );
|
auto hasModules() -> bool { return m_associatedModules.size() > 0; }
|
||||||
void disableModule( CalypAppModuleIf* pcModule = NULL );
|
bool hasAssociatedModule();
|
||||||
void associateModule( CalypAppModuleIf* pcModule );
|
void setDisplayModule( CalypAppModuleIf* pcModule );
|
||||||
|
void associateModule( std::shared_ptr<CalypAppModuleIf> pcModule );
|
||||||
CalypAppModuleIf* getDisplayModule() { return m_pcCurrentDisplayModule; }
|
void disableModule( CalypAppModuleIf* pcModule );
|
||||||
QList<CalypAppModuleIf*> getModuleArray()
|
bool disableAllModules();
|
||||||
{
|
CalypAppModuleIf* getDisplayModule() { return m_pcDisplayModule; }
|
||||||
QList<CalypAppModuleIf*> apcModulesArray;
|
|
||||||
if( m_pcCurrentDisplayModule )
|
|
||||||
apcModulesArray.append( m_pcCurrentDisplayModule );
|
|
||||||
apcModulesArray.append( m_apcCurrentModule );
|
|
||||||
return apcModulesArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Virtual functions from SubWindowAbstract
|
* Virtual functions from SubWindowAbstract
|
||||||
*/
|
*/
|
||||||
void normalSize();
|
void normalSize() override;
|
||||||
void zoomToFit();
|
void zoomToFit() override;
|
||||||
void scaleView( double scale, QPoint center = QPoint() );
|
void scaleView( double scale, QPoint center = QPoint() ) override;
|
||||||
void zoomToFactor( double factor, QPoint center = QPoint() );
|
void zoomToFactor( double factor, QPoint center = QPoint() ) override;
|
||||||
|
|
||||||
double getScaleFactor() { return m_cViewArea->getZoomFactor(); }
|
double getScaleFactor() override { return m_cViewArea->getZoomFactor(); }
|
||||||
/**
|
/**
|
||||||
* Size related functions
|
* Size related functions
|
||||||
*/
|
*/
|
||||||
QSize sizeHint() const;
|
QSize sizeHint( const QSize& ) const override;
|
||||||
QSize sizeHint( const QSize& ) const;
|
|
||||||
|
|
||||||
QString getCurrentFileName() { return m_cFilename; }
|
|
||||||
bool getIsModule() { return getCategory() | SubWindowAbstract::MODULE_SUBWINDOW; }
|
|
||||||
void clearWindowBusy() { m_bWindowBusy = false; }
|
|
||||||
void setFillWindow( bool bFlag );
|
void setFillWindow( bool bFlag );
|
||||||
|
|
||||||
void adjustScrollBarToRatio( const double& horRatio, const double& verRatio );
|
void adjustScrollBarToRatio( const double& horRatio, const double& verRatio );
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void refreshFrameOperation();
|
|
||||||
bool goToNextFrame( bool bThreaded = false );
|
|
||||||
|
|
||||||
static bool guessFormat( QString filename, unsigned int& rWidth, unsigned int& rHeight, int& rInputFormat, unsigned int& rBitsPerPixel,
|
|
||||||
int& rEndianness, unsigned int& rFrameRate );
|
|
||||||
|
|
||||||
bool hasRunningModule();
|
bool hasRunningModule();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -205,9 +149,11 @@ private:
|
|||||||
QSize getScrollSize();
|
QSize getScrollSize();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void keyPressEvent( QKeyEvent* event );
|
void refreshFrame();
|
||||||
void resizeEvent( QResizeEvent* event );
|
|
||||||
void closeEvent( QCloseEvent* event );
|
void keyPressEvent( QKeyEvent* event ) override;
|
||||||
|
void resizeEvent( QResizeEvent* event ) override;
|
||||||
|
void closeEvent( QCloseEvent* event ) override;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
void updateWindowOnTimeout();
|
void updateWindowOnTimeout();
|
||||||
@@ -216,9 +162,27 @@ public Q_SLOTS:
|
|||||||
void updateScrollValues();
|
void updateScrollValues();
|
||||||
void updateSelectedArea( QRect area );
|
void updateSelectedArea( QRect area );
|
||||||
void updatePixelValueStatusBar( const QPoint& pos );
|
void updatePixelValueStatusBar( const QPoint& pos );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
VideoInformation* m_pcVideoInfo;
|
||||||
|
QString m_cStreamInformation;
|
||||||
|
std::shared_ptr<CalypFrame> m_pcCurrFrameAsset;
|
||||||
|
//bool m_bWindowBusy;
|
||||||
|
//bool m_bIsPlaying;
|
||||||
|
|
||||||
|
std::vector<std::shared_ptr<CalypAppModuleIf>> m_associatedModules;
|
||||||
|
CalypAppModuleIf* m_pcDisplayModule{ nullptr };
|
||||||
|
//bool m_hasAssociatedModules;
|
||||||
|
|
||||||
|
private:
|
||||||
|
QScrollArea* m_pcScrollArea;
|
||||||
|
QPoint m_cCurrScroll;
|
||||||
|
double m_dHorScroll;
|
||||||
|
double m_dVerScroll;
|
||||||
|
ViewArea* m_cViewArea;
|
||||||
|
QRect m_cSelectedArea;
|
||||||
|
VideoSubWindow* m_pcReferenceSubWindow;
|
||||||
|
QTimer* m_pcUpdateTimer;
|
||||||
};
|
};
|
||||||
|
|
||||||
Q_DECLARE_METATYPE( CalypFileInfo )
|
|
||||||
Q_DECLARE_METATYPE( CalypFileInfoVector )
|
|
||||||
|
|
||||||
#endif // __VIDEOSUBWINDOW_H__
|
#endif // __VIDEOSUBWINDOW_H__
|
||||||
+77
-83
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
#include "ViewArea.h"
|
#include "ViewArea.h"
|
||||||
|
|
||||||
#include "GridManager.h"
|
#include <qnamespace.h>
|
||||||
|
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
@@ -38,9 +38,10 @@
|
|||||||
#include <QRectF>
|
#include <QRectF>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "GridManager.h"
|
||||||
|
|
||||||
static const QColor selectionColor = Qt::cyan;
|
static const QColor selectionColor = Qt::cyan;
|
||||||
static const QColor imageMaskColor = Qt::green;
|
static const QColor imageMaskColor = Qt::green;
|
||||||
static const QColor eraserColor = Qt::red;
|
static const QColor eraserColor = Qt::red;
|
||||||
@@ -49,9 +50,6 @@ ViewArea::ViewArea( QWidget* parent )
|
|||||||
: QWidget( parent )
|
: QWidget( parent )
|
||||||
{
|
{
|
||||||
setMouseTracking( true );
|
setMouseTracking( true );
|
||||||
|
|
||||||
m_pcCurrFrame = NULL;
|
|
||||||
m_pixmap = QPixmap();
|
|
||||||
m_grid = GridManager();
|
m_grid = GridManager();
|
||||||
m_mask = QBitmap();
|
m_mask = QBitmap();
|
||||||
m_selectedArea = QRect();
|
m_selectedArea = QRect();
|
||||||
@@ -70,31 +68,27 @@ ViewArea::ViewArea( QWidget* parent )
|
|||||||
connect( &m_zoomWinTimer, SIGNAL( timeout() ), this, SLOT( update() ) );
|
connect( &m_zoomWinTimer, SIGNAL( timeout() ), this, SLOT( update() ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewArea::setImage( CalypFrame* pcFrame )
|
void ViewArea::setImage( std::shared_ptr<CalypFrame> frame )
|
||||||
{
|
{
|
||||||
m_pcCurrFrame = pcFrame;
|
m_nextFrame = frame;
|
||||||
m_uiPixelHalfScale = 1 << ( m_pcCurrFrame->getBitsPel() - 1 );
|
m_uiPixelHalfScale = 1 << ( m_nextFrame->getBitsPel() - 1 );
|
||||||
m_pcCurrFrame->fillRGBBuffer();
|
m_nextFrame->fillRGBBuffer();
|
||||||
QImage qimg = QImage( m_pcCurrFrame->getRGBBuffer(), m_pcCurrFrame->getWidth(), m_pcCurrFrame->getHeight(),
|
m_image = QImage( m_nextFrame->getRGBBuffer(),
|
||||||
QImage::Format_ARGB32 );
|
m_nextFrame->getWidth(),
|
||||||
setImage( QPixmap::fromImage( qimg ) );
|
m_nextFrame->getHeight(),
|
||||||
}
|
QImage::Format_ARGB32 );
|
||||||
|
|
||||||
void ViewArea::setImage( const QPixmap& pixmap )
|
// m_mask = QBitmap( pixmap.width(), pixmap.height() );
|
||||||
{
|
// m_mask.clear();
|
||||||
m_pixmap = pixmap;
|
|
||||||
m_mask = QBitmap( pixmap.width(), pixmap.height() );
|
|
||||||
m_mask.clear();
|
|
||||||
updateSize();
|
updateSize();
|
||||||
update();
|
update();
|
||||||
updateGeometry();
|
updateGeometry();
|
||||||
|
|
||||||
initZoomWinRect();
|
initZoomWinRect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewArea::clear()
|
void ViewArea::clear()
|
||||||
{
|
{
|
||||||
m_pixmap = QPixmap();
|
m_image = QImage();
|
||||||
m_mask = QBitmap();
|
m_mask = QBitmap();
|
||||||
m_mode = NormalMode;
|
m_mode = NormalMode;
|
||||||
updateSize();
|
updateSize();
|
||||||
@@ -168,7 +162,7 @@ void ViewArea::setZoomFactor( double f )
|
|||||||
double ViewArea::scaleZoomFactor( double scale, QPoint center, QSize minimumSize )
|
double ViewArea::scaleZoomFactor( double scale, QPoint center, QSize minimumSize )
|
||||||
{
|
{
|
||||||
double maxZoom = 100.0;
|
double maxZoom = 100.0;
|
||||||
double minZoom = 0.01; //( 1.0 / m_pixmap.width() );
|
double minZoom = 0.01; //( 1.0 / m_image.width() );
|
||||||
double new_scale = 1.0;
|
double new_scale = 1.0;
|
||||||
|
|
||||||
if( ( m_dZoomFactor == minZoom ) && ( scale < 1 ) )
|
if( ( m_dZoomFactor == minZoom ) && ( scale < 1 ) )
|
||||||
@@ -184,10 +178,10 @@ double ViewArea::scaleZoomFactor( double scale, QPoint center, QSize minimumSize
|
|||||||
|
|
||||||
if( !minimumSize.isNull() )
|
if( !minimumSize.isNull() )
|
||||||
{
|
{
|
||||||
double cw = m_pixmap.width() * m_dZoomFactor;
|
double cw = m_image.width() * m_dZoomFactor;
|
||||||
double ch = m_pixmap.height() * m_dZoomFactor;
|
double ch = m_image.height() * m_dZoomFactor;
|
||||||
double fw = m_pixmap.width() * newZoomFactor;
|
double fw = m_image.width() * newZoomFactor;
|
||||||
double fh = m_pixmap.height() * newZoomFactor;
|
double fh = m_image.height() * newZoomFactor;
|
||||||
double mw = minimumSize.width();
|
double mw = minimumSize.width();
|
||||||
double mh = minimumSize.height();
|
double mh = minimumSize.height();
|
||||||
|
|
||||||
@@ -320,45 +314,45 @@ void ViewArea::setSnapToGrid( bool enable )
|
|||||||
|
|
||||||
void ViewArea::initZoomWinRect()
|
void ViewArea::initZoomWinRect()
|
||||||
{
|
{
|
||||||
int iMinX = 80;
|
double iMinX = 80;
|
||||||
int iMinY = 80;
|
double iMinY = 80;
|
||||||
|
|
||||||
int iMaxX = iMinX * 5;
|
double iMaxX = iMinX * 5;
|
||||||
int iMaxY = iMinY * 5;
|
double iMaxY = iMinY * 5;
|
||||||
|
|
||||||
double dSizeRatio, dWinZoomRatio;
|
double dSizeRatio, dWinZoomRatio;
|
||||||
|
|
||||||
int iHorizontalImg = ( m_pixmap.width() > m_pixmap.height() ) ? 1 : 0;
|
bool iHorizontalImg = m_image.width() > m_image.height();
|
||||||
|
|
||||||
if( iHorizontalImg )
|
if( iHorizontalImg )
|
||||||
{
|
{
|
||||||
dSizeRatio = (double)m_pixmap.width() / (double)m_pixmap.height();
|
dSizeRatio = (double)m_image.width() / (double)m_image.height();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dSizeRatio = (double)m_pixmap.height() / (double)m_pixmap.width();
|
dSizeRatio = (double)m_image.height() / (double)m_image.width();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( dSizeRatio > 5.0 )
|
if( dSizeRatio > 5.0 )
|
||||||
{
|
{
|
||||||
if( iHorizontalImg )
|
if( iHorizontalImg )
|
||||||
{
|
{
|
||||||
dWinZoomRatio = (double)( m_pixmap.width() * 1024 / iMaxX ) / 1000.0;
|
dWinZoomRatio = static_cast<double>( m_image.width() ) * 1024.0 / iMaxX / 1000.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dWinZoomRatio = (double)( m_pixmap.height() * 1024 / iMaxY ) / 1000.0;
|
dWinZoomRatio = static_cast<double>( m_image.height() ) * 1024.0 / iMaxY / 1000.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( iHorizontalImg )
|
if( iHorizontalImg )
|
||||||
{
|
{
|
||||||
dWinZoomRatio = (double)( m_pixmap.height() * 1024 / iMinY ) / 1000.0;
|
dWinZoomRatio = static_cast<double>( m_image.height() ) * 1024.0 / iMinY / 1000.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dWinZoomRatio = (double)( m_pixmap.width() * 1024 / iMinX ) / 1000.0;
|
dWinZoomRatio = static_cast<double>( m_image.width() ) * 1024.0 / iMinX / 1000.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -370,8 +364,8 @@ void ViewArea::initZoomWinRect()
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ViewArea::updateSize()
|
void ViewArea::updateSize()
|
||||||
{
|
{
|
||||||
int w = m_pixmap.width() * m_dZoomFactor;
|
int w = m_image.width() * m_dZoomFactor;
|
||||||
int h = m_pixmap.height() * m_dZoomFactor;
|
int h = m_image.height() * m_dZoomFactor;
|
||||||
setMinimumSize( w, h );
|
setMinimumSize( w, h );
|
||||||
|
|
||||||
QWidget* p = parentWidget();
|
QWidget* p = parentWidget();
|
||||||
@@ -389,17 +383,17 @@ void ViewArea::updateSize()
|
|||||||
|
|
||||||
void ViewArea::updateOffset()
|
void ViewArea::updateOffset()
|
||||||
{
|
{
|
||||||
if( width() > m_pixmap.width() * m_dZoomFactor )
|
if( width() > m_image.width() * m_dZoomFactor )
|
||||||
{
|
{
|
||||||
m_xOffset = ( width() - m_pixmap.width() * m_dZoomFactor ) / 2;
|
m_xOffset = ( width() - m_image.width() * m_dZoomFactor ) / 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_xOffset = 0;
|
m_xOffset = 0;
|
||||||
}
|
}
|
||||||
if( height() > m_pixmap.height() * m_dZoomFactor )
|
if( height() > m_image.height() * m_dZoomFactor )
|
||||||
{
|
{
|
||||||
m_yOffset = ( height() - m_pixmap.height() * m_dZoomFactor ) / 2;
|
m_yOffset = ( height() - m_image.height() * m_dZoomFactor ) / 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -412,7 +406,7 @@ void ViewArea::updateOffset()
|
|||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
void ViewArea::resizeEvent( QResizeEvent* event )
|
void ViewArea::resizeEvent( QResizeEvent* event )
|
||||||
{
|
{
|
||||||
if( size().isEmpty() || m_pixmap.isNull() )
|
if( size().isEmpty() || m_image.isNull() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
updateOffset();
|
updateOffset();
|
||||||
@@ -425,12 +419,11 @@ void ViewArea::resizeEvent( QResizeEvent* event )
|
|||||||
|
|
||||||
void ViewArea::paintEvent( QPaintEvent* event )
|
void ViewArea::paintEvent( QPaintEvent* event )
|
||||||
{
|
{
|
||||||
|
m_currFrame = m_nextFrame;
|
||||||
|
|
||||||
QRect winRect = event->rect();
|
QRect winRect = event->rect();
|
||||||
|
|
||||||
if( visibleRegion().isEmpty() )
|
if( visibleRegion().isEmpty() || size().isEmpty() || m_image.isNull() || m_currFrame == nullptr )
|
||||||
return;
|
|
||||||
|
|
||||||
if( size().isEmpty() || m_pixmap.isNull() )
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
QSize windowSize = parentWidget()->size();
|
QSize windowSize = parentWidget()->size();
|
||||||
@@ -443,15 +436,14 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
|||||||
|
|
||||||
// This line is for fast paiting. Only visible area of the image is painted.
|
// This line is for fast paiting. Only visible area of the image is painted.
|
||||||
// We take the exposed rect from the event (that gives us scroll/expose
|
// We take the exposed rect from the event (that gives us scroll/expose
|
||||||
// optimizations for free – no need
|
// optimizations for free – no need to draw the whole pixmap if your widget
|
||||||
// to draw the whole pixmap if your widget is only partially exposed), and
|
// is only partially exposed), and reverse map it with the painter matrix.
|
||||||
// reverse map it with the painter matrix.
|
|
||||||
// That gives us the part of the pixmap that has actually been exposed.
|
// That gives us the part of the pixmap that has actually been exposed.
|
||||||
// See:
|
// See: http://blog.qt.digia.com/blog/2006/05/13/fast-transformed-pixmapimage-drawing/
|
||||||
// http://blog.qt.digia.com/blog/2006/05/13/fast-transformed-pixmapimage-drawing/
|
QRect exposedRect = painter.worldTransform().inverted().mapRect( winRect ).adjusted( -1, -1, 1, 1 );
|
||||||
QRect exposedRect = painter.worldTransform().inverted().mapRect( event->rect() ).adjusted( -1, -1, 1, 1 );
|
|
||||||
// Draw the pixmap.
|
// Draw the pixmap.
|
||||||
painter.drawPixmap( exposedRect, m_pixmap, exposedRect );
|
// painter.drawPixmap( exposedRect, m_pixmap, exposedRect );
|
||||||
|
painter.drawImage( exposedRect, m_image, exposedRect );
|
||||||
|
|
||||||
// Draw the Grid if it's visible.
|
// Draw the Grid if it's visible.
|
||||||
if( m_bGridVisible )
|
if( m_bGridVisible )
|
||||||
@@ -469,13 +461,13 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
|||||||
// is, is referenced to the not scaled image.
|
// is, is referenced to the not scaled image.
|
||||||
// To know what image area we need to update, just intersects the
|
// To know what image area we need to update, just intersects the
|
||||||
// rectangle area with the image area.
|
// rectangle area with the image area.
|
||||||
vr &= QRect( 0, 0, m_pixmap.width(), m_pixmap.height() );
|
vr &= QRect( 0, 0, m_image.width(), m_image.height() );
|
||||||
|
|
||||||
// Set up for the grid drawer.
|
// Set up for the grid drawer.
|
||||||
painter.setRenderHint( QPainter::Antialiasing );
|
painter.setRenderHint( QPainter::Antialiasing );
|
||||||
|
|
||||||
// Draw grid.
|
// Draw grid.
|
||||||
m_grid.drawGrid( m_pixmap, vr, &painter );
|
m_grid.drawGrid( m_image, vr, &painter );
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.restore();
|
painter.restore();
|
||||||
@@ -484,18 +476,18 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
|||||||
/* if( m_xOffset || m_yOffset )
|
/* if( m_xOffset || m_yOffset )
|
||||||
{
|
{
|
||||||
painter.setPen( Qt::black );
|
painter.setPen( Qt::black );
|
||||||
painter.drawRect( m_xOffset - 1, m_yOffset - 1, m_pixmap.width() *
|
painter.drawRect( m_xOffset - 1, m_yOffset - 1, m_image.width() *
|
||||||
m_dZoomFactor + 1, m_pixmap.height() *
|
m_dZoomFactor + 1, m_image.height() *
|
||||||
m_dZoomFactor + 1 );
|
m_dZoomFactor + 1 );
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
int frFormat = m_pcCurrFrame->getColorSpace();
|
int frFormat = m_currFrame->getColorSpace();
|
||||||
|
|
||||||
// Draw pixel values in grid
|
// Draw pixel values in grid
|
||||||
if( m_dZoomFactor >= 60.0 || ( frFormat != CLP_COLOR_RGBA && m_dZoomFactor >= 50.0 ) )
|
if( m_dZoomFactor >= 60.0 || ( frFormat != CLP_COLOR_RGBA && m_dZoomFactor >= 50.0 ) )
|
||||||
{
|
{
|
||||||
int imageWidth = m_pixmap.width();
|
int imageWidth = m_image.width();
|
||||||
int imageHeight = m_pixmap.height();
|
int imageHeight = m_image.height();
|
||||||
;
|
;
|
||||||
|
|
||||||
QFont font( "Helvetica" );
|
QFont font( "Helvetica" );
|
||||||
@@ -513,7 +505,7 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
|||||||
|
|
||||||
QRect pixelRect( viewToWindow( pixelTopLeft ), QSize( m_dZoomFactor, m_dZoomFactor ) );
|
QRect pixelRect( viewToWindow( pixelTopLeft ), QSize( m_dZoomFactor, m_dZoomFactor ) );
|
||||||
QString pixelValue;
|
QString pixelValue;
|
||||||
CalypPixel pixel = m_pcCurrFrame->getPixel( pixelTopLeft.x(), pixelTopLeft.y() );
|
CalypPixel pixel = m_currFrame->getPixel( pixelTopLeft.x(), pixelTopLeft.y() );
|
||||||
|
|
||||||
if( frFormat == CLP_COLOR_YUV || frFormat == CLP_COLOR_GRAY )
|
if( frFormat == CLP_COLOR_YUV || frFormat == CLP_COLOR_GRAY )
|
||||||
{
|
{
|
||||||
@@ -560,15 +552,15 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
|||||||
painter.drawLine( viewToWindow( QPoint( 0, y ) ), viewToWindow( QPoint( imageWidth, y ) ) );
|
painter.drawLine( viewToWindow( QPoint( 0, y ) ), viewToWindow( QPoint( imageWidth, y ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
bool showZoomRect = m_pixmap.width() * m_dZoomFactor > windowSize.width() ||
|
bool showZoomRect = m_image.width() * m_dZoomFactor > windowSize.width() ||
|
||||||
m_pixmap.height() * m_dZoomFactor > windowSize.height();
|
m_image.height() * m_dZoomFactor > windowSize.height();
|
||||||
|
|
||||||
// VISIBLE ZOOM RECT
|
// VISIBLE ZOOM RECT
|
||||||
if( m_visibleZoomRect && m_zoomWinTimer.isActive() && showZoomRect )
|
if( m_visibleZoomRect && m_zoomWinTimer.isActive() && showZoomRect )
|
||||||
{
|
{
|
||||||
double dRatio = m_dZoomWinRatio;
|
double dRatio = m_dZoomWinRatio;
|
||||||
|
|
||||||
QRect cImg = QRect( 0, 0, m_pixmap.width(), m_pixmap.height() );
|
QRect cImg = QRect( 0, 0, m_image.width(), m_image.height() );
|
||||||
QPoint cZWinRBpos = QPoint( winRect.bottomRight() ) - QPoint( 15, 15 );
|
QPoint cZWinRBpos = QPoint( winRect.bottomRight() ) - QPoint( 15, 15 );
|
||||||
QRect cImgWinRect( 0, 0, round( (double)cImg.width() / dRatio ), round( (double)cImg.height() / dRatio ) );
|
QRect cImgWinRect( 0, 0, round( (double)cImg.width() / dRatio ), round( (double)cImg.height() / dRatio ) );
|
||||||
cImgWinRect.moveBottomRight( cZWinRBpos );
|
cImgWinRect.moveBottomRight( cZWinRBpos );
|
||||||
@@ -586,7 +578,7 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
|||||||
painter.setPen( QColor( 50, 50, 50, 128 ) );
|
painter.setPen( QColor( 50, 50, 50, 128 ) );
|
||||||
//painter.drawRect( cImgWinRect );
|
//painter.drawRect( cImgWinRect );
|
||||||
painter.setOpacity( 0.7 );
|
painter.setOpacity( 0.7 );
|
||||||
painter.drawPixmap( cImgWinRect, m_pixmap );
|
painter.drawImage( cImgWinRect, m_image );
|
||||||
painter.setOpacity( 1 );
|
painter.setOpacity( 1 );
|
||||||
|
|
||||||
cVisibleWinRect.moveTopLeft( cImgWinRect.topLeft() + cVisibleWinRect.topLeft() );
|
cVisibleWinRect.moveTopLeft( cImgWinRect.topLeft() + cVisibleWinRect.topLeft() );
|
||||||
@@ -643,7 +635,7 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
|||||||
painter.setBrush( fill );
|
painter.setBrush( fill );
|
||||||
painter.setPen( Qt::NoPen );
|
painter.setPen( Qt::NoPen );
|
||||||
QPainterPath myPath;
|
QPainterPath myPath;
|
||||||
QRect imgr = viewToWindow( QRect( 0, 0, m_pixmap.width(), m_pixmap.height() ) );
|
QRect imgr = viewToWindow( QRect( 0, 0, m_image.width(), m_image.height() ) );
|
||||||
|
|
||||||
myPath.addRect( imgr );
|
myPath.addRect( imgr );
|
||||||
myPath.addRect( sr ); // m_selectedArea
|
myPath.addRect( sr ); // m_selectedArea
|
||||||
@@ -688,8 +680,7 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
|||||||
{
|
{
|
||||||
switch( tool() )
|
switch( tool() )
|
||||||
{
|
{
|
||||||
case MaskTool:
|
case MaskTool: {
|
||||||
{
|
|
||||||
if( m_maskColor.isValid() )
|
if( m_maskColor.isValid() )
|
||||||
color = m_maskColor;
|
color = m_maskColor;
|
||||||
else
|
else
|
||||||
@@ -697,8 +688,7 @@ void ViewArea::paintEvent( QPaintEvent* event )
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EraserTool:
|
case EraserTool: {
|
||||||
{
|
|
||||||
color = eraserColor;
|
color = eraserColor;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -733,7 +723,7 @@ void ViewArea::wheelEvent( QWheelEvent* event )
|
|||||||
|
|
||||||
if( event->modifiers() & Qt::ControlModifier )
|
if( event->modifiers() & Qt::ControlModifier )
|
||||||
{
|
{
|
||||||
scale = 0.001 * event->delta();
|
scale = 0.001 * event->angleDelta().y();
|
||||||
if( scale > 0 )
|
if( scale > 0 )
|
||||||
scale = 1.25;
|
scale = 1.25;
|
||||||
else
|
else
|
||||||
@@ -741,10 +731,16 @@ void ViewArea::wheelEvent( QWheelEvent* event )
|
|||||||
|
|
||||||
QWidget* p = parentWidget();
|
QWidget* p = parentWidget();
|
||||||
QSize minimumSize = QSize( p->size().width() - 5, p->size().height() - 5 );
|
QSize minimumSize = QSize( p->size().width() - 5, p->size().height() - 5 );
|
||||||
usedScale = scaleZoomFactor( scale, event->pos(), minimumSize );
|
|
||||||
|
#if QT_VERSION < QT_VERSION_CHECK( 5, 14, 0 )
|
||||||
|
auto eventPosition = event->pos();
|
||||||
|
#else
|
||||||
|
auto eventPosition = event->position().toPoint();
|
||||||
|
#endif
|
||||||
|
usedScale = scaleZoomFactor( scale, eventPosition, minimumSize );
|
||||||
if( usedScale != 1.0 )
|
if( usedScale != 1.0 )
|
||||||
{
|
{
|
||||||
emit zoomFactorChanged_byWheel( usedScale, event->pos() );
|
emit zoomFactorChanged_byWheel( usedScale, eventPosition );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -755,7 +751,7 @@ void ViewArea::mousePressEvent( QMouseEvent* event )
|
|||||||
|
|
||||||
QPoint vpos = windowToView( event->pos() );
|
QPoint vpos = windowToView( event->pos() );
|
||||||
|
|
||||||
if( event->button() == Qt::MidButton )
|
if( event->button() == Qt::MiddleButton )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
if( event->button() == Qt::LeftButton )
|
if( event->button() == Qt::LeftButton )
|
||||||
@@ -919,7 +915,7 @@ void ViewArea::mouseMoveEvent( QMouseEvent* event )
|
|||||||
// intercept the selected area with the image area to limit the
|
// intercept the selected area with the image area to limit the
|
||||||
// selection only to the image area, preventing it to come outside
|
// selection only to the image area, preventing it to come outside
|
||||||
// the image.
|
// the image.
|
||||||
m_selectedArea &= QRect( 0, 0, m_pixmap.width(), m_pixmap.height() );
|
m_selectedArea &= QRect( 0, 0, m_image.width(), m_image.height() );
|
||||||
|
|
||||||
// Update only the united area
|
// Update only the united area
|
||||||
// updateRect = updateRect.united( viewToWindow( m_selectedArea ) );
|
// updateRect = updateRect.united( viewToWindow( m_selectedArea ) );
|
||||||
@@ -1003,7 +999,7 @@ void ViewArea::mouseReleaseEvent( QMouseEvent* event )
|
|||||||
|
|
||||||
bool ViewArea::isPosValid( const QPoint& pos ) const
|
bool ViewArea::isPosValid( const QPoint& pos ) const
|
||||||
{
|
{
|
||||||
if( pos.x() < 0 || pos.y() < 0 || pos.x() >= m_pixmap.width() || pos.y() >= m_pixmap.height() )
|
if( pos.x() < 0 || pos.y() < 0 || pos.x() >= m_image.width() || pos.y() >= m_image.height() )
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
@@ -1075,8 +1071,7 @@ void ViewArea::updateMask( const QRect& rect )
|
|||||||
{
|
{
|
||||||
switch( tool() )
|
switch( tool() )
|
||||||
{
|
{
|
||||||
case MaskTool:
|
case MaskTool: {
|
||||||
{
|
|
||||||
// Add rect to the mask
|
// Add rect to the mask
|
||||||
QPainter painter( &m_mask );
|
QPainter painter( &m_mask );
|
||||||
painter.setBrush( Qt::color1 );
|
painter.setBrush( Qt::color1 );
|
||||||
@@ -1085,8 +1080,7 @@ void ViewArea::updateMask( const QRect& rect )
|
|||||||
painter.end();
|
painter.end();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case EraserTool:
|
case EraserTool: {
|
||||||
{
|
|
||||||
// Clears rect area in the mask
|
// Clears rect area in the mask
|
||||||
QPainter painter( &m_mask );
|
QPainter painter( &m_mask );
|
||||||
painter.setBrush( Qt::color0 );
|
painter.setBrush( Qt::color0 );
|
||||||
@@ -1096,6 +1090,6 @@ void ViewArea::updateMask( const QRect& rect )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: /* Do Nothing */
|
default: /* Do Nothing */
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+12
-12
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -26,17 +26,17 @@
|
|||||||
#ifndef __VIEWAREA_H__
|
#ifndef __VIEWAREA_H__
|
||||||
#define __VIEWAREA_H__
|
#define __VIEWAREA_H__
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
|
||||||
#include "GridManager.h"
|
|
||||||
#include "config.h"
|
|
||||||
#include "lib/CalypFrame.h"
|
|
||||||
|
|
||||||
#include <QBitmap>
|
#include <QBitmap>
|
||||||
#include <QColor>
|
#include <QColor>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "CommonDefs.h"
|
||||||
|
#include "GridManager.h"
|
||||||
|
#include "config.h"
|
||||||
|
#include "lib/CalypFrame.h"
|
||||||
|
|
||||||
class CalypStream;
|
class CalypStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,8 +56,8 @@ public:
|
|||||||
|
|
||||||
ViewArea( QWidget* parent = 0 );
|
ViewArea( QWidget* parent = 0 );
|
||||||
|
|
||||||
void setImage( CalypFrame* pcFrame );
|
QImage& image() { return m_image; };
|
||||||
void setImage( const QPixmap& pixmap );
|
void setImage( std::shared_ptr<CalypFrame> frame );
|
||||||
|
|
||||||
void setMode( int mode );
|
void setMode( int mode );
|
||||||
void setMaskColor( const QColor& color = QColor() );
|
void setMaskColor( const QColor& color = QColor() );
|
||||||
@@ -83,8 +83,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
void clearMask();
|
void clearMask();
|
||||||
|
|
||||||
QPixmap image() const { return m_pixmap; }
|
|
||||||
QBitmap mask() const { return m_mask; }
|
|
||||||
QRect selectedArea() const { return m_selectedArea; }
|
QRect selectedArea() const { return m_selectedArea; }
|
||||||
GridManager gridManager() const { return m_grid; }
|
GridManager gridManager() const { return m_grid; }
|
||||||
QColor maskColor() const { return m_maskColor; }
|
QColor maskColor() const { return m_maskColor; }
|
||||||
@@ -150,7 +148,8 @@ private:
|
|||||||
QPoint viewToWindow( const QPoint& pt ) const;
|
QPoint viewToWindow( const QPoint& pt ) const;
|
||||||
QRect viewToWindow( const QRect& rc ) const;
|
QRect viewToWindow( const QRect& rc ) const;
|
||||||
|
|
||||||
CalypFrame* m_pcCurrFrame;
|
std::shared_ptr<CalypFrame> m_currFrame;
|
||||||
|
std::shared_ptr<CalypFrame> m_nextFrame;
|
||||||
|
|
||||||
ClpPel m_uiPixelHalfScale;
|
ClpPel m_uiPixelHalfScale;
|
||||||
|
|
||||||
@@ -161,7 +160,8 @@ private:
|
|||||||
double m_dZoomWinRatio;
|
double m_dZoomWinRatio;
|
||||||
double m_dZoomFactor;
|
double m_dZoomFactor;
|
||||||
|
|
||||||
QPixmap m_pixmap;
|
QImage m_image;
|
||||||
|
//QPixmap m_pixmap;
|
||||||
QBitmap m_mask;
|
QBitmap m_mask;
|
||||||
QRect m_selectedArea;
|
QRect m_selectedArea;
|
||||||
QPoint m_lastPos;
|
QPoint m_lastPos;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
* Joao Santos (joaompssantos@gmail.com)
|
* Joao Santos (joaompssantos@gmail.com)
|
||||||
*
|
*
|
||||||
@@ -27,14 +27,14 @@
|
|||||||
|
|
||||||
#include "AboutDialog.h"
|
#include "AboutDialog.h"
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QTextEdit>
|
#include <QTextEdit>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#define TAB_FROM_SPACES " "
|
#define TAB_FROM_SPACES " "
|
||||||
|
|
||||||
AboutDialog::AboutDialog( QWidget* parent )
|
AboutDialog::AboutDialog( QWidget* parent )
|
||||||
@@ -49,7 +49,7 @@ AboutDialog::AboutDialog( QWidget* parent )
|
|||||||
.arg( QApplication::applicationVersion() ) );
|
.arg( QApplication::applicationVersion() ) );
|
||||||
label->setWordWrap( false );
|
label->setWordWrap( false );
|
||||||
|
|
||||||
QString featuresList = QStringLiteral( "<p><h3><b>Features:</b></h3><ul>" );
|
QString featuresList = QStringLiteral( "<p><h4><b>Features:</b></h4><ul>" );
|
||||||
|
|
||||||
#ifdef USE_QTDBUS
|
#ifdef USE_QTDBUS
|
||||||
featuresList.append( QStringLiteral( "<li>Support for Qt DBus messages" ) );
|
featuresList.append( QStringLiteral( "<li>Support for Qt DBus messages" ) );
|
||||||
@@ -63,14 +63,21 @@ AboutDialog::AboutDialog( QWidget* parent )
|
|||||||
featuresList.append( QStringLiteral( "</ul></p>" ) );
|
featuresList.append( QStringLiteral( "</ul></p>" ) );
|
||||||
QLabel* labelFeatures = new QLabel( featuresList );
|
QLabel* labelFeatures = new QLabel( featuresList );
|
||||||
|
|
||||||
QLabel* labelCopyright = new QLabel( QStringLiteral( "Copyright © 2014–2018 Joao Carreira and Luis Lucas" ) );
|
QString thanksList = QStringLiteral( "<p><h4><b>Thanks to:</b></h4><ul>" );
|
||||||
|
thanksList.append( QStringLiteral( "<li>Joao Santos" ) );
|
||||||
|
thanksList.append( QStringLiteral( "<li>Jose Filipe" ) );
|
||||||
|
thanksList.append( QStringLiteral( "</ul></p>" ) );
|
||||||
|
QLabel* labelContributors = new QLabel( thanksList );
|
||||||
|
|
||||||
|
QLabel* labelCopyright = new QLabel( QStringLiteral( "Copyright 2014–2021 Joao Carreira and Luis Lucas" ) );
|
||||||
|
|
||||||
QWidget* topWidget = new QWidget;
|
QWidget* topWidget = new QWidget;
|
||||||
QVBoxLayout* topLayout = new QVBoxLayout;
|
QVBoxLayout* topLayout = new QVBoxLayout;
|
||||||
topLayout->addWidget( pixmapLabel, 0, Qt::AlignHCenter );
|
topLayout->addWidget( pixmapLabel, 0, Qt::AlignHCenter );
|
||||||
topLayout->addWidget( label );
|
topLayout->addWidget( label );
|
||||||
topLayout->addWidget( labelFeatures );
|
|
||||||
topLayout->addWidget( labelCopyright );
|
topLayout->addWidget( labelCopyright );
|
||||||
|
topLayout->addWidget( labelFeatures );
|
||||||
|
topLayout->addWidget( labelContributors );
|
||||||
topWidget->setLayout( topLayout );
|
topWidget->setLayout( topLayout );
|
||||||
|
|
||||||
// QTextEdit *textEdit = new QTextEdit(tr("<p>This program is free "
|
// QTextEdit *textEdit = new QTextEdit(tr("<p>This program is free "
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,8 +24,6 @@
|
|||||||
|
|
||||||
#include "ConfigureFormatDialog.h"
|
#include "ConfigureFormatDialog.h"
|
||||||
|
|
||||||
#include "lib/CalypFrame.h"
|
|
||||||
|
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
@@ -39,6 +37,8 @@
|
|||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "lib/CalypFrame.h"
|
||||||
|
|
||||||
#define MAX_SUPPORTED_RESOLUTION 99999
|
#define MAX_SUPPORTED_RESOLUTION 99999
|
||||||
|
|
||||||
QDataStream& operator<<( QDataStream& out, const CalypStandardResolutionVector& array )
|
QDataStream& operator<<( QDataStream& out, const CalypStandardResolutionVector& array )
|
||||||
@@ -395,7 +395,7 @@ int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, un
|
|||||||
int sampling = 0;
|
int sampling = 0;
|
||||||
if( rInputFormat >= 0 )
|
if( rInputFormat >= 0 )
|
||||||
{
|
{
|
||||||
ClpString pelFmtName = CalypFrame::supportedPixelFormatListNames()[rInputFormat];
|
std::string pelFmtName = CalypFrame::supportedPixelFormatListNames()[rInputFormat];
|
||||||
for( unsigned int j = 0; j < CalypFrame::supportedColorSpacesListNames().size(); j++ )
|
for( unsigned int j = 0; j < CalypFrame::supportedColorSpacesListNames().size(); j++ )
|
||||||
{
|
{
|
||||||
for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames( j ).size(); i++ )
|
for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames( j ).size(); i++ )
|
||||||
@@ -442,7 +442,7 @@ int ConfigureFormatDialog::runConfigureFormatDialog( const QString& Filename, un
|
|||||||
rHeight = m_spinBoxheight->value();
|
rHeight = m_spinBoxheight->value();
|
||||||
colorSpace = m_comboBoxColorSpace->currentIndex();
|
colorSpace = m_comboBoxColorSpace->currentIndex();
|
||||||
sampling = m_comboBoxPixelFormat->currentIndex();
|
sampling = m_comboBoxPixelFormat->currentIndex();
|
||||||
ClpString pelFmtName = CalypFrame::supportedPixelFormatListNames( colorSpace )[sampling];
|
std::string pelFmtName = CalypFrame::supportedPixelFormatListNames( colorSpace )[sampling];
|
||||||
for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames().size(); i++ )
|
for( unsigned int i = 0; i < CalypFrame::supportedPixelFormatListNames().size(); i++ )
|
||||||
{
|
{
|
||||||
if( pelFmtName == CalypFrame::supportedPixelFormatListNames()[i] )
|
if( pelFmtName == CalypFrame::supportedPixelFormatListNames()[i] )
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,8 +24,6 @@
|
|||||||
|
|
||||||
#include "ModulesHandleOptDialog.h"
|
#include "ModulesHandleOptDialog.h"
|
||||||
|
|
||||||
#include "lib/CalypOptions.h"
|
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@@ -34,6 +32,8 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "lib/CalypOptions.h"
|
||||||
|
|
||||||
class QLineEdit;
|
class QLineEdit;
|
||||||
|
|
||||||
class OpionConfiguration : public QWidget
|
class OpionConfiguration : public QWidget
|
||||||
@@ -72,13 +72,13 @@ public:
|
|||||||
}
|
}
|
||||||
return m_pcValue->text();
|
return m_pcValue->text();
|
||||||
}
|
}
|
||||||
const ClpString& getName() { return m_cName; }
|
const std::string& getName() { return m_cName; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLineEdit* m_pcValue;
|
QLineEdit* m_pcValue;
|
||||||
QCheckBox* m_pcChecked;
|
QCheckBox* m_pcChecked;
|
||||||
QLabel* m_pcDescription;
|
QLabel* m_pcDescription;
|
||||||
ClpString m_cName;
|
std::string m_cName;
|
||||||
};
|
};
|
||||||
|
|
||||||
ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget* parent, CalypAppModuleIf* pcCurrModuleIf )
|
ModulesHandleOptDialog::ModulesHandleOptDialog( QWidget* parent, CalypAppModuleIf* pcCurrModuleIf )
|
||||||
@@ -121,8 +121,8 @@ int ModulesHandleOptDialog::runConfiguration()
|
|||||||
return QDialog::Rejected;
|
return QDialog::Rejected;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ClpString> argsArray;
|
std::vector<std::string> argsArray;
|
||||||
ClpString optionString;
|
std::string optionString;
|
||||||
QString valueString( "" );
|
QString valueString( "" );
|
||||||
|
|
||||||
for( int i = 0; i < m_apcOptionList.size(); i++ )
|
for( int i = 0; i < m_apcOptionList.size(); i++ )
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,13 +25,13 @@
|
|||||||
#ifndef __MODULEHANDLEOPTDIALOG_H__
|
#ifndef __MODULEHANDLEOPTDIALOG_H__
|
||||||
#define __MODULEHANDLEOPTDIALOG_H__
|
#define __MODULEHANDLEOPTDIALOG_H__
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
#include "CalypAppModuleIf.h"
|
#include "CalypAppModuleIf.h"
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
class OpionConfiguration;
|
class OpionConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,11 +25,11 @@
|
|||||||
#ifndef __PROGRESSBAR_H__
|
#ifndef __PROGRESSBAR_H__
|
||||||
#define __PROGRESSBAR_H__
|
#define __PROGRESSBAR_H__
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "CommonDefs.h"
|
||||||
|
|
||||||
class QProgressBar;
|
class QProgressBar;
|
||||||
|
|
||||||
class ProgressBar : public QWidget
|
class ProgressBar : public QWidget
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,8 +24,6 @@
|
|||||||
|
|
||||||
#include "SeekStreamDialog.h"
|
#include "SeekStreamDialog.h"
|
||||||
|
|
||||||
#include "lib/CalypStream.h"
|
|
||||||
|
|
||||||
#include <QDialogButtonBox>
|
#include <QDialogButtonBox>
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
@@ -33,7 +31,9 @@
|
|||||||
#include <QVector>
|
#include <QVector>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
SeekStreamDialog::SeekStreamDialog( CalypStream* pcCurrStream, QWidget* parent )
|
#include "lib/CalypStream.h"
|
||||||
|
|
||||||
|
SeekStreamDialog::SeekStreamDialog( const CalypStream* pcCurrStream, QWidget* parent )
|
||||||
: QDialog( parent, Qt::Dialog | Qt::WindowTitleHint ), m_iSelectedFrameNum()
|
: QDialog( parent, Qt::Dialog | Qt::WindowTitleHint ), m_iSelectedFrameNum()
|
||||||
{
|
{
|
||||||
m_iSelectedFrameNum = pcCurrStream->getCurrFrameNum();
|
m_iSelectedFrameNum = pcCurrStream->getCurrFrameNum();
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,13 +25,13 @@
|
|||||||
#ifndef __SEEKSTREAMDIALOG_H__
|
#ifndef __SEEKSTREAMDIALOG_H__
|
||||||
#define __SEEKSTREAMDIALOG_H__
|
#define __SEEKSTREAMDIALOG_H__
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QVector>
|
||||||
|
|
||||||
#include "CalypAppModuleIf.h"
|
#include "CalypAppModuleIf.h"
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <QDialog>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
class QSpinBox;
|
class QSpinBox;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,7 +42,7 @@ class SeekStreamDialog : public QDialog
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SeekStreamDialog( CalypStream* pcCurrStream, QWidget* parent = 0 );
|
SeekStreamDialog( const CalypStream* pcCurrStream, QWidget* parent = 0 );
|
||||||
int runDialog();
|
int runDialog();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,12 +24,12 @@
|
|||||||
|
|
||||||
#include "SubWindowSelectorDialog.h"
|
#include "SubWindowSelectorDialog.h"
|
||||||
|
|
||||||
#include "SubWindowHandle.h"
|
|
||||||
#include "VideoSubWindow.h"
|
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QGroupBox>
|
#include <QGroupBox>
|
||||||
|
|
||||||
|
#include "SubWindowHandle.h"
|
||||||
|
#include "VideoSubWindow.h"
|
||||||
|
|
||||||
SubWindowSelectorDialog::SubWindowSelectorDialog( QWidget* parent, SubWindowHandle* windowManager,
|
SubWindowSelectorDialog::SubWindowSelectorDialog( QWidget* parent, SubWindowHandle* windowManager,
|
||||||
unsigned int uiCategory, int minWindowsSelected, int maxWindowsSelected )
|
unsigned int uiCategory, int minWindowsSelected, int maxWindowsSelected )
|
||||||
: QDialog( parent )
|
: QDialog( parent )
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,13 +25,12 @@
|
|||||||
#ifndef __DIALOGSUBWINDOWSELECTOR_H__
|
#ifndef __DIALOGSUBWINDOWSELECTOR_H__
|
||||||
#define __DIALOGSUBWINDOWSELECTOR_H__
|
#define __DIALOGSUBWINDOWSELECTOR_H__
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include <QVector>
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
#include <QtWidgets>
|
#include <QtWidgets>
|
||||||
|
|
||||||
#include <QVector>
|
#include "CommonDefs.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
class QPixmap;
|
class QPixmap;
|
||||||
class QColor;
|
class QColor;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -28,12 +28,12 @@
|
|||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "lib/CalypStream.h"
|
||||||
|
|
||||||
FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitch )
|
FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitch )
|
||||||
: QWidget( parent ), m_pbIsPlaying( pbMainPlaySwitch )
|
: QWidget( parent ), m_bIsPlaying( false ), m_bHasFrame( false )
|
||||||
{
|
{
|
||||||
// -------------- Variables definition --------------
|
// -------------- Variables definition --------------
|
||||||
m_pcFrame = NULL;
|
|
||||||
m_pcSelectedFrame = NULL;
|
|
||||||
m_iLastFrameType = -1;
|
m_iLastFrameType = -1;
|
||||||
|
|
||||||
// Histogram area -----------------------------------------------------
|
// Histogram area -----------------------------------------------------
|
||||||
@@ -204,6 +204,11 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
|
|||||||
labelMedianValue = new QLabel;
|
labelMedianValue = new QLabel;
|
||||||
labelMedianValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
labelMedianValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||||
|
|
||||||
|
QLabel* entropyLabel = new QLabel( tr( "Entropy:" ) );
|
||||||
|
entropyLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||||
|
labelEntropyValue = new QLabel;
|
||||||
|
labelEntropyValue->setAlignment( Qt::AlignRight | Qt::AlignVCenter );
|
||||||
|
|
||||||
QLabel* percentileLabel = new QLabel( tr( "Percentile:" ) );
|
QLabel* percentileLabel = new QLabel( tr( "Percentile:" ) );
|
||||||
percentileLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
percentileLabel->setAlignment( Qt::AlignLeft | Qt::AlignVCenter );
|
||||||
labelPercentileValue = new QLabel;
|
labelPercentileValue = new QLabel;
|
||||||
@@ -225,6 +230,10 @@ FramePropertiesDock::FramePropertiesDock( QWidget* parent, bool* pbMainPlaySwitc
|
|||||||
statisticsLayout->addWidget( labelStdDevValue, gridRow++, 1 );
|
statisticsLayout->addWidget( labelStdDevValue, gridRow++, 1 );
|
||||||
statisticsLayout->addWidget( medianLabel, gridRow, 0 );
|
statisticsLayout->addWidget( medianLabel, gridRow, 0 );
|
||||||
statisticsLayout->addWidget( labelMedianValue, gridRow++, 1 );
|
statisticsLayout->addWidget( labelMedianValue, gridRow++, 1 );
|
||||||
|
statisticsLayout->addWidget( percentileLabel, gridRow, 0 );
|
||||||
|
statisticsLayout->addWidget( labelPercentileValue, gridRow++, 1 );
|
||||||
|
statisticsLayout->addWidget( entropyLabel, gridRow, 0 );
|
||||||
|
statisticsLayout->addWidget( labelEntropyValue, gridRow++, 1 );
|
||||||
|
|
||||||
QGroupBox* statisticsGroup = new QGroupBox( tr( "Statistics" ) );
|
QGroupBox* statisticsGroup = new QGroupBox( tr( "Statistics" ) );
|
||||||
statisticsGroup->setLayout( statisticsLayout );
|
statisticsGroup->setLayout( statisticsLayout );
|
||||||
@@ -271,16 +280,15 @@ QSize FramePropertiesDock::sizeHint() const
|
|||||||
|
|
||||||
void FramePropertiesDock::reset()
|
void FramePropertiesDock::reset()
|
||||||
{
|
{
|
||||||
m_pcFrame = NULL;
|
m_pcFrame = nullptr;
|
||||||
|
m_pcSelectedFrame = nullptr;
|
||||||
|
|
||||||
|
m_bHasFrame = false;
|
||||||
m_cSelectionArea = QRect();
|
m_cSelectionArea = QRect();
|
||||||
if( m_pcSelectedFrame )
|
|
||||||
{
|
|
||||||
delete m_pcSelectedFrame;
|
|
||||||
m_pcSelectedFrame = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_iLastFrameType = -1;
|
m_iLastFrameType = -1;
|
||||||
|
|
||||||
|
labelRangeValue->clear();
|
||||||
labelNEBinsValue->clear();
|
labelNEBinsValue->clear();
|
||||||
labelMeanValue->clear();
|
labelMeanValue->clear();
|
||||||
labelPixelsValue->clear();
|
labelPixelsValue->clear();
|
||||||
@@ -288,6 +296,7 @@ void FramePropertiesDock::reset()
|
|||||||
labelCountValue->clear();
|
labelCountValue->clear();
|
||||||
labelMedianValue->clear();
|
labelMedianValue->clear();
|
||||||
labelPercentileValue->clear();
|
labelPercentileValue->clear();
|
||||||
|
labelEntropyValue->clear();
|
||||||
|
|
||||||
// Remove the histogram data from memory
|
// Remove the histogram data from memory
|
||||||
histogramWidget->reset();
|
histogramWidget->reset();
|
||||||
@@ -295,7 +304,7 @@ void FramePropertiesDock::reset()
|
|||||||
setEnabled( false );
|
setEnabled( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramePropertiesDock::setFrame( CalypFrame* pcFrame )
|
void FramePropertiesDock::setFrame( std::shared_ptr<CalypFrame> pcFrame, bool isPlaying )
|
||||||
{
|
{
|
||||||
int colorSpace = pcFrame->getColorSpace();
|
int colorSpace = pcFrame->getColorSpace();
|
||||||
if( m_iLastFrameType != colorSpace )
|
if( m_iLastFrameType != colorSpace )
|
||||||
@@ -357,35 +366,40 @@ void FramePropertiesDock::setFrame( CalypFrame* pcFrame )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
setEnabled( true );
|
setEnabled( true );
|
||||||
if( m_pcFrame || !( *m_pbIsPlaying ) )
|
m_bIsPlaying = isPlaying;
|
||||||
|
if( !m_bIsPlaying )
|
||||||
{
|
{
|
||||||
m_pcFrame = pcFrame;
|
if( pcFrame )
|
||||||
updateDataHistogram();
|
{
|
||||||
|
m_bHasFrame = true;
|
||||||
|
m_pcFrame = pcFrame;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
m_bHasFrame = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
updateDataHistogram();
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramePropertiesDock::setSelection( const QRect& selectionArea )
|
void FramePropertiesDock::setSelection( const QRect& selectionArea )
|
||||||
{
|
{
|
||||||
if( m_pcFrame )
|
if( m_bHasFrame )
|
||||||
{
|
{
|
||||||
bool bSelectionChanged = !( selectionArea.size() == m_cSelectionArea.size() );
|
bool bSelectionChanged = !( selectionArea.size() == m_cSelectionArea.size() );
|
||||||
m_cSelectionArea = selectionArea;
|
|
||||||
if( selectionArea.isValid() )
|
if( selectionArea.isValid() )
|
||||||
{
|
{
|
||||||
|
m_cSelectionArea = selectionArea;
|
||||||
histogramWidget->stopHistogramComputation();
|
histogramWidget->stopHistogramComputation();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate a new image for the selection
|
* Crop selection from frame
|
||||||
* or just copy information
|
|
||||||
*/
|
*/
|
||||||
if( bSelectionChanged )
|
if( bSelectionChanged )
|
||||||
{
|
{
|
||||||
if( m_pcSelectedFrame )
|
m_pcSelectedFrame = std::make_shared<CalypFrame>( *m_pcFrame, selectionArea.x(),
|
||||||
{
|
selectionArea.y(),
|
||||||
delete m_pcSelectedFrame;
|
selectionArea.width(),
|
||||||
}
|
selectionArea.height() );
|
||||||
m_pcSelectedFrame = new CalypFrame( m_pcFrame, selectionArea.x(), selectionArea.y(), selectionArea.width(),
|
|
||||||
selectionArea.height() );
|
|
||||||
}
|
}
|
||||||
updateDataHistogram();
|
updateDataHistogram();
|
||||||
selectionImageButton->click();
|
selectionImageButton->click();
|
||||||
@@ -402,13 +416,21 @@ void FramePropertiesDock::setSelection( const QRect& selectionArea )
|
|||||||
|
|
||||||
void FramePropertiesDock::updateDataHistogram()
|
void FramePropertiesDock::updateDataHistogram()
|
||||||
{
|
{
|
||||||
if( m_pcFrame && isVisible() )
|
if( m_bHasFrame && isVisible() )
|
||||||
{
|
{
|
||||||
if( !*m_pbIsPlaying )
|
if( m_bIsPlaying )
|
||||||
{
|
{
|
||||||
if( m_pcSelectedFrame )
|
histogramWidget->setLoadingSkipped();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if( m_cSelectionArea.isValid() )
|
||||||
{
|
{
|
||||||
m_pcSelectedFrame->copyFrom( m_pcFrame, m_cSelectionArea.x(), m_cSelectionArea.y() );
|
m_pcSelectedFrame = std::make_shared<CalypFrame>( *m_pcFrame,
|
||||||
|
m_cSelectionArea.x(),
|
||||||
|
m_cSelectionArea.y(),
|
||||||
|
m_cSelectionArea.width(),
|
||||||
|
m_cSelectionArea.height() );
|
||||||
fullImageButton->show();
|
fullImageButton->show();
|
||||||
selectionImageButton->show();
|
selectionImageButton->show();
|
||||||
}
|
}
|
||||||
@@ -417,12 +439,9 @@ void FramePropertiesDock::updateDataHistogram()
|
|||||||
fullImageButton->hide();
|
fullImageButton->hide();
|
||||||
selectionImageButton->hide();
|
selectionImageButton->hide();
|
||||||
}
|
}
|
||||||
histogramWidget->updateData( m_pcFrame, m_pcSelectedFrame );
|
histogramWidget->updateData( m_pcFrame, m_cSelectionArea.isValid() ? m_pcSelectedFrame : nullptr );
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
histogramWidget->setLoadingSkipped();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
histogramWidget->update();
|
histogramWidget->update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -443,7 +462,7 @@ void FramePropertiesDock::updateStatistiques()
|
|||||||
if( channel == CalypFrame::HIST_ALL_CHANNELS )
|
if( channel == CalypFrame::HIST_ALL_CHANNELS )
|
||||||
channel = colorsCB->itemData( colorsCB->currentIndex() ).toInt();
|
channel = colorsCB->itemData( colorsCB->currentIndex() ).toInt();
|
||||||
|
|
||||||
CalypFrame* frame;
|
std::shared_ptr<CalypFrame> frame;
|
||||||
|
|
||||||
if( histogramWidget->m_renderingType == HistogramWidget::FullImageHistogram )
|
if( histogramWidget->m_renderingType == HistogramWidget::FullImageHistogram )
|
||||||
frame = histogramWidget->m_fullImage;
|
frame = histogramWidget->m_fullImage;
|
||||||
@@ -472,7 +491,10 @@ void FramePropertiesDock::updateStatistiques()
|
|||||||
labelCountValue->setText( value.setNum( (float)counts, 'f', 0 ) );
|
labelCountValue->setText( value.setNum( (float)counts, 'f', 0 ) );
|
||||||
|
|
||||||
double median = frame->getMedian( channel, min, max );
|
double median = frame->getMedian( channel, min, max );
|
||||||
labelMedianValue->setText( value.setNum( median, 'f', 1 ) );
|
labelMedianValue->setText( value.setNum( median, 'f', 0 ) );
|
||||||
|
|
||||||
|
double entropy = frame->getEntropy( channel, min, max );
|
||||||
|
labelEntropyValue->setText( value.setNum( entropy, 'f', 2 ) );
|
||||||
|
|
||||||
double percentile = ( pixels > 0 ? ( 100.0 * counts / pixels ) : 0.0 );
|
double percentile = ( pixels > 0 ? ( 100.0 * counts / pixels ) : 0.0 );
|
||||||
labelPercentileValue->setText( value.setNum( percentile, 'f', 1 ) );
|
labelPercentileValue->setText( value.setNum( percentile, 'f', 1 ) );
|
||||||
@@ -513,7 +535,7 @@ void FramePropertiesDock::slotRefreshOptions( int range )
|
|||||||
|
|
||||||
void FramePropertiesDock::slotHistogramComputationFailed()
|
void FramePropertiesDock::slotHistogramComputationFailed()
|
||||||
{
|
{
|
||||||
m_pcFrame = NULL;
|
m_bHasFrame = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FramePropertiesDock::slotChannelChanged( int index )
|
void FramePropertiesDock::slotChannelChanged( int index )
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,13 +25,14 @@
|
|||||||
#ifndef __FRAMEPROPERTIESDOCK_H__
|
#ifndef __FRAMEPROPERTIESDOCK_H__
|
||||||
#define __FRAMEPROPERTIESDOCK_H__
|
#define __FRAMEPROPERTIESDOCK_H__
|
||||||
|
|
||||||
|
#include <QtWidgets>
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "HistogramWidget.h"
|
#include "HistogramWidget.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "lib/CalypFrame.h"
|
#include "lib/CalypFrame.h"
|
||||||
#include "lib/CalypStream.h"
|
|
||||||
|
|
||||||
#include <QtWidgets>
|
class CalypStream;
|
||||||
|
|
||||||
class FramePropertiesDock : public QWidget
|
class FramePropertiesDock : public QWidget
|
||||||
{
|
{
|
||||||
@@ -42,17 +43,17 @@ public:
|
|||||||
|
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
|
|
||||||
void setFrame( CalypFrame* m_pcFrame );
|
void setFrame( std::shared_ptr<CalypFrame> m_pcFrame, bool isPlaying );
|
||||||
void setSelection( const QRect& selectionArea );
|
void setSelection( const QRect& selectionArea );
|
||||||
void reset();
|
void reset();
|
||||||
void stopHistogram();
|
void stopHistogram();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CalypFrame* m_pcFrame;
|
std::shared_ptr<CalypFrame> m_pcFrame;
|
||||||
CalypFrame* m_pcSelectedFrame;
|
std::shared_ptr<CalypFrame> m_pcSelectedFrame;
|
||||||
int m_iLastFrameType;
|
int m_iLastFrameType;
|
||||||
|
bool m_bIsPlaying;
|
||||||
bool* m_pbIsPlaying;
|
bool m_bHasFrame;
|
||||||
|
|
||||||
QComboBox* channelCB;
|
QComboBox* channelCB;
|
||||||
QComboBox* colorsCB;
|
QComboBox* colorsCB;
|
||||||
@@ -76,6 +77,7 @@ private:
|
|||||||
QLabel* labelMeanValue;
|
QLabel* labelMeanValue;
|
||||||
QLabel* labelStdDevValue;
|
QLabel* labelStdDevValue;
|
||||||
QLabel* labelMedianValue;
|
QLabel* labelMedianValue;
|
||||||
|
QLabel* labelEntropyValue;
|
||||||
QLabel* labelPercentileValue;
|
QLabel* labelPercentileValue;
|
||||||
|
|
||||||
QLabel* colorsLabel;
|
QLabel* colorsLabel;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,14 +24,14 @@
|
|||||||
|
|
||||||
#include "ModuleHandleDock.h"
|
#include "ModuleHandleDock.h"
|
||||||
|
|
||||||
#include "CalypAppModuleIf.h"
|
|
||||||
#include "ModulesHandle.h"
|
|
||||||
|
|
||||||
#include <QGridLayout>
|
#include <QGridLayout>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QtGui>
|
#include <QtGui>
|
||||||
|
|
||||||
|
#include "CalypAppModuleIf.h"
|
||||||
|
#include "ModulesHandle.h"
|
||||||
|
|
||||||
ModuleHandleDock::ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf )
|
ModuleHandleDock::ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf )
|
||||||
: QWidget( parent ), m_pcCurrModuleIf( moduleIf )
|
: QWidget( parent ), m_pcCurrModuleIf( moduleIf )
|
||||||
{
|
{
|
||||||
@@ -58,9 +58,9 @@ ModuleHandleDock::ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf
|
|||||||
setEnabled( true );
|
setEnabled( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
ModuleHandleDock::~ModuleHandleDock() {}
|
ModuleHandleDock::~ModuleHandleDock() = default;
|
||||||
|
|
||||||
void ModuleHandleDock::setModulueReturnValue( double value )
|
void ModuleHandleDock::setModuleReturnValue( double value )
|
||||||
{
|
{
|
||||||
labelModulueReturnValue->clear();
|
labelModulueReturnValue->clear();
|
||||||
QString strValue = QString( "%1" ).arg( value );
|
QString strValue = QString( "%1" ).arg( value );
|
||||||
@@ -69,11 +69,9 @@ void ModuleHandleDock::setModulueReturnValue( double value )
|
|||||||
|
|
||||||
void ModuleHandleDock::visibilityChangedSlot( bool visiblity )
|
void ModuleHandleDock::visibilityChangedSlot( bool visiblity )
|
||||||
{
|
{
|
||||||
if( !visiblity && m_pcCurrModuleIf )
|
if( !visiblity )
|
||||||
{
|
{
|
||||||
CalypAppModuleIf* pcCurrentModule = m_pcCurrModuleIf;
|
m_pcCurrModuleIf->disable();
|
||||||
m_pcCurrModuleIf = NULL;
|
|
||||||
ModulesHandle::destroyModuleIf( pcCurrentModule );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,12 +25,12 @@
|
|||||||
#ifndef __MODULEHANDLEDOCK_H__
|
#ifndef __MODULEHANDLEDOCK_H__
|
||||||
#define __MODULEHANDLEDOCK_H__
|
#define __MODULEHANDLEDOCK_H__
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "CommonDefs.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
|
||||||
class CalypAppModuleIf;
|
class CalypAppModuleIf;
|
||||||
@@ -42,7 +42,7 @@ public:
|
|||||||
ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf );
|
ModuleHandleDock( QWidget* parent, CalypAppModuleIf* moduleIf );
|
||||||
~ModuleHandleDock();
|
~ModuleHandleDock();
|
||||||
|
|
||||||
void setModulueReturnValue( double value );
|
void setModuleReturnValue( double value );
|
||||||
|
|
||||||
QSize sizeHint() const;
|
QSize sizeHint() const;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,11 +24,11 @@
|
|||||||
|
|
||||||
#include "QualityMeasurementSidebar.h"
|
#include "QualityMeasurementSidebar.h"
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
#include "SubWindowHandle.h"
|
#include "SubWindowHandle.h"
|
||||||
#include "VideoSubWindow.h"
|
#include "VideoSubWindow.h"
|
||||||
|
|
||||||
#include <QtGui>
|
|
||||||
|
|
||||||
QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, SubWindowHandle* windowManager )
|
QualityMeasurementSidebar::QualityMeasurementSidebar( QWidget* parent, SubWindowHandle* windowManager )
|
||||||
: QWidget( parent ), m_pcMainWindowManager( windowManager ), m_pcCurrentVideoSubWindow( NULL )
|
: QWidget( parent ), m_pcMainWindowManager( windowManager ), m_pcCurrentVideoSubWindow( NULL )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,14 +25,14 @@
|
|||||||
#ifndef __QUALITYMEASUREMENTSIDEBAR_H__
|
#ifndef __QUALITYMEASUREMENTSIDEBAR_H__
|
||||||
#define __QUALITYMEASUREMENTSIDEBAR_H__
|
#define __QUALITYMEASUREMENTSIDEBAR_H__
|
||||||
|
|
||||||
|
#include <QtWidgets>
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "HistogramWidget.h"
|
#include "HistogramWidget.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "lib/CalypFrame.h"
|
#include "lib/CalypFrame.h"
|
||||||
#include "lib/CalypStream.h"
|
#include "lib/CalypStream.h"
|
||||||
|
|
||||||
#include <QtWidgets>
|
|
||||||
|
|
||||||
class SubWindowHandle;
|
class SubWindowHandle;
|
||||||
class VideoSubWindow;
|
class VideoSubWindow;
|
||||||
|
|
||||||
|
|||||||
Vendored
+4
-4
@@ -1,5 +1,5 @@
|
|||||||
###
|
#
|
||||||
### CMakeLists for calyp external components
|
# CMakeLists for calyp external components
|
||||||
###
|
#
|
||||||
|
|
||||||
ADD_SUBDIRECTORY( qcustomplot )
|
ADD_SUBDIRECTORY(qcustomplot)
|
||||||
+13
-16
@@ -1,20 +1,17 @@
|
|||||||
###
|
#
|
||||||
### CMakeLists for qcustomplot
|
# CMakeLists for qcustomplot
|
||||||
###
|
#
|
||||||
|
|
||||||
FIND_PACKAGE( Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport )
|
FIND_PACKAGE(Qt5 REQUIRED COMPONENTS Core Gui Widgets PrintSupport)
|
||||||
|
|
||||||
set(qcustomplot_SRCS
|
SET(qcustomplot_SRCS qcustomplot.cpp qcustomplot.h)
|
||||||
qcustomplot.cpp
|
|
||||||
qcustomplot.h
|
|
||||||
)
|
|
||||||
|
|
||||||
ADD_LIBRARY( QCustomPlotLib STATIC ${qcustomplot_SRCS} )
|
SET(CMAKE_AUTOMOC ON)
|
||||||
TARGET_LINK_LIBRARIES( QCustomPlotLib
|
|
||||||
Qt5::Core
|
|
||||||
Qt5::Gui
|
|
||||||
Qt5::Widgets
|
|
||||||
Qt5::PrintSupport
|
|
||||||
)
|
|
||||||
|
|
||||||
TARGET_INCLUDE_DIRECTORIES(QCustomPlotLib PUBLIC . )
|
IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations -Wno-deprecated-enum-enum-conversion")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
ADD_LIBRARY(QCustomPlotLib STATIC ${qcustomplot_SRCS})
|
||||||
|
TARGET_LINK_LIBRARIES(QCustomPlotLib Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport)
|
||||||
|
TARGET_INCLUDE_DIRECTORIES(QCustomPlotLib PUBLIC .)
|
||||||
+674
@@ -0,0 +1,674 @@
|
|||||||
|
GNU GENERAL PUBLIC LICENSE
|
||||||
|
Version 3, 29 June 2007
|
||||||
|
|
||||||
|
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
||||||
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
|
Preamble
|
||||||
|
|
||||||
|
The GNU General Public License is a free, copyleft license for
|
||||||
|
software and other kinds of works.
|
||||||
|
|
||||||
|
The licenses for most software and other practical works are designed
|
||||||
|
to take away your freedom to share and change the works. By contrast,
|
||||||
|
the GNU General Public License is intended to guarantee your freedom to
|
||||||
|
share and change all versions of a program--to make sure it remains free
|
||||||
|
software for all its users. We, the Free Software Foundation, use the
|
||||||
|
GNU General Public License for most of our software; it applies also to
|
||||||
|
any other work released this way by its authors. You can apply it to
|
||||||
|
your programs, too.
|
||||||
|
|
||||||
|
When we speak of free software, we are referring to freedom, not
|
||||||
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
|
have the freedom to distribute copies of free software (and charge for
|
||||||
|
them if you wish), that you receive source code or can get it if you
|
||||||
|
want it, that you can change the software or use pieces of it in new
|
||||||
|
free programs, and that you know you can do these things.
|
||||||
|
|
||||||
|
To protect your rights, we need to prevent others from denying you
|
||||||
|
these rights or asking you to surrender the rights. Therefore, you have
|
||||||
|
certain responsibilities if you distribute copies of the software, or if
|
||||||
|
you modify it: responsibilities to respect the freedom of others.
|
||||||
|
|
||||||
|
For example, if you distribute copies of such a program, whether
|
||||||
|
gratis or for a fee, you must pass on to the recipients the same
|
||||||
|
freedoms that you received. You must make sure that they, too, receive
|
||||||
|
or can get the source code. And you must show them these terms so they
|
||||||
|
know their rights.
|
||||||
|
|
||||||
|
Developers that use the GNU GPL protect your rights with two steps:
|
||||||
|
(1) assert copyright on the software, and (2) offer you this License
|
||||||
|
giving you legal permission to copy, distribute and/or modify it.
|
||||||
|
|
||||||
|
For the developers' and authors' protection, the GPL clearly explains
|
||||||
|
that there is no warranty for this free software. For both users' and
|
||||||
|
authors' sake, the GPL requires that modified versions be marked as
|
||||||
|
changed, so that their problems will not be attributed erroneously to
|
||||||
|
authors of previous versions.
|
||||||
|
|
||||||
|
Some devices are designed to deny users access to install or run
|
||||||
|
modified versions of the software inside them, although the manufacturer
|
||||||
|
can do so. This is fundamentally incompatible with the aim of
|
||||||
|
protecting users' freedom to change the software. The systematic
|
||||||
|
pattern of such abuse occurs in the area of products for individuals to
|
||||||
|
use, which is precisely where it is most unacceptable. Therefore, we
|
||||||
|
have designed this version of the GPL to prohibit the practice for those
|
||||||
|
products. If such problems arise substantially in other domains, we
|
||||||
|
stand ready to extend this provision to those domains in future versions
|
||||||
|
of the GPL, as needed to protect the freedom of users.
|
||||||
|
|
||||||
|
Finally, every program is threatened constantly by software patents.
|
||||||
|
States should not allow patents to restrict development and use of
|
||||||
|
software on general-purpose computers, but in those that do, we wish to
|
||||||
|
avoid the special danger that patents applied to a free program could
|
||||||
|
make it effectively proprietary. To prevent this, the GPL assures that
|
||||||
|
patents cannot be used to render the program non-free.
|
||||||
|
|
||||||
|
The precise terms and conditions for copying, distribution and
|
||||||
|
modification follow.
|
||||||
|
|
||||||
|
TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
0. Definitions.
|
||||||
|
|
||||||
|
"This License" refers to version 3 of the GNU General Public License.
|
||||||
|
|
||||||
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
|
"recipients" may be individuals or organizations.
|
||||||
|
|
||||||
|
To "modify" a work means to copy from or adapt all or part of the work
|
||||||
|
in a fashion requiring copyright permission, other than the making of an
|
||||||
|
exact copy. The resulting work is called a "modified version" of the
|
||||||
|
earlier work or a work "based on" the earlier work.
|
||||||
|
|
||||||
|
A "covered work" means either the unmodified Program or a work based
|
||||||
|
on the Program.
|
||||||
|
|
||||||
|
To "propagate" a work means to do anything with it that, without
|
||||||
|
permission, would make you directly or secondarily liable for
|
||||||
|
infringement under applicable copyright law, except executing it on a
|
||||||
|
computer or modifying a private copy. Propagation includes copying,
|
||||||
|
distribution (with or without modification), making available to the
|
||||||
|
public, and in some countries other activities as well.
|
||||||
|
|
||||||
|
To "convey" a work means any kind of propagation that enables other
|
||||||
|
parties to make or receive copies. Mere interaction with a user through
|
||||||
|
a computer network, with no transfer of a copy, is not conveying.
|
||||||
|
|
||||||
|
An interactive user interface displays "Appropriate Legal Notices"
|
||||||
|
to the extent that it includes a convenient and prominently visible
|
||||||
|
feature that (1) displays an appropriate copyright notice, and (2)
|
||||||
|
tells the user that there is no warranty for the work (except to the
|
||||||
|
extent that warranties are provided), that licensees may convey the
|
||||||
|
work under this License, and how to view a copy of this License. If
|
||||||
|
the interface presents a list of user commands or options, such as a
|
||||||
|
menu, a prominent item in the list meets this criterion.
|
||||||
|
|
||||||
|
1. Source Code.
|
||||||
|
|
||||||
|
The "source code" for a work means the preferred form of the work
|
||||||
|
for making modifications to it. "Object code" means any non-source
|
||||||
|
form of a work.
|
||||||
|
|
||||||
|
A "Standard Interface" means an interface that either is an official
|
||||||
|
standard defined by a recognized standards body, or, in the case of
|
||||||
|
interfaces specified for a particular programming language, one that
|
||||||
|
is widely used among developers working in that language.
|
||||||
|
|
||||||
|
The "System Libraries" of an executable work include anything, other
|
||||||
|
than the work as a whole, that (a) is included in the normal form of
|
||||||
|
packaging a Major Component, but which is not part of that Major
|
||||||
|
Component, and (b) serves only to enable use of the work with that
|
||||||
|
Major Component, or to implement a Standard Interface for which an
|
||||||
|
implementation is available to the public in source code form. A
|
||||||
|
"Major Component", in this context, means a major essential component
|
||||||
|
(kernel, window system, and so on) of the specific operating system
|
||||||
|
(if any) on which the executable work runs, or a compiler used to
|
||||||
|
produce the work, or an object code interpreter used to run it.
|
||||||
|
|
||||||
|
The "Corresponding Source" for a work in object code form means all
|
||||||
|
the source code needed to generate, install, and (for an executable
|
||||||
|
work) run the object code and to modify the work, including scripts to
|
||||||
|
control those activities. However, it does not include the work's
|
||||||
|
System Libraries, or general-purpose tools or generally available free
|
||||||
|
programs which are used unmodified in performing those activities but
|
||||||
|
which are not part of the work. For example, Corresponding Source
|
||||||
|
includes interface definition files associated with source files for
|
||||||
|
the work, and the source code for shared libraries and dynamically
|
||||||
|
linked subprograms that the work is specifically designed to require,
|
||||||
|
such as by intimate data communication or control flow between those
|
||||||
|
subprograms and other parts of the work.
|
||||||
|
|
||||||
|
The Corresponding Source need not include anything that users
|
||||||
|
can regenerate automatically from other parts of the Corresponding
|
||||||
|
Source.
|
||||||
|
|
||||||
|
The Corresponding Source for a work in source code form is that
|
||||||
|
same work.
|
||||||
|
|
||||||
|
2. Basic Permissions.
|
||||||
|
|
||||||
|
All rights granted under this License are granted for the term of
|
||||||
|
copyright on the Program, and are irrevocable provided the stated
|
||||||
|
conditions are met. This License explicitly affirms your unlimited
|
||||||
|
permission to run the unmodified Program. The output from running a
|
||||||
|
covered work is covered by this License only if the output, given its
|
||||||
|
content, constitutes a covered work. This License acknowledges your
|
||||||
|
rights of fair use or other equivalent, as provided by copyright law.
|
||||||
|
|
||||||
|
You may make, run and propagate covered works that you do not
|
||||||
|
convey, without conditions so long as your license otherwise remains
|
||||||
|
in force. You may convey covered works to others for the sole purpose
|
||||||
|
of having them make modifications exclusively for you, or provide you
|
||||||
|
with facilities for running those works, provided that you comply with
|
||||||
|
the terms of this License in conveying all material for which you do
|
||||||
|
not control copyright. Those thus making or running the covered works
|
||||||
|
for you must do so exclusively on your behalf, under your direction
|
||||||
|
and control, on terms that prohibit them from making any copies of
|
||||||
|
your copyrighted material outside their relationship with you.
|
||||||
|
|
||||||
|
Conveying under any other circumstances is permitted solely under
|
||||||
|
the conditions stated below. Sublicensing is not allowed; section 10
|
||||||
|
makes it unnecessary.
|
||||||
|
|
||||||
|
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
|
||||||
|
|
||||||
|
No covered work shall be deemed part of an effective technological
|
||||||
|
measure under any applicable law fulfilling obligations under article
|
||||||
|
11 of the WIPO copyright treaty adopted on 20 December 1996, or
|
||||||
|
similar laws prohibiting or restricting circumvention of such
|
||||||
|
measures.
|
||||||
|
|
||||||
|
When you convey a covered work, you waive any legal power to forbid
|
||||||
|
circumvention of technological measures to the extent such circumvention
|
||||||
|
is effected by exercising rights under this License with respect to
|
||||||
|
the covered work, and you disclaim any intention to limit operation or
|
||||||
|
modification of the work as a means of enforcing, against the work's
|
||||||
|
users, your or third parties' legal rights to forbid circumvention of
|
||||||
|
technological measures.
|
||||||
|
|
||||||
|
4. Conveying Verbatim Copies.
|
||||||
|
|
||||||
|
You may convey verbatim copies of the Program's source code as you
|
||||||
|
receive it, in any medium, provided that you conspicuously and
|
||||||
|
appropriately publish on each copy an appropriate copyright notice;
|
||||||
|
keep intact all notices stating that this License and any
|
||||||
|
non-permissive terms added in accord with section 7 apply to the code;
|
||||||
|
keep intact all notices of the absence of any warranty; and give all
|
||||||
|
recipients a copy of this License along with the Program.
|
||||||
|
|
||||||
|
You may charge any price or no price for each copy that you convey,
|
||||||
|
and you may offer support or warranty protection for a fee.
|
||||||
|
|
||||||
|
5. Conveying Modified Source Versions.
|
||||||
|
|
||||||
|
You may convey a work based on the Program, or the modifications to
|
||||||
|
produce it from the Program, in the form of source code under the
|
||||||
|
terms of section 4, provided that you also meet all of these conditions:
|
||||||
|
|
||||||
|
a) The work must carry prominent notices stating that you modified
|
||||||
|
it, and giving a relevant date.
|
||||||
|
|
||||||
|
b) The work must carry prominent notices stating that it is
|
||||||
|
released under this License and any conditions added under section
|
||||||
|
7. This requirement modifies the requirement in section 4 to
|
||||||
|
"keep intact all notices".
|
||||||
|
|
||||||
|
c) You must license the entire work, as a whole, under this
|
||||||
|
License to anyone who comes into possession of a copy. This
|
||||||
|
License will therefore apply, along with any applicable section 7
|
||||||
|
additional terms, to the whole of the work, and all its parts,
|
||||||
|
regardless of how they are packaged. This License gives no
|
||||||
|
permission to license the work in any other way, but it does not
|
||||||
|
invalidate such permission if you have separately received it.
|
||||||
|
|
||||||
|
d) If the work has interactive user interfaces, each must display
|
||||||
|
Appropriate Legal Notices; however, if the Program has interactive
|
||||||
|
interfaces that do not display Appropriate Legal Notices, your
|
||||||
|
work need not make them do so.
|
||||||
|
|
||||||
|
A compilation of a covered work with other separate and independent
|
||||||
|
works, which are not by their nature extensions of the covered work,
|
||||||
|
and which are not combined with it such as to form a larger program,
|
||||||
|
in or on a volume of a storage or distribution medium, is called an
|
||||||
|
"aggregate" if the compilation and its resulting copyright are not
|
||||||
|
used to limit the access or legal rights of the compilation's users
|
||||||
|
beyond what the individual works permit. Inclusion of a covered work
|
||||||
|
in an aggregate does not cause this License to apply to the other
|
||||||
|
parts of the aggregate.
|
||||||
|
|
||||||
|
6. Conveying Non-Source Forms.
|
||||||
|
|
||||||
|
You may convey a covered work in object code form under the terms
|
||||||
|
of sections 4 and 5, provided that you also convey the
|
||||||
|
machine-readable Corresponding Source under the terms of this License,
|
||||||
|
in one of these ways:
|
||||||
|
|
||||||
|
a) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by the
|
||||||
|
Corresponding Source fixed on a durable physical medium
|
||||||
|
customarily used for software interchange.
|
||||||
|
|
||||||
|
b) Convey the object code in, or embodied in, a physical product
|
||||||
|
(including a physical distribution medium), accompanied by a
|
||||||
|
written offer, valid for at least three years and valid for as
|
||||||
|
long as you offer spare parts or customer support for that product
|
||||||
|
model, to give anyone who possesses the object code either (1) a
|
||||||
|
copy of the Corresponding Source for all the software in the
|
||||||
|
product that is covered by this License, on a durable physical
|
||||||
|
medium customarily used for software interchange, for a price no
|
||||||
|
more than your reasonable cost of physically performing this
|
||||||
|
conveying of source, or (2) access to copy the
|
||||||
|
Corresponding Source from a network server at no charge.
|
||||||
|
|
||||||
|
c) Convey individual copies of the object code with a copy of the
|
||||||
|
written offer to provide the Corresponding Source. This
|
||||||
|
alternative is allowed only occasionally and noncommercially, and
|
||||||
|
only if you received the object code with such an offer, in accord
|
||||||
|
with subsection 6b.
|
||||||
|
|
||||||
|
d) Convey the object code by offering access from a designated
|
||||||
|
place (gratis or for a charge), and offer equivalent access to the
|
||||||
|
Corresponding Source in the same way through the same place at no
|
||||||
|
further charge. You need not require recipients to copy the
|
||||||
|
Corresponding Source along with the object code. If the place to
|
||||||
|
copy the object code is a network server, the Corresponding Source
|
||||||
|
may be on a different server (operated by you or a third party)
|
||||||
|
that supports equivalent copying facilities, provided you maintain
|
||||||
|
clear directions next to the object code saying where to find the
|
||||||
|
Corresponding Source. Regardless of what server hosts the
|
||||||
|
Corresponding Source, you remain obligated to ensure that it is
|
||||||
|
available for as long as needed to satisfy these requirements.
|
||||||
|
|
||||||
|
e) Convey the object code using peer-to-peer transmission, provided
|
||||||
|
you inform other peers where the object code and Corresponding
|
||||||
|
Source of the work are being offered to the general public at no
|
||||||
|
charge under subsection 6d.
|
||||||
|
|
||||||
|
A separable portion of the object code, whose source code is excluded
|
||||||
|
from the Corresponding Source as a System Library, need not be
|
||||||
|
included in conveying the object code work.
|
||||||
|
|
||||||
|
A "User Product" is either (1) a "consumer product", which means any
|
||||||
|
tangible personal property which is normally used for personal, family,
|
||||||
|
or household purposes, or (2) anything designed or sold for incorporation
|
||||||
|
into a dwelling. In determining whether a product is a consumer product,
|
||||||
|
doubtful cases shall be resolved in favor of coverage. For a particular
|
||||||
|
product received by a particular user, "normally used" refers to a
|
||||||
|
typical or common use of that class of product, regardless of the status
|
||||||
|
of the particular user or of the way in which the particular user
|
||||||
|
actually uses, or expects or is expected to use, the product. A product
|
||||||
|
is a consumer product regardless of whether the product has substantial
|
||||||
|
commercial, industrial or non-consumer uses, unless such uses represent
|
||||||
|
the only significant mode of use of the product.
|
||||||
|
|
||||||
|
"Installation Information" for a User Product means any methods,
|
||||||
|
procedures, authorization keys, or other information required to install
|
||||||
|
and execute modified versions of a covered work in that User Product from
|
||||||
|
a modified version of its Corresponding Source. The information must
|
||||||
|
suffice to ensure that the continued functioning of the modified object
|
||||||
|
code is in no case prevented or interfered with solely because
|
||||||
|
modification has been made.
|
||||||
|
|
||||||
|
If you convey an object code work under this section in, or with, or
|
||||||
|
specifically for use in, a User Product, and the conveying occurs as
|
||||||
|
part of a transaction in which the right of possession and use of the
|
||||||
|
User Product is transferred to the recipient in perpetuity or for a
|
||||||
|
fixed term (regardless of how the transaction is characterized), the
|
||||||
|
Corresponding Source conveyed under this section must be accompanied
|
||||||
|
by the Installation Information. But this requirement does not apply
|
||||||
|
if neither you nor any third party retains the ability to install
|
||||||
|
modified object code on the User Product (for example, the work has
|
||||||
|
been installed in ROM).
|
||||||
|
|
||||||
|
The requirement to provide Installation Information does not include a
|
||||||
|
requirement to continue to provide support service, warranty, or updates
|
||||||
|
for a work that has been modified or installed by the recipient, or for
|
||||||
|
the User Product in which it has been modified or installed. Access to a
|
||||||
|
network may be denied when the modification itself materially and
|
||||||
|
adversely affects the operation of the network or violates the rules and
|
||||||
|
protocols for communication across the network.
|
||||||
|
|
||||||
|
Corresponding Source conveyed, and Installation Information provided,
|
||||||
|
in accord with this section must be in a format that is publicly
|
||||||
|
documented (and with an implementation available to the public in
|
||||||
|
source code form), and must require no special password or key for
|
||||||
|
unpacking, reading or copying.
|
||||||
|
|
||||||
|
7. Additional Terms.
|
||||||
|
|
||||||
|
"Additional permissions" are terms that supplement the terms of this
|
||||||
|
License by making exceptions from one or more of its conditions.
|
||||||
|
Additional permissions that are applicable to the entire Program shall
|
||||||
|
be treated as though they were included in this License, to the extent
|
||||||
|
that they are valid under applicable law. If additional permissions
|
||||||
|
apply only to part of the Program, that part may be used separately
|
||||||
|
under those permissions, but the entire Program remains governed by
|
||||||
|
this License without regard to the additional permissions.
|
||||||
|
|
||||||
|
When you convey a copy of a covered work, you may at your option
|
||||||
|
remove any additional permissions from that copy, or from any part of
|
||||||
|
it. (Additional permissions may be written to require their own
|
||||||
|
removal in certain cases when you modify the work.) You may place
|
||||||
|
additional permissions on material, added by you to a covered work,
|
||||||
|
for which you have or can give appropriate copyright permission.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, for material you
|
||||||
|
add to a covered work, you may (if authorized by the copyright holders of
|
||||||
|
that material) supplement the terms of this License with terms:
|
||||||
|
|
||||||
|
a) Disclaiming warranty or limiting liability differently from the
|
||||||
|
terms of sections 15 and 16 of this License; or
|
||||||
|
|
||||||
|
b) Requiring preservation of specified reasonable legal notices or
|
||||||
|
author attributions in that material or in the Appropriate Legal
|
||||||
|
Notices displayed by works containing it; or
|
||||||
|
|
||||||
|
c) Prohibiting misrepresentation of the origin of that material, or
|
||||||
|
requiring that modified versions of such material be marked in
|
||||||
|
reasonable ways as different from the original version; or
|
||||||
|
|
||||||
|
d) Limiting the use for publicity purposes of names of licensors or
|
||||||
|
authors of the material; or
|
||||||
|
|
||||||
|
e) Declining to grant rights under trademark law for use of some
|
||||||
|
trade names, trademarks, or service marks; or
|
||||||
|
|
||||||
|
f) Requiring indemnification of licensors and authors of that
|
||||||
|
material by anyone who conveys the material (or modified versions of
|
||||||
|
it) with contractual assumptions of liability to the recipient, for
|
||||||
|
any liability that these contractual assumptions directly impose on
|
||||||
|
those licensors and authors.
|
||||||
|
|
||||||
|
All other non-permissive additional terms are considered "further
|
||||||
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
|
received it, or any part of it, contains a notice stating that it is
|
||||||
|
governed by this License along with a term that is a further
|
||||||
|
restriction, you may remove that term. If a license document contains
|
||||||
|
a further restriction but permits relicensing or conveying under this
|
||||||
|
License, you may add to a covered work material governed by the terms
|
||||||
|
of that license document, provided that the further restriction does
|
||||||
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
|
If you add terms to a covered work in accord with this section, you
|
||||||
|
must place, in the relevant source files, a statement of the
|
||||||
|
additional terms that apply to those files, or a notice indicating
|
||||||
|
where to find the applicable terms.
|
||||||
|
|
||||||
|
Additional terms, permissive or non-permissive, may be stated in the
|
||||||
|
form of a separately written license, or stated as exceptions;
|
||||||
|
the above requirements apply either way.
|
||||||
|
|
||||||
|
8. Termination.
|
||||||
|
|
||||||
|
You may not propagate or modify a covered work except as expressly
|
||||||
|
provided under this License. Any attempt otherwise to propagate or
|
||||||
|
modify it is void, and will automatically terminate your rights under
|
||||||
|
this License (including any patent licenses granted under the third
|
||||||
|
paragraph of section 11).
|
||||||
|
|
||||||
|
However, if you cease all violation of this License, then your
|
||||||
|
license from a particular copyright holder is reinstated (a)
|
||||||
|
provisionally, unless and until the copyright holder explicitly and
|
||||||
|
finally terminates your license, and (b) permanently, if the copyright
|
||||||
|
holder fails to notify you of the violation by some reasonable means
|
||||||
|
prior to 60 days after the cessation.
|
||||||
|
|
||||||
|
Moreover, your license from a particular copyright holder is
|
||||||
|
reinstated permanently if the copyright holder notifies you of the
|
||||||
|
violation by some reasonable means, this is the first time you have
|
||||||
|
received notice of violation of this License (for any work) from that
|
||||||
|
copyright holder, and you cure the violation prior to 30 days after
|
||||||
|
your receipt of the notice.
|
||||||
|
|
||||||
|
Termination of your rights under this section does not terminate the
|
||||||
|
licenses of parties who have received copies or rights from you under
|
||||||
|
this License. If your rights have been terminated and not permanently
|
||||||
|
reinstated, you do not qualify to receive new licenses for the same
|
||||||
|
material under section 10.
|
||||||
|
|
||||||
|
9. Acceptance Not Required for Having Copies.
|
||||||
|
|
||||||
|
You are not required to accept this License in order to receive or
|
||||||
|
run a copy of the Program. Ancillary propagation of a covered work
|
||||||
|
occurring solely as a consequence of using peer-to-peer transmission
|
||||||
|
to receive a copy likewise does not require acceptance. However,
|
||||||
|
nothing other than this License grants you permission to propagate or
|
||||||
|
modify any covered work. These actions infringe copyright if you do
|
||||||
|
not accept this License. Therefore, by modifying or propagating a
|
||||||
|
covered work, you indicate your acceptance of this License to do so.
|
||||||
|
|
||||||
|
10. Automatic Licensing of Downstream Recipients.
|
||||||
|
|
||||||
|
Each time you convey a covered work, the recipient automatically
|
||||||
|
receives a license from the original licensors, to run, modify and
|
||||||
|
propagate that work, subject to this License. You are not responsible
|
||||||
|
for enforcing compliance by third parties with this License.
|
||||||
|
|
||||||
|
An "entity transaction" is a transaction transferring control of an
|
||||||
|
organization, or substantially all assets of one, or subdividing an
|
||||||
|
organization, or merging organizations. If propagation of a covered
|
||||||
|
work results from an entity transaction, each party to that
|
||||||
|
transaction who receives a copy of the work also receives whatever
|
||||||
|
licenses to the work the party's predecessor in interest had or could
|
||||||
|
give under the previous paragraph, plus a right to possession of the
|
||||||
|
Corresponding Source of the work from the predecessor in interest, if
|
||||||
|
the predecessor has it or can get it with reasonable efforts.
|
||||||
|
|
||||||
|
You may not impose any further restrictions on the exercise of the
|
||||||
|
rights granted or affirmed under this License. For example, you may
|
||||||
|
not impose a license fee, royalty, or other charge for exercise of
|
||||||
|
rights granted under this License, and you may not initiate litigation
|
||||||
|
(including a cross-claim or counterclaim in a lawsuit) alleging that
|
||||||
|
any patent claim is infringed by making, using, selling, offering for
|
||||||
|
sale, or importing the Program or any portion of it.
|
||||||
|
|
||||||
|
11. Patents.
|
||||||
|
|
||||||
|
A "contributor" is a copyright holder who authorizes use under this
|
||||||
|
License of the Program or a work on which the Program is based. The
|
||||||
|
work thus licensed is called the contributor's "contributor version".
|
||||||
|
|
||||||
|
A contributor's "essential patent claims" are all patent claims
|
||||||
|
owned or controlled by the contributor, whether already acquired or
|
||||||
|
hereafter acquired, that would be infringed by some manner, permitted
|
||||||
|
by this License, of making, using, or selling its contributor version,
|
||||||
|
but do not include claims that would be infringed only as a
|
||||||
|
consequence of further modification of the contributor version. For
|
||||||
|
purposes of this definition, "control" includes the right to grant
|
||||||
|
patent sublicenses in a manner consistent with the requirements of
|
||||||
|
this License.
|
||||||
|
|
||||||
|
Each contributor grants you a non-exclusive, worldwide, royalty-free
|
||||||
|
patent license under the contributor's essential patent claims, to
|
||||||
|
make, use, sell, offer for sale, import and otherwise run, modify and
|
||||||
|
propagate the contents of its contributor version.
|
||||||
|
|
||||||
|
In the following three paragraphs, a "patent license" is any express
|
||||||
|
agreement or commitment, however denominated, not to enforce a patent
|
||||||
|
(such as an express permission to practice a patent or covenant not to
|
||||||
|
sue for patent infringement). To "grant" such a patent license to a
|
||||||
|
party means to make such an agreement or commitment not to enforce a
|
||||||
|
patent against the party.
|
||||||
|
|
||||||
|
If you convey a covered work, knowingly relying on a patent license,
|
||||||
|
and the Corresponding Source of the work is not available for anyone
|
||||||
|
to copy, free of charge and under the terms of this License, through a
|
||||||
|
publicly available network server or other readily accessible means,
|
||||||
|
then you must either (1) cause the Corresponding Source to be so
|
||||||
|
available, or (2) arrange to deprive yourself of the benefit of the
|
||||||
|
patent license for this particular work, or (3) arrange, in a manner
|
||||||
|
consistent with the requirements of this License, to extend the patent
|
||||||
|
license to downstream recipients. "Knowingly relying" means you have
|
||||||
|
actual knowledge that, but for the patent license, your conveying the
|
||||||
|
covered work in a country, or your recipient's use of the covered work
|
||||||
|
in a country, would infringe one or more identifiable patents in that
|
||||||
|
country that you have reason to believe are valid.
|
||||||
|
|
||||||
|
If, pursuant to or in connection with a single transaction or
|
||||||
|
arrangement, you convey, or propagate by procuring conveyance of, a
|
||||||
|
covered work, and grant a patent license to some of the parties
|
||||||
|
receiving the covered work authorizing them to use, propagate, modify
|
||||||
|
or convey a specific copy of the covered work, then the patent license
|
||||||
|
you grant is automatically extended to all recipients of the covered
|
||||||
|
work and works based on it.
|
||||||
|
|
||||||
|
A patent license is "discriminatory" if it does not include within
|
||||||
|
the scope of its coverage, prohibits the exercise of, or is
|
||||||
|
conditioned on the non-exercise of one or more of the rights that are
|
||||||
|
specifically granted under this License. You may not convey a covered
|
||||||
|
work if you are a party to an arrangement with a third party that is
|
||||||
|
in the business of distributing software, under which you make payment
|
||||||
|
to the third party based on the extent of your activity of conveying
|
||||||
|
the work, and under which the third party grants, to any of the
|
||||||
|
parties who would receive the covered work from you, a discriminatory
|
||||||
|
patent license (a) in connection with copies of the covered work
|
||||||
|
conveyed by you (or copies made from those copies), or (b) primarily
|
||||||
|
for and in connection with specific products or compilations that
|
||||||
|
contain the covered work, unless you entered into that arrangement,
|
||||||
|
or that patent license was granted, prior to 28 March 2007.
|
||||||
|
|
||||||
|
Nothing in this License shall be construed as excluding or limiting
|
||||||
|
any implied license or other defenses to infringement that may
|
||||||
|
otherwise be available to you under applicable patent law.
|
||||||
|
|
||||||
|
12. No Surrender of Others' Freedom.
|
||||||
|
|
||||||
|
If conditions are imposed on you (whether by court order, agreement or
|
||||||
|
otherwise) that contradict the conditions of this License, they do not
|
||||||
|
excuse you from the conditions of this License. If you cannot convey a
|
||||||
|
covered work so as to satisfy simultaneously your obligations under this
|
||||||
|
License and any other pertinent obligations, then as a consequence you may
|
||||||
|
not convey it at all. For example, if you agree to terms that obligate you
|
||||||
|
to collect a royalty for further conveying from those to whom you convey
|
||||||
|
the Program, the only way you could satisfy both those terms and this
|
||||||
|
License would be to refrain entirely from conveying the Program.
|
||||||
|
|
||||||
|
13. Use with the GNU Affero General Public License.
|
||||||
|
|
||||||
|
Notwithstanding any other provision of this License, you have
|
||||||
|
permission to link or combine any covered work with a work licensed
|
||||||
|
under version 3 of the GNU Affero General Public License into a single
|
||||||
|
combined work, and to convey the resulting work. The terms of this
|
||||||
|
License will continue to apply to the part which is the covered work,
|
||||||
|
but the special requirements of the GNU Affero General Public License,
|
||||||
|
section 13, concerning interaction through a network will apply to the
|
||||||
|
combination as such.
|
||||||
|
|
||||||
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
|
the GNU General Public License from time to time. Such new versions will
|
||||||
|
be similar in spirit to the present version, but may differ in detail to
|
||||||
|
address new problems or concerns.
|
||||||
|
|
||||||
|
Each version is given a distinguishing version number. If the
|
||||||
|
Program specifies that a certain numbered version of the GNU General
|
||||||
|
Public License "or any later version" applies to it, you have the
|
||||||
|
option of following the terms and conditions either of that numbered
|
||||||
|
version or of any later version published by the Free Software
|
||||||
|
Foundation. If the Program does not specify a version number of the
|
||||||
|
GNU General Public License, you may choose any version ever published
|
||||||
|
by the Free Software Foundation.
|
||||||
|
|
||||||
|
If the Program specifies that a proxy can decide which future
|
||||||
|
versions of the GNU General Public License can be used, that proxy's
|
||||||
|
public statement of acceptance of a version permanently authorizes you
|
||||||
|
to choose that version for the Program.
|
||||||
|
|
||||||
|
Later license versions may give you additional or different
|
||||||
|
permissions. However, no additional obligations are imposed on any
|
||||||
|
author or copyright holder as a result of your choosing to follow a
|
||||||
|
later version.
|
||||||
|
|
||||||
|
15. Disclaimer of Warranty.
|
||||||
|
|
||||||
|
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
|
||||||
|
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
|
||||||
|
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
|
||||||
|
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
|
||||||
|
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
|
||||||
|
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||||
|
|
||||||
|
16. Limitation of Liability.
|
||||||
|
|
||||||
|
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||||
|
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
|
||||||
|
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
|
||||||
|
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
|
||||||
|
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
|
||||||
|
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
|
||||||
|
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
|
||||||
|
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
|
||||||
|
SUCH DAMAGES.
|
||||||
|
|
||||||
|
17. Interpretation of Sections 15 and 16.
|
||||||
|
|
||||||
|
If the disclaimer of warranty and limitation of liability provided
|
||||||
|
above cannot be given local legal effect according to their terms,
|
||||||
|
reviewing courts shall apply local law that most closely approximates
|
||||||
|
an absolute waiver of all civil liability in connection with the
|
||||||
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
|
If you develop a new program, and you want it to be of the greatest
|
||||||
|
possible use to the public, the best way to achieve this is to make it
|
||||||
|
free software which everyone can redistribute and change under these terms.
|
||||||
|
|
||||||
|
To do so, attach the following notices to the program. It is safest
|
||||||
|
to attach them to the start of each source file to most effectively
|
||||||
|
state the exclusion of warranty; and each file should have at least
|
||||||
|
the "copyright" line and a pointer to where the full notice is found.
|
||||||
|
|
||||||
|
<one line to give the program's name and a brief idea of what it does.>
|
||||||
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
|
If the program does terminal interaction, make it output a short
|
||||||
|
notice like this when it starts in an interactive mode:
|
||||||
|
|
||||||
|
<program> Copyright (C) <year> <name of author>
|
||||||
|
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||||
|
This is free software, and you are welcome to redistribute it
|
||||||
|
under certain conditions; type `show c' for details.
|
||||||
|
|
||||||
|
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||||
|
parts of the General Public License. Of course, your program's commands
|
||||||
|
might be different; for a GUI interface, you would use an "about box".
|
||||||
|
|
||||||
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
|
For more information on this, and how to apply and follow the GNU GPL, see
|
||||||
|
<http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
The GNU General Public License does not permit incorporating your program
|
||||||
|
into proprietary programs. If your program is a subroutine library, you
|
||||||
|
may consider it more useful to permit linking proprietary applications with
|
||||||
|
the library. If this is what you want to do, use the GNU Lesser General
|
||||||
|
Public License instead of this License. But first, please read
|
||||||
|
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
|
||||||
+34
@@ -1,3 +1,37 @@
|
|||||||
|
#### Version 2.1.0 released on 29.03.21 ####
|
||||||
|
|
||||||
|
Added features:
|
||||||
|
- Compatibility up to Qt 6.0
|
||||||
|
- Tech Preview: Radial Plots (see setupPolarPlotDemo in examples project)
|
||||||
|
- QCPAxisTickerDateTime can now be configured with a QTimeZone for adjusting the label display to arbitrary time zones
|
||||||
|
- QCPColorGradient (and thus also QCPColorMap) now has explicit configurable NaN handling (see QCPColorGradient::setNanHandling)
|
||||||
|
- added timing/benchmarking method QCustomPlot::replotTime(bool average) which returns the milliseconds per replot
|
||||||
|
- QCustomPlot::plottableAt has an optional output parameter dataIndex, providing the index of the data point at the probed position
|
||||||
|
- QCustomPlot::plottableAt<T> template method allows limiting the search to the specified QCPAbstractPlottable subclass T
|
||||||
|
- QCustomPlot::itemAt<T> template method allows limiting the search to the specified QCPAbstractItem subclass T
|
||||||
|
- Added Interaction flag QCP::iSelectPlottablesBeyondAxisRect, allows selection of data points very close to (and beyond of) the axes
|
||||||
|
- QCPAxisTickerDateTime::dateTimeToKey(QDate &) now also takes a TimeSpec to specify the interpretation of the start-of-day
|
||||||
|
- QCPAxisTickerLog now switches to linear ticks if zoomed in beyond where logarithmic ticks are reasonable
|
||||||
|
- Added QCustomPlot::afterLayout signal, for user code that crucially depends on layout sizes/positions, right before the draw step during a replot
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
- Fixed bug where QCPLayer::replot wouldn't issue full replot even though invalidated buffers existed
|
||||||
|
- Fixed QCPCurve bug causing rendering artifacts when using keys/values smaller than about 1e-12 in some constellations
|
||||||
|
- Fixed getValueRange when used with explicit keyRange, now doesn't use key range expanded by one point to each side anymore
|
||||||
|
- Fixed bug of QCPAxis tick label font size change only propagating to the layout after second call to replot
|
||||||
|
- Fixed bug of QCPTextElement not respecting the configured text alignment flag (setTextFlags)
|
||||||
|
- Various documentation typos and improvements
|
||||||
|
|
||||||
|
Other:
|
||||||
|
- QCP Now requires C++11. However, Qt4.6 compatibility is maintained in the QCP 2.x release series
|
||||||
|
- QCPColorScale is now initialized with gpCold gradient preset, which prevents color maps turning black when linking them to a default-created color scale without explicitly setting a gradient
|
||||||
|
- QCPLegend::clearItems is now faster in case of many legend items (>1000)
|
||||||
|
- Modernized expressions and thereby avoided some warnings (e.g. nullptr and casts)
|
||||||
|
- Switched to foreach (Qt macro) where possible (in preparation for switch to range-based for (C++11), soonest at next major release)
|
||||||
|
- Work around Qt bug, drawing lines with pen width 1 as slow as with pen widths > 1 (polyfill instead of line algorithm, also on Normal-DPI), by using pen width 0 in such cases.
|
||||||
|
- Added QCP::Interaction flag iNone=0x000 to allow explicitly specifying no interaction (Avoids QFlags::zero, which was deprecated in Qt5.14)
|
||||||
|
- QCP is now compatible with defines QT_USE_QSTRINGBUILDER, QT_USE_FAST_CONCATENATION (Qt<4.8), QT_USE_FAST_OPERATOR_PLUS (Qt<4.8)
|
||||||
|
|
||||||
#### Version 2.0.1 released on 25.06.18 ####
|
#### Version 2.0.1 released on 25.06.18 ####
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
|||||||
+15144
-9240
File diff suppressed because it is too large.
Load diff
+4361
-3007
File diff suppressed because it is too large.
Load diff
+6
-1
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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,6 +31,7 @@
|
|||||||
#include "DBusAppAdaptor.h"
|
#include "DBusAppAdaptor.h"
|
||||||
#endif
|
#endif
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
|
#include <QStyleFactory>
|
||||||
#ifdef USE_FERVOR
|
#ifdef USE_FERVOR
|
||||||
#include "fvupdater.h"
|
#include "fvupdater.h"
|
||||||
#endif
|
#endif
|
||||||
@@ -51,6 +52,10 @@ int main( int argc, char* argv[] )
|
|||||||
QApplication::setApplicationVersion( QStringLiteral( CALYP_VERSION_STRING ) );
|
QApplication::setApplicationVersion( QStringLiteral( CALYP_VERSION_STRING ) );
|
||||||
QApplication::setOrganizationName( QStringLiteral( "PixLRA" ) );
|
QApplication::setOrganizationName( QStringLiteral( "PixLRA" ) );
|
||||||
|
|
||||||
|
#if _WIN32
|
||||||
|
application.setStyle( QStyleFactory::create( "Fusion" ) );
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_QTDBUS
|
#ifdef USE_QTDBUS
|
||||||
/**
|
/**
|
||||||
* use dbus, if available
|
* use dbus, if available
|
||||||
|
|||||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,11 +25,11 @@
|
|||||||
#ifndef __WIDGETFRAMENUMBER_H__
|
#ifndef __WIDGETFRAMENUMBER_H__
|
||||||
#define __WIDGETFRAMENUMBER_H__
|
#define __WIDGETFRAMENUMBER_H__
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
class QLabel;
|
class QLabel;
|
||||||
|
|
||||||
class FrameNumberWidget : public QWidget
|
class FrameNumberWidget : public QWidget
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -41,60 +41,42 @@ class HistogramWorker : public QThread
|
|||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
QObject* m_parent;
|
QObject* m_parent;
|
||||||
CalypFrame* m_pcFrame;
|
std::shared_ptr<CalypFrame> m_pcFrame{ nullptr };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
HistogramWorker( QObject* parent )
|
HistogramWorker( QObject* parent )
|
||||||
{
|
: m_parent{ parent } {}
|
||||||
m_pcFrame = NULL;
|
|
||||||
m_parent = parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
void setup( CalypFrame* frame )
|
void reset() { m_pcFrame = nullptr; }
|
||||||
|
|
||||||
|
void setup( std::shared_ptr<CalypFrame> frame )
|
||||||
{
|
{
|
||||||
m_pcFrame = frame;
|
m_pcFrame = std::move( frame );
|
||||||
// run();
|
EventData* eventData = new EventData(); // NOLINT
|
||||||
|
eventData->starting = true;
|
||||||
|
// QCoreApplication::postEvent( m_parent, eventData );
|
||||||
start();
|
start();
|
||||||
}
|
}
|
||||||
void run()
|
void run() override
|
||||||
{
|
{
|
||||||
if( m_pcFrame && m_parent )
|
EventData* eventData = new EventData(); // NOLINT
|
||||||
|
if( m_pcFrame != nullptr )
|
||||||
{
|
{
|
||||||
EventData* eventData = new EventData();
|
|
||||||
// eventDm_imageHistogramata->starting = true;
|
|
||||||
// eventData->success = false;
|
|
||||||
// eventData->histogram = m_histogram;
|
|
||||||
// QCoreApplication::postEvent( m_parent, eventData );
|
|
||||||
|
|
||||||
eventData->starting = true;
|
|
||||||
|
|
||||||
m_pcFrame->calcHistogram();
|
m_pcFrame->calcHistogram();
|
||||||
|
eventData->frame = m_pcFrame.get();
|
||||||
eventData->starting = false;
|
|
||||||
// eventData->success = m_pcFrame->getHasHistogram();
|
|
||||||
eventData->success = true;
|
|
||||||
eventData->frame = m_pcFrame;
|
|
||||||
QCoreApplication::postEvent( m_parent, eventData );
|
|
||||||
}
|
}
|
||||||
|
eventData->success = true;
|
||||||
|
QCoreApplication::postEvent( m_parent, eventData );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Custom Event
|
|
||||||
*/
|
|
||||||
class EventData : public QEvent
|
class EventData : public QEvent
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EventData()
|
EventData()
|
||||||
: QEvent( QEvent::User )
|
: QEvent( QEvent::User ), frame{ nullptr } {}
|
||||||
{
|
CalypFrame* frame{ nullptr };
|
||||||
starting = false;
|
bool starting{ false };
|
||||||
success = false;
|
bool success{ false };
|
||||||
frame = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool starting;
|
|
||||||
bool success;
|
|
||||||
CalypFrame* frame;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -239,8 +221,10 @@ void HistogramWidget::reset()
|
|||||||
d->guideVisible = false;
|
d->guideVisible = false;
|
||||||
d->clearFlag = HistogramWidgetPrivate::HistogramNone;
|
d->clearFlag = HistogramWidgetPrivate::HistogramNone;
|
||||||
// Remove histogram data from memory.
|
// Remove histogram data from memory.
|
||||||
m_fullImage = NULL;
|
m_fullImage = nullptr;
|
||||||
m_selectionImage = NULL;
|
m_selectionImage = nullptr;
|
||||||
|
m_imageWorker->setup( nullptr );
|
||||||
|
m_selectionWorker->setup( nullptr );
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -262,7 +246,7 @@ void HistogramWidget::customEvent( QEvent* event )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( ed->frame != m_fullImage && ed->frame != m_selectionImage )
|
if( ed->frame != m_fullImage.get() && ed->frame != m_selectionImage.get() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -323,8 +307,6 @@ void HistogramWidget::customEvent( QEvent* event )
|
|||||||
emit signalHistogramComputationFailed();
|
emit signalHistogramComputationFailed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete ed;
|
|
||||||
}
|
}
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
// Data Loading Functions
|
// Data Loading Functions
|
||||||
@@ -379,7 +361,7 @@ void HistogramWidget::stopHistogramComputation()
|
|||||||
// Update Data Methods
|
// Update Data Methods
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
void HistogramWidget::updateData( CalypFrame* pcFrame, CalypFrame* pcFrameSelection )
|
void HistogramWidget::updateData( std::shared_ptr<CalypFrame> pcFrame, std::shared_ptr<CalypFrame> pcFrameSelection )
|
||||||
{
|
{
|
||||||
d->imageBits = pcFrame->getBitsPel();
|
d->imageBits = pcFrame->getBitsPel();
|
||||||
switch( pcFrame->getColorSpace() )
|
switch( pcFrame->getColorSpace() )
|
||||||
@@ -497,7 +479,7 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
|||||||
int wWidth = width() - 1;
|
int wWidth = width() - 1;
|
||||||
int wHeight = height() - 1;
|
int wHeight = height() - 1;
|
||||||
double max;
|
double max;
|
||||||
CalypFrame* frame;
|
std::shared_ptr<CalypFrame> frame;
|
||||||
|
|
||||||
if( m_renderingType == ImageSelectionHistogram && m_selectionImage )
|
if( m_renderingType == ImageSelectionHistogram && m_selectionImage )
|
||||||
frame = m_selectionImage;
|
frame = m_selectionImage;
|
||||||
@@ -938,7 +920,11 @@ void HistogramWidget::paintEvent( QPaintEvent* )
|
|||||||
|
|
||||||
tipText += cellBeg + tr( "Median:" ) + cellMid;
|
tipText += cellBeg + tr( "Median:" ) + cellMid;
|
||||||
double median = frame->getMedian( m_channelType, 0, frame->getNumHistogramSegment() - 1 );
|
double median = frame->getMedian( m_channelType, 0, frame->getNumHistogramSegment() - 1 );
|
||||||
tipText += value.setNum( median, 'f', 1 ) + cellEnd;
|
tipText += value.setNum( median, 'f', 0 ) + cellEnd;
|
||||||
|
|
||||||
|
tipText += cellBeg + tr( "Entropy:" ) + cellMid;
|
||||||
|
double entropy = frame->getEntropy( m_channelType, 0, frame->getNumHistogramSegment() - 1 );
|
||||||
|
tipText += value.setNum( entropy, 'f', 2 ) + cellEnd;
|
||||||
|
|
||||||
tipText += cellBeg + tr( "Percent:" ) + cellMid;
|
tipText += cellBeg + tr( "Percent:" ) + cellMid;
|
||||||
double percentile = ( pixels > 0 ? ( 100.0 * counts / pixels ) : 0.0 );
|
double percentile = ( pixels > 0 ? ( 100.0 * counts / pixels ) : 0.0 );
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -26,13 +26,13 @@
|
|||||||
#ifndef __HISTOGRAMWIDGET_H__
|
#ifndef __HISTOGRAMWIDGET_H__
|
||||||
#define __HISTOGRAMWIDGET_H__
|
#define __HISTOGRAMWIDGET_H__
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
#include "CommonDefs.h"
|
#include "CommonDefs.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "lib/CalypFrame.h"
|
#include "lib/CalypFrame.h"
|
||||||
|
|
||||||
#include <QColor>
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
class QEvent;
|
class QEvent;
|
||||||
|
|
||||||
class HistogramWorker;
|
class HistogramWorker;
|
||||||
@@ -90,7 +90,7 @@ public:
|
|||||||
void stopHistogramComputation();
|
void stopHistogramComputation();
|
||||||
|
|
||||||
/** Update full image histogram data. */
|
/** Update full image histogram data. */
|
||||||
void updateData( CalypFrame* pcFrame, CalypFrame* pcFrameSelection );
|
void updateData( std::shared_ptr<CalypFrame> pcFrame, std::shared_ptr<CalypFrame> pcFrameSelection );
|
||||||
|
|
||||||
/** @see @p HistogramOption */
|
/** @see @p HistogramOption */
|
||||||
void setOptions( HistogramOptions options = AllOptions );
|
void setOptions( HistogramOptions options = AllOptions );
|
||||||
@@ -113,12 +113,10 @@ public:
|
|||||||
|
|
||||||
/** Full image */
|
/** Full image */
|
||||||
HistogramWorker* m_imageWorker;
|
HistogramWorker* m_imageWorker;
|
||||||
// CalypFrameStats* m_imageHistogram;
|
std::shared_ptr<CalypFrame> m_fullImage;
|
||||||
CalypFrame* m_fullImage;
|
|
||||||
/** Histogram area selection */
|
/** Histogram area selection */
|
||||||
HistogramWorker* m_selectionWorker;
|
HistogramWorker* m_selectionWorker;
|
||||||
// CalypFrameStats* m_selectionHistogram;
|
std::shared_ptr<CalypFrame> m_selectionImage;
|
||||||
CalypFrame* m_selectionImage;
|
|
||||||
|
|
||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void signalintervalChanged( int min, int max );
|
void signalintervalChanged( int min, int max );
|
||||||
|
|||||||
+94
-102
@@ -1,147 +1,139 @@
|
|||||||
# - Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
|
# * Try to find the required ffmpeg components(default: AVFORMAT, AVUTIL, AVCODEC)
|
||||||
#
|
#
|
||||||
# Once done this will define
|
# Once done this will define FFMPEG_FOUND - System has the all required components. FFMPEG_INCLUDE_DIRS - Include directory necessary for
|
||||||
# FFMPEG_FOUND - System has the all required components.
|
# using the required components headers. FFMPEG_LIBRARIES - Link these to use the required ffmpeg components. FFMPEG_DEFINITIONS - Compiler
|
||||||
# FFMPEG_INCLUDE_DIRS - Include directory necessary for using the required components headers.
|
# switches required for using the required ffmpeg components.
|
||||||
# FFMPEG_LIBRARIES - Link these to use the required ffmpeg components.
|
|
||||||
# FFMPEG_DEFINITIONS - Compiler switches required for using the required ffmpeg components.
|
|
||||||
#
|
#
|
||||||
# For each of the components it will additionally set.
|
# For each of the components it will additionally set. - AVCODEC - AVDEVICE - AVFORMAT - AVUTIL - POSTPROCESS - SWSCALE the following variables will
|
||||||
# - AVCODEC
|
# be defined <component>_FOUND - System has <component> <component>_INCLUDE_DIRS - Include directory necessary for using the <component>
|
||||||
# - AVDEVICE
|
# headers <component>_LIBRARIES - Link these to use <component> <component>_DEFINITIONS - Compiler switches required for using <component>
|
||||||
# - AVFORMAT
|
# <component>_VERSION - The components version
|
||||||
# - AVUTIL
|
|
||||||
# - POSTPROCESS
|
|
||||||
# - SWSCALE
|
|
||||||
# the following variables will be defined
|
|
||||||
# <component>_FOUND - System has <component>
|
|
||||||
# <component>_INCLUDE_DIRS - Include directory necessary for using the <component> headers
|
|
||||||
# <component>_LIBRARIES - Link these to use <component>
|
|
||||||
# <component>_DEFINITIONS - Compiler switches required for using <component>
|
|
||||||
# <component>_VERSION - The components version
|
|
||||||
#
|
#
|
||||||
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org>
|
# Copyright (c) 2006, Matthias Kretz, <kretz@kde.org> Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org> Copyright (c) 2011, Michael Jansen,
|
||||||
# Copyright (c) 2008, Alexander Neundorf, <neundorf@kde.org>
|
# <kde@michael-jansen.biz>
|
||||||
# Copyright (c) 2011, Michael Jansen, <kde@michael-jansen.biz>
|
|
||||||
#
|
#
|
||||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
# Redistribution and use is allowed according to the terms of the BSD license. For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
|
||||||
|
|
||||||
include(FindPackageHandleStandardArgs)
|
INCLUDE(FindPackageHandleStandardArgs)
|
||||||
|
|
||||||
# The default components were taken from a survey over other FindFFMPEG.cmake files
|
# The default components were taken from a survey over other FindFFMPEG.cmake files
|
||||||
if (NOT FFmpeg_FIND_COMPONENTS)
|
IF(NOT FFmpeg_FIND_COMPONENTS)
|
||||||
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
|
SET(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL)
|
||||||
endif ()
|
ENDIF()
|
||||||
|
|
||||||
#
|
#
|
||||||
### Macro: set_component_found
|
# Macro: set_component_found
|
||||||
#
|
#
|
||||||
# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
|
# Marks the given component as found if both *_LIBRARIES AND *_INCLUDE_DIRS is present.
|
||||||
#
|
#
|
||||||
macro(set_component_found _component )
|
MACRO(set_component_found _component)
|
||||||
if (${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
|
IF(${_component}_LIBRARIES AND ${_component}_INCLUDE_DIRS)
|
||||||
# message(STATUS " - ${_component} found.")
|
# message(STATUS " - ${_component} found.")
|
||||||
set(${_component}_FOUND TRUE)
|
SET(${_component}_FOUND TRUE)
|
||||||
else ()
|
ELSE()
|
||||||
# message(STATUS " - ${_component} not found.")
|
# message(STATUS " - ${_component} not found.")
|
||||||
endif ()
|
ENDIF()
|
||||||
endmacro()
|
ENDMACRO()
|
||||||
|
|
||||||
#
|
#
|
||||||
### Macro: find_component
|
# Macro: find_component
|
||||||
#
|
#
|
||||||
# Checks for the given component by invoking pkgconfig and then looking up the libraries and
|
# Checks for the given component by invoking pkgconfig and then looking up the libraries and include directories.
|
||||||
# include directories.
|
|
||||||
#
|
#
|
||||||
macro(find_component _component _pkgconfig _library _header)
|
MACRO(find_component _component _pkgconfig _library _header)
|
||||||
|
|
||||||
if (NOT WIN32)
|
IF(NOT WIN32)
|
||||||
# use pkg-config to get the directories and then use these values
|
# use pkg-config to get the directories and then use these values in the FIND_PATH() and FIND_LIBRARY() calls
|
||||||
# in the FIND_PATH() and FIND_LIBRARY() calls
|
FIND_PACKAGE(PkgConfig)
|
||||||
find_package(PkgConfig)
|
IF(PKG_CONFIG_FOUND)
|
||||||
if (PKG_CONFIG_FOUND)
|
PKG_CHECK_MODULES(PC_${_component} ${_pkgconfig})
|
||||||
pkg_check_modules(PC_${_component} ${_pkgconfig})
|
ENDIF()
|
||||||
endif ()
|
ENDIF(NOT WIN32)
|
||||||
endif (NOT WIN32)
|
|
||||||
|
|
||||||
find_path(${_component}_INCLUDE_DIRS ${_header}
|
FIND_PATH(
|
||||||
HINTS
|
${_component}_INCLUDE_DIRS ${_header}
|
||||||
${PC_LIB${_component}_INCLUDEDIR}
|
HINTS ${PC_LIB${_component}_INCLUDEDIR} ${PC_LIB${_component}_INCLUDE_DIRS}
|
||||||
${PC_LIB${_component}_INCLUDE_DIRS}
|
PATH_SUFFIXES ffmpeg
|
||||||
PATH_SUFFIXES
|
|
||||||
ffmpeg
|
|
||||||
)
|
)
|
||||||
|
|
||||||
find_library(${_component}_LIBRARIES NAMES ${_library}
|
FIND_LIBRARY(
|
||||||
HINTS
|
|
||||||
${PC_LIB${_component}_LIBDIR}
|
|
||||||
${PC_LIB${_component}_LIBRARY_DIRS}
|
|
||||||
)
|
|
||||||
|
|
||||||
set(${_component}_DEFINITIONS ${PC_${_component}_CFLAGS_OTHER} CACHE STRING "The ${_component} CFLAGS.")
|
|
||||||
set(${_component}_VERSION ${PC_${_component}_VERSION} CACHE STRING "The ${_component} version number.")
|
|
||||||
|
|
||||||
set_component_found(${_component})
|
|
||||||
|
|
||||||
mark_as_advanced(
|
|
||||||
${_component}_INCLUDE_DIRS
|
|
||||||
${_component}_LIBRARIES
|
${_component}_LIBRARIES
|
||||||
${_component}_DEFINITIONS
|
NAMES ${_library}
|
||||||
${_component}_VERSION)
|
HINTS ${PC_LIB${_component}_LIBDIR} ${PC_LIB${_component}_LIBRARY_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
endmacro()
|
SET(${_component}_DEFINITIONS
|
||||||
|
${PC_${_component}_CFLAGS_OTHER}
|
||||||
|
CACHE STRING "The ${_component} CFLAGS."
|
||||||
|
)
|
||||||
|
SET(${_component}_VERSION
|
||||||
|
${PC_${_component}_VERSION}
|
||||||
|
CACHE STRING "The ${_component} version number."
|
||||||
|
)
|
||||||
|
|
||||||
|
SET_COMPONENT_FOUND(${_component})
|
||||||
|
|
||||||
|
MARK_AS_ADVANCED(${_component}_INCLUDE_DIRS ${_component}_LIBRARIES ${_component}_DEFINITIONS ${_component}_VERSION)
|
||||||
|
|
||||||
|
ENDMACRO()
|
||||||
|
|
||||||
# Check for cached results. If there are skip the costly part.
|
# Check for cached results. If there are skip the costly part.
|
||||||
if (NOT FFMPEG_LIBRARIES)
|
IF(NOT FFMPEG_LIBRARIES)
|
||||||
|
|
||||||
# Check for all possible component.
|
# Check for all possible component.
|
||||||
find_component(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
|
FIND_COMPONENT(AVCODEC libavcodec avcodec libavcodec/avcodec.h)
|
||||||
find_component(AVFORMAT libavformat avformat libavformat/avformat.h)
|
FIND_COMPONENT(AVFORMAT libavformat avformat libavformat/avformat.h)
|
||||||
find_component(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
|
FIND_COMPONENT(AVDEVICE libavdevice avdevice libavdevice/avdevice.h)
|
||||||
find_component(AVUTIL libavutil avutil libavutil/avutil.h)
|
FIND_COMPONENT(AVUTIL libavutil avutil libavutil/avutil.h)
|
||||||
find_component(SWSCALE libswscale swscale libswscale/swscale.h)
|
FIND_COMPONENT(SWSCALE libswscale swscale libswscale/swscale.h)
|
||||||
find_component(POSTPROC libpostproc postproc libpostproc/postprocess.h)
|
FIND_COMPONENT(SWRESAMPLE libswresample swresample libswresample/swresample.h)
|
||||||
|
FIND_COMPONENT(POSTPROC libpostproc postproc libpostproc/postprocess.h)
|
||||||
|
|
||||||
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
|
# Check if the required components were found and add their stuff to the FFMPEG_* vars.
|
||||||
foreach (_component ${FFmpeg_FIND_COMPONENTS})
|
FOREACH(_component ${FFmpeg_FIND_COMPONENTS})
|
||||||
if (${_component}_FOUND)
|
IF(${_component}_FOUND)
|
||||||
# message(STATUS "Required component ${_component} present.")
|
# message(STATUS "Required component ${_component} present.")
|
||||||
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
|
SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${${_component}_LIBRARIES})
|
||||||
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
|
SET(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${${_component}_DEFINITIONS})
|
||||||
list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
|
LIST(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIRS})
|
||||||
else ()
|
ELSE()
|
||||||
# message(STATUS "Required component ${_component} missing.")
|
# message(STATUS "Required component ${_component} missing.")
|
||||||
endif ()
|
ENDIF()
|
||||||
endforeach ()
|
ENDFOREACH()
|
||||||
|
|
||||||
# Build the include path with duplicates removed.
|
# Build the include path with duplicates removed.
|
||||||
if (FFMPEG_INCLUDE_DIRS)
|
IF(FFMPEG_INCLUDE_DIRS)
|
||||||
list(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
|
LIST(REMOVE_DUPLICATES FFMPEG_INCLUDE_DIRS)
|
||||||
endif ()
|
ENDIF()
|
||||||
|
|
||||||
# cache the vars.
|
# cache the vars.
|
||||||
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} CACHE STRING "The FFmpeg include directories." FORCE)
|
SET(FFMPEG_INCLUDE_DIRS
|
||||||
set(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} CACHE STRING "The FFmpeg libraries." FORCE)
|
${FFMPEG_INCLUDE_DIRS}
|
||||||
set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} CACHE STRING "The FFmpeg cflags." FORCE)
|
CACHE STRING "The FFmpeg include directories." FORCE
|
||||||
|
)
|
||||||
|
SET(FFMPEG_LIBRARIES
|
||||||
|
${FFMPEG_LIBRARIES}
|
||||||
|
CACHE STRING "The FFmpeg libraries." FORCE
|
||||||
|
)
|
||||||
|
SET(FFMPEG_DEFINITIONS
|
||||||
|
${FFMPEG_DEFINITIONS}
|
||||||
|
CACHE STRING "The FFmpeg cflags." FORCE
|
||||||
|
)
|
||||||
|
|
||||||
mark_as_advanced(FFMPEG_INCLUDE_DIRS
|
MARK_AS_ADVANCED(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES FFMPEG_DEFINITIONS)
|
||||||
FFMPEG_LIBRARIES
|
|
||||||
FFMPEG_DEFINITIONS)
|
|
||||||
|
|
||||||
endif ()
|
ENDIF()
|
||||||
|
|
||||||
# Now set the noncached _FOUND vars for the components.
|
# Now set the noncached _FOUND vars for the components.
|
||||||
foreach (_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE)
|
FOREACH(_component AVCODEC AVDEVICE AVFORMAT AVUTIL POSTPROCESS SWSCALE)
|
||||||
set_component_found(${_component})
|
SET_COMPONENT_FOUND(${_component})
|
||||||
endforeach ()
|
ENDFOREACH()
|
||||||
|
|
||||||
# Compile the list of required vars
|
# Compile the list of required vars
|
||||||
set(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
|
SET(_FFmpeg_REQUIRED_VARS FFMPEG_LIBRARIES FFMPEG_INCLUDE_DIRS)
|
||||||
foreach (_component ${FFmpeg_FIND_COMPONENTS})
|
FOREACH(_component ${FFmpeg_FIND_COMPONENTS})
|
||||||
list(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
|
LIST(APPEND _FFmpeg_REQUIRED_VARS ${_component}_LIBRARIES ${_component}_INCLUDE_DIRS)
|
||||||
endforeach ()
|
ENDFOREACH()
|
||||||
|
|
||||||
# Give a nice error message if some of the required vars are missing.
|
# Give a nice error message if some of the required vars are missing.
|
||||||
find_package_handle_standard_args(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FFmpeg DEFAULT_MSG ${_FFmpeg_REQUIRED_VARS})
|
||||||
+51
-50
@@ -1,67 +1,68 @@
|
|||||||
|
# General function to add a module It receives the name of the module and the filename where it is defined. Used in modules/CMakeLists.txt
|
||||||
MACRO(ADD_EXTRA_MODULES dir)
|
MACRO(ADD_MODULE name file)
|
||||||
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 )
|
|
||||||
SET(__modulename "Module${name}")
|
SET(__modulename "Module${name}")
|
||||||
OPTION(MODULE_${name} "Use module ${name}" ON )
|
OPTION(MODULE_${name} "Use module ${name}" ON)
|
||||||
ADD_FEATURE_INFO(${name} MODULE_${name} "Module ${name}" )
|
ADD_FEATURE_INFO(${name} MODULE_${name} "Module ${name}")
|
||||||
IF( MODULE_${name} )
|
IF(MODULE_${name})
|
||||||
list(APPEND Calyp_Mod_SRCS ${MODULE_LOCATION}${file} )
|
LIST(APPEND Calyp_Mod_SRCS ${MODULE_LOCATION}${file}.cpp)
|
||||||
LIST(APPEND MODULES_LIST_NAME ${name} )
|
LIST(APPEND MODULES_LIST_NAME ${name})
|
||||||
LIST(APPEND MODULES_LIST_FILES ${file} )
|
LIST(APPEND MODULES_LIST_FILES ${file})
|
||||||
SET( Calyp_Mod_SRCS "${Calyp_Mod_SRCS}" PARENT_SCOPE )
|
SET(Calyp_Mod_SRCS
|
||||||
SET( MODULES_LIST_NAME "${MODULES_LIST_NAME}" PARENT_SCOPE )
|
"${Calyp_Mod_SRCS}"
|
||||||
SET( MODULES_LIST_FILES "${MODULES_LIST_FILES}" PARENT_SCOPE )
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
|
SET(MODULES_LIST_NAME
|
||||||
|
"${MODULES_LIST_NAME}"
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
|
SET(MODULES_LIST_FILES
|
||||||
|
"${MODULES_LIST_FILES}"
|
||||||
|
PARENT_SCOPE
|
||||||
|
)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
UNSET(__modulename)
|
UNSET(__modulename)
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
|
|
||||||
|
# General function to add a module It receives the name of the module and the filename where it is defined. Moreover it receives a VERSION and MODULES
|
||||||
MACRO(ADD_MODULE_USE_OPENCV name file )
|
# (OpenCV modules required) Used in modules/CMakeLists.txt
|
||||||
IF( USE_OPENCV )
|
MACRO(ADD_MODULE_USE_OPENCV name file)
|
||||||
SET( ADD_MODULE_USE_OPENCV_VERSION "2.4" )
|
IF(USE_OPENCV)
|
||||||
CMAKE_PARSE_ARGUMENTS(ADD_MODULE_USE_OPENCV "" "VERSION" "MODULES" ${ARGN} )
|
SET(ADD_MODULE_USE_OPENCV_VERSION "2.4")
|
||||||
IF( NOT ( ${OpenCV_VERSION} VERSION_LESS ${ADD_MODULE_USE_OPENCV_VERSION} ) )
|
CMAKE_PARSE_ARGUMENTS(ADD_MODULE_USE_OPENCV "" "VERSION" "MODULES" ${ARGN})
|
||||||
SET( _HAS_MODULES TRUE )
|
IF(NOT (${OpenCV_VERSION} VERSION_LESS ${ADD_MODULE_USE_OPENCV_VERSION}))
|
||||||
FOREACH(opencv_module IN LISTS ADD_MODULE_USE_OPENCV_MODULES )
|
SET(_HAS_MODULES TRUE)
|
||||||
string(TOUPPER "${opencv_module}" opencv_moduleUP)
|
FOREACH(opencv_module IN LISTS ADD_MODULE_USE_OPENCV_MODULES)
|
||||||
FIND_PACKAGE( OpenCV QUIET COMPONENTS ${opencv_module} )
|
STRING(TOUPPER "${opencv_module}" opencv_moduleUP)
|
||||||
IF( NOT ${OPENCV_${opencv_moduleUP}_FOUND} EQUAL "1" )
|
FIND_PACKAGE(OpenCV QUIET COMPONENTS ${opencv_module})
|
||||||
SET( _HAS_MODULES FALSE )
|
IF(NOT ${OPENCV_${opencv_moduleUP}_FOUND} EQUAL "1")
|
||||||
|
SET(_HAS_MODULES FALSE)
|
||||||
ELSE()
|
ELSE()
|
||||||
LIST(APPEND OPENCV_MODULES ${opencv_module} )
|
LIST(APPEND OPENCV_MODULES ${opencv_module})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
IF( _HAS_MODULES )
|
IF(_HAS_MODULES)
|
||||||
ADD_MODULE( ${name} ${file} )
|
ADD_MODULE(${name} ${file})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
UNSET( OPENCV_${opencv_moduleUP}_FOUND )
|
UNSET(OPENCV_${opencv_moduleUP}_FOUND)
|
||||||
UNSET( _HAS_MODULES )
|
UNSET(_HAS_MODULES)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
UNSET( ADD_MODULE_USE_OPENCV_VERSION )
|
UNSET(ADD_MODULE_USE_OPENCV_VERSION)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# Create header
|
# Create header
|
||||||
#
|
MACRO(CREATE_MODULE_MACROS)
|
||||||
MACRO(CREATE_MODULE_MACROS )
|
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n"
|
||||||
file( WRITE ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "// This files add the header files of each module\n"
|
"#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n"
|
||||||
"#ifndef __MODULESLISTHEADER_H__\n#define __MODULESLISTHEADER_H__\n" )
|
)
|
||||||
foreach(module ${MODULES_LIST_FILES})
|
FOREACH(module ${MODULES_LIST_FILES})
|
||||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${module}.h\"\n")
|
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#include \"${module}.h\"\n")
|
||||||
endforeach(module ${MODULES_LIST_FILES})
|
ENDFOREACH(module ${MODULES_LIST_FILES})
|
||||||
|
|
||||||
file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#define REGISTER_ALL_MODULES \\\n" )
|
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "#define REGISTER_ALL_MODULES \\\n")
|
||||||
foreach(module ${MODULES_LIST_NAME})
|
FOREACH(module ${MODULES_LIST_NAME})
|
||||||
file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "Register( \"${module}\", &(${module}::Create) ); \\\n")
|
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "Register( \"${module}\", &(${module}::Create) ); \\\n")
|
||||||
endforeach(module ${MODULES_LIST_NAME})
|
ENDFOREACH(module ${MODULES_LIST_NAME})
|
||||||
|
|
||||||
file( APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "\n#endif // __MODULESLISTHEADER_H__\n" )
|
FILE(APPEND ${CMAKE_CURRENT_BINARY_DIR}/ModulesListHeader.h "\n#endif // __MODULESLISTHEADER_H__\n")
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
+67
-49
@@ -1,63 +1,81 @@
|
|||||||
#####################################################################################
|
# ####################################################################################################################################################
|
||||||
# DLLs and Win32 specific code
|
# DLLs and Win32 specific code
|
||||||
######################################################################################
|
# ####################################################################################################################################################
|
||||||
|
|
||||||
foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} )
|
FOREACH(OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES})
|
||||||
string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG )
|
STRING(TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG)
|
||||||
set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "." )
|
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ".")
|
||||||
set( CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "." )
|
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ".")
|
||||||
set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "." )
|
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${OUTPUTCONFIG} ".")
|
||||||
endforeach( OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES )
|
ENDFOREACH(OUTPUTCONFIG CMAKE_CONFIGURATION_TYPES)
|
||||||
|
|
||||||
SET(MSVC_DLL_DIR "MSVC_DLL_DIR" CACHE PATH "Where to find MSVC dlls")
|
SET(MSVC_DLL_DIR
|
||||||
#INSTALL(FILES ${MSVC_DLL_DIR}/msvcr120.dll DESTINATION bin )
|
"MSVC_DLL_DIR"
|
||||||
#INSTALL(FILES ${MSVC_DLL_DIR}/msvcp120.dll DESTINATION bin )
|
CACHE PATH "Where to find MSVC dlls"
|
||||||
|
)
|
||||||
|
# INSTALL(FILES ${MSVC_DLL_DIR}/msvcr120.dll DESTINATION bin ) INSTALL(FILES ${MSVC_DLL_DIR}/msvcp120.dll DESTINATION bin )
|
||||||
|
|
||||||
SET(QT_DIR "QT-Dir" CACHE PATH "Where to find QT Lib on Windows")
|
SET(QT_DIR
|
||||||
SET(QT_ICU_VERSION "" CACHE STRING "Qt ICU version of dll's" )
|
"QT-Dir"
|
||||||
SET(QT_DLL_POSTFIX "" CACHE STRING "Postfix to dll's name for debug" )
|
CACHE PATH "Where to find QT Lib on Windows"
|
||||||
SET(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH} ${QT_DIR}" )
|
)
|
||||||
|
SET(QT_ICU_VERSION
|
||||||
|
""
|
||||||
|
CACHE STRING "Qt ICU version of dll's"
|
||||||
|
)
|
||||||
|
SET(QT_DLL_POSTFIX
|
||||||
|
""
|
||||||
|
CACHE STRING "Postfix to dll's name for debug"
|
||||||
|
)
|
||||||
|
SET(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH} ${QT_DIR}")
|
||||||
|
|
||||||
SET(WINDLLIB "Dl-location" CACHE PATH "Where to find DL Lib on Windows")
|
SET(WINDLLIB
|
||||||
|
"Dl-location"
|
||||||
|
CACHE PATH "Where to find DL Lib on Windows"
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(NOT USE_QT4)
|
||||||
|
INSTALL(FILES ${QT_DIR}/bin/Qt5Core${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
|
INSTALL(FILES ${QT_DIR}/bin/Qt5Gui${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
|
INSTALL(FILES ${QT_DIR}/bin/Qt5Widgets${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
|
INSTALL(FILES ${QT_DIR}/bin/Qt5PrintSupport${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
|
INSTALL(FILES ${QT_DIR}/plugins/platforms/qwindows${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms)
|
||||||
|
INSTALL(FILES ${QT_DIR}/plugins/platforms/qminimal${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms)
|
||||||
|
INSTALL(FILES ${QT_DIR}/plugins/platforms/qoffscreen${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms)
|
||||||
|
|
||||||
IF( NOT USE_QT4 )
|
IF(USE_FERVOR)
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Core${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
INSTALL(FILES ${QT_DIR}/bin/Qt5Network${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Gui${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKit${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Widgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKitWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5PrintSupport${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
INSTALL(FILES ${QT_DIR}/bin/Qt5Quick${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
INSTALL(FILES ${QT_DIR}/plugins/platforms/qwindows${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms )
|
INSTALL(FILES ${QT_DIR}/bin/Qt5Qml${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
INSTALL(FILES ${QT_DIR}/plugins/platforms/qminimal${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms )
|
INSTALL(FILES ${QT_DIR}/bin/Qt5Multimedia${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
INSTALL(FILES ${QT_DIR}/plugins/platforms/qoffscreen${QT_DLL_POSTFIX}.dll DESTINATION bin/platforms )
|
INSTALL(FILES ${QT_DIR}/bin/Qt5Sql${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
|
INSTALL(FILES ${QT_DIR}/bin/Qt5Positioning${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
IF( USE_FERVOR )
|
INSTALL(FILES ${QT_DIR}/bin/Qt5Sensors${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Network${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
INSTALL(FILES ${QT_DIR}/bin/Qt5MultimediaWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKit${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
INSTALL(FILES ${QT_DIR}/bin/Qt5OpenGL${QT_DLL_POSTFIX}.dll DESTINATION bin)
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5WebKitWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Quick${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Qml${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Multimedia${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Sql${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Positioning${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5Sensors${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5MultimediaWidgets${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
|
||||||
INSTALL(FILES ${QT_DIR}/bin/Qt5OpenGL${QT_DLL_POSTFIX}.dll DESTINATION bin )
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF( USE_OPENCV )
|
IF(USE_OPENCV)
|
||||||
SET(OpenCV_DLL_DIR "${OpenCV_DIR}/bin" CACHE PATH "Where to find OpenCV dlls")
|
SET(OpenCV_DLL_DIR
|
||||||
SET(OpenCV_INSTALL_MODULES ${OPENCV_MODULES} CACHE STRING "List of OpenCV modules")
|
"${OpenCV_DIR}/bin"
|
||||||
FOREACH(opencv_module IN LISTS OpenCV_INSTALL_MODULES )
|
CACHE PATH "Where to find OpenCV dlls"
|
||||||
INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_${opencv_module}${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin )
|
)
|
||||||
|
SET(OpenCV_INSTALL_MODULES
|
||||||
|
${OPENCV_MODULES}
|
||||||
|
CACHE STRING "List of OpenCV modules"
|
||||||
|
)
|
||||||
|
FOREACH(opencv_module IN LISTS OpenCV_INSTALL_MODULES)
|
||||||
|
INSTALL(FILES ${OpenCV_DLL_DIR}/opencv_${opencv_module}${OpenCV_VERSION_MAJOR}${OpenCV_VERSION_MINOR}${OpenCV_VERSION_PATCH}.dll DESTINATION bin)
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF( USE_FFMPEG )
|
IF(USE_FFMPEG)
|
||||||
SET(FFMPEG_DIR "FFmpeg-Dir" CACHE PATH "Where to find FFmpeg Lib on Windows")
|
SET(FFMPEG_DIR
|
||||||
INSTALL(FILES ${FFMPEG_DIR}/bin/avcodec-${AVCODEC_VERSION}.dll DESTINATION bin )
|
"FFmpeg-Dir"
|
||||||
INSTALL(FILES ${FFMPEG_DIR}/bin/avformat-${AVFORMAT_VERSION}.dll DESTINATION bin )
|
CACHE PATH "Where to find FFmpeg Lib on Windows"
|
||||||
INSTALL(FILES ${FFMPEG_DIR}/bin/avutil-${AVUTIL_VERSION}.dll DESTINATION bin )
|
)
|
||||||
INSTALL(FILES ${FFMPEG_DIR}/bin/swscale-${SWSCALE_VERSION}.dll DESTINATION bin )
|
INSTALL(DIRECTORY ${FFMPEG_DIR}/bin/ DESTINATION bin)
|
||||||
INSTALL(FILES ${FFMPEG_DIR}/bin/swresample-${SWRESAMPLE_VERSION}.dll DESTINATION bin )
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
+8
-5
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -26,10 +26,10 @@
|
|||||||
#define __CONFIG_CALYP_H__
|
#define __CONFIG_CALYP_H__
|
||||||
|
|
||||||
/* Version definition */
|
/* Version definition */
|
||||||
#define CALYP_VERSION_MAJOR @CALYP_VERSION_MAJOR@
|
#define CALYP_VERSION_MAJOR @CALYP_VERSION_MAJOR @
|
||||||
#define CALYP_VERSION_MINOR @CALYP_VERSION_MINOR@
|
#define CALYP_VERSION_MINOR @CALYP_VERSION_MINOR @
|
||||||
#define CALYP_VERSION_PATCH @CALYP_VERSION_PATCH@
|
#define CALYP_VERSION_PATCH @CALYP_VERSION_PATCH @
|
||||||
#define CALYP_VERSION @CALYP_VERSION@
|
#define CALYP_VERSION @CALYP_VERSION @
|
||||||
#define CALYP_VERSION_STRING "@CALYP_VERSION_STRING@"
|
#define CALYP_VERSION_STRING "@CALYP_VERSION_STRING@"
|
||||||
|
|
||||||
#define UPDATE_CHANNEL "@UPDATE_CHANNEL@"
|
#define UPDATE_CHANNEL "@UPDATE_CHANNEL@"
|
||||||
@@ -55,4 +55,7 @@
|
|||||||
/* Fervor update lib */
|
/* Fervor update lib */
|
||||||
#cmakedefine USE_FERVOR
|
#cmakedefine USE_FERVOR
|
||||||
|
|
||||||
|
/* Use a resource manager to manage streams in different threads */
|
||||||
|
#cmakedefine CALYP_MANAGED_RESOURCES
|
||||||
|
|
||||||
#endif // __CONFIG_CALYP_H__
|
#endif // __CONFIG_CALYP_H__
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
###
|
#
|
||||||
### CMakeLists for examples
|
# CMakeLists for examples
|
||||||
###
|
#
|
||||||
|
|
||||||
|
|
||||||
ADD_SUBDIRECTORY( modules )
|
|
||||||
|
|
||||||
|
ADD_SUBDIRECTORY(modules)
|
||||||
|
ADD_SUBDIRECTORY(stream)
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -23,6 +23,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "AbsoluteFrameDifferenceExample.h"
|
#include "AbsoluteFrameDifferenceExample.h"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
REGISTER_CLASS_MAKER( AbsoluteFrameDifferenceExample )
|
REGISTER_CLASS_MAKER( AbsoluteFrameDifferenceExample )
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -25,10 +25,10 @@
|
|||||||
#ifndef __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__
|
#ifndef __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__
|
||||||
#define __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__
|
#define __ABSOLUTEFRAMEDIFFERENCEEXAMPLE_H__
|
||||||
|
|
||||||
#include "CalypModuleIf.h"
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "CalypModuleIf.h"
|
||||||
|
|
||||||
class AbsoluteFrameDifferenceExample : public CalypModuleIf
|
class AbsoluteFrameDifferenceExample : public CalypModuleIf
|
||||||
{
|
{
|
||||||
REGISTER_CLASS_FACTORY( AbsoluteFrameDifferenceExample )
|
REGISTER_CLASS_FACTORY( AbsoluteFrameDifferenceExample )
|
||||||
|
|||||||
@@ -1,21 +1,16 @@
|
|||||||
###
|
#
|
||||||
### CMakeLists for modules_example
|
# CMakeLists for modules_example
|
||||||
###
|
#
|
||||||
|
|
||||||
|
CMAKE_MINIMUM_REQUIRED(VERSION 3.5.0)
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED( VERSION 2.8.9 )
|
PROJECT("modules_example")
|
||||||
|
|
||||||
PROJECT( "modules_example" )
|
# THIS FIND_PACKAGE( Calyp ) INCLUDE_DIRECTORIES( ${CALYP_INCLUDE_DIRS} ) OR
|
||||||
|
INCLUDE_DIRECTORIES(../../lib)
|
||||||
|
|
||||||
# THIS
|
ADD_LIBRARY(FrameBinarizationAPIv1 SHARED FrameBinarizationAPIv1.cpp)
|
||||||
# FIND_PACKAGE( Calyp )
|
TARGET_LINK_LIBRARIES(FrameBinarizationAPIv1 ${PROJECT_LIBRARY})
|
||||||
#INCLUDE_DIRECTORIES( ${CALYP_INCLUDE_DIRS} )
|
|
||||||
# OR
|
|
||||||
INCLUDE_DIRECTORIES( ../../lib )
|
|
||||||
|
|
||||||
ADD_LIBRARY(FrameBinarization SHARED FrameBinarization_APIv1.cpp)
|
|
||||||
TARGET_LINK_LIBRARIES( FrameBinarization ${CALYP_LINKER_LIBS} )
|
|
||||||
|
|
||||||
ADD_LIBRARY(AbsoluteFrameDifferenceExample SHARED AbsoluteFrameDifferenceExample.cpp)
|
ADD_LIBRARY(AbsoluteFrameDifferenceExample SHARED AbsoluteFrameDifferenceExample.cpp)
|
||||||
TARGET_LINK_LIBRARIES( AbsoluteFrameDifferenceExample ${PROJECT_LIBRARY} ${CALYP_LINKER_LIBS} )
|
TARGET_LINK_LIBRARIES(AbsoluteFrameDifferenceExample ${PROJECT_LIBRARY})
|
||||||
|
|
||||||
+9
-9
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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
|
||||||
@@ -18,20 +18,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file FrameBinarization_APIv1.cpp
|
* \file FrameBinarizationAPIv1.cpp
|
||||||
* \brief Binarize frame module (example of APIv1)
|
* \brief Binarize frame module (example of APIv1)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "FrameBinarization_APIv1.h"
|
#include "FrameBinarizationAPIv1.h"
|
||||||
|
|
||||||
REGISTER_CLASS_MAKER( FrameBinarization_APIv1 )
|
REGISTER_CLASS_MAKER( FrameBinarizationAPIv1 )
|
||||||
|
|
||||||
FrameBinarization_APIv1::FrameBinarization_APIv1()
|
FrameBinarizationAPIv1::FrameBinarizationAPIv1()
|
||||||
{
|
{
|
||||||
/* Module Definition */
|
/* Module Definition */
|
||||||
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
m_iModuleType = CLP_FRAME_PROCESSING_MODULE;
|
||||||
m_pchModuleCategory = "Utilities";
|
m_pchModuleCategory = "Utilities";
|
||||||
m_pchModuleName = "FrameBinarization_APIv1";
|
m_pchModuleName = "FrameBinarizationAPIv1";
|
||||||
m_pchModuleLongName = "Frame Binarization API v1";
|
m_pchModuleLongName = "Frame Binarization API v1";
|
||||||
m_pchModuleTooltip = "Binarize frame";
|
m_pchModuleTooltip = "Binarize frame";
|
||||||
m_uiNumberOfFrames = 1;
|
m_uiNumberOfFrames = 1;
|
||||||
@@ -44,13 +44,13 @@ FrameBinarization_APIv1::FrameBinarization_APIv1()
|
|||||||
m_uiThreshold = 128;
|
m_uiThreshold = 128;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameBinarization_APIv1::create( CalypFrame* frame )
|
void FrameBinarizationAPIv1::create( CalypFrame* frame )
|
||||||
{
|
{
|
||||||
m_pcBinFrame = NULL;
|
m_pcBinFrame = NULL;
|
||||||
m_pcBinFrame = new CalypFrame( frame->getWidth(), frame->getHeight(), CLP_GRAY, 8 );
|
m_pcBinFrame = new CalypFrame( frame->getWidth(), frame->getHeight(), CLP_GRAY, 8 );
|
||||||
}
|
}
|
||||||
|
|
||||||
CalypFrame* FrameBinarization_APIv1::process( CalypFrame* frame )
|
CalypFrame* FrameBinarizationAPIv1::process( CalypFrame* frame )
|
||||||
{
|
{
|
||||||
const ClpPel* pPelInput = frame->getPelBufferYUV()[0][0];
|
const ClpPel* pPelInput = frame->getPelBufferYUV()[0][0];
|
||||||
ClpPel* pPelBin = m_pcBinFrame->getPelBufferYUV()[0][0];
|
ClpPel* pPelBin = m_pcBinFrame->getPelBufferYUV()[0][0];
|
||||||
@@ -62,7 +62,7 @@ CalypFrame* FrameBinarization_APIv1::process( CalypFrame* frame )
|
|||||||
return m_pcBinFrame;
|
return m_pcBinFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FrameBinarization_APIv1::destroy()
|
void FrameBinarizationAPIv1::destroy()
|
||||||
{
|
{
|
||||||
if( m_pcBinFrame )
|
if( m_pcBinFrame )
|
||||||
delete m_pcBinFrame;
|
delete m_pcBinFrame;
|
||||||
+9
-9
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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
|
||||||
@@ -18,29 +18,29 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file FrameBinarization_APIv1.h
|
* \file FrameBinarizationAPIv1.h
|
||||||
* \brief Binarize frame module (example of APIv1)
|
* \brief Binarize frame module (example of APIv1)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __FRAMEBINARIZATION_APIV1_H__
|
#ifndef __FRAMEBINARIZATIONAPIV1_H__
|
||||||
#define __FRAMEBINARIZATION_APIV1_H__
|
#define __FRAMEBINARIZATIONAPIV1_H__
|
||||||
|
|
||||||
#include "CalypModuleIf.h"
|
#include "CalypModuleIf.h"
|
||||||
|
|
||||||
class FrameBinarization_APIv1 : public CalypModuleIf
|
class FrameBinarizationAPIv1 : public CalypModuleIf
|
||||||
{
|
{
|
||||||
REGISTER_CLASS_FACTORY( FrameBinarization_APIv1 )
|
REGISTER_CLASS_FACTORY( FrameBinarizationAPIv1 )
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CalypFrame* m_pcBinFrame;
|
CalypFrame* m_pcBinFrame;
|
||||||
unsigned int m_uiThreshold;
|
unsigned int m_uiThreshold;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
FrameBinarization_APIv1();
|
FrameBinarizationAPIv1();
|
||||||
virtual ~FrameBinarization_APIv1() {}
|
virtual ~FrameBinarizationAPIv1() {}
|
||||||
void create( CalypFrame* );
|
void create( CalypFrame* );
|
||||||
CalypFrame* process( CalypFrame* );
|
CalypFrame* process( CalypFrame* );
|
||||||
void destroy();
|
void destroy();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __FRAMEBINARIZATION_APIV1_H__
|
#endif // __FRAMEBINARIZATIONAPIV1_H__
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# CMakeLists for modules_example
|
||||||
|
#
|
||||||
|
INCLUDE_DIRECTORIES(../../lib)
|
||||||
|
|
||||||
|
ADD_DEFINITIONS(-DCALYP_TEST_DATA_DIR=\"${CALYP_TEST_DATA_DIR}\")
|
||||||
|
|
||||||
|
ADD_EXECUTABLE(testStreamReading testStreamReading.cpp)
|
||||||
|
TARGET_LINK_LIBRARIES(testStreamReading ${PROJECT_LIBRARY})
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/* This file is a part of Calyp project
|
||||||
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
|
*
|
||||||
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation; either version 2 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file testStreamReading.cpp
|
||||||
|
* \brief Example of open and reading from a stream
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
#include "CalypFrame.h"
|
||||||
|
#include "CalypStream.h"
|
||||||
|
|
||||||
|
int main( int argc, char* argv[] )
|
||||||
|
{
|
||||||
|
// Use auto keyword to avoid typing long
|
||||||
|
// type definitions to get the timepoint
|
||||||
|
// at this instant use function now()
|
||||||
|
auto start = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
|
double n = 0;
|
||||||
|
CalypStream stream;
|
||||||
|
stream.open( std::string( CALYP_TEST_DATA_DIR ) + std::string( "/Foreman.yuv" ), 352, 288, 0, 8, CLP_BIG_ENDIAN, 1, true );
|
||||||
|
|
||||||
|
while( 1 )
|
||||||
|
{
|
||||||
|
CalypFrame* frame = stream.getCurrFrame();
|
||||||
|
frame->fillRGBBuffer();
|
||||||
|
n++;
|
||||||
|
if( stream.setNextFrame() )
|
||||||
|
break;
|
||||||
|
stream.readNextFrame();
|
||||||
|
}
|
||||||
|
|
||||||
|
// After function call
|
||||||
|
auto stop = std::chrono::high_resolution_clock::now();
|
||||||
|
|
||||||
|
// Subtract stop and start timepoints and
|
||||||
|
// cast it to required unit. Predefined units
|
||||||
|
// are nanoseconds, microseconds, milliseconds,
|
||||||
|
// seconds, minutes, hours. Use duration_cast()
|
||||||
|
// function.
|
||||||
|
auto duration = std::chrono::duration_cast<std::chrono::microseconds>( stop - start );
|
||||||
|
|
||||||
|
// To get the value of duration use the count()
|
||||||
|
// member function on the duration object
|
||||||
|
std::cout << duration.count() / 1000.0 / n << std::endl;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
+71
-67
@@ -1,22 +1,16 @@
|
|||||||
###
|
#
|
||||||
### CMakeLists for calyp lib component
|
# CMakeLists for calyp lib component
|
||||||
###
|
#
|
||||||
|
|
||||||
INCLUDE(GNUInstallDirs)
|
INCLUDE(GNUInstallDirs)
|
||||||
|
SET(CMAKE_EXPORT_PACKAGE_REGISTRY ON)
|
||||||
|
EXPORT(PACKAGE MyLib)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR} )
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/..)
|
||||||
|
|
||||||
set(Calyp_Lib_SRCS
|
SET(Calyp_Lib_Frame_SRCS CalypPixel.cpp PixelFormats.h PixelFormats.cpp CalypFrame.h CalypFrame.cpp)
|
||||||
LibMemory.h
|
|
||||||
CalypLib.h
|
SET(Calyp_Lib_Stream_SRCS
|
||||||
CalypDefs.h
|
|
||||||
# Frame
|
|
||||||
CalypFrame.h
|
|
||||||
CalypFrame.cpp
|
|
||||||
CalypPixel.cpp
|
|
||||||
PixelFormats.h
|
|
||||||
PixelFormats.cpp
|
|
||||||
# Stream
|
|
||||||
CalypStream.h
|
CalypStream.h
|
||||||
CalypStream.cpp
|
CalypStream.cpp
|
||||||
CalypStreamHandlerIf.h
|
CalypStreamHandlerIf.h
|
||||||
@@ -24,81 +18,91 @@ set(Calyp_Lib_SRCS
|
|||||||
StreamHandlerRaw.cpp
|
StreamHandlerRaw.cpp
|
||||||
StreamHandlerPortableMap.h
|
StreamHandlerPortableMap.h
|
||||||
StreamHandlerPortableMap.cpp
|
StreamHandlerPortableMap.cpp
|
||||||
# Options Parser
|
|
||||||
CalypOptions.h
|
|
||||||
CalypOptions.cpp
|
|
||||||
# Modules
|
|
||||||
CalypModuleIf.h
|
|
||||||
CalypOpenCVModuleIf.h
|
|
||||||
)
|
)
|
||||||
|
|
||||||
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${PROJECT_LIBRARY} )
|
SET(Calyp_Lib_OptionParser_SRCS CalypOptions.h CalypOptions.cpp)
|
||||||
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR} )
|
|
||||||
|
|
||||||
IF( USE_FFMPEG )
|
SET(Calyp_Lib_Modules_SRCS CalypOptions.h CalypOptions.cpp)
|
||||||
LIST( APPEND Calyp_Lib_SRCS StreamHandlerLibav.h )
|
|
||||||
LIST( APPEND Calyp_Lib_SRCS StreamHandlerLibav.cpp )
|
|
||||||
|
|
||||||
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${FFMPEG_LIBRARIES} )
|
SET(Calyp_Lib_SRCS CalypLib.h CalypDefs.h ${Calyp_Lib_Frame_SRCS} ${Calyp_Lib_Stream_SRCS} ${Calyp_Lib_OptionParser_SRCS} ${Calyp_Lib_Modules_SRCS})
|
||||||
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS} )
|
|
||||||
|
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
|
IF(USE_FFMPEG)
|
||||||
|
LIST(APPEND Calyp_Lib_SRCS StreamHandlerLibav.h)
|
||||||
|
LIST(APPEND Calyp_Lib_SRCS StreamHandlerLibav.cpp)
|
||||||
|
|
||||||
|
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${FFMPEG_LIBRARIES})
|
||||||
|
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${FFMPEG_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${FFMPEG_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
LIST(APPEND CALYP_LIB_LINKER_DEPENDENCIES ${FFMPEG_LIBRARIES})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF( USE_OPENCV )
|
IF(USE_OPENCV)
|
||||||
LIST( APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.h )
|
LIST(APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.h)
|
||||||
LIST( APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.cpp )
|
LIST(APPEND Calyp_Lib_SRCS StreamHandlerOpenCV.cpp)
|
||||||
|
|
||||||
LIST( APPEND Calyp_Lib_SRCS CalypOpenCVModuleIf.cpp )
|
LIST(APPEND Calyp_Lib_SRCS CalypOpenCVModuleIf.cpp)
|
||||||
|
|
||||||
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${OpenCV_LIBRARIES} )
|
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${OpenCV_LIBRARIES})
|
||||||
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} )
|
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
LIST(APPEND CMAKE_CFG_LINKER_LIBSS ${PROJECT_LIBRARY})
|
||||||
|
LIST(APPEND CMAKE_CFG_INCLUDE_DIRS ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
|
|
||||||
|
INCLUDE_DIRECTORIES(${OpenCV_INCLUDE_DIRS})
|
||||||
|
|
||||||
|
LIST(APPEND CALYP_LIB_LINKER_DEPENDENCIES ${OpenCV_LIBRARIES})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
set(Calyp_Lib_HEADERS
|
SET(Calyp_Lib_HEADERS CalypFrame.h CalypStream.h CalypOptions.h CalypModuleIf.h)
|
||||||
CalypDefs.h
|
|
||||||
CalypFrame.h
|
INCLUDE(CMakePackageConfigHelpers)
|
||||||
CalypStream.h
|
|
||||||
CalypOptions.h
|
CONFIGURE_PACKAGE_CONFIG_FILE(CalypConfig.cmake.in CalypConfig.cmake INSTALL_DESTINATION share/calyp)
|
||||||
CalypModuleIf.h
|
|
||||||
CalypOpenCVModuleIf.h
|
WRITE_BASIC_PACKAGE_VERSION_FILE(
|
||||||
|
CalypConfigVersion.cmake
|
||||||
|
VERSION ${CALYP_VERSION}
|
||||||
|
COMPATIBILITY SameMajorVersion
|
||||||
)
|
)
|
||||||
|
|
||||||
CONFIGURE_FILE( CalypConfig.cmake.in CalypConfig.cmake @ONLY)
|
# CONFIGURE_FILE(CalypConfig.cmake.in CalypConfig.cmake @ONLY)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES( ${FFMPEG_INCLUDE_DIRS} ${OpenCV_INCLUDE_DIRS} )
|
IF(USE_STATIC)
|
||||||
|
ADD_LIBRARY(${PROJECT_LIBRARY} STATIC ${Calyp_Lib_SRCS})
|
||||||
IF( USE_STATIC )
|
|
||||||
ADD_LIBRARY( ${PROJECT_LIBRARY} STATIC ${Calyp_Lib_SRCS} )
|
|
||||||
ELSE()
|
ELSE()
|
||||||
ADD_LIBRARY( ${PROJECT_LIBRARY} SHARED ${Calyp_Lib_SRCS} )
|
ADD_LIBRARY(${PROJECT_LIBRARY} SHARED ${Calyp_Lib_SRCS})
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
TARGET_LINK_LIBRARIES(${PROJECT_LIBRARY} ${CALYP_LIB_LINKER_DEPENDENCIES})
|
||||||
|
# TARGET_INCLUDE_DIRECTORIES(${PROJECT_LIBRARY} PUBLIC $<INSTALL_INTERFACE:include> $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>)
|
||||||
|
SET_TARGET_PROPERTIES(${PROJECT_LIBRARY} PROPERTIES VERSION ${CALYP_VERSION} SOVERSION ${CALYP_VERSION_MAJOR})
|
||||||
|
|
||||||
TARGET_LINK_LIBRARIES( ${PROJECT_LIBRARY}
|
IF(USE_IWYU)
|
||||||
${FFMPEG_LIBRARIES}
|
SET_PROPERTY(TARGET ${PROJECT_LIBRARY} PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path})
|
||||||
${OpenCV_LIBRARIES}
|
ENDIF()
|
||||||
)
|
|
||||||
|
|
||||||
TARGET_INCLUDE_DIRECTORIES(${PROJECT_LIBRARY}
|
EXPORT(TARGETS ${PROJECT_LIBRARY} FILE ${CMAKE_CURRENT_BINARY_DIR}/CalypTargets.cmake)
|
||||||
PUBLIC
|
EXPORT(PACKAGE ${PROJECT_LIBRARY})
|
||||||
$<INSTALL_INTERFACE:include>
|
|
||||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
|
|
||||||
)
|
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES( ${PROJECT_LIBRARY}
|
IF(NOT USE_STATIC)
|
||||||
PROPERTIES VERSION ${CALYP_VERSION}
|
INSTALL(
|
||||||
SOVERSION ${CALYP_VERSION_MAJOR}
|
TARGETS ${PROJECT_LIBRARY}
|
||||||
)
|
EXPORT "${PROJECT_LIBRARY}Targets"
|
||||||
|
|
||||||
IF( NOT USE_STATIC )
|
|
||||||
INSTALL( TARGETS ${PROJECT_LIBRARY}
|
|
||||||
RUNTIME DESTINATION bin
|
RUNTIME DESTINATION bin
|
||||||
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
|
||||||
)
|
)
|
||||||
INSTALL(FILES ${Calyp_Lib_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" )
|
INSTALL(FILES ${Calyp_Lib_HEADERS} DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
|
||||||
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CalypConfig.cmake DESTINATION share/calyp )
|
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CalypConfig.cmake ${CMAKE_CURRENT_BINARY_DIR}/CalypConfigVersion.cmake DESTINATION share/calyp)
|
||||||
|
INSTALL(EXPORT CalypTargets DESTINATION share/calyp)
|
||||||
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF( BUILD_TESTS )
|
IF(BUILD_TESTS)
|
||||||
ADD_SUBDIRECTORY( tests )
|
ADD_SUBDIRECTORY(tests)
|
||||||
|
ADD_SUBDIRECTORY(catch2)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
@@ -12,7 +12,7 @@
|
|||||||
#
|
#
|
||||||
#
|
#
|
||||||
# This file will define the following variables:
|
# This file will define the following variables:
|
||||||
# - CALYP_LINKER_LIBS : The list of all imported targets for OpenCV modules.
|
# - CALYP_LIBRARIES : The list of all imported targets for OpenCV modules.
|
||||||
# - CALYP_CXX_FLAGS
|
# - CALYP_CXX_FLAGS
|
||||||
# - CALYP_INCLUDE_DIRS : The Calyp include directories.
|
# - CALYP_INCLUDE_DIRS : The Calyp include directories.
|
||||||
# - CALYP_VERSION : The version of this Calyp build: "@CALYP_VERSION@"
|
# - CALYP_VERSION : The version of this Calyp build: "@CALYP_VERSION@"
|
||||||
@@ -22,15 +22,18 @@
|
|||||||
#
|
#
|
||||||
# ===================================================================================================================
|
# ===================================================================================================================
|
||||||
|
|
||||||
|
@PACKAGE_INIT@
|
||||||
|
|
||||||
# ======================================================
|
|
||||||
# Variables:
|
|
||||||
# ======================================================
|
|
||||||
SET(CALYP_VERSION @CALYP_VERSION@)
|
SET(CALYP_VERSION @CALYP_VERSION@)
|
||||||
SET(CALYP_VERSION_MAJOR @CALYP_VERSION_MAJOR@)
|
SET(CALYP_VERSION_MAJOR @CALYP_VERSION_MAJOR@)
|
||||||
SET(CALYP_VERSION_MINOR @CALYP_VERSION_MINOR@)
|
SET(CALYP_VERSION_MINOR @CALYP_VERSION_MINOR@)
|
||||||
SET(CALYP_VERSION_PATCH @CALYP_VERSION_PATCH@)
|
SET(CALYP_VERSION_PATCH @CALYP_VERSION_PATCH@)
|
||||||
|
|
||||||
|
FIND_LIBRARY(CALYP_LIBRARY NAMES Calyp HINTS @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@ )
|
||||||
|
|
||||||
SET( CALYP_CXX_FLAGS "" )
|
SET( CALYP_CXX_FLAGS "" )
|
||||||
SET( CALYP_INCLUDE_DIRS "@CMAKE_CFG_INCLUDE_DIRS@" )
|
SET( CALYP_LIBRARIES "${CALYP_LIBRARY}" )
|
||||||
SET( CALYP_LINKER_LIBS "@CMAKE_CFG_LINKER_LIBSS@" )
|
LIST( APPEND CALYP_LIBRARIES "@CALYP_LIB_LINKER_DEPENDENCIES@")
|
||||||
|
set_and_check( CALYP_INCLUDE_DIRS "@CMAKE_CFG_INCLUDE_DIRS@" )
|
||||||
|
|
||||||
|
CHECK_REQUIRED_COMPONENTS(Calyp)
|
||||||
+14
-77
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -27,15 +27,9 @@
|
|||||||
#define __CALYPDEFS_H__
|
#define __CALYPDEFS_H__
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
|
#include <memory>
|
||||||
typedef unsigned short ClpPel; ///< 16-bit pixel type
|
#include <string>
|
||||||
typedef unsigned char ClpByte;
|
|
||||||
typedef unsigned long long ClpULong;
|
|
||||||
|
|
||||||
typedef std::string ClpString;
|
|
||||||
|
|
||||||
enum CLP_LOG_LEVEL
|
enum CLP_LOG_LEVEL
|
||||||
{
|
{
|
||||||
@@ -45,94 +39,37 @@ enum CLP_LOG_LEVEL
|
|||||||
CLP_LOG_ERROR = 4,
|
CLP_LOG_ERROR = 4,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum CalypColorSpace
|
|
||||||
* \brief List of supported color spaces
|
|
||||||
* \ingroup CalypLibGrp
|
|
||||||
*/
|
|
||||||
enum CalypColorSpace
|
|
||||||
{
|
|
||||||
CLP_COLOR_INVALID = -1, //!< Invalid
|
|
||||||
CLP_COLOR_YUV = 0, //!< YUV
|
|
||||||
CLP_COLOR_RGB = 1, //!< RGB
|
|
||||||
CLP_COLOR_GRAY = 2, //!< Grayscale
|
|
||||||
CLP_COLOR_RGBA = 3, //!< RGB + Alpha
|
|
||||||
CLP_COLOR_MAX = 255, //!< Account for future formats
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \enum CalypPixelFormats
|
|
||||||
* \brief List of supported pixel formats
|
|
||||||
* \ingroup CalypLibGrp
|
|
||||||
*/
|
|
||||||
enum CalypPixelFormats
|
|
||||||
{
|
|
||||||
CLP_INVALID_FMT = -1, //!< Invalid
|
|
||||||
CLP_YUV420P = 0, //!< YUV 420 progressive
|
|
||||||
CLP_YUV422P, //!< YUV 422 progressive
|
|
||||||
CLP_YUV444P, //!< YUV 444 progressive
|
|
||||||
CLP_YUYV422, //!< YUV 422 interleaved
|
|
||||||
CLP_GRAY, //!< Grayscale
|
|
||||||
CLP_RGB24P, //!< RGB 32 bpp progressive
|
|
||||||
CLP_RGB24, //!< RGB 32 bpp
|
|
||||||
CLP_BGR24, //!< BGR 32 bpp
|
|
||||||
CLP_RGBA32, //!< RGBA 32 bpp
|
|
||||||
CLP_BGRA32, //!< BGRA 32 bpp
|
|
||||||
CLP_MAX_FMT = 255, //!< Account for future formats
|
|
||||||
};
|
|
||||||
|
|
||||||
enum CLP_YUV_Components
|
|
||||||
{
|
|
||||||
CLP_LUMA = 0,
|
|
||||||
CLP_CHROMA_U,
|
|
||||||
CLP_CHROMA_V,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum CLP_RGB_Components
|
|
||||||
{
|
|
||||||
CLP_COLOR_R = 0,
|
|
||||||
CLP_COLOR_G,
|
|
||||||
CLP_COLOR_B,
|
|
||||||
CLP_COLOR_A,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum CLP_Endianness
|
|
||||||
{
|
|
||||||
CLP_BIG_ENDIAN = 0,
|
|
||||||
CLP_LITTLE_ENDIAN = 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
static const double S_PI = 3.14159265358979323846;
|
static const double S_PI = 3.14159265358979323846;
|
||||||
static const double S_PI_2 = 1.57079632679489661923;
|
static const double S_PI_2 = 1.57079632679489661923;
|
||||||
|
|
||||||
inline ClpString clpLowercase( const ClpString& in )
|
inline std::string clpLowercase( const std::string& in )
|
||||||
{
|
{
|
||||||
ClpString out;
|
std::string out;
|
||||||
transform( in.begin(), in.end(), std::back_inserter( out ), tolower );
|
std::transform( in.begin(), in.end(), std::back_inserter( out ), tolower );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline ClpString clpUppercase( const ClpString& in )
|
inline std::string clpUppercase( const std::string& in )
|
||||||
{
|
{
|
||||||
ClpString out;
|
std::string out;
|
||||||
transform( in.begin(), in.end(), std::back_inserter( out ), toupper );
|
std::transform( in.begin(), in.end(), std::back_inserter( out ), toupper );
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CalypFailure : public std::exception
|
struct CalypFailure : public std::exception
|
||||||
{
|
{
|
||||||
ClpString m_class_name;
|
std::string m_class_name;
|
||||||
ClpString m_error_msg;
|
std::string m_error_msg;
|
||||||
CalypFailure( ClpString error_msg ) throw()
|
CalypFailure( std::string error_msg ) throw()
|
||||||
: m_error_msg( error_msg ) {}
|
: m_error_msg( error_msg ) {}
|
||||||
CalypFailure( ClpString class_name, ClpString error_msg ) throw()
|
CalypFailure( std::string class_name, std::string error_msg ) throw()
|
||||||
: m_class_name( class_name ), m_error_msg( error_msg )
|
: m_class_name( class_name ), m_error_msg( error_msg )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
~CalypFailure() throw() {}
|
~CalypFailure() throw() {}
|
||||||
const char* what() const throw()
|
const char* what() const throw()
|
||||||
{
|
{
|
||||||
ClpString* msg = new ClpString( "[" + m_class_name + "] " + m_error_msg );
|
std::string* msg = new std::string( "[" + m_class_name + "] " + m_error_msg );
|
||||||
return msg->c_str();
|
return msg->c_str();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
+238
-144
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -24,12 +24,14 @@
|
|||||||
|
|
||||||
#include "CalypFrame.h"
|
#include "CalypFrame.h"
|
||||||
|
|
||||||
#include "LibMemory.h"
|
|
||||||
#include "PixelFormats.h"
|
|
||||||
#include "config.h"
|
|
||||||
|
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstring>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include "CalypDefs.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
#ifdef USE_OPENCV
|
#ifdef USE_OPENCV
|
||||||
#include <opencv2/core/core.hpp>
|
#include <opencv2/core/core.hpp>
|
||||||
@@ -37,9 +39,24 @@
|
|||||||
#include <opencv2/imgproc/imgproc.hpp>
|
#include <opencv2/imgproc/imgproc.hpp>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<ClpString> CalypFrame::supportedColorSpacesListNames()
|
#include "PixelFormats.h"
|
||||||
|
#include "config.h"
|
||||||
|
|
||||||
|
#define DATA_ALIGN 1 ///< use 32-bit aligned malloc/free
|
||||||
|
#if DATA_ALIGN && _WIN32 && ( _MSC_VER > 1300 )
|
||||||
|
#define xMalloc( len ) _aligned_malloc( len, 32 )
|
||||||
|
#define xFreeMem( ptr ) _aligned_free( ptr )
|
||||||
|
#else
|
||||||
|
#define xMalloc( len ) malloc( len )
|
||||||
|
#define xFreeMem( ptr ) free( ptr )
|
||||||
|
#endif
|
||||||
|
|
||||||
|
constexpr auto kMinBitsPerPixel = 8;
|
||||||
|
constexpr auto kMaxBitsPerPixel = 16;
|
||||||
|
|
||||||
|
std::vector<std::string> CalypFrame::supportedColorSpacesListNames()
|
||||||
{
|
{
|
||||||
return std::vector<ClpString>{
|
return std::vector<std::string>{
|
||||||
"YUV",
|
"YUV",
|
||||||
"RGB",
|
"RGB",
|
||||||
"GRAY",
|
"GRAY",
|
||||||
@@ -47,9 +64,9 @@ std::vector<ClpString> CalypFrame::supportedColorSpacesListNames()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ClpString> CalypFrame::supportedPixelFormatListNames()
|
std::vector<std::string> CalypFrame::supportedPixelFormatListNames()
|
||||||
{
|
{
|
||||||
std::vector<ClpString> formatsList;
|
std::vector<std::string> formatsList;
|
||||||
for( int i = 0; i < numberOfFormats(); i++ )
|
for( int i = 0; i < numberOfFormats(); i++ )
|
||||||
{
|
{
|
||||||
formatsList.push_back( g_CalypPixFmtDescriptorsMap.at( i ).name );
|
formatsList.push_back( g_CalypPixFmtDescriptorsMap.at( i ).name );
|
||||||
@@ -57,9 +74,9 @@ std::vector<ClpString> CalypFrame::supportedPixelFormatListNames()
|
|||||||
return formatsList;
|
return formatsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ClpString> CalypFrame::supportedPixelFormatListNames( int colorSpace )
|
std::vector<std::string> CalypFrame::supportedPixelFormatListNames( int colorSpace )
|
||||||
{
|
{
|
||||||
std::vector<ClpString> formatsList;
|
std::vector<std::string> formatsList;
|
||||||
for( int i = 0; i < numberOfFormats(); i++ )
|
for( int i = 0; i < numberOfFormats(); i++ )
|
||||||
{
|
{
|
||||||
if( g_CalypPixFmtDescriptorsMap.at( i ).colorSpace == colorSpace )
|
if( g_CalypPixFmtDescriptorsMap.at( i ).colorSpace == colorSpace )
|
||||||
@@ -70,10 +87,10 @@ std::vector<ClpString> CalypFrame::supportedPixelFormatListNames( int colorSpace
|
|||||||
|
|
||||||
int CalypFrame::numberOfFormats()
|
int CalypFrame::numberOfFormats()
|
||||||
{
|
{
|
||||||
return g_CalypPixFmtDescriptorsMap.size();
|
return static_cast<int>( g_CalypPixFmtDescriptorsMap.size() );
|
||||||
}
|
}
|
||||||
|
|
||||||
int CalypFrame::findPixelFormat( const ClpString& name )
|
int CalypFrame::findPixelFormat( const std::string& name )
|
||||||
{
|
{
|
||||||
for( int i = 0; i < numberOfFormats(); i++ )
|
for( int i = 0; i < numberOfFormats(); i++ )
|
||||||
{
|
{
|
||||||
@@ -88,36 +105,42 @@ int CalypFrame::pelformatColorSpace( const int idx )
|
|||||||
return g_CalypPixFmtDescriptorsMap.at( idx ).colorSpace;
|
return g_CalypPixFmtDescriptorsMap.at( idx ).colorSpace;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct CalypFramePrivate
|
class CalypFrame::CalypFramePrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
bool m_bInit;
|
bool m_bInit{ false };
|
||||||
|
|
||||||
//! Struct with the pixel format description.
|
//! Struct with the pixel format description.
|
||||||
const CalypPixelFormatDescriptor* m_pcPelFormat;
|
const CalypPixelFormatDescriptor* m_pcPelFormat{ nullptr };
|
||||||
ClpString m_cPelFmtName;
|
std::string m_cPelFmtName;
|
||||||
|
|
||||||
unsigned int m_uiWidth; //!< Width of the frame
|
unsigned int m_uiWidth{ 0 }; //!< Width of the frame
|
||||||
unsigned int m_uiHeight; //!< Height of the frame
|
unsigned int m_uiHeight{ 0 }; //!< Height of the frame
|
||||||
int m_iPixelFormat; //!< Pixel format number (it follows the list of supported pixel formats)
|
int m_iPixelFormat{ 0 }; //!< Pixel format number (it follows the list of supported pixel formats)
|
||||||
unsigned int m_uiBitsPel; //!< Bits per pixel/channel
|
unsigned int m_uiBitsPel{ 0 }; //!< Bits per pixel/channel
|
||||||
unsigned int m_uiHalfPelValue; //!< Bits per pixel/channel
|
unsigned int m_uiHalfPelValue{ 0 }; //!< Bits per pixel/channel
|
||||||
bool m_bHasNegativeValues; //!< Half of the scale correspond to negative values
|
bool m_bHasNegativeValues{ false }; //!< Half of the scale correspond to negative values
|
||||||
|
|
||||||
ClpPel*** m_pppcInputPel;
|
ClpPel*** m_pppcInputPel{ nullptr };
|
||||||
|
|
||||||
bool m_bHasRGBPel; //!< Flag indicating that the ARGB buffer was computed
|
bool m_bHasRGBPel{ false }; //!< Flag indicating that the ARGB buffer was computed
|
||||||
unsigned char* m_pcARGB32; //!< Buffer with the ARGB pixels used in Qt libs
|
std::vector<std::uint8_t> m_pcARGB32; //!< Buffer with the ARGB pixels used in Qt libs
|
||||||
|
|
||||||
/** Histogram control variables **/
|
/** Histogram control variables **/
|
||||||
bool m_bHasHistogram;
|
bool m_bHasHistogram{ false };
|
||||||
bool m_bHistogramRunning;
|
bool m_bHistogramRunning{ false };
|
||||||
/** The histogram data.*/
|
/** The histogram data.*/
|
||||||
unsigned int* m_puiHistogram;
|
std::vector<unsigned int> m_puiHistogram;
|
||||||
/** If the image is RGB and calcLuma is true, we have 1 more channel */
|
/** If the image is RGB and calcLuma is true, we have 1 more channel */
|
||||||
unsigned int m_uiHistoChannels;
|
unsigned int m_uiHistoChannels{ 0 };
|
||||||
/** Numbers of histogram segments depending of image bytes depth*/
|
/** Numbers of histogram segments depending of image bytes depth*/
|
||||||
unsigned int m_uiHistoSegments;
|
unsigned int m_uiHistoSegments{ 0 };
|
||||||
|
|
||||||
|
CalypFramePrivate() = default;
|
||||||
|
CalypFramePrivate( const CalypFramePrivate& ) = delete;
|
||||||
|
CalypFramePrivate( CalypFramePrivate&& ) = delete;
|
||||||
|
CalypFramePrivate& operator=( const CalypFramePrivate& ) = delete;
|
||||||
|
CalypFramePrivate& operator=( CalypFramePrivate&& ) = delete;
|
||||||
|
|
||||||
void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel )
|
void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel )
|
||||||
{
|
{
|
||||||
@@ -126,20 +149,16 @@ public:
|
|||||||
|
|
||||||
void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel, bool has_negative_values )
|
void init( unsigned int width, unsigned int height, int pel_format, unsigned bitsPixel, bool has_negative_values )
|
||||||
{
|
{
|
||||||
m_bInit = false;
|
|
||||||
m_bHasRGBPel = false;
|
|
||||||
m_pppcInputPel = NULL;
|
|
||||||
m_pcARGB32 = NULL;
|
|
||||||
m_uiWidth = width;
|
m_uiWidth = width;
|
||||||
m_uiHeight = height;
|
m_uiHeight = height;
|
||||||
m_iPixelFormat = pel_format;
|
m_iPixelFormat = pel_format;
|
||||||
m_uiBitsPel = bitsPixel < 8 ? 8 : bitsPixel;
|
m_uiBitsPel = bitsPixel < kMinBitsPerPixel ? kMinBitsPerPixel : bitsPixel;
|
||||||
m_uiHalfPelValue = 1 << ( m_uiBitsPel - 1 );
|
m_uiHalfPelValue = 1 << ( m_uiBitsPel - 1 );
|
||||||
m_bHasNegativeValues = has_negative_values;
|
m_bHasNegativeValues = has_negative_values;
|
||||||
|
|
||||||
if( m_uiWidth == 0 || m_uiHeight == 0 || m_iPixelFormat == -1 || bitsPixel > 16 )
|
if( m_uiWidth == 0 || m_uiHeight == 0 || m_iPixelFormat == -1 || bitsPixel > kMaxBitsPerPixel )
|
||||||
{
|
{
|
||||||
throw CalypFailure( "CalypFrame", "Cannot create a PlYUVerFrame of this type" );
|
throw CalypFailure( "CalypFrame", "Cannot create a CalypFrame of this type" );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( pel_format ) );
|
m_pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( pel_format ) );
|
||||||
@@ -158,7 +177,7 @@ public:
|
|||||||
}
|
}
|
||||||
mem_size += num_of_ptrs * sizeof( ClpPel* ) + sizeof( ClpPel** ) * iNumberChannels;
|
mem_size += num_of_ptrs * sizeof( ClpPel* ) + sizeof( ClpPel** ) * iNumberChannels;
|
||||||
|
|
||||||
m_pppcInputPel = (ClpPel***)xMallocMem( mem_size );
|
m_pppcInputPel = (ClpPel***)xMalloc( mem_size );
|
||||||
|
|
||||||
ClpPel** pelPtrMem = (ClpPel**)( m_pppcInputPel + iNumberChannels );
|
ClpPel** pelPtrMem = (ClpPel**)( m_pppcInputPel + iNumberChannels );
|
||||||
ClpPel* pelMem = (ClpPel*)( pelPtrMem + num_of_ptrs );
|
ClpPel* pelMem = (ClpPel*)( pelPtrMem + num_of_ptrs );
|
||||||
@@ -176,9 +195,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Alloc ARGB memory */
|
/* Alloc ARGB memory */
|
||||||
getMem1D( &m_pcARGB32, m_uiHeight * m_uiWidth * 4 );
|
m_pcARGB32.resize( m_uiHeight * m_uiWidth * 4 );
|
||||||
|
|
||||||
m_puiHistogram = NULL;
|
|
||||||
m_bHasHistogram = false;
|
m_bHasHistogram = false;
|
||||||
m_bHistogramRunning = false;
|
m_bHistogramRunning = false;
|
||||||
|
|
||||||
@@ -190,7 +208,7 @@ public:
|
|||||||
else
|
else
|
||||||
m_uiHistoChannels = m_pcPelFormat->numberChannels;
|
m_uiHistoChannels = m_pcPelFormat->numberChannels;
|
||||||
|
|
||||||
getMem1D<unsigned int>( &( m_puiHistogram ), m_uiHistoSegments * m_uiHistoChannels );
|
m_puiHistogram.resize( m_uiHistoSegments * m_uiHistoChannels );
|
||||||
|
|
||||||
m_cPelFmtName = CalypFrame::supportedPixelFormatListNames()[m_iPixelFormat].c_str();
|
m_cPelFmtName = CalypFrame::supportedPixelFormatListNames()[m_iPixelFormat].c_str();
|
||||||
|
|
||||||
@@ -242,53 +260,78 @@ public:
|
|||||||
{
|
{
|
||||||
while( m_bHistogramRunning )
|
while( m_bHistogramRunning )
|
||||||
;
|
;
|
||||||
if( m_puiHistogram )
|
|
||||||
freeMem1D( m_puiHistogram );
|
|
||||||
m_bHasHistogram = false;
|
m_bHasHistogram = false;
|
||||||
|
|
||||||
if( m_pppcInputPel )
|
if( m_pppcInputPel )
|
||||||
xFreeMem( m_pppcInputPel );
|
xFreeMem( m_pppcInputPel );
|
||||||
|
|
||||||
if( m_pcARGB32 )
|
|
||||||
freeMem1D( m_pcARGB32 );
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Constructors
|
* \brief Constructors
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel )
|
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel )
|
||||||
: d( new CalypFramePrivate )
|
: d{ std::make_unique<CalypFramePrivate>() }
|
||||||
{
|
{
|
||||||
d->init( width, height, pelFormat, bitsPixel );
|
d->init( width, height, pelFormat, bitsPixel );
|
||||||
}
|
}
|
||||||
|
|
||||||
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel, bool has_negative_values )
|
CalypFrame::CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel, bool has_negative_values )
|
||||||
: d( new CalypFramePrivate )
|
: d{ std::make_unique<CalypFramePrivate>() }
|
||||||
{
|
{
|
||||||
d->init( width, height, pelFormat, bitsPixel, has_negative_values );
|
d->init( width, height, pelFormat, bitsPixel, has_negative_values );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CalypFrame::CalypFrame( CalypFrame&& other ) noexcept
|
||||||
|
: d{ std::move( other.d ) }
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CalypFrame& CalypFrame::operator=( CalypFrame&& other ) noexcept
|
||||||
|
{
|
||||||
|
// Self-assignment detection
|
||||||
|
if( &other == this )
|
||||||
|
return *this;
|
||||||
|
|
||||||
|
// Transfer ownership of a.m_ptr to m_ptr
|
||||||
|
d = std::move( other.d );
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
CalypFrame::CalypFrame( const CalypFrame& other )
|
CalypFrame::CalypFrame( const CalypFrame& other )
|
||||||
: d( new CalypFramePrivate )
|
: d{ std::make_unique<CalypFramePrivate>() }
|
||||||
{
|
{
|
||||||
d->init( other.getWidth(), other.getHeight(), other.getPelFormat(), other.getBitsPel(), other.getHasNegativeValues() );
|
d->init( other.getWidth(), other.getHeight(), other.getPelFormat(), other.getBitsPel(), other.getHasNegativeValues() );
|
||||||
copyFrom( &other );
|
copyFrom( &other );
|
||||||
}
|
}
|
||||||
|
|
||||||
CalypFrame::CalypFrame( const CalypFrame* other )
|
// CalypFrame::CalypFrame( const CalypFrame* other )
|
||||||
: d( new CalypFramePrivate )
|
// : d{ std::make_unique<CalypFramePrivate>() }
|
||||||
|
// {
|
||||||
|
// if( other )
|
||||||
|
// {
|
||||||
|
// d->init( other->getWidth(), other->getHeight(), other->getPelFormat(), other->getBitsPel(), other->getHasNegativeValues() );
|
||||||
|
// copyFrom( other );
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
CalypFrame& CalypFrame::operator=( const CalypFrame& other )
|
||||||
{
|
{
|
||||||
if( other )
|
// Self-assignment detection
|
||||||
{
|
if( &other == this )
|
||||||
d->init( other->getWidth(), other->getHeight(), other->getPelFormat(), other->getBitsPel(), other->getHasNegativeValues() );
|
return *this;
|
||||||
copyFrom( other );
|
|
||||||
}
|
// Copy the resource
|
||||||
|
d = std::make_unique<CalypFramePrivate>();
|
||||||
|
d->init( other.getWidth(), other.getHeight(), other.getPelFormat(), other.getBitsPel(), other.getHasNegativeValues() );
|
||||||
|
copyFrom( &other );
|
||||||
|
|
||||||
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
CalypFrame::CalypFrame( const CalypFrame& other, unsigned int x, unsigned int y, unsigned int width, unsigned int height )
|
CalypFrame::CalypFrame( const CalypFrame& other, unsigned int x, unsigned int y, unsigned int width, unsigned int height )
|
||||||
: d( new CalypFramePrivate )
|
: d{ std::make_unique<CalypFramePrivate>() }
|
||||||
{
|
{
|
||||||
const CalypPixelFormatDescriptor* pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( other.getPelFormat() ) );
|
const CalypPixelFormatDescriptor* pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( other.getPelFormat() ) );
|
||||||
if( pcPelFormat->log2ChromaWidth )
|
if( pcPelFormat->log2ChromaWidth )
|
||||||
@@ -313,7 +356,7 @@ CalypFrame::CalypFrame( const CalypFrame& other, unsigned int x, unsigned int y,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CalypFrame::CalypFrame( const CalypFrame* other, unsigned int posX, unsigned int posY, unsigned int areaWidth, unsigned int areaHeight )
|
CalypFrame::CalypFrame( const CalypFrame* other, unsigned int posX, unsigned int posY, unsigned int areaWidth, unsigned int areaHeight )
|
||||||
: d( new CalypFramePrivate )
|
: d{ std::make_unique<CalypFramePrivate>() }
|
||||||
{
|
{
|
||||||
if( !other )
|
if( !other )
|
||||||
return;
|
return;
|
||||||
@@ -340,10 +383,7 @@ CalypFrame::CalypFrame( const CalypFrame* other, unsigned int posX, unsigned int
|
|||||||
copyFrom( other, posX, posY );
|
copyFrom( other, posX, posY );
|
||||||
}
|
}
|
||||||
|
|
||||||
CalypFrame::~CalypFrame()
|
CalypFrame::~CalypFrame() = default;
|
||||||
{
|
|
||||||
delete d;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CalypFrame::haveSameFmt( const CalypFrame& other, unsigned int match ) const
|
bool CalypFrame::haveSameFmt( const CalypFrame& other, unsigned int match ) const
|
||||||
{
|
{
|
||||||
@@ -378,7 +418,7 @@ int CalypFrame::getPelFormat() const
|
|||||||
return d->m_iPixelFormat;
|
return d->m_iPixelFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClpString CalypFrame::getPelFmtName()
|
std::string CalypFrame::getPelFmtName()
|
||||||
{
|
{
|
||||||
return d->m_pcPelFormat->name;
|
return d->m_pcPelFormat->name;
|
||||||
}
|
}
|
||||||
@@ -407,14 +447,14 @@ bool CalypFrame::getHasNegativeValues() const
|
|||||||
return d->m_bHasNegativeValues;
|
return d->m_bHasNegativeValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClpULong CalypFrame::getPixels( unsigned channel ) const
|
std::uint64_t CalypFrame::getPixels( unsigned channel ) const
|
||||||
{
|
{
|
||||||
return getWidth( channel ) * getHeight( channel );
|
return getWidth( channel ) * getHeight( channel );
|
||||||
}
|
}
|
||||||
|
|
||||||
ClpULong CalypFrame::getTotalNumberOfPixels() const
|
std::uint64_t CalypFrame::getTotalNumberOfPixels() const
|
||||||
{
|
{
|
||||||
ClpULong numberPixels = 0;
|
std::uint64_t numberPixels = 0;
|
||||||
for( unsigned i = 0; i < getNumberChannels(); i++ )
|
for( unsigned i = 0; i < getNumberChannels(); i++ )
|
||||||
{
|
{
|
||||||
numberPixels += getPixels( i );
|
numberPixels += getPixels( i );
|
||||||
@@ -432,7 +472,7 @@ unsigned CalypFrame::getChromaHeightRatio() const
|
|||||||
return d->m_pcPelFormat->log2ChromaHeight;
|
return d->m_pcPelFormat->log2ChromaHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClpULong CalypFrame::getChromaLength() const
|
std::uint64_t CalypFrame::getChromaLength() const
|
||||||
{
|
{
|
||||||
return getWidth( 1 ) * getHeight( 1 );
|
return getWidth( 1 ) * getHeight( 1 );
|
||||||
}
|
}
|
||||||
@@ -442,19 +482,19 @@ unsigned int CalypFrame::getBitsPel() const
|
|||||||
return d->m_uiBitsPel;
|
return d->m_uiBitsPel;
|
||||||
}
|
}
|
||||||
|
|
||||||
ClpULong CalypFrame::getBytesPerFrame() const
|
std::uint64_t 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 );
|
||||||
}
|
}
|
||||||
|
|
||||||
ClpULong CalypFrame::getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel )
|
std::uint64_t CalypFrame::getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel )
|
||||||
{
|
{
|
||||||
const CalypPixelFormatDescriptor* pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( iPixelFormat ) );
|
const CalypPixelFormatDescriptor* pcPelFormat = &( g_CalypPixFmtDescriptorsMap.at( iPixelFormat ) );
|
||||||
unsigned int bytesPerPixel = ( bitsPixel - 1 ) / 8 + 1;
|
unsigned int bytesPerPixel = ( bitsPixel - 1 ) / 8 + 1;
|
||||||
ClpULong numberBytes = uiWidth * uiHeight;
|
std::uint64_t numberBytes = uiWidth * uiHeight;
|
||||||
if( pcPelFormat->numberChannels > 1 )
|
if( pcPelFormat->numberChannels > 1 )
|
||||||
{
|
{
|
||||||
ClpULong numberBytesChroma =
|
std::uint64_t 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;
|
||||||
}
|
}
|
||||||
@@ -491,11 +531,11 @@ ClpPel*** CalypFrame::getPelBufferYUV()
|
|||||||
return d->m_pppcInputPel;
|
return d->m_pppcInputPel;
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned char* CalypFrame::getRGBBuffer() const
|
auto CalypFrame::getRGBBuffer() const -> const unsigned char*
|
||||||
{
|
{
|
||||||
if( d->m_bHasRGBPel )
|
if( d->m_bHasRGBPel )
|
||||||
{
|
{
|
||||||
return d->m_pcARGB32;
|
return d->m_pcARGB32.data();
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@@ -507,7 +547,7 @@ ClpPel CalypFrame::operator()( unsigned int ch, unsigned int xPos, unsigned int
|
|||||||
{
|
{
|
||||||
retValue = d->m_pppcInputPel[ch][yPos][xPos];
|
retValue = d->m_pppcInputPel[ch][yPos][xPos];
|
||||||
if( !absolute && d->m_bHasNegativeValues )
|
if( !absolute && d->m_bHasNegativeValues )
|
||||||
retValue = retValue - int(d->m_uiHalfPelValue);
|
retValue = retValue - int( d->m_uiHalfPelValue );
|
||||||
}
|
}
|
||||||
return ClpPel( retValue );
|
return ClpPel( retValue );
|
||||||
}
|
}
|
||||||
@@ -529,7 +569,7 @@ CalypPixel CalypFrame::getPixel( unsigned int xPos, unsigned int yPos ) const
|
|||||||
return PixelValue;
|
return PixelValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CalypPixel CalypFrame::getPixel( unsigned int xPos, unsigned int yPos, CalypColorSpace eColorSpace )
|
CalypPixel CalypFrame::getPixel( unsigned int xPos, unsigned int yPos, CalypColorSpace eColorSpace ) const
|
||||||
{
|
{
|
||||||
return getPixel( xPos, yPos ).convertPixel( eColorSpace );
|
return getPixel( xPos, yPos ).convertPixel( eColorSpace );
|
||||||
}
|
}
|
||||||
@@ -587,7 +627,7 @@ void CalypFrame::copyFrom( const CalypFrame* other, unsigned x, unsigned y )
|
|||||||
copyFrom( *other, x, y );
|
copyFrom( *other, x, y );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypFrame::copyTo( const CalypFrame& other, unsigned x, unsigned y )
|
void CalypFrame::copyTo( const CalypFrame& other, unsigned x, unsigned y ) const
|
||||||
{
|
{
|
||||||
if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_PEL_FMT | MATCH_BITS ) )
|
if( !haveSameFmt( other, MATCH_COLOR_SPACE | MATCH_PEL_FMT | MATCH_BITS ) )
|
||||||
return;
|
return;
|
||||||
@@ -608,13 +648,13 @@ void CalypFrame::copyTo( const CalypFrame& other, unsigned x, unsigned y )
|
|||||||
d->m_bHasHistogram = false;
|
d->m_bHasHistogram = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypFrame::copyTo( const CalypFrame* other, unsigned x, unsigned y )
|
void CalypFrame::copyTo( const CalypFrame* other, unsigned x, unsigned y ) const
|
||||||
{
|
{
|
||||||
if( other )
|
if( other )
|
||||||
copyTo( *other, x, y );
|
copyTo( *other, x, y );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness, unsigned long uiBuffSize )
|
void CalypFrame::frameFromBuffer( const std::vector<ClpByte>& Buff, int iEndianness, unsigned long uiBuffSize )
|
||||||
{
|
{
|
||||||
if( uiBuffSize != getBytesPerFrame() )
|
if( uiBuffSize != getBytesPerFrame() )
|
||||||
return;
|
return;
|
||||||
@@ -622,19 +662,14 @@ void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness, unsigned long
|
|||||||
frameFromBuffer( Buff, iEndianness );
|
frameFromBuffer( Buff, iEndianness );
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness )
|
void CalypFrame::frameFromBuffer( const std::vector<ClpByte>& Buff, int iEndianness )
|
||||||
{
|
{
|
||||||
ClpByte* ppBuff[MAX_NUMBER_PLANES];
|
const ClpByte* ppBuff[MAX_NUMBER_PLANES];
|
||||||
ClpByte* pTmpBuff;
|
|
||||||
ClpPel* pPel;
|
|
||||||
unsigned int bytesPixel = ( d->m_uiBitsPel - 1 ) / 8 + 1;
|
unsigned int bytesPixel = ( d->m_uiBitsPel - 1 ) / 8 + 1;
|
||||||
int ratioH, ratioW, step;
|
|
||||||
unsigned int i, ch;
|
|
||||||
int startByte = 0;
|
int startByte = 0;
|
||||||
int endByte = bytesPixel;
|
int endByte = bytesPixel;
|
||||||
int incByte = 1;
|
int incByte = 1;
|
||||||
int b;
|
int maxval = ( 1 << d->m_uiBitsPel ) - 1;
|
||||||
int maxval = pow( 2, d->m_uiBitsPel ) - 1;
|
|
||||||
|
|
||||||
if( iEndianness == CLP_BIG_ENDIAN )
|
if( iEndianness == CLP_BIG_ENDIAN )
|
||||||
{
|
{
|
||||||
@@ -643,37 +678,36 @@ void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness )
|
|||||||
incByte = -1;
|
incByte = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ppBuff[0] = Buff;
|
ppBuff[0] = Buff.data();
|
||||||
for( i = 1; i < MAX_NUMBER_PLANES; i++ )
|
for( unsigned i = 1; i < MAX_NUMBER_PLANES; i++ )
|
||||||
{
|
{
|
||||||
ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
int ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
||||||
ratioH = i > 1 ? d->m_pcPelFormat->log2ChromaHeight : 0;
|
int ratioH = i > 1 ? d->m_pcPelFormat->log2ChromaHeight : 0;
|
||||||
ppBuff[i] = ppBuff[i - 1] + CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel;
|
ppBuff[i] = ppBuff[i - 1] + CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ) * bytesPixel;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
|
memset( d->m_pppcInputPel[0][0], 0, getTotalNumberOfPixels() * sizeof( ClpPel ) );
|
||||||
|
|
||||||
|
for( unsigned ch = 0; ch < d->m_pcPelFormat->numberChannels; ch++ )
|
||||||
{
|
{
|
||||||
ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
int ratioW = ch > 0 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
||||||
ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
|
int ratioH = ch > 0 ? d->m_pcPelFormat->log2ChromaHeight : 0;
|
||||||
step = ( d->m_pcPelFormat->comp[ch].step_minus1 ) * bytesPixel;
|
int step = ( d->m_pcPelFormat->comp[ch].step_minus1 ) * bytesPixel;
|
||||||
|
|
||||||
pPel = d->m_pppcInputPel[ch][0];
|
ClpPel* pPel = d->m_pppcInputPel[ch][0];
|
||||||
pTmpBuff = ppBuff[d->m_pcPelFormat->comp[ch].plane] + ( d->m_pcPelFormat->comp[ch].offset_plus1 - 1 ) * bytesPixel;
|
const ClpByte* 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( unsigned p = 0; p < CHROMASHIFT( d->m_uiHeight, ratioH ) * CHROMASHIFT( d->m_uiWidth, ratioW ); p++ )
|
||||||
{
|
{
|
||||||
*pPel = 0;
|
for( int b = startByte; b != endByte; b += incByte )
|
||||||
for( b = startByte; b != endByte; b += incByte )
|
|
||||||
{
|
{
|
||||||
*pPel += *pTmpBuff << ( b * 8 );
|
pPel[p] += *pTmpBuff << ( b * 8 );
|
||||||
pTmpBuff++;
|
pTmpBuff++;
|
||||||
// Check max value and bound it to "maxval" to prevent segfault when
|
|
||||||
// calculating histogram
|
|
||||||
if( *pPel > maxval )
|
|
||||||
*pPel = 0;
|
|
||||||
// -----
|
|
||||||
}
|
}
|
||||||
pPel++;
|
// Check max value and bound it to "maxval" to prevent segfault when
|
||||||
|
// calculating histogram
|
||||||
|
if( pPel[p] > maxval )
|
||||||
|
pPel[p] = 0;
|
||||||
pTmpBuff += step;
|
pTmpBuff += step;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -681,7 +715,7 @@ void CalypFrame::frameFromBuffer( ClpByte* Buff, int iEndianness )
|
|||||||
d->m_bHasHistogram = false;
|
d->m_bHasHistogram = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypFrame::frameToBuffer( ClpByte* output_buffer, int iEndianness )
|
void CalypFrame::frameToBuffer( std::vector<ClpByte>& output_buffer, int iEndianness ) const
|
||||||
{
|
{
|
||||||
unsigned int bytesPixel = ( d->m_uiBitsPel - 1 ) / 8 + 1;
|
unsigned int bytesPixel = ( d->m_uiBitsPel - 1 ) / 8 + 1;
|
||||||
ClpByte* ppBuff[MAX_NUMBER_PLANES];
|
ClpByte* ppBuff[MAX_NUMBER_PLANES];
|
||||||
@@ -701,7 +735,7 @@ void CalypFrame::frameToBuffer( ClpByte* output_buffer, int iEndianness )
|
|||||||
incByte = -1;
|
incByte = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
ppBuff[0] = output_buffer;
|
ppBuff[0] = output_buffer.data();
|
||||||
for( int i = 1; i < MAX_NUMBER_PLANES; i++ )
|
for( int i = 1; i < MAX_NUMBER_PLANES; i++ )
|
||||||
{
|
{
|
||||||
ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
ratioW = i > 1 ? d->m_pcPelFormat->log2ChromaWidth : 0;
|
||||||
@@ -731,11 +765,10 @@ void CalypFrame::frameToBuffer( ClpByte* output_buffer, int iEndianness )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypFrame::fillRGBBuffer()
|
|
||||||
{
|
|
||||||
#define PEL_ARGB( a, r, g, b ) ( ( a & 0xff ) << 24 ) | ( ( r & 0xff ) << 16 ) | ( ( g & 0xff ) << 8 ) | ( b & 0xff )
|
#define PEL_ARGB( a, r, g, b ) ( ( a & 0xff ) << 24 ) | ( ( r & 0xff ) << 16 ) | ( ( g & 0xff ) << 8 ) | ( b & 0xff )
|
||||||
#define PEL_RGB( r, g, b ) PEL_ARGB( 0xffu, r, g, b )
|
#define PEL_RGB( r, g, b ) PEL_ARGB( 0xffu, r, g, b )
|
||||||
#define CLAMP_YUV2RGB( X ) X = X < 0 ? 0 : X > 255 ? 255 : X;
|
#define CLAMP_YUV2RGB( X ) X = X < 0 ? 0 : X > 255 ? 255 : \
|
||||||
|
X;
|
||||||
#define YUV2RGB( iY, iU, iV, iR, iG, iB ) \
|
#define YUV2RGB( iY, iU, iV, iR, iG, iB ) \
|
||||||
iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 ); \
|
iR = iY + ( ( 1436 * ( iV - 128 ) ) >> 10 ); \
|
||||||
iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 ); \
|
iG = iY - ( ( 352 * ( iU - 128 ) + 731 * ( iV - 128 ) ) >> 10 ); \
|
||||||
@@ -744,16 +777,51 @@ void CalypFrame::fillRGBBuffer()
|
|||||||
CLAMP_YUV2RGB( iG ) \
|
CLAMP_YUV2RGB( iG ) \
|
||||||
CLAMP_YUV2RGB( iB )
|
CLAMP_YUV2RGB( iB )
|
||||||
|
|
||||||
|
void fillRGBBufferYUV420p( ClpPel*** pppInputPel, uint32_t* pARGB, unsigned uiWidth, unsigned uiHeight, int shiftBits )
|
||||||
|
{
|
||||||
|
ClpPel* pY = pppInputPel[CLP_LUMA][0];
|
||||||
|
ClpPel* pU = pppInputPel[CLP_CHROMA_U][0];
|
||||||
|
ClpPel* pV = pppInputPel[CLP_CHROMA_V][0];
|
||||||
|
|
||||||
|
for( unsigned y = 0; y < uiHeight; y += 2 )
|
||||||
|
{
|
||||||
|
for( unsigned x = 0; x < uiWidth; x += 2 )
|
||||||
|
{
|
||||||
|
int iY, iU, iV, iR, iG, iB;
|
||||||
|
iY = pY[y * uiWidth + x] >> shiftBits;
|
||||||
|
iU = pU[y * uiWidth / 4 + x / 2] >> shiftBits;
|
||||||
|
iV = pV[y * uiWidth / 4 + x / 2] >> shiftBits;
|
||||||
|
YUV2RGB( iY, iU, iV, iR, iG, iB );
|
||||||
|
pARGB[y * uiWidth + x] = PEL_RGB( iR, iG, iB );
|
||||||
|
|
||||||
|
iY = pY[y * uiWidth + x + 1] >> shiftBits;
|
||||||
|
YUV2RGB( iY, iU, iV, iR, iG, iB );
|
||||||
|
pARGB[y * uiWidth + x + 1] = PEL_RGB( iR, iG, iB );
|
||||||
|
|
||||||
|
iY = pY[y * uiWidth + uiWidth + x] >> shiftBits;
|
||||||
|
YUV2RGB( iY, iU, iV, iR, iG, iB );
|
||||||
|
pARGB[y * uiWidth + uiWidth + x] = PEL_RGB( iR, iG, iB );
|
||||||
|
|
||||||
|
iY = pY[y * uiWidth + uiWidth + x + 1] >> shiftBits;
|
||||||
|
YUV2RGB( iY, iU, iV, iR, iG, iB );
|
||||||
|
pARGB[y * uiWidth + uiWidth + x + 1] = PEL_RGB( iR, iG, iB );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalypFrame::fillRGBBuffer() const
|
||||||
|
{
|
||||||
if( d->m_bHasRGBPel )
|
if( d->m_bHasRGBPel )
|
||||||
return;
|
return;
|
||||||
int shiftBits = d->m_uiBitsPel - 8;
|
int shiftBits = d->m_uiBitsPel - 8;
|
||||||
|
|
||||||
|
d->m_bHasRGBPel = true;
|
||||||
// 4 bytes for A, R, G and B
|
// 4 bytes for A, R, G and B
|
||||||
uint32_t* pARGB = (uint32_t*)d->m_pcARGB32;
|
uint32_t* pARGB = (uint32_t*)d->m_pcARGB32.data();
|
||||||
if( d->m_pcPelFormat->colorSpace == CLP_COLOR_GRAY )
|
if( d->m_pcPelFormat->colorSpace == CLP_COLOR_GRAY )
|
||||||
{
|
{
|
||||||
ClpPel* pY = d->m_pppcInputPel[CLP_LUMA][0];
|
ClpPel* pY = d->m_pppcInputPel[CLP_LUMA][0];
|
||||||
unsigned char finalPel;
|
unsigned char finalPel{ 0 };
|
||||||
for( unsigned int i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ )
|
for( unsigned int i = 0; i < d->m_uiHeight * d->m_uiWidth; i++ )
|
||||||
{
|
{
|
||||||
finalPel = ( *pY++ ) >> shiftBits;
|
finalPel = ( *pY++ ) >> shiftBits;
|
||||||
@@ -779,36 +847,37 @@ void CalypFrame::fillRGBBuffer()
|
|||||||
}
|
}
|
||||||
else if( d->m_pcPelFormat->colorSpace == CLP_COLOR_YUV )
|
else if( d->m_pcPelFormat->colorSpace == CLP_COLOR_YUV )
|
||||||
{
|
{
|
||||||
|
if( d->m_iPixelFormat == CLP_YUV420P )
|
||||||
|
{
|
||||||
|
fillRGBBufferYUV420p( d->m_pppcInputPel, pARGB, d->m_uiWidth, d->m_uiHeight, shiftBits );
|
||||||
|
return;
|
||||||
|
}
|
||||||
ClpPel* pLineY = d->m_pppcInputPel[CLP_LUMA][0];
|
ClpPel* pLineY = d->m_pppcInputPel[CLP_LUMA][0];
|
||||||
ClpPel* pLineU = d->m_pppcInputPel[CLP_CHROMA_U][0];
|
ClpPel* pLineU = d->m_pppcInputPel[CLP_CHROMA_U][0];
|
||||||
ClpPel* pLineV = d->m_pppcInputPel[CLP_CHROMA_V][0];
|
ClpPel* pLineV = d->m_pppcInputPel[CLP_CHROMA_V][0];
|
||||||
unsigned int uiChromaStride = CHROMASHIFT( d->m_uiWidth, d->m_pcPelFormat->log2ChromaWidth );
|
unsigned int uiChromaStride = CHROMASHIFT( d->m_uiWidth, d->m_pcPelFormat->log2ChromaWidth );
|
||||||
ClpPel* pY;
|
|
||||||
ClpPel* pU;
|
int iR, iG, iB;
|
||||||
ClpPel* pV;
|
|
||||||
int iY, iU, iV, iR, iG, iB;
|
|
||||||
uint32_t* pARGBLine = pARGB;
|
uint32_t* pARGBLine = pARGB;
|
||||||
uint32_t* pARGBAux;
|
uint32_t* pARGBAux;
|
||||||
|
|
||||||
unsigned int y, x;
|
for( unsigned y = 0; y < CHROMASHIFT( d->m_uiHeight, d->m_pcPelFormat->log2ChromaHeight ); y++ )
|
||||||
int i, j;
|
|
||||||
for( y = 0; y < CHROMASHIFT( d->m_uiHeight, d->m_pcPelFormat->log2ChromaHeight ); y++ )
|
|
||||||
{
|
{
|
||||||
for( i = 0; i < 1 << d->m_pcPelFormat->log2ChromaHeight; i++ )
|
for( int i = 0; i < 1 << d->m_pcPelFormat->log2ChromaHeight; i++ )
|
||||||
{
|
{
|
||||||
pY = pLineY;
|
ClpPel* pY = pLineY;
|
||||||
pU = pLineU;
|
ClpPel* pU = pLineU;
|
||||||
pV = pLineV;
|
ClpPel* pV = pLineV;
|
||||||
pARGBAux = pARGBLine;
|
pARGBAux = pARGBLine;
|
||||||
for( x = 0; x < CHROMASHIFT( d->m_uiWidth, d->m_pcPelFormat->log2ChromaWidth ); x++ )
|
for( unsigned x = 0; x < CHROMASHIFT( d->m_uiWidth, d->m_pcPelFormat->log2ChromaWidth ); x++ )
|
||||||
{
|
{
|
||||||
iU = *pU++;
|
int iU = *pU++;
|
||||||
iU >>= shiftBits;
|
iU >>= shiftBits;
|
||||||
iV = *pV++;
|
int iV = *pV++;
|
||||||
iV >>= shiftBits;
|
iV >>= shiftBits;
|
||||||
for( j = 0; j < ( 1 << d->m_pcPelFormat->log2ChromaWidth ); j++ )
|
for( int j = 0; j < ( 1 << d->m_pcPelFormat->log2ChromaWidth ); j++ )
|
||||||
{
|
{
|
||||||
iY = *pY++;
|
int iY = *pY++;
|
||||||
iY >>= shiftBits;
|
iY >>= shiftBits;
|
||||||
YUV2RGB( iY, iU, iV, iR, iG, iB );
|
YUV2RGB( iY, iU, iV, iR, iG, iB );
|
||||||
*pARGBAux++ = PEL_RGB( iR, iG, iB );
|
*pARGBAux++ = PEL_RGB( iR, iG, iB );
|
||||||
@@ -821,7 +890,6 @@ void CalypFrame::fillRGBBuffer()
|
|||||||
pLineV += uiChromaStride;
|
pLineV += uiChromaStride;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
d->m_bHasRGBPel = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -830,12 +898,12 @@ void CalypFrame::fillRGBBuffer()
|
|||||||
|
|
||||||
void CalypFrame::calcHistogram()
|
void CalypFrame::calcHistogram()
|
||||||
{
|
{
|
||||||
if( d->m_bHasHistogram || !d->m_puiHistogram )
|
if( d->m_bHasHistogram || d->m_puiHistogram.empty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d->m_bHistogramRunning = true;
|
d->m_bHistogramRunning = true;
|
||||||
|
|
||||||
xMemSet( unsigned int, d->m_uiHistoSegments * d->m_uiHistoChannels, d->m_puiHistogram );
|
std::fill( d->m_puiHistogram.begin(), d->m_puiHistogram.end(), 0 );
|
||||||
|
|
||||||
unsigned int numberChannels = d->m_pcPelFormat->numberChannels;
|
unsigned int numberChannels = d->m_pcPelFormat->numberChannels;
|
||||||
for( unsigned int ch = 0; ch < numberChannels; ch++ )
|
for( unsigned int ch = 0; ch < numberChannels; ch++ )
|
||||||
@@ -1132,13 +1200,39 @@ double CalypFrame::getHistogramValue( unsigned channel, unsigned int bin )
|
|||||||
return d->m_puiHistogram[indexStart + bin];
|
return d->m_puiHistogram[indexStart + bin];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
double CalypFrame::getEntropy( unsigned channel, unsigned int start, unsigned int end )
|
||||||
|
{
|
||||||
|
if( !d->m_bHasHistogram )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
channel = d->getRealHistogramChannel( channel );
|
||||||
|
if( channel < 0 )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
int indexStart = channel * d->m_uiHistoSegments;
|
||||||
|
double numValues = getNumPixelsRange( channel, start, end );
|
||||||
|
double entropy = 0.0;
|
||||||
|
|
||||||
|
for( unsigned b = start; b <= end; b++ )
|
||||||
|
{
|
||||||
|
if( d->m_puiHistogram[indexStart + b] == 0 )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
double prob = d->m_puiHistogram[indexStart + b] / numValues;
|
||||||
|
|
||||||
|
entropy -= prob * log2( prob );
|
||||||
|
}
|
||||||
|
|
||||||
|
return entropy;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
**************************************************************
|
**************************************************************
|
||||||
* interface to other libs
|
* interface to other libs
|
||||||
**************************************************************
|
**************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray, bool scale, unsigned channel )
|
bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray, bool scale, unsigned channel ) const
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
#ifdef USE_OPENCV
|
#ifdef USE_OPENCV
|
||||||
@@ -1168,12 +1262,12 @@ bool CalypFrame::toMat( cv::Mat& cvMat, bool convertToGray, bool scale, unsigned
|
|||||||
cv::Mat tmpMat( imgHeight, imgWidth, CV_MAKETYPE( cvPrecision, numChannels ) );
|
cv::Mat tmpMat( imgHeight, imgWidth, CV_MAKETYPE( cvPrecision, numChannels ) );
|
||||||
|
|
||||||
unsigned char* cv_data = tmpMat.data;
|
unsigned char* cv_data = tmpMat.data;
|
||||||
CalypPixel currPel;
|
|
||||||
for( unsigned y = 0; y < imgHeight; y++ )
|
for( unsigned y = 0; y < imgHeight; y++ )
|
||||||
{
|
{
|
||||||
for( unsigned x = 0; x < imgWidth; x++ )
|
for( unsigned x = 0; x < imgWidth; x++ )
|
||||||
{
|
{
|
||||||
currPel = getPixel( x, y ) * scaleFactor;
|
CalypPixel currPel = getPixel( x, y );
|
||||||
|
currPel *= scaleFactor;
|
||||||
for( unsigned int ch = 0; ch < numChannels; ch++ )
|
for( unsigned int ch = 0; ch < numChannels; ch++ )
|
||||||
for( unsigned b = 0; b < numBytes; b++ )
|
for( unsigned b = 0; b < numBytes; b++ )
|
||||||
{
|
{
|
||||||
@@ -1306,9 +1400,9 @@ bool CalypFrame::fromMat( cv::Mat& cvMat, int channel )
|
|||||||
**************************************************************
|
**************************************************************
|
||||||
*/
|
*/
|
||||||
|
|
||||||
std::vector<ClpString> CalypFrame::supportedQualityMetricsList()
|
std::vector<std::string> CalypFrame::supportedQualityMetricsList()
|
||||||
{
|
{
|
||||||
return std::vector<ClpString>{
|
return std::vector<std::string>{
|
||||||
"PSNR",
|
"PSNR",
|
||||||
"MSE",
|
"MSE",
|
||||||
"SSIM",
|
"SSIM",
|
||||||
@@ -1316,9 +1410,9 @@ std::vector<ClpString> CalypFrame::supportedQualityMetricsList()
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<ClpString> CalypFrame::supportedQualityMetricsUnitsList()
|
std::vector<std::string> CalypFrame::supportedQualityMetricsUnitsList()
|
||||||
{
|
{
|
||||||
return std::vector<ClpString>{
|
return std::vector<std::string>{
|
||||||
"dB",
|
"dB",
|
||||||
"",
|
"",
|
||||||
"",
|
"",
|
||||||
@@ -1356,8 +1450,8 @@ 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 );
|
std::uint64_t numberOfPixels = Org->getHeight( component ) * Org->getWidth( component );
|
||||||
ClpULong ssd = 0;
|
std::uint64_t ssd = 0;
|
||||||
for( unsigned int i = 0; i < numberOfPixels; i++ )
|
for( unsigned int i = 0; i < numberOfPixels; i++ )
|
||||||
{
|
{
|
||||||
int diff = int( *pPelYUV++ ) - int( *pOrgPelYUV++ );
|
int diff = int( *pPelYUV++ ) - int( *pOrgPelYUV++ );
|
||||||
@@ -1372,7 +1466,7 @@ double CalypFrame::getMSE( CalypFrame* Org, unsigned int component )
|
|||||||
|
|
||||||
double CalypFrame::getPSNR( CalypFrame* Org, unsigned int component )
|
double CalypFrame::getPSNR( CalypFrame* Org, unsigned int component )
|
||||||
{
|
{
|
||||||
ClpULong uiMaxValue = ( 1 << Org->getBitsPel() ) - 1;
|
std::uint64_t uiMaxValue = ( 1 << Org->getBitsPel() ) - 1;
|
||||||
double dPSNR = 100;
|
double dPSNR = 100;
|
||||||
double dMSE = getMSE( Org, component );
|
double dMSE = getMSE( Org, component );
|
||||||
if( dMSE != 0 )
|
if( dMSE != 0 )
|
||||||
|
|||||||
+181
-44
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 by Joao Carreira (jfmcarreira@gmail.com)
|
||||||
* Luis Lucas (luisfrlucas@gmail.com)
|
* Luis Lucas (luisfrlucas@gmail.com)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@@ -26,13 +26,78 @@
|
|||||||
#ifndef __CALYPFRAME_H__
|
#ifndef __CALYPFRAME_H__
|
||||||
#define __CALYPFRAME_H__
|
#define __CALYPFRAME_H__
|
||||||
|
|
||||||
#include "CalypDefs.h"
|
#include <cstdint>
|
||||||
|
#include <memory>
|
||||||
|
#include <span>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
class Mat;
|
class Mat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using ClpPel = std::uint16_t;
|
||||||
|
using ClpByte = std::uint8_t;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \enum CalypColorSpace
|
||||||
|
* \brief List of supported color spaces
|
||||||
|
* \ingroup CalypLibGrp
|
||||||
|
*/
|
||||||
|
enum CalypColorSpace
|
||||||
|
{
|
||||||
|
CLP_COLOR_INVALID = -1, //!< Invalid
|
||||||
|
CLP_COLOR_YUV = 0, //!< YUV
|
||||||
|
CLP_COLOR_RGB = 1, //!< RGB
|
||||||
|
CLP_COLOR_GRAY = 2, //!< Grayscale
|
||||||
|
CLP_COLOR_RGBA = 3, //!< RGB + Alpha
|
||||||
|
CLP_COLOR_MAX = 255, //!< Account for future formats
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \enum CalypPixelFormats
|
||||||
|
* \brief List of supported pixel formats
|
||||||
|
* \ingroup CalypLibGrp
|
||||||
|
*/
|
||||||
|
enum CalypPixelFormats
|
||||||
|
{
|
||||||
|
CLP_INVALID_FMT = -1, //!< Invalid
|
||||||
|
CLP_YUV420P = 0, //!< YUV 420 progressive
|
||||||
|
CLP_YUV422P, //!< YUV 422 progressive
|
||||||
|
CLP_YUV444P, //!< YUV 444 progressive
|
||||||
|
CLP_YUYV422, //!< YUV 422 interleaved
|
||||||
|
CLP_GRAY, //!< Grayscale
|
||||||
|
CLP_RGB24P, //!< RGB 32 bpp progressive
|
||||||
|
CLP_RGB24, //!< RGB 32 bpp
|
||||||
|
CLP_BGR24, //!< BGR 32 bpp
|
||||||
|
CLP_RGBA32, //!< RGBA 32 bpp
|
||||||
|
CLP_BGRA32, //!< BGRA 32 bpp
|
||||||
|
CLP_MAX_FMT = 255, //!< Account for future formats
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CLP_YUV_Components
|
||||||
|
{
|
||||||
|
CLP_LUMA = 0,
|
||||||
|
CLP_CHROMA_U,
|
||||||
|
CLP_CHROMA_V,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CLP_RGB_Components
|
||||||
|
{
|
||||||
|
CLP_COLOR_R = 0,
|
||||||
|
CLP_COLOR_G,
|
||||||
|
CLP_COLOR_B,
|
||||||
|
CLP_COLOR_A,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CLP_Endianness
|
||||||
|
{
|
||||||
|
CLP_INVALID_ENDIANESS = -1,
|
||||||
|
CLP_BIG_ENDIAN = 0,
|
||||||
|
CLP_LITTLE_ENDIAN = 1,
|
||||||
|
};
|
||||||
|
|
||||||
#define CHROMASHIFT( SIZE, SHIFT ) (unsigned int)( -( ( -( (int)( SIZE ) ) ) >> ( SHIFT ) ) )
|
#define CHROMASHIFT( SIZE, SHIFT ) (unsigned int)( -( ( -( (int)( SIZE ) ) ) >> ( SHIFT ) ) )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,27 +107,39 @@ class Mat;
|
|||||||
*/
|
*/
|
||||||
class CalypPixel
|
class CalypPixel
|
||||||
{
|
{
|
||||||
|
private:
|
||||||
|
static constexpr std::size_t kMaxNumberOfComponents{ 4 };
|
||||||
|
int m_colorSpace{ CLP_COLOR_INVALID };
|
||||||
|
std::array<ClpPel, kMaxNumberOfComponents> m_pelComp{ 0, 0, 0, 0 };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int getMaxNumberOfComponents();
|
static std::size_t getMaxNumberOfComponents() { return kMaxNumberOfComponents; }
|
||||||
|
|
||||||
CalypPixel( const int& CalypColorSpace = CLP_COLOR_INVALID );
|
CalypPixel() = default;
|
||||||
CalypPixel( const int& CalypColorSpace, const ClpPel& c0 );
|
CalypPixel( const int CalypColorSpace, const ClpPel c0 = 0 );
|
||||||
CalypPixel( const int& CalypColorSpace, const ClpPel& c0, const ClpPel& c1, const ClpPel& c2 );
|
CalypPixel( const int CalypColorSpace, const ClpPel c0, const ClpPel c1, const ClpPel c2 );
|
||||||
CalypPixel( const int& CalypColorSpace, const ClpPel& c0, const ClpPel& c1, const ClpPel& c2, const ClpPel& c3 );
|
CalypPixel( const int CalypColorSpace, const ClpPel c0, const ClpPel c1, const ClpPel c2, const ClpPel c3 );
|
||||||
CalypPixel( const CalypPixel& other );
|
CalypPixel( const CalypPixel& other ) noexcept = default;
|
||||||
~CalypPixel();
|
CalypPixel( CalypPixel&& other ) noexcept = default;
|
||||||
|
auto operator=( const CalypPixel& other ) -> CalypPixel& = default;
|
||||||
|
auto operator=( CalypPixel&& other ) noexcept -> CalypPixel& = default;
|
||||||
|
~CalypPixel() = default;
|
||||||
|
|
||||||
int colorSpace() const;
|
int colorSpace() const { return m_colorSpace; };
|
||||||
|
|
||||||
ClpPel operator[]( const int& channel ) const;
|
auto components() const -> const std::array<ClpPel, kMaxNumberOfComponents>& { return m_pelComp; };
|
||||||
ClpPel& operator[]( const int& channel );
|
auto components() -> std::array<ClpPel, kMaxNumberOfComponents>& { return m_pelComp; };
|
||||||
|
|
||||||
CalypPixel operator=( const CalypPixel& );
|
ClpPel operator[]( const int& channel ) const { return m_pelComp[channel]; }
|
||||||
CalypPixel operator+( const CalypPixel& );
|
ClpPel& operator[]( const int& channel ) { return m_pelComp[channel]; }
|
||||||
CalypPixel operator+=( const CalypPixel& );
|
|
||||||
CalypPixel operator-( const CalypPixel& );
|
CalypPixel& operator+=( const CalypPixel& );
|
||||||
CalypPixel operator-=( const CalypPixel& );
|
CalypPixel& operator-=( const CalypPixel& );
|
||||||
CalypPixel operator*( const double& );
|
CalypPixel& operator*=( const double& );
|
||||||
|
|
||||||
|
CalypPixel operator+( const CalypPixel& ) const;
|
||||||
|
CalypPixel operator-( const CalypPixel& ) const;
|
||||||
|
CalypPixel operator*( const double& ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a Pixel to a new color space
|
* Convert a Pixel to a new color space
|
||||||
@@ -70,10 +147,49 @@ public:
|
|||||||
* @param eOutputSpace output color space
|
* @param eOutputSpace output color space
|
||||||
* @return converted pixel
|
* @return converted pixel
|
||||||
*/
|
*/
|
||||||
CalypPixel convertPixel( CalypColorSpace eOutputSpace );
|
CalypPixel convertPixel( CalypColorSpace eOutputSpace ) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \class CalypPlane
|
||||||
|
* \ingroup CalypLibGrp CalypPlaneGrp
|
||||||
|
* \brief Frame handling class
|
||||||
|
*/
|
||||||
|
template <typename T>
|
||||||
|
class CalypPlane
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalypPlane() noexcept = default;
|
||||||
|
CalypPlane( std::size_t width, std::size_t height ) noexcept { resize( width, height ); }
|
||||||
|
|
||||||
|
~CalypPlane() noexcept = default;
|
||||||
|
CalypPlane( const CalypPlane& buffer ) noexcept = default;
|
||||||
|
CalypPlane( CalypPlane&& buffer ) noexcept = default;
|
||||||
|
auto operator=( const CalypPlane& buffer ) -> CalypPlane& = default;
|
||||||
|
auto operator=( CalypPlane&& buffer ) noexcept -> CalypPlane& = default;
|
||||||
|
|
||||||
|
auto operator[]( std::size_t row ) const& noexcept -> const std::span<T>& { return m_rows[row]; }
|
||||||
|
auto operator[]( std::size_t row ) & noexcept -> std::span<T>& { return m_rows[row]; }
|
||||||
|
|
||||||
|
auto operator[]( std::size_t row ) const&& noexcept { return m_rows[row]; }
|
||||||
|
auto operator[]( std::size_t row ) && noexcept { return m_rows[row]; }
|
||||||
|
|
||||||
|
auto data() noexcept { return std::span<T>( m_data ); }
|
||||||
|
auto data() const noexcept { return std::span<const T>( m_data ); }
|
||||||
|
|
||||||
|
void resize( std::size_t width, std::size_t height ) noexcept
|
||||||
|
{
|
||||||
|
m_data.resize( width * height );
|
||||||
|
m_rows.resize( height );
|
||||||
|
for( std::size_t y = 0; y < height; y++ )
|
||||||
|
{
|
||||||
|
m_rows[y] = std::span<T>( m_data ).subspan( y * width, width );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CalypPixelPrivate* d;
|
std::vector<T> m_data;
|
||||||
|
std::vector<std::span<T>> m_rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,17 +205,17 @@ public:
|
|||||||
* of CalypFrame
|
* of CalypFrame
|
||||||
* @return vector of strings with pixel formats names
|
* @return vector of strings with pixel formats names
|
||||||
*/
|
*/
|
||||||
static std::vector<ClpString> supportedColorSpacesListNames();
|
static std::vector<std::string> supportedColorSpacesListNames();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that handles the supported pixel formats
|
* Function that handles the supported pixel formats
|
||||||
* of CalypFrame
|
* of CalypFrame
|
||||||
* @return vector of strings with pixel formats names
|
* @return vector of strings with pixel formats names
|
||||||
*/
|
*/
|
||||||
static std::vector<ClpString> supportedPixelFormatListNames();
|
static std::vector<std::string> supportedPixelFormatListNames();
|
||||||
static std::vector<ClpString> supportedPixelFormatListNames( int colorSpace );
|
static std::vector<std::string> supportedPixelFormatListNames( int colorSpace );
|
||||||
static int numberOfFormats();
|
static int numberOfFormats();
|
||||||
static int findPixelFormat( const ClpString& name );
|
static int findPixelFormat( const std::string& name );
|
||||||
static int pelformatColorSpace( const int idx );
|
static int pelformatColorSpace( const int idx );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -124,13 +240,33 @@ public:
|
|||||||
*/
|
*/
|
||||||
CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel, bool has_negative_values );
|
CalypFrame( unsigned int width, unsigned int height, int pelFormat, unsigned bitsPixel, bool has_negative_values );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move contructor
|
||||||
|
*
|
||||||
|
* @param other existing frame to copy from
|
||||||
|
*/
|
||||||
|
CalypFrame( CalypFrame&& other ) noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Move assignement contructor
|
||||||
|
*
|
||||||
|
* @param other existing frame to copy from
|
||||||
|
*/
|
||||||
|
CalypFrame& operator=( CalypFrame&& other ) noexcept;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy contructor
|
* Copy contructor
|
||||||
*
|
*
|
||||||
* @param other existing frame to copy from
|
* @param other existing frame to copy from
|
||||||
*/
|
*/
|
||||||
CalypFrame( const CalypFrame& other );
|
CalypFrame( const CalypFrame& other );
|
||||||
CalypFrame( const CalypFrame* other );
|
|
||||||
|
/**
|
||||||
|
* Copy-assignement contructor
|
||||||
|
*
|
||||||
|
* @param other existing frame to copy from
|
||||||
|
*/
|
||||||
|
CalypFrame& operator=( const CalypFrame& other );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and new frame with the configuration of an existing one and copy
|
* Creates and new frame with the configuration of an existing one and copy
|
||||||
@@ -180,7 +316,7 @@ public:
|
|||||||
* Get pixel format information
|
* Get pixel format information
|
||||||
* @return pixel format name
|
* @return pixel format name
|
||||||
*/
|
*/
|
||||||
ClpString getPelFmtName();
|
std::string getPelFmtName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get color space information
|
* Get color space information
|
||||||
@@ -219,13 +355,13 @@ public:
|
|||||||
* @param channel/component
|
* @param channel/component
|
||||||
* @return number of pixels
|
* @return number of pixels
|
||||||
*/
|
*/
|
||||||
ClpULong getPixels( unsigned channel = 0 ) const;
|
std::uint64_t getPixels( unsigned channel = 0 ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the total number of pixels of the frame
|
* Get the total number of pixels of the frame
|
||||||
* @return number of pixels
|
* @return number of pixels
|
||||||
*/
|
*/
|
||||||
ClpULong getTotalNumberOfPixels() const;
|
std::uint64_t getTotalNumberOfPixels() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get chroma width ratio
|
* Get chroma width ratio
|
||||||
@@ -243,7 +379,7 @@ public:
|
|||||||
* Get number of pixels in each chroma channel
|
* Get number of pixels in each chroma channel
|
||||||
* @return number of pixels
|
* @return number of pixels
|
||||||
*/
|
*/
|
||||||
ClpULong getChromaLength() const;
|
std::uint64_t getChromaLength() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get number of bits per pixel
|
* Get number of bits per pixel
|
||||||
@@ -255,13 +391,13 @@ public:
|
|||||||
* Get number of bytes per frame of an existing frame
|
* Get number of bytes per frame of an existing frame
|
||||||
* @return number of bytes per frame
|
* @return number of bytes per frame
|
||||||
*/
|
*/
|
||||||
ClpULong getBytesPerFrame() const;
|
std::uint64_t 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 ClpULong getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel );
|
static std::uint64_t getBytesPerFrame( unsigned int uiWidth, unsigned int uiHeight, int iPixelFormat, unsigned int bitsPixel );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset frame pixels to zero
|
* Reset frame pixels to zero
|
||||||
@@ -271,7 +407,7 @@ public:
|
|||||||
ClpPel*** getPelBufferYUV() const;
|
ClpPel*** getPelBufferYUV() const;
|
||||||
ClpPel*** getPelBufferYUV();
|
ClpPel*** getPelBufferYUV();
|
||||||
|
|
||||||
unsigned char* getRGBBuffer() const;
|
auto getRGBBuffer() const -> const unsigned char*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get pixel value at coordinates
|
* Get pixel value at coordinates
|
||||||
@@ -299,7 +435,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
CalypPixel getPixel( unsigned int xPos, unsigned int yPos ) const;
|
CalypPixel getPixel( unsigned int xPos, unsigned int yPos ) const;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get pixel value at coordinates
|
* Get pixel value at coordinates
|
||||||
* in the desired color space
|
* in the desired color space
|
||||||
@@ -308,7 +443,7 @@ public:
|
|||||||
* @param eColorSpace desired color space
|
* @param eColorSpace desired color space
|
||||||
* @return pixel value
|
* @return pixel value
|
||||||
*/
|
*/
|
||||||
CalypPixel getPixel( unsigned int xPos, unsigned int yPos, CalypColorSpace eColorSpace );
|
CalypPixel getPixel( unsigned int xPos, unsigned int yPos, CalypColorSpace eColorSpace ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set pixel value at coordinates to a given value
|
* Set pixel value at coordinates to a given value
|
||||||
@@ -341,14 +476,14 @@ public:
|
|||||||
* @param x x position on the current frame
|
* @param x x position on the current frame
|
||||||
* @param y y 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 ) const;
|
||||||
void copyTo( const CalypFrame* other, unsigned x, unsigned y );
|
void copyTo( const CalypFrame* other, unsigned x, unsigned y ) const;
|
||||||
|
|
||||||
void frameFromBuffer( ClpByte*, int, unsigned long );
|
void frameFromBuffer( const std::vector<ClpByte>&, int, unsigned long );
|
||||||
void frameFromBuffer( ClpByte*, int );
|
void frameFromBuffer( const std::vector<ClpByte>&, int );
|
||||||
void frameToBuffer( ClpByte*, int );
|
void frameToBuffer( std::vector<ClpByte>&, int ) const;
|
||||||
|
|
||||||
void fillRGBBuffer();
|
void fillRGBBuffer() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Histogram
|
* Histogram
|
||||||
@@ -382,11 +517,12 @@ public:
|
|||||||
double getHistogramValue( unsigned channel, unsigned int bin );
|
double getHistogramValue( unsigned channel, unsigned int bin );
|
||||||
unsigned int getNEBins( unsigned channel );
|
unsigned int getNEBins( unsigned channel );
|
||||||
int getNumHistogramSegment();
|
int getNumHistogramSegment();
|
||||||
|
double getEntropy( unsigned channel, unsigned int start, unsigned int end );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* interface with OpenCV lib
|
* interface with OpenCV lib
|
||||||
*/
|
*/
|
||||||
bool toMat( cv::Mat& cvMat, bool convertToGray = false, bool scale = true, unsigned channel = 0 );
|
bool toMat( cv::Mat& cvMat, bool convertToGray = false, bool scale = true, unsigned channel = 0 ) const;
|
||||||
bool fromMat( cv::Mat& cvMat, int iChannel = -1 );
|
bool fromMat( cv::Mat& cvMat, int iChannel = -1 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -407,8 +543,8 @@ public:
|
|||||||
NUMBER_METRICS,
|
NUMBER_METRICS,
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::vector<ClpString> supportedQualityMetricsList();
|
static std::vector<std::string> supportedQualityMetricsList();
|
||||||
static std::vector<ClpString> supportedQualityMetricsUnitsList();
|
static std::vector<std::string> 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 );
|
||||||
@@ -417,7 +553,8 @@ public:
|
|||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct CalypFramePrivate* d;
|
class CalypFramePrivate;
|
||||||
|
std::unique_ptr<CalypFramePrivate> d;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __CALYPFRAME_H__
|
#endif // __CALYPFRAME_H__
|
||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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
|
||||||
|
|||||||
+75
-31
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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,15 +34,24 @@
|
|||||||
* @}
|
* @}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "CalypFrame.h"
|
#include "CalypFrame.h"
|
||||||
#include "CalypOptions.h"
|
#include "CalypOptions.h"
|
||||||
|
|
||||||
#define REGISTER_CLASS_MAKER( X ) \
|
#define REGISTER_CLASS_MAKER( X ) \
|
||||||
extern "C" CalypModuleIf* Maker() { return new X; }
|
extern "C" CalypModulePtr Maker() { return std::make_unique<X>(); }
|
||||||
#define REGISTER_CLASS_FACTORY( X ) \
|
#define REGISTER_CLASS_FACTORY( X ) \
|
||||||
public: \
|
public: \
|
||||||
static CalypModuleIf* Create() { return new X(); } \
|
X( const X& buffer ) \
|
||||||
void Delete() { delete this; }
|
noexcept = delete; \
|
||||||
|
X( X&& buffer ) \
|
||||||
|
noexcept = delete; \
|
||||||
|
auto operator=( const X& buffer )->X& = delete; \
|
||||||
|
auto operator=( X&& buffer ) noexcept->X& = delete; \
|
||||||
|
static CalypModulePtr Create() { return std::make_unique<X>(); }
|
||||||
|
|
||||||
#define _BASIC_MODULE_API_2_CHECK_ \
|
#define _BASIC_MODULE_API_2_CHECK_ \
|
||||||
if( apcFrameList.size() != m_uiNumberOfFrames ) \
|
if( apcFrameList.size() != m_uiNumberOfFrames ) \
|
||||||
return false; \
|
return false; \
|
||||||
@@ -74,8 +83,9 @@ enum Module_API_Version
|
|||||||
*/
|
*/
|
||||||
enum Module_Type
|
enum Module_Type
|
||||||
{
|
{
|
||||||
CLP_FRAME_PROCESSING_MODULE,
|
CLP_INVALID_MODULE = -1,
|
||||||
CLP_FRAME_MEASUREMENT_MODULE,
|
CLP_FRAME_PROCESSING_MODULE = 0,
|
||||||
|
CLP_FRAME_MEASUREMENT_MODULE = 1,
|
||||||
CLP_MODULE_TYPE_MAX = 255,
|
CLP_MODULE_TYPE_MAX = 255,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -112,33 +122,28 @@ enum Module_Key_Supported
|
|||||||
class CalypModuleIf
|
class CalypModuleIf
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int m_iModuleAPI;
|
int m_iModuleAPI{ CLP_MODULE_API_1 };
|
||||||
int m_iModuleType;
|
int m_iModuleType{ CLP_INVALID_MODULE };
|
||||||
const char* m_pchModuleCategory;
|
const char* m_pchModuleCategory{ "" };
|
||||||
const char* m_pchModuleName;
|
const char* m_pchModuleName{ "" };
|
||||||
const char* m_pchModuleTooltip;
|
const char* m_pchModuleTooltip{ "" };
|
||||||
const char* m_pchModuleLongName;
|
const char* m_pchModuleLongName{ nullptr };
|
||||||
|
|
||||||
//! Number of frames
|
//! Number of frames
|
||||||
unsigned int m_uiNumberOfFrames;
|
unsigned int m_uiNumberOfFrames{ 1 };
|
||||||
//! Features/Requirements
|
//! Features/Requirements
|
||||||
unsigned int m_uiModuleRequirements;
|
unsigned int m_uiModuleRequirements{ CLP_MODULE_REQUIRES_NOTHING };
|
||||||
|
|
||||||
unsigned int m_iFrameBufferCount;
|
unsigned int m_iFrameBufferCount{ 0 };
|
||||||
CalypFrame* m_pcOutputFrame;
|
|
||||||
|
|
||||||
CalypOptions m_cModuleOptions;
|
CalypOptions m_cModuleOptions;
|
||||||
|
|
||||||
CalypModuleIf()
|
CalypModuleIf() = default;
|
||||||
{
|
CalypModuleIf( const CalypModuleIf& other ) noexcept = delete;
|
||||||
m_iModuleAPI = CLP_MODULE_API_1;
|
CalypModuleIf( CalypModuleIf&& other ) noexcept = delete;
|
||||||
m_uiModuleRequirements = CLP_MODULE_REQUIRES_NOTHING;
|
auto operator=( const CalypModuleIf& other ) -> CalypModuleIf& = delete;
|
||||||
m_pchModuleLongName = NULL;
|
auto operator=( CalypModuleIf&& other ) noexcept -> CalypModuleIf& = delete;
|
||||||
m_pcOutputFrame = NULL;
|
virtual ~CalypModuleIf() = default;
|
||||||
m_iFrameBufferCount = 0;
|
|
||||||
}
|
|
||||||
virtual ~CalypModuleIf() {}
|
|
||||||
virtual void Delete() = 0;
|
|
||||||
virtual void destroy() = 0;
|
virtual void destroy() = 0;
|
||||||
|
|
||||||
const char* getModuleLongName()
|
const char* getModuleLongName()
|
||||||
@@ -159,12 +164,12 @@ public:
|
|||||||
virtual CalypFrame* process( std::vector<CalypFrame*> ) { return NULL; }
|
virtual CalypFrame* process( std::vector<CalypFrame*> ) { return NULL; }
|
||||||
virtual double measure( std::vector<CalypFrame*> ) { return 0; }
|
virtual double measure( std::vector<CalypFrame*> ) { return 0; }
|
||||||
virtual bool keyPressed( enum Module_Key_Supported ) { return false; }
|
virtual bool keyPressed( enum Module_Key_Supported ) { return false; }
|
||||||
virtual ClpString moduleInfo() { return ClpString(); }
|
virtual std::string moduleInfo() { return std::string(); }
|
||||||
/**
|
/**
|
||||||
* Module API version 3
|
* Module API version 3
|
||||||
*/
|
*/
|
||||||
virtual CalypFrame* getProcessedFrame() { return m_pcOutputFrame; }
|
virtual CalypFrame* getProcessedFrame() { return nullptr; }
|
||||||
virtual bool needFrame() { return m_iFrameBufferCount == 0? true : false; };
|
virtual bool needFrame() { return m_iFrameBufferCount == 0 ? true : false; };
|
||||||
virtual bool flush()
|
virtual bool flush()
|
||||||
{
|
{
|
||||||
m_iFrameBufferCount = 0;
|
m_iFrameBufferCount = 0;
|
||||||
@@ -172,4 +177,43 @@ public:
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
namespace cv
|
||||||
|
{
|
||||||
|
class Mat;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \class CalypOpenCVModuleIf
|
||||||
|
* \ingroup CalypLib Calyp_Modules
|
||||||
|
* \brief Abstract class for modules using OpenCV library
|
||||||
|
*/
|
||||||
|
class CalypOpenCVModuleIf : public CalypModuleIf
|
||||||
|
{
|
||||||
|
using Mat = cv::Mat;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
//const char* m_pchPythonFunctionName;
|
||||||
|
std::unique_ptr<CalypFrame> m_pcOutputFrame;
|
||||||
|
bool m_bConvertToGray;
|
||||||
|
|
||||||
|
public:
|
||||||
|
CalypOpenCVModuleIf()
|
||||||
|
{
|
||||||
|
m_bConvertToGray = false;
|
||||||
|
};
|
||||||
|
virtual ~CalypOpenCVModuleIf() {}
|
||||||
|
|
||||||
|
// Common API
|
||||||
|
bool create( std::vector<CalypFrame*> apcFrameList );
|
||||||
|
CalypFrame* process( std::vector<CalypFrame*> apcFrameList );
|
||||||
|
void destroy();
|
||||||
|
|
||||||
|
// API using OpenCV
|
||||||
|
virtual cv::Mat* create_using_opencv( const std::vector<Mat>& apcFrameList ) { return nullptr; };
|
||||||
|
virtual Mat* process_using_opencv( const std::vector<Mat>& apcFrameList ) = 0;
|
||||||
|
virtual void destroy_using_opencv(){};
|
||||||
|
};
|
||||||
|
|
||||||
|
using CalypModulePtr = std::unique_ptr<CalypModuleIf>;
|
||||||
|
|
||||||
#endif // __CALYPMODULESIF_H__
|
#endif // __CALYPMODULESIF_H__
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/* This file is a part of Calyp project
|
/* This file is a part of Calyp project
|
||||||
* Copyright (C) 2014-2019 by Joao Carreira (jfmcarreira@gmail.com)
|
* Copyright (C) 2014-2021 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,62 +22,47 @@
|
|||||||
* \brief Calyp modules interface for OpenCV
|
* \brief Calyp modules interface for OpenCV
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "CalypOpenCVModuleIf.h"
|
#include "CalypModuleIf.h"
|
||||||
|
|
||||||
// OpenCV
|
// OpenCV
|
||||||
#include <opencv2/opencv.hpp>
|
#include <opencv2/opencv.hpp>
|
||||||
|
|
||||||
using cv::Mat;
|
|
||||||
|
|
||||||
bool CalypOpenCVModuleIf::create( std::vector<CalypFrame*> apcFrameList )
|
bool CalypOpenCVModuleIf::create( std::vector<CalypFrame*> apcFrameList )
|
||||||
{
|
{
|
||||||
_BASIC_MODULE_API_2_CHECK_
|
_BASIC_MODULE_API_2_CHECK_
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
std::vector<Mat*> acMatList( apcFrameList.size() );
|
std::vector<Mat> acMatList( apcFrameList.size() );
|
||||||
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
||||||
{
|
{
|
||||||
acMatList[i] = new Mat;
|
apcFrameList[i]->toMat( acMatList[i], m_bConvertToGray );
|
||||||
apcFrameList[i]->toMat( *acMatList[i], m_bConvertToGray );
|
|
||||||
}
|
}
|
||||||
Mat* outputMat = create_using_opencv( acMatList );
|
Mat* outputMat = create_using_opencv( acMatList );
|
||||||
if( outputMat )
|
if( outputMat )
|
||||||
{
|
{
|
||||||
unsigned pelFormat = m_bConvertToGray ? CalypFrame::findPixelFormat( "GRAY" ) : apcFrameList[0]->getPelFormat();
|
unsigned pelFormat = m_bConvertToGray ? CalypFrame::findPixelFormat( "GRAY" ) : apcFrameList[0]->getPelFormat();
|
||||||
m_pcOutputFrame = new CalypFrame( outputMat->cols, outputMat->rows, pelFormat, apcFrameList[0]->getBitsPel() );
|
m_pcOutputFrame = std::make_unique<CalypFrame>( outputMat->cols, outputMat->rows, pelFormat, apcFrameList[0]->getBitsPel() );
|
||||||
bRet = true;
|
bRet = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
|
||||||
{
|
|
||||||
delete acMatList[i];
|
|
||||||
}
|
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
CalypFrame* CalypOpenCVModuleIf::process( std::vector<CalypFrame*> apcFrameList )
|
CalypFrame* CalypOpenCVModuleIf::process( std::vector<CalypFrame*> apcFrameList )
|
||||||
{
|
{
|
||||||
m_pcOutputFrame->reset();
|
m_pcOutputFrame->reset();
|
||||||
std::vector<Mat*> acMatList( apcFrameList.size() );
|
std::vector<Mat> acMatList( apcFrameList.size() );
|
||||||
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
||||||
{
|
{
|
||||||
acMatList[i] = new Mat;
|
apcFrameList[i]->toMat( acMatList[i], m_bConvertToGray );
|
||||||
apcFrameList[i]->toMat( *acMatList[i], m_bConvertToGray );
|
|
||||||
}
|
}
|
||||||
Mat* cvOutput = process_using_opencv( acMatList );
|
Mat* cvOutput = process_using_opencv( acMatList );
|
||||||
m_pcOutputFrame->fromMat( *cvOutput );
|
m_pcOutputFrame->fromMat( *cvOutput );
|
||||||
for( unsigned i = 0; i < apcFrameList.size(); i++ )
|
return m_pcOutputFrame.get();
|
||||||
{
|
|
||||||
delete acMatList[i];
|
|
||||||
}
|
|
||||||
return m_pcOutputFrame;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypOpenCVModuleIf::destroy()
|
void CalypOpenCVModuleIf::destroy()
|
||||||
{
|
{
|
||||||
if( m_pcOutputFrame )
|
|
||||||
delete m_pcOutputFrame;
|
|
||||||
m_pcOutputFrame = NULL;
|
|
||||||
}
|
}
|
||||||
+45
-46
@@ -38,20 +38,20 @@
|
|||||||
|
|
||||||
#include "CalypOptions.h"
|
#include "CalypOptions.h"
|
||||||
|
|
||||||
#include "config.h"
|
|
||||||
#include "lib/CalypModuleIf.h"
|
|
||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
|
#include "lib/CalypModuleIf.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
struct ParseFailure : public std::exception
|
struct ParseFailure : public std::exception
|
||||||
{
|
{
|
||||||
ClpString arg;
|
std::string arg;
|
||||||
ClpString val;
|
std::string val;
|
||||||
ParseFailure( ClpString arg0, ClpString val0 ) throw()
|
ParseFailure( std::string arg0, std::string val0 ) throw()
|
||||||
: arg( arg0 ), val( val0 ) {}
|
: arg( arg0 ), val( val0 ) {}
|
||||||
~ParseFailure() throw() {}
|
~ParseFailure() throw() {}
|
||||||
const char* what() const throw() { return "Option Parse Failure"; }
|
const char* what() const throw() { return "Option Parse Failure"; }
|
||||||
@@ -61,9 +61,9 @@ struct ParseFailure : public std::exception
|
|||||||
class boolOption : public OptionBase
|
class boolOption : public OptionBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
boolOption( const ClpString& name, const ClpString& desc )
|
boolOption( const std::string& name, const std::string& desc )
|
||||||
: OptionBase( name, desc, "(1-0)" ) { is_binary = true; }
|
: OptionBase( name, desc, "(1-0)" ) { is_binary = true; }
|
||||||
void parse( const ClpString& arg ) { arg_count++; }
|
void parse( const std::string& arg ) { arg_count++; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Type specific option storage */
|
/** Type specific option storage */
|
||||||
@@ -71,20 +71,20 @@ template <typename T>
|
|||||||
class StandardOption : public OptionBase
|
class StandardOption : public OptionBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
StandardOption( const ClpString& name, T& storage, const ClpString& desc, const ClpString& def )
|
StandardOption( const std::string& name, T& storage, const std::string& desc, const std::string& def )
|
||||||
: OptionBase( name, desc, def ), opt_storage( storage )
|
: OptionBase( name, desc, def ), opt_storage( storage )
|
||||||
{
|
{
|
||||||
is_binary = false;
|
is_binary = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse( const ClpString& arg );
|
void parse( const std::string& arg );
|
||||||
T& opt_storage;
|
T& opt_storage;
|
||||||
std::vector<T> opt_storage_array;
|
std::vector<T> opt_storage_array;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Generic parsing */
|
/* Generic parsing */
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void StandardOption<T>::parse( const ClpString& arg )
|
inline void StandardOption<T>::parse( const std::string& arg )
|
||||||
{
|
{
|
||||||
if( !is_binary )
|
if( !is_binary )
|
||||||
{
|
{
|
||||||
@@ -103,7 +103,7 @@ inline void StandardOption<T>::parse( const ClpString& arg )
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void StandardOption<std::vector<unsigned int>>::parse( const ClpString& arg )
|
inline void StandardOption<std::vector<unsigned int>>::parse( const std::string& arg )
|
||||||
{
|
{
|
||||||
unsigned int aux_opt_storage;
|
unsigned int aux_opt_storage;
|
||||||
std::istringstream arg_ss( arg, std::istringstream::in );
|
std::istringstream arg_ss( arg, std::istringstream::in );
|
||||||
@@ -121,7 +121,7 @@ inline void StandardOption<std::vector<unsigned int>>::parse( const ClpString& a
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
inline void StandardOption<std::vector<int>>::parse( const ClpString& arg )
|
inline void StandardOption<std::vector<int>>::parse( const std::string& arg )
|
||||||
{
|
{
|
||||||
int aux_opt_storage;
|
int aux_opt_storage;
|
||||||
std::istringstream arg_ss( arg, std::istringstream::in );
|
std::istringstream arg_ss( arg, std::istringstream::in );
|
||||||
@@ -140,7 +140,7 @@ inline void StandardOption<std::vector<int>>::parse( const ClpString& arg )
|
|||||||
|
|
||||||
/* string parsing is specialized */
|
/* string parsing is specialized */
|
||||||
template <>
|
template <>
|
||||||
inline void StandardOption<ClpString>::parse( const ClpString& arg )
|
inline void StandardOption<std::string>::parse( const std::string& arg )
|
||||||
{
|
{
|
||||||
opt_storage = arg;
|
opt_storage = arg;
|
||||||
arg_count++;
|
arg_count++;
|
||||||
@@ -148,7 +148,7 @@ inline void StandardOption<ClpString>::parse( const ClpString& arg )
|
|||||||
|
|
||||||
/* string vector parsing is specialized */
|
/* string vector parsing is specialized */
|
||||||
template <>
|
template <>
|
||||||
inline void StandardOption<std::vector<ClpString>>::parse( const ClpString& arg )
|
inline void StandardOption<std::vector<std::string>>::parse( const std::string& arg )
|
||||||
{
|
{
|
||||||
opt_storage.push_back( arg );
|
opt_storage.push_back( arg );
|
||||||
arg_count++;
|
arg_count++;
|
||||||
@@ -158,15 +158,15 @@ inline void StandardOption<std::vector<ClpString>>::parse( const ClpString& arg
|
|||||||
struct FunctionOption : public OptionBase
|
struct FunctionOption : public OptionBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef void( Func )( CalypOptions&, const ClpString& );
|
typedef void( Func )( CalypOptions&, const std::string& );
|
||||||
|
|
||||||
FunctionOption( const ClpString& name, CalypOptions& parent_, Func* func_, const ClpString& desc, const ClpString& def )
|
FunctionOption( const std::string& name, CalypOptions& parent_, Func* func_, const std::string& desc, const std::string& def )
|
||||||
: OptionBase( name, desc, def ), parent( parent_ ), func( func_ )
|
: OptionBase( name, desc, def ), parent( parent_ ), func( func_ )
|
||||||
{
|
{
|
||||||
is_binary = false;
|
is_binary = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void parse( const ClpString& arg )
|
void parse( const std::string& arg )
|
||||||
{
|
{
|
||||||
func( parent, arg );
|
func( parent, arg );
|
||||||
arg_count++;
|
arg_count++;
|
||||||
@@ -174,7 +174,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
CalypOptions& parent;
|
CalypOptions& parent;
|
||||||
void ( *func )( CalypOptions&, const ClpString& );
|
void ( *func )( CalypOptions&, const std::string& );
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Helper method to initiate adding options to Options */
|
/* Helper method to initiate adding options to Options */
|
||||||
@@ -185,7 +185,7 @@ private:
|
|||||||
* with default_val as the default value
|
* with default_val as the default value
|
||||||
* with desc as an optional help description
|
* with desc as an optional help description
|
||||||
*/
|
*/
|
||||||
CalypOptions& CalypOptions::operator()( const ClpString& name, const ClpString& desc )
|
CalypOptions& CalypOptions::operator()( const std::string& name, const std::string& desc )
|
||||||
{
|
{
|
||||||
addOption( new boolOption( name, desc ) );
|
addOption( new boolOption( name, desc ) );
|
||||||
return *this;
|
return *this;
|
||||||
@@ -197,31 +197,31 @@ CalypOptions& CalypOptions::operator()( const ClpString& name, const ClpString&
|
|||||||
* with desc as an optional help description
|
* with desc as an optional help description
|
||||||
*/
|
*/
|
||||||
template <typename T>
|
template <typename T>
|
||||||
CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc )
|
CalypOptions& CalypOptions::operator()( const std::string& name, T& storage, const std::string& desc )
|
||||||
{
|
{
|
||||||
addOption( new StandardOption<T>( name, storage, desc, ClpString( "" ) ) );
|
addOption( new StandardOption<T>( name, storage, desc, std::string( "" ) ) );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
CalypOptions& CalypOptions::operator()( const ClpString& name, T& storage, const ClpString& desc, const ClpString& defaults )
|
CalypOptions& CalypOptions::operator()( const std::string& name, T& storage, const std::string& desc, const std::string& defaults )
|
||||||
{
|
{
|
||||||
addOption( new StandardOption<T>( name, storage, desc ) );
|
addOption( new StandardOption<T>( name, storage, desc ) );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, bool& storage, const ClpString& desc );
|
template CalypOptions& CalypOptions::operator()( const std::string& name, bool& storage, const std::string& desc );
|
||||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, unsigned int& storage, const ClpString& desc );
|
template CalypOptions& CalypOptions::operator()( const std::string& name, unsigned int& storage, const std::string& desc );
|
||||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, int& storage, const ClpString& desc );
|
template CalypOptions& CalypOptions::operator()( const std::string& name, int& storage, const std::string& desc );
|
||||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, long& storage, const ClpString& desc );
|
template CalypOptions& CalypOptions::operator()( const std::string& name, long& storage, const std::string& desc );
|
||||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, long long int& storage, const ClpString& desc );
|
template CalypOptions& CalypOptions::operator()( const std::string& name, long long int& storage, const std::string& desc );
|
||||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, ClpString& storage, const ClpString& desc );
|
template CalypOptions& CalypOptions::operator()( const std::string& name, std::string& storage, const std::string& desc );
|
||||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, std::vector<unsigned int>& storage,
|
template CalypOptions& CalypOptions::operator()( const std::string& name, std::vector<unsigned int>& storage,
|
||||||
const ClpString& desc );
|
const std::string& desc );
|
||||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, std::vector<int>& storage,
|
template CalypOptions& CalypOptions::operator()( const std::string& name, std::vector<int>& storage,
|
||||||
const ClpString& desc );
|
const std::string& desc );
|
||||||
template CalypOptions& CalypOptions::operator()( const ClpString& name, std::vector<ClpString>& storage,
|
template CalypOptions& CalypOptions::operator()( const std::string& name, std::vector<std::string>& storage,
|
||||||
const ClpString& desc );
|
const std::string& desc );
|
||||||
|
|
||||||
CalypOptions::Option::Option()
|
CalypOptions::Option::Option()
|
||||||
: opt( 0 ) {}
|
: opt( 0 ) {}
|
||||||
@@ -232,7 +232,7 @@ CalypOptions::Option::~Option()
|
|||||||
delete opt;
|
delete opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
CalypOptions::CalypOptions( const ClpString& name )
|
CalypOptions::CalypOptions( const std::string& name )
|
||||||
{
|
{
|
||||||
m_cOptionGroupName = name;
|
m_cOptionGroupName = name;
|
||||||
m_bAllowUnkonw = true;
|
m_bAllowUnkonw = true;
|
||||||
@@ -246,12 +246,12 @@ CalypOptions::~CalypOptions()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionBase* CalypOptions::operator[]( const ClpString& optName )
|
OptionBase* CalypOptions::operator[]( const std::string& optName )
|
||||||
{
|
{
|
||||||
return getOption( optName );
|
return getOption( optName );
|
||||||
}
|
}
|
||||||
|
|
||||||
OptionBase* CalypOptions::getOption( const ClpString& optName )
|
OptionBase* CalypOptions::getOption( const std::string& optName )
|
||||||
{
|
{
|
||||||
CalypOptions::OptionMap::iterator opt_it;
|
CalypOptions::OptionMap::iterator opt_it;
|
||||||
opt_it = opt_short_map.find( optName );
|
opt_it = opt_short_map.find( optName );
|
||||||
@@ -275,7 +275,7 @@ OptionBase* CalypOptions::getOption( const ClpString& optName )
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CalypOptions::hasOpt( const ClpString& optName )
|
bool CalypOptions::hasOpt( const std::string& optName )
|
||||||
{
|
{
|
||||||
OptionBase* opt = getOption( optName );
|
OptionBase* opt = getOption( optName );
|
||||||
return opt ? opt->count() > 0 ? true : false : false;
|
return opt ? opt->count() > 0 ? true : false : false;
|
||||||
@@ -284,7 +284,7 @@ bool CalypOptions::hasOpt( const ClpString& optName )
|
|||||||
void CalypOptions::addDefaultOptions()
|
void CalypOptions::addDefaultOptions()
|
||||||
{
|
{
|
||||||
addOptions() /**/
|
addOptions() /**/
|
||||||
( "help,h", "produce help message" ) /**/
|
( "help", "produce help message" ) /**/
|
||||||
( "version", "show version and exit" ) /**/
|
( "version", "show version and exit" ) /**/
|
||||||
( "pel_fmts", "list pixel formats" ) /**/
|
( "pel_fmts", "list pixel formats" ) /**/
|
||||||
( "quality_metrics", "list supported quality metrics" ) /**/
|
( "quality_metrics", "list supported quality metrics" ) /**/
|
||||||
@@ -477,27 +477,26 @@ unsigned int CalypOptions::parseSHORT( unsigned int argc, char* argv[] )
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CalypOptions::parse( unsigned int argc, char* argv[] )
|
int CalypOptions::parse( unsigned int argc, char* argv[] )
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
m_aUnhandledArgs = scanArgv( argc, argv );
|
m_aUnhandledArgs = scanArgv( argc, argv );
|
||||||
|
|
||||||
if( checkListingOpts() )
|
if( checkListingOpts() )
|
||||||
{
|
{
|
||||||
return false;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch( std::exception& e )
|
catch( std::exception& e )
|
||||||
{
|
{
|
||||||
std::cerr << "error: " << e.what() << "\n";
|
std::cerr << "error: " << e.what() << "\n";
|
||||||
return false;
|
return -1;
|
||||||
}
|
}
|
||||||
catch( ... )
|
catch( ... )
|
||||||
{
|
{
|
||||||
std::cerr << "Exception of unknown type!\n";
|
std::cerr << "Exception of unknown type!\n";
|
||||||
}
|
}
|
||||||
return true;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
list<const char*> CalypOptions::scanArgv( unsigned int argc, char* argv[] )
|
list<const char*> CalypOptions::scanArgv( unsigned int argc, char* argv[] )
|
||||||
@@ -546,7 +545,7 @@ list<const char*> CalypOptions::scanArgv( unsigned int argc, char* argv[] )
|
|||||||
return non_option_arguments;
|
return non_option_arguments;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalypOptions::parse( std::vector<ClpString> args_array )
|
void CalypOptions::parse( std::vector<std::string> args_array )
|
||||||
{
|
{
|
||||||
for( unsigned int i = 0; i < args_array.size(); i++ )
|
for( unsigned int i = 0; i < args_array.size(); i++ )
|
||||||
{
|
{
|
||||||
|
|||||||
Loaded 100 of 193 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user