Mercurial > mplayer.hg
comparison libswscale/cs_test.c @ 19470:b3939dba3c13
Allow to compile swscale tests
author | lucabe |
---|---|
date | Mon, 21 Aug 2006 12:15:29 +0000 |
parents | 8579acff875e |
children | f837670d269c |
comparison
equal
deleted
inserted
replaced
19469:b9d2ceb63777 | 19470:b3939dba3c13 |
---|---|
15 along with this program; if not, write to the Free Software | 15 along with this program; if not, write to the Free Software |
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 */ | 17 */ |
18 | 18 |
19 #include <stdio.h> | 19 #include <stdio.h> |
20 #include <string.h> /* for memset() */ | |
21 #include <unistd.h> | |
20 #include <stdlib.h> | 22 #include <stdlib.h> |
21 #include <inttypes.h> | 23 #include <inttypes.h> |
22 | 24 |
23 #include "swscale.h" | 25 #include "swscale.h" |
24 #include "rgb2rgb.h" | 26 #include "rgb2rgb.h" |
25 #include "cpudetect.h" | |
26 | 27 |
27 #define SIZE 1000 | 28 #define SIZE 1000 |
28 #define srcByte 0x55 | 29 #define srcByte 0x55 |
29 #define dstByte 0xBB | 30 #define dstByte 0xBB |
30 | 31 |
31 #ifdef __APPLE_CC__ | 32 #ifdef __APPLE_CC__ |
32 #define memalign(x,y) malloc(y) | 33 #define memalign(x,y) malloc(y) |
33 #endif | 34 #endif |
34 | 35 |
35 static int get_sws_cpuflags() | 36 static int cpu_caps; |
37 | |
38 static char *args_parse(int argc, char *argv[]) | |
36 { | 39 { |
37 return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) | | 40 int o; |
38 (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0) | | 41 |
39 (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0); | 42 while ((o = getopt(argc, argv, "m23")) != -1) { |
43 switch (o) { | |
44 case 'm': | |
45 cpu_caps |= SWS_CPU_CAPS_MMX; | |
46 break; | |
47 case '2': | |
48 cpu_caps |= SWS_CPU_CAPS_MMX2; | |
49 break; | |
50 case '3': | |
51 cpu_caps |= SWS_CPU_CAPS_3DNOW; | |
52 break; | |
53 default: | |
54 fprintf(stderr, "Unknown option %c\n", o); | |
55 } | |
56 } | |
57 | |
58 return argv[optind]; | |
40 } | 59 } |
41 | 60 |
42 main(int argc, char **argv) | 61 main(int argc, char **argv) |
43 { | 62 { |
44 int i, funcNum; | 63 int i, funcNum; |
46 uint8_t *dstBuffer= (uint8_t*)memalign(128, SIZE); | 65 uint8_t *dstBuffer= (uint8_t*)memalign(128, SIZE); |
47 int failedNum=0; | 66 int failedNum=0; |
48 int passedNum=0; | 67 int passedNum=0; |
49 | 68 |
50 printf("memory corruption test ...\n"); | 69 printf("memory corruption test ...\n"); |
51 | 70 args_parse(argc, argv); |
52 if(argc==2){ | 71 fprintf(stderr, "CPU capabilities forced to %x\n", cpu_caps); |
53 GetCpuCaps(&gCpuCaps); | 72 sws_rgb2rgb_init(cpu_caps); |
54 printf("testing mmx\n"); | |
55 } | |
56 | |
57 sws_rgb2rgb_init(get_sws_cpuflags()); | |
58 | 73 |
59 for(funcNum=0; funcNum<100; funcNum++){ | 74 for(funcNum=0; funcNum<100; funcNum++){ |
60 int width; | 75 int width; |
61 int failed=0; | 76 int failed=0; |
62 int srcBpp=0; | 77 int srcBpp=0; |