Mercurial > mplayer.hg
annotate postproc/cs_test.c @ 17488:ce1ba8fd57e7
Make clean/distclean behave uniformly in all directories.
author | diego |
---|---|
date | Fri, 27 Jan 2006 00:06:42 +0000 |
parents | 401b440a6d76 |
children |
rev | line source |
---|---|
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
1 /* |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
2 Copyright (C) 2002 Michael Niedermayer <michaelni@gmx.at> |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
3 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
4 This program is free software; you can redistribute it and/or modify |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
5 it under the terms of the GNU General Public License as published by |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
6 the Free Software Foundation; either version 2 of the License, or |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
7 (at your option) any later version. |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
8 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
9 This program is distributed in the hope that it will be useful, |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
10 but WITHOUT ANY WARRANTY; without even the implied warranty of |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
12 GNU General Public License for more details. |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
13 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
14 You should have received a copy of the GNU General Public License |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
15 along with this program; if not, write to the Free Software |
17367
401b440a6d76
Update licensing information: The FSF changed postal address.
diego
parents:
16985
diff
changeset
|
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
17 */ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
18 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
19 #include <stdio.h> |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
20 #include <stdlib.h> |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
21 #include <inttypes.h> |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
22 |
10173 | 23 #include "swscale.h" |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
24 #include "rgb2rgb.h" |
16985 | 25 #include "cpudetect.h" |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
26 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
27 #define SIZE 1000 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
28 #define srcByte 0x55 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
29 #define dstByte 0xBB |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
30 |
12698 | 31 #ifdef __APPLE_CC__ |
32 #define memalign(x,y) malloc(y) | |
33 #endif | |
34 | |
10173 | 35 static int get_sws_cpuflags() |
36 { | |
37 return (gCpuCaps.hasMMX ? SWS_CPU_CAPS_MMX : 0) | | |
38 (gCpuCaps.hasMMX2 ? SWS_CPU_CAPS_MMX2 : 0) | | |
39 (gCpuCaps.has3DNow ? SWS_CPU_CAPS_3DNOW : 0); | |
40 } | |
41 | |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
42 main(int argc, char **argv) |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
43 { |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
44 int i, funcNum; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
45 uint8_t *srcBuffer= (uint8_t*)memalign(128, SIZE); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
46 uint8_t *dstBuffer= (uint8_t*)memalign(128, SIZE); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
47 int failedNum=0; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
48 int passedNum=0; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
49 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
50 printf("memory corruption test ...\n"); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
51 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
52 if(argc==2){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
53 GetCpuCaps(&gCpuCaps); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
54 printf("testing mmx\n"); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
55 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
56 |
10173 | 57 sws_rgb2rgb_init(get_sws_cpuflags()); |
58 | |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
59 for(funcNum=0; funcNum<100; funcNum++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
60 int width; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
61 int failed=0; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
62 int srcBpp=0; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
63 int dstBpp=0; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
64 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
65 printf("."); fflush(stdout); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
66 memset(srcBuffer, srcByte, SIZE); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
67 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
68 for(width=32; width<64; width++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
69 int dstOffset; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
70 for(dstOffset=128; dstOffset<196; dstOffset++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
71 int srcOffset; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
72 memset(dstBuffer, dstByte, SIZE); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
73 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
74 for(srcOffset=128; srcOffset<196; srcOffset++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
75 uint8_t *src= srcBuffer+srcOffset; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
76 uint8_t *dst= dstBuffer+dstOffset; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
77 char *name=NULL; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
78 |
11000 | 79 if(failed) break; //don't fill the screen with shit ... |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
80 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
81 switch(funcNum){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
82 case 0: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
83 srcBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
84 dstBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
85 name="rgb15to16"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
86 rgb15to16(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
87 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
88 case 1: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
89 srcBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
90 dstBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
91 name="rgb15to24"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
92 rgb15to24(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
93 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
94 case 2: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
95 srcBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
96 dstBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
97 name="rgb15to32"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
98 rgb15to32(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
99 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
100 case 3: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
101 srcBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
102 dstBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
103 name="rgb16to24"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
104 rgb16to24(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
105 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
106 case 4: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
107 srcBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
108 dstBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
109 name="rgb16to32"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
110 rgb16to32(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
111 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
112 case 5: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
113 srcBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
114 dstBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
115 name="rgb24to15"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
116 rgb24to15(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
117 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
118 case 6: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
119 srcBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
120 dstBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
121 name="rgb24to16"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
122 rgb24to16(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
123 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
124 case 7: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
125 srcBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
126 dstBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
127 name="rgb24to32"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
128 rgb24to32(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
129 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
130 case 8: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
131 srcBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
132 dstBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
133 name="rgb32to15"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
134 rgb32to15(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
135 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
136 case 9: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
137 srcBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
138 dstBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
139 name="rgb32to16"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
140 rgb32to16(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
141 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
142 case 10: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
143 srcBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
144 dstBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
145 name="rgb32to24"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
146 rgb32to24(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
147 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
148 case 11: |
6607 | 149 srcBpp=2; |
150 dstBpp=2; | |
151 name="rgb16to15"; | |
152 rgb16to15(src, dst, width*srcBpp); | |
153 break; | |
154 | |
155 case 14: | |
156 srcBpp=2; | |
157 dstBpp=2; | |
158 name="rgb15tobgr15"; | |
159 rgb15tobgr15(src, dst, width*srcBpp); | |
160 break; | |
161 case 15: | |
162 srcBpp=2; | |
163 dstBpp=2; | |
164 name="rgb15tobgr16"; | |
165 rgb15tobgr16(src, dst, width*srcBpp); | |
166 break; | |
167 case 16: | |
168 srcBpp=2; | |
169 dstBpp=3; | |
170 name="rgb15tobgr24"; | |
171 rgb15tobgr24(src, dst, width*srcBpp); | |
172 break; | |
173 case 17: | |
174 srcBpp=2; | |
175 dstBpp=4; | |
176 name="rgb15tobgr32"; | |
177 rgb15tobgr32(src, dst, width*srcBpp); | |
178 break; | |
179 case 18: | |
180 srcBpp=2; | |
181 dstBpp=2; | |
182 name="rgb16tobgr15"; | |
183 rgb16tobgr15(src, dst, width*srcBpp); | |
184 break; | |
185 case 19: | |
186 srcBpp=2; | |
187 dstBpp=2; | |
188 name="rgb16tobgr16"; | |
189 rgb16tobgr16(src, dst, width*srcBpp); | |
190 break; | |
191 case 20: | |
192 srcBpp=2; | |
193 dstBpp=3; | |
194 name="rgb16tobgr24"; | |
195 rgb16tobgr24(src, dst, width*srcBpp); | |
196 break; | |
197 case 21: | |
198 srcBpp=2; | |
199 dstBpp=4; | |
200 name="rgb16tobgr32"; | |
201 rgb16tobgr32(src, dst, width*srcBpp); | |
202 break; | |
203 case 22: | |
204 srcBpp=3; | |
205 dstBpp=2; | |
206 name="rgb24tobgr15"; | |
207 rgb24tobgr15(src, dst, width*srcBpp); | |
208 break; | |
209 case 23: | |
210 srcBpp=3; | |
211 dstBpp=2; | |
212 name="rgb24tobgr16"; | |
213 rgb24tobgr16(src, dst, width*srcBpp); | |
214 break; | |
215 case 24: | |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
216 srcBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
217 dstBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
218 name="rgb24tobgr24"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
219 rgb24tobgr24(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
220 break; |
6607 | 221 case 25: |
222 srcBpp=3; | |
223 dstBpp=4; | |
224 name="rgb24tobgr32"; | |
225 rgb24tobgr32(src, dst, width*srcBpp); | |
226 break; | |
227 case 26: | |
228 srcBpp=4; | |
229 dstBpp=2; | |
230 name="rgb32tobgr15"; | |
231 rgb32tobgr15(src, dst, width*srcBpp); | |
232 break; | |
233 case 27: | |
234 srcBpp=4; | |
235 dstBpp=2; | |
236 name="rgb32tobgr16"; | |
237 rgb32tobgr16(src, dst, width*srcBpp); | |
238 break; | |
239 case 28: | |
240 srcBpp=4; | |
241 dstBpp=3; | |
242 name="rgb32tobgr24"; | |
243 rgb32tobgr24(src, dst, width*srcBpp); | |
244 break; | |
245 case 29: | |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
246 srcBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
247 dstBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
248 name="rgb32tobgr32"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
249 rgb32tobgr32(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
250 break; |
6607 | 251 |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
252 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
253 if(!srcBpp) break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
254 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
255 for(i=0; i<SIZE; i++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
256 if(srcBuffer[i]!=srcByte){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
257 printf("src damaged at %d w:%d src:%d dst:%d %s\n", |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
258 i, width, srcOffset, dstOffset, name); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
259 failed=1; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
260 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
261 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
262 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
263 for(i=0; i<dstOffset; i++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
264 if(dstBuffer[i]!=dstByte){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
265 printf("dst damaged at %d w:%d src:%d dst:%d %s\n", |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
266 i, width, srcOffset, dstOffset, name); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
267 failed=1; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
268 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
269 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
270 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
271 for(i=dstOffset + width*dstBpp; i<SIZE; i++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
272 if(dstBuffer[i]!=dstByte){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
273 printf("dst damaged at %d w:%d src:%d dst:%d %s\n", |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
274 i, width, srcOffset, dstOffset, name); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
275 failed=1; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
276 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
277 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
278 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
279 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
280 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
281 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
282 if(failed) failedNum++; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
283 else if(srcBpp) passedNum++; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
284 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
285 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
286 printf("%d converters passed, %d converters randomly overwrote memory\n", passedNum, failedNum); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
287 return failedNum; |
12698 | 288 } |