1
2 /* autogenerated from gstbayerorc.orc */
3
4 #ifdef HAVE_CONFIG_H
5 #include "config.h"
6 #endif
7 #include <glib.h>
8
9 #ifndef _ORC_INTEGER_TYPEDEFS_
10 #define _ORC_INTEGER_TYPEDEFS_
11 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
12 #include <stdint.h>
13 typedef int8_t orc_int8;
14 typedef int16_t orc_int16;
15 typedef int32_t orc_int32;
16 typedef int64_t orc_int64;
17 typedef uint8_t orc_uint8;
18 typedef uint16_t orc_uint16;
19 typedef uint32_t orc_uint32;
20 typedef uint64_t orc_uint64;
21 #define ORC_UINT64_C(x) UINT64_C(x)
22 #elif defined(_MSC_VER)
23 typedef signed __int8 orc_int8;
24 typedef signed __int16 orc_int16;
25 typedef signed __int32 orc_int32;
26 typedef signed __int64 orc_int64;
27 typedef unsigned __int8 orc_uint8;
28 typedef unsigned __int16 orc_uint16;
29 typedef unsigned __int32 orc_uint32;
30 typedef unsigned __int64 orc_uint64;
31 #define ORC_UINT64_C(x) (x##Ui64)
32 #define inline __inline
33 #else
34 #include <limits.h>
35 typedef signed char orc_int8;
36 typedef short orc_int16;
37 typedef int orc_int32;
38 typedef unsigned char orc_uint8;
39 typedef unsigned short orc_uint16;
40 typedef unsigned int orc_uint32;
41 #if INT_MAX == LONG_MAX
42 typedef long long orc_int64;
43 typedef unsigned long long orc_uint64;
44 #define ORC_UINT64_C(x) (x##ULL)
45 #else
46 typedef long orc_int64;
47 typedef unsigned long orc_uint64;
48 #define ORC_UINT64_C(x) (x##UL)
49 #endif
50 #endif
51 typedef union
52 {
53 orc_int16 i;
54 orc_int8 x2[2];
55 } orc_union16;
56 typedef union
57 {
58 orc_int32 i;
59 float f;
60 orc_int16 x2[2];
61 orc_int8 x4[4];
62 } orc_union32;
63 typedef union
64 {
65 orc_int64 i;
66 double f;
67 orc_int32 x2[2];
68 float x2f[2];
69 orc_int16 x4[4];
70 } orc_union64;
71 #endif
72 #ifndef ORC_RESTRICT
73 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
74 #define ORC_RESTRICT restrict
75 #elif defined(__GNUC__) && __GNUC__ >= 4
76 #define ORC_RESTRICT __restrict__
77 #else
78 #define ORC_RESTRICT
79 #endif
80 #endif
81
82 #ifndef ORC_INTERNAL
83 #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590)
84 #define ORC_INTERNAL __attribute__((visibility("hidden")))
85 #elif defined(__SUNPRO_C) && (__SUNPRO_C >= 0x550)
86 #define ORC_INTERNAL __hidden
87 #elif defined (__GNUC__)
88 #define ORC_INTERNAL __attribute__((visibility("hidden")))
89 #else
90 #define ORC_INTERNAL
91 #endif
92 #endif
93
94
95 #ifndef DISABLE_ORC
96 #include <orc/orc.h>
97 #endif
98 void bayer_orc_horiz_upsample_unaligned (guint8 * ORC_RESTRICT d1,
99 guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n);
100 void bayer_orc_horiz_upsample (guint8 * ORC_RESTRICT d1,
101 guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n);
102 void bayer_orc_merge_bg_bgra (guint8 * ORC_RESTRICT d1,
103 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
104 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
105 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n);
106 void bayer_orc_merge_gr_bgra (guint8 * ORC_RESTRICT d1,
107 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
108 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
109 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n);
110 void bayer_orc_merge_bg_abgr (guint8 * ORC_RESTRICT d1,
111 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
112 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
113 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n);
114 void bayer_orc_merge_gr_abgr (guint8 * ORC_RESTRICT d1,
115 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
116 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
117 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n);
118 void bayer_orc_merge_bg_rgba (guint8 * ORC_RESTRICT d1,
119 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
120 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
121 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n);
122 void bayer_orc_merge_gr_rgba (guint8 * ORC_RESTRICT d1,
123 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
124 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
125 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n);
126 void bayer_orc_merge_bg_argb (guint8 * ORC_RESTRICT d1,
127 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
128 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
129 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n);
130 void bayer_orc_merge_gr_argb (guint8 * ORC_RESTRICT d1,
131 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
132 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
133 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n);
134
135
136 /* begin Orc C target preamble */
137 #define ORC_CLAMP(x,a,b) ((x)<(a) ? (a) : ((x)>(b) ? (b) : (x)))
138 #define ORC_ABS(a) ((a)<0 ? -(a) : (a))
139 #define ORC_MIN(a,b) ((a)<(b) ? (a) : (b))
140 #define ORC_MAX(a,b) ((a)>(b) ? (a) : (b))
141 #define ORC_SB_MAX 127
142 #define ORC_SB_MIN (-1-ORC_SB_MAX)
143 #define ORC_UB_MAX (orc_uint8) 255
144 #define ORC_UB_MIN 0
145 #define ORC_SW_MAX 32767
146 #define ORC_SW_MIN (-1-ORC_SW_MAX)
147 #define ORC_UW_MAX (orc_uint16)65535
148 #define ORC_UW_MIN 0
149 #define ORC_SL_MAX 2147483647
150 #define ORC_SL_MIN (-1-ORC_SL_MAX)
151 #define ORC_UL_MAX 4294967295U
152 #define ORC_UL_MIN 0
153 #define ORC_CLAMP_SB(x) ORC_CLAMP(x,ORC_SB_MIN,ORC_SB_MAX)
154 #define ORC_CLAMP_UB(x) ORC_CLAMP(x,ORC_UB_MIN,ORC_UB_MAX)
155 #define ORC_CLAMP_SW(x) ORC_CLAMP(x,ORC_SW_MIN,ORC_SW_MAX)
156 #define ORC_CLAMP_UW(x) ORC_CLAMP(x,ORC_UW_MIN,ORC_UW_MAX)
157 #define ORC_CLAMP_SL(x) ORC_CLAMP(x,ORC_SL_MIN,ORC_SL_MAX)
158 #define ORC_CLAMP_UL(x) ORC_CLAMP(x,ORC_UL_MIN,ORC_UL_MAX)
159 #define ORC_SWAP_W(x) ((((x)&0xffU)<<8) | (((x)&0xff00U)>>8))
160 #define ORC_SWAP_L(x) ((((x)&0xffU)<<24) | (((x)&0xff00U)<<8) | (((x)&0xff0000U)>>8) | (((x)&0xff000000U)>>24))
161 #define ORC_SWAP_Q(x) ((((x)&ORC_UINT64_C(0xff))<<56) | (((x)&ORC_UINT64_C(0xff00))<<40) | (((x)&ORC_UINT64_C(0xff0000))<<24) | (((x)&ORC_UINT64_C(0xff000000))<<8) | (((x)&ORC_UINT64_C(0xff00000000))>>8) | (((x)&ORC_UINT64_C(0xff0000000000))>>24) | (((x)&ORC_UINT64_C(0xff000000000000))>>40) | (((x)&ORC_UINT64_C(0xff00000000000000))>>56))
162 #define ORC_PTR_OFFSET(ptr,offset) ((void *)(((unsigned char *)(ptr)) + (offset)))
163 #define ORC_DENORMAL(x) ((x) & ((((x)&0x7f800000) == 0) ? 0xff800000 : 0xffffffff))
164 #define ORC_ISNAN(x) ((((x)&0x7f800000) == 0x7f800000) && (((x)&0x007fffff) != 0))
165 #define ORC_DENORMAL_DOUBLE(x) ((x) & ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == 0) ? ORC_UINT64_C(0xfff0000000000000) : ORC_UINT64_C(0xffffffffffffffff)))
166 #define ORC_ISNAN_DOUBLE(x) ((((x)&ORC_UINT64_C(0x7ff0000000000000)) == ORC_UINT64_C(0x7ff0000000000000)) && (((x)&ORC_UINT64_C(0x000fffffffffffff)) != 0))
167 #ifndef ORC_RESTRICT
168 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
169 #define ORC_RESTRICT restrict
170 #elif defined(__GNUC__) && __GNUC__ >= 4
171 #define ORC_RESTRICT __restrict__
172 #else
173 #define ORC_RESTRICT
174 #endif
175 #endif
176 /* end Orc C target preamble */
177
178
179
180 /* bayer_orc_horiz_upsample_unaligned */
181 #ifdef DISABLE_ORC
182 void
bayer_orc_horiz_upsample_unaligned(guint8 * ORC_RESTRICT d1,guint8 * ORC_RESTRICT d2,const guint8 * ORC_RESTRICT s1,int n)183 bayer_orc_horiz_upsample_unaligned (guint8 * ORC_RESTRICT d1,
184 guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n)
185 {
186 int i;
187 orc_union16 *ORC_RESTRICT ptr0;
188 orc_union16 *ORC_RESTRICT ptr1;
189 const orc_union16 *ORC_RESTRICT ptr4;
190 orc_union16 var37;
191 orc_union16 var38;
192 orc_union16 var39;
193 orc_int8 var40;
194 orc_int8 var41;
195 orc_union16 var42;
196 orc_int8 var43;
197 orc_int8 var44;
198 orc_int8 var45;
199 orc_int8 var46;
200
201 ptr0 = (orc_union16 *) d1;
202 ptr1 = (orc_union16 *) d2;
203 ptr4 = (orc_union16 *) s1;
204
205
206 for (i = 0; i < n; i++) {
207 /* 0: loadw */
208 var37 = ptr4[i];
209 /* 1: splitwb */
210 {
211 orc_union16 _src;
212 _src.i = var37.i;
213 var40 = _src.x2[1];
214 var41 = _src.x2[0];
215 }
216 /* 2: loadoffw */
217 var42 = ptr4[i + 1];
218 /* 3: splitwb */
219 {
220 orc_union16 _src;
221 _src.i = var42.i;
222 var43 = _src.x2[1];
223 var44 = _src.x2[0];
224 }
225 /* 4: avgub */
226 var45 = ((orc_uint8) var40 + (orc_uint8) var43 + 1) >> 1;
227 /* 5: mergebw */
228 {
229 orc_union16 _dest;
230 _dest.x2[0] = var40;
231 _dest.x2[1] = var45;
232 var38.i = _dest.i;
233 }
234 /* 6: storew */
235 ptr0[i] = var38;
236 /* 7: avgub */
237 var46 = ((orc_uint8) var41 + (orc_uint8) var44 + 1) >> 1;
238 /* 8: mergebw */
239 {
240 orc_union16 _dest;
241 _dest.x2[0] = var46;
242 _dest.x2[1] = var44;
243 var39.i = _dest.i;
244 }
245 /* 9: storew */
246 ptr1[i] = var39;
247 }
248
249 }
250
251 #else
252 static void
_backup_bayer_orc_horiz_upsample_unaligned(OrcExecutor * ORC_RESTRICT ex)253 _backup_bayer_orc_horiz_upsample_unaligned (OrcExecutor * ORC_RESTRICT ex)
254 {
255 int i;
256 int n = ex->n;
257 orc_union16 *ORC_RESTRICT ptr0;
258 orc_union16 *ORC_RESTRICT ptr1;
259 const orc_union16 *ORC_RESTRICT ptr4;
260 orc_union16 var37;
261 orc_union16 var38;
262 orc_union16 var39;
263 orc_int8 var40;
264 orc_int8 var41;
265 orc_union16 var42;
266 orc_int8 var43;
267 orc_int8 var44;
268 orc_int8 var45;
269 orc_int8 var46;
270
271 ptr0 = (orc_union16 *) ex->arrays[0];
272 ptr1 = (orc_union16 *) ex->arrays[1];
273 ptr4 = (orc_union16 *) ex->arrays[4];
274
275
276 for (i = 0; i < n; i++) {
277 /* 0: loadw */
278 var37 = ptr4[i];
279 /* 1: splitwb */
280 {
281 orc_union16 _src;
282 _src.i = var37.i;
283 var40 = _src.x2[1];
284 var41 = _src.x2[0];
285 }
286 /* 2: loadoffw */
287 var42 = ptr4[i + 1];
288 /* 3: splitwb */
289 {
290 orc_union16 _src;
291 _src.i = var42.i;
292 var43 = _src.x2[1];
293 var44 = _src.x2[0];
294 }
295 /* 4: avgub */
296 var45 = ((orc_uint8) var40 + (orc_uint8) var43 + 1) >> 1;
297 /* 5: mergebw */
298 {
299 orc_union16 _dest;
300 _dest.x2[0] = var40;
301 _dest.x2[1] = var45;
302 var38.i = _dest.i;
303 }
304 /* 6: storew */
305 ptr0[i] = var38;
306 /* 7: avgub */
307 var46 = ((orc_uint8) var41 + (orc_uint8) var44 + 1) >> 1;
308 /* 8: mergebw */
309 {
310 orc_union16 _dest;
311 _dest.x2[0] = var46;
312 _dest.x2[1] = var44;
313 var39.i = _dest.i;
314 }
315 /* 9: storew */
316 ptr1[i] = var39;
317 }
318
319 }
320
321 void
bayer_orc_horiz_upsample_unaligned(guint8 * ORC_RESTRICT d1,guint8 * ORC_RESTRICT d2,const guint8 * ORC_RESTRICT s1,int n)322 bayer_orc_horiz_upsample_unaligned (guint8 * ORC_RESTRICT d1,
323 guint8 * ORC_RESTRICT d2, const guint8 * ORC_RESTRICT s1, int n)
324 {
325 OrcExecutor _ex, *ex = &_ex;
326 static volatile int p_inited = 0;
327 static OrcCode *c = 0;
328 void (*func) (OrcExecutor *);
329
330 if (!p_inited) {
331 orc_once_mutex_lock ();
332 if (!p_inited) {
333 OrcProgram *p;
334
335 #if 1
336 static const orc_uint8 bc[] = {
337 1, 9, 34, 98, 97, 121, 101, 114, 95, 111, 114, 99, 95, 104, 111, 114,
338 105, 122, 95, 117, 112, 115, 97, 109, 112, 108, 101, 95, 117, 110, 97,
339 108,
340 105, 103, 110, 101, 100, 11, 2, 2, 11, 2, 2, 12, 2, 2, 14, 4,
341 1, 0, 0, 0, 20, 2, 20, 1, 20, 1, 20, 1, 20, 1, 199, 34,
342 33, 4, 83, 32, 4, 16, 199, 36, 35, 32, 39, 36, 34, 36, 196, 0,
343 34, 36, 39, 33, 33, 35, 196, 1, 33, 35, 2, 0,
344 };
345 p = orc_program_new_from_static_bytecode (bc);
346 orc_program_set_backup_function (p,
347 _backup_bayer_orc_horiz_upsample_unaligned);
348 #else
349 p = orc_program_new ();
350 orc_program_set_name (p, "bayer_orc_horiz_upsample_unaligned");
351 orc_program_set_backup_function (p,
352 _backup_bayer_orc_horiz_upsample_unaligned);
353 orc_program_add_destination (p, 2, "d1");
354 orc_program_add_destination (p, 2, "d2");
355 orc_program_add_source (p, 2, "s1");
356 orc_program_add_constant (p, 4, 0x00000001, "c1");
357 orc_program_add_temporary (p, 2, "t1");
358 orc_program_add_temporary (p, 1, "t2");
359 orc_program_add_temporary (p, 1, "t3");
360 orc_program_add_temporary (p, 1, "t4");
361 orc_program_add_temporary (p, 1, "t5");
362
363 orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T3, ORC_VAR_T2, ORC_VAR_S1,
364 ORC_VAR_D1);
365 orc_program_append_2 (p, "loadoffw", 0, ORC_VAR_T1, ORC_VAR_S1,
366 ORC_VAR_C1, ORC_VAR_D1);
367 orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T5, ORC_VAR_T4, ORC_VAR_T1,
368 ORC_VAR_D1);
369 orc_program_append_2 (p, "avgub", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_T5,
370 ORC_VAR_D1);
371 orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T5,
372 ORC_VAR_D1);
373 orc_program_append_2 (p, "avgub", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T4,
374 ORC_VAR_D1);
375 orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_T4,
376 ORC_VAR_D1);
377 #endif
378
379 orc_program_compile (p);
380 c = orc_program_take_code (p);
381 orc_program_free (p);
382 }
383 p_inited = TRUE;
384 orc_once_mutex_unlock ();
385 }
386 ex->arrays[ORC_VAR_A2] = c;
387 ex->program = 0;
388
389 ex->n = n;
390 ex->arrays[ORC_VAR_D1] = d1;
391 ex->arrays[ORC_VAR_D2] = d2;
392 ex->arrays[ORC_VAR_S1] = (void *) s1;
393
394 func = c->exec;
395 func (ex);
396 }
397 #endif
398
399
400 /* bayer_orc_horiz_upsample */
401 #ifdef DISABLE_ORC
402 void
bayer_orc_horiz_upsample(guint8 * ORC_RESTRICT d1,guint8 * ORC_RESTRICT d2,const guint8 * ORC_RESTRICT s1,int n)403 bayer_orc_horiz_upsample (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
404 const guint8 * ORC_RESTRICT s1, int n)
405 {
406 int i;
407 orc_union16 *ORC_RESTRICT ptr0;
408 orc_union16 *ORC_RESTRICT ptr1;
409 const orc_union16 *ORC_RESTRICT ptr4;
410 orc_union16 var37;
411 orc_union16 var38;
412 orc_union16 var39;
413 orc_union16 var40;
414 orc_int8 var41;
415 orc_int8 var42;
416 orc_int8 var43;
417 orc_union16 var44;
418 orc_int8 var45;
419 orc_int8 var46;
420 orc_int8 var47;
421
422 ptr0 = (orc_union16 *) d1;
423 ptr1 = (orc_union16 *) d2;
424 ptr4 = (orc_union16 *) s1;
425
426
427 for (i = 0; i < n; i++) {
428 /* 0: loadoffw */
429 var40 = ptr4[i + -1];
430 /* 1: select1wb */
431 {
432 orc_union16 _src;
433 _src.i = var40.i;
434 var41 = _src.x2[1];
435 }
436 /* 2: loadw */
437 var37 = ptr4[i];
438 /* 3: splitwb */
439 {
440 orc_union16 _src;
441 _src.i = var37.i;
442 var42 = _src.x2[1];
443 var43 = _src.x2[0];
444 }
445 /* 4: loadoffw */
446 var44 = ptr4[i + 1];
447 /* 5: select0wb */
448 {
449 orc_union16 _src;
450 _src.i = var44.i;
451 var45 = _src.x2[0];
452 }
453 /* 6: avgub */
454 var46 = ((orc_uint8) var43 + (orc_uint8) var45 + 1) >> 1;
455 /* 7: mergebw */
456 {
457 orc_union16 _dest;
458 _dest.x2[0] = var43;
459 _dest.x2[1] = var46;
460 var38.i = _dest.i;
461 }
462 /* 8: storew */
463 ptr0[i] = var38;
464 /* 9: avgub */
465 var47 = ((orc_uint8) var41 + (orc_uint8) var42 + 1) >> 1;
466 /* 10: mergebw */
467 {
468 orc_union16 _dest;
469 _dest.x2[0] = var47;
470 _dest.x2[1] = var42;
471 var39.i = _dest.i;
472 }
473 /* 11: storew */
474 ptr1[i] = var39;
475 }
476
477 }
478
479 #else
480 static void
_backup_bayer_orc_horiz_upsample(OrcExecutor * ORC_RESTRICT ex)481 _backup_bayer_orc_horiz_upsample (OrcExecutor * ORC_RESTRICT ex)
482 {
483 int i;
484 int n = ex->n;
485 orc_union16 *ORC_RESTRICT ptr0;
486 orc_union16 *ORC_RESTRICT ptr1;
487 const orc_union16 *ORC_RESTRICT ptr4;
488 orc_union16 var37;
489 orc_union16 var38;
490 orc_union16 var39;
491 orc_union16 var40;
492 orc_int8 var41;
493 orc_int8 var42;
494 orc_int8 var43;
495 orc_union16 var44;
496 orc_int8 var45;
497 orc_int8 var46;
498 orc_int8 var47;
499
500 ptr0 = (orc_union16 *) ex->arrays[0];
501 ptr1 = (orc_union16 *) ex->arrays[1];
502 ptr4 = (orc_union16 *) ex->arrays[4];
503
504
505 for (i = 0; i < n; i++) {
506 /* 0: loadoffw */
507 var40 = ptr4[i + -1];
508 /* 1: select1wb */
509 {
510 orc_union16 _src;
511 _src.i = var40.i;
512 var41 = _src.x2[1];
513 }
514 /* 2: loadw */
515 var37 = ptr4[i];
516 /* 3: splitwb */
517 {
518 orc_union16 _src;
519 _src.i = var37.i;
520 var42 = _src.x2[1];
521 var43 = _src.x2[0];
522 }
523 /* 4: loadoffw */
524 var44 = ptr4[i + 1];
525 /* 5: select0wb */
526 {
527 orc_union16 _src;
528 _src.i = var44.i;
529 var45 = _src.x2[0];
530 }
531 /* 6: avgub */
532 var46 = ((orc_uint8) var43 + (orc_uint8) var45 + 1) >> 1;
533 /* 7: mergebw */
534 {
535 orc_union16 _dest;
536 _dest.x2[0] = var43;
537 _dest.x2[1] = var46;
538 var38.i = _dest.i;
539 }
540 /* 8: storew */
541 ptr0[i] = var38;
542 /* 9: avgub */
543 var47 = ((orc_uint8) var41 + (orc_uint8) var42 + 1) >> 1;
544 /* 10: mergebw */
545 {
546 orc_union16 _dest;
547 _dest.x2[0] = var47;
548 _dest.x2[1] = var42;
549 var39.i = _dest.i;
550 }
551 /* 11: storew */
552 ptr1[i] = var39;
553 }
554
555 }
556
557 void
bayer_orc_horiz_upsample(guint8 * ORC_RESTRICT d1,guint8 * ORC_RESTRICT d2,const guint8 * ORC_RESTRICT s1,int n)558 bayer_orc_horiz_upsample (guint8 * ORC_RESTRICT d1, guint8 * ORC_RESTRICT d2,
559 const guint8 * ORC_RESTRICT s1, int n)
560 {
561 OrcExecutor _ex, *ex = &_ex;
562 static volatile int p_inited = 0;
563 static OrcCode *c = 0;
564 void (*func) (OrcExecutor *);
565
566 if (!p_inited) {
567 orc_once_mutex_lock ();
568 if (!p_inited) {
569 OrcProgram *p;
570
571 #if 1
572 static const orc_uint8 bc[] = {
573 1, 9, 24, 98, 97, 121, 101, 114, 95, 111, 114, 99, 95, 104, 111, 114,
574 105, 122, 95, 117, 112, 115, 97, 109, 112, 108, 101, 11, 2, 2, 11, 2,
575 2, 12, 2, 2, 14, 4, 255, 255, 255, 255, 14, 4, 1, 0, 0, 0,
576 20, 2, 20, 1, 20, 1, 20, 1, 20, 1, 83, 32, 4, 16, 189, 33,
577 32, 199, 35, 34, 4, 83, 32, 4, 17, 188, 36, 32, 39, 36, 34, 36,
578 196, 0, 34, 36, 39, 33, 33, 35, 196, 1, 33, 35, 2, 0,
579 };
580 p = orc_program_new_from_static_bytecode (bc);
581 orc_program_set_backup_function (p, _backup_bayer_orc_horiz_upsample);
582 #else
583 p = orc_program_new ();
584 orc_program_set_name (p, "bayer_orc_horiz_upsample");
585 orc_program_set_backup_function (p, _backup_bayer_orc_horiz_upsample);
586 orc_program_add_destination (p, 2, "d1");
587 orc_program_add_destination (p, 2, "d2");
588 orc_program_add_source (p, 2, "s1");
589 orc_program_add_constant (p, 4, 0xffffffff, "c1");
590 orc_program_add_constant (p, 4, 0x00000001, "c2");
591 orc_program_add_temporary (p, 2, "t1");
592 orc_program_add_temporary (p, 1, "t2");
593 orc_program_add_temporary (p, 1, "t3");
594 orc_program_add_temporary (p, 1, "t4");
595 orc_program_add_temporary (p, 1, "t5");
596
597 orc_program_append_2 (p, "loadoffw", 0, ORC_VAR_T1, ORC_VAR_S1,
598 ORC_VAR_C1, ORC_VAR_D1);
599 orc_program_append_2 (p, "select1wb", 0, ORC_VAR_T2, ORC_VAR_T1,
600 ORC_VAR_D1, ORC_VAR_D1);
601 orc_program_append_2 (p, "splitwb", 0, ORC_VAR_T4, ORC_VAR_T3, ORC_VAR_S1,
602 ORC_VAR_D1);
603 orc_program_append_2 (p, "loadoffw", 0, ORC_VAR_T1, ORC_VAR_S1,
604 ORC_VAR_C2, ORC_VAR_D1);
605 orc_program_append_2 (p, "select0wb", 0, ORC_VAR_T5, ORC_VAR_T1,
606 ORC_VAR_D1, ORC_VAR_D1);
607 orc_program_append_2 (p, "avgub", 0, ORC_VAR_T5, ORC_VAR_T3, ORC_VAR_T5,
608 ORC_VAR_D1);
609 orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D1, ORC_VAR_T3, ORC_VAR_T5,
610 ORC_VAR_D1);
611 orc_program_append_2 (p, "avgub", 0, ORC_VAR_T2, ORC_VAR_T2, ORC_VAR_T4,
612 ORC_VAR_D1);
613 orc_program_append_2 (p, "mergebw", 0, ORC_VAR_D2, ORC_VAR_T2, ORC_VAR_T4,
614 ORC_VAR_D1);
615 #endif
616
617 orc_program_compile (p);
618 c = orc_program_take_code (p);
619 orc_program_free (p);
620 }
621 p_inited = TRUE;
622 orc_once_mutex_unlock ();
623 }
624 ex->arrays[ORC_VAR_A2] = c;
625 ex->program = 0;
626
627 ex->n = n;
628 ex->arrays[ORC_VAR_D1] = d1;
629 ex->arrays[ORC_VAR_D2] = d2;
630 ex->arrays[ORC_VAR_S1] = (void *) s1;
631
632 func = c->exec;
633 func (ex);
634 }
635 #endif
636
637
638 /* bayer_orc_merge_bg_bgra */
639 #ifdef DISABLE_ORC
640 void
bayer_orc_merge_bg_bgra(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)641 bayer_orc_merge_bg_bgra (guint8 * ORC_RESTRICT d1,
642 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
643 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
644 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
645 {
646 int i;
647 orc_union64 *ORC_RESTRICT ptr0;
648 const orc_union16 *ORC_RESTRICT ptr4;
649 const orc_union16 *ORC_RESTRICT ptr5;
650 const orc_union16 *ORC_RESTRICT ptr6;
651 const orc_union16 *ORC_RESTRICT ptr7;
652 const orc_union16 *ORC_RESTRICT ptr8;
653 const orc_union16 *ORC_RESTRICT ptr9;
654 orc_union16 var37;
655 orc_union16 var38;
656 orc_union16 var39;
657 orc_union16 var40;
658 orc_union16 var41;
659 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
660 volatile orc_union16 var42;
661 #else
662 orc_union16 var42;
663 #endif
664 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
665 volatile orc_union16 var43;
666 #else
667 orc_union16 var43;
668 #endif
669 orc_union16 var44;
670 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
671 volatile orc_union16 var45;
672 #else
673 orc_union16 var45;
674 #endif
675 orc_union64 var46;
676 orc_union16 var47;
677 orc_union16 var48;
678 orc_union16 var49;
679 orc_union16 var50;
680 orc_union16 var51;
681 orc_union16 var52;
682 orc_union16 var53;
683 orc_union32 var54;
684 orc_union32 var55;
685
686 ptr0 = (orc_union64 *) d1;
687 ptr4 = (orc_union16 *) s1;
688 ptr5 = (orc_union16 *) s2;
689 ptr6 = (orc_union16 *) s3;
690 ptr7 = (orc_union16 *) s4;
691 ptr8 = (orc_union16 *) s5;
692 ptr9 = (orc_union16 *) s6;
693
694 /* 9: loadpw */
695 var42.i = 0x000000ff; /* 255 or 1.25987e-321f */
696 /* 11: loadpw */
697 var43.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
698 /* 16: loadpb */
699 var45.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
700 var45.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
701
702 for (i = 0; i < n; i++) {
703 /* 0: loadw */
704 var37 = ptr5[i];
705 /* 1: loadw */
706 var38 = ptr9[i];
707 /* 2: avgub */
708 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
709 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
710 /* 3: loadw */
711 var39 = ptr4[i];
712 /* 4: loadw */
713 var40 = ptr8[i];
714 /* 5: avgub */
715 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
716 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
717 /* 6: loadw */
718 var41 = ptr7[i];
719 /* 7: copyw */
720 var49.i = var41.i;
721 /* 8: avgub */
722 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
723 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
724 /* 10: andw */
725 var51.i = var50.i & var42.i;
726 /* 12: andw */
727 var52.i = var49.i & var43.i;
728 /* 13: orw */
729 var53.i = var52.i | var51.i;
730 /* 14: loadw */
731 var44 = ptr6[i];
732 /* 15: mergebw */
733 {
734 orc_union16 _dest;
735 _dest.x2[0] = var44.x2[0];
736 _dest.x2[1] = var53.x2[0];
737 var54.x2[0] = _dest.i;
738 }
739 {
740 orc_union16 _dest;
741 _dest.x2[0] = var44.x2[1];
742 _dest.x2[1] = var53.x2[1];
743 var54.x2[1] = _dest.i;
744 }
745 /* 17: mergebw */
746 {
747 orc_union16 _dest;
748 _dest.x2[0] = var47.x2[0];
749 _dest.x2[1] = var45.x2[0];
750 var55.x2[0] = _dest.i;
751 }
752 {
753 orc_union16 _dest;
754 _dest.x2[0] = var47.x2[1];
755 _dest.x2[1] = var45.x2[1];
756 var55.x2[1] = _dest.i;
757 }
758 /* 18: mergewl */
759 {
760 orc_union32 _dest;
761 _dest.x2[0] = var54.x2[0];
762 _dest.x2[1] = var55.x2[0];
763 var46.x2[0] = _dest.i;
764 }
765 {
766 orc_union32 _dest;
767 _dest.x2[0] = var54.x2[1];
768 _dest.x2[1] = var55.x2[1];
769 var46.x2[1] = _dest.i;
770 }
771 /* 19: storeq */
772 ptr0[i] = var46;
773 }
774
775 }
776
777 #else
778 static void
_backup_bayer_orc_merge_bg_bgra(OrcExecutor * ORC_RESTRICT ex)779 _backup_bayer_orc_merge_bg_bgra (OrcExecutor * ORC_RESTRICT ex)
780 {
781 int i;
782 int n = ex->n;
783 orc_union64 *ORC_RESTRICT ptr0;
784 const orc_union16 *ORC_RESTRICT ptr4;
785 const orc_union16 *ORC_RESTRICT ptr5;
786 const orc_union16 *ORC_RESTRICT ptr6;
787 const orc_union16 *ORC_RESTRICT ptr7;
788 const orc_union16 *ORC_RESTRICT ptr8;
789 const orc_union16 *ORC_RESTRICT ptr9;
790 orc_union16 var37;
791 orc_union16 var38;
792 orc_union16 var39;
793 orc_union16 var40;
794 orc_union16 var41;
795 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
796 volatile orc_union16 var42;
797 #else
798 orc_union16 var42;
799 #endif
800 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
801 volatile orc_union16 var43;
802 #else
803 orc_union16 var43;
804 #endif
805 orc_union16 var44;
806 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
807 volatile orc_union16 var45;
808 #else
809 orc_union16 var45;
810 #endif
811 orc_union64 var46;
812 orc_union16 var47;
813 orc_union16 var48;
814 orc_union16 var49;
815 orc_union16 var50;
816 orc_union16 var51;
817 orc_union16 var52;
818 orc_union16 var53;
819 orc_union32 var54;
820 orc_union32 var55;
821
822 ptr0 = (orc_union64 *) ex->arrays[0];
823 ptr4 = (orc_union16 *) ex->arrays[4];
824 ptr5 = (orc_union16 *) ex->arrays[5];
825 ptr6 = (orc_union16 *) ex->arrays[6];
826 ptr7 = (orc_union16 *) ex->arrays[7];
827 ptr8 = (orc_union16 *) ex->arrays[8];
828 ptr9 = (orc_union16 *) ex->arrays[9];
829
830 /* 9: loadpw */
831 var42.i = 0x000000ff; /* 255 or 1.25987e-321f */
832 /* 11: loadpw */
833 var43.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
834 /* 16: loadpb */
835 var45.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
836 var45.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
837
838 for (i = 0; i < n; i++) {
839 /* 0: loadw */
840 var37 = ptr5[i];
841 /* 1: loadw */
842 var38 = ptr9[i];
843 /* 2: avgub */
844 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
845 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
846 /* 3: loadw */
847 var39 = ptr4[i];
848 /* 4: loadw */
849 var40 = ptr8[i];
850 /* 5: avgub */
851 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
852 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
853 /* 6: loadw */
854 var41 = ptr7[i];
855 /* 7: copyw */
856 var49.i = var41.i;
857 /* 8: avgub */
858 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
859 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
860 /* 10: andw */
861 var51.i = var50.i & var42.i;
862 /* 12: andw */
863 var52.i = var49.i & var43.i;
864 /* 13: orw */
865 var53.i = var52.i | var51.i;
866 /* 14: loadw */
867 var44 = ptr6[i];
868 /* 15: mergebw */
869 {
870 orc_union16 _dest;
871 _dest.x2[0] = var44.x2[0];
872 _dest.x2[1] = var53.x2[0];
873 var54.x2[0] = _dest.i;
874 }
875 {
876 orc_union16 _dest;
877 _dest.x2[0] = var44.x2[1];
878 _dest.x2[1] = var53.x2[1];
879 var54.x2[1] = _dest.i;
880 }
881 /* 17: mergebw */
882 {
883 orc_union16 _dest;
884 _dest.x2[0] = var47.x2[0];
885 _dest.x2[1] = var45.x2[0];
886 var55.x2[0] = _dest.i;
887 }
888 {
889 orc_union16 _dest;
890 _dest.x2[0] = var47.x2[1];
891 _dest.x2[1] = var45.x2[1];
892 var55.x2[1] = _dest.i;
893 }
894 /* 18: mergewl */
895 {
896 orc_union32 _dest;
897 _dest.x2[0] = var54.x2[0];
898 _dest.x2[1] = var55.x2[0];
899 var46.x2[0] = _dest.i;
900 }
901 {
902 orc_union32 _dest;
903 _dest.x2[0] = var54.x2[1];
904 _dest.x2[1] = var55.x2[1];
905 var46.x2[1] = _dest.i;
906 }
907 /* 19: storeq */
908 ptr0[i] = var46;
909 }
910
911 }
912
913 void
bayer_orc_merge_bg_bgra(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)914 bayer_orc_merge_bg_bgra (guint8 * ORC_RESTRICT d1,
915 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
916 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
917 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
918 {
919 OrcExecutor _ex, *ex = &_ex;
920 static volatile int p_inited = 0;
921 static OrcCode *c = 0;
922 void (*func) (OrcExecutor *);
923
924 if (!p_inited) {
925 orc_once_mutex_lock ();
926 if (!p_inited) {
927 OrcProgram *p;
928
929 #if 1
930 static const orc_uint8 bc[] = {
931 1, 9, 23, 98, 97, 121, 101, 114, 95, 111, 114, 99, 95, 109, 101, 114,
932 103, 101, 95, 98, 103, 95, 98, 103, 114, 97, 11, 8, 8, 12, 2, 2,
933 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 14,
934 2, 255, 0, 0, 0, 14, 2, 0, 255, 0, 0, 14, 1, 255, 0, 0,
935 0, 20, 4, 20, 4, 20, 2, 20, 2, 20, 2, 21, 1, 39, 34, 5,
936 9, 21, 1, 39, 35, 4, 8, 79, 36, 7, 21, 1, 39, 35, 35, 36,
937 73, 35, 35, 16, 73, 36, 36, 17, 92, 35, 36, 35, 21, 1, 196, 33,
938 6, 35, 21, 1, 196, 32, 34, 18, 21, 1, 195, 0, 33, 32, 2, 0,
939
940 };
941 p = orc_program_new_from_static_bytecode (bc);
942 orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_bgra);
943 #else
944 p = orc_program_new ();
945 orc_program_set_name (p, "bayer_orc_merge_bg_bgra");
946 orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_bgra);
947 orc_program_add_destination (p, 8, "d1");
948 orc_program_add_source (p, 2, "s1");
949 orc_program_add_source (p, 2, "s2");
950 orc_program_add_source (p, 2, "s3");
951 orc_program_add_source (p, 2, "s4");
952 orc_program_add_source (p, 2, "s5");
953 orc_program_add_source (p, 2, "s6");
954 orc_program_add_constant (p, 2, 0x000000ff, "c1");
955 orc_program_add_constant (p, 2, 0x0000ff00, "c2");
956 orc_program_add_constant (p, 1, 0x000000ff, "c3");
957 orc_program_add_temporary (p, 4, "t1");
958 orc_program_add_temporary (p, 4, "t2");
959 orc_program_add_temporary (p, 2, "t3");
960 orc_program_add_temporary (p, 2, "t4");
961 orc_program_add_temporary (p, 2, "t5");
962
963 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6,
964 ORC_VAR_D1);
965 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5,
966 ORC_VAR_D1);
967 orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1,
968 ORC_VAR_D1);
969 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5,
970 ORC_VAR_D1);
971 orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1,
972 ORC_VAR_D1);
973 orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2,
974 ORC_VAR_D1);
975 orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4,
976 ORC_VAR_D1);
977 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_T4,
978 ORC_VAR_D1);
979 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_C3,
980 ORC_VAR_D1);
981 orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
982 ORC_VAR_D1);
983 #endif
984
985 orc_program_compile (p);
986 c = orc_program_take_code (p);
987 orc_program_free (p);
988 }
989 p_inited = TRUE;
990 orc_once_mutex_unlock ();
991 }
992 ex->arrays[ORC_VAR_A2] = c;
993 ex->program = 0;
994
995 ex->n = n;
996 ex->arrays[ORC_VAR_D1] = d1;
997 ex->arrays[ORC_VAR_S1] = (void *) s1;
998 ex->arrays[ORC_VAR_S2] = (void *) s2;
999 ex->arrays[ORC_VAR_S3] = (void *) s3;
1000 ex->arrays[ORC_VAR_S4] = (void *) s4;
1001 ex->arrays[ORC_VAR_S5] = (void *) s5;
1002 ex->arrays[ORC_VAR_S6] = (void *) s6;
1003
1004 func = c->exec;
1005 func (ex);
1006 }
1007 #endif
1008
1009
1010 /* bayer_orc_merge_gr_bgra */
1011 #ifdef DISABLE_ORC
1012 void
bayer_orc_merge_gr_bgra(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)1013 bayer_orc_merge_gr_bgra (guint8 * ORC_RESTRICT d1,
1014 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
1015 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
1016 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
1017 {
1018 int i;
1019 orc_union64 *ORC_RESTRICT ptr0;
1020 const orc_union16 *ORC_RESTRICT ptr4;
1021 const orc_union16 *ORC_RESTRICT ptr5;
1022 const orc_union16 *ORC_RESTRICT ptr6;
1023 const orc_union16 *ORC_RESTRICT ptr7;
1024 const orc_union16 *ORC_RESTRICT ptr8;
1025 const orc_union16 *ORC_RESTRICT ptr9;
1026 orc_union16 var37;
1027 orc_union16 var38;
1028 orc_union16 var39;
1029 orc_union16 var40;
1030 orc_union16 var41;
1031 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1032 volatile orc_union16 var42;
1033 #else
1034 orc_union16 var42;
1035 #endif
1036 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1037 volatile orc_union16 var43;
1038 #else
1039 orc_union16 var43;
1040 #endif
1041 orc_union16 var44;
1042 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1043 volatile orc_union16 var45;
1044 #else
1045 orc_union16 var45;
1046 #endif
1047 orc_union64 var46;
1048 orc_union16 var47;
1049 orc_union16 var48;
1050 orc_union16 var49;
1051 orc_union16 var50;
1052 orc_union16 var51;
1053 orc_union16 var52;
1054 orc_union16 var53;
1055 orc_union32 var54;
1056 orc_union32 var55;
1057
1058 ptr0 = (orc_union64 *) d1;
1059 ptr4 = (orc_union16 *) s1;
1060 ptr5 = (orc_union16 *) s2;
1061 ptr6 = (orc_union16 *) s3;
1062 ptr7 = (orc_union16 *) s4;
1063 ptr8 = (orc_union16 *) s5;
1064 ptr9 = (orc_union16 *) s6;
1065
1066 /* 9: loadpw */
1067 var42.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
1068 /* 11: loadpw */
1069 var43.i = 0x000000ff; /* 255 or 1.25987e-321f */
1070 /* 16: loadpb */
1071 var45.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
1072 var45.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
1073
1074 for (i = 0; i < n; i++) {
1075 /* 0: loadw */
1076 var37 = ptr4[i];
1077 /* 1: loadw */
1078 var38 = ptr8[i];
1079 /* 2: avgub */
1080 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
1081 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
1082 /* 3: loadw */
1083 var39 = ptr5[i];
1084 /* 4: loadw */
1085 var40 = ptr9[i];
1086 /* 5: avgub */
1087 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
1088 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
1089 /* 6: loadw */
1090 var41 = ptr6[i];
1091 /* 7: copyw */
1092 var49.i = var41.i;
1093 /* 8: avgub */
1094 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
1095 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
1096 /* 10: andw */
1097 var51.i = var50.i & var42.i;
1098 /* 12: andw */
1099 var52.i = var49.i & var43.i;
1100 /* 13: orw */
1101 var53.i = var52.i | var51.i;
1102 /* 14: mergebw */
1103 {
1104 orc_union16 _dest;
1105 _dest.x2[0] = var47.x2[0];
1106 _dest.x2[1] = var53.x2[0];
1107 var54.x2[0] = _dest.i;
1108 }
1109 {
1110 orc_union16 _dest;
1111 _dest.x2[0] = var47.x2[1];
1112 _dest.x2[1] = var53.x2[1];
1113 var54.x2[1] = _dest.i;
1114 }
1115 /* 15: loadw */
1116 var44 = ptr7[i];
1117 /* 17: mergebw */
1118 {
1119 orc_union16 _dest;
1120 _dest.x2[0] = var44.x2[0];
1121 _dest.x2[1] = var45.x2[0];
1122 var55.x2[0] = _dest.i;
1123 }
1124 {
1125 orc_union16 _dest;
1126 _dest.x2[0] = var44.x2[1];
1127 _dest.x2[1] = var45.x2[1];
1128 var55.x2[1] = _dest.i;
1129 }
1130 /* 18: mergewl */
1131 {
1132 orc_union32 _dest;
1133 _dest.x2[0] = var54.x2[0];
1134 _dest.x2[1] = var55.x2[0];
1135 var46.x2[0] = _dest.i;
1136 }
1137 {
1138 orc_union32 _dest;
1139 _dest.x2[0] = var54.x2[1];
1140 _dest.x2[1] = var55.x2[1];
1141 var46.x2[1] = _dest.i;
1142 }
1143 /* 19: storeq */
1144 ptr0[i] = var46;
1145 }
1146
1147 }
1148
1149 #else
1150 static void
_backup_bayer_orc_merge_gr_bgra(OrcExecutor * ORC_RESTRICT ex)1151 _backup_bayer_orc_merge_gr_bgra (OrcExecutor * ORC_RESTRICT ex)
1152 {
1153 int i;
1154 int n = ex->n;
1155 orc_union64 *ORC_RESTRICT ptr0;
1156 const orc_union16 *ORC_RESTRICT ptr4;
1157 const orc_union16 *ORC_RESTRICT ptr5;
1158 const orc_union16 *ORC_RESTRICT ptr6;
1159 const orc_union16 *ORC_RESTRICT ptr7;
1160 const orc_union16 *ORC_RESTRICT ptr8;
1161 const orc_union16 *ORC_RESTRICT ptr9;
1162 orc_union16 var37;
1163 orc_union16 var38;
1164 orc_union16 var39;
1165 orc_union16 var40;
1166 orc_union16 var41;
1167 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1168 volatile orc_union16 var42;
1169 #else
1170 orc_union16 var42;
1171 #endif
1172 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1173 volatile orc_union16 var43;
1174 #else
1175 orc_union16 var43;
1176 #endif
1177 orc_union16 var44;
1178 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1179 volatile orc_union16 var45;
1180 #else
1181 orc_union16 var45;
1182 #endif
1183 orc_union64 var46;
1184 orc_union16 var47;
1185 orc_union16 var48;
1186 orc_union16 var49;
1187 orc_union16 var50;
1188 orc_union16 var51;
1189 orc_union16 var52;
1190 orc_union16 var53;
1191 orc_union32 var54;
1192 orc_union32 var55;
1193
1194 ptr0 = (orc_union64 *) ex->arrays[0];
1195 ptr4 = (orc_union16 *) ex->arrays[4];
1196 ptr5 = (orc_union16 *) ex->arrays[5];
1197 ptr6 = (orc_union16 *) ex->arrays[6];
1198 ptr7 = (orc_union16 *) ex->arrays[7];
1199 ptr8 = (orc_union16 *) ex->arrays[8];
1200 ptr9 = (orc_union16 *) ex->arrays[9];
1201
1202 /* 9: loadpw */
1203 var42.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
1204 /* 11: loadpw */
1205 var43.i = 0x000000ff; /* 255 or 1.25987e-321f */
1206 /* 16: loadpb */
1207 var45.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
1208 var45.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
1209
1210 for (i = 0; i < n; i++) {
1211 /* 0: loadw */
1212 var37 = ptr4[i];
1213 /* 1: loadw */
1214 var38 = ptr8[i];
1215 /* 2: avgub */
1216 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
1217 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
1218 /* 3: loadw */
1219 var39 = ptr5[i];
1220 /* 4: loadw */
1221 var40 = ptr9[i];
1222 /* 5: avgub */
1223 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
1224 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
1225 /* 6: loadw */
1226 var41 = ptr6[i];
1227 /* 7: copyw */
1228 var49.i = var41.i;
1229 /* 8: avgub */
1230 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
1231 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
1232 /* 10: andw */
1233 var51.i = var50.i & var42.i;
1234 /* 12: andw */
1235 var52.i = var49.i & var43.i;
1236 /* 13: orw */
1237 var53.i = var52.i | var51.i;
1238 /* 14: mergebw */
1239 {
1240 orc_union16 _dest;
1241 _dest.x2[0] = var47.x2[0];
1242 _dest.x2[1] = var53.x2[0];
1243 var54.x2[0] = _dest.i;
1244 }
1245 {
1246 orc_union16 _dest;
1247 _dest.x2[0] = var47.x2[1];
1248 _dest.x2[1] = var53.x2[1];
1249 var54.x2[1] = _dest.i;
1250 }
1251 /* 15: loadw */
1252 var44 = ptr7[i];
1253 /* 17: mergebw */
1254 {
1255 orc_union16 _dest;
1256 _dest.x2[0] = var44.x2[0];
1257 _dest.x2[1] = var45.x2[0];
1258 var55.x2[0] = _dest.i;
1259 }
1260 {
1261 orc_union16 _dest;
1262 _dest.x2[0] = var44.x2[1];
1263 _dest.x2[1] = var45.x2[1];
1264 var55.x2[1] = _dest.i;
1265 }
1266 /* 18: mergewl */
1267 {
1268 orc_union32 _dest;
1269 _dest.x2[0] = var54.x2[0];
1270 _dest.x2[1] = var55.x2[0];
1271 var46.x2[0] = _dest.i;
1272 }
1273 {
1274 orc_union32 _dest;
1275 _dest.x2[0] = var54.x2[1];
1276 _dest.x2[1] = var55.x2[1];
1277 var46.x2[1] = _dest.i;
1278 }
1279 /* 19: storeq */
1280 ptr0[i] = var46;
1281 }
1282
1283 }
1284
1285 void
bayer_orc_merge_gr_bgra(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)1286 bayer_orc_merge_gr_bgra (guint8 * ORC_RESTRICT d1,
1287 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
1288 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
1289 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
1290 {
1291 OrcExecutor _ex, *ex = &_ex;
1292 static volatile int p_inited = 0;
1293 static OrcCode *c = 0;
1294 void (*func) (OrcExecutor *);
1295
1296 if (!p_inited) {
1297 orc_once_mutex_lock ();
1298 if (!p_inited) {
1299 OrcProgram *p;
1300
1301 #if 1
1302 static const orc_uint8 bc[] = {
1303 1, 9, 23, 98, 97, 121, 101, 114, 95, 111, 114, 99, 95, 109, 101, 114,
1304 103, 101, 95, 103, 114, 95, 98, 103, 114, 97, 11, 8, 8, 12, 2, 2,
1305 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 14,
1306 2, 0, 255, 0, 0, 14, 2, 255, 0, 0, 0, 14, 1, 255, 0, 0,
1307 0, 20, 4, 20, 4, 20, 2, 20, 2, 20, 2, 21, 1, 39, 34, 4,
1308 8, 21, 1, 39, 35, 5, 9, 79, 36, 6, 21, 1, 39, 35, 35, 36,
1309 73, 35, 35, 16, 73, 36, 36, 17, 92, 35, 36, 35, 21, 1, 196, 33,
1310 34, 35, 21, 1, 196, 32, 7, 18, 21, 1, 195, 0, 33, 32, 2, 0,
1311
1312 };
1313 p = orc_program_new_from_static_bytecode (bc);
1314 orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_bgra);
1315 #else
1316 p = orc_program_new ();
1317 orc_program_set_name (p, "bayer_orc_merge_gr_bgra");
1318 orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_bgra);
1319 orc_program_add_destination (p, 8, "d1");
1320 orc_program_add_source (p, 2, "s1");
1321 orc_program_add_source (p, 2, "s2");
1322 orc_program_add_source (p, 2, "s3");
1323 orc_program_add_source (p, 2, "s4");
1324 orc_program_add_source (p, 2, "s5");
1325 orc_program_add_source (p, 2, "s6");
1326 orc_program_add_constant (p, 2, 0x0000ff00, "c1");
1327 orc_program_add_constant (p, 2, 0x000000ff, "c2");
1328 orc_program_add_constant (p, 1, 0x000000ff, "c3");
1329 orc_program_add_temporary (p, 4, "t1");
1330 orc_program_add_temporary (p, 4, "t2");
1331 orc_program_add_temporary (p, 2, "t3");
1332 orc_program_add_temporary (p, 2, "t4");
1333 orc_program_add_temporary (p, 2, "t5");
1334
1335 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5,
1336 ORC_VAR_D1);
1337 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6,
1338 ORC_VAR_D1);
1339 orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1,
1340 ORC_VAR_D1);
1341 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5,
1342 ORC_VAR_D1);
1343 orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1,
1344 ORC_VAR_D1);
1345 orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2,
1346 ORC_VAR_D1);
1347 orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4,
1348 ORC_VAR_D1);
1349 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_T4,
1350 ORC_VAR_D1);
1351 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_S4, ORC_VAR_C3,
1352 ORC_VAR_D1);
1353 orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T2, ORC_VAR_T1,
1354 ORC_VAR_D1);
1355 #endif
1356
1357 orc_program_compile (p);
1358 c = orc_program_take_code (p);
1359 orc_program_free (p);
1360 }
1361 p_inited = TRUE;
1362 orc_once_mutex_unlock ();
1363 }
1364 ex->arrays[ORC_VAR_A2] = c;
1365 ex->program = 0;
1366
1367 ex->n = n;
1368 ex->arrays[ORC_VAR_D1] = d1;
1369 ex->arrays[ORC_VAR_S1] = (void *) s1;
1370 ex->arrays[ORC_VAR_S2] = (void *) s2;
1371 ex->arrays[ORC_VAR_S3] = (void *) s3;
1372 ex->arrays[ORC_VAR_S4] = (void *) s4;
1373 ex->arrays[ORC_VAR_S5] = (void *) s5;
1374 ex->arrays[ORC_VAR_S6] = (void *) s6;
1375
1376 func = c->exec;
1377 func (ex);
1378 }
1379 #endif
1380
1381
1382 /* bayer_orc_merge_bg_abgr */
1383 #ifdef DISABLE_ORC
1384 void
bayer_orc_merge_bg_abgr(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)1385 bayer_orc_merge_bg_abgr (guint8 * ORC_RESTRICT d1,
1386 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
1387 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
1388 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
1389 {
1390 int i;
1391 orc_union64 *ORC_RESTRICT ptr0;
1392 const orc_union16 *ORC_RESTRICT ptr4;
1393 const orc_union16 *ORC_RESTRICT ptr5;
1394 const orc_union16 *ORC_RESTRICT ptr6;
1395 const orc_union16 *ORC_RESTRICT ptr7;
1396 const orc_union16 *ORC_RESTRICT ptr8;
1397 const orc_union16 *ORC_RESTRICT ptr9;
1398 orc_union16 var37;
1399 orc_union16 var38;
1400 orc_union16 var39;
1401 orc_union16 var40;
1402 orc_union16 var41;
1403 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1404 volatile orc_union16 var42;
1405 #else
1406 orc_union16 var42;
1407 #endif
1408 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1409 volatile orc_union16 var43;
1410 #else
1411 orc_union16 var43;
1412 #endif
1413 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1414 volatile orc_union16 var44;
1415 #else
1416 orc_union16 var44;
1417 #endif
1418 orc_union16 var45;
1419 orc_union64 var46;
1420 orc_union16 var47;
1421 orc_union16 var48;
1422 orc_union16 var49;
1423 orc_union16 var50;
1424 orc_union16 var51;
1425 orc_union16 var52;
1426 orc_union16 var53;
1427 orc_union32 var54;
1428 orc_union32 var55;
1429
1430 ptr0 = (orc_union64 *) d1;
1431 ptr4 = (orc_union16 *) s1;
1432 ptr5 = (orc_union16 *) s2;
1433 ptr6 = (orc_union16 *) s3;
1434 ptr7 = (orc_union16 *) s4;
1435 ptr8 = (orc_union16 *) s5;
1436 ptr9 = (orc_union16 *) s6;
1437
1438 /* 9: loadpw */
1439 var42.i = 0x000000ff; /* 255 or 1.25987e-321f */
1440 /* 11: loadpw */
1441 var43.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
1442 /* 14: loadpb */
1443 var44.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
1444 var44.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
1445
1446 for (i = 0; i < n; i++) {
1447 /* 0: loadw */
1448 var37 = ptr5[i];
1449 /* 1: loadw */
1450 var38 = ptr9[i];
1451 /* 2: avgub */
1452 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
1453 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
1454 /* 3: loadw */
1455 var39 = ptr4[i];
1456 /* 4: loadw */
1457 var40 = ptr8[i];
1458 /* 5: avgub */
1459 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
1460 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
1461 /* 6: loadw */
1462 var41 = ptr7[i];
1463 /* 7: copyw */
1464 var49.i = var41.i;
1465 /* 8: avgub */
1466 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
1467 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
1468 /* 10: andw */
1469 var51.i = var50.i & var42.i;
1470 /* 12: andw */
1471 var52.i = var49.i & var43.i;
1472 /* 13: orw */
1473 var53.i = var52.i | var51.i;
1474 /* 15: loadw */
1475 var45 = ptr6[i];
1476 /* 16: mergebw */
1477 {
1478 orc_union16 _dest;
1479 _dest.x2[0] = var44.x2[0];
1480 _dest.x2[1] = var45.x2[0];
1481 var54.x2[0] = _dest.i;
1482 }
1483 {
1484 orc_union16 _dest;
1485 _dest.x2[0] = var44.x2[1];
1486 _dest.x2[1] = var45.x2[1];
1487 var54.x2[1] = _dest.i;
1488 }
1489 /* 17: mergebw */
1490 {
1491 orc_union16 _dest;
1492 _dest.x2[0] = var53.x2[0];
1493 _dest.x2[1] = var47.x2[0];
1494 var55.x2[0] = _dest.i;
1495 }
1496 {
1497 orc_union16 _dest;
1498 _dest.x2[0] = var53.x2[1];
1499 _dest.x2[1] = var47.x2[1];
1500 var55.x2[1] = _dest.i;
1501 }
1502 /* 18: mergewl */
1503 {
1504 orc_union32 _dest;
1505 _dest.x2[0] = var54.x2[0];
1506 _dest.x2[1] = var55.x2[0];
1507 var46.x2[0] = _dest.i;
1508 }
1509 {
1510 orc_union32 _dest;
1511 _dest.x2[0] = var54.x2[1];
1512 _dest.x2[1] = var55.x2[1];
1513 var46.x2[1] = _dest.i;
1514 }
1515 /* 19: storeq */
1516 ptr0[i] = var46;
1517 }
1518
1519 }
1520
1521 #else
1522 static void
_backup_bayer_orc_merge_bg_abgr(OrcExecutor * ORC_RESTRICT ex)1523 _backup_bayer_orc_merge_bg_abgr (OrcExecutor * ORC_RESTRICT ex)
1524 {
1525 int i;
1526 int n = ex->n;
1527 orc_union64 *ORC_RESTRICT ptr0;
1528 const orc_union16 *ORC_RESTRICT ptr4;
1529 const orc_union16 *ORC_RESTRICT ptr5;
1530 const orc_union16 *ORC_RESTRICT ptr6;
1531 const orc_union16 *ORC_RESTRICT ptr7;
1532 const orc_union16 *ORC_RESTRICT ptr8;
1533 const orc_union16 *ORC_RESTRICT ptr9;
1534 orc_union16 var37;
1535 orc_union16 var38;
1536 orc_union16 var39;
1537 orc_union16 var40;
1538 orc_union16 var41;
1539 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1540 volatile orc_union16 var42;
1541 #else
1542 orc_union16 var42;
1543 #endif
1544 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1545 volatile orc_union16 var43;
1546 #else
1547 orc_union16 var43;
1548 #endif
1549 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1550 volatile orc_union16 var44;
1551 #else
1552 orc_union16 var44;
1553 #endif
1554 orc_union16 var45;
1555 orc_union64 var46;
1556 orc_union16 var47;
1557 orc_union16 var48;
1558 orc_union16 var49;
1559 orc_union16 var50;
1560 orc_union16 var51;
1561 orc_union16 var52;
1562 orc_union16 var53;
1563 orc_union32 var54;
1564 orc_union32 var55;
1565
1566 ptr0 = (orc_union64 *) ex->arrays[0];
1567 ptr4 = (orc_union16 *) ex->arrays[4];
1568 ptr5 = (orc_union16 *) ex->arrays[5];
1569 ptr6 = (orc_union16 *) ex->arrays[6];
1570 ptr7 = (orc_union16 *) ex->arrays[7];
1571 ptr8 = (orc_union16 *) ex->arrays[8];
1572 ptr9 = (orc_union16 *) ex->arrays[9];
1573
1574 /* 9: loadpw */
1575 var42.i = 0x000000ff; /* 255 or 1.25987e-321f */
1576 /* 11: loadpw */
1577 var43.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
1578 /* 14: loadpb */
1579 var44.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
1580 var44.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
1581
1582 for (i = 0; i < n; i++) {
1583 /* 0: loadw */
1584 var37 = ptr5[i];
1585 /* 1: loadw */
1586 var38 = ptr9[i];
1587 /* 2: avgub */
1588 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
1589 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
1590 /* 3: loadw */
1591 var39 = ptr4[i];
1592 /* 4: loadw */
1593 var40 = ptr8[i];
1594 /* 5: avgub */
1595 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
1596 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
1597 /* 6: loadw */
1598 var41 = ptr7[i];
1599 /* 7: copyw */
1600 var49.i = var41.i;
1601 /* 8: avgub */
1602 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
1603 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
1604 /* 10: andw */
1605 var51.i = var50.i & var42.i;
1606 /* 12: andw */
1607 var52.i = var49.i & var43.i;
1608 /* 13: orw */
1609 var53.i = var52.i | var51.i;
1610 /* 15: loadw */
1611 var45 = ptr6[i];
1612 /* 16: mergebw */
1613 {
1614 orc_union16 _dest;
1615 _dest.x2[0] = var44.x2[0];
1616 _dest.x2[1] = var45.x2[0];
1617 var54.x2[0] = _dest.i;
1618 }
1619 {
1620 orc_union16 _dest;
1621 _dest.x2[0] = var44.x2[1];
1622 _dest.x2[1] = var45.x2[1];
1623 var54.x2[1] = _dest.i;
1624 }
1625 /* 17: mergebw */
1626 {
1627 orc_union16 _dest;
1628 _dest.x2[0] = var53.x2[0];
1629 _dest.x2[1] = var47.x2[0];
1630 var55.x2[0] = _dest.i;
1631 }
1632 {
1633 orc_union16 _dest;
1634 _dest.x2[0] = var53.x2[1];
1635 _dest.x2[1] = var47.x2[1];
1636 var55.x2[1] = _dest.i;
1637 }
1638 /* 18: mergewl */
1639 {
1640 orc_union32 _dest;
1641 _dest.x2[0] = var54.x2[0];
1642 _dest.x2[1] = var55.x2[0];
1643 var46.x2[0] = _dest.i;
1644 }
1645 {
1646 orc_union32 _dest;
1647 _dest.x2[0] = var54.x2[1];
1648 _dest.x2[1] = var55.x2[1];
1649 var46.x2[1] = _dest.i;
1650 }
1651 /* 19: storeq */
1652 ptr0[i] = var46;
1653 }
1654
1655 }
1656
1657 void
bayer_orc_merge_bg_abgr(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)1658 bayer_orc_merge_bg_abgr (guint8 * ORC_RESTRICT d1,
1659 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
1660 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
1661 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
1662 {
1663 OrcExecutor _ex, *ex = &_ex;
1664 static volatile int p_inited = 0;
1665 static OrcCode *c = 0;
1666 void (*func) (OrcExecutor *);
1667
1668 if (!p_inited) {
1669 orc_once_mutex_lock ();
1670 if (!p_inited) {
1671 OrcProgram *p;
1672
1673 #if 1
1674 static const orc_uint8 bc[] = {
1675 1, 9, 23, 98, 97, 121, 101, 114, 95, 111, 114, 99, 95, 109, 101, 114,
1676 103, 101, 95, 98, 103, 95, 97, 98, 103, 114, 11, 8, 8, 12, 2, 2,
1677 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 14,
1678 2, 255, 0, 0, 0, 14, 2, 0, 255, 0, 0, 14, 1, 255, 0, 0,
1679 0, 20, 4, 20, 4, 20, 2, 20, 2, 20, 2, 21, 1, 39, 34, 5,
1680 9, 21, 1, 39, 35, 4, 8, 79, 36, 7, 21, 1, 39, 35, 35, 36,
1681 73, 35, 35, 16, 73, 36, 36, 17, 92, 35, 36, 35, 21, 1, 196, 32,
1682 18, 6, 21, 1, 196, 33, 35, 34, 21, 1, 195, 0, 32, 33, 2, 0,
1683
1684 };
1685 p = orc_program_new_from_static_bytecode (bc);
1686 orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_abgr);
1687 #else
1688 p = orc_program_new ();
1689 orc_program_set_name (p, "bayer_orc_merge_bg_abgr");
1690 orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_abgr);
1691 orc_program_add_destination (p, 8, "d1");
1692 orc_program_add_source (p, 2, "s1");
1693 orc_program_add_source (p, 2, "s2");
1694 orc_program_add_source (p, 2, "s3");
1695 orc_program_add_source (p, 2, "s4");
1696 orc_program_add_source (p, 2, "s5");
1697 orc_program_add_source (p, 2, "s6");
1698 orc_program_add_constant (p, 2, 0x000000ff, "c1");
1699 orc_program_add_constant (p, 2, 0x0000ff00, "c2");
1700 orc_program_add_constant (p, 1, 0x000000ff, "c3");
1701 orc_program_add_temporary (p, 4, "t1");
1702 orc_program_add_temporary (p, 4, "t2");
1703 orc_program_add_temporary (p, 2, "t3");
1704 orc_program_add_temporary (p, 2, "t4");
1705 orc_program_add_temporary (p, 2, "t5");
1706
1707 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6,
1708 ORC_VAR_D1);
1709 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5,
1710 ORC_VAR_D1);
1711 orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1,
1712 ORC_VAR_D1);
1713 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5,
1714 ORC_VAR_D1);
1715 orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1,
1716 ORC_VAR_D1);
1717 orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2,
1718 ORC_VAR_D1);
1719 orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4,
1720 ORC_VAR_D1);
1721 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C3, ORC_VAR_S3,
1722 ORC_VAR_D1);
1723 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_T3,
1724 ORC_VAR_D1);
1725 orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
1726 ORC_VAR_D1);
1727 #endif
1728
1729 orc_program_compile (p);
1730 c = orc_program_take_code (p);
1731 orc_program_free (p);
1732 }
1733 p_inited = TRUE;
1734 orc_once_mutex_unlock ();
1735 }
1736 ex->arrays[ORC_VAR_A2] = c;
1737 ex->program = 0;
1738
1739 ex->n = n;
1740 ex->arrays[ORC_VAR_D1] = d1;
1741 ex->arrays[ORC_VAR_S1] = (void *) s1;
1742 ex->arrays[ORC_VAR_S2] = (void *) s2;
1743 ex->arrays[ORC_VAR_S3] = (void *) s3;
1744 ex->arrays[ORC_VAR_S4] = (void *) s4;
1745 ex->arrays[ORC_VAR_S5] = (void *) s5;
1746 ex->arrays[ORC_VAR_S6] = (void *) s6;
1747
1748 func = c->exec;
1749 func (ex);
1750 }
1751 #endif
1752
1753
1754 /* bayer_orc_merge_gr_abgr */
1755 #ifdef DISABLE_ORC
1756 void
bayer_orc_merge_gr_abgr(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)1757 bayer_orc_merge_gr_abgr (guint8 * ORC_RESTRICT d1,
1758 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
1759 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
1760 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
1761 {
1762 int i;
1763 orc_union64 *ORC_RESTRICT ptr0;
1764 const orc_union16 *ORC_RESTRICT ptr4;
1765 const orc_union16 *ORC_RESTRICT ptr5;
1766 const orc_union16 *ORC_RESTRICT ptr6;
1767 const orc_union16 *ORC_RESTRICT ptr7;
1768 const orc_union16 *ORC_RESTRICT ptr8;
1769 const orc_union16 *ORC_RESTRICT ptr9;
1770 orc_union16 var37;
1771 orc_union16 var38;
1772 orc_union16 var39;
1773 orc_union16 var40;
1774 orc_union16 var41;
1775 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1776 volatile orc_union16 var42;
1777 #else
1778 orc_union16 var42;
1779 #endif
1780 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1781 volatile orc_union16 var43;
1782 #else
1783 orc_union16 var43;
1784 #endif
1785 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1786 volatile orc_union16 var44;
1787 #else
1788 orc_union16 var44;
1789 #endif
1790 orc_union16 var45;
1791 orc_union64 var46;
1792 orc_union16 var47;
1793 orc_union16 var48;
1794 orc_union16 var49;
1795 orc_union16 var50;
1796 orc_union16 var51;
1797 orc_union16 var52;
1798 orc_union16 var53;
1799 orc_union32 var54;
1800 orc_union32 var55;
1801
1802 ptr0 = (orc_union64 *) d1;
1803 ptr4 = (orc_union16 *) s1;
1804 ptr5 = (orc_union16 *) s2;
1805 ptr6 = (orc_union16 *) s3;
1806 ptr7 = (orc_union16 *) s4;
1807 ptr8 = (orc_union16 *) s5;
1808 ptr9 = (orc_union16 *) s6;
1809
1810 /* 9: loadpw */
1811 var42.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
1812 /* 11: loadpw */
1813 var43.i = 0x000000ff; /* 255 or 1.25987e-321f */
1814 /* 14: loadpb */
1815 var44.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
1816 var44.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
1817
1818 for (i = 0; i < n; i++) {
1819 /* 0: loadw */
1820 var37 = ptr4[i];
1821 /* 1: loadw */
1822 var38 = ptr8[i];
1823 /* 2: avgub */
1824 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
1825 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
1826 /* 3: loadw */
1827 var39 = ptr5[i];
1828 /* 4: loadw */
1829 var40 = ptr9[i];
1830 /* 5: avgub */
1831 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
1832 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
1833 /* 6: loadw */
1834 var41 = ptr6[i];
1835 /* 7: copyw */
1836 var49.i = var41.i;
1837 /* 8: avgub */
1838 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
1839 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
1840 /* 10: andw */
1841 var51.i = var50.i & var42.i;
1842 /* 12: andw */
1843 var52.i = var49.i & var43.i;
1844 /* 13: orw */
1845 var53.i = var52.i | var51.i;
1846 /* 15: mergebw */
1847 {
1848 orc_union16 _dest;
1849 _dest.x2[0] = var44.x2[0];
1850 _dest.x2[1] = var47.x2[0];
1851 var54.x2[0] = _dest.i;
1852 }
1853 {
1854 orc_union16 _dest;
1855 _dest.x2[0] = var44.x2[1];
1856 _dest.x2[1] = var47.x2[1];
1857 var54.x2[1] = _dest.i;
1858 }
1859 /* 16: loadw */
1860 var45 = ptr7[i];
1861 /* 17: mergebw */
1862 {
1863 orc_union16 _dest;
1864 _dest.x2[0] = var53.x2[0];
1865 _dest.x2[1] = var45.x2[0];
1866 var55.x2[0] = _dest.i;
1867 }
1868 {
1869 orc_union16 _dest;
1870 _dest.x2[0] = var53.x2[1];
1871 _dest.x2[1] = var45.x2[1];
1872 var55.x2[1] = _dest.i;
1873 }
1874 /* 18: mergewl */
1875 {
1876 orc_union32 _dest;
1877 _dest.x2[0] = var54.x2[0];
1878 _dest.x2[1] = var55.x2[0];
1879 var46.x2[0] = _dest.i;
1880 }
1881 {
1882 orc_union32 _dest;
1883 _dest.x2[0] = var54.x2[1];
1884 _dest.x2[1] = var55.x2[1];
1885 var46.x2[1] = _dest.i;
1886 }
1887 /* 19: storeq */
1888 ptr0[i] = var46;
1889 }
1890
1891 }
1892
1893 #else
1894 static void
_backup_bayer_orc_merge_gr_abgr(OrcExecutor * ORC_RESTRICT ex)1895 _backup_bayer_orc_merge_gr_abgr (OrcExecutor * ORC_RESTRICT ex)
1896 {
1897 int i;
1898 int n = ex->n;
1899 orc_union64 *ORC_RESTRICT ptr0;
1900 const orc_union16 *ORC_RESTRICT ptr4;
1901 const orc_union16 *ORC_RESTRICT ptr5;
1902 const orc_union16 *ORC_RESTRICT ptr6;
1903 const orc_union16 *ORC_RESTRICT ptr7;
1904 const orc_union16 *ORC_RESTRICT ptr8;
1905 const orc_union16 *ORC_RESTRICT ptr9;
1906 orc_union16 var37;
1907 orc_union16 var38;
1908 orc_union16 var39;
1909 orc_union16 var40;
1910 orc_union16 var41;
1911 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1912 volatile orc_union16 var42;
1913 #else
1914 orc_union16 var42;
1915 #endif
1916 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1917 volatile orc_union16 var43;
1918 #else
1919 orc_union16 var43;
1920 #endif
1921 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
1922 volatile orc_union16 var44;
1923 #else
1924 orc_union16 var44;
1925 #endif
1926 orc_union16 var45;
1927 orc_union64 var46;
1928 orc_union16 var47;
1929 orc_union16 var48;
1930 orc_union16 var49;
1931 orc_union16 var50;
1932 orc_union16 var51;
1933 orc_union16 var52;
1934 orc_union16 var53;
1935 orc_union32 var54;
1936 orc_union32 var55;
1937
1938 ptr0 = (orc_union64 *) ex->arrays[0];
1939 ptr4 = (orc_union16 *) ex->arrays[4];
1940 ptr5 = (orc_union16 *) ex->arrays[5];
1941 ptr6 = (orc_union16 *) ex->arrays[6];
1942 ptr7 = (orc_union16 *) ex->arrays[7];
1943 ptr8 = (orc_union16 *) ex->arrays[8];
1944 ptr9 = (orc_union16 *) ex->arrays[9];
1945
1946 /* 9: loadpw */
1947 var42.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
1948 /* 11: loadpw */
1949 var43.i = 0x000000ff; /* 255 or 1.25987e-321f */
1950 /* 14: loadpb */
1951 var44.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
1952 var44.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
1953
1954 for (i = 0; i < n; i++) {
1955 /* 0: loadw */
1956 var37 = ptr4[i];
1957 /* 1: loadw */
1958 var38 = ptr8[i];
1959 /* 2: avgub */
1960 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
1961 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
1962 /* 3: loadw */
1963 var39 = ptr5[i];
1964 /* 4: loadw */
1965 var40 = ptr9[i];
1966 /* 5: avgub */
1967 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
1968 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
1969 /* 6: loadw */
1970 var41 = ptr6[i];
1971 /* 7: copyw */
1972 var49.i = var41.i;
1973 /* 8: avgub */
1974 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
1975 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
1976 /* 10: andw */
1977 var51.i = var50.i & var42.i;
1978 /* 12: andw */
1979 var52.i = var49.i & var43.i;
1980 /* 13: orw */
1981 var53.i = var52.i | var51.i;
1982 /* 15: mergebw */
1983 {
1984 orc_union16 _dest;
1985 _dest.x2[0] = var44.x2[0];
1986 _dest.x2[1] = var47.x2[0];
1987 var54.x2[0] = _dest.i;
1988 }
1989 {
1990 orc_union16 _dest;
1991 _dest.x2[0] = var44.x2[1];
1992 _dest.x2[1] = var47.x2[1];
1993 var54.x2[1] = _dest.i;
1994 }
1995 /* 16: loadw */
1996 var45 = ptr7[i];
1997 /* 17: mergebw */
1998 {
1999 orc_union16 _dest;
2000 _dest.x2[0] = var53.x2[0];
2001 _dest.x2[1] = var45.x2[0];
2002 var55.x2[0] = _dest.i;
2003 }
2004 {
2005 orc_union16 _dest;
2006 _dest.x2[0] = var53.x2[1];
2007 _dest.x2[1] = var45.x2[1];
2008 var55.x2[1] = _dest.i;
2009 }
2010 /* 18: mergewl */
2011 {
2012 orc_union32 _dest;
2013 _dest.x2[0] = var54.x2[0];
2014 _dest.x2[1] = var55.x2[0];
2015 var46.x2[0] = _dest.i;
2016 }
2017 {
2018 orc_union32 _dest;
2019 _dest.x2[0] = var54.x2[1];
2020 _dest.x2[1] = var55.x2[1];
2021 var46.x2[1] = _dest.i;
2022 }
2023 /* 19: storeq */
2024 ptr0[i] = var46;
2025 }
2026
2027 }
2028
2029 void
bayer_orc_merge_gr_abgr(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)2030 bayer_orc_merge_gr_abgr (guint8 * ORC_RESTRICT d1,
2031 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
2032 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
2033 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
2034 {
2035 OrcExecutor _ex, *ex = &_ex;
2036 static volatile int p_inited = 0;
2037 static OrcCode *c = 0;
2038 void (*func) (OrcExecutor *);
2039
2040 if (!p_inited) {
2041 orc_once_mutex_lock ();
2042 if (!p_inited) {
2043 OrcProgram *p;
2044
2045 #if 1
2046 static const orc_uint8 bc[] = {
2047 1, 9, 23, 98, 97, 121, 101, 114, 95, 111, 114, 99, 95, 109, 101, 114,
2048 103, 101, 95, 103, 114, 95, 97, 98, 103, 114, 11, 8, 8, 12, 2, 2,
2049 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 14,
2050 2, 0, 255, 0, 0, 14, 2, 255, 0, 0, 0, 14, 1, 255, 0, 0,
2051 0, 20, 4, 20, 4, 20, 2, 20, 2, 20, 2, 21, 1, 39, 34, 4,
2052 8, 21, 1, 39, 35, 5, 9, 79, 36, 6, 21, 1, 39, 35, 35, 36,
2053 73, 35, 35, 16, 73, 36, 36, 17, 92, 35, 36, 35, 21, 1, 196, 32,
2054 18, 34, 21, 1, 196, 33, 35, 7, 21, 1, 195, 0, 32, 33, 2, 0,
2055
2056 };
2057 p = orc_program_new_from_static_bytecode (bc);
2058 orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_abgr);
2059 #else
2060 p = orc_program_new ();
2061 orc_program_set_name (p, "bayer_orc_merge_gr_abgr");
2062 orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_abgr);
2063 orc_program_add_destination (p, 8, "d1");
2064 orc_program_add_source (p, 2, "s1");
2065 orc_program_add_source (p, 2, "s2");
2066 orc_program_add_source (p, 2, "s3");
2067 orc_program_add_source (p, 2, "s4");
2068 orc_program_add_source (p, 2, "s5");
2069 orc_program_add_source (p, 2, "s6");
2070 orc_program_add_constant (p, 2, 0x0000ff00, "c1");
2071 orc_program_add_constant (p, 2, 0x000000ff, "c2");
2072 orc_program_add_constant (p, 1, 0x000000ff, "c3");
2073 orc_program_add_temporary (p, 4, "t1");
2074 orc_program_add_temporary (p, 4, "t2");
2075 orc_program_add_temporary (p, 2, "t3");
2076 orc_program_add_temporary (p, 2, "t4");
2077 orc_program_add_temporary (p, 2, "t5");
2078
2079 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5,
2080 ORC_VAR_D1);
2081 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6,
2082 ORC_VAR_D1);
2083 orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1,
2084 ORC_VAR_D1);
2085 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5,
2086 ORC_VAR_D1);
2087 orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1,
2088 ORC_VAR_D1);
2089 orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2,
2090 ORC_VAR_D1);
2091 orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4,
2092 ORC_VAR_D1);
2093 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C3, ORC_VAR_T3,
2094 ORC_VAR_D1);
2095 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_S4,
2096 ORC_VAR_D1);
2097 orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
2098 ORC_VAR_D1);
2099 #endif
2100
2101 orc_program_compile (p);
2102 c = orc_program_take_code (p);
2103 orc_program_free (p);
2104 }
2105 p_inited = TRUE;
2106 orc_once_mutex_unlock ();
2107 }
2108 ex->arrays[ORC_VAR_A2] = c;
2109 ex->program = 0;
2110
2111 ex->n = n;
2112 ex->arrays[ORC_VAR_D1] = d1;
2113 ex->arrays[ORC_VAR_S1] = (void *) s1;
2114 ex->arrays[ORC_VAR_S2] = (void *) s2;
2115 ex->arrays[ORC_VAR_S3] = (void *) s3;
2116 ex->arrays[ORC_VAR_S4] = (void *) s4;
2117 ex->arrays[ORC_VAR_S5] = (void *) s5;
2118 ex->arrays[ORC_VAR_S6] = (void *) s6;
2119
2120 func = c->exec;
2121 func (ex);
2122 }
2123 #endif
2124
2125
2126 /* bayer_orc_merge_bg_rgba */
2127 #ifdef DISABLE_ORC
2128 void
bayer_orc_merge_bg_rgba(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)2129 bayer_orc_merge_bg_rgba (guint8 * ORC_RESTRICT d1,
2130 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
2131 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
2132 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
2133 {
2134 int i;
2135 orc_union64 *ORC_RESTRICT ptr0;
2136 const orc_union16 *ORC_RESTRICT ptr4;
2137 const orc_union16 *ORC_RESTRICT ptr5;
2138 const orc_union16 *ORC_RESTRICT ptr6;
2139 const orc_union16 *ORC_RESTRICT ptr7;
2140 const orc_union16 *ORC_RESTRICT ptr8;
2141 const orc_union16 *ORC_RESTRICT ptr9;
2142 orc_union16 var37;
2143 orc_union16 var38;
2144 orc_union16 var39;
2145 orc_union16 var40;
2146 orc_union16 var41;
2147 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2148 volatile orc_union16 var42;
2149 #else
2150 orc_union16 var42;
2151 #endif
2152 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2153 volatile orc_union16 var43;
2154 #else
2155 orc_union16 var43;
2156 #endif
2157 orc_union16 var44;
2158 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2159 volatile orc_union16 var45;
2160 #else
2161 orc_union16 var45;
2162 #endif
2163 orc_union64 var46;
2164 orc_union16 var47;
2165 orc_union16 var48;
2166 orc_union16 var49;
2167 orc_union16 var50;
2168 orc_union16 var51;
2169 orc_union16 var52;
2170 orc_union16 var53;
2171 orc_union32 var54;
2172 orc_union32 var55;
2173
2174 ptr0 = (orc_union64 *) d1;
2175 ptr4 = (orc_union16 *) s1;
2176 ptr5 = (orc_union16 *) s2;
2177 ptr6 = (orc_union16 *) s3;
2178 ptr7 = (orc_union16 *) s4;
2179 ptr8 = (orc_union16 *) s5;
2180 ptr9 = (orc_union16 *) s6;
2181
2182 /* 9: loadpw */
2183 var42.i = 0x000000ff; /* 255 or 1.25987e-321f */
2184 /* 11: loadpw */
2185 var43.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
2186 /* 16: loadpb */
2187 var45.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
2188 var45.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
2189
2190 for (i = 0; i < n; i++) {
2191 /* 0: loadw */
2192 var37 = ptr5[i];
2193 /* 1: loadw */
2194 var38 = ptr9[i];
2195 /* 2: avgub */
2196 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
2197 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
2198 /* 3: loadw */
2199 var39 = ptr4[i];
2200 /* 4: loadw */
2201 var40 = ptr8[i];
2202 /* 5: avgub */
2203 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
2204 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
2205 /* 6: loadw */
2206 var41 = ptr7[i];
2207 /* 7: copyw */
2208 var49.i = var41.i;
2209 /* 8: avgub */
2210 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
2211 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
2212 /* 10: andw */
2213 var51.i = var50.i & var42.i;
2214 /* 12: andw */
2215 var52.i = var49.i & var43.i;
2216 /* 13: orw */
2217 var53.i = var52.i | var51.i;
2218 /* 14: mergebw */
2219 {
2220 orc_union16 _dest;
2221 _dest.x2[0] = var47.x2[0];
2222 _dest.x2[1] = var53.x2[0];
2223 var54.x2[0] = _dest.i;
2224 }
2225 {
2226 orc_union16 _dest;
2227 _dest.x2[0] = var47.x2[1];
2228 _dest.x2[1] = var53.x2[1];
2229 var54.x2[1] = _dest.i;
2230 }
2231 /* 15: loadw */
2232 var44 = ptr6[i];
2233 /* 17: mergebw */
2234 {
2235 orc_union16 _dest;
2236 _dest.x2[0] = var44.x2[0];
2237 _dest.x2[1] = var45.x2[0];
2238 var55.x2[0] = _dest.i;
2239 }
2240 {
2241 orc_union16 _dest;
2242 _dest.x2[0] = var44.x2[1];
2243 _dest.x2[1] = var45.x2[1];
2244 var55.x2[1] = _dest.i;
2245 }
2246 /* 18: mergewl */
2247 {
2248 orc_union32 _dest;
2249 _dest.x2[0] = var54.x2[0];
2250 _dest.x2[1] = var55.x2[0];
2251 var46.x2[0] = _dest.i;
2252 }
2253 {
2254 orc_union32 _dest;
2255 _dest.x2[0] = var54.x2[1];
2256 _dest.x2[1] = var55.x2[1];
2257 var46.x2[1] = _dest.i;
2258 }
2259 /* 19: storeq */
2260 ptr0[i] = var46;
2261 }
2262
2263 }
2264
2265 #else
2266 static void
_backup_bayer_orc_merge_bg_rgba(OrcExecutor * ORC_RESTRICT ex)2267 _backup_bayer_orc_merge_bg_rgba (OrcExecutor * ORC_RESTRICT ex)
2268 {
2269 int i;
2270 int n = ex->n;
2271 orc_union64 *ORC_RESTRICT ptr0;
2272 const orc_union16 *ORC_RESTRICT ptr4;
2273 const orc_union16 *ORC_RESTRICT ptr5;
2274 const orc_union16 *ORC_RESTRICT ptr6;
2275 const orc_union16 *ORC_RESTRICT ptr7;
2276 const orc_union16 *ORC_RESTRICT ptr8;
2277 const orc_union16 *ORC_RESTRICT ptr9;
2278 orc_union16 var37;
2279 orc_union16 var38;
2280 orc_union16 var39;
2281 orc_union16 var40;
2282 orc_union16 var41;
2283 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2284 volatile orc_union16 var42;
2285 #else
2286 orc_union16 var42;
2287 #endif
2288 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2289 volatile orc_union16 var43;
2290 #else
2291 orc_union16 var43;
2292 #endif
2293 orc_union16 var44;
2294 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2295 volatile orc_union16 var45;
2296 #else
2297 orc_union16 var45;
2298 #endif
2299 orc_union64 var46;
2300 orc_union16 var47;
2301 orc_union16 var48;
2302 orc_union16 var49;
2303 orc_union16 var50;
2304 orc_union16 var51;
2305 orc_union16 var52;
2306 orc_union16 var53;
2307 orc_union32 var54;
2308 orc_union32 var55;
2309
2310 ptr0 = (orc_union64 *) ex->arrays[0];
2311 ptr4 = (orc_union16 *) ex->arrays[4];
2312 ptr5 = (orc_union16 *) ex->arrays[5];
2313 ptr6 = (orc_union16 *) ex->arrays[6];
2314 ptr7 = (orc_union16 *) ex->arrays[7];
2315 ptr8 = (orc_union16 *) ex->arrays[8];
2316 ptr9 = (orc_union16 *) ex->arrays[9];
2317
2318 /* 9: loadpw */
2319 var42.i = 0x000000ff; /* 255 or 1.25987e-321f */
2320 /* 11: loadpw */
2321 var43.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
2322 /* 16: loadpb */
2323 var45.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
2324 var45.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
2325
2326 for (i = 0; i < n; i++) {
2327 /* 0: loadw */
2328 var37 = ptr5[i];
2329 /* 1: loadw */
2330 var38 = ptr9[i];
2331 /* 2: avgub */
2332 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
2333 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
2334 /* 3: loadw */
2335 var39 = ptr4[i];
2336 /* 4: loadw */
2337 var40 = ptr8[i];
2338 /* 5: avgub */
2339 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
2340 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
2341 /* 6: loadw */
2342 var41 = ptr7[i];
2343 /* 7: copyw */
2344 var49.i = var41.i;
2345 /* 8: avgub */
2346 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
2347 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
2348 /* 10: andw */
2349 var51.i = var50.i & var42.i;
2350 /* 12: andw */
2351 var52.i = var49.i & var43.i;
2352 /* 13: orw */
2353 var53.i = var52.i | var51.i;
2354 /* 14: mergebw */
2355 {
2356 orc_union16 _dest;
2357 _dest.x2[0] = var47.x2[0];
2358 _dest.x2[1] = var53.x2[0];
2359 var54.x2[0] = _dest.i;
2360 }
2361 {
2362 orc_union16 _dest;
2363 _dest.x2[0] = var47.x2[1];
2364 _dest.x2[1] = var53.x2[1];
2365 var54.x2[1] = _dest.i;
2366 }
2367 /* 15: loadw */
2368 var44 = ptr6[i];
2369 /* 17: mergebw */
2370 {
2371 orc_union16 _dest;
2372 _dest.x2[0] = var44.x2[0];
2373 _dest.x2[1] = var45.x2[0];
2374 var55.x2[0] = _dest.i;
2375 }
2376 {
2377 orc_union16 _dest;
2378 _dest.x2[0] = var44.x2[1];
2379 _dest.x2[1] = var45.x2[1];
2380 var55.x2[1] = _dest.i;
2381 }
2382 /* 18: mergewl */
2383 {
2384 orc_union32 _dest;
2385 _dest.x2[0] = var54.x2[0];
2386 _dest.x2[1] = var55.x2[0];
2387 var46.x2[0] = _dest.i;
2388 }
2389 {
2390 orc_union32 _dest;
2391 _dest.x2[0] = var54.x2[1];
2392 _dest.x2[1] = var55.x2[1];
2393 var46.x2[1] = _dest.i;
2394 }
2395 /* 19: storeq */
2396 ptr0[i] = var46;
2397 }
2398
2399 }
2400
2401 void
bayer_orc_merge_bg_rgba(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)2402 bayer_orc_merge_bg_rgba (guint8 * ORC_RESTRICT d1,
2403 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
2404 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
2405 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
2406 {
2407 OrcExecutor _ex, *ex = &_ex;
2408 static volatile int p_inited = 0;
2409 static OrcCode *c = 0;
2410 void (*func) (OrcExecutor *);
2411
2412 if (!p_inited) {
2413 orc_once_mutex_lock ();
2414 if (!p_inited) {
2415 OrcProgram *p;
2416
2417 #if 1
2418 static const orc_uint8 bc[] = {
2419 1, 9, 23, 98, 97, 121, 101, 114, 95, 111, 114, 99, 95, 109, 101, 114,
2420 103, 101, 95, 98, 103, 95, 114, 103, 98, 97, 11, 8, 8, 12, 2, 2,
2421 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 14,
2422 2, 255, 0, 0, 0, 14, 2, 0, 255, 0, 0, 14, 1, 255, 0, 0,
2423 0, 20, 4, 20, 4, 20, 2, 20, 2, 20, 2, 21, 1, 39, 34, 5,
2424 9, 21, 1, 39, 35, 4, 8, 79, 36, 7, 21, 1, 39, 35, 35, 36,
2425 73, 35, 35, 16, 73, 36, 36, 17, 92, 35, 36, 35, 21, 1, 196, 32,
2426 34, 35, 21, 1, 196, 33, 6, 18, 21, 1, 195, 0, 32, 33, 2, 0,
2427
2428 };
2429 p = orc_program_new_from_static_bytecode (bc);
2430 orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_rgba);
2431 #else
2432 p = orc_program_new ();
2433 orc_program_set_name (p, "bayer_orc_merge_bg_rgba");
2434 orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_rgba);
2435 orc_program_add_destination (p, 8, "d1");
2436 orc_program_add_source (p, 2, "s1");
2437 orc_program_add_source (p, 2, "s2");
2438 orc_program_add_source (p, 2, "s3");
2439 orc_program_add_source (p, 2, "s4");
2440 orc_program_add_source (p, 2, "s5");
2441 orc_program_add_source (p, 2, "s6");
2442 orc_program_add_constant (p, 2, 0x000000ff, "c1");
2443 orc_program_add_constant (p, 2, 0x0000ff00, "c2");
2444 orc_program_add_constant (p, 1, 0x000000ff, "c3");
2445 orc_program_add_temporary (p, 4, "t1");
2446 orc_program_add_temporary (p, 4, "t2");
2447 orc_program_add_temporary (p, 2, "t3");
2448 orc_program_add_temporary (p, 2, "t4");
2449 orc_program_add_temporary (p, 2, "t5");
2450
2451 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6,
2452 ORC_VAR_D1);
2453 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5,
2454 ORC_VAR_D1);
2455 orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1,
2456 ORC_VAR_D1);
2457 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5,
2458 ORC_VAR_D1);
2459 orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1,
2460 ORC_VAR_D1);
2461 orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2,
2462 ORC_VAR_D1);
2463 orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4,
2464 ORC_VAR_D1);
2465 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_T3, ORC_VAR_T4,
2466 ORC_VAR_D1);
2467 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_S3, ORC_VAR_C3,
2468 ORC_VAR_D1);
2469 orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
2470 ORC_VAR_D1);
2471 #endif
2472
2473 orc_program_compile (p);
2474 c = orc_program_take_code (p);
2475 orc_program_free (p);
2476 }
2477 p_inited = TRUE;
2478 orc_once_mutex_unlock ();
2479 }
2480 ex->arrays[ORC_VAR_A2] = c;
2481 ex->program = 0;
2482
2483 ex->n = n;
2484 ex->arrays[ORC_VAR_D1] = d1;
2485 ex->arrays[ORC_VAR_S1] = (void *) s1;
2486 ex->arrays[ORC_VAR_S2] = (void *) s2;
2487 ex->arrays[ORC_VAR_S3] = (void *) s3;
2488 ex->arrays[ORC_VAR_S4] = (void *) s4;
2489 ex->arrays[ORC_VAR_S5] = (void *) s5;
2490 ex->arrays[ORC_VAR_S6] = (void *) s6;
2491
2492 func = c->exec;
2493 func (ex);
2494 }
2495 #endif
2496
2497
2498 /* bayer_orc_merge_gr_rgba */
2499 #ifdef DISABLE_ORC
2500 void
bayer_orc_merge_gr_rgba(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)2501 bayer_orc_merge_gr_rgba (guint8 * ORC_RESTRICT d1,
2502 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
2503 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
2504 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
2505 {
2506 int i;
2507 orc_union64 *ORC_RESTRICT ptr0;
2508 const orc_union16 *ORC_RESTRICT ptr4;
2509 const orc_union16 *ORC_RESTRICT ptr5;
2510 const orc_union16 *ORC_RESTRICT ptr6;
2511 const orc_union16 *ORC_RESTRICT ptr7;
2512 const orc_union16 *ORC_RESTRICT ptr8;
2513 const orc_union16 *ORC_RESTRICT ptr9;
2514 orc_union16 var37;
2515 orc_union16 var38;
2516 orc_union16 var39;
2517 orc_union16 var40;
2518 orc_union16 var41;
2519 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2520 volatile orc_union16 var42;
2521 #else
2522 orc_union16 var42;
2523 #endif
2524 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2525 volatile orc_union16 var43;
2526 #else
2527 orc_union16 var43;
2528 #endif
2529 orc_union16 var44;
2530 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2531 volatile orc_union16 var45;
2532 #else
2533 orc_union16 var45;
2534 #endif
2535 orc_union64 var46;
2536 orc_union16 var47;
2537 orc_union16 var48;
2538 orc_union16 var49;
2539 orc_union16 var50;
2540 orc_union16 var51;
2541 orc_union16 var52;
2542 orc_union16 var53;
2543 orc_union32 var54;
2544 orc_union32 var55;
2545
2546 ptr0 = (orc_union64 *) d1;
2547 ptr4 = (orc_union16 *) s1;
2548 ptr5 = (orc_union16 *) s2;
2549 ptr6 = (orc_union16 *) s3;
2550 ptr7 = (orc_union16 *) s4;
2551 ptr8 = (orc_union16 *) s5;
2552 ptr9 = (orc_union16 *) s6;
2553
2554 /* 9: loadpw */
2555 var42.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
2556 /* 11: loadpw */
2557 var43.i = 0x000000ff; /* 255 or 1.25987e-321f */
2558 /* 16: loadpb */
2559 var45.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
2560 var45.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
2561
2562 for (i = 0; i < n; i++) {
2563 /* 0: loadw */
2564 var37 = ptr4[i];
2565 /* 1: loadw */
2566 var38 = ptr8[i];
2567 /* 2: avgub */
2568 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
2569 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
2570 /* 3: loadw */
2571 var39 = ptr5[i];
2572 /* 4: loadw */
2573 var40 = ptr9[i];
2574 /* 5: avgub */
2575 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
2576 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
2577 /* 6: loadw */
2578 var41 = ptr6[i];
2579 /* 7: copyw */
2580 var49.i = var41.i;
2581 /* 8: avgub */
2582 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
2583 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
2584 /* 10: andw */
2585 var51.i = var50.i & var42.i;
2586 /* 12: andw */
2587 var52.i = var49.i & var43.i;
2588 /* 13: orw */
2589 var53.i = var52.i | var51.i;
2590 /* 14: loadw */
2591 var44 = ptr7[i];
2592 /* 15: mergebw */
2593 {
2594 orc_union16 _dest;
2595 _dest.x2[0] = var44.x2[0];
2596 _dest.x2[1] = var53.x2[0];
2597 var54.x2[0] = _dest.i;
2598 }
2599 {
2600 orc_union16 _dest;
2601 _dest.x2[0] = var44.x2[1];
2602 _dest.x2[1] = var53.x2[1];
2603 var54.x2[1] = _dest.i;
2604 }
2605 /* 17: mergebw */
2606 {
2607 orc_union16 _dest;
2608 _dest.x2[0] = var47.x2[0];
2609 _dest.x2[1] = var45.x2[0];
2610 var55.x2[0] = _dest.i;
2611 }
2612 {
2613 orc_union16 _dest;
2614 _dest.x2[0] = var47.x2[1];
2615 _dest.x2[1] = var45.x2[1];
2616 var55.x2[1] = _dest.i;
2617 }
2618 /* 18: mergewl */
2619 {
2620 orc_union32 _dest;
2621 _dest.x2[0] = var54.x2[0];
2622 _dest.x2[1] = var55.x2[0];
2623 var46.x2[0] = _dest.i;
2624 }
2625 {
2626 orc_union32 _dest;
2627 _dest.x2[0] = var54.x2[1];
2628 _dest.x2[1] = var55.x2[1];
2629 var46.x2[1] = _dest.i;
2630 }
2631 /* 19: storeq */
2632 ptr0[i] = var46;
2633 }
2634
2635 }
2636
2637 #else
2638 static void
_backup_bayer_orc_merge_gr_rgba(OrcExecutor * ORC_RESTRICT ex)2639 _backup_bayer_orc_merge_gr_rgba (OrcExecutor * ORC_RESTRICT ex)
2640 {
2641 int i;
2642 int n = ex->n;
2643 orc_union64 *ORC_RESTRICT ptr0;
2644 const orc_union16 *ORC_RESTRICT ptr4;
2645 const orc_union16 *ORC_RESTRICT ptr5;
2646 const orc_union16 *ORC_RESTRICT ptr6;
2647 const orc_union16 *ORC_RESTRICT ptr7;
2648 const orc_union16 *ORC_RESTRICT ptr8;
2649 const orc_union16 *ORC_RESTRICT ptr9;
2650 orc_union16 var37;
2651 orc_union16 var38;
2652 orc_union16 var39;
2653 orc_union16 var40;
2654 orc_union16 var41;
2655 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2656 volatile orc_union16 var42;
2657 #else
2658 orc_union16 var42;
2659 #endif
2660 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2661 volatile orc_union16 var43;
2662 #else
2663 orc_union16 var43;
2664 #endif
2665 orc_union16 var44;
2666 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2667 volatile orc_union16 var45;
2668 #else
2669 orc_union16 var45;
2670 #endif
2671 orc_union64 var46;
2672 orc_union16 var47;
2673 orc_union16 var48;
2674 orc_union16 var49;
2675 orc_union16 var50;
2676 orc_union16 var51;
2677 orc_union16 var52;
2678 orc_union16 var53;
2679 orc_union32 var54;
2680 orc_union32 var55;
2681
2682 ptr0 = (orc_union64 *) ex->arrays[0];
2683 ptr4 = (orc_union16 *) ex->arrays[4];
2684 ptr5 = (orc_union16 *) ex->arrays[5];
2685 ptr6 = (orc_union16 *) ex->arrays[6];
2686 ptr7 = (orc_union16 *) ex->arrays[7];
2687 ptr8 = (orc_union16 *) ex->arrays[8];
2688 ptr9 = (orc_union16 *) ex->arrays[9];
2689
2690 /* 9: loadpw */
2691 var42.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
2692 /* 11: loadpw */
2693 var43.i = 0x000000ff; /* 255 or 1.25987e-321f */
2694 /* 16: loadpb */
2695 var45.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
2696 var45.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
2697
2698 for (i = 0; i < n; i++) {
2699 /* 0: loadw */
2700 var37 = ptr4[i];
2701 /* 1: loadw */
2702 var38 = ptr8[i];
2703 /* 2: avgub */
2704 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
2705 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
2706 /* 3: loadw */
2707 var39 = ptr5[i];
2708 /* 4: loadw */
2709 var40 = ptr9[i];
2710 /* 5: avgub */
2711 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
2712 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
2713 /* 6: loadw */
2714 var41 = ptr6[i];
2715 /* 7: copyw */
2716 var49.i = var41.i;
2717 /* 8: avgub */
2718 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
2719 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
2720 /* 10: andw */
2721 var51.i = var50.i & var42.i;
2722 /* 12: andw */
2723 var52.i = var49.i & var43.i;
2724 /* 13: orw */
2725 var53.i = var52.i | var51.i;
2726 /* 14: loadw */
2727 var44 = ptr7[i];
2728 /* 15: mergebw */
2729 {
2730 orc_union16 _dest;
2731 _dest.x2[0] = var44.x2[0];
2732 _dest.x2[1] = var53.x2[0];
2733 var54.x2[0] = _dest.i;
2734 }
2735 {
2736 orc_union16 _dest;
2737 _dest.x2[0] = var44.x2[1];
2738 _dest.x2[1] = var53.x2[1];
2739 var54.x2[1] = _dest.i;
2740 }
2741 /* 17: mergebw */
2742 {
2743 orc_union16 _dest;
2744 _dest.x2[0] = var47.x2[0];
2745 _dest.x2[1] = var45.x2[0];
2746 var55.x2[0] = _dest.i;
2747 }
2748 {
2749 orc_union16 _dest;
2750 _dest.x2[0] = var47.x2[1];
2751 _dest.x2[1] = var45.x2[1];
2752 var55.x2[1] = _dest.i;
2753 }
2754 /* 18: mergewl */
2755 {
2756 orc_union32 _dest;
2757 _dest.x2[0] = var54.x2[0];
2758 _dest.x2[1] = var55.x2[0];
2759 var46.x2[0] = _dest.i;
2760 }
2761 {
2762 orc_union32 _dest;
2763 _dest.x2[0] = var54.x2[1];
2764 _dest.x2[1] = var55.x2[1];
2765 var46.x2[1] = _dest.i;
2766 }
2767 /* 19: storeq */
2768 ptr0[i] = var46;
2769 }
2770
2771 }
2772
2773 void
bayer_orc_merge_gr_rgba(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)2774 bayer_orc_merge_gr_rgba (guint8 * ORC_RESTRICT d1,
2775 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
2776 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
2777 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
2778 {
2779 OrcExecutor _ex, *ex = &_ex;
2780 static volatile int p_inited = 0;
2781 static OrcCode *c = 0;
2782 void (*func) (OrcExecutor *);
2783
2784 if (!p_inited) {
2785 orc_once_mutex_lock ();
2786 if (!p_inited) {
2787 OrcProgram *p;
2788
2789 #if 1
2790 static const orc_uint8 bc[] = {
2791 1, 9, 23, 98, 97, 121, 101, 114, 95, 111, 114, 99, 95, 109, 101, 114,
2792 103, 101, 95, 103, 114, 95, 114, 103, 98, 97, 11, 8, 8, 12, 2, 2,
2793 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 14,
2794 2, 0, 255, 0, 0, 14, 2, 255, 0, 0, 0, 14, 1, 255, 0, 0,
2795 0, 20, 4, 20, 4, 20, 2, 20, 2, 20, 2, 21, 1, 39, 34, 4,
2796 8, 21, 1, 39, 35, 5, 9, 79, 36, 6, 21, 1, 39, 35, 35, 36,
2797 73, 35, 35, 16, 73, 36, 36, 17, 92, 35, 36, 35, 21, 1, 196, 32,
2798 7, 35, 21, 1, 196, 33, 34, 18, 21, 1, 195, 0, 32, 33, 2, 0,
2799
2800 };
2801 p = orc_program_new_from_static_bytecode (bc);
2802 orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_rgba);
2803 #else
2804 p = orc_program_new ();
2805 orc_program_set_name (p, "bayer_orc_merge_gr_rgba");
2806 orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_rgba);
2807 orc_program_add_destination (p, 8, "d1");
2808 orc_program_add_source (p, 2, "s1");
2809 orc_program_add_source (p, 2, "s2");
2810 orc_program_add_source (p, 2, "s3");
2811 orc_program_add_source (p, 2, "s4");
2812 orc_program_add_source (p, 2, "s5");
2813 orc_program_add_source (p, 2, "s6");
2814 orc_program_add_constant (p, 2, 0x0000ff00, "c1");
2815 orc_program_add_constant (p, 2, 0x000000ff, "c2");
2816 orc_program_add_constant (p, 1, 0x000000ff, "c3");
2817 orc_program_add_temporary (p, 4, "t1");
2818 orc_program_add_temporary (p, 4, "t2");
2819 orc_program_add_temporary (p, 2, "t3");
2820 orc_program_add_temporary (p, 2, "t4");
2821 orc_program_add_temporary (p, 2, "t5");
2822
2823 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5,
2824 ORC_VAR_D1);
2825 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6,
2826 ORC_VAR_D1);
2827 orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1,
2828 ORC_VAR_D1);
2829 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5,
2830 ORC_VAR_D1);
2831 orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1,
2832 ORC_VAR_D1);
2833 orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2,
2834 ORC_VAR_D1);
2835 orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4,
2836 ORC_VAR_D1);
2837 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_S4, ORC_VAR_T4,
2838 ORC_VAR_D1);
2839 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T3, ORC_VAR_C3,
2840 ORC_VAR_D1);
2841 orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
2842 ORC_VAR_D1);
2843 #endif
2844
2845 orc_program_compile (p);
2846 c = orc_program_take_code (p);
2847 orc_program_free (p);
2848 }
2849 p_inited = TRUE;
2850 orc_once_mutex_unlock ();
2851 }
2852 ex->arrays[ORC_VAR_A2] = c;
2853 ex->program = 0;
2854
2855 ex->n = n;
2856 ex->arrays[ORC_VAR_D1] = d1;
2857 ex->arrays[ORC_VAR_S1] = (void *) s1;
2858 ex->arrays[ORC_VAR_S2] = (void *) s2;
2859 ex->arrays[ORC_VAR_S3] = (void *) s3;
2860 ex->arrays[ORC_VAR_S4] = (void *) s4;
2861 ex->arrays[ORC_VAR_S5] = (void *) s5;
2862 ex->arrays[ORC_VAR_S6] = (void *) s6;
2863
2864 func = c->exec;
2865 func (ex);
2866 }
2867 #endif
2868
2869
2870 /* bayer_orc_merge_bg_argb */
2871 #ifdef DISABLE_ORC
2872 void
bayer_orc_merge_bg_argb(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)2873 bayer_orc_merge_bg_argb (guint8 * ORC_RESTRICT d1,
2874 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
2875 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
2876 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
2877 {
2878 int i;
2879 orc_union64 *ORC_RESTRICT ptr0;
2880 const orc_union16 *ORC_RESTRICT ptr4;
2881 const orc_union16 *ORC_RESTRICT ptr5;
2882 const orc_union16 *ORC_RESTRICT ptr6;
2883 const orc_union16 *ORC_RESTRICT ptr7;
2884 const orc_union16 *ORC_RESTRICT ptr8;
2885 const orc_union16 *ORC_RESTRICT ptr9;
2886 orc_union16 var37;
2887 orc_union16 var38;
2888 orc_union16 var39;
2889 orc_union16 var40;
2890 orc_union16 var41;
2891 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2892 volatile orc_union16 var42;
2893 #else
2894 orc_union16 var42;
2895 #endif
2896 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2897 volatile orc_union16 var43;
2898 #else
2899 orc_union16 var43;
2900 #endif
2901 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
2902 volatile orc_union16 var44;
2903 #else
2904 orc_union16 var44;
2905 #endif
2906 orc_union16 var45;
2907 orc_union64 var46;
2908 orc_union16 var47;
2909 orc_union16 var48;
2910 orc_union16 var49;
2911 orc_union16 var50;
2912 orc_union16 var51;
2913 orc_union16 var52;
2914 orc_union16 var53;
2915 orc_union32 var54;
2916 orc_union32 var55;
2917
2918 ptr0 = (orc_union64 *) d1;
2919 ptr4 = (orc_union16 *) s1;
2920 ptr5 = (orc_union16 *) s2;
2921 ptr6 = (orc_union16 *) s3;
2922 ptr7 = (orc_union16 *) s4;
2923 ptr8 = (orc_union16 *) s5;
2924 ptr9 = (orc_union16 *) s6;
2925
2926 /* 9: loadpw */
2927 var42.i = 0x000000ff; /* 255 or 1.25987e-321f */
2928 /* 11: loadpw */
2929 var43.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
2930 /* 14: loadpb */
2931 var44.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
2932 var44.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
2933
2934 for (i = 0; i < n; i++) {
2935 /* 0: loadw */
2936 var37 = ptr5[i];
2937 /* 1: loadw */
2938 var38 = ptr9[i];
2939 /* 2: avgub */
2940 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
2941 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
2942 /* 3: loadw */
2943 var39 = ptr4[i];
2944 /* 4: loadw */
2945 var40 = ptr8[i];
2946 /* 5: avgub */
2947 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
2948 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
2949 /* 6: loadw */
2950 var41 = ptr7[i];
2951 /* 7: copyw */
2952 var49.i = var41.i;
2953 /* 8: avgub */
2954 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
2955 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
2956 /* 10: andw */
2957 var51.i = var50.i & var42.i;
2958 /* 12: andw */
2959 var52.i = var49.i & var43.i;
2960 /* 13: orw */
2961 var53.i = var52.i | var51.i;
2962 /* 15: mergebw */
2963 {
2964 orc_union16 _dest;
2965 _dest.x2[0] = var44.x2[0];
2966 _dest.x2[1] = var47.x2[0];
2967 var54.x2[0] = _dest.i;
2968 }
2969 {
2970 orc_union16 _dest;
2971 _dest.x2[0] = var44.x2[1];
2972 _dest.x2[1] = var47.x2[1];
2973 var54.x2[1] = _dest.i;
2974 }
2975 /* 16: loadw */
2976 var45 = ptr6[i];
2977 /* 17: mergebw */
2978 {
2979 orc_union16 _dest;
2980 _dest.x2[0] = var53.x2[0];
2981 _dest.x2[1] = var45.x2[0];
2982 var55.x2[0] = _dest.i;
2983 }
2984 {
2985 orc_union16 _dest;
2986 _dest.x2[0] = var53.x2[1];
2987 _dest.x2[1] = var45.x2[1];
2988 var55.x2[1] = _dest.i;
2989 }
2990 /* 18: mergewl */
2991 {
2992 orc_union32 _dest;
2993 _dest.x2[0] = var54.x2[0];
2994 _dest.x2[1] = var55.x2[0];
2995 var46.x2[0] = _dest.i;
2996 }
2997 {
2998 orc_union32 _dest;
2999 _dest.x2[0] = var54.x2[1];
3000 _dest.x2[1] = var55.x2[1];
3001 var46.x2[1] = _dest.i;
3002 }
3003 /* 19: storeq */
3004 ptr0[i] = var46;
3005 }
3006
3007 }
3008
3009 #else
3010 static void
_backup_bayer_orc_merge_bg_argb(OrcExecutor * ORC_RESTRICT ex)3011 _backup_bayer_orc_merge_bg_argb (OrcExecutor * ORC_RESTRICT ex)
3012 {
3013 int i;
3014 int n = ex->n;
3015 orc_union64 *ORC_RESTRICT ptr0;
3016 const orc_union16 *ORC_RESTRICT ptr4;
3017 const orc_union16 *ORC_RESTRICT ptr5;
3018 const orc_union16 *ORC_RESTRICT ptr6;
3019 const orc_union16 *ORC_RESTRICT ptr7;
3020 const orc_union16 *ORC_RESTRICT ptr8;
3021 const orc_union16 *ORC_RESTRICT ptr9;
3022 orc_union16 var37;
3023 orc_union16 var38;
3024 orc_union16 var39;
3025 orc_union16 var40;
3026 orc_union16 var41;
3027 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
3028 volatile orc_union16 var42;
3029 #else
3030 orc_union16 var42;
3031 #endif
3032 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
3033 volatile orc_union16 var43;
3034 #else
3035 orc_union16 var43;
3036 #endif
3037 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
3038 volatile orc_union16 var44;
3039 #else
3040 orc_union16 var44;
3041 #endif
3042 orc_union16 var45;
3043 orc_union64 var46;
3044 orc_union16 var47;
3045 orc_union16 var48;
3046 orc_union16 var49;
3047 orc_union16 var50;
3048 orc_union16 var51;
3049 orc_union16 var52;
3050 orc_union16 var53;
3051 orc_union32 var54;
3052 orc_union32 var55;
3053
3054 ptr0 = (orc_union64 *) ex->arrays[0];
3055 ptr4 = (orc_union16 *) ex->arrays[4];
3056 ptr5 = (orc_union16 *) ex->arrays[5];
3057 ptr6 = (orc_union16 *) ex->arrays[6];
3058 ptr7 = (orc_union16 *) ex->arrays[7];
3059 ptr8 = (orc_union16 *) ex->arrays[8];
3060 ptr9 = (orc_union16 *) ex->arrays[9];
3061
3062 /* 9: loadpw */
3063 var42.i = 0x000000ff; /* 255 or 1.25987e-321f */
3064 /* 11: loadpw */
3065 var43.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
3066 /* 14: loadpb */
3067 var44.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
3068 var44.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
3069
3070 for (i = 0; i < n; i++) {
3071 /* 0: loadw */
3072 var37 = ptr5[i];
3073 /* 1: loadw */
3074 var38 = ptr9[i];
3075 /* 2: avgub */
3076 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
3077 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
3078 /* 3: loadw */
3079 var39 = ptr4[i];
3080 /* 4: loadw */
3081 var40 = ptr8[i];
3082 /* 5: avgub */
3083 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
3084 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
3085 /* 6: loadw */
3086 var41 = ptr7[i];
3087 /* 7: copyw */
3088 var49.i = var41.i;
3089 /* 8: avgub */
3090 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
3091 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
3092 /* 10: andw */
3093 var51.i = var50.i & var42.i;
3094 /* 12: andw */
3095 var52.i = var49.i & var43.i;
3096 /* 13: orw */
3097 var53.i = var52.i | var51.i;
3098 /* 15: mergebw */
3099 {
3100 orc_union16 _dest;
3101 _dest.x2[0] = var44.x2[0];
3102 _dest.x2[1] = var47.x2[0];
3103 var54.x2[0] = _dest.i;
3104 }
3105 {
3106 orc_union16 _dest;
3107 _dest.x2[0] = var44.x2[1];
3108 _dest.x2[1] = var47.x2[1];
3109 var54.x2[1] = _dest.i;
3110 }
3111 /* 16: loadw */
3112 var45 = ptr6[i];
3113 /* 17: mergebw */
3114 {
3115 orc_union16 _dest;
3116 _dest.x2[0] = var53.x2[0];
3117 _dest.x2[1] = var45.x2[0];
3118 var55.x2[0] = _dest.i;
3119 }
3120 {
3121 orc_union16 _dest;
3122 _dest.x2[0] = var53.x2[1];
3123 _dest.x2[1] = var45.x2[1];
3124 var55.x2[1] = _dest.i;
3125 }
3126 /* 18: mergewl */
3127 {
3128 orc_union32 _dest;
3129 _dest.x2[0] = var54.x2[0];
3130 _dest.x2[1] = var55.x2[0];
3131 var46.x2[0] = _dest.i;
3132 }
3133 {
3134 orc_union32 _dest;
3135 _dest.x2[0] = var54.x2[1];
3136 _dest.x2[1] = var55.x2[1];
3137 var46.x2[1] = _dest.i;
3138 }
3139 /* 19: storeq */
3140 ptr0[i] = var46;
3141 }
3142
3143 }
3144
3145 void
bayer_orc_merge_bg_argb(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)3146 bayer_orc_merge_bg_argb (guint8 * ORC_RESTRICT d1,
3147 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
3148 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
3149 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
3150 {
3151 OrcExecutor _ex, *ex = &_ex;
3152 static volatile int p_inited = 0;
3153 static OrcCode *c = 0;
3154 void (*func) (OrcExecutor *);
3155
3156 if (!p_inited) {
3157 orc_once_mutex_lock ();
3158 if (!p_inited) {
3159 OrcProgram *p;
3160
3161 #if 1
3162 static const orc_uint8 bc[] = {
3163 1, 9, 23, 98, 97, 121, 101, 114, 95, 111, 114, 99, 95, 109, 101, 114,
3164 103, 101, 95, 98, 103, 95, 97, 114, 103, 98, 11, 8, 8, 12, 2, 2,
3165 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 14,
3166 2, 255, 0, 0, 0, 14, 2, 0, 255, 0, 0, 14, 1, 255, 0, 0,
3167 0, 20, 4, 20, 4, 20, 2, 20, 2, 20, 2, 21, 1, 39, 34, 5,
3168 9, 21, 1, 39, 35, 4, 8, 79, 36, 7, 21, 1, 39, 35, 35, 36,
3169 73, 35, 35, 16, 73, 36, 36, 17, 92, 35, 36, 35, 21, 1, 196, 32,
3170 18, 34, 21, 1, 196, 33, 35, 6, 21, 1, 195, 0, 32, 33, 2, 0,
3171
3172 };
3173 p = orc_program_new_from_static_bytecode (bc);
3174 orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_argb);
3175 #else
3176 p = orc_program_new ();
3177 orc_program_set_name (p, "bayer_orc_merge_bg_argb");
3178 orc_program_set_backup_function (p, _backup_bayer_orc_merge_bg_argb);
3179 orc_program_add_destination (p, 8, "d1");
3180 orc_program_add_source (p, 2, "s1");
3181 orc_program_add_source (p, 2, "s2");
3182 orc_program_add_source (p, 2, "s3");
3183 orc_program_add_source (p, 2, "s4");
3184 orc_program_add_source (p, 2, "s5");
3185 orc_program_add_source (p, 2, "s6");
3186 orc_program_add_constant (p, 2, 0x000000ff, "c1");
3187 orc_program_add_constant (p, 2, 0x0000ff00, "c2");
3188 orc_program_add_constant (p, 1, 0x000000ff, "c3");
3189 orc_program_add_temporary (p, 4, "t1");
3190 orc_program_add_temporary (p, 4, "t2");
3191 orc_program_add_temporary (p, 2, "t3");
3192 orc_program_add_temporary (p, 2, "t4");
3193 orc_program_add_temporary (p, 2, "t5");
3194
3195 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S2, ORC_VAR_S6,
3196 ORC_VAR_D1);
3197 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S1, ORC_VAR_S5,
3198 ORC_VAR_D1);
3199 orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S4, ORC_VAR_D1,
3200 ORC_VAR_D1);
3201 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5,
3202 ORC_VAR_D1);
3203 orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1,
3204 ORC_VAR_D1);
3205 orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2,
3206 ORC_VAR_D1);
3207 orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4,
3208 ORC_VAR_D1);
3209 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C3, ORC_VAR_T3,
3210 ORC_VAR_D1);
3211 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_S3,
3212 ORC_VAR_D1);
3213 orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
3214 ORC_VAR_D1);
3215 #endif
3216
3217 orc_program_compile (p);
3218 c = orc_program_take_code (p);
3219 orc_program_free (p);
3220 }
3221 p_inited = TRUE;
3222 orc_once_mutex_unlock ();
3223 }
3224 ex->arrays[ORC_VAR_A2] = c;
3225 ex->program = 0;
3226
3227 ex->n = n;
3228 ex->arrays[ORC_VAR_D1] = d1;
3229 ex->arrays[ORC_VAR_S1] = (void *) s1;
3230 ex->arrays[ORC_VAR_S2] = (void *) s2;
3231 ex->arrays[ORC_VAR_S3] = (void *) s3;
3232 ex->arrays[ORC_VAR_S4] = (void *) s4;
3233 ex->arrays[ORC_VAR_S5] = (void *) s5;
3234 ex->arrays[ORC_VAR_S6] = (void *) s6;
3235
3236 func = c->exec;
3237 func (ex);
3238 }
3239 #endif
3240
3241
3242 /* bayer_orc_merge_gr_argb */
3243 #ifdef DISABLE_ORC
3244 void
bayer_orc_merge_gr_argb(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)3245 bayer_orc_merge_gr_argb (guint8 * ORC_RESTRICT d1,
3246 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
3247 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
3248 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
3249 {
3250 int i;
3251 orc_union64 *ORC_RESTRICT ptr0;
3252 const orc_union16 *ORC_RESTRICT ptr4;
3253 const orc_union16 *ORC_RESTRICT ptr5;
3254 const orc_union16 *ORC_RESTRICT ptr6;
3255 const orc_union16 *ORC_RESTRICT ptr7;
3256 const orc_union16 *ORC_RESTRICT ptr8;
3257 const orc_union16 *ORC_RESTRICT ptr9;
3258 orc_union16 var37;
3259 orc_union16 var38;
3260 orc_union16 var39;
3261 orc_union16 var40;
3262 orc_union16 var41;
3263 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
3264 volatile orc_union16 var42;
3265 #else
3266 orc_union16 var42;
3267 #endif
3268 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
3269 volatile orc_union16 var43;
3270 #else
3271 orc_union16 var43;
3272 #endif
3273 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
3274 volatile orc_union16 var44;
3275 #else
3276 orc_union16 var44;
3277 #endif
3278 orc_union16 var45;
3279 orc_union64 var46;
3280 orc_union16 var47;
3281 orc_union16 var48;
3282 orc_union16 var49;
3283 orc_union16 var50;
3284 orc_union16 var51;
3285 orc_union16 var52;
3286 orc_union16 var53;
3287 orc_union32 var54;
3288 orc_union32 var55;
3289
3290 ptr0 = (orc_union64 *) d1;
3291 ptr4 = (orc_union16 *) s1;
3292 ptr5 = (orc_union16 *) s2;
3293 ptr6 = (orc_union16 *) s3;
3294 ptr7 = (orc_union16 *) s4;
3295 ptr8 = (orc_union16 *) s5;
3296 ptr9 = (orc_union16 *) s6;
3297
3298 /* 9: loadpw */
3299 var42.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
3300 /* 11: loadpw */
3301 var43.i = 0x000000ff; /* 255 or 1.25987e-321f */
3302 /* 14: loadpb */
3303 var44.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
3304 var44.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
3305
3306 for (i = 0; i < n; i++) {
3307 /* 0: loadw */
3308 var37 = ptr4[i];
3309 /* 1: loadw */
3310 var38 = ptr8[i];
3311 /* 2: avgub */
3312 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
3313 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
3314 /* 3: loadw */
3315 var39 = ptr5[i];
3316 /* 4: loadw */
3317 var40 = ptr9[i];
3318 /* 5: avgub */
3319 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
3320 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
3321 /* 6: loadw */
3322 var41 = ptr6[i];
3323 /* 7: copyw */
3324 var49.i = var41.i;
3325 /* 8: avgub */
3326 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
3327 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
3328 /* 10: andw */
3329 var51.i = var50.i & var42.i;
3330 /* 12: andw */
3331 var52.i = var49.i & var43.i;
3332 /* 13: orw */
3333 var53.i = var52.i | var51.i;
3334 /* 15: loadw */
3335 var45 = ptr7[i];
3336 /* 16: mergebw */
3337 {
3338 orc_union16 _dest;
3339 _dest.x2[0] = var44.x2[0];
3340 _dest.x2[1] = var45.x2[0];
3341 var54.x2[0] = _dest.i;
3342 }
3343 {
3344 orc_union16 _dest;
3345 _dest.x2[0] = var44.x2[1];
3346 _dest.x2[1] = var45.x2[1];
3347 var54.x2[1] = _dest.i;
3348 }
3349 /* 17: mergebw */
3350 {
3351 orc_union16 _dest;
3352 _dest.x2[0] = var53.x2[0];
3353 _dest.x2[1] = var47.x2[0];
3354 var55.x2[0] = _dest.i;
3355 }
3356 {
3357 orc_union16 _dest;
3358 _dest.x2[0] = var53.x2[1];
3359 _dest.x2[1] = var47.x2[1];
3360 var55.x2[1] = _dest.i;
3361 }
3362 /* 18: mergewl */
3363 {
3364 orc_union32 _dest;
3365 _dest.x2[0] = var54.x2[0];
3366 _dest.x2[1] = var55.x2[0];
3367 var46.x2[0] = _dest.i;
3368 }
3369 {
3370 orc_union32 _dest;
3371 _dest.x2[0] = var54.x2[1];
3372 _dest.x2[1] = var55.x2[1];
3373 var46.x2[1] = _dest.i;
3374 }
3375 /* 19: storeq */
3376 ptr0[i] = var46;
3377 }
3378
3379 }
3380
3381 #else
3382 static void
_backup_bayer_orc_merge_gr_argb(OrcExecutor * ORC_RESTRICT ex)3383 _backup_bayer_orc_merge_gr_argb (OrcExecutor * ORC_RESTRICT ex)
3384 {
3385 int i;
3386 int n = ex->n;
3387 orc_union64 *ORC_RESTRICT ptr0;
3388 const orc_union16 *ORC_RESTRICT ptr4;
3389 const orc_union16 *ORC_RESTRICT ptr5;
3390 const orc_union16 *ORC_RESTRICT ptr6;
3391 const orc_union16 *ORC_RESTRICT ptr7;
3392 const orc_union16 *ORC_RESTRICT ptr8;
3393 const orc_union16 *ORC_RESTRICT ptr9;
3394 orc_union16 var37;
3395 orc_union16 var38;
3396 orc_union16 var39;
3397 orc_union16 var40;
3398 orc_union16 var41;
3399 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
3400 volatile orc_union16 var42;
3401 #else
3402 orc_union16 var42;
3403 #endif
3404 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
3405 volatile orc_union16 var43;
3406 #else
3407 orc_union16 var43;
3408 #endif
3409 #if defined(__APPLE__) && __GNUC__ == 4 && __GNUC_MINOR__ == 2 && defined (__i386__)
3410 volatile orc_union16 var44;
3411 #else
3412 orc_union16 var44;
3413 #endif
3414 orc_union16 var45;
3415 orc_union64 var46;
3416 orc_union16 var47;
3417 orc_union16 var48;
3418 orc_union16 var49;
3419 orc_union16 var50;
3420 orc_union16 var51;
3421 orc_union16 var52;
3422 orc_union16 var53;
3423 orc_union32 var54;
3424 orc_union32 var55;
3425
3426 ptr0 = (orc_union64 *) ex->arrays[0];
3427 ptr4 = (orc_union16 *) ex->arrays[4];
3428 ptr5 = (orc_union16 *) ex->arrays[5];
3429 ptr6 = (orc_union16 *) ex->arrays[6];
3430 ptr7 = (orc_union16 *) ex->arrays[7];
3431 ptr8 = (orc_union16 *) ex->arrays[8];
3432 ptr9 = (orc_union16 *) ex->arrays[9];
3433
3434 /* 9: loadpw */
3435 var42.i = 0x0000ff00; /* 65280 or 3.22526e-319f */
3436 /* 11: loadpw */
3437 var43.i = 0x000000ff; /* 255 or 1.25987e-321f */
3438 /* 14: loadpb */
3439 var44.x2[0] = 0x000000ff; /* 255 or 1.25987e-321f */
3440 var44.x2[1] = 0x000000ff; /* 255 or 1.25987e-321f */
3441
3442 for (i = 0; i < n; i++) {
3443 /* 0: loadw */
3444 var37 = ptr4[i];
3445 /* 1: loadw */
3446 var38 = ptr8[i];
3447 /* 2: avgub */
3448 var47.x2[0] = ((orc_uint8) var37.x2[0] + (orc_uint8) var38.x2[0] + 1) >> 1;
3449 var47.x2[1] = ((orc_uint8) var37.x2[1] + (orc_uint8) var38.x2[1] + 1) >> 1;
3450 /* 3: loadw */
3451 var39 = ptr5[i];
3452 /* 4: loadw */
3453 var40 = ptr9[i];
3454 /* 5: avgub */
3455 var48.x2[0] = ((orc_uint8) var39.x2[0] + (orc_uint8) var40.x2[0] + 1) >> 1;
3456 var48.x2[1] = ((orc_uint8) var39.x2[1] + (orc_uint8) var40.x2[1] + 1) >> 1;
3457 /* 6: loadw */
3458 var41 = ptr6[i];
3459 /* 7: copyw */
3460 var49.i = var41.i;
3461 /* 8: avgub */
3462 var50.x2[0] = ((orc_uint8) var48.x2[0] + (orc_uint8) var49.x2[0] + 1) >> 1;
3463 var50.x2[1] = ((orc_uint8) var48.x2[1] + (orc_uint8) var49.x2[1] + 1) >> 1;
3464 /* 10: andw */
3465 var51.i = var50.i & var42.i;
3466 /* 12: andw */
3467 var52.i = var49.i & var43.i;
3468 /* 13: orw */
3469 var53.i = var52.i | var51.i;
3470 /* 15: loadw */
3471 var45 = ptr7[i];
3472 /* 16: mergebw */
3473 {
3474 orc_union16 _dest;
3475 _dest.x2[0] = var44.x2[0];
3476 _dest.x2[1] = var45.x2[0];
3477 var54.x2[0] = _dest.i;
3478 }
3479 {
3480 orc_union16 _dest;
3481 _dest.x2[0] = var44.x2[1];
3482 _dest.x2[1] = var45.x2[1];
3483 var54.x2[1] = _dest.i;
3484 }
3485 /* 17: mergebw */
3486 {
3487 orc_union16 _dest;
3488 _dest.x2[0] = var53.x2[0];
3489 _dest.x2[1] = var47.x2[0];
3490 var55.x2[0] = _dest.i;
3491 }
3492 {
3493 orc_union16 _dest;
3494 _dest.x2[0] = var53.x2[1];
3495 _dest.x2[1] = var47.x2[1];
3496 var55.x2[1] = _dest.i;
3497 }
3498 /* 18: mergewl */
3499 {
3500 orc_union32 _dest;
3501 _dest.x2[0] = var54.x2[0];
3502 _dest.x2[1] = var55.x2[0];
3503 var46.x2[0] = _dest.i;
3504 }
3505 {
3506 orc_union32 _dest;
3507 _dest.x2[0] = var54.x2[1];
3508 _dest.x2[1] = var55.x2[1];
3509 var46.x2[1] = _dest.i;
3510 }
3511 /* 19: storeq */
3512 ptr0[i] = var46;
3513 }
3514
3515 }
3516
3517 void
bayer_orc_merge_gr_argb(guint8 * ORC_RESTRICT d1,const guint8 * ORC_RESTRICT s1,const guint8 * ORC_RESTRICT s2,const guint8 * ORC_RESTRICT s3,const guint8 * ORC_RESTRICT s4,const guint8 * ORC_RESTRICT s5,const guint8 * ORC_RESTRICT s6,int n)3518 bayer_orc_merge_gr_argb (guint8 * ORC_RESTRICT d1,
3519 const guint8 * ORC_RESTRICT s1, const guint8 * ORC_RESTRICT s2,
3520 const guint8 * ORC_RESTRICT s3, const guint8 * ORC_RESTRICT s4,
3521 const guint8 * ORC_RESTRICT s5, const guint8 * ORC_RESTRICT s6, int n)
3522 {
3523 OrcExecutor _ex, *ex = &_ex;
3524 static volatile int p_inited = 0;
3525 static OrcCode *c = 0;
3526 void (*func) (OrcExecutor *);
3527
3528 if (!p_inited) {
3529 orc_once_mutex_lock ();
3530 if (!p_inited) {
3531 OrcProgram *p;
3532
3533 #if 1
3534 static const orc_uint8 bc[] = {
3535 1, 9, 23, 98, 97, 121, 101, 114, 95, 111, 114, 99, 95, 109, 101, 114,
3536 103, 101, 95, 103, 114, 95, 97, 114, 103, 98, 11, 8, 8, 12, 2, 2,
3537 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 12, 2, 2, 14,
3538 2, 0, 255, 0, 0, 14, 2, 255, 0, 0, 0, 14, 1, 255, 0, 0,
3539 0, 20, 4, 20, 4, 20, 2, 20, 2, 20, 2, 21, 1, 39, 34, 4,
3540 8, 21, 1, 39, 35, 5, 9, 79, 36, 6, 21, 1, 39, 35, 35, 36,
3541 73, 35, 35, 16, 73, 36, 36, 17, 92, 35, 36, 35, 21, 1, 196, 32,
3542 18, 7, 21, 1, 196, 33, 35, 34, 21, 1, 195, 0, 32, 33, 2, 0,
3543
3544 };
3545 p = orc_program_new_from_static_bytecode (bc);
3546 orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_argb);
3547 #else
3548 p = orc_program_new ();
3549 orc_program_set_name (p, "bayer_orc_merge_gr_argb");
3550 orc_program_set_backup_function (p, _backup_bayer_orc_merge_gr_argb);
3551 orc_program_add_destination (p, 8, "d1");
3552 orc_program_add_source (p, 2, "s1");
3553 orc_program_add_source (p, 2, "s2");
3554 orc_program_add_source (p, 2, "s3");
3555 orc_program_add_source (p, 2, "s4");
3556 orc_program_add_source (p, 2, "s5");
3557 orc_program_add_source (p, 2, "s6");
3558 orc_program_add_constant (p, 2, 0x0000ff00, "c1");
3559 orc_program_add_constant (p, 2, 0x000000ff, "c2");
3560 orc_program_add_constant (p, 1, 0x000000ff, "c3");
3561 orc_program_add_temporary (p, 4, "t1");
3562 orc_program_add_temporary (p, 4, "t2");
3563 orc_program_add_temporary (p, 2, "t3");
3564 orc_program_add_temporary (p, 2, "t4");
3565 orc_program_add_temporary (p, 2, "t5");
3566
3567 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T3, ORC_VAR_S1, ORC_VAR_S5,
3568 ORC_VAR_D1);
3569 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_S2, ORC_VAR_S6,
3570 ORC_VAR_D1);
3571 orc_program_append_2 (p, "copyw", 0, ORC_VAR_T5, ORC_VAR_S3, ORC_VAR_D1,
3572 ORC_VAR_D1);
3573 orc_program_append_2 (p, "avgub", 1, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_T5,
3574 ORC_VAR_D1);
3575 orc_program_append_2 (p, "andw", 0, ORC_VAR_T4, ORC_VAR_T4, ORC_VAR_C1,
3576 ORC_VAR_D1);
3577 orc_program_append_2 (p, "andw", 0, ORC_VAR_T5, ORC_VAR_T5, ORC_VAR_C2,
3578 ORC_VAR_D1);
3579 orc_program_append_2 (p, "orw", 0, ORC_VAR_T4, ORC_VAR_T5, ORC_VAR_T4,
3580 ORC_VAR_D1);
3581 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T1, ORC_VAR_C3, ORC_VAR_S4,
3582 ORC_VAR_D1);
3583 orc_program_append_2 (p, "mergebw", 1, ORC_VAR_T2, ORC_VAR_T4, ORC_VAR_T3,
3584 ORC_VAR_D1);
3585 orc_program_append_2 (p, "mergewl", 1, ORC_VAR_D1, ORC_VAR_T1, ORC_VAR_T2,
3586 ORC_VAR_D1);
3587 #endif
3588
3589 orc_program_compile (p);
3590 c = orc_program_take_code (p);
3591 orc_program_free (p);
3592 }
3593 p_inited = TRUE;
3594 orc_once_mutex_unlock ();
3595 }
3596 ex->arrays[ORC_VAR_A2] = c;
3597 ex->program = 0;
3598
3599 ex->n = n;
3600 ex->arrays[ORC_VAR_D1] = d1;
3601 ex->arrays[ORC_VAR_S1] = (void *) s1;
3602 ex->arrays[ORC_VAR_S2] = (void *) s2;
3603 ex->arrays[ORC_VAR_S3] = (void *) s3;
3604 ex->arrays[ORC_VAR_S4] = (void *) s4;
3605 ex->arrays[ORC_VAR_S5] = (void *) s5;
3606 ex->arrays[ORC_VAR_S6] = (void *) s6;
3607
3608 func = c->exec;
3609 func (ex);
3610 }
3611 #endif
3612