Revision 2a80b21d libswscale/cs_test.c

View differences:

libswscale/cs_test.c
31 31
#define srcByte 0x55
32 32
#define dstByte 0xBB
33 33

  
34
#define FUNC(s,d,n) {s,d,#n,n}
34 35

  
35 36
static int cpu_caps;
36 37

  
......
70 71
	av_log(NULL, AV_LOG_INFO, "CPU capabilities forced to %x\n", cpu_caps);
71 72
	sws_rgb2rgb_init(cpu_caps);
72 73
	
73
	for(funcNum=0; funcNum<100; funcNum++){
74
	for(funcNum=0; ; funcNum++){
75
		struct func_info_s {
76
			int src_bpp;
77
			int dst_bpp;
78
			char *name;
79
			void (*func)(const uint8_t *src, uint8_t *dst, long src_size);
80
		} func_info[] = {
81
			FUNC(2, 2, rgb15to16),
82
			FUNC(2, 3, rgb15to24),
83
			FUNC(2, 4, rgb15to32),
84
			FUNC(2, 3, rgb16to24),
85
			FUNC(2, 4, rgb16to32),
86
			FUNC(3, 2, rgb24to15),
87
			FUNC(3, 2, rgb24to16),
88
			FUNC(3, 4, rgb24to32),
89
			FUNC(4, 2, rgb32to15),
90
			FUNC(4, 2, rgb32to16),
91
			FUNC(4, 3, rgb32to24),
92
			FUNC(2, 2, rgb16to15),
93
			FUNC(2, 2, rgb15tobgr15),
94
			FUNC(2, 2, rgb15tobgr16),
95
			FUNC(2, 3, rgb15tobgr24),
96
			FUNC(2, 4, rgb15tobgr32),
97
			FUNC(2, 2, rgb16tobgr15),
98
			FUNC(2, 2, rgb16tobgr16),
99
			FUNC(2, 3, rgb16tobgr24),
100
			FUNC(2, 4, rgb16tobgr32),
101
			FUNC(3, 2, rgb24tobgr15),
102
			FUNC(3, 2, rgb24tobgr16),
103
			FUNC(3, 3, rgb24tobgr24),
104
			FUNC(3, 4, rgb24tobgr32),
105
			FUNC(4, 2, rgb32tobgr15),
106
			FUNC(4, 2, rgb32tobgr16),
107
			FUNC(4, 3, rgb32tobgr24),
108
			FUNC(4, 4, rgb32tobgr32),
109
			FUNC(0, 0, NULL)
110
		};
74 111
		int width;
75 112
		int failed=0;
76 113
		int srcBpp=0;
77 114
		int dstBpp=0;
78 115

  
116
		if (!func_info[funcNum].func) break;
117

  
79 118
		av_log(NULL, AV_LOG_INFO,".");
80 119
		memset(srcBuffer, srcByte, SIZE);
81 120

  
......
92 131
					
93 132
					if(failed) break; //don't fill the screen with shit ...
94 133

  
95
					switch(funcNum){
96
					case 0:
97
						srcBpp=2;
98
						dstBpp=2;
99
						name="rgb15to16";
100
						rgb15to16(src, dst, width*srcBpp);
101
						break;
102
					case 1:
103
						srcBpp=2;
104
						dstBpp=3;
105
						name="rgb15to24";
106
						rgb15to24(src, dst, width*srcBpp);
107
						break;
108
					case 2:
109
						srcBpp=2;
110
						dstBpp=4;
111
						name="rgb15to32";
112
						rgb15to32(src, dst, width*srcBpp);
113
						break;
114
					case 3:
115
						srcBpp=2;
116
						dstBpp=3;
117
						name="rgb16to24";
118
						rgb16to24(src, dst, width*srcBpp);
119
						break;
120
					case 4:
121
						srcBpp=2;
122
						dstBpp=4;
123
						name="rgb16to32";
124
						rgb16to32(src, dst, width*srcBpp);
125
						break;
126
					case 5:
127
						srcBpp=3;
128
						dstBpp=2;
129
						name="rgb24to15";
130
						rgb24to15(src, dst, width*srcBpp);
131
						break;
132
					case 6:
133
						srcBpp=3;
134
						dstBpp=2;
135
						name="rgb24to16";
136
						rgb24to16(src, dst, width*srcBpp);
137
						break;
138
					case 7:
139
						srcBpp=3;
140
						dstBpp=4;
141
						name="rgb24to32";
142
						rgb24to32(src, dst, width*srcBpp);
143
						break;
144
					case 8:
145
						srcBpp=4;
146
						dstBpp=2;
147
						name="rgb32to15";
148
                        //((*s++) << TGA_SHIFT32) | TGA_ALPHA32;
149
						rgb32to15(src, dst, width*srcBpp);
150
						break;
151
					case 9:
152
						srcBpp=4;
153
						dstBpp=2;
154
						name="rgb32to16";
155
						rgb32to16(src, dst, width*srcBpp);
156
						break;
157
					case 10:
158
						srcBpp=4;
159
						dstBpp=3;
160
						name="rgb32to24";
161
						rgb32to24(src, dst, width*srcBpp);
162
						break;
163
					case 11:
164
						srcBpp=2;
165
						dstBpp=2;
166
						name="rgb16to15";
167
						rgb16to15(src, dst, width*srcBpp);
168
						break;
169
					
170
					case 14:
171
						srcBpp=2;
172
						dstBpp=2;
173
						name="rgb15tobgr15";
174
						rgb15tobgr15(src, dst, width*srcBpp);
175
						break;
176
					case 15:
177
						srcBpp=2;
178
						dstBpp=2;
179
						name="rgb15tobgr16";
180
						rgb15tobgr16(src, dst, width*srcBpp);
181
						break;
182
					case 16:
183
						srcBpp=2;
184
						dstBpp=3;
185
						name="rgb15tobgr24";
186
						rgb15tobgr24(src, dst, width*srcBpp);
187
						break;
188
					case 17:
189
						srcBpp=2;
190
						dstBpp=4;
191
						name="rgb15tobgr32";
192
						rgb15tobgr32(src, dst, width*srcBpp);
193
						break;
194
					case 18:
195
						srcBpp=2;
196
						dstBpp=2;
197
						name="rgb16tobgr15";
198
						rgb16tobgr15(src, dst, width*srcBpp);
199
						break;
200
					case 19:
201
						srcBpp=2;
202
						dstBpp=2;
203
						name="rgb16tobgr16";
204
						rgb16tobgr16(src, dst, width*srcBpp);
205
						break;
206
					case 20:
207
						srcBpp=2;
208
						dstBpp=3;
209
						name="rgb16tobgr24";
210
						rgb16tobgr24(src, dst, width*srcBpp);
211
						break;
212
					case 21:
213
						srcBpp=2;
214
						dstBpp=4;
215
						name="rgb16tobgr32";
216
						rgb16tobgr32(src, dst, width*srcBpp);
217
						break;
218
					case 22:
219
						srcBpp=3;
220
						dstBpp=2;
221
						name="rgb24tobgr15";
222
						rgb24tobgr15(src, dst, width*srcBpp);
223
						break;
224
					case 23:
225
						srcBpp=3;
226
						dstBpp=2;
227
						name="rgb24tobgr16";
228
						rgb24tobgr16(src, dst, width*srcBpp);
229
						break;
230
					case 24:
231
						srcBpp=3;
232
						dstBpp=3;
233
						name="rgb24tobgr24";
234
						rgb24tobgr24(src, dst, width*srcBpp);
235
						break;
236
					case 25:
237
						srcBpp=3;
238
						dstBpp=4;
239
						name="rgb24tobgr32";
240
						rgb24tobgr32(src, dst, width*srcBpp);
241
						break;
242
					case 26:
243
						srcBpp=4;
244
						dstBpp=2;
245
						name="rgb32tobgr15";
246
						rgb32tobgr15(src, dst, width*srcBpp);
247
						break;
248
					case 27:
249
						srcBpp=4;
250
						dstBpp=2;
251
						name="rgb32tobgr16";
252
						rgb32tobgr16(src, dst, width*srcBpp);
253
						break;
254
					case 28:
255
						srcBpp=4;
256
						dstBpp=3;
257
						name="rgb32tobgr24";
258
						rgb32tobgr24(src, dst, width*srcBpp);
259
						break;
260
					case 29:
261
						srcBpp=4;
262
						dstBpp=4;
263
						name="rgb32tobgr32";
264
						rgb32tobgr32(src, dst, width*srcBpp);
265
						break;
134
					srcBpp = func_info[funcNum].src_bpp;
135
					dstBpp = func_info[funcNum].dst_bpp;
136
					name   = func_info[funcNum].name;
137

  
138
					func_info[funcNum].func(src, dst, width*srcBpp);
266 139

  
267
					}
268 140
					if(!srcBpp) break;
269 141

  
270 142
					for(i=0; i<SIZE; i++){
......
298 170
		else if(srcBpp) passedNum++;
299 171
	}
300 172
	
301
	av_log(NULL, AV_LOG_INFO, "%d converters passed, %d converters randomly overwrote memory\n", passedNum, failedNum);
173
	av_log(NULL, AV_LOG_INFO, "\n%d converters passed, %d converters randomly overwrote memory\n", passedNum, failedNum);
302 174
	return failedNum;
303 175
}

Also available in: Unified diff