Mercurial > mplayer.hg
annotate postproc/cs_test.c @ 7760:5262223af043
memleak fix
author | arpi |
---|---|
date | Wed, 16 Oct 2002 20:17:20 +0000 |
parents | e3a8a030c27a |
children | 5c3a8881adc4 |
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 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
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 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
23 #include "rgb2rgb.h" |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
24 #include "../cpudetect.h" |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
25 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
26 #define SIZE 1000 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
27 #define srcByte 0x55 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
28 #define dstByte 0xBB |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
29 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
30 main(int argc, char **argv) |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
31 { |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
32 int i, funcNum; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
33 uint8_t *srcBuffer= (uint8_t*)memalign(128, SIZE); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
34 uint8_t *dstBuffer= (uint8_t*)memalign(128, SIZE); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
35 int failedNum=0; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
36 int passedNum=0; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
37 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
38 printf("memory corruption test ...\n"); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
39 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
40 if(argc==2){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
41 GetCpuCaps(&gCpuCaps); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
42 printf("testing mmx\n"); |
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 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
45 for(funcNum=0; funcNum<100; funcNum++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
46 int width; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
47 int failed=0; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
48 int srcBpp=0; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
49 int dstBpp=0; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
50 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
51 printf("."); fflush(stdout); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
52 memset(srcBuffer, srcByte, SIZE); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
53 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
54 for(width=32; width<64; width++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
55 int dstOffset; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
56 for(dstOffset=128; dstOffset<196; dstOffset++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
57 int srcOffset; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
58 memset(dstBuffer, dstByte, SIZE); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
59 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
60 for(srcOffset=128; srcOffset<196; srcOffset++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
61 uint8_t *src= srcBuffer+srcOffset; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
62 uint8_t *dst= dstBuffer+dstOffset; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
63 char *name=NULL; |
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 if(failed) break; //dont fill the screen with shit ... |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
66 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
67 switch(funcNum){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
68 case 0: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
69 srcBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
70 dstBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
71 name="rgb15to16"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
72 rgb15to16(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
73 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
74 case 1: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
75 srcBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
76 dstBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
77 name="rgb15to24"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
78 rgb15to24(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
79 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
80 case 2: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
81 srcBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
82 dstBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
83 name="rgb15to32"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
84 rgb15to32(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
85 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
86 case 3: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
87 srcBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
88 dstBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
89 name="rgb16to24"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
90 rgb16to24(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
91 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
92 case 4: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
93 srcBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
94 dstBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
95 name="rgb16to32"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
96 rgb16to32(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
97 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
98 case 5: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
99 srcBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
100 dstBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
101 name="rgb24to15"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
102 rgb24to15(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
103 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
104 case 6: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
105 srcBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
106 dstBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
107 name="rgb24to16"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
108 rgb24to16(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
109 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
110 case 7: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
111 srcBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
112 dstBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
113 name="rgb24to32"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
114 rgb24to32(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
115 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
116 case 8: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
117 srcBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
118 dstBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
119 name="rgb32to15"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
120 rgb32to15(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
121 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
122 case 9: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
123 srcBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
124 dstBpp=2; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
125 name="rgb32to16"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
126 rgb32to16(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
127 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
128 case 10: |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
129 srcBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
130 dstBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
131 name="rgb32to24"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
132 rgb32to24(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
133 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
134 case 11: |
6607 | 135 srcBpp=2; |
136 dstBpp=2; | |
137 name="rgb16to15"; | |
138 rgb16to15(src, dst, width*srcBpp); | |
139 break; | |
140 | |
141 case 14: | |
142 srcBpp=2; | |
143 dstBpp=2; | |
144 name="rgb15tobgr15"; | |
145 rgb15tobgr15(src, dst, width*srcBpp); | |
146 break; | |
147 case 15: | |
148 srcBpp=2; | |
149 dstBpp=2; | |
150 name="rgb15tobgr16"; | |
151 rgb15tobgr16(src, dst, width*srcBpp); | |
152 break; | |
153 case 16: | |
154 srcBpp=2; | |
155 dstBpp=3; | |
156 name="rgb15tobgr24"; | |
157 rgb15tobgr24(src, dst, width*srcBpp); | |
158 break; | |
159 case 17: | |
160 srcBpp=2; | |
161 dstBpp=4; | |
162 name="rgb15tobgr32"; | |
163 rgb15tobgr32(src, dst, width*srcBpp); | |
164 break; | |
165 case 18: | |
166 srcBpp=2; | |
167 dstBpp=2; | |
168 name="rgb16tobgr15"; | |
169 rgb16tobgr15(src, dst, width*srcBpp); | |
170 break; | |
171 case 19: | |
172 srcBpp=2; | |
173 dstBpp=2; | |
174 name="rgb16tobgr16"; | |
175 rgb16tobgr16(src, dst, width*srcBpp); | |
176 break; | |
177 case 20: | |
178 srcBpp=2; | |
179 dstBpp=3; | |
180 name="rgb16tobgr24"; | |
181 rgb16tobgr24(src, dst, width*srcBpp); | |
182 break; | |
183 case 21: | |
184 srcBpp=2; | |
185 dstBpp=4; | |
186 name="rgb16tobgr32"; | |
187 rgb16tobgr32(src, dst, width*srcBpp); | |
188 break; | |
189 case 22: | |
190 srcBpp=3; | |
191 dstBpp=2; | |
192 name="rgb24tobgr15"; | |
193 rgb24tobgr15(src, dst, width*srcBpp); | |
194 break; | |
195 case 23: | |
196 srcBpp=3; | |
197 dstBpp=2; | |
198 name="rgb24tobgr16"; | |
199 rgb24tobgr16(src, dst, width*srcBpp); | |
200 break; | |
201 case 24: | |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
202 srcBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
203 dstBpp=3; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
204 name="rgb24tobgr24"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
205 rgb24tobgr24(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
206 break; |
6607 | 207 case 25: |
208 srcBpp=3; | |
209 dstBpp=4; | |
210 name="rgb24tobgr32"; | |
211 rgb24tobgr32(src, dst, width*srcBpp); | |
212 break; | |
213 case 26: | |
214 srcBpp=4; | |
215 dstBpp=2; | |
216 name="rgb32tobgr15"; | |
217 rgb32tobgr15(src, dst, width*srcBpp); | |
218 break; | |
219 case 27: | |
220 srcBpp=4; | |
221 dstBpp=2; | |
222 name="rgb32tobgr16"; | |
223 rgb32tobgr16(src, dst, width*srcBpp); | |
224 break; | |
225 case 28: | |
226 srcBpp=4; | |
227 dstBpp=3; | |
228 name="rgb32tobgr24"; | |
229 rgb32tobgr24(src, dst, width*srcBpp); | |
230 break; | |
231 case 29: | |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
232 srcBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
233 dstBpp=4; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
234 name="rgb32tobgr32"; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
235 rgb32tobgr32(src, dst, width*srcBpp); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
236 break; |
6607 | 237 |
6603
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
238 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
239 if(!srcBpp) break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
240 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
241 for(i=0; i<SIZE; i++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
242 if(srcBuffer[i]!=srcByte){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
243 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
|
244 i, width, srcOffset, dstOffset, name); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
245 failed=1; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
246 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
247 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
248 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
249 for(i=0; i<dstOffset; i++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
250 if(dstBuffer[i]!=dstByte){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
251 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
|
252 i, width, srcOffset, dstOffset, name); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
253 failed=1; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
254 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
255 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
256 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
257 for(i=dstOffset + width*dstBpp; i<SIZE; i++){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
258 if(dstBuffer[i]!=dstByte){ |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
259 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
|
260 i, width, srcOffset, dstOffset, name); |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
261 failed=1; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
262 break; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
263 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
264 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
265 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
266 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
267 } |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
268 if(failed) failedNum++; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
269 else if(srcBpp) passedNum++; |
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 |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
272 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
|
273 return failedNum; |
6eab60ea6c11
colorspace converter tests (memory corruption tests at different width/src/dst)
michael
parents:
diff
changeset
|
274 } |