#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"
{ 0 }
};
-#if HAVE_MMX && HAVE_YASM
+#if ARCH_X86_64 && HAVE_MMX && HAVE_YASM
void ff_prores_idct_put_10_sse2(uint16_t *dst, int linesize,
DCTELEM *block, int16_t *qmat);
static void ff_prores_idct_put_10_sse2_wrap(DCTELEM *dst){
- int16_t qmat[64]; int i;
- int16_t tmp[64];
+ DECLARE_ALIGNED(16, static int16_t, qmat)[64];
+ DECLARE_ALIGNED(16, static int16_t, tmp)[64];
+ int i;
for(i=0; i<64; i++){
qmat[i]=4;
#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
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;
permute(block, block1, dct->format);
dct->func(block);
- mmx_emms();
+ emms_c();
if (dct->format == SCALE_PERM) {
for (i = 0; i < 64; i++) {
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,
if (!speed)
return;
- ti = gettime();
+ ti = av_gettime();
it1 = 0;
do {
for (it = 0; it < NB_ITS_SPEED; it++) {
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,