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