-
Notifications
You must be signed in to change notification settings - Fork 2
/
jitter.py
66 lines (52 loc) · 1.13 KB
/
jitter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import os
import sys
image = 1
filename = "/home/linus/sleipnir-videos/1/" +sys.argv[1]+ "/timestamps.txt"
tt = {}
with open(filename) as f:
content = f.readlines()
for data in content:
data = data.split()
if len(data) == 2:
tt[int(data[0])] = int(data[1])
minjitter = 1000000
maxjitter = 0
first = 0
last = 0
j = {}
for i in xrange(0,1000):
j[i] = 0
while True:
if image % 10000 == 0:
print image, minjitter, maxjitter
if not image in tt:
break;
timestamp = tt[image];
if timestamp == 0:
break
if last == 0:
last = timestamp
continue
jitter = timestamp - last
if jitter < 0:
print image, jitter
break
if (jitter < minjitter and image > 500):
minjitter = jitter
if (jitter > maxjitter and image > 500):
maxjitter = jitter
j[jitter] += 1
if first == 0:
first = timestamp
last = timestamp
image += 1
print "image: ",image
print "minjitter: ", minjitter
print "maxjitter: ", maxjitter
print
t = 0.0
for i in xrange(minjitter, maxjitter + 1):
print i,j[i]
t += i * j[i]
print "standard fps:" + str(float(image) / (last-first) * 1000) + "fps"
print "jitter fps: " + str(image / t * 1000) + "fps"