summaryrefslogtreecommitdiff
path: root/libavcodec/dct-test.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/dct-test.c')
-rw-r--r--libavcodec/dct-test.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/libavcodec/dct-test.c b/libavcodec/dct-test.c
index 45d21bf284..9ea8f09914 100644
--- a/libavcodec/dct-test.c
+++ b/libavcodec/dct-test.c
@@ -28,13 +28,13 @@
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <sys/time.h>
#include <unistd.h>
#include <math.h>
#include "libavutil/cpu.h"
#include "libavutil/common.h"
#include "libavutil/lfg.h"
+#include "libavutil/time.h"
#include "simple_idct.h"
#include "aandcttab.h"
@@ -163,13 +163,6 @@ static const struct algo idct_tab[] = {
#define AANSCALE_BITS 12
-static int64_t gettime(void)
-{
- struct timeval tv;
- gettimeofday(&tv, NULL);
- return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
#define NB_ITS 20000
#define NB_ITS_SPEED 50000
@@ -201,14 +194,6 @@ static void idct_mmx_init(void)
DECLARE_ALIGNED(16, static DCTELEM, block)[64];
DECLARE_ALIGNED(8, static DCTELEM, block1)[64];
-static inline void mmx_emms(void)
-{
-#if HAVE_MMX
- if (cpu_flags & AV_CPU_FLAG_MMX)
- __asm__ volatile ("emms\n\t" ::: "memory");
-#endif
-}
-
static void init_block(DCTELEM block[64], int test, int is_idct, AVLFG *prng, int vals)
{
int i, j;
@@ -287,7 +272,7 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed, c
permute(block, block1, dct->format);
dct->func(block);
- mmx_emms();
+ emms_c();
if (dct->format == SCALE_PERM) {
for (i = 0; i < 64; i++) {
@@ -345,16 +330,16 @@ static int dct_error(const struct algo *dct, int test, int is_idct, int speed, c
init_block(block, test, is_idct, &prng, vals);
permute(block1, block, dct->format);
- ti = gettime();
+ ti = av_gettime();
it1 = 0;
do {
for (it = 0; it < NB_ITS_SPEED; it++) {
memcpy(block, block1, sizeof(block));
dct->func(block);
}
- mmx_emms();
+ emms_c();
it1 += NB_ITS_SPEED;
- ti1 = gettime() - ti;
+ ti1 = av_gettime() - ti;
} while (ti1 < 1000000);
printf("%s %s: %0.1f kdct/s\n", is_idct ? "IDCT" : "DCT", dct->name,
@@ -505,7 +490,7 @@ static void idct248_error(const char *name,
if (!speed)
return;
- ti = gettime();
+ ti = av_gettime();
it1 = 0;
do {
for (it = 0; it < NB_ITS_SPEED; it++) {
@@ -513,9 +498,9 @@ static void idct248_error(const char *name,
block[i] = block1[i];
idct248_put(img_dest, 8, block);
}
- mmx_emms();
+ emms_c();
it1 += NB_ITS_SPEED;
- ti1 = gettime() - ti;
+ ti1 = av_gettime() - ti;
} while (ti1 < 1000000);
printf("%s %s: %0.1f kdct/s\n", 1 ? "IDCT248" : "DCT248", name,