Browse code

dct-test: make speed test optional

Signed-off-by: Mans Rullgard <mans@mansr.com>

Mans Rullgard authored on 2011/07/04 07:19:13
Showing 1 changed files
... ...
@@ -200,7 +200,7 @@ static inline void mmx_emms(void)
200 200
 #endif
201 201
 }
202 202
 
203
-static void dct_error(const struct algo *dct, int test, int is_idct)
203
+static void dct_error(const struct algo *dct, int test, int is_idct, int speed)
204 204
 {
205 205
     int it, i, scale;
206 206
     int err_inf, v;
... ...
@@ -303,6 +303,9 @@ static void dct_error(const struct algo *dct, int test, int is_idct)
303 303
            (double) err2 / NB_ITS / 64.0, (double) sysErrMax / NB_ITS,
304 304
            maxout, blockSumErrMax);
305 305
 
306
+    if (!speed)
307
+        return;
308
+
306 309
     /* speed test */
307 310
     for (i = 0; i < 64; i++)
308 311
         block1[i] = 0;
... ...
@@ -439,7 +442,8 @@ static void idct248_ref(uint8_t *dest, int linesize, int16_t *block)
439 439
 
440 440
 static void idct248_error(const char *name,
441 441
                           void (*idct248_put)(uint8_t *dest, int line_size,
442
-                                              int16_t *block))
442
+                                              int16_t *block),
443
+                          int speed)
443 444
 {
444 445
     int it, i, it1, ti, ti1, err_max, v;
445 446
     AVLFG prng;
... ...
@@ -473,6 +477,9 @@ static void idct248_error(const char *name,
473 473
     }
474 474
     printf("%s %s: err_inf=%d\n", 1 ? "IDCT248" : "DCT248", name, err_max);
475 475
 
476
+    if (!speed)
477
+        return;
478
+
476 479
     ti = gettime();
477 480
     it1 = 0;
478 481
     do {
... ...
@@ -497,7 +504,8 @@ static void help(void)
497 497
            "            1 -> test with random sparse matrixes\n"
498 498
            "            2 -> do 3. test from mpeg4 std\n"
499 499
            "-i          test IDCT implementations\n"
500
-           "-4          test IDCT248 implementations\n");
500
+           "-4          test IDCT248 implementations\n"
501
+           "-t          speed test\n");
501 502
 }
502 503
 
503 504
 int main(int argc, char **argv)
... ...
@@ -505,6 +513,7 @@ int main(int argc, char **argv)
505 505
     int test_idct = 0, test_248_dct = 0;
506 506
     int c, i;
507 507
     int test = 1;
508
+    int speed = 0;
508 509
 
509 510
     cpu_flags = av_get_cpu_flags();
510 511
 
... ...
@@ -519,7 +528,7 @@ int main(int argc, char **argv)
519 519
     }
520 520
 
521 521
     for (;;) {
522
-        c = getopt(argc, argv, "ih4");
522
+        c = getopt(argc, argv, "ih4t");
523 523
         if (c == -1)
524 524
             break;
525 525
         switch (c) {
... ...
@@ -529,6 +538,9 @@ int main(int argc, char **argv)
529 529
         case '4':
530 530
             test_248_dct = 1;
531 531
             break;
532
+        case 't':
533
+            speed = 1;
534
+            break;
532 535
         default:
533 536
         case 'h':
534 537
             help();
... ...
@@ -542,12 +554,12 @@ int main(int argc, char **argv)
542 542
     printf("ffmpeg DCT/IDCT test\n");
543 543
 
544 544
     if (test_248_dct) {
545
-        idct248_error("SIMPLE-C", ff_simple_idct248_put);
545
+        idct248_error("SIMPLE-C", ff_simple_idct248_put, speed);
546 546
     } else {
547 547
         const struct algo *algos = test_idct ? idct_tab : fdct_tab;
548 548
         for (i = 0; algos[i].name; i++)
549 549
             if (!(~cpu_flags & algos[i].mm_support)) {
550
-                dct_error(&algos[i], test, test_idct);
550
+                dct_error(&algos[i], test, test_idct, speed);
551 551
             }
552 552
     }
553 553
     return 0;