summaryrefslogtreecommitdiffhomepage
path: root/pose-widget/pose-widget.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-06-30 11:43:52 +0200
committerStanislaw Halik <sthalik@misaki.pl>2017-06-30 11:48:45 +0200
commit800b9c7a2914c59b1b42192708f6c555eb180b43 (patch)
treea1a20e4f373f8e32f4ac1b434cc6f866c78029af /pose-widget/pose-widget.hpp
parent2ed75f0586897405fd26215fcfe7b9d17841affc (diff)
pose-widget: optimize CPU usage slightly
CPU usage of an empty tracker loop fell reliably from 1% to .9%.
Diffstat (limited to 'pose-widget/pose-widget.hpp')
-rw-r--r--pose-widget/pose-widget.hpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/pose-widget/pose-widget.hpp b/pose-widget/pose-widget.hpp
index fc606e13..7bc66cd2 100644
--- a/pose-widget/pose-widget.hpp
+++ b/pose-widget/pose-widget.hpp
@@ -16,6 +16,7 @@
#include <mutex>
#include <atomic>
+#include <vector>
#ifdef BUILD_POSE_WIDGET
# define POSE_WIDGET_EXPORT Q_DECL_EXPORT
@@ -37,6 +38,14 @@ using lock_guard = std::unique_lock<std::mutex>;
class pose_widget;
+class Triangle {
+ num dot00, dot01, dot11, invDenom;
+ vec2 v0, v1, origin;
+public:
+ Triangle(const vec2& p1, const vec2& p2, const vec2& p3);
+ bool barycentric_coords(const vec2& px, vec2& uv, int& i) const;
+};
+
struct pose_transform final : private QThread
{
pose_transform(QWidget* dst);
@@ -67,6 +76,14 @@ struct pose_transform final : private QThread
QImage front, back;
QImage image, image2;
+ struct uv_
+ {
+ vec2 coords;
+ int i;
+ };
+
+ std::vector<uv_> uv_vec;
+
std::atomic<bool> fresh;
static constexpr int w = 320, h = 240;