static HandOffData hdata_p;
+// Point to current user spack point which has camera image source to be inferenced.
+static user_stack_t current_data_p;
+
static GMutex pose_mutex;
static guint old_timeout = 0;
static guint nFrames = 0;
//printf("(%d,%d): %f\n", humanSkeleton.pose[n].x, humanSkeleton.pose[n].y, confidences[n]);
//printf("(%d,%d)\n", humanSkeleton.pose[n].x, humanSkeleton.pose[n].y);
}
+
humanSkeleton.label = label;
humanSkeleton.IsDetected = true;
+
+ struct timespec e_time;
+ clock_gettime(CLOCK_MONOTONIC, &e_time);
+
+ struct timespec diffspec = diff(current_data_p.s_time, e_time);
+ unsigned long timeDiff = gettotalmillisec(diffspec);
+ printf("elapsed time: %lu(ms)\n", timeDiff);
}
static void _hand_detected_cb (
return;
}
-
- struct timespec s_tspec;
- struct timespec e_tspec;
-
- clock_gettime(CLOCK_MONOTONIC, &s_tspec);
-
mv_source_clear(mv_src_p2);
mv_source_fill_by_tensor_buffer(mv_src_p2, user_data,
MV_INFERENCE_DATA_FLOAT32,
56 * 56 * 21 * sizeof(float),
56, 56, 21, 3);
- clock_gettime(CLOCK_MONOTONIC, &e_tspec);
-
- struct timespec diffspec = diff(s_tspec, e_tspec);
- unsigned long timeDiff = gettotalmillisec(diffspec);
- printf("memcpy time: %lu(ms)\n", timeDiff);
-
- clock_gettime(CLOCK_MONOTONIC, &s_tspec);
-
mv_inference_pose_landmark_detect(mv_src_p2, hp_mv_infer2, NULL, _hand_pose_cb, NULL);
-
- clock_gettime(CLOCK_MONOTONIC, &e_tspec);
-
- diffspec = diff(s_tspec, e_tspec);
- timeDiff = gettotalmillisec(diffspec);
- printf("pose_estimation time: %lu(ms)\n", timeDiff);
- //humanSkeleton.IsDetected = true;
#endif
return;
}
}
humanSkeleton.IsDetected = true;
+
+ struct timespec e_time;
+ clock_gettime(CLOCK_MONOTONIC, &e_time);
+
+ struct timespec diffspec = diff(current_data_p.s_time, e_time);
+ unsigned long timeDiff = gettotalmillisec(diffspec);
+ printf("elapsed time: %lu(ms)\n", timeDiff);
+
+// user_stack_t *s = (user_stack_t *)user_data;
+
+// struct timespec e_time;
+// clock_gettime(CLOCK_MONOTONIC, &e_time);
+
+// struct timespec diffspec = diff(s->s_time, e_time);
+// unsigned long timeDiff = gettotalmillisec(diffspec);
+// printf("elapsed time: %lu(ms)\n", timeDiff);
}
static gboolean
gst_buffer_unmap((GstBuffer *)s->buffer, &map);
- g_mutex_unlock(&pose_mutex);
-
- struct timespec s_tspec;
- struct timespec e_tspec;
+ current_data_p = *s;
- clock_gettime(CLOCK_MONOTONIC, &s_tspec);
-
- mv_inference_pose_landmark_detect(mv_src_p, hp_mv_infer, &poseRoi, _human_pose_cb, NULL);
+ g_mutex_unlock(&pose_mutex);
- clock_gettime(CLOCK_MONOTONIC, &e_tspec);
- struct timespec diffspec = diff(s_tspec, e_tspec);
- unsigned long timeDiff = gettotalmillisec(diffspec);
- printf("detect + pose time: %lu(ms)\n", timeDiff);
+ mv_inference_pose_landmark_detect(mv_src_p, hp_mv_infer, &poseRoi, _human_pose_cb, s->user_data);
}
return FALSE;
gst_buffer_unmap((GstBuffer *)s->buffer, &map);
- g_mutex_unlock(&pose_mutex);
-
- struct timespec s_tspec;
- struct timespec e_tspec;
+ current_data_p = *s;
- void *outputTensorBuffer = s->user_data;
-
- clock_gettime(CLOCK_MONOTONIC, &s_tspec);
+ g_mutex_unlock(&pose_mutex);
// invoke tflite -> _hand_detected_cb -> memcpy output -> invoke tflite -> _pose_cb
- mv_inference_hand_detect(mv_src_p, hp_mv_infer, _hand_detected_cb, outputTensorBuffer);
-
- clock_gettime(CLOCK_MONOTONIC, &e_tspec);
- struct timespec diffspec = diff(s_tspec, e_tspec);
- unsigned long timeDiff = gettotalmillisec(diffspec);
- printf("detect + pose time: %lu(ms)\n", timeDiff);
+ mv_inference_hand_detect(mv_src_p, hp_mv_infer, _hand_detected_cb, (void *)s->user_data);
}
return FALSE;
g_mutex_lock(&pose_mutex);
PushBuffer(s);
+ clock_gettime(CLOCK_MONOTONIC, &s->s_time);
g_mutex_unlock(&pose_mutex);
}
g_mutex_lock(&pose_mutex);
PushBuffer(s);
+ clock_gettime(CLOCK_MONOTONIC, &s->s_time);
g_mutex_unlock(&pose_mutex);
}