summaryrefslogtreecommitdiff
path: root/live.c
diff options
context:
space:
mode:
Diffstat (limited to 'live.c')
-rw-r--r--live.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/live.c b/live.c
index 77587cb..4a920c5 100644
--- a/live.c
+++ b/live.c
@@ -57,8 +57,8 @@
#define SELECT_TIMEOUT 2000 /* in milliseconds */
static struct timespec fps_ts = { 0, 0 };
-static unsigned int fps_count = 0;
-static bool show_fps = true;
+static unsigned int fps_last = 0;
+static bool fps_show = true;
static unsigned int frame_count = 0;
static unsigned int frame_skip = 0;
@@ -174,19 +174,18 @@ static void viewfinder_process(struct omap3_isp_device *isp __attribute__((__unu
frame_count++;
- if (show_fps){
- fps_count++;
-
+ if (fps_show){
clock_gettime(CLOCK_MONOTONIC, &ts);
interval = ts.tv_sec - fps_ts.tv_sec;
interval += (ts.tv_nsec - fps_ts.tv_nsec) / 1000000000.0;
if (interval >= 5) {
- if (fps_count > 1)
- printf("frame rate: %f fps\n", fps_count / interval);
+ if (frame_count > 1)
+ printf("frame rate: %f fps\n",
+ (frame_count - fps_last) / interval);
- fps_count = 0;
+ fps_last = frame_count;
fps_ts = ts;
}
}