fft-test: add option to set cpuflag mask

This can be useful for testing.

Signed-off-by: Mans Rullgard <mans@mansr.com>
pull/30/merge
Mans Rullgard 13 years ago
parent 6eca84bad8
commit b6a6e90a7c
  1. 10
      libavcodec/fft-test.c
  2. 26
      tests/fate/fft.mak

@ -23,6 +23,7 @@
* FFT and MDCT tests. * FFT and MDCT tests.
*/ */
#include "libavutil/cpu.h"
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "libavutil/lfg.h" #include "libavutil/lfg.h"
#include "libavutil/log.h" #include "libavutil/log.h"
@ -240,6 +241,7 @@ int main(int argc, char **argv)
FFTComplex *tab, *tab1, *tab_ref; FFTComplex *tab, *tab1, *tab_ref;
FFTSample *tab2; FFTSample *tab2;
int it, i, c; int it, i, c;
int cpuflags;
int do_speed = 0; int do_speed = 0;
int err = 1; int err = 1;
enum tf_transform transform = TRANSFORM_FFT; enum tf_transform transform = TRANSFORM_FFT;
@ -258,7 +260,7 @@ int main(int argc, char **argv)
fft_nbits = 9; fft_nbits = 9;
for(;;) { for(;;) {
c = getopt(argc, argv, "hsimrdn:f:"); c = getopt(argc, argv, "hsimrdn:f:c:");
if (c == -1) if (c == -1)
break; break;
switch(c) { switch(c) {
@ -286,6 +288,12 @@ int main(int argc, char **argv)
case 'f': case 'f':
scale = atof(optarg); scale = atof(optarg);
break; break;
case 'c':
cpuflags = av_parse_cpu_flags(optarg);
if (cpuflags < 0)
return 1;
av_set_cpu_flags_mask(cpuflags);
break;
} }
} }

@ -4,36 +4,38 @@ FATE_FFT += fate-fft-$(1) fate-ifft-$(1) \
fate-rdft-$(1) fate-irdft-$(1) \ fate-rdft-$(1) fate-irdft-$(1) \
fate-dct1d-$(1) fate-idct1d-$(1) fate-dct1d-$(1) fate-idct1d-$(1)
fate-fft-$(N): CMD = run libavcodec/fft-test -n$(1) fate-fft-$(N): ARGS = -n$(1)
fate-ifft-$(N): CMD = run libavcodec/fft-test -n$(1) -i fate-ifft-$(N): ARGS = -n$(1) -i
fate-mdct-$(N): CMD = run libavcodec/fft-test -n$(1) -m fate-mdct-$(N): ARGS = -n$(1) -m
fate-imdct-$(N): CMD = run libavcodec/fft-test -n$(1) -m -i fate-imdct-$(N): ARGS = -n$(1) -m -i
fate-rdft-$(N): CMD = run libavcodec/fft-test -n$(1) -r fate-rdft-$(N): ARGS = -n$(1) -r
fate-irdft-$(N): CMD = run libavcodec/fft-test -n$(1) -r -i fate-irdft-$(N): ARGS = -n$(1) -r -i
fate-dct1d-$(N): CMD = run libavcodec/fft-test -n$(1) -d fate-dct1d-$(N): ARGS = -n$(1) -d
fate-idct1d-$(N): CMD = run libavcodec/fft-test -n$(1) -d -i fate-idct1d-$(N): ARGS = -n$(1) -d -i
endef endef
$(foreach N, 4 5 6 7 8 9 10 11 12, $(eval $(call DEF_FFT,$(N)))) $(foreach N, 4 5 6 7 8 9 10 11 12, $(eval $(call DEF_FFT,$(N))))
fate-fft-test: $(FATE_FFT) fate-fft-test: $(FATE_FFT)
$(FATE_FFT): libavcodec/fft-test$(EXESUF) $(FATE_FFT): libavcodec/fft-test$(EXESUF)
$(FATE_FFT): CMD = run libavcodec/fft-test $(CPUFLAGS:%=-c%) $(ARGS)
$(FATE_FFT): REF = /dev/null $(FATE_FFT): REF = /dev/null
define DEF_FFT_FIXED define DEF_FFT_FIXED
FATE_FFT_FIXED += fate-fft-fixed-$(1) fate-ifft-fixed-$(1) \ FATE_FFT_FIXED += fate-fft-fixed-$(1) fate-ifft-fixed-$(1) \
fate-mdct-fixed-$(1) fate-imdct-fixed-$(1) fate-mdct-fixed-$(1) fate-imdct-fixed-$(1)
fate-fft-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1) fate-fft-fixed-$(1): ARGS = -n$(1)
fate-ifft-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1) -i fate-ifft-fixed-$(1): ARGS = -n$(1) -i
fate-mdct-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1) -m fate-mdct-fixed-$(1): ARGS = -n$(1) -m
fate-imdct-fixed-$(1): CMD = run libavcodec/fft-fixed-test -n$(1) -m -i fate-imdct-fixed-$(1): ARGS = -n$(1) -m -i
endef endef
$(foreach N, 4 5 6 7 8 9 10 11 12, $(eval $(call DEF_FFT_FIXED,$(N)))) $(foreach N, 4 5 6 7 8 9 10 11 12, $(eval $(call DEF_FFT_FIXED,$(N))))
fate-fft-fixed-test: $(FATE_FFT_FIXED) fate-fft-fixed-test: $(FATE_FFT_FIXED)
$(FATE_FFT_FIXED): libavcodec/fft-fixed-test$(EXESUF) $(FATE_FFT_FIXED): libavcodec/fft-fixed-test$(EXESUF)
$(FATE_FFT_FIXED): CMD = run libavcodec/fft-fixed-test $(CPUFLAGS:%=-c%) $(ARGS)
$(FATE_FFT_FIXED): REF = /dev/null $(FATE_FFT_FIXED): REF = /dev/null
FATE_TESTS += $(FATE_FFT) $(FATE_FFT_FIXED) FATE_TESTS += $(FATE_FFT) $(FATE_FFT_FIXED)

Loading…
Cancel
Save