MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / test_motion

Function test_motion

libavcodec/tests/motion.c:66–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

64int dummy;
65
66static void test_motion(const char *name,
67 me_cmp_func test_func, me_cmp_func ref_func)
68{
69 int x, y, d1, d2, it;
70 uint8_t *ptr;
71 int64_t ti;
72 printf("testing '%s'\n", name);
73
74 /* test correctness */
75 for(it=0;it<20;it++) {
76
77 fill_random(img1, WIDTH * HEIGHT);
78 fill_random(img2, WIDTH * HEIGHT);
79
80 for(y=0;y<HEIGHT-17;y++) {
81 for(x=0;x<WIDTH-17;x++) {
82 ptr = img2 + y * WIDTH + x;
83 d1 = test_func(NULL, img1, ptr, WIDTH, 8);
84 d2 = ref_func(NULL, img1, ptr, WIDTH, 8);
85 if (d1 != d2) {
86 printf("error: mmx=%d c=%d\n", d1, d2);
87 }
88 }
89 }
90 }
91 emms_c();
92
93 /* speed test */
94 ti = av_gettime_relative();
95 d1 = 0;
96 for(it=0;it<NB_ITS;it++) {
97 for(y=0;y<HEIGHT-17;y++) {
98 for(x=0;x<WIDTH-17;x++) {
99 ptr = img2 + y * WIDTH + x;
100 d1 += test_func(NULL, img1, ptr, WIDTH, 8);
101 }
102 }
103 }
104 emms_c();
105 dummy = d1; /* avoid optimization */
106 ti = av_gettime_relative() - ti;
107
108 printf(" %0.0f kop/s\n",
109 (double)NB_ITS * (WIDTH - 16) * (HEIGHT - 16) /
110 (double)(ti / 1000.0));
111}
112
113
114int main(int argc, char **argv)

Callers 1

mainFunction · 0.70

Calls 3

emms_cFunction · 0.85
av_gettime_relativeFunction · 0.85
fill_randomFunction · 0.70

Tested by

no test coverage detected