t/debug: Update HelperDebugSink to use new u_debug_sink

This commit is contained in:
Jakob Bornecrantz 2021-09-17 13:17:47 +01:00
parent 2404257077
commit 0157b2d4b0
4 changed files with 15 additions and 12 deletions

View file

@ -13,8 +13,9 @@
#error "This header is C++-only."
#endif
#include <opencv2/opencv.hpp>
#include "util/u_sink.h"
#include "util/u_frame.h"
#include <opencv2/opencv.hpp>
namespace xrt::auxiliary::tracking {
@ -29,7 +30,7 @@ public:
public:
Kind kind = AllAvailable;
struct xrt_frame_sink *sink = {};
struct u_sink_debug usd = {};
struct xrt_frame *frame = {};
cv::Mat rgb[2] = {};
@ -39,19 +40,21 @@ public:
HelperDebugSink(Kind kind)
{
this->kind = kind;
u_sink_debug_init(&usd);
}
HelperDebugSink() = delete;
~HelperDebugSink()
{
u_sink_debug_destroy(&usd);
xrt_frame_reference(&frame, NULL);
}
void
refresh(struct xrt_frame *xf)
{
if (sink == NULL) {
if (!u_sink_debug_is_active(&usd)) {
return;
}
@ -113,12 +116,12 @@ public:
void
submit()
{
if (frame != NULL) {
// Make sure that the cv::Mats doesn't use the data.
rgb[0] = cv::Mat();
rgb[1] = cv::Mat();
sink->push_frame(sink, frame);
}
// Make sure that the cv::Mats doesn't use the data.
rgb[0] = cv::Mat();
rgb[1] = cv::Mat();
// Does checking.
u_sink_debug_push_frame(&usd, frame);
// We unreference the frame here, downstream is either
// done with it or have referenced it themselves.

View file

@ -406,7 +406,7 @@ t_hand_create(struct xrt_frame_context *xfctx,
u_var_add_root(&t, "Hand Tracker", true);
u_var_add_vec3_f32(&t, &t.hand_data[0].hand_relation.pose.position, "hand.tracker.pos.0");
u_var_add_vec3_f32(&t, &t.hand_data[1].hand_relation.pose.position, "hand.tracker.pos.1");
u_var_add_sink(&t, &t.debug.sink, "Debug");
u_var_add_sink_debug(&t, &t.debug.usd, "Debug");
*out_sink = &t.sink;
*out_xth = &t.base;

View file

@ -611,7 +611,7 @@ t_psmv_create(struct xrt_frame_context *xfctx,
// Everything is safe, now setup the variable tracking.
u_var_add_root(&t, "PSMV Tracker", true);
u_var_add_vec3_f32(&t, &t.tracked_object_position, "last.ball.pos");
u_var_add_sink(&t, &t.debug.sink, "Debug");
u_var_add_sink_debug(&t, &t.debug.usd, "Debug");
*out_sink = &t.sink;
*out_xtmv = &t.base;

View file

@ -2136,7 +2136,7 @@ t_psvr_create(struct xrt_frame_context *xfctx,
// Everything is safe, now setup the variable tracking.
u_var_add_root(&t, "PSVR Tracker", true);
u_var_add_log_level(&t, &t.ll, "Log level");
u_var_add_sink(&t, &t.debug.sink, "Debug");
u_var_add_sink_debug(&t, &t.debug.usd, "Debug");
*out_sink = &t.sink;
*out_xtvr = &t.base;