Commit f1c7edb
Frame rate detection on MotionMark occasionally sees older devices as 90 fps instead of 60
#50
rdar://127012351
To get the target frame rate we sample 300 rAFs and we get the average of their
frame rates. We calculate the average incrementally using some sort of exponential
decay. The average starts very small but keeps increasing until it reaches the
actual target frame rate and it is supposed to stay unchanged much. Then we compare
the final average rate with predefined frame rates and get the closest one.
The purpose of this incremental calculation was to show the target frame rate
being calculated in the detectionProgressElement in the developer page.
In addition to having the incremental average very small for more than 100 frames,
the bigger problem is this incremental average calculation gives more weight to
the last frame. And if it is considerably large for any reason, the final average
will be wildly inaccurate.
The fix is to simplify the calculations:
1. For count == 0: The firstTimeStamp will be recorded and and we won't update
the detectionProgressElement.
2. For count > 0:
averageFrameLength = (timestamp - firstTimeStamp) / count;
averageFrameRate = 1000 / averageFrameLength;1 parent f3034d6 commit f1c7edb
1 file changed
+14
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
558 | 558 | | |
559 | 559 | | |
560 | 560 | | |
561 | | - | |
562 | | - | |
| 561 | + | |
563 | 562 | | |
564 | 563 | | |
565 | | - | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
566 | 570 | | |
567 | 571 | | |
568 | 572 | | |
| |||
585 | 589 | | |
586 | 590 | | |
587 | 591 | | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
593 | 597 | | |
| 598 | + | |
594 | 599 | | |
595 | 600 | | |
596 | 601 | | |
597 | | - | |
| 602 | + | |
598 | 603 | | |
599 | 604 | | |
600 | 605 | | |
| |||
0 commit comments