diff options
author | David Walter Seikel | 2012-01-23 23:30:42 +1000 |
---|---|---|
committer | David Walter Seikel | 2012-01-23 23:30:42 +1000 |
commit | 825a3d837a33f226c879cd02ad15c3fba57e8b2c (patch) | |
tree | 75f57bd9c4253508d338dc79ba8e57a7abc42255 /libraries/evas/src/lib/engines/common/evas_convert_rgb_32.c | |
parent | Add ability to disable the test harness, or the Lua compile test. (diff) | |
download | SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.zip SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.gz SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.bz2 SledjHamr-825a3d837a33f226c879cd02ad15c3fba57e8b2c.tar.xz |
Update the EFL to what I'm actually using, coz I'm using some stuff not yet released.
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.c | 347 |
1 files changed, 256 insertions, 91 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 index 41dac6f..0401a4a 100644 --- a/libraries/evas/src/lib/engines/common/evas_convert_rgb_32.c +++ b/libraries/evas/src/lib/engines/common/evas_convert_rgb_32.c | |||
@@ -48,15 +48,167 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_180 (DATA32 *src, DATA8 *dst, int | |||
48 | #endif | 48 | #endif |
49 | #endif | 49 | #endif |
50 | 50 | ||
51 | #ifdef TILE_ROTATE | ||
52 | #define FAST_SIMPLE_ROTATE(suffix, pix_type) \ | ||
53 | static void \ | ||
54 | blt_rotated_90_trivial_##suffix(pix_type *dst, \ | ||
55 | int dst_stride, \ | ||
56 | const pix_type *src, \ | ||
57 | int src_stride, \ | ||
58 | int w, \ | ||
59 | int h) \ | ||
60 | { \ | ||
61 | int x, y; \ | ||
62 | for (y = 0; y < h; y++) \ | ||
63 | { \ | ||
64 | const pix_type *s = src + (h - y - 1); \ | ||
65 | pix_type *d = dst + (dst_stride * y); \ | ||
66 | for (x = 0; x < w; x++) \ | ||
67 | { \ | ||
68 | *d++ = *s; \ | ||
69 | s += src_stride; \ | ||
70 | } \ | ||
71 | } \ | ||
72 | } \ | ||
73 | static void \ | ||
74 | blt_rotated_270_trivial_##suffix(pix_type *dst, \ | ||
75 | int dst_stride, \ | ||
76 | const pix_type *src, \ | ||
77 | int src_stride, \ | ||
78 | int w, \ | ||
79 | int h) \ | ||
80 | { \ | ||
81 | int x, y; \ | ||
82 | for (y = 0; y < h; y++) \ | ||
83 | { \ | ||
84 | const pix_type *s = src + (src_stride * (w - 1)) + y; \ | ||
85 | pix_type *d = dst + (dst_stride * y); \ | ||
86 | for (x = 0; x < w; x++) \ | ||
87 | { \ | ||
88 | *d++ = *s; \ | ||
89 | s -= src_stride; \ | ||
90 | } \ | ||
91 | } \ | ||
92 | } \ | ||
93 | static void \ | ||
94 | blt_rotated_90_##suffix(pix_type *dst, \ | ||
95 | int dst_stride, \ | ||
96 | const pix_type *src, \ | ||
97 | int src_stride, \ | ||
98 | int w, \ | ||
99 | int h) \ | ||
100 | { \ | ||
101 | int x, leading_pixels = 0, trailing_pixels = 0; \ | ||
102 | const int TILE_SIZE = TILE_CACHE_LINE_SIZE / sizeof(pix_type); \ | ||
103 | if ((uintptr_t)dst & (TILE_CACHE_LINE_SIZE - 1)) \ | ||
104 | { \ | ||
105 | leading_pixels = TILE_SIZE - \ | ||
106 | (((uintptr_t)dst & (TILE_CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \ | ||
107 | if (leading_pixels > w) \ | ||
108 | leading_pixels = w; \ | ||
109 | blt_rotated_90_trivial_##suffix(dst, \ | ||
110 | dst_stride, \ | ||
111 | src, \ | ||
112 | src_stride, \ | ||
113 | leading_pixels, \ | ||
114 | h); \ | ||
115 | dst += leading_pixels; \ | ||
116 | src += leading_pixels * src_stride; \ | ||
117 | w -= leading_pixels; \ | ||
118 | } \ | ||
119 | if ((uintptr_t)(dst + w) & (TILE_CACHE_LINE_SIZE - 1)) \ | ||
120 | { \ | ||
121 | trailing_pixels = (((uintptr_t)(dst + w) & \ | ||
122 | (TILE_CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \ | ||
123 | if (trailing_pixels > w) \ | ||
124 | trailing_pixels = w; \ | ||
125 | w -= trailing_pixels; \ | ||
126 | } \ | ||
127 | for (x = 0; x < w; x += TILE_SIZE) \ | ||
128 | { \ | ||
129 | blt_rotated_90_trivial_##suffix(dst + x, \ | ||
130 | dst_stride, \ | ||
131 | src + (src_stride * x), \ | ||
132 | src_stride, \ | ||
133 | TILE_SIZE, \ | ||
134 | h); \ | ||
135 | } \ | ||
136 | if (trailing_pixels) \ | ||
137 | blt_rotated_90_trivial_##suffix(dst + w, \ | ||
138 | dst_stride, \ | ||
139 | src + (w * src_stride), \ | ||
140 | src_stride, \ | ||
141 | trailing_pixels, \ | ||
142 | h); \ | ||
143 | } \ | ||
144 | static void \ | ||
145 | blt_rotated_270_##suffix(pix_type *dst, \ | ||
146 | int dst_stride, \ | ||
147 | const pix_type *src, \ | ||
148 | int src_stride, \ | ||
149 | int w, \ | ||
150 | int h) \ | ||
151 | { \ | ||
152 | int x, leading_pixels = 0, trailing_pixels = 0; \ | ||
153 | const int TILE_SIZE = TILE_CACHE_LINE_SIZE / sizeof(pix_type); \ | ||
154 | if ((uintptr_t)dst & (TILE_CACHE_LINE_SIZE - 1)) \ | ||
155 | { \ | ||
156 | leading_pixels = TILE_SIZE - \ | ||
157 | (((uintptr_t)dst & (TILE_CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \ | ||
158 | if (leading_pixels > w) \ | ||
159 | leading_pixels = w; \ | ||
160 | blt_rotated_270_trivial_##suffix(dst, \ | ||
161 | dst_stride, \ | ||
162 | src + (src_stride * (w - leading_pixels)), \ | ||
163 | src_stride, \ | ||
164 | leading_pixels, \ | ||
165 | h); \ | ||
166 | dst += leading_pixels; \ | ||
167 | w -= leading_pixels; \ | ||
168 | } \ | ||
169 | if ((uintptr_t)(dst + w) & (TILE_CACHE_LINE_SIZE - 1)) \ | ||
170 | { \ | ||
171 | trailing_pixels = (((uintptr_t)(dst + w) & \ | ||
172 | (TILE_CACHE_LINE_SIZE - 1)) / sizeof(pix_type)); \ | ||
173 | if (trailing_pixels > w) \ | ||
174 | trailing_pixels = w; \ | ||
175 | w -= trailing_pixels; \ | ||
176 | src += trailing_pixels * src_stride; \ | ||
177 | } \ | ||
178 | for (x = 0; x < w; x += TILE_SIZE) \ | ||
179 | { \ | ||
180 | blt_rotated_270_trivial_##suffix(dst + x, \ | ||
181 | dst_stride, \ | ||
182 | src + (src_stride * (w - x - TILE_SIZE)), \ | ||
183 | src_stride, \ | ||
184 | TILE_SIZE, \ | ||
185 | h); \ | ||
186 | } \ | ||
187 | if (trailing_pixels) \ | ||
188 | blt_rotated_270_trivial_##suffix(dst + w, \ | ||
189 | dst_stride, \ | ||
190 | src - (trailing_pixels * src_stride), \ | ||
191 | src_stride, \ | ||
192 | trailing_pixels, \ | ||
193 | h); \ | ||
194 | } | ||
195 | |||
196 | FAST_SIMPLE_ROTATE(8888, DATA8) | ||
197 | #endif | ||
198 | |||
199 | |||
51 | #ifdef BUILD_CONVERT_32_RGB_8888 | 200 | #ifdef BUILD_CONVERT_32_RGB_8888 |
52 | #ifdef BUILD_CONVERT_32_RGB_ROT270 | 201 | #ifdef BUILD_CONVERT_32_RGB_ROT270 |
53 | void | 202 | void |
54 | evas_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__) | 203 | evas_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 | { | 204 | { |
205 | #ifdef TILE_ROTATE | ||
206 | blt_rotated_270_8888((DATA8 *)dst, dst_jump+w, (const DATA8 *)src, src_jump+h, w, h) ; | ||
207 | #else | ||
56 | DATA32 *src_ptr; | 208 | DATA32 *src_ptr; |
57 | DATA32 *dst_ptr; | 209 | DATA32 *dst_ptr; |
58 | int x, y; | 210 | int x, y; |
59 | 211 | ||
60 | dst_ptr = (DATA32 *)dst; | 212 | dst_ptr = (DATA32 *)dst; |
61 | 213 | ||
62 | CONVERT_LOOP_START_ROT_270(); | 214 | CONVERT_LOOP_START_ROT_270(); |
@@ -64,6 +216,7 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_270 (DATA32 *src, DATA8 *dst, int | |||
64 | *dst_ptr = *src_ptr; | 216 | *dst_ptr = *src_ptr; |
65 | 217 | ||
66 | CONVERT_LOOP_END_ROT_270(); | 218 | CONVERT_LOOP_END_ROT_270(); |
219 | #endif | ||
67 | return; | 220 | return; |
68 | } | 221 | } |
69 | #endif | 222 | #endif |
@@ -74,106 +227,118 @@ evas_common_convert_rgba_to_32bpp_rgb_8888_rot_270 (DATA32 *src, DATA8 *dst, int | |||
74 | void | 227 | void |
75 | evas_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__) | 228 | evas_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 | { | 229 | { |
77 | #ifndef BUILD_NEON | 230 | # ifndef BUILD_NEON |
231 | # ifdef TILE_ROTATE | ||
232 | blt_rotated_90_8888((DATA8 *)dst, dst_jump+w, (const DATA8 *)src, src_jump+h, w, h) ; | ||
233 | # else | ||
78 | DATA32 *src_ptr; | 234 | DATA32 *src_ptr; |
79 | DATA32 *dst_ptr; | 235 | DATA32 *dst_ptr; |
80 | int x, y; | 236 | int x, y; |
81 | 237 | ||
82 | dst_ptr = (DATA32 *)dst; | 238 | dst_ptr = (DATA32 *)dst; |
83 | CONVERT_LOOP_START_ROT_90(); | 239 | CONVERT_LOOP_START_ROT_90(); |
84 | 240 | ||
85 | *dst_ptr = *src_ptr; | 241 | *dst_ptr = *src_ptr; |
86 | 242 | ||
87 | CONVERT_LOOP_END_ROT_90(); | 243 | CONVERT_LOOP_END_ROT_90(); |
88 | #else | 244 | # endif |
245 | |||
246 | # else | ||
247 | |||
248 | # ifdef TILE_ROTATE | ||
249 | blt_rotated_90_8888((DATA8 *)dst, dst_jump+w, (const DATA8 *)src, src_jump+h, w, h) ; | ||
250 | # else | ||
89 | if ((w & 1) || (h & 1)) | 251 | if ((w & 1) || (h & 1)) |
90 | { | 252 | { |
91 | /* Rarely (if ever) if ever: so slow path is fine */ | 253 | /* Rarely (if ever) if ever: so slow path is fine */ |
92 | DATA32 *src_ptr; | 254 | DATA32 *src_ptr; |
93 | DATA32 *dst_ptr; | 255 | DATA32 *dst_ptr; |
94 | int x, y; | 256 | int x, y; |
95 | 257 | ||
96 | dst_ptr = (DATA32 *)dst; | 258 | dst_ptr = (DATA32 *)dst; |
97 | CONVERT_LOOP_START_ROT_90(); | 259 | CONVERT_LOOP_START_ROT_90(); |
98 | 260 | ||
99 | *dst_ptr = *src_ptr; | 261 | *dst_ptr = *src_ptr; |
100 | 262 | ||
101 | CONVERT_LOOP_END_ROT_90(); | 263 | CONVERT_LOOP_END_ROT_90(); |
102 | } else { | 264 | } |
103 | #define AP "convert_rgba32_rot_90_" | 265 | else |
104 | asm volatile ( | 266 | { |
105 | ".fpu neon \n\t" | 267 | # define AP "convert_rgba32_rot_90_" |
106 | " mov %[s1], %[src] \n\t" | 268 | asm volatile ( |
107 | " add %[s1], %[h],lsl #2 \n\t" | 269 | ".fpu neon \n\t" |
108 | " sub %[s1], #8 \n\t" | 270 | " mov %[s1], %[src] \n\t" |
109 | 271 | " add %[s1], %[s1], %[h],lsl #2 \n\t" | |
110 | " mov %[s2], %[src] \n\t" | 272 | " sub %[s1], #8 \n\t" |
111 | " add %[s2], %[h], lsl #3 \n\t" | 273 | |
112 | " add %[s2], %[sjmp], lsr #1 \n\t" | 274 | " mov %[s2], %[src] \n\t" |
113 | " sub %[s2], #8 \n\t" | 275 | " add %[s2], %[s2], %[h], lsl #3 \n\t" |
114 | 276 | " add %[s2], %[s2], %[sjmp], lsr #1 \n\t" | |
115 | " mov %[d1], %[dst] \n\t" | 277 | " sub %[s2], #8 \n\t" |
116 | 278 | ||
117 | " add %[d2], %[d1], %[djmp] \n\t" | 279 | " mov %[d1], %[dst] \n\t" |
118 | " add %[d2], %[w], lsl #2 \n\t" | 280 | |
119 | 281 | " add %[d2], %[d1], %[djmp] \n\t" | |
120 | " mov %[sadv], %[h], lsl #3 \n\t" | 282 | " add %[d2], %[d2], %[w], lsl #2 \n\t" |
121 | " add %[sadv], %[sjmp], lsl #1 \n\t" | 283 | |
122 | 284 | " mov %[sadv], %[h], lsl #3 \n\t" | |
123 | " mov %[y], #0 \n\t" | 285 | " add %[sadv], %[sadv], %[sjmp], lsl #1\n\t" |
124 | " mov %[x], #0 \n\t" | 286 | |
125 | AP"loop: \n\t" | 287 | " mov %[y], #0 \n\t" |
126 | " vld1.u32 d0, [%[s1]] \n\t" | 288 | " mov %[x], #0 \n\t" |
127 | " vld1.u32 d1, [%[s2]] \n\t" | 289 | AP"loop: \n\t" |
128 | " add %[x], #2 \n\t" | 290 | " vld1.u32 d0, [%[s1]] \n\t" |
129 | " add %[s1], %[sadv] \n\t" | 291 | " vld1.u32 d1, [%[s2]] \n\t" |
130 | " add %[s2], %[sadv] \n\t" | 292 | " add %[x], #2 \n\t" |
131 | " vtrn.u32 d0, d1 \n\t" | 293 | " add %[s1], %[sadv] \n\t" |
132 | " cmp %[x], %[w] \n\t" | 294 | " add %[s2], %[sadv] \n\t" |
133 | " vst1.u32 d1, [%[d1]]! \n\t" | 295 | " vtrn.u32 d0, d1 \n\t" |
134 | " vst1.u32 d0, [%[d2]]! \n\t" | 296 | " cmp %[x], %[w] \n\t" |
135 | " blt "AP"loop \n\t" | 297 | " vst1.u32 d1, [%[d1]]! \n\t" |
136 | 298 | " vst1.u32 d0, [%[d2]]! \n\t" | |
137 | " mov %[x], #0 \n\t" | 299 | " blt "AP"loop \n\t" |
138 | " add %[d1], %[djmp] \n\t" | 300 | |
139 | " add %[d1], %[w], lsl #2 \n\t" | 301 | " mov %[x], #0 \n\t" |
140 | " add %[d2], %[djmp] \n\t" | 302 | " add %[d1], %[djmp] \n\t" |
141 | " add %[d2], %[w], lsl #2 \n\t" | 303 | " add %[d1], %[d1], %[w], lsl #2 \n\t" |
142 | 304 | " add %[d2], %[djmp] \n\t" | |
143 | " mov %[s1], %[src] \n\t" | 305 | " add %[d2], %[d2], %[w], lsl #2 \n\t" |
144 | " add %[s1], %[h], lsl #2 \n\t" | 306 | |
145 | " sub %[s1], %[y], lsl #2 \n\t" | 307 | " mov %[s1], %[src] \n\t" |
146 | " sub %[s1], #16 \n\t" | 308 | " add %[s1], %[s1], %[h], lsl #2 \n\t" |
147 | 309 | " sub %[s1], %[s1], %[y], lsl #2 \n\t" | |
148 | " add %[s2], %[s1], %[h], lsl #2 \n\t" | 310 | " sub %[s1], #16 \n\t" |
149 | " add %[s2], %[sjmp], lsl #2 \n\t" | 311 | |
150 | 312 | " add %[s2], %[s1], %[h], lsl #2 \n\t" | |
151 | " add %[y], #2 \n\t" | 313 | " add %[s2], %[s2], %[sjmp], lsl #2 \n\t" |
152 | 314 | ||
153 | " cmp %[y], %[h] \n\t" | 315 | " add %[y], #2 \n\t" |
154 | " blt "AP"loop \n\t" | 316 | |
155 | 317 | " cmp %[y], %[h] \n\t" | |
156 | : // Out | 318 | " blt "AP"loop \n\t" |
157 | : [s1] "r" (1), | 319 | |
158 | [s2] "r" (11), | 320 | : // Out |
159 | [d1] "r" (2), | 321 | : [s1] "r" (1), |
160 | [d2] "r" (12), | 322 | [s2] "r" (11), |
161 | [src] "r" (src), | 323 | [d1] "r" (2), |
162 | [dst] "r" (dst), | 324 | [d2] "r" (12), |
163 | [x] "r" (3), | 325 | [src] "r" (src), |
164 | [y] "r" (4), | 326 | [dst] "r" (dst), |
165 | [w] "r" (w), | 327 | [x] "r" (3), |
166 | [h] "r" (h), | 328 | [y] "r" (4), |
167 | [sadv] "r" (5), | 329 | [w] "r" (w), |
168 | [sjmp] "r" (src_jump * 4), | 330 | [h] "r" (h), |
169 | [djmp] "r" (dst_jump * 4 * 2) | 331 | [sadv] "r" (5), |
170 | : "d0", "d1", "memory", "cc"// Clober | 332 | [sjmp] "r" (src_jump * 4), |
171 | 333 | [djmp] "r" (dst_jump * 4 * 2) | |
172 | 334 | : "d0", "d1", "memory", "cc"// Clober | |
173 | ); | 335 | |
174 | } | 336 | |
175 | #undef AP | 337 | ); |
176 | #endif | 338 | } |
339 | # undef AP | ||
340 | # endif | ||
341 | # endif | ||
177 | return; | 342 | return; |
178 | } | 343 | } |
179 | #endif | 344 | #endif |
@@ -448,7 +613,7 @@ evas_common_convert_rgba_to_32bpp_rgb_666(DATA32 *src, DATA8 *dst, int src_jump, | |||
448 | 613 | ||
449 | CONVERT_LOOP_START_ROT_0(); | 614 | CONVERT_LOOP_START_ROT_0(); |
450 | 615 | ||
451 | *dst_ptr = | 616 | *dst_ptr = |
452 | (((R_VAL(src_ptr) << 12) | (B_VAL(src_ptr) >> 2)) & 0x03f03f) | | 617 | (((R_VAL(src_ptr) << 12) | (B_VAL(src_ptr) >> 2)) & 0x03f03f) | |
453 | ((G_VAL(src_ptr) << 4) & 0x000fc0); | 618 | ((G_VAL(src_ptr) << 4) & 0x000fc0); |
454 | 619 | ||