From 95f542365f6f1cd043c7b3090a67d269d6dde58b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 16 Oct 2015 21:38:23 +0200 Subject: allow for filter immediate center --- ftnoir_filter_accela/ftnoir_filter_accela.h | 3 ++- opentrack/plugin-api.hpp | 2 ++ opentrack/tracker.cpp | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.h b/ftnoir_filter_accela/ftnoir_filter_accela.h index 318cf909..a6f04dfa 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.h +++ b/ftnoir_filter_accela/ftnoir_filter_accela.h @@ -37,7 +37,8 @@ class FTNoIR_Filter : public IFilter { public: FTNoIR_Filter(); - void filter(const double* input, double *output); + void filter(const double* input, double *output) override; + void center() override { first_run = true; } Map rot, trans; private: settings_accela s; diff --git a/opentrack/plugin-api.hpp b/opentrack/plugin-api.hpp index 732dbb3d..a57077ab 100644 --- a/opentrack/plugin-api.hpp +++ b/opentrack/plugin-api.hpp @@ -61,6 +61,8 @@ struct IFilter // perform filtering step. // you have to take care of dt on your own, try "opentrack-compat/timer.hpp" virtual void filter(const double *input, double *output) = 0; + // optionally reset the filter when centering + virtual void center() {} }; struct IFilterDialog : public BaseDialog diff --git a/opentrack/tracker.cpp b/opentrack/tracker.cpp index 8fd054b4..a9e60555 100644 --- a/opentrack/tracker.cpp +++ b/opentrack/tracker.cpp @@ -114,6 +114,8 @@ void Tracker::logic() if (can_center) { + if (libs.pFilter) + libs.pFilter->center(); centerp = false; for (int i = 0; i < 3; i++) t_b[i] = t(i); -- cgit v1.2.3 From f314ef0afb4f9f5eb2a3bbd7f49d23fc77728330 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 16 Oct 2015 21:38:44 +0200 Subject: accela: also filter out NaNs on tracking start --- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 81ef3948..3e049eb0 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -64,9 +64,13 @@ void FTNoIR_Filter::filter(const double* input, double *output) { for (int i = 0; i < 6; i++) { - output[i] = input[i]; - last_output[i] = input[i]; - smoothed_input[i] = input[i]; + const bool drop = std::isnan(input[i]) || std::isinf(input[i]); + double f = input[i]; + if (drop) + f = 0; + output[i] = f; + last_output[i] = f; + smoothed_input[i] = f; } first_run = false; t.start(); -- cgit v1.2.3 From 59897ded74a13e2a31a60f9443a64a59e97bb386 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 08:33:12 +0200 Subject: shortcuts: allow for binding scroll lock and pause/break Print screen doesn't seem to work. Issue: #257 --- opentrack/win32-shortcuts.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/opentrack/win32-shortcuts.cpp b/opentrack/win32-shortcuts.cpp index bd51ae88..ceee2f9b 100644 --- a/opentrack/win32-shortcuts.cpp +++ b/opentrack/win32-shortcuts.cpp @@ -109,6 +109,9 @@ QList windows_key_sequences = win_key(DIK_RETURN, Qt::Key::Key_Return), win_key(DIK_INSERT, Qt::Key::Key_Insert), win_key(DIK_SPACE, Qt::Key::Key_Space), + //win_key(DIK_SYSRQ, Qt::Key::Key_Print), + win_key(DIK_SCROLL, Qt::Key::Key_ScrollLock), + win_key(DIK_PAUSE, Qt::Key::Key_Pause), }); bool win_key::to_qt(const Key& k, QKeySequence& qt_, Qt::KeyboardModifiers &mods) -- cgit v1.2.3 From c47260fbc4045d62063ba7f952fda1b46e0a10ea Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 08:33:28 +0200 Subject: shortcuts: alias right modifier keys to left modifier keys Issue: #257 Closes #257 --- opentrack/shortcuts.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp index ba2b7c8e..3ad8e9be 100644 --- a/opentrack/shortcuts.cpp +++ b/opentrack/shortcuts.cpp @@ -96,9 +96,9 @@ void KeybindingWorker::run() { case DIK_RALT: break; default: - k.shift = !!(keystate[DIK_LSHIFT] & 0x80); - k.alt = !!(keystate[DIK_LALT] & 0x80); - k.ctrl = !!(keystate[DIK_LCONTROL] & 0x80); + k.shift = !!(keystate[DIK_LSHIFT] & 0x80) || !!(keystate[DIK_RSHIFT] & 0x80); + k.alt = !!(keystate[DIK_LALT] & 0x80) || !!(keystate[DIK_RALT] & 0x80); + k.ctrl = !!(keystate[DIK_LCONTROL] & 0x80) || !!(keystate[DIK_RCONTROL] & 0x80); k.keycode = i; receiver(k); break; -- cgit v1.2.3 From 86418fa6feeb199df96146ba2343f4b9fdb54c21 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 08:36:16 +0200 Subject: shortcuts: actually print screen binding works It works only if Dropbox doesn't hook the key Issue: #257 --- opentrack/win32-shortcuts.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opentrack/win32-shortcuts.cpp b/opentrack/win32-shortcuts.cpp index ceee2f9b..feaf6036 100644 --- a/opentrack/win32-shortcuts.cpp +++ b/opentrack/win32-shortcuts.cpp @@ -109,7 +109,7 @@ QList windows_key_sequences = win_key(DIK_RETURN, Qt::Key::Key_Return), win_key(DIK_INSERT, Qt::Key::Key_Insert), win_key(DIK_SPACE, Qt::Key::Key_Space), - //win_key(DIK_SYSRQ, Qt::Key::Key_Print), + win_key(DIK_SYSRQ, Qt::Key::Key_Print), win_key(DIK_SCROLL, Qt::Key::Key_ScrollLock), win_key(DIK_PAUSE, Qt::Key::Key_Pause), }); -- cgit v1.2.3 From 0cff7ae12e4672f7b8272830691bfbfe92dd56c3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 10:49:01 +0200 Subject: cmake: drop -ffast-math, allow for NaN check --- cmake/mingw-w64.cmake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake index f8ee1d41..2705c068 100644 --- a/cmake/mingw-w64.cmake +++ b/cmake/mingw-w64.cmake @@ -26,7 +26,8 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # oldest CPU supported here is Northwood-based Pentium 4. -sh 20150811 -set(cpu "-O3 -march=pentium4 -mtune=corei7-avx -ffast-math -mfpmath=both -msse -msse2 -mno-sse3") +set(fpu "-fno-math-errno -funsafe-math-optimizations -fno-signed-zeros -mfpmath=both") +set(cpu "-O3 -march=pentium4 -mtune=corei7-avx ${fpu} -msse -msse2 -mno-sse3") set(CFLAGS-OVERRIDE "" CACHE STRING "") -- cgit v1.2.3 From 343bdbaa7d3ac2fd6ee3d83c2d8bee5d80c94fda Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 10:49:36 +0200 Subject: accela: don't check NaNs in filter, wrong place --- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 3e049eb0..ab5fda07 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -64,13 +64,9 @@ void FTNoIR_Filter::filter(const double* input, double *output) { for (int i = 0; i < 6; i++) { - const bool drop = std::isnan(input[i]) || std::isinf(input[i]); - double f = input[i]; - if (drop) - f = 0; - output[i] = f; - last_output[i] = f; - smoothed_input[i] = f; + output[i] = input[i]; + last_output[i] = input[i]; + smoothed_input[i] = input[i]; } first_run = false; t.start(); @@ -92,9 +88,7 @@ void FTNoIR_Filter::filter(const double* input, double *output) { Map& m = i >= 3 ? rot : trans; - const bool drop = std::isnan(input[i]) || std::isinf(input[i]); - const double f = drop ? last_output[i] : input[i]; - smoothed_input[i] = smoothed_input[i] * (1.-alpha) + f * alpha; + smoothed_input[i] = smoothed_input[i] * (1.-alpha) + input[i] * alpha; const double in = smoothed_input[i]; -- cgit v1.2.3 From 9af18404a44f68a3d65bf30843abc99b27ed68f7 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 10:51:22 +0200 Subject: tracker: check for NaN values Issue: #255 --- opentrack/tracker.cpp | 126 +++++++++++++++++++++++++++++++++++++------------- opentrack/tracker.h | 2 +- 2 files changed, 96 insertions(+), 32 deletions(-) diff --git a/opentrack/tracker.cpp b/opentrack/tracker.cpp index a9e60555..ad10e396 100644 --- a/opentrack/tracker.cpp +++ b/opentrack/tracker.cpp @@ -62,6 +62,44 @@ void Tracker::t_compensate(const rmat& rmat, const double* xyz, double* output, output[0] = -ret(1); } +static inline bool nanp(double value) +{ + return std::isnan(value) || std::isinf(value); +} + +static inline double elide_nan(double value, double def) +{ + if (nanp(value)) + { + if (nanp(def)) + return 0; + return def; + } + return value; +} + +static bool is_nan(const dmat<3,3>& r, const dmat<3, 1>& t) +{ + for (int i = 0; i < 3; i++) + for (int j = 0; j < 3; j++) + if (nanp(r(i, j))) + return true; + + for (int i = 0; i < 3; i++) + if (nanp(t(i))) + return true; + + return false; +} + +static bool is_nan(const Pose& value) +{ + for (int i = 0; i < 6; i++) + if (nanp(value(i))) + return true; + return false; +} + void Tracker::logic() { bool inverts[6] = { @@ -72,12 +110,12 @@ void Tracker::logic() m(4).opts.invert, m(5).opts.invert, }; - + static constexpr double pi = 3.141592653; static constexpr double r2d = 180. / pi; - + Pose value, raw; - + for (int i = 0; i < 6; i++) { auto& axis = m(i); @@ -89,6 +127,9 @@ void Tracker::logic() raw(i) = newpose[i]; } + if (is_nan(raw)) + raw = last_raw; + const double off[] = { (double)-s.camera_yaw, (double)-s.camera_pitch, @@ -97,12 +138,13 @@ void Tracker::logic() const rmat cam = rmat::euler_to_rmat(off); rmat r = rmat::euler_to_rmat(&value[Yaw]); dmat<3, 1> t(value(0), value(1), value(2)); - + r = cam * r; - + bool can_center = false; - - if (centerp) + const bool nan = is_nan(r, t); + + if (centerp && !nan) { for (int i = 0; i < 6; i++) if (fabs(newpose[i]) != 0) @@ -111,7 +153,7 @@ void Tracker::logic() break; } } - + if (can_center) { if (libs.pFilter) @@ -121,7 +163,7 @@ void Tracker::logic() t_b[i] = t(i); r_b = r; } - + { double tmp[3] = { t(0) - t_b[0], t(1) - t_b[1], t(2) - t_b[2] }; t_compensate(cam, tmp, tmp, false); @@ -143,35 +185,57 @@ void Tracker::logic() value(i+3) = euler(i) * r2d; } } - + + bool nan_ = false; + // we're checking NaNs after every block of numeric ops + if (is_nan(value)) + { + nan_ = true; + } + else { Pose tmp = value; - + if (libs.pFilter) libs.pFilter->filter(tmp, value); - } - for (int i = 0; i < 6; i++) - value(i) = map(value(i), m(i)); - - if (s.tcomp_p) - t_compensate(rmat::euler_to_rmat(&value[Yaw]), - value, - value, - s.tcomp_tz); + for (int i = 0; i < 6; i++) + value(i) = map(value(i), m(i)); - for (int i = 0; i < 6; i++) - value(i) += m(i).opts.zero; + if (s.tcomp_p) + t_compensate(rmat::euler_to_rmat(&value[Yaw]), + value, + value, + s.tcomp_tz); - for (int i = 0; i < 6; i++) - value[i] *= inverts[i] ? -1. : 1.; + for (int i = 0; i < 6; i++) + value(i) += m(i).opts.zero; - if (zero_) for (int i = 0; i < 6; i++) - value(i) = 0; + value[i] *= inverts[i] ? -1. : 1.; + + if (zero_) + for (int i = 0; i < 6; i++) + value(i) = 0; + + if (is_nan(value)) + nan_ = true; + } + + if (nan_) + { + value = last_mapped; + + // for widget last value display + for (int i = 0; i < 6; i++) + (void) map(value(i), m(i)); + } libs.pProtocol->pose(value); + last_mapped = value; + last_raw = raw; + QMutexLocker foo(&mtx); output_pose = value; raw_6dof = raw; @@ -179,7 +243,7 @@ void Tracker::logic() void Tracker::run() { const int sleep_ms = 3; - + #if defined(_WIN32) (void) timeBeginPeriod(1); #endif @@ -187,14 +251,14 @@ void Tracker::run() { while (!should_quit) { t.start(); - + double tmp[6] {0,0,0, 0,0,0}; libs.pTracker->data(tmp); - + if (enabledp) for (int i = 0; i < 6; i++) - newpose[i] = tmp[i]; - + newpose[i] = elide_nan(tmp[i], newpose[i]); + logic(); long q = sleep_ms * 1000L - t.elapsed()/1000L; diff --git a/opentrack/tracker.h b/opentrack/tracker.h index c5c39797..b0e89455 100644 --- a/opentrack/tracker.h +++ b/opentrack/tracker.h @@ -48,7 +48,7 @@ private: Mappings& m; Timer t; - Pose output_pose, raw_6dof; + Pose output_pose, raw_6dof, last_mapped, last_raw; double newpose[6]; volatile bool centerp; -- cgit v1.2.3 From 5f20a56e3d948d44a856a529d490e330a1adb57f Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 11:06:02 +0200 Subject: cmake: generate version.cc --- CMakeLists.txt | 29 +++++++++++++++++++++-------- opentrack/version.cc | 9 --------- 2 files changed, 21 insertions(+), 17 deletions(-) delete mode 100644 opentrack/version.cc diff --git a/CMakeLists.txt b/CMakeLists.txt index 67064d76..cb9dc8b9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,10 +14,26 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/) include(GetGitRevisionDescription) find_package(Git QUIET) if(GIT_FOUND) - git_describe(OPENTRACK__COMMIT --tags --always) + git_describe(OPENTRACK_COMMIT --tags --always) endif() -file(WRITE ${CMAKE_BINARY_DIR}/opentrack-version.h "#define OPENTRACK_VERSION \"${OPENTRACK__COMMIT}\"") +file(WRITE ${CMAKE_BINARY_DIR}/opentrack-version.h "#define OPENTRACK_VERSION \"${OPENTRACK_COMMIT}\"") + +## start crapola + +file(WRITE ${CMAKE_BINARY_DIR}/version.cc " +#include \"opentrack-compat/export.hpp\" + +#ifdef __cplusplus +extern \"C\" +#endif +OPENTRACK_EXPORT +const char* opentrack_version; + +const char* opentrack_version = \"${OPENTRACK_COMMIT}\"; +") + +## end crapola SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) @@ -187,7 +203,7 @@ if(filename-hash_0) endif() string(REPLACE "refs/heads/" "" filename-branch_1 "${filename-branch_0}") string(REPLACE "/" "-" filename-branch "${filename-branch_1}") -set(filename_0 "${OPENTRACK__COMMIT}") +set(filename_0 "${OPENTRACK_COMMIT}") set(filename "${CMAKE_BINARY_DIR}/${filename_0}.zip") add_custom_command(OUTPUT ${filename} COMMAND env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}") @@ -274,11 +290,8 @@ opentrack_compat(opentrack-spline-widget) target_include_directories(opentrack-spline-widget PUBLIC qfunctionconfigurator/) target_link_libraries(opentrack-spline-widget ${MY_QT_LIBS}) -add_library(opentrack-version STATIC opentrack/version.cc) +add_library(opentrack-version STATIC ${CMAKE_BINARY_DIR}/version.cc) opentrack_compat(opentrack-version) -set_target_properties(opentrack-version PROPERTIES - COMPILE_DEFINITIONS - "OPENTRACK_VERSION=\"${OPENTRACK__COMMIT}\"") opentrack_library(opentrack-filter-accela ftnoir_filter_accela) target_link_libraries(opentrack-filter-accela opentrack-spline-widget) @@ -570,6 +583,6 @@ if(APPLE) \"${CMAKE_SOURCE_DIR}/macosx\" \"${CMAKE_INSTALL_PREFIX}\" \"${CMAKE_BINARY_DIR}\" - \"${OPENTRACK__COMMIT}\") + \"${OPENTRACK_COMMIT}\") ") endif() diff --git a/opentrack/version.cc b/opentrack/version.cc deleted file mode 100644 index 9e75a336..00000000 --- a/opentrack/version.cc +++ /dev/null @@ -1,9 +0,0 @@ -#include "opentrack-compat/export.hpp" - -#ifdef __cplusplus -extern "C" -#endif -OPENTRACK_EXPORT -const char* opentrack_version; - -const char* opentrack_version = OPENTRACK_VERSION; -- cgit v1.2.3 From 6b220145f9571681d10742f00ffb42ea226e3851 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 11:13:02 +0200 Subject: cmake: regen tarball even if exists --- CMakeLists.txt | 2 +- make-tar.sh | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cb9dc8b9..41b7f57d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,7 +207,7 @@ set(filename_0 "${OPENTRACK_COMMIT}") set(filename "${CMAKE_BINARY_DIR}/${filename_0}.zip") add_custom_command(OUTPUT ${filename} COMMAND env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}") -add_custom_target(tarball DEPENDS ${filename}) +add_custom_target(tarball) opentrack_module(opentrack-api opentrack) diff --git a/make-tar.sh b/make-tar.sh index cd5abc56..8954a4ba 100644 --- a/make-tar.sh +++ b/make-tar.sh @@ -3,6 +3,8 @@ prefix="$1" filename="$2" +rm -fv "$filename" + if : && cd $(dirname -- "${prefix}") && zip -9r "${filename}" $(basename "${prefix}") -- cgit v1.2.3 From 69e9fbf84676e6f0b8d92a9df47f04a2077077b4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 11:13:46 +0200 Subject: cmake: mark dirty tree --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 41b7f57d..b8b7f61a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,7 +14,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake/) include(GetGitRevisionDescription) find_package(Git QUIET) if(GIT_FOUND) - git_describe(OPENTRACK_COMMIT --tags --always) + git_describe(OPENTRACK_COMMIT --tags --always --dirty) endif() file(WRITE ${CMAKE_BINARY_DIR}/opentrack-version.h "#define OPENTRACK_VERSION \"${OPENTRACK_COMMIT}\"") -- cgit v1.2.3 From f97698d16f9523ed04555d9a5ba0fff5d22ba05c Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 11:22:36 +0200 Subject: fix tarball target --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8b7f61a..992ea9ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -206,8 +206,8 @@ string(REPLACE "/" "-" filename-branch "${filename-branch_1}") set(filename_0 "${OPENTRACK_COMMIT}") set(filename "${CMAKE_BINARY_DIR}/${filename_0}.zip") -add_custom_command(OUTPUT ${filename} COMMAND env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}") -add_custom_target(tarball) +add_custom_command(OUTPUT ${filename} COMMAND /usr/bin/env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}") +add_custom_target(tarball DEPENDS "${filename}") opentrack_module(opentrack-api opentrack) -- cgit v1.2.3 From 82f6e8acfd87d7e03ff696616b09b042035eb3a9 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 11:31:16 +0200 Subject: cmake: retab git module --- cmake/GetGitRevisionDescription.cmake | 136 +++++++++++++++++----------------- 1 file changed, 68 insertions(+), 68 deletions(-) diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake index e16d8c37..8a7f0eeb 100644 --- a/cmake/GetGitRevisionDescription.cmake +++ b/cmake/GetGitRevisionDescription.cmake @@ -31,7 +31,7 @@ # http://www.boost.org/LICENSE_1_0.txt) if(__get_git_revision_description) - return() + return() endif() set(__get_git_revision_description YES) @@ -40,84 +40,84 @@ set(__get_git_revision_description YES) get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) function(get_git_head_revision _refspecvar _hashvar) - set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}") - set(GIT_DIR "${GIT_PARENT_DIR}/.git") - while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories - set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") - get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) - if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) - # We have reached the root directory, we are not in git - set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) - return() - endif() - set(GIT_DIR "${GIT_PARENT_DIR}/.git") - endwhile() - set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") - if(NOT EXISTS "${GIT_DATA}") - file(MAKE_DIRECTORY "${GIT_DATA}") - endif() + set(GIT_PARENT_DIR "${CMAKE_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() - if(NOT EXISTS "${GIT_DIR}/HEAD") - return() - endif() - set(HEAD_FILE "${GIT_DATA}/HEAD") - configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) - configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" - "${GIT_DATA}/grabRef.cmake" - @ONLY) - include("${GIT_DATA}/grabRef.cmake") + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" + @ONLY) + include("${GIT_DATA}/grabRef.cmake") - set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) - set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) endfunction() function(git_describe _var) - if(NOT GIT_FOUND) - find_package(Git QUIET) - endif() - get_git_head_revision(refspec hash) - if(NOT GIT_FOUND) - set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) - return() - endif() - if(NOT hash) - set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) - return() - endif() + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() - # TODO sanitize - #if((${ARGN}" MATCHES "&&") OR - # (ARGN MATCHES "||") OR - # (ARGN MATCHES "\\;")) - # message("Please report the following error to the project!") - # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") - #endif() + # TODO sanitize + #if((${ARGN}" MATCHES "&&") OR + # (ARGN MATCHES "||") OR + # (ARGN MATCHES "\\;")) + # message("Please report the following error to the project!") + # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") + #endif() - #message(STATUS "Arguments to execute_process: ${ARGN}") + #message(STATUS "Arguments to execute_process: ${ARGN}") - execute_process(COMMAND - "${GIT_EXECUTABLE}" - describe - ${hash} - ${ARGN} - WORKING_DIRECTORY - "${CMAKE_SOURCE_DIR}" - RESULT_VARIABLE - res - OUTPUT_VARIABLE - out - ERROR_QUIET - OUTPUT_STRIP_TRAILING_WHITESPACE) - if(NOT res EQUAL 0) - set(out "${out}-${res}-NOTFOUND") - endif() + execute_process(COMMAND + "${GIT_EXECUTABLE}" + describe + ${hash} + ${ARGN} + WORKING_DIRECTORY + "${CMAKE_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() - set(${_var} "${out}" PARENT_SCOPE) + set(${_var} "${out}" PARENT_SCOPE) endfunction() function(git_get_exact_tag _var) - git_describe(out ${ARGN}) - set(${_var} "${out}" PARENT_SCOPE) + git_describe(out ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) endfunction() -- cgit v1.2.3 From 3266cba9e0e9e3dec20bd25e836cf500967b143d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 11:32:13 +0200 Subject: cmake: fix git describe --dirty --- cmake/GetGitRevisionDescription.cmake | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/GetGitRevisionDescription.cmake index 8a7f0eeb..e4ac79c0 100644 --- a/cmake/GetGitRevisionDescription.cmake +++ b/cmake/GetGitRevisionDescription.cmake @@ -77,15 +77,15 @@ function(git_describe _var) if(NOT GIT_FOUND) find_package(Git QUIET) endif() - get_git_head_revision(refspec hash) + #get_git_head_revision(refspec hash) if(NOT GIT_FOUND) set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) return() endif() - if(NOT hash) - set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) - return() - endif() + #if(NOT hash) + # set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + # return() + #endif() # TODO sanitize #if((${ARGN}" MATCHES "&&") OR @@ -100,7 +100,6 @@ function(git_describe _var) execute_process(COMMAND "${GIT_EXECUTABLE}" describe - ${hash} ${ARGN} WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" -- cgit v1.2.3 From 96c2536411dea74dc8e60883bbd31201c18a4f17 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 11:33:06 +0200 Subject: cmake: don't regen version if none changed Fixes caused re-link of executable --- CMakeLists.txt | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 992ea9ac..b9925b4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,7 +21,7 @@ file(WRITE ${CMAKE_BINARY_DIR}/opentrack-version.h "#define OPENTRACK_VERSION \" ## start crapola -file(WRITE ${CMAKE_BINARY_DIR}/version.cc " +set(version-string " #include \"opentrack-compat/export.hpp\" #ifdef __cplusplus @@ -33,6 +33,15 @@ const char* opentrack_version; const char* opentrack_version = \"${OPENTRACK_COMMIT}\"; ") +set(crapola-ver) +if(EXISTS ${CMAKE_BINARY_DIR}/version.cc) + file(READ ${CMAKE_BINARY_DIR}/version.cc crapola-ver) +endif() + +if(NOT (crapola-ver STREQUAL version-string)) + file(WRITE ${CMAKE_BINARY_DIR}/version.cc "${version-string}") +endif() + ## end crapola SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE) -- cgit v1.2.3 From 507ad23581797779f182adc116aae5556d2d2d78 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 11:37:18 +0200 Subject: cmake: add tarball timestamp so it gets rebuilt --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b9925b4f..197bad8b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -213,12 +213,12 @@ endif() string(REPLACE "refs/heads/" "" filename-branch_1 "${filename-branch_0}") string(REPLACE "/" "-" filename-branch "${filename-branch_1}") set(filename_0 "${OPENTRACK_COMMIT}") -set(filename "${CMAKE_BINARY_DIR}/${filename_0}.zip") +string(TIMESTAMP filename_1 "%Y%m%d%H%M%S") +set(filename "${CMAKE_BINARY_DIR}/${filename_0}-${filename_1}.zip") add_custom_command(OUTPUT ${filename} COMMAND /usr/bin/env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}") add_custom_target(tarball DEPENDS "${filename}") - opentrack_module(opentrack-api opentrack) opentrack_qt(opentrack-api) add_library(opentrack-api STATIC ${opentrack-api-all}) -- cgit v1.2.3 From 97b6c47b21f5d2bfb7a43969f67d6b3ad6edab28 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 12:07:33 +0200 Subject: cmake: upload tarball to Dropbox but only if I'm the user --- CMakeLists.txt | 4 +++- make-tar.sh | 15 +++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 197bad8b..482bdb6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,7 +216,9 @@ set(filename_0 "${OPENTRACK_COMMIT}") string(TIMESTAMP filename_1 "%Y%m%d%H%M%S") set(filename "${CMAKE_BINARY_DIR}/${filename_0}-${filename_1}.zip") -add_custom_command(OUTPUT ${filename} COMMAND /usr/bin/env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}") +add_custom_command(OUTPUT ${filename} COMMAND /usr/bin/env sh + "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" + "${filename}" "${CMAKE_BINARY_DIR}") add_custom_target(tarball DEPENDS "${filename}") opentrack_module(opentrack-api opentrack) diff --git a/make-tar.sh b/make-tar.sh index 8954a4ba..e831f16a 100644 --- a/make-tar.sh +++ b/make-tar.sh @@ -2,16 +2,23 @@ prefix="$1" filename="$2" +bin="$3" -rm -fv "$filename" +cmake --build "$bin" --target install || exit 1 if : && cd $(dirname -- "${prefix}") && zip -9r "${filename}" $(basename "${prefix}") then - ls -lh -- "${filename}" - case "$(uname -s)" in - CYGWIN_*) ls -lh -- "$(cygpath -w -- "$filename")";; + case "$USER,$(uname -s)" in + # for the script see https://github.com/andreafabrizi/Dropbox-Uploader + sthalik,CYGWIN_*) + dropbox_uploader.sh -p upload "$filename" / && + l="$(dropbox_uploader.sh share "/$filename")" && + f="$(echo "$l" | tr -d '\n\r' | egrep -o 'https://[^ ]+$')" && + test -n "$f" && { echo "$f"; echo -n "$f" | putclip; } + echo -ne '\a' ;; + *) ls -lh -- "${filename}" ;; esac else rm -fv -- "${filename}" -- cgit v1.2.3 From f2607137b744b66b84be799fe56db08595c38867 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 13:02:08 +0200 Subject: pt: switch min/max point size to reals --- ftnoir_tracker_pt/FTNoIR_PT_Controls.ui | 58 ++++++++++++++------------ ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 7 ++-- ftnoir_tracker_pt/point_extractor.cpp | 4 +- 3 files changed, 37 insertions(+), 32 deletions(-) diff --git a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui index acdbda78..88575644 100644 --- a/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui +++ b/ftnoir_tracker_pt/FTNoIR_PT_Controls.ui @@ -299,19 +299,6 @@ Point extraction - - - - Maximum point diameter - - - px - - - 1024 - - - @@ -322,19 +309,6 @@ - - - - Minimum point diameter - - - px - - - 1024 - - - @@ -394,6 +368,38 @@ + + + + Maximum point diameter + + + px + + + 1 + + + 0.100000000000000 + + + + + + + Minimum point diameter + + + px + + + 1 + + + 0.100000000000000 + + + diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index 57e68d0e..d7ddb6a9 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -17,9 +17,8 @@ struct settings_pt : opts value cam_res_x, cam_res_y, cam_fps, - threshold, - min_point_size, - max_point_size; + threshold; + value min_point_size, max_point_size; value m01_x, m01_y, m01_z; value m02_x, m02_y, m02_z; @@ -42,7 +41,7 @@ struct settings_pt : opts cam_res_y(b, "camera-res-height", 480), cam_fps(b, "camera-fps", 30), threshold(b, "threshold-primary", 128), - min_point_size(b, "min-point-size", 10), + min_point_size(b, "min-point-size", 1), max_point_size(b, "max-point-size", 50), m01_x(b, "m_01-x", 0), m01_y(b, "m_01-y", 0), diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp index 0ac2fc32..77f2473c 100644 --- a/ftnoir_tracker_pt/point_extractor.cpp +++ b/ftnoir_tracker_pt/point_extractor.cpp @@ -28,8 +28,8 @@ std::vector PointExtractor::extract_points(cv::Mat& frame) cv::Mat frame_gray; cv::cvtColor(frame, frame_gray, cv::COLOR_RGB2GRAY); - const int region_size_min = s.min_point_size; - const int region_size_max = s.max_point_size; + const double region_size_min = s.min_point_size; + const double region_size_max = s.max_point_size; struct simple_blob { -- cgit v1.2.3 From f0800fee0d40b7375d3c7e7b7a7a99314c5fb251 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 13:02:26 +0200 Subject: pt: rename ill-chosen name --- ftnoir_tracker_pt/point_extractor.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp index 77f2473c..f9be259a 100644 --- a/ftnoir_tracker_pt/point_extractor.cpp +++ b/ftnoir_tracker_pt/point_extractor.cpp @@ -31,18 +31,18 @@ std::vector PointExtractor::extract_points(cv::Mat& frame) const double region_size_min = s.min_point_size; const double region_size_max = s.max_point_size; - struct simple_blob + struct blob { double radius; cv::Vec2d pos; double confid; bool taken; double area; - simple_blob(double radius, const cv::Vec2d& pos, double confid, double area) : radius(radius), pos(pos), confid(confid), taken(false), area(area) + blob(double radius, const cv::Vec2d& pos, double confid, double area) : radius(radius), pos(pos), confid(confid), taken(false), area(area) { //qDebug() << "radius" << radius << "pos" << pos[0] << pos[1] << "confid" << confid; } - bool inside(const simple_blob& other) + bool inside(const blob& other) { cv::Vec2d tmp = pos - other.pos; return sqrt(tmp.dot(tmp)) < radius; @@ -52,7 +52,7 @@ std::vector PointExtractor::extract_points(cv::Mat& frame) // mask for everything that passes the threshold (or: the upper threshold of the hysteresis) cv::Mat frame_bin = cv::Mat::zeros(H, W, CV_8U); - std::vector blobs; + std::vector blobs; std::vector> contours; const int thres = s.threshold; @@ -148,13 +148,13 @@ std::vector PointExtractor::extract_points(cv::Mat& frame) cv::putText(frame, buf, cv::Point(pos[0]+30, pos[1]+20), cv::FONT_HERSHEY_DUPLEX, 1, cv::Scalar(0, 0, 255), 1); } - blobs.push_back(simple_blob(radius, pos, confid, area)); + blobs.push_back(blob(radius, pos, confid, area)); } // clear old points points.clear(); - using b = const simple_blob; + using b = const blob; std::sort(blobs.begin(), blobs.end(), [](b& b1, b& b2) {return b1.confid > b2.confid;}); for (auto& b : blobs) -- cgit v1.2.3 From b27141f3a4e4756c8019dabbdbd49b5a7da09ef0 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 13:04:01 +0200 Subject: pt: refactor auto threshold somewhat --- ftnoir_tracker_pt/point_extractor.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp index f9be259a..a1e61f28 100644 --- a/ftnoir_tracker_pt/point_extractor.cpp +++ b/ftnoir_tracker_pt/point_extractor.cpp @@ -76,8 +76,8 @@ std::vector PointExtractor::extract_points(cv::Mat& frame) const int sz = hist.rows*hist.cols; int val = 0; int cnt = 0; - constexpr int min_pixels = 2000; - const int pixels_to_include = std::max(0, static_cast(min_pixels * (1. - s.threshold / 100.))); + constexpr int min_pixels = 250; + const auto pixels_to_include = std::max(0, min_pixels * s.threshold/100.); for (int i = sz-1; i >= 0; i--) { cnt += hist.at(i); @@ -87,8 +87,8 @@ std::vector PointExtractor::extract_points(cv::Mat& frame) break; } } - val *= .95; - //qDebug() << "cnt" << cnt << "val" << val; + val *= 240./256.; + //qDebug() << "val" << val; cv::Mat frame_bin_; cv::threshold(frame_gray, frame_bin_, val, 255, CV_THRESH_BINARY); -- cgit v1.2.3 From 6dc31bc869c44c84429f3e52a033cbc09c1d3844 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 16:31:41 +0200 Subject: pt: reformat posit --- ftnoir_tracker_pt/point_tracker.cpp | 240 ++++++++++++++++++------------------ 1 file changed, 120 insertions(+), 120 deletions(-) diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/point_tracker.cpp index cedf1979..383061c5 100644 --- a/ftnoir_tracker_pt/point_tracker.cpp +++ b/ftnoir_tracker_pt/point_tracker.cpp @@ -110,7 +110,7 @@ void PointTracker::track(const std::vector& points, const PointModel& order = find_correspondences(points, model); else order = find_correspondences_previous(points, model, f); - + POSIT(model, order, f); init_phase = false; t.start(); @@ -142,127 +142,127 @@ PointTracker::PointOrder PointTracker::find_correspondences(const std::vector and - cv::Vec2f I0_M0i(order[1][0]*(1.0 + epsilon_1) - order[0][0], - order[2][0]*(1.0 + epsilon_2) - order[0][0]); - cv::Vec2f J0_M0i(order[1][1]*(1.0 + epsilon_1) - order[0][1], - order[2][1]*(1.0 + epsilon_2) - order[0][1]); - - // construct projection of I, J onto M0i plane: I0 and J0 - I0_coeff = model.P * I0_M0i; - J0_coeff = model.P * J0_M0i; - I0 = I0_coeff[0]*model.M01 + I0_coeff[1]*model.M02; - J0 = J0_coeff[0]*model.M01 + J0_coeff[1]*model.M02; - - // calculate u component of I, J - float II0 = I0.dot(I0); - float IJ0 = I0.dot(J0); - float JJ0 = J0.dot(J0); - float rho, theta; - if (JJ0 == II0) { - rho = std::sqrt(std::abs(2*IJ0)); - theta = -PI/4; - if (IJ0<0) theta *= -1; - } - else { - rho = sqrt(sqrt( (JJ0-II0)*(JJ0-II0) + 4*IJ0*IJ0 )); - theta = atan( -2*IJ0 / (JJ0-II0) ); - if (JJ0 - II0 < 0) theta += PI; - theta /= 2; - } - - // construct the two solutions - I_1 = I0 + rho*cos(theta)*model.u; - I_2 = I0 - rho*cos(theta)*model.u; - - J_1 = J0 + rho*sin(theta)*model.u; - J_2 = J0 - rho*sin(theta)*model.u; - - float norm_const = 1.0/cv::norm(I_1); // all have the same norm - - // create rotation matrices - I_1 *= norm_const; J_1 *= norm_const; - I_2 *= norm_const; J_2 *= norm_const; - - set_row(R_1, 0, I_1); - set_row(R_1, 1, J_1); - set_row(R_1, 2, I_1.cross(J_1)); - - set_row(R_2, 0, I_2); - set_row(R_2, 1, J_2); - set_row(R_2, 2, I_2.cross(J_2)); - - // the single translation solution - Z0 = norm_const * focal_length; - - // pick the rotation solution closer to the expected one - // in simple metric d(A,B) = || I - A * B^T || - float R_1_deviation = cv::norm(cv::Matx33f::eye() - R_expected * R_1.t()); - float R_2_deviation = cv::norm(cv::Matx33f::eye() - R_expected * R_2.t()); - - if (R_1_deviation < R_2_deviation) - R_current = &R_1; - else - R_current = &R_2; - - get_row(*R_current, 2, k); - - // check for convergence condition - if (std::abs(epsilon_1 - old_epsilon_1) + std::abs(epsilon_2 - old_epsilon_2) < EPS_THRESHOLD) - break; - old_epsilon_1 = epsilon_1; - old_epsilon_2 = epsilon_2; - } - - // apply results - X_CM.R = *R_current; - X_CM.t[0] = order[0][0] * Z0/focal_length; - X_CM.t[1] = order[0][1] * Z0/focal_length; - X_CM.t[2] = Z0; - - //qDebug() << "iter:" << i; - - return i; + // POSIT algorithm for coplanar points as presented in + // [Denis Oberkampf, Daniel F. DeMenthon, Larry S. Davis: "Iterative Pose Estimation Using Coplanar Feature Points"] + // we use the same notation as in the paper here + + // The expected rotation used for resolving the ambiguity in POSIT: + // In every iteration step the rotation closer to R_expected is taken + cv::Matx33f R_expected = cv::Matx33f::eye(); + + // initial pose = last (predicted) pose + cv::Vec3f k; + get_row(R_expected, 2, k); + float Z0 = 1000.f; + + float old_epsilon_1 = 0; + float old_epsilon_2 = 0; + float epsilon_1 = 1; + float epsilon_2 = 1; + + cv::Vec3f I0, J0; + cv::Vec2f I0_coeff, J0_coeff; + + cv::Vec3f I_1, J_1, I_2, J_2; + cv::Matx33f R_1, R_2; + cv::Matx33f* R_current; + + const int MAX_ITER = 100; + const float EPS_THRESHOLD = 1e-4; + + const cv::Vec2f* order = order_.points; + + int i=1; + for (; i and + cv::Vec2f I0_M0i(order[1][0]*(1.0 + epsilon_1) - order[0][0], + order[2][0]*(1.0 + epsilon_2) - order[0][0]); + cv::Vec2f J0_M0i(order[1][1]*(1.0 + epsilon_1) - order[0][1], + order[2][1]*(1.0 + epsilon_2) - order[0][1]); + + // construct projection of I, J onto M0i plane: I0 and J0 + I0_coeff = model.P * I0_M0i; + J0_coeff = model.P * J0_M0i; + I0 = I0_coeff[0]*model.M01 + I0_coeff[1]*model.M02; + J0 = J0_coeff[0]*model.M01 + J0_coeff[1]*model.M02; + + // calculate u component of I, J + float II0 = I0.dot(I0); + float IJ0 = I0.dot(J0); + float JJ0 = J0.dot(J0); + float rho, theta; + if (JJ0 == II0) { + rho = std::sqrt(std::abs(2*IJ0)); + theta = -PI/4; + if (IJ0<0) theta *= -1; + } + else { + rho = sqrt(sqrt( (JJ0-II0)*(JJ0-II0) + 4*IJ0*IJ0 )); + theta = atan( -2*IJ0 / (JJ0-II0) ); + if (JJ0 - II0 < 0) theta += PI; + theta /= 2; + } + + // construct the two solutions + I_1 = I0 + rho*cos(theta)*model.u; + I_2 = I0 - rho*cos(theta)*model.u; + + J_1 = J0 + rho*sin(theta)*model.u; + J_2 = J0 - rho*sin(theta)*model.u; + + float norm_const = 1.0/cv::norm(I_1); // all have the same norm + + // create rotation matrices + I_1 *= norm_const; J_1 *= norm_const; + I_2 *= norm_const; J_2 *= norm_const; + + set_row(R_1, 0, I_1); + set_row(R_1, 1, J_1); + set_row(R_1, 2, I_1.cross(J_1)); + + set_row(R_2, 0, I_2); + set_row(R_2, 1, J_2); + set_row(R_2, 2, I_2.cross(J_2)); + + // the single translation solution + Z0 = norm_const * focal_length; + + // pick the rotation solution closer to the expected one + // in simple metric d(A,B) = || I - A * B^T || + float R_1_deviation = cv::norm(cv::Matx33f::eye() - R_expected * R_1.t()); + float R_2_deviation = cv::norm(cv::Matx33f::eye() - R_expected * R_2.t()); + + if (R_1_deviation < R_2_deviation) + R_current = &R_1; + else + R_current = &R_2; + + get_row(*R_current, 2, k); + + // check for convergence condition + if (std::abs(epsilon_1 - old_epsilon_1) + std::abs(epsilon_2 - old_epsilon_2) < EPS_THRESHOLD) + break; + old_epsilon_1 = epsilon_1; + old_epsilon_2 = epsilon_2; + } + + // apply results + X_CM.R = *R_current; + X_CM.t[0] = order[0][0] * Z0/focal_length; + X_CM.t[1] = order[0][1] * Z0/focal_length; + X_CM.t[2] = Z0; + + //qDebug() << "iter:" << i; + + return i; } cv::Vec2f PointTracker::project(const cv::Vec3f& v_M, float f) { - cv::Vec3f v_C = X_CM * v_M; - return cv::Vec2f(f*v_C[0]/v_C[2], f*v_C[1]/v_C[2]); + cv::Vec3f v_C = X_CM * v_M; + return cv::Vec2f(f*v_C[0]/v_C[2], f*v_C[1]/v_C[2]); } -- cgit v1.2.3 From 22857e786cd7462eb087cf039cefd36076784280 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 17 Oct 2015 17:15:53 +0200 Subject: pt: reformat more --- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 42 ++++++++++---------- ftnoir_tracker_pt/point_tracker.cpp | 68 ++++++++++++++++----------------- 2 files changed, 55 insertions(+), 55 deletions(-) diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 19d1bd7f..11fe64cc 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -19,8 +19,8 @@ Tracker_PT::Tracker_PT() : mutex(QMutex::Recursive), commands(0), - video_widget(NULL), - video_frame(NULL), + video_widget(NULL), + video_frame(NULL), ever_success(false) { connect(s.b.get(), SIGNAL(saving()), this, SLOT(apply_settings())); @@ -28,8 +28,8 @@ Tracker_PT::Tracker_PT() Tracker_PT::~Tracker_PT() { - set_command(ABORT); - wait(); + set_command(ABORT); + wait(); delete video_widget; video_widget = NULL; if (video_frame->layout()) delete video_frame->layout(); @@ -39,13 +39,13 @@ Tracker_PT::~Tracker_PT() void Tracker_PT::set_command(Command command) { //QMutexLocker lock(&mutex); - commands |= command; + commands |= command; } void Tracker_PT::reset_command(Command command) { //QMutexLocker lock(&mutex); - commands &= ~command; + commands &= ~command; } bool Tracker_PT::get_focal_length(float& ret) @@ -69,13 +69,13 @@ bool Tracker_PT::get_focal_length(float& ret) void Tracker_PT::run() { #ifdef PT_PERF_LOG - QFile log_file(QCoreApplication::applicationDirPath() + "/PointTrackerPerformance.txt"); - if (!log_file.open(QIODevice::WriteOnly | QIODevice::Text)) return; - QTextStream log_stream(&log_file); + QFile log_file(QCoreApplication::applicationDirPath() + "/PointTrackerPerformance.txt"); + if (!log_file.open(QIODevice::WriteOnly | QIODevice::Text)) return; + QTextStream log_stream(&log_file); #endif apply_settings(); - + while((commands & ABORT) == 0) { const double dt = time.elapsed() * 1e-9; @@ -97,20 +97,20 @@ void Tracker_PT::run() // blobs are sorted in order of circularity if (points.size() > PointModel::N_POINTS) points.resize(PointModel::N_POINTS); - + bool success = points.size() == PointModel::N_POINTS; - + ever_success |= success; float fx; if (!get_focal_length(fx)) continue; - + if (success) { point_tracker.track(points, PointModel(s), fx, s.dynamic_pose, s.init_phase_timeout); } - + { Affine X_CM = pose(); Affine X_MH(cv::Matx33f::eye(), cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z)); // just copy pasted these lines from below @@ -119,7 +119,7 @@ void Tracker_PT::run() cv::Vec2f p_(p[0] / p[2] * fx, p[1] / p[2] * fx); // projected to screen points.push_back(p_); } - + for (unsigned i = 0; i < points.size(); i++) { auto& p = points[i]; @@ -138,7 +138,7 @@ void Tracker_PT::run() color, 4); } - + video_widget->update_image(frame); } #ifdef PT_PERF_LOG @@ -181,26 +181,26 @@ void Tracker_PT::data(double *data) if (ever_success) { Affine X_CM = pose(); - + Affine X_MH(cv::Matx33f::eye(), cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z)); Affine X_GH = X_CM * X_MH; - + cv::Matx33f R = X_GH.R; cv::Vec3f t = X_GH.t; - + // translate rotation matrix from opengl (G) to roll-pitch-yaw (E) frame // -z -> x, y -> z, x -> -y cv::Matx33f R_EG(0, 0,-1, -1, 0, 0, 0, 1, 0); R = R_EG * R * R_EG.t(); - + // extract rotation angles float alpha, beta, gamma; beta = atan2( -R(2,0), sqrt(R(2,1)*R(2,1) + R(2,2)*R(2,2)) ); alpha = atan2( R(1,0), R(0,0)); gamma = atan2( R(2,1), R(2,2)); - + // extract rotation angles data[Yaw] = rad2deg * alpha; data[Pitch] = -rad2deg * beta; diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/point_tracker.cpp index 383061c5..cec107cf 100644 --- a/ftnoir_tracker_pt/point_tracker.cpp +++ b/ftnoir_tracker_pt/point_tracker.cpp @@ -18,16 +18,16 @@ const float PI = 3.14159265358979323846f; // ---------------------------------------------------------------------------- static void get_row(const cv::Matx33f& m, int i, cv::Vec3f& v) { - v[0] = m(i,0); - v[1] = m(i,1); - v[2] = m(i,2); + v[0] = m(i,0); + v[1] = m(i,1); + v[2] = m(i,2); } static void set_row(cv::Matx33f& m, int i, const cv::Vec3f& v) { - m(i,0) = v[0]; - m(i,1) = v[1]; - m(i,2) = v[2]; + m(i,0) = v[0]; + m(i,1) = v[1]; + m(i,2) = v[2]; } static bool d_vals_sort(const std::pair a, const std::pair b) @@ -67,31 +67,31 @@ PointTracker::PointOrder PointTracker::find_correspondences_previous(const std:: // set correspondences by minimum distance to projected model point bool point_taken[PointModel::N_POINTS]; for (int i=0; i& points, const PointModel& { PointOrder order; - if (t.elapsed_ms() > init_phase_timeout) - { - t.start(); - init_phase = true; - } + if (t.elapsed_ms() > init_phase_timeout) + { + t.start(); + init_phase = true; + } if (!dynamic_pose || init_phase) order = find_correspondences(points, model); - else - order = find_correspondences_previous(points, model, f); + else + order = find_correspondences_previous(points, model, f); POSIT(model, order, f); - init_phase = false; + init_phase = false; t.start(); } -- cgit v1.2.3 From 297794e9a885c7e0574462aa27e23a90bc84f039 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Oct 2015 05:44:18 +0200 Subject: qfc: elide NaN values --- qfunctionconfigurator/functionconfig.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 33f9beee..8c0bbc9f 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -67,6 +67,18 @@ static bool sortFn(const QPointF& one, const QPointF& two) { return one.x() < two.x(); } +static inline bool nanp(double value) +{ + return std::isnan(value) || std::isinf(value); +} + +static inline double elide_nan(double value) +{ + if (nanp(value)) + return -1; + return value; +} + void Map::reload() { if (cur.input.size()) { @@ -124,7 +136,7 @@ void Map::reload() { (-p0_y + 3. * p1_y - 3. * p2_y + p3_y) * t3); if (x >= 0 && x < sz) - data[x] = y; + data[x] = elide_nan(y); } } -- cgit v1.2.3 From f3c34824ffec671976a411567e47e4be54f48790 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Oct 2015 05:44:51 +0200 Subject: accela: elide NaN output values --- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index ab5fda07..2fb00739 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -58,15 +58,32 @@ FTNoIR_Filter::FTNoIR_Filter() : first_run(true) } } +static inline bool nanp(double value) +{ + return std::isnan(value) || std::isinf(value); +} + +static inline double elide_nan(double value, double def) +{ + if (nanp(value)) + { + if (nanp(def)) + return 0; + return def; + } + return value; +} + void FTNoIR_Filter::filter(const double* input, double *output) { if (first_run) { for (int i = 0; i < 6; i++) { - output[i] = input[i]; - last_output[i] = input[i]; - smoothed_input[i] = input[i]; + const double f = nanp(input[i]) ? 0 : input[i]; + output[i] = f; + last_output[i] = f; + smoothed_input[i] = f; } first_run = false; t.start(); @@ -104,7 +121,7 @@ void FTNoIR_Filter::filter(const double* input, double *output) : result >= in; const double ret = done ? in : result; - last_output[i] = output[i] = ret; + last_output[i] = output[i] = elide_nan(ret, last_output[i]); } } -- cgit v1.2.3 From bcf12504559ff6acce3d6ea3020fbe8430ac64cc Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Oct 2015 09:02:11 +0200 Subject: cmake: fix tarball invocation --- make-tar.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/make-tar.sh b/make-tar.sh index e831f16a..82afd67e 100644 --- a/make-tar.sh +++ b/make-tar.sh @@ -4,6 +4,7 @@ prefix="$1" filename="$2" bin="$3" +cmake "$bin" || exit 1 cmake --build "$bin" --target install || exit 1 if : && @@ -13,10 +14,12 @@ then case "$USER,$(uname -s)" in # for the script see https://github.com/andreafabrizi/Dropbox-Uploader sthalik,CYGWIN_*) - dropbox_uploader.sh -p upload "$filename" / && - l="$(dropbox_uploader.sh share "/$filename")" && - f="$(echo "$l" | tr -d '\n\r' | egrep -o 'https://[^ ]+$')" && - test -n "$f" && { echo "$f"; echo -n "$f" | putclip; } + set -x + dropbox_uploader.sh -p upload "$filename" / + l="$(dropbox_uploader.sh -q share "/$filename")" + set +x + test -n "$l" && echo -n "$l" | putclip + echo $l echo -ne '\a' ;; *) ls -lh -- "${filename}" ;; esac -- cgit v1.2.3 From de79ef90a6a16854709ecf7bfe8b713c4b5d382a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Oct 2015 09:02:23 +0200 Subject: accela: also don't poison ewma state with nans --- ftnoir_filter_accela/ftnoir_filter_accela.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ftnoir_filter_accela/ftnoir_filter_accela.cpp b/ftnoir_filter_accela/ftnoir_filter_accela.cpp index 2fb00739..9bac5d58 100644 --- a/ftnoir_filter_accela/ftnoir_filter_accela.cpp +++ b/ftnoir_filter_accela/ftnoir_filter_accela.cpp @@ -105,7 +105,7 @@ void FTNoIR_Filter::filter(const double* input, double *output) { Map& m = i >= 3 ? rot : trans; - smoothed_input[i] = smoothed_input[i] * (1.-alpha) + input[i] * alpha; + smoothed_input[i] = smoothed_input[i] * (1.-alpha) + elide_nan(input[i], smoothed_input[i]) * alpha; const double in = smoothed_input[i]; -- cgit v1.2.3 From c89a1d04630cf7e334fa36b01c9240f0bc0b82c6 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Oct 2015 09:32:46 +0200 Subject: pt: use previous pose on NaN result from POSIT This will reset dynamic pose resolution if the error persists. --- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 35 ++++++++++++++++++++++++++++++--- ftnoir_tracker_pt/point_tracker.h | 4 ++++ 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 11fe64cc..29b32dad 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -66,6 +66,11 @@ bool Tracker_PT::get_focal_length(float& ret) return false; } +static inline bool nanp(double value) +{ + return std::isnan(value) || std::isinf(value); +} + void Tracker_PT::run() { #ifdef PT_PERF_LOG @@ -100,19 +105,43 @@ void Tracker_PT::run() bool success = points.size() == PointModel::N_POINTS; - ever_success |= success; - float fx; if (!get_focal_length(fx)) continue; + Affine X_CM_ = pose(); + if (success) { point_tracker.track(points, PointModel(s), fx, s.dynamic_pose, s.init_phase_timeout); } + + Affine X_CM = pose(); + + { + int j = 0; + + for (int i = 0; i < 3; i++) + { + if (nanp(X_CM.t(i))) + goto nannan; + for (; j < 3; j++) + if (nanp(X_CM.R(i, j))) + { +nannan: success = false; + X_CM = X_CM_; + { + QMutexLocker lock(&mutex); + point_tracker.reset(X_CM_); + } + goto nannannan; + } + } + } + +nannannan: ever_success |= success; { - Affine X_CM = pose(); Affine X_MH(cv::Matx33f::eye(), cv::Vec3f(s.t_MH_x, s.t_MH_y, s.t_MH_z)); // just copy pasted these lines from below Affine X_GH = X_CM * X_MH; cv::Vec3f p = X_GH.t; // head (center?) position in global space diff --git a/ftnoir_tracker_pt/point_tracker.h b/ftnoir_tracker_pt/point_tracker.h index cdcf2998..fd002948 100644 --- a/ftnoir_tracker_pt/point_tracker.h +++ b/ftnoir_tracker_pt/point_tracker.h @@ -118,6 +118,10 @@ public: void track(const std::vector& projected_points, const PointModel& model, float f, bool dynamic_pose, int init_phase_timeout); Affine pose() const { return X_CM; } cv::Vec2f project(const cv::Vec3f& v_M, float f); + void reset(const Affine& pose) + { + X_CM = pose; + } private: // the points in model order struct PointOrder -- cgit v1.2.3 From 55de6ead40cd7120cfd798715cbfc57eb05b417d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Oct 2015 09:33:24 +0200 Subject: tracker: initialize newpose In newpose[i] = elide_nan(tmp[i], newpose[i]); uninitialized memory can be used. --- opentrack/tracker.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/opentrack/tracker.cpp b/opentrack/tracker.cpp index ad10e396..6411db40 100644 --- a/opentrack/tracker.cpp +++ b/opentrack/tracker.cpp @@ -24,6 +24,7 @@ Tracker::Tracker(main_settings& s, Mappings &m, SelectedLibraries &libs) : s(s), m(m), + newpose {0,0,0, 0,0,0}, centerp(s.center_at_startup), enabledp(true), zero_(false), @@ -254,7 +255,7 @@ void Tracker::run() { double tmp[6] {0,0,0, 0,0,0}; libs.pTracker->data(tmp); - + if (enabledp) for (int i = 0; i < 6; i++) newpose[i] = elide_nan(tmp[i], newpose[i]); -- cgit v1.2.3 From 14d27dd0998b18a2eb13d30c8680701a9b619a08 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Oct 2015 09:38:10 +0200 Subject: cmake: fix dropbox share invocation --- make-tar.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/make-tar.sh b/make-tar.sh index 82afd67e..9d1af1f3 100644 --- a/make-tar.sh +++ b/make-tar.sh @@ -14,10 +14,9 @@ then case "$USER,$(uname -s)" in # for the script see https://github.com/andreafabrizi/Dropbox-Uploader sthalik,CYGWIN_*) - set -x dropbox_uploader.sh -p upload "$filename" / - l="$(dropbox_uploader.sh -q share "/$filename")" - set +x + bn="$(basename -- "$filename")" + l="$(dropbox_uploader.sh -q share /"$bn")" test -n "$l" && echo -n "$l" | putclip echo $l echo -ne '\a' ;; -- cgit v1.2.3 From f1e71e68512bc58f3f41ba4566f9d1574773d742 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 18 Oct 2015 09:44:47 +0200 Subject: cmake: regen before making tarball Updates timestamp as it should. --- CMakeLists.txt | 9 +++++---- cmake/tarball.cmake | 8 ++++++++ make-tar.sh | 1 - 3 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 cmake/tarball.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 482bdb6c..78d9cab8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -216,10 +216,11 @@ set(filename_0 "${OPENTRACK_COMMIT}") string(TIMESTAMP filename_1 "%Y%m%d%H%M%S") set(filename "${CMAKE_BINARY_DIR}/${filename_0}-${filename_1}.zip") -add_custom_command(OUTPUT ${filename} COMMAND /usr/bin/env sh - "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" - "${filename}" "${CMAKE_BINARY_DIR}") -add_custom_target(tarball DEPENDS "${filename}") +add_custom_target(tarball-real) +add_custom_target(tarball-real2) +add_custom_command(TARGET tarball-real COMMAND cmake -P ${CMAKE_SOURCE_DIR}/cmake/tarball.cmake) +add_custom_command(TARGET tarball-real2 COMMAND /usr/bin/env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}" "${CMAKE_BINARY_DIR}") +add_custom_target(tarball DEPENDS tarball-real) opentrack_module(opentrack-api opentrack) opentrack_qt(opentrack-api) diff --git a/cmake/tarball.cmake b/cmake/tarball.cmake new file mode 100644 index 00000000..5761e24a --- /dev/null +++ b/cmake/tarball.cmake @@ -0,0 +1,8 @@ +execute_process(COMMAND cmake ${CMAKE_BINARY_DIR} RESULT_VARIABLE ret) +if(NOT ret EQUAL 0) + message(FATAL_ERROR "can't regen") +endif() +execute_process(COMMAND cmake --build ${CMAKE_BINARY_DIR} --target tarball-real2) +if(NOT ret EQUAL 0) + message(FATAL_ERROR "can't make tarball") +endif() diff --git a/make-tar.sh b/make-tar.sh index 9d1af1f3..3e119d12 100644 --- a/make-tar.sh +++ b/make-tar.sh @@ -4,7 +4,6 @@ prefix="$1" filename="$2" bin="$3" -cmake "$bin" || exit 1 cmake --build "$bin" --target install || exit 1 if : && -- cgit v1.2.3 From 6186f49000e6895b03661cd01c3f1c9c5950577a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 03:23:57 +0200 Subject: all: comments only --- facetracknoir/main.cpp | 2 +- ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp | 2 +- ftnoir_tracker_aruco/trans_calib.cpp | 1 - ftnoir_tracker_pt/point_tracker.cpp | 1 - opentrack-compat/shm.cpp | 5 ++++- opentrack-compat/sleep.hpp | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/facetracknoir/main.cpp b/facetracknoir/main.cpp index 45483a68..a63fe54a 100644 --- a/facetracknoir/main.cpp +++ b/facetracknoir/main.cpp @@ -42,7 +42,7 @@ int main(int argc, char** argv) // qt5 designer-made controls look like shit on 'doze -sh 20140921 // also our OSX look leaves a lot to be desired -sh 20150726 { - const QStringList preferred { "fusion", "windowsvista", "jazzbands'-marijuana", "macintosh", "windowsxp" }; + const QStringList preferred { "fusion", "windowsvista", "macintosh", "windowsxp" }; for (const auto& style_name : preferred) { QStyle* s = QStyleFactory::create(style_name); diff --git a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp index d77df027..702a92d4 100644 --- a/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp +++ b/ftnoir_protocol_fsuipc/ftnoir_protocol_fsuipc.cpp @@ -114,7 +114,7 @@ void FTNoIR_Protocol::pose(const double *headpose ) { // FSUIPC checks for already open connections and returns FSUIPC_ERR_OPEN in that case // the connection scope is global for the process. this is why above code doesn't // leak resources or have logic errors. see: http://www.purebasic.fr/english/viewtopic.php?t=31112 - FSUIPC_Close(); //timeout (1 second) so assume FS closed + FSUIPC_Close(); } } } diff --git a/ftnoir_tracker_aruco/trans_calib.cpp b/ftnoir_tracker_aruco/trans_calib.cpp index 176cf24c..b5148efd 100644 --- a/ftnoir_tracker_aruco/trans_calib.cpp +++ b/ftnoir_tracker_aruco/trans_calib.cpp @@ -7,7 +7,6 @@ #include "trans_calib.h" -//----------------------------------------------------------------------------- TranslationCalibrator::TranslationCalibrator() { reset(); diff --git a/ftnoir_tracker_pt/point_tracker.cpp b/ftnoir_tracker_pt/point_tracker.cpp index cec107cf..924b75de 100644 --- a/ftnoir_tracker_pt/point_tracker.cpp +++ b/ftnoir_tracker_pt/point_tracker.cpp @@ -15,7 +15,6 @@ const float PI = 3.14159265358979323846f; -// ---------------------------------------------------------------------------- static void get_row(const cv::Matx33f& m, int i, cv::Vec3f& v) { v[0] = m(i,0); diff --git a/opentrack-compat/shm.cpp b/opentrack-compat/shm.cpp index b18a9933..029a4c95 100644 --- a/opentrack-compat/shm.cpp +++ b/opentrack-compat/shm.cpp @@ -43,10 +43,13 @@ void PortableLockedShm::unlock() (void) ReleaseMutex(hMutex); } #else + +#include + #pragma GCC diagnostic ignored "-Wunused-result" PortableLockedShm::PortableLockedShm(const char *shmName, const char* /*mutexName*/, int mapSize) : size(mapSize) { - char filename[512] = {0}; + char filename[PATH_MAX+2] = {0}; strcpy(filename, "/"); strcat(filename, shmName); fd = shm_open(filename, O_RDWR | O_CREAT, 0600); diff --git a/opentrack-compat/sleep.hpp b/opentrack-compat/sleep.hpp index 27920842..e7c70285 100644 --- a/opentrack-compat/sleep.hpp +++ b/opentrack-compat/sleep.hpp @@ -3,7 +3,7 @@ namespace portable { #ifdef _WIN32 - #include +# include template void sleep(unsigned milliseconds) -- cgit v1.2.3 From d9746e7d4c4f7ed687c23b746914a9c5af8e9b49 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 03:24:30 +0200 Subject: all: update copyright where appropriate --- ftnoir_protocol_sc/ftnoir_protocol_sc.cpp | 26 ++++++++++++++----------- ftnoir_tracker_pt/ftnoir_tracker_pt.cpp | 1 + ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp | 1 + ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h | 1 + ftnoir_tracker_pt/point_extractor.cpp | 1 + ftnoir_tracker_pt/pt_video_widget.cpp | 1 + opentrack-compat/process-list.hpp | 7 +++++++ opentrack/shortcuts.cpp | 2 +- opentrack/win32-shortcuts.cpp | 8 ++++++++ qfunctionconfigurator/functionconfig.cpp | 8 ++++++++ qfunctionconfigurator/functionconfig.h | 2 +- qfunctionconfigurator/qfunctionconfigurator.cpp | 7 +++++++ qfunctionconfigurator/qfunctionconfigurator.h | 2 +- 13 files changed, 53 insertions(+), 14 deletions(-) diff --git a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp index 5d7ab778..0c6cb486 100644 --- a/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp +++ b/ftnoir_protocol_sc/ftnoir_protocol_sc.cpp @@ -1,9 +1,13 @@ -/* Copyright (c) 2015 Stanislaw Halik - * Copyright (c) 2015 Wim Vriend - * - * Permission to use, copy, modify, and/or distribute this software for any - * purpose with or without fee is hereby granted, provided that the above - * copyright notice and this permission notice appear in all copies. +/* Homepage http://facetracknoir.sourceforge.net/home/default.htm * + * * + * ISC License (ISC) * + * * + * Copyright (c) 2015, Wim Vriend + * Copyright (c) 2014, Stanislaw Halik + * * + * Permission to use, copy, modify, and/or distribute this software for any * + * purpose with or without fee is hereby granted, provided that the above * + * copyright notice and this permission notice appear in all copies. * */ #include "ftnoir_protocol_sc.h" #include "opentrack/plugin-api.hpp" @@ -80,7 +84,7 @@ public: # define PREFIX "" #else # define PREFIX "lib" -#endif +#endif QString path = QCoreApplication::applicationDirPath() + "/" PREFIX "opentrack-proto-simconnect.dll"; QByteArray name = QFile::encodeName(path); actx.lpSource = name.constData(); @@ -113,11 +117,11 @@ private: }; bool FTNoIR_Protocol::correct() -{ - if (!SCClientLib.isLoaded()) +{ + if (!SCClientLib.isLoaded()) { ActivationContext ctx(142 + static_cast(s.sxs_manifest)); - + if (ctx.is_ok()) { SCClientLib.setFileName("SimConnect.dll"); @@ -171,7 +175,7 @@ void FTNoIR_Protocol::handle() void CALLBACK FTNoIR_Protocol::processNextSimconnectEvent(SIMCONNECT_RECV* pData, DWORD, void *self_) { FTNoIR_Protocol& self = *reinterpret_cast(self_); - + switch(pData->dwID) { default: diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp index 29b32dad..2db5006c 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt.cpp @@ -1,4 +1,5 @@ /* Copyright (c) 2012 Patrick Ruoff + * Copyright (c) 2014-2015 Stanislaw Halik * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp index da7a6113..b1ae2238 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_dialog.cpp @@ -1,4 +1,5 @@ /* Copyright (c) 2012 Patrick Ruoff + * Copyright (c) 2014-2015 Stanislaw Halik * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h index d7ddb6a9..85eec8f9 100644 --- a/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h +++ b/ftnoir_tracker_pt/ftnoir_tracker_pt_settings.h @@ -1,4 +1,5 @@ /* Copyright (c) 2012 Patrick Ruoff + * Copyright (c) 2014-2015 Stanislaw Halik * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/ftnoir_tracker_pt/point_extractor.cpp b/ftnoir_tracker_pt/point_extractor.cpp index a1e61f28..ec37dd00 100644 --- a/ftnoir_tracker_pt/point_extractor.cpp +++ b/ftnoir_tracker_pt/point_extractor.cpp @@ -1,4 +1,5 @@ /* Copyright (c) 2012 Patrick Ruoff + * Copyright (c) 2014-2015 Stanislaw Halik * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/ftnoir_tracker_pt/pt_video_widget.cpp b/ftnoir_tracker_pt/pt_video_widget.cpp index 9f2b90f6..cbb7c268 100644 --- a/ftnoir_tracker_pt/pt_video_widget.cpp +++ b/ftnoir_tracker_pt/pt_video_widget.cpp @@ -1,4 +1,5 @@ /* Copyright (c) 2012 Patrick Ruoff + * Copyright (c) 2015 Stanislaw Halik * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above diff --git a/opentrack-compat/process-list.hpp b/opentrack-compat/process-list.hpp index 65735740..ef3b325f 100644 --- a/opentrack-compat/process-list.hpp +++ b/opentrack-compat/process-list.hpp @@ -1,3 +1,10 @@ +/* Copyright (c) 2015 Stanislaw Halik + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + */ + #pragma once #include diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp index 3ad8e9be..718dd778 100644 --- a/opentrack/shortcuts.cpp +++ b/opentrack/shortcuts.cpp @@ -1,4 +1,4 @@ -/* Copyright (c) 2014, Stanislaw Halik +/* Copyright (c) 2014-2015, Stanislaw Halik * Permission to use, copy, modify, and/or distribute this * software for any purpose with or without fee is hereby granted, diff --git a/opentrack/win32-shortcuts.cpp b/opentrack/win32-shortcuts.cpp index feaf6036..96232631 100644 --- a/opentrack/win32-shortcuts.cpp +++ b/opentrack/win32-shortcuts.cpp @@ -1,3 +1,11 @@ +/* Copyright (c) 2015, Stanislaw Halik + + * Permission to use, copy, modify, and/or distribute this + * software for any purpose with or without fee is hereby granted, + * provided that the above copyright notice and this permission + * notice appear in all copies. + */ + #if defined(_WIN32) # ifndef DIRECTINPUT_VERSION # define DIRECTINPUT_VERSION 0x800 diff --git a/qfunctionconfigurator/functionconfig.cpp b/qfunctionconfigurator/functionconfig.cpp index 8c0bbc9f..cac8121c 100644 --- a/qfunctionconfigurator/functionconfig.cpp +++ b/qfunctionconfigurator/functionconfig.cpp @@ -1,3 +1,11 @@ +/* Copyright (c) 2012-2015, Stanislaw Halik + + * Permission to use, copy, modify, and/or distribute this + * software for any purpose with or without fee is hereby granted, + * provided that the above copyright notice and this permission + * notice appear in all copies. + */ + #include #include #include diff --git a/qfunctionconfigurator/functionconfig.h b/qfunctionconfigurator/functionconfig.h index 31aebdf6..6d76d0de 100644 --- a/qfunctionconfigurator/functionconfig.h +++ b/qfunctionconfigurator/functionconfig.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014, Stanislaw Halik +/* Copyright (c) 2012-2015, Stanislaw Halik * Permission to use, copy, modify, and/or distribute this * software for any purpose with or without fee is hereby granted, diff --git a/qfunctionconfigurator/qfunctionconfigurator.cpp b/qfunctionconfigurator/qfunctionconfigurator.cpp index e62049db..bcb895ec 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.cpp +++ b/qfunctionconfigurator/qfunctionconfigurator.cpp @@ -1,3 +1,10 @@ +/* Copyright (c) 2012-2015 Stanislaw Halik + * + * Permission to use, copy, modify, and/or distribute this software for any + * purpose with or without fee is hereby granted, provided that the above + * copyright notice and this permission notice appear in all copies. + */ + #include "opentrack/options.hpp" using namespace options; #include "qfunctionconfigurator/qfunctionconfigurator.h" diff --git a/qfunctionconfigurator/qfunctionconfigurator.h b/qfunctionconfigurator/qfunctionconfigurator.h index 8957c898..667886cd 100644 --- a/qfunctionconfigurator/qfunctionconfigurator.h +++ b/qfunctionconfigurator/qfunctionconfigurator.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2011-2014 Stanislaw Halik +/* Copyright (c) 2012-2015 Stanislaw Halik * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above -- cgit v1.2.3 From 7eab0fc411abe57f6623f42fe984fd3d0cceca32 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 05:39:41 +0200 Subject: cmake: no timestamp for tag builds --- CMakeLists.txt | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 78d9cab8..564fc736 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,6 +15,7 @@ include(GetGitRevisionDescription) find_package(Git QUIET) if(GIT_FOUND) git_describe(OPENTRACK_COMMIT --tags --always --dirty) + git_describe(OPENTRACK_TAG_EXACT --tag --exact) endif() file(WRITE ${CMAKE_BINARY_DIR}/opentrack-version.h "#define OPENTRACK_VERSION \"${OPENTRACK_COMMIT}\"") @@ -198,11 +199,7 @@ if(NOT WIN32) set(SDK_WINE_NO_WRAPPER FALSE CACHE BOOL "disable Wine wrapper -- use Wine only for X-Plane") endif() -# ---- - -# misc - -# ---- +# --- tarball string(TIMESTAMP filename-date "%Y%m%d") set(filename-ostype ${CMAKE_SYSTEM_NAME}) @@ -213,15 +210,26 @@ endif() string(REPLACE "refs/heads/" "" filename-branch_1 "${filename-branch_0}") string(REPLACE "/" "-" filename-branch "${filename-branch_1}") set(filename_0 "${OPENTRACK_COMMIT}") -string(TIMESTAMP filename_1 "%Y%m%d%H%M%S") -set(filename "${CMAKE_BINARY_DIR}/${filename_0}-${filename_1}.zip") +set(filename_1) +if(is_exact_p EQUAL 0) + string(TIMESTAMP filename_1 "-%Y%m%d%H%M%S") +endif() +set(filename "${CMAKE_BINARY_DIR}/${filename_0}${filename_1}.zip") add_custom_target(tarball-real) add_custom_target(tarball-real2) add_custom_command(TARGET tarball-real COMMAND cmake -P ${CMAKE_SOURCE_DIR}/cmake/tarball.cmake) -add_custom_command(TARGET tarball-real2 COMMAND /usr/bin/env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" "${filename}" "${CMAKE_BINARY_DIR}") +set(is-exact-p 0) +if (OPENTRACK_TAG_EXACT STREQUAL OPENTRACK_COMMIT) + set(is-exact-p 1) +endif() +add_custom_command(TARGET tarball-real2 COMMAND /usr/bin/env sh + "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" + "${filename}" "${CMAKE_BINARY_DIR}" ${is-exact-p}) add_custom_target(tarball DEPENDS tarball-real) +# -- end tarball + opentrack_module(opentrack-api opentrack) opentrack_qt(opentrack-api) add_library(opentrack-api STATIC ${opentrack-api-all}) -- cgit v1.2.3 From bb43e044972f541ae6d39e1718a6a2a08102f78b Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 06:32:06 +0200 Subject: cmake: timestamp logic simplify/fix --- CMakeLists.txt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 564fc736..0ee925b0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -211,7 +211,7 @@ string(REPLACE "refs/heads/" "" filename-branch_1 "${filename-branch_0}") string(REPLACE "/" "-" filename-branch "${filename-branch_1}") set(filename_0 "${OPENTRACK_COMMIT}") set(filename_1) -if(is_exact_p EQUAL 0) +if (NOT OPENTRACK_TAG_EXACT STREQUAL OPENTRACK_COMMIT) string(TIMESTAMP filename_1 "-%Y%m%d%H%M%S") endif() set(filename "${CMAKE_BINARY_DIR}/${filename_0}${filename_1}.zip") @@ -219,13 +219,10 @@ set(filename "${CMAKE_BINARY_DIR}/${filename_0}${filename_1}.zip") add_custom_target(tarball-real) add_custom_target(tarball-real2) add_custom_command(TARGET tarball-real COMMAND cmake -P ${CMAKE_SOURCE_DIR}/cmake/tarball.cmake) -set(is-exact-p 0) -if (OPENTRACK_TAG_EXACT STREQUAL OPENTRACK_COMMIT) - set(is-exact-p 1) -endif() + add_custom_command(TARGET tarball-real2 COMMAND /usr/bin/env sh "${CMAKE_SOURCE_DIR}/make-tar.sh" "${CMAKE_INSTALL_PREFIX}" - "${filename}" "${CMAKE_BINARY_DIR}" ${is-exact-p}) + "${filename}" "${CMAKE_BINARY_DIR}") add_custom_target(tarball DEPENDS tarball-real) # -- end tarball -- cgit v1.2.3 From f268cfe57d0b96f19acf76df9e9843a56a8c895d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 06:52:42 +0200 Subject: gitattributes: more text extensions to eol=lf --- .gitattributes | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitattributes b/.gitattributes index 5f7a58f5..d681ede5 100644 --- a/.gitattributes +++ b/.gitattributes @@ -6,3 +6,5 @@ *.txt text=auto eol=lf *.ui text=auto eol=lf *.qrc text=auto eol=lf +*.cc text=auto eol=lf +*.md text=auto eol=lf -- cgit v1.2.3 From 3eb0d43aaa37b6d9e030a85197bf30fe7b47029e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 07:12:38 +0200 Subject: osx: nix warning --- qxt-mini/plat/qxtglobalshortcut_mac.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/qxt-mini/plat/qxtglobalshortcut_mac.cpp b/qxt-mini/plat/qxtglobalshortcut_mac.cpp index fbf86a94..1181b293 100644 --- a/qxt-mini/plat/qxtglobalshortcut_mac.cpp +++ b/qxt-mini/plat/qxtglobalshortcut_mac.cpp @@ -29,6 +29,9 @@ ** *****************************************************************************/ +#pragma GCC diagnostic ignored "-Wfour-char-constants" +#pragma GCC diagnostic ignored "-Wunused-parameter" + #include "qxtglobalshortcut_p.h" #include #include -- cgit v1.2.3 From d50d9f9d436d7c9827d0d31913778012eb716323 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 07:13:51 +0200 Subject: x-plane: ignore diagnostic --- x-plane-plugin/plugin.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/x-plane-plugin/plugin.c b/x-plane-plugin/plugin.c index 999f6e15..c091f74d 100644 --- a/x-plane-plugin/plugin.c +++ b/x-plane-plugin/plugin.c @@ -16,6 +16,8 @@ #define PLUGIN_API #endif +#pragma GCC diagnostic ignored "-Wunused-parameter" + /* using Wine name to ease things */ #define WINE_SHM_NAME "facetracknoir-wine-shm" #define WINE_MTX_NAME "facetracknoir-wine-mtx" -- cgit v1.2.3 From d55a4b37629c5826adcf7cc3989913a10e9719ab Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 08:01:50 +0200 Subject: cmake: add osx policy to make it shutup --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0ee925b0..36ffbfb7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,6 +7,9 @@ endif() if(POLICY CMP0028) cmake_policy(SET CMP0028 OLD) endif() +if(POLICY CMP0042) + cmake_policy(SET CMP0042 NEW) +endif() include(CMakeParseArguments) -- cgit v1.2.3 From a4fb405d0d78adf2a97d828bc516ac9ee6cae77d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 08:37:21 +0200 Subject: cmake: add toolchain file for OSX --- cmake/apple.cmake | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 cmake/apple.cmake diff --git a/cmake/apple.cmake b/cmake/apple.cmake new file mode 100644 index 00000000..c16ff575 --- /dev/null +++ b/cmake/apple.cmake @@ -0,0 +1,25 @@ +SET(CMAKE_SYSTEM_NAME Darwin) +SET(CMAKE_SYSTEM_VERSION 1) + +SET(CMAKE_C_COMPILER ${c}cc) +SET(CMAKE_CXX_COMPILER ${c}c++) +set(CMAKE_LINKER ${c}c++) + +set(CMAKE_OSX_ARCHITECTURES x86_64) +set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) +# change this +set(CMAKE_OSX_SYSROOT /var/root/MacOSX10.8.sdk) + +# oldest CPU supported here is Northwood-based Pentium 4. -sh 20150811 +set(fpu "-fno-math-errno -funsafe-math-optimizations -fno-signed-zeros") +set(cpu "-O3 -DNDEBUG -flto ${fpu}") +set(cxx "-std=c++11 -stdlib=libc++") + +set(CFLAGS-OVERRIDE "" CACHE STRING "") + +set(CMAKE_C_FLAGS_RELEASE "${cpu} ${CFLAGS-OVERRIDE}" CACHE STRING "" FORCE) +set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${cxx}" CACHE STRING "" FORCE) +set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${cpu} ${CFLAGS-OVERRIDE}" CACHE STRING "" FORCE) +set(CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} CACHE STRING "" FORCE) +set(CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} CACHE STRING "" FORCE) +set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE) -- cgit v1.2.3 From 446ed900af4b0c1bad1334918a6f36c4db314d02 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 08:42:25 +0200 Subject: cmake: fix copy-paste comment --- cmake/apple.cmake | 1 - 1 file changed, 1 deletion(-) diff --git a/cmake/apple.cmake b/cmake/apple.cmake index c16ff575..054e1ae5 100644 --- a/cmake/apple.cmake +++ b/cmake/apple.cmake @@ -10,7 +10,6 @@ set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8) # change this set(CMAKE_OSX_SYSROOT /var/root/MacOSX10.8.sdk) -# oldest CPU supported here is Northwood-based Pentium 4. -sh 20150811 set(fpu "-fno-math-errno -funsafe-math-optimizations -fno-signed-zeros") set(cpu "-O3 -DNDEBUG -flto ${fpu}") set(cxx "-std=c++11 -stdlib=libc++") -- cgit v1.2.3 From 6e5694f995454b48478e30abf432bb78dedd81c1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 20 Oct 2015 09:07:45 +0200 Subject: shortcuts: fix osx/linux keystrokes persisting --- opentrack/shortcuts.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opentrack/shortcuts.cpp b/opentrack/shortcuts.cpp index 718dd778..91480d16 100644 --- a/opentrack/shortcuts.cpp +++ b/opentrack/shortcuts.cpp @@ -120,6 +120,8 @@ void Shortcuts::bind_keyboard_shortcut(K &key, key_opts& k) else { key->setShortcut(QKeySequence::UnknownKey); key->setEnabled(false); + std::shared_ptr ptr = K(); + key.swap(ptr); } if (k.keycode != "") -- cgit v1.2.3 From fe3bc42f80bb8cef37dea68539e8a1fd9752baa8 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Wed, 21 Oct 2015 08:43:24 +0200 Subject: cmake: update toolchain file --- cmake/mingw-w64-debug.cmake | 38 -------------------------------------- cmake/mingw-w64.cmake | 2 +- 2 files changed, 1 insertion(+), 39 deletions(-) delete mode 100644 cmake/mingw-w64-debug.cmake diff --git a/cmake/mingw-w64-debug.cmake b/cmake/mingw-w64-debug.cmake deleted file mode 100644 index 7a371e5d..00000000 --- a/cmake/mingw-w64-debug.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# this file only serves as toolchain file when specified so explicitly -# when building the software. from repository's root directory: -# mkdir build && cd build && cmake -DCMAKE_TOOLCHAIN_FILE=$(pwd)/../cmake/mingw-w64.cmake -# -sh 20140922 - -SET(CMAKE_SYSTEM_NAME Windows) -SET(CMAKE_SYSTEM_VERSION 1) - -# specify the cross compiler -set(c i686-w64-mingw32-) - -SET(CMAKE_C_COMPILER ${c}gcc) -SET(CMAKE_CXX_COMPILER ${c}g++) -set(CMAKE_RC_COMPILER ${c}windres) -set(CMAKE_LINKER ${c}ld) -set(CMAKE_AR ${c}gcc-ar CACHE STRING "" FORCE) -set(CMAKE_NM ${c}gcc-nm CACHE STRING "" FORCE) -set(CMAKE_RANLIB ${c}gcc-ranlib CACHE STRING "" FORCE) - -SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32) - -# search for programs in the host directories -SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) -# don't poison with system compile-time data -SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) -SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) - -set(cpu "-O2 -march=i686 -mtune=corei7-avx -ffast-math -mfpmath=both -msse -msse2 -mno-sse3 -mno-avx") -set(rice "-ggdb") - -set(CFLAGS-OVERRIDE "" CACHE STRING "") - -set(CMAKE_C_FLAGS_RELEASE "${rice} ${cpu} ${CFLAGS-OVERRIDE}" CACHE STRING "" FORCE) -set(CMAKE_CXX_FLAGS_RELEASE ${CMAKE_C_FLAGS_RELEASE} CACHE STRING "" FORCE) -set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${cpu} ${CFLAGS-OVERRIDE}" CACHE STRING "" FORCE) -set(CMAKE_EXE_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} CACHE STRING "" FORCE) -set(CMAKE_MODULE_LINKER_FLAGS_RELEASE ${CMAKE_SHARED_LINKER_FLAGS_RELEASE} CACHE STRING "" FORCE) -set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE) diff --git a/cmake/mingw-w64.cmake b/cmake/mingw-w64.cmake index 2705c068..1f60993a 100644 --- a/cmake/mingw-w64.cmake +++ b/cmake/mingw-w64.cmake @@ -26,7 +26,7 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) # oldest CPU supported here is Northwood-based Pentium 4. -sh 20150811 -set(fpu "-fno-math-errno -funsafe-math-optimizations -fno-signed-zeros -mfpmath=both") +set(fpu "-ffast-math -fno-finite-math-only -mfpmath=both") set(cpu "-O3 -march=pentium4 -mtune=corei7-avx ${fpu} -msse -msse2 -mno-sse3") set(CFLAGS-OVERRIDE "" CACHE STRING "") -- cgit v1.2.3