* FFT and MDCT tests.
*/
+#include "libavutil/cpu.h"
#include "libavutil/mathematics.h"
#include "libavutil/lfg.h"
#include "libavutil/log.h"
+#include "libavutil/time.h"
#include "fft.h"
#if CONFIG_FFT_FLOAT
#include "dct.h"
#include "rdft.h"
#endif
#include <math.h>
+#if HAVE_UNISTD_H
#include <unistd.h>
-#include <sys/time.h>
+#endif
#include <stdlib.h>
#include <string.h>
return (int16_t)av_lfg_get(prng) / 32768.0 * RANGE;
}
-static int64_t gettime(void)
-{
- struct timeval tv;
- gettimeofday(&tv,NULL);
- return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec;
-}
-
static int check_diff(FFTSample *tab1, FFTSample *tab2, int n, double scale)
{
int i;
TRANSFORM_DCT,
};
+#if !HAVE_GETOPT
+#include "compat/getopt.c"
+#endif
+
int main(int argc, char **argv)
{
FFTComplex *tab, *tab1, *tab_ref;
FFTSample *tab2;
int it, i, c;
+ int cpuflags;
int do_speed = 0;
int err = 1;
enum tf_transform transform = TRANSFORM_FFT;
fft_nbits = 9;
for(;;) {
- c = getopt(argc, argv, "hsimrdn:f:");
+ c = getopt(argc, argv, "hsimrdn:f:c:");
if (c == -1)
break;
switch(c) {
case 'f':
scale = atof(optarg);
break;
+ case 'c':
+ cpuflags = av_parse_cpu_flags(optarg);
+ if (cpuflags < 0)
+ return 1;
+ av_set_cpu_flags_mask(cpuflags);
+ break;
}
}
/* we measure during about 1 seconds */
nb_its = 1;
for(;;) {
- time_start = gettime();
+ time_start = av_gettime();
for (it = 0; it < nb_its; it++) {
switch (transform) {
case TRANSFORM_MDCT:
#endif
}
}
- duration = gettime() - time_start;
+ duration = av_gettime() - time_start;
if (duration >= 1000000)
break;
nb_its *= 2;