From dc1959af891b1b94eb875254c92e37e54dfb9fa5 Mon Sep 17 00:00:00 2001 From: lucabe Date: Mon, 21 Aug 2006 12:15:29 +0000 Subject: Allow to compile swscale tests git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19476 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/cs_test.c | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) (limited to 'libswscale/cs_test.c') diff --git a/libswscale/cs_test.c b/libswscale/cs_test.c index b1963f92f6..5778a146ba 100644 --- a/libswscale/cs_test.c +++ b/libswscale/cs_test.c @@ -17,12 +17,13 @@ */ #include +#include /* for memset() */ +#include #include #include #include "swscale.h" #include "rgb2rgb.h" -#include "cpudetect.h" #define SIZE 1000 #define srcByte 0x55 @@ -32,11 +33,29 @@ #define memalign(x,y) malloc(y) #endif -static int get_sws_cpuflags() +static int cpu_caps; + +static char *args_parse(int argc, char *argv[]) { - return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) | - (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0) | - (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0); + int o; + + while ((o = getopt(argc, argv, "m23")) != -1) { + switch (o) { + case 'm': + cpu_caps |= SWS_CPU_CAPS_MMX; + break; + case '2': + cpu_caps |= SWS_CPU_CAPS_MMX2; + break; + case '3': + cpu_caps |= SWS_CPU_CAPS_3DNOW; + break; + default: + fprintf(stderr, "Unknown option %c\n", o); + } + } + + return argv[optind]; } main(int argc, char **argv) @@ -48,13 +67,9 @@ main(int argc, char **argv) int passedNum=0; printf("memory corruption test ...\n"); - - if(argc==2){ - GetCpuCaps(&gCpuCaps); - printf("testing mmx\n"); - } - - sws_rgb2rgb_init(get_sws_cpuflags()); + args_parse(argc, argv); + fprintf(stderr, "CPU capabilities forced to %x\n", cpu_caps); + sws_rgb2rgb_init(cpu_caps); for(funcNum=0; funcNum<100; funcNum++){ int width; -- cgit v1.2.3