t/hand: Apply formatting

This commit is contained in:
Moses Turner 2022-06-15 13:08:32 +01:00
parent f7a9317b8e
commit 8e3a47dd94
6 changed files with 27 additions and 23 deletions

View file

@ -21,7 +21,8 @@ extern "C" {
* @ingroup aux_tracking
*/
struct t_hand_tracking_sync *
t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib, enum hand_tracking_output_space output_space);
t_hand_tracking_sync_mercury_create(struct t_stereo_camera_calibration *calib,
enum hand_tracking_output_space output_space);
#ifdef __cplusplus
} // extern "C"

View file

@ -258,25 +258,27 @@ applyJointWidths(struct HandTracking *htd, struct xrt_hand_joint_set *set)
.040f * .5f; // Measured my wrist thickness with calipers
}
static bool handle_changed_image_size(HandTracking *htd, xrt_size &new_one_view_size)
static bool
handle_changed_image_size(HandTracking *htd, xrt_size &new_one_view_size)
{
int gcd_calib = std::gcd(htd->calibration_one_view_size_px.h, htd->calibration_one_view_size_px.w);
int gcd_new = std::gcd(new_one_view_size.h, new_one_view_size.w);
int lcm_h_calib = htd->calibration_one_view_size_px.h/gcd_calib;
int lcm_w_calib = htd->calibration_one_view_size_px.w/gcd_calib;
int lcm_h_calib = htd->calibration_one_view_size_px.h / gcd_calib;
int lcm_w_calib = htd->calibration_one_view_size_px.w / gcd_calib;
int lcm_h_new = new_one_view_size.h/gcd_new;
int lcm_w_new = new_one_view_size.w/gcd_new;
int lcm_h_new = new_one_view_size.h / gcd_new;
int lcm_w_new = new_one_view_size.w / gcd_new;
bool good = (lcm_h_calib == lcm_h_new) && (lcm_w_calib == lcm_w_new);
if (!good) {
HT_WARN(htd, "Can't process this frame, wrong aspect ratio. What we wanted: %dx%d, what we got: %dx%d", lcm_h_calib, lcm_w_calib, lcm_h_new, lcm_w_new);
HT_WARN(htd, "Can't process this frame, wrong aspect ratio. What we wanted: %dx%d, what we got: %dx%d",
lcm_h_calib, lcm_w_calib, lcm_h_new, lcm_w_new);
return false;
}
htd->multiply_px_coord_for_undistort = (float)htd->calibration_one_view_size_px.h/(float)new_one_view_size.h;
htd->multiply_px_coord_for_undistort = (float)htd->calibration_one_view_size_px.h / (float)new_one_view_size.h;
htd->last_frame_one_view_size_px = new_one_view_size;
return true;
}
@ -343,10 +345,10 @@ HandTracking::cCallbackProcess(struct t_hand_tracking_sync *ht_sync,
assert(left_frame->height == right_frame->height);
const int full_height = left_frame->height;
const int full_width = left_frame->width*2;
const int full_width = left_frame->width * 2;
if ((left_frame->width != (uint32_t)htd->last_frame_one_view_size_px.w) || (left_frame->height != (uint32_t)htd->last_frame_one_view_size_px.h))
{
if ((left_frame->width != (uint32_t)htd->last_frame_one_view_size_px.w) ||
(left_frame->height != (uint32_t)htd->last_frame_one_view_size_px.h)) {
xrt_size new_one_view_size;
new_one_view_size.h = left_frame->height;
new_one_view_size.w = left_frame->width;

View file

@ -150,7 +150,7 @@ struct ht_view
cv::Mat run_model_on_this;
cv::Mat debug_out_to_this;
struct det_output det_outputs[2]; // left, right
struct det_output det_outputs[2]; // left, right
struct keypoint_estimation_run_info run_info[2];
struct keypoint_output keypoint_outputs[2];

View file

@ -21,7 +21,7 @@ extern "C" {
* @ingroup aux_tracking
*/
struct t_hand_tracking_sync *
t_hand_tracking_sync_old_rgb_create(struct t_stereo_camera_calibration * calib);
t_hand_tracking_sync_old_rgb_create(struct t_stereo_camera_calibration *calib);
#ifdef __cplusplus

View file

@ -458,8 +458,8 @@ getCalibration(struct HandTracking *htd, t_stereo_camera_calibration *calibratio
htd->one_view_size_px.w = wrap.view[0].image_size_pixels.w;
htd->one_view_size_px.h = wrap.view[0].image_size_pixels.h;
U_LOG_E("%d %d %p %p", htd->one_view_size_px.w, htd->one_view_size_px.h,
(void *)&htd->one_view_size_px.w, (void *)&htd->one_view_size_px.h);
U_LOG_E("%d %d %p %p", htd->one_view_size_px.w, htd->one_view_size_px.h, (void *)&htd->one_view_size_px.w,
(void *)&htd->one_view_size_px.h);
@ -733,7 +733,7 @@ htExitFrame(struct HandTracking *htd,
uint64_t timestamp,
struct xrt_hand_joint_set *out_left,
struct xrt_hand_joint_set *out_right,
uint64_t *out_timestamp_ns)
uint64_t *out_timestamp_ns)
{
os_mutex_lock(&htd->openxr_hand_data_mediator);
@ -805,7 +805,7 @@ HandTracking::cCallbackProcess(struct t_hand_tracking_sync *ht_sync,
struct xrt_frame *right_frame,
struct xrt_hand_joint_set *out_left_hand,
struct xrt_hand_joint_set *out_right_hand,
uint64_t *out_timestamp_ns)
uint64_t *out_timestamp_ns)
{
XRT_TRACE_MARKER();
@ -827,7 +827,7 @@ HandTracking::cCallbackProcess(struct t_hand_tracking_sync *ht_sync,
assert(left_frame->height == right_frame->height);
const int full_height = left_frame->height;
const int full_width = left_frame->width*2;
const int full_width = left_frame->width * 2;
const int view_width = htd->one_view_size_px.w;
const int view_height = htd->one_view_size_px.h;
@ -1002,8 +1002,8 @@ HandTracking::cCallbackProcess(struct t_hand_tracking_sync *ht_sync,
htd->histories_3d[past_indices[i]].last_hands_unfiltered.push_back(
hands_unfiltered[present_indices[i]]);
}
// The preceding may not do anything, because we'll start out with no hand histories! All the numbers of elements
// should be zero.
// The preceding may not do anything, because we'll start out with no hand histories! All the numbers of
// elements should be zero.
for (size_t i = 0; i < present_hands_taken.size(); i++) {
@ -1189,7 +1189,8 @@ HandTracking::cCallbackProcess(struct t_hand_tracking_sync *ht_sync,
applyJointWidths(put_in_set);
applyJointOrientations(put_in_set, xr_indices[i]);
}
htExitFrame(htd, false, final_hands_ordered_by_handedness, filtered_hands[0].timestamp, out_left_hand, out_right_hand, out_timestamp_ns);
htExitFrame(htd, false, final_hands_ordered_by_handedness, filtered_hands[0].timestamp, out_left_hand,
out_right_hand, out_timestamp_ns);
}
void
@ -1216,7 +1217,7 @@ t_hand_tracking_sync_old_rgb_create(struct t_stereo_camera_calibration *calib)
auto htd = new HandTracking();
U_LOG_E("htd is at %p", (void*)htd);
U_LOG_E("htd is at %p", (void *)htd);
// Setup logging first. We like logging.
htd->log_level = debug_get_log_option_ht_log();

View file

@ -295,7 +295,7 @@ public:
struct xrt_frame *right_frame,
struct xrt_hand_joint_set *out_left_hand,
struct xrt_hand_joint_set *out_right_hand,
uint64_t *out_timestamp_ns);
uint64_t *out_timestamp_ns);
static void
cCallbackDestroy(t_hand_tracking_sync *ht_sync);