From f837647d6159941526ac479050bf317ae13a41a1 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 26 Sep 2021 19:42:36 +0200 Subject: video/widget, tracker/pt: skip widget processing in more cases --- tracker-pt/ftnoir_tracker_pt.cpp | 6 +++--- video/video-widget.hpp | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tracker-pt/ftnoir_tracker_pt.cpp b/tracker-pt/ftnoir_tracker_pt.cpp index dabd48b4..2911a217 100644 --- a/tracker-pt/ftnoir_tracker_pt.cpp +++ b/tracker-pt/ftnoir_tracker_pt.cpp @@ -71,10 +71,10 @@ void Tracker_PT::run() { const bool preview_visible = check_is_visible(); - if (preview_visible) + if (preview_visible && !widget->fresh()) preview_frame->set_last_frame(*frame); - point_extractor->extract_points(*frame, *preview_frame, preview_visible, points); + point_extractor->extract_points(*frame, *preview_frame, preview_visible && !widget->fresh(), points); point_count.store(points.size(), std::memory_order_relaxed); const bool success = points.size() >= PointModel::N_POINTS; @@ -99,7 +99,7 @@ void Tracker_PT::run() X_CM = point_tracker.pose(); } - if (preview_visible) + if (preview_visible && !widget->fresh()) { const f fx = pt_camera_info::get_focal_length(info.fov, info.res_x, info.res_y); Affine X_MH(mat33::eye(), vec3(s.t_MH_x, s.t_MH_y, s.t_MH_z)); diff --git a/video/video-widget.hpp b/video/video-widget.hpp index bb218c69..4f54b2b9 100644 --- a/video/video-widget.hpp +++ b/video/video-widget.hpp @@ -29,12 +29,12 @@ struct OTR_VIDEO_EXPORT video_widget : QWidget void resizeEvent(QResizeEvent*) override; void paintEvent(QPaintEvent*) override; void draw_image(); + bool fresh() const; protected: mutable QMutex mtx { QMutex::NonRecursive }; QImage texture; std::vector vec; - bool fresh() const; void set_fresh(bool x); void set_image(const unsigned char* src, int width, int height, int stride, QImage::Format fmt); -- cgit v1.2.3