aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/evas/src/lib/engines/common/evas_convert_rgb_32.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2012-01-04 18:41:13 +1000
committerDavid Walter Seikel2012-01-04 18:41:13 +1000
commitdd7595a3475407a7fa96a97393bae8c5220e8762 (patch)
treee341e911d7eb911a51684a7412ef7f7c7605d28e /libraries/evas/src/lib/engines/common/evas_convert_rgb_32.c
parentAdd the skeleton. (diff)
downloadSledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.zip
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.gz
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.bz2
SledjHamr-dd7595a3475407a7fa96a97393bae8c5220e8762.tar.xz
Add the base Enlightenment Foundation Libraries - eina, eet, evas, ecore, embryo, and edje.
Note that embryo wont be used, but I'm not sure yet if you can build edje without it.
Diffstat (limited to 'libraries/evas/src/lib/engines/common/evas_convert_rgb_32.c')
-rw-r--r--libraries/evas/src/lib/engines/common/evas_convert_rgb_32.c460
1 files changed, 460 insertions, 0 deletions
diff --git a/libraries/evas/src/lib/engines/common/evas_convert_rgb_32.c b/libraries/evas/src/lib/engines/common/evas_convert_rgb_32.c
new file mode 100644
index 0000000..41dac6f
--- /dev/null
+++ b/libraries/evas/src/lib/engines/common/evas_convert_rgb_32.c
@@ -0,0 +1,460 @@
1#include "evas_common.h"
2#include "evas_convert_rgb_32.h"
3
4#ifdef BUILD_CONVERT_32_RGB_8888
5#ifdef BUILD_CONVERT_32_RGB_ROT0
6void
7evas_common_convert_rgba_to_32bpp_rgb_8888 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
8{
9 DATA32 *src_ptr;
10 DATA32 *dst_ptr;
11 int y;
12 Gfx_Func_Copy func;
13
14 dst_ptr = (DATA32 *)dst;
15 src_ptr = src;
16
17 func = evas_common_draw_func_copy_get(w, 0);
18
19 for (y = 0; y < h; y++)
20 {
21 func(src_ptr, dst_ptr, w);
22 src_ptr += w + src_jump;
23 dst_ptr += w + dst_jump;
24 }
25 return;
26}
27#endif
28#endif
29
30#ifdef BUILD_CONVERT_32_RGB_8888
31#ifdef BUILD_CONVERT_32_RGB_ROT180
32void
33evas_common_convert_rgba_to_32bpp_rgb_8888_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
34{
35 DATA32 *src_ptr;
36 DATA32 *dst_ptr;
37 int x, y;
38
39 dst_ptr = (DATA32 *)dst;
40
41 CONVERT_LOOP_START_ROT_180();
42
43 *dst_ptr = *src_ptr;
44
45 CONVERT_LOOP_END_ROT_180();
46 return;
47}
48#endif
49#endif
50
51#ifdef BUILD_CONVERT_32_RGB_8888
52#ifdef BUILD_CONVERT_32_RGB_ROT270
53void
54evas_common_convert_rgba_to_32bpp_rgb_8888_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
55{
56 DATA32 *src_ptr;
57 DATA32 *dst_ptr;
58 int x, y;
59
60 dst_ptr = (DATA32 *)dst;
61
62 CONVERT_LOOP_START_ROT_270();
63
64 *dst_ptr = *src_ptr;
65
66 CONVERT_LOOP_END_ROT_270();
67 return;
68}
69#endif
70#endif
71
72#ifdef BUILD_CONVERT_32_RGB_8888
73#ifdef BUILD_CONVERT_32_RGB_ROT90
74void
75evas_common_convert_rgba_to_32bpp_rgb_8888_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
76{
77#ifndef BUILD_NEON
78 DATA32 *src_ptr;
79 DATA32 *dst_ptr;
80 int x, y;
81
82 dst_ptr = (DATA32 *)dst;
83 CONVERT_LOOP_START_ROT_90();
84
85 *dst_ptr = *src_ptr;
86
87 CONVERT_LOOP_END_ROT_90();
88#else
89 if ((w & 1) || (h & 1))
90 {
91 /* Rarely (if ever) if ever: so slow path is fine */
92 DATA32 *src_ptr;
93 DATA32 *dst_ptr;
94 int x, y;
95
96 dst_ptr = (DATA32 *)dst;
97 CONVERT_LOOP_START_ROT_90();
98
99 *dst_ptr = *src_ptr;
100
101 CONVERT_LOOP_END_ROT_90();
102 } else {
103#define AP "convert_rgba32_rot_90_"
104 asm volatile (
105 ".fpu neon \n\t"
106 " mov %[s1], %[src] \n\t"
107 " add %[s1], %[h],lsl #2 \n\t"
108 " sub %[s1], #8 \n\t"
109
110 " mov %[s2], %[src] \n\t"
111 " add %[s2], %[h], lsl #3 \n\t"
112 " add %[s2], %[sjmp], lsr #1 \n\t"
113 " sub %[s2], #8 \n\t"
114
115 " mov %[d1], %[dst] \n\t"
116
117 " add %[d2], %[d1], %[djmp] \n\t"
118 " add %[d2], %[w], lsl #2 \n\t"
119
120 " mov %[sadv], %[h], lsl #3 \n\t"
121 " add %[sadv], %[sjmp], lsl #1 \n\t"
122
123 " mov %[y], #0 \n\t"
124 " mov %[x], #0 \n\t"
125 AP"loop: \n\t"
126 " vld1.u32 d0, [%[s1]] \n\t"
127 " vld1.u32 d1, [%[s2]] \n\t"
128 " add %[x], #2 \n\t"
129 " add %[s1], %[sadv] \n\t"
130 " add %[s2], %[sadv] \n\t"
131 " vtrn.u32 d0, d1 \n\t"
132 " cmp %[x], %[w] \n\t"
133 " vst1.u32 d1, [%[d1]]! \n\t"
134 " vst1.u32 d0, [%[d2]]! \n\t"
135 " blt "AP"loop \n\t"
136
137 " mov %[x], #0 \n\t"
138 " add %[d1], %[djmp] \n\t"
139 " add %[d1], %[w], lsl #2 \n\t"
140 " add %[d2], %[djmp] \n\t"
141 " add %[d2], %[w], lsl #2 \n\t"
142
143 " mov %[s1], %[src] \n\t"
144 " add %[s1], %[h], lsl #2 \n\t"
145 " sub %[s1], %[y], lsl #2 \n\t"
146 " sub %[s1], #16 \n\t"
147
148 " add %[s2], %[s1], %[h], lsl #2 \n\t"
149 " add %[s2], %[sjmp], lsl #2 \n\t"
150
151 " add %[y], #2 \n\t"
152
153 " cmp %[y], %[h] \n\t"
154 " blt "AP"loop \n\t"
155
156 : // Out
157 : [s1] "r" (1),
158 [s2] "r" (11),
159 [d1] "r" (2),
160 [d2] "r" (12),
161 [src] "r" (src),
162 [dst] "r" (dst),
163 [x] "r" (3),
164 [y] "r" (4),
165 [w] "r" (w),
166 [h] "r" (h),
167 [sadv] "r" (5),
168 [sjmp] "r" (src_jump * 4),
169 [djmp] "r" (dst_jump * 4 * 2)
170 : "d0", "d1", "memory", "cc"// Clober
171
172
173 );
174 }
175#undef AP
176#endif
177 return;
178}
179#endif
180#endif
181
182#ifdef BUILD_CONVERT_32_RGBX_8888
183#ifdef BUILD_CONVERT_32_RGB_ROT0
184void
185evas_common_convert_rgba_to_32bpp_rgbx_8888 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
186{
187 DATA32 *src_ptr;
188 DATA32 *dst_ptr;
189 int x, y;
190
191 dst_ptr = (DATA32 *)dst;
192
193 CONVERT_LOOP_START_ROT_0();
194
195// *dst_ptr = (R_VAL(src_ptr) << 24) | (G_VAL(src_ptr) << 16) | (B_VAL(src_ptr) << 8);
196 *dst_ptr = (*src_ptr << 8);
197
198 CONVERT_LOOP_END_ROT_0();
199 return;
200}
201#endif
202#endif
203
204#ifdef BUILD_CONVERT_32_RGBX_8888
205#ifdef BUILD_CONVERT_32_RGB_ROT180
206void
207evas_common_convert_rgba_to_32bpp_rgbx_8888_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
208{
209 DATA32 *src_ptr;
210 DATA32 *dst_ptr;
211 int x, y;
212
213 dst_ptr = (DATA32 *)dst;
214
215 CONVERT_LOOP_START_ROT_180();
216
217// *dst_ptr = (R_VAL(src_ptr) << 24) | (G_VAL(src_ptr) << 16) | (B_VAL(src_ptr) << 8);
218 *dst_ptr = (*src_ptr << 8);
219
220 CONVERT_LOOP_END_ROT_180();
221 return;
222}
223#endif
224#endif
225
226#ifdef BUILD_CONVERT_32_RGBX_8888
227#ifdef BUILD_CONVERT_32_RGB_ROT270
228void
229evas_common_convert_rgba_to_32bpp_rgbx_8888_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
230{
231 DATA32 *src_ptr;
232 DATA32 *dst_ptr;
233 int x, y;
234
235 dst_ptr = (DATA32 *)dst;
236
237 CONVERT_LOOP_START_ROT_270();
238
239// *dst_ptr = (R_VAL(src_ptr) << 24) | (G_VAL(src_ptr) << 16) | (B_VAL(src_ptr) << 8);
240 *dst_ptr = (*src_ptr << 8);
241
242 CONVERT_LOOP_END_ROT_270();
243 return;
244}
245#endif
246#endif
247
248#ifdef BUILD_CONVERT_32_RGBX_8888
249#ifdef BUILD_CONVERT_32_RGB_ROT90
250void
251evas_common_convert_rgba_to_32bpp_rgbx_8888_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
252{
253 DATA32 *src_ptr;
254 DATA32 *dst_ptr;
255 int x, y;
256
257 dst_ptr = (DATA32 *)dst;
258
259 CONVERT_LOOP_START_ROT_90();
260
261// *dst_ptr = (R_VAL(src_ptr) << 24) | (G_VAL(src_ptr) << 16) | (B_VAL(src_ptr) << 8);
262 *dst_ptr = (*src_ptr << 8);
263
264 CONVERT_LOOP_END_ROT_90();
265 return;
266}
267#endif
268#endif
269
270#ifdef BUILD_CONVERT_32_BGR_8888
271#ifdef BUILD_CONVERT_32_RGB_ROT0
272void
273evas_common_convert_rgba_to_32bpp_bgr_8888 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
274{
275 DATA32 *src_ptr;
276 DATA32 *dst_ptr;
277 int x, y;
278
279 dst_ptr = (DATA32 *)dst;
280
281 CONVERT_LOOP_START_ROT_0();
282
283 *dst_ptr = (B_VAL(src_ptr) << 16) | (G_VAL(src_ptr) << 8) | (R_VAL(src_ptr));
284
285 CONVERT_LOOP_END_ROT_0();
286 return;
287}
288#endif
289#endif
290
291#ifdef BUILD_CONVERT_32_BGR_8888
292#ifdef BUILD_CONVERT_32_RGB_ROT180
293void
294evas_common_convert_rgba_to_32bpp_bgr_8888_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
295{
296 DATA32 *src_ptr;
297 DATA32 *dst_ptr;
298 int x, y;
299
300 dst_ptr = (DATA32 *)dst;
301
302 CONVERT_LOOP_START_ROT_180();
303
304 *dst_ptr = (B_VAL(src_ptr) << 16) | (G_VAL(src_ptr) << 8) | (R_VAL(src_ptr));
305
306 CONVERT_LOOP_END_ROT_180();
307 return;
308}
309#endif
310#endif
311
312#ifdef BUILD_CONVERT_32_BGR_8888
313#ifdef BUILD_CONVERT_32_RGB_ROT270
314void
315evas_common_convert_rgba_to_32bpp_bgr_8888_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
316{
317 DATA32 *src_ptr;
318 DATA32 *dst_ptr;
319 int x, y;
320
321 dst_ptr = (DATA32 *)dst;
322
323 CONVERT_LOOP_START_ROT_270();
324
325 *dst_ptr = (B_VAL(src_ptr) << 16) | (G_VAL(src_ptr) << 8) | (R_VAL(src_ptr));
326
327 CONVERT_LOOP_END_ROT_270();
328 return;
329}
330#endif
331#endif
332
333#ifdef BUILD_CONVERT_32_BGR_8888
334#ifdef BUILD_CONVERT_32_RGB_ROT90
335void
336evas_common_convert_rgba_to_32bpp_bgr_8888_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
337{
338 DATA32 *src_ptr;
339 DATA32 *dst_ptr;
340 int x, y;
341
342 dst_ptr = (DATA32 *)dst;
343
344 CONVERT_LOOP_START_ROT_90();
345
346 *dst_ptr = (B_VAL(src_ptr) << 16) | (G_VAL(src_ptr) << 8) | (R_VAL(src_ptr));
347
348 CONVERT_LOOP_END_ROT_90();
349 return;
350}
351#endif
352#endif
353
354#ifdef BUILD_CONVERT_32_BGRX_8888
355#ifdef BUILD_CONVERT_32_RGB_ROT0
356void
357evas_common_convert_rgba_to_32bpp_bgrx_8888 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
358{
359 DATA32 *src_ptr;
360 DATA32 *dst_ptr;
361 int x, y;
362
363 dst_ptr = (DATA32 *)dst;
364
365 CONVERT_LOOP_START_ROT_0();
366
367 *dst_ptr = (B_VAL(src_ptr) << 24) | (G_VAL(src_ptr) << 16) | (R_VAL(src_ptr) << 8);
368
369 CONVERT_LOOP_END_ROT_0();
370 return;
371}
372#endif
373#endif
374
375#ifdef BUILD_CONVERT_32_BGRX_8888
376#ifdef BUILD_CONVERT_32_RGB_ROT180
377void
378evas_common_convert_rgba_to_32bpp_bgrx_8888_rot_180 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
379{
380 DATA32 *src_ptr;
381 DATA32 *dst_ptr;
382 int x, y;
383
384 dst_ptr = (DATA32 *)dst;
385
386 CONVERT_LOOP_START_ROT_180();
387
388 *dst_ptr = (B_VAL(src_ptr) << 24) | (G_VAL(src_ptr) << 16) | (R_VAL(src_ptr) << 8);
389
390 CONVERT_LOOP_END_ROT_180();
391 return;
392}
393#endif
394#endif
395
396#ifdef BUILD_CONVERT_32_BGRX_8888
397#ifdef BUILD_CONVERT_32_RGB_ROT270
398void
399evas_common_convert_rgba_to_32bpp_bgrx_8888_rot_270 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
400{
401 DATA32 *src_ptr;
402 DATA32 *dst_ptr;
403 int x, y;
404
405 dst_ptr = (DATA32 *)dst;
406
407 CONVERT_LOOP_START_ROT_270();
408
409 *dst_ptr = (B_VAL(src_ptr) << 24) | (G_VAL(src_ptr) << 16) | (R_VAL(src_ptr) << 8);
410
411 CONVERT_LOOP_END_ROT_270();
412 return;
413}
414#endif
415#endif
416
417#ifdef BUILD_CONVERT_32_BGRX_8888
418#ifdef BUILD_CONVERT_32_RGB_ROT90
419void
420evas_common_convert_rgba_to_32bpp_bgrx_8888_rot_90 (DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
421{
422 DATA32 *src_ptr;
423 DATA32 *dst_ptr;
424 int x, y;
425
426 dst_ptr = (DATA32 *)dst;
427
428 CONVERT_LOOP_START_ROT_90();
429
430 *dst_ptr = (B_VAL(src_ptr) << 24) | (G_VAL(src_ptr) << 16) | (R_VAL(src_ptr) << 8);
431
432 CONVERT_LOOP_END_ROT_90();
433 return;
434}
435#endif
436#endif
437
438#ifdef BUILD_CONVERT_32_RGB_666
439#ifdef BUILD_CONVERT_32_RGB_ROT0
440void
441evas_common_convert_rgba_to_32bpp_rgb_666(DATA32 *src, DATA8 *dst, int src_jump, int dst_jump, int w, int h, int dith_x __UNUSED__, int dith_y __UNUSED__, DATA8 *pal __UNUSED__)
442{
443 DATA32 *src_ptr;
444 DATA32 *dst_ptr;
445 int x, y;
446
447 dst_ptr = (DATA32 *)dst;
448
449 CONVERT_LOOP_START_ROT_0();
450
451 *dst_ptr =
452 (((R_VAL(src_ptr) << 12) | (B_VAL(src_ptr) >> 2)) & 0x03f03f) |
453 ((G_VAL(src_ptr) << 4) & 0x000fc0);
454
455 CONVERT_LOOP_END_ROT_0();
456 return;
457}
458#endif
459#endif
460