Wednesday, April 05, 2006

benchmarks for drawing AVI frames


test video: "Movie_051112214725 comp.avi"
Release mode
Master Rings = 0
Window size: 632 x 459
# samples: 1000 (40 seconds)
averages (times in seconds)

Dell / Windows 2000
---------------------
using BitBlt, SRCCOPY
total 0.032182 <- i.e. avg duration of DrawAviFrame
get frame 0.013667 (42.5%)
create bitmap 0.009647 (30.0%)
blit 0.008469 (26.3%)
misc 0.000400 (1.2%)

using StretchBlt, SRCCOPY
total 0.047449 <- exceeds timer period! 47% worse than BitBlt
get frame 0.013653 (28.8%)
create bitmap 0.009758 (20.6%)
blit 0.023656 (49.9%)
misc 0.000383 (0.8%)

using StretchBlt, SRCINVERT
total 0.059013 <- 148% of timer period! 25% worse than SRCCOPY
get frame 0.013646 (23.1%)
create bitmap 0.010457 (17.7%)
blit 0.034508 (58.5%)
misc 0.000402 (0.7%)

Hotrod / XP
---------------------
using BitBlt, SRCCOPY
total 0.004478 <- i.e. avg duration of DrawAviFrame
get frame 0.002263 (50.5%)
create bitmap 0.001238 (27.6%)
blit 0.000881 (19.7%)
misc 0.000096 (2.1%)

using StretchBlt, SRCCOPY
total 0.006912 <- 54% worse than BitBlt
get frame 0.002257 (32.7%)
create bitmap 0.001240 (17.9%)
blit 0.003314 (48.0%)
misc 0.000100 (1.4%)

using StretchBlt, SRCINVERT
total 0.008200 <- 20% of timer period, 19% worse than SRCCOPY
get frame 0.002267 (27.6%)
create bitmap 0.001239 (15.1%)
blit 0.004592 (56.0%)
misc 0.000102 (1.2%)

Conclusion:
Hotrod is 7.2 times faster, but StretchBlt mode is bad stuff.

#include "benchmark.h"
double blitsum;
double createsum;
double getfrmsum;
double totsum;
int samps;
...
totsum += b.Elapsed();
samps++;
if (samps == 1000) {
CString s;
double total = totsum / samps;
double getfrm = getfrmsum / samps;
double create = createsum / samps;
double blit = blitsum / samps;
double misc = total - (getfrm + create + blit);
s.Format("total\t%f\ngetfrm\t%f (%.1f%%)\ncreate\t%f (%.1f%%)\nblit\t%f (%.1f%%)\nmisc\t%f (%.1f%%)",
total,
getfrm, getfrm / total * 100,
create, create / total * 100,
blit, blit / total * 100,
misc, misc / total * 100);
AfxMessageBox(s);
}

No comments: