1 #ifndef __BLEND
2 #define __BLEND 1
3 
4 #include "colormod.h"
5 
6 #ifndef WORDS_BIGENDIAN
7 
8 #define A_VAL(p) ((DATA8 *)(p))[3]
9 #define R_VAL(p) ((DATA8 *)(p))[2]
10 #define G_VAL(p) ((DATA8 *)(p))[1]
11 #define B_VAL(p) ((DATA8 *)(p))[0]
12 
13 #else
14 
15 #define A_VAL(p) ((DATA8 *)(p))[0]
16 #define R_VAL(p) ((DATA8 *)(p))[1]
17 #define G_VAL(p) ((DATA8 *)(p))[2]
18 #define B_VAL(p) ((DATA8 *)(p))[3]
19 
20 #endif
21 
22 #define INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
23    ((x < (xx + ww)) && \
24        (y < (yy + hh)) && \
25        ((x + w) > xx) && \
26        ((y + h) > yy))
27 
28 #define CLIP_TO(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \
29 { \
30 if (INTERSECTS(_x, _y, _w, _h, _cx, _cy, _cw, _ch)) \
31    { \
32          if (_x < _cx) \
33 	{ \
34 	           _w += _x - _cx; \
35 	           _x = _cx; \
36 	           if (_w < 0) _w = 0; \
37 	} \
38          if ((_x + _w) > (_cx + _cw)) \
39 	     _w = _cx + _cw - _x; \
40          if (_y < _cy) \
41 	{ \
42 	           _h += _y - _cy; \
43 	           _y = _cy; \
44 	           if (_h < 0) _h = 0; \
45 	} \
46          if ((_y + _h) > (_cy + _ch)) \
47 	     _h = _cy + _ch - _y; \
48    } \
49 else \
50    { \
51       _w = 0; _h = 0; \
52    } \
53 }
54 
55 /*
56  * 1) Basic Saturation - 8 bit unsigned
57  *
58  * The add, subtract, and reshade operations generate new color values that may
59  * be out of range for an unsigned 8 bit quantity.  Therefore, we will want to
60  * saturate the values into the range [0, 255].  Any value < 0 will become 0,
61  * and any value > 255 will become 255.  Or simply:
62  *
63  *   saturated = (value < 0) ? 0 : ((value > 255) ? 255 : value)
64  *
65  * Of course the above isn't the most efficient means of saturating.  Sometimes
66  * due to the nature of a calculation, we know we only need to saturate from
67  * above (> 255) or just from below (< 0).  Or simply:
68  *
69  *   saturated = (value < 0)   ?   0 : value
70  *   saturated = (value > 255) ? 255 : value
71  *
72  * 2) Alternate Forms of Saturation
73  *
74  * The methods of saturation described above use testing/branching operations,
75  * which are not necessarily efficient on all platforms.  There are other means
76  * of performing saturation using just simple arithmetic operations
77  * (+, -, >>, <<, ~).  A discussion of these saturation techniques follows.
78  *
79  * A) Saturation in the range [0, 512), or "from above".
80  *
81  * Assuming we have an integral value in the range [0, 512), the following
82  * formula evaluates to either 0, or 255:
83  *
84  *    (value & 255) - ((value & 256) >> 8)
85  *
86  * This is easy to show.  Notice that if the value is in the range [0, 256)
87  * the 9th bit is 0, and we get (0 - 0), which is 0.   And if the value is in
88  * the range [256, 512) the 9th bit is 1, and we get (256 - 1), which is 255.
89  *
90  * Now, using the above information and the fact that assigning an integer to
91  * an 8 bit unsigned value will truncate to the lower 8 bits of the integer,
92  * the following properly saturates:
93  *
94  *    8bit_value = value | (value & 256) - ((value & 256) >> 8)
95  *
96  * To prove this to yourself, just think about what the lower 8 bits look like
97  * in the ranges [0, 256) and [256, 512).  In particular, notice that the value
98  * in the range [0, 256) are unchanged, and values in the range [256, 512)
99  * always give you 255.  Just what we want!
100  *
101  * B) Saturation in the range (-256, 256), or "from below".
102  *
103  * Assuming we have an integral value in the range (-256, 256), the following
104  * formula evaluates to either 0, or -1:
105  *
106  *   ~(value >> 8)
107  *
108  * Here's why.  If the value is in the range [0, 256), then shifting right by
109  * 8 bits gives us all 0 bits, or 0.  And thus inverting the bits gives all
110  * 1 bits, which is -1.  If the value is in the range (-256, 0), then the 9th
111  * bit and higher bits are all 1.  So, when we shift right by 8 bits (with
112  * signed extension), we get a value with all 1 bits.  Which when inverted is
113  * all 0 bits, or 0.
114  *
115  * Now, using the above information the following properly saturates:
116  *
117  *    8bit_value = value & (~(value >> 8))
118  *
119  * To prove this to yourself, noticed that values in the range (-256, 0) will
120  * always be AND'd with 0, and thus map to 0.   Further, values in the range
121  * [0, 256) will always be AND'd with a value that is all 1 bits, and thus
122  * be unchanged.  Just what we want!
123  *
124  * C) Saturation in the range (-256, 512), or "from above and below".
125  *
126  * The short of it is the following works:
127  *
128  *    8bit_value = (tmp | ((tmp & 256) - ((tmp & 256) >> 8))) & (~(tmp >> 9))
129  *
130  * We leave it to the reader to prove.  Looks very similar to the techniques
131  * used above, eh? :)
132  */
133 
134 /* Saturate values in the range [0, 512) */
135 #define SATURATE_UPPER(nc, v) \
136    tmp = (v);                 \
137    nc = (tmp | (-(tmp >> 8)));
138 
139 /* Saturate values in the range (-256, 256) */
140 #define SATURATE_LOWER(nc, v) \
141    tmp = (v);                 \
142    nc = tmp & (~(tmp >> 8));
143 
144 /* Saturate values in the range (-256, 512) */
145 #define SATURATE_BOTH(nc, v) \
146    tmp = (v);                \
147    nc = (tmp | (-(tmp >> 8))) & (~(tmp >> 9));
148 
149 /*
150  * 1) Operations
151  *
152  * There are 4 operations supported:
153  *
154  *    Copy, Add, Subtract, and Reshade
155  *
156  * For each operation there are 3 different variations that can be made:
157  *
158  *   a) Use "blend" or "copy" in the calculations?  A "blend" uses the alpha
159  *      value of the source pixel to lighten the source pixel values.  Where
160  *      as "copy" ignores the alpha value and uses the raw source pixel values.
161  *   b) Include source alpha in the calculation for new destination alpha?
162  *      If source alpha is not used, then destination alpha is preserved.
163  *      If source alpha is used, a "copy" sets the new alpha to the source
164  *      alpha, and a "blend" increases it by a factor given by the product
165  *      of the source alpha with one minus the destination alpha.
166  *   c) Should the source pixels be passed through a color modifier before the
167  *      calculations are performed?
168  *
169  * All together we have 4*2*2*2 = 32 combinations.
170  *
171  * 2) Copy operation
172  *
173  * The "copy" version of this operation copies the source image onto the
174  * destination image.
175  *
176  * The "blend" version of this operation blends the source image color 'c' with
177  * the destination image color 'cc' using 'a' (in the range [0, 1]) according
178  * to the following formula.  Also notice that saturation is not needed for
179  * this calculation, the output is in the range [0, 255]:
180  *
181  *    nc = c * alpha + (1 - alpha) * cc
182  *       = c * alpha - cc * alpha + cc
183  *       = (c - cc) * alpha + cc;
184  *
185  * A discussion of how we're calculating this value follows:
186  *
187  * We're using 'a', an integer, in the range [0, 255] for alpha (and for 'c'
188  * and 'cc', BTW).  Therefore, we need to slightly modify the equation to take
189  * that into account.  To get into the range [0, 255] we need to divide 'a'
190  * by 255:
191  *
192  *    nc = ((c - cc) * a) / 255 + cc
193  *
194  * Notice that it is faster to divide by 256 (bit shifting), however without a
195  * fudge factor 'x' to balance things this isn't horribly accurate.  So, let's
196  * solve for 'x'.  The equality is:
197  *
198  *    ((c - cc) * a) / 256 + cc + x = ((c - cc) * a) / 255 + cc
199  *
200  * The 'cc' terms cancel, and multiply both sides by 255*256 to remove the
201  * fractions:
202  *
203  *    ((c - cc) * a) * 255 + 255 * 256 * x = ((c - cc) * a) * 256
204  *
205  * Get the 'x' term alone:
206  *
207  *    255 * 256 * x = ((c - cc) * a)
208  *
209  * Divide both sides by 255 * 256 to solve for 'x':
210  *
211  *    x = ((c - cc) * a) / (255 * 256)
212  *
213  * And putting 'x' back into the equation we get:
214  *
215  *    nc = ((c - cc) * a) / 256 + cc + ((c - cc) * a) / (255 * 256)
216  *
217  * And if we let 'tmp' represent the value '(c - cc) * a', and do a little
218  * regrouping we get:
219  *
220  *    nc = tmp / 256 + tmp / (255 * 256) + cc
221  *       = (tmp + tmp / 255) / 256 + cc
222  *
223  * We'll be using integer arithmetic, and over the range of values tmp takes
224  * (in [-255*255, 255*255]) the term tmp/(255*256) is pretty much the same as
225  * tmp/(256*256).  So we get:
226  *
227  *    nc = (tmp + tmp / 256) / 256 + cc
228  *
229  * And because the division of the sum uses integer arithmetic, it always
230  * rounds up/down even if that isn't the "best" choice.  If we add .5 to the
231  * sum, we can get standard rounding:  Like so:
232  *
233  *    nc = (tmp + tmp / 256 + 128) / 256 + cc
234  *
235  * 3) Add operation
236  *
237  * The "copy" version of this operation sums the source image pixel values
238  * with the destination image pixel values, saturating at 255 (from above).
239  *
240  * The "blend" version of this operation sums the source image pixel values,
241  * after taking into account alpha transparency (e.g. a percentage), with the
242  * destination image pixel values, saturating at 255 (from above).
243  *
244  * 4) Subtract operation
245  *
246  * This operation is the same as the Add operation, except the source values
247  * are subtracted from the destination values (instead of added).  Further,
248  * the result must be saturated at 0 (from below).
249  *
250  * 5) Reshade operation
251  *
252  * This operation uses the source image color values to lighten/darken color
253  * values in the destination image using the following formula:
254  *
255  *    nc = cc + ((c - middle_value) * 2 * alpha)
256  *
257  * Recall our pixel color and alpha values are in the range [0, 255].  So, the
258  * "blend" version of this operation can be calculated as:
259  *
260  *    nc = cc + ((c - 127) * 2 * (a / 255))
261  *
262  * And in an integer arithmetic friendly form is:
263  *
264  *    nc = cc + (((c - 127) * a) >> 7)
265  *
266  * The "copy" version of this operation treats alpha as 1.0 (or a/255), and in
267  * integer arithmetic friendly form is:
268  *
269  *    nc = cc + ((c - 127) << 1)
270  *
271  * Notice the color values created by this operation are in the range
272  * (-256, 512), and thus must be saturated at 0 and 255 (from above and below).
273  *
274  * For all the operations, when the "blend" version involves computing new
275  * destination alpha values via the use of some source alpha, we have that:
276  *
277  *    nalpha = alpha + ((255 - alpha) * (a / 255))
278  *
279  * We can use the previous argument for approximating division by 255, and
280  * calculate this by:
281  *
282  *    tmp = (255 - alpha) * a;
283  *    nalpha = alpha + ((tmp + (tmp >> 8) + 0x80) >> 8);
284  *
285  * This is again in the range [0, 255], so no saturation is needed.
286  */
287 
288 #define BLEND_COLOR(a, nc, c, cc) \
289 tmp = ((c) - (cc)) * (a); \
290 nc = (cc) + ((tmp + (tmp >> 8) + 0x80) >> 8);
291 
292 #define ADD_COLOR_WITH_ALPHA(a, nc, c, cc) \
293 tmp = (c) * (a); \
294 tmp = (cc) + ((tmp + (tmp >> 8) + 0x80) >> 8); \
295 nc = (tmp | (-(tmp >> 8)));
296 
297 #define ADD_COLOR(nc, c, cc) \
298 tmp = (cc) + (c); \
299 nc = (tmp | (-(tmp >> 8)));
300 
301 #define SUB_COLOR_WITH_ALPHA(a, nc, c, cc) \
302 tmp = (c) * (a); \
303 tmp = (cc) - ((tmp + (tmp >> 8) + 0x80) >> 8); \
304 nc = (tmp & (~(tmp >> 8)));
305 
306 #define SUB_COLOR(nc, c, cc) \
307 tmp = (cc) - (c); \
308 nc = (tmp & (~(tmp >> 8)));
309 
310 #define RESHADE_COLOR_WITH_ALPHA(a, nc, c, cc) \
311 tmp = (cc) + ((((c) - 127) * (a)) >> 7); \
312 nc = (tmp | (-(tmp >> 8))) & (~(tmp >> 9));
313 
314 #define RESHADE_COLOR(nc, c, cc) \
315 tmp = (cc) + (((c) - 127) << 1); \
316 nc = (tmp | (-(tmp >> 8))) & (~(tmp >> 9));
317 
318 extern int          pow_lut_initialized;
319 extern DATA8        pow_lut[256][256];
320 
321 #define BLEND_DST_ALPHA(r1, g1, b1, a1, dest) \
322 { DATA8 _aa; \
323 _aa = pow_lut[a1][A_VAL(dest)]; \
324 BLEND_COLOR(a1, A_VAL(dest), 255, A_VAL(dest)); \
325 BLEND_COLOR(_aa, R_VAL(dest), r1, R_VAL(dest)); \
326 BLEND_COLOR(_aa, G_VAL(dest), g1, G_VAL(dest)); \
327 BLEND_COLOR(_aa, B_VAL(dest), b1, B_VAL(dest)); \
328 }
329 
330 #define BLEND(r1, g1, b1, a1, dest) \
331 BLEND_COLOR(a1, R_VAL(dest), r1, R_VAL(dest)); \
332 BLEND_COLOR(a1, G_VAL(dest), g1, G_VAL(dest)); \
333 BLEND_COLOR(a1, B_VAL(dest), b1, B_VAL(dest));
334 
335 #define BLEND_ADD(r1, g1, b1, a1, dest) \
336 ADD_COLOR_WITH_ALPHA(a1, R_VAL(dest), r1, R_VAL(dest)); \
337 ADD_COLOR_WITH_ALPHA(a1, G_VAL(dest), g1, G_VAL(dest)); \
338 ADD_COLOR_WITH_ALPHA(a1, B_VAL(dest), b1, B_VAL(dest));
339 
340 #define BLEND_SUB(r1, g1, b1, a1, dest) \
341 SUB_COLOR_WITH_ALPHA(a1, R_VAL(dest), r1, R_VAL(dest)); \
342 SUB_COLOR_WITH_ALPHA(a1, G_VAL(dest), g1, G_VAL(dest)); \
343 SUB_COLOR_WITH_ALPHA(a1, B_VAL(dest), b1, B_VAL(dest));
344 
345 #define BLEND_RE(r1, g1, b1, a1, dest) \
346 RESHADE_COLOR_WITH_ALPHA(a1, R_VAL(dest), r1, R_VAL(dest)); \
347 RESHADE_COLOR_WITH_ALPHA(a1, G_VAL(dest), g1, G_VAL(dest)); \
348 RESHADE_COLOR_WITH_ALPHA(a1, B_VAL(dest), b1, B_VAL(dest));
349 
350 enum _imlibop {
351    OP_COPY,
352    OP_ADD,
353    OP_SUBTRACT,
354    OP_RESHADE
355 };
356 
357 typedef enum _imlibop ImlibOp;
358 
359 typedef void        (*ImlibBlendFunction)(DATA32 *, int, DATA32 *, int, int,
360                                           int, ImlibColorModifier *);
361 
362 ImlibBlendFunction  __imlib_GetBlendFunction(ImlibOp op, char merge_alpha,
363                                              char blend, char rgb_src,
364                                              ImlibColorModifier * cm);
365 void                __imlib_BlendImageToImage(ImlibImage * im_src,
366                                               ImlibImage * im_dst, char aa,
367                                               char blend, char merge_alpha,
368                                               int ssx, int ssy,
369                                               int ssw, int ssh,
370                                               int ddx, int ddy,
371                                               int ddw, int ddh,
372                                               ImlibColorModifier * cm,
373                                               ImlibOp op, int clx, int cly,
374                                               int clw, int clh);
375 void                __imlib_BlendRGBAToData(DATA32 * src, int src_w, int src_h,
376                                             DATA32 * dst, int dst_w, int dst_h,
377                                             int sx, int sy, int dx, int dy,
378                                             int w, int h,
379                                             char blend, char merge_alpha,
380                                             ImlibColorModifier * cm, ImlibOp op,
381                                             char rgb_src);
382 void                __imlib_build_pow_lut(void);
383 
384 /* *INDENT-OFF* */
385 #ifdef DO_MMX_ASM
386 void    __imlib_mmx_blend_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
387                                       int w, int h, ImlibColorModifier * cm);
388 void    __imlib_mmx_blend_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
389                                        int w, int h, ImlibColorModifier * cm);
390 void    __imlib_mmx_copy_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
391                                      int w, int h, ImlibColorModifier * cm);
392 void    __imlib_mmx_copy_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
393                                       int w, int h, ImlibColorModifier * cm);
394 void    __imlib_mmx_copy_rgb_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
395                                      int w, int h, ImlibColorModifier * cm);
396 void    __imlib_mmx_add_blend_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
397                                           int w, int h, ImlibColorModifier * cm);
398 void    __imlib_mmx_add_blend_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
399                                            int w, int h, ImlibColorModifier * cm);
400 void    __imlib_mmx_add_copy_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
401                                          int w, int h, ImlibColorModifier * cm);
402 void    __imlib_mmx_add_copy_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
403                                           int w, int h, ImlibColorModifier * cm);
404 void    __imlib_mmx_add_copy_rgb_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
405                                          int w, int h, ImlibColorModifier * cm);
406 void    __imlib_mmx_subtract_blend_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
407                                                int w, int h, ImlibColorModifier * cm);
408 void    __imlib_mmx_subtract_blend_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
409                                                 int w, int h, ImlibColorModifier * cm);
410 void    __imlib_mmx_subtract_copy_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
411                                               int w, int h, ImlibColorModifier * cm);
412 void    __imlib_mmx_subtract_copy_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
413                                                int w, int h, ImlibColorModifier * cm);
414 void    __imlib_mmx_subtract_copy_rgb_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
415                                               int w, int h, ImlibColorModifier * cm);
416 void    __imlib_mmx_reshade_blend_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
417                                               int w, int h, ImlibColorModifier * cm);
418 void    __imlib_mmx_reshade_blend_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
419                                                int w, int h, ImlibColorModifier * cm);
420 void    __imlib_mmx_reshade_copy_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
421                                              int w, int h, ImlibColorModifier * cm);
422 void    __imlib_mmx_reshade_copy_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
423                                                           int w, int h, ImlibColorModifier * cm);
424 void    __imlib_mmx_reshade_copy_rgb_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
425                                                          int w, int h, ImlibColorModifier * cm);
426 
427 void    __imlib_mmx_blend_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
428                                            int w, int h, ImlibColorModifier * cm);
429 void    __imlib_mmx_blend_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
430                                             int w, int h, ImlibColorModifier * cm);
431 void    __imlib_mmx_blend_rgb_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
432                                           int w, int h, ImlibColorModifier * cm);
433 void    __imlib_mmx_blend_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
434                                            int w, int h, ImlibColorModifier * cm);
435 void    __imlib_mmx_copy_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
436                                           int w, int h, ImlibColorModifier * cm);
437 void    __imlib_mmx_copy_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
438                                            int w, int h, ImlibColorModifier * cm);
439 void    __imlib_mmx_copy_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
440                                           int w, int h, ImlibColorModifier * cm);
441 void    __imlib_mmx_add_blend_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
442                                                int w, int h, ImlibColorModifier * cm);
443 void    __imlib_mmx_add_blend_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
444                                                 int w, int h, ImlibColorModifier * cm);
445 void    __imlib_mmx_add_blend_rgb_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
446                                               int w, int h, ImlibColorModifier * cm);
447 void    __imlib_mmx_add_blend_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
448                                                int w, int h, ImlibColorModifier * cm);
449 void    __imlib_mmx_add_copy_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
450                                               int w, int h, ImlibColorModifier * cm);
451 void    __imlib_mmx_add_copy_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
452                                                int w, int h, ImlibColorModifier * cm);
453 void    __imlib_mmx_add_copy_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
454                                               int w, int h, ImlibColorModifier * cm);
455 void    __imlib_mmx_subtract_blend_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
456                                                     int w, int h, ImlibColorModifier * cm);
457 void    __imlib_mmx_subtract_blend_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
458                                                      int w, int h, ImlibColorModifier * cm);
459 void    __imlib_mmx_subtract_blend_rgb_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
460                                                    int w, int h, ImlibColorModifier * cm);
461 void    __imlib_mmx_subtract_blend_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
462                                                     int w, int h, ImlibColorModifier * cm);
463 void    __imlib_mmx_subtract_copy_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
464                                                    int w, int h, ImlibColorModifier * cm);
465 void    __imlib_mmx_subtract_copy_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
466                                                     int w, int h, ImlibColorModifier * cm);
467 void    __imlib_mmx_subtract_copy_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
468                                                    int w, int h, ImlibColorModifier * cm);
469 void    __imlib_mmx_reshade_blend_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
470                                                    int w, int h, ImlibColorModifier * cm);
471 void    __imlib_mmx_reshade_blend_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
472                                                     int w, int h, ImlibColorModifier * cm);
473 void    __imlib_mmx_reshade_blend_rgb_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
474                                                   int w, int h, ImlibColorModifier * cm);
475 void    __imlib_mmx_reshade_blend_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
476                                                    int w, int h, ImlibColorModifier * cm);
477 void    __imlib_mmx_reshade_copy_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
478                                                   int w, int h, ImlibColorModifier * cm);
479 void    __imlib_mmx_reshade_copy_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
480                                                    int w, int h, ImlibColorModifier * cm);
481 void    __imlib_mmx_reshade_copy_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
482                                                   int w, int h, ImlibColorModifier * cm);
483 #elif DO_AMD64_ASM
484 void    __imlib_amd64_blend_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
485                                         int w, int h, ImlibColorModifier * cm);
486 void    __imlib_amd64_blend_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
487                                          int w, int h, ImlibColorModifier * cm);
488 void    __imlib_amd64_copy_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
489                                        int w, int h, ImlibColorModifier * cm);
490 void    __imlib_amd64_copy_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
491                                         int w, int h, ImlibColorModifier * cm);
492 void    __imlib_amd64_copy_rgb_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
493                                        int w, int h, ImlibColorModifier * cm);
494 void    __imlib_amd64_add_blend_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
495                                             int w, int h, ImlibColorModifier * cm);
496 void    __imlib_amd64_add_blend_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
497                                              int w, int h, ImlibColorModifier * cm);
498 void    __imlib_amd64_add_copy_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
499                                            int w, int h, ImlibColorModifier * cm);
500 void    __imlib_amd64_add_copy_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
501                                             int w, int h, ImlibColorModifier * cm);
502 void    __imlib_amd64_add_copy_rgb_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
503                                            int w, int h, ImlibColorModifier * cm);
504 void    __imlib_amd64_subtract_blend_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
505                                                  int w, int h, ImlibColorModifier * cm);
506 void    __imlib_amd64_subtract_blend_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
507                                                   int w, int h, ImlibColorModifier * cm);
508 void    __imlib_amd64_subtract_copy_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
509                                                 int w, int h, ImlibColorModifier * cm);
510 void    __imlib_amd64_subtract_copy_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
511                                                  int w, int h, ImlibColorModifier * cm);
512 void    __imlib_amd64_subtract_copy_rgb_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
513                                                 int w, int h, ImlibColorModifier * cm);
514 void    __imlib_amd64_reshade_blend_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
515                                                 int w, int h, ImlibColorModifier * cm);
516 void    __imlib_amd64_reshade_blend_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
517                                                  int w, int h, ImlibColorModifier * cm);
518 void    __imlib_amd64_reshade_copy_rgba_to_rgb(DATA32 * src, int sw, DATA32 * dst, int dw,
519                                                int w, int h, ImlibColorModifier * cm);
520 void    __imlib_amd64_reshade_copy_rgba_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
521                                                 int w, int h, ImlibColorModifier * cm);
522 void    __imlib_amd64_reshade_copy_rgb_to_rgba(DATA32 * src, int sw, DATA32 * dst, int dw,
523                                                int w, int h, ImlibColorModifier * cm);
524 
525 void    __imlib_amd64_blend_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
526                                              int w, int h, ImlibColorModifier * cm);
527 void    __imlib_amd64_blend_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
528                                               int w, int h, ImlibColorModifier * cm);
529 void    __imlib_amd64_blend_rgb_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
530                                             int w, int h, ImlibColorModifier * cm);
531 void    __imlib_amd64_blend_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
532                                              int w, int h, ImlibColorModifier * cm);
533 void    __imlib_amd64_copy_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
534                                             int w, int h, ImlibColorModifier * cm);
535 void    __imlib_amd64_copy_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
536                                              int w, int h, ImlibColorModifier * cm);
537 void    __imlib_amd64_copy_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
538                                             int w, int h, ImlibColorModifier * cm);
539 void    __imlib_amd64_add_blend_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
540                                                  int w, int h, ImlibColorModifier * cm);
541 void    __imlib_amd64_add_blend_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
542                                                   int w, int h, ImlibColorModifier * cm);
543 void    __imlib_amd64_add_blend_rgb_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
544                                                 int w, int h, ImlibColorModifier * cm);
545 void    __imlib_amd64_add_blend_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
546                                                  int w, int h, ImlibColorModifier * cm);
547 void    __imlib_amd64_add_copy_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
548                                                 int w, int h, ImlibColorModifier * cm);
549 void    __imlib_amd64_add_copy_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
550                                                  int w, int h, ImlibColorModifier * cm);
551 void    __imlib_amd64_add_copy_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
552                                                 int w, int h, ImlibColorModifier * cm);
553 void    __imlib_amd64_subtract_blend_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
554                                                       int w, int h, ImlibColorModifier * cm);
555 void    __imlib_amd64_subtract_blend_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
556                                                        int w, int h, ImlibColorModifier * cm);
557 void    __imlib_amd64_subtract_blend_rgb_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
558                                                      int w, int h, ImlibColorModifier * cm);
559 void    __imlib_amd64_subtract_blend_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
560                                                       int w, int h, ImlibColorModifier * cm);
561 void    __imlib_amd64_subtract_copy_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
562                                                      int w, int h, ImlibColorModifier * cm);
563 void    __imlib_amd64_subtract_copy_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
564                                                       int w, int h, ImlibColorModifier * cm);
565 void    __imlib_amd64_subtract_copy_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
566                                                      int w, int h, ImlibColorModifier * cm);
567 void    __imlib_amd64_reshade_blend_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
568                                                      int w, int h, ImlibColorModifier * cm);
569 void    __imlib_amd64_reshade_blend_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
570                                                       int w, int h, ImlibColorModifier * cm);
571 void    __imlib_amd64_reshade_blend_rgb_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
572                                                     int w, int h, ImlibColorModifier * cm);
573 void    __imlib_amd64_reshade_blend_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
574                                                      int w, int h, ImlibColorModifier * cm);
575 void    __imlib_amd64_reshade_copy_rgba_to_rgb_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
576                                                     int w, int h, ImlibColorModifier * cm);
577 void    __imlib_amd64_reshade_copy_rgba_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
578                                                      int w, int h, ImlibColorModifier * cm);
579 void    __imlib_amd64_reshade_copy_rgb_to_rgba_cmod(DATA32 * src, int sw, DATA32 * dst, int dw,
580                                                     int w, int h, ImlibColorModifier * cm);
581 #endif
582 /* *INDENT-ON* */
583 #endif
584