os/ossrv/genericopenlibs/liboil/src/c/composite_c.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/liboil/src/c/composite_c.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,636 @@
     1.4 +/*
     1.5 + * Copyright (c) 2005
     1.6 + *	Eric Anholt.  All rights reserved.
     1.7 + *
     1.8 + * Redistribution and use in source and binary forms, with or without
     1.9 + * modification, are permitted provided that the following conditions
    1.10 + * are met:
    1.11 + * 1. Redistributions of source code must retain the above copyright
    1.12 + *    notice, this list of conditions and the following disclaimer.
    1.13 + * 2. Redistributions in binary form must reproduce the above copyright
    1.14 + *    notice, this list of conditions and the following disclaimer in the
    1.15 + *    documentation and/or other materials provided with the distribution.
    1.16 + *
    1.17 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
    1.18 + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    1.19 + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
    1.20 + * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE
    1.21 + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
    1.22 + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
    1.23 + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    1.24 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.25 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
    1.26 + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
    1.27 + * SUCH DAMAGE.
    1.28 + */
    1.29 +//Portions Copyright (c)  2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
    1.30 +
    1.31 +#ifdef HAVE_CONFIG_H
    1.32 +#include "config.h"
    1.33 +#endif
    1.34 +#include <liboil/liboilclasses.h>
    1.35 +#include <liboil/liboilfunction.h>
    1.36 +#include "liboil/liboilcolorspace.h"
    1.37 +
    1.38 +#define COMPOSITE_ADD(d,s) oil_clamp_255((d) + (s))
    1.39 +#define COMPOSITE_OVER(d,s,m) ((d) + (s) - oil_muldiv_255((d),(m)))
    1.40 +
    1.41 +static void
    1.42 +composite_in_argb_fast (uint32_t *dest, const uint32_t *src,
    1.43 +    const uint8_t *mask, int n)
    1.44 +{
    1.45 +  for (; n > 0; n--) {
    1.46 +    uint32_t src1, src2;
    1.47 +    uint8_t m = *mask++;
    1.48 +
    1.49 +    /* Split the pixel into two sets of two channels, and multiply by the
    1.50 +     * mask.
    1.51 +     */
    1.52 +    src1 = *src & 0x00ff00ff;
    1.53 +    src1 *= m;
    1.54 +    src1 += 0x00800080;
    1.55 +    src1 += (src1 >> 8) & 0x00ff00ff;
    1.56 +    src1 >>= 8;
    1.57 +    src1 &= 0x00ff00ff;
    1.58 +
    1.59 +    src2 = (*src >> 8) & 0x00ff00ff;
    1.60 +    src2 *= m;
    1.61 +    src2 += 0x00800080;
    1.62 +    src2 += (src2 >> 8) & 0x00ff00ff;
    1.63 +    src2 &= 0xff00ff00;
    1.64 +
    1.65 +    *dest++ = src1 | src2;
    1.66 +    src++;
    1.67 +  }
    1.68 +}
    1.69 +OIL_DEFINE_IMPL (composite_in_argb_fast, composite_in_argb);
    1.70 +
    1.71 +static void
    1.72 +composite_in_argb_const_src_fast (uint32_t *dest, const uint32_t *src,
    1.73 +    const uint8_t *mask, int n)
    1.74 +{
    1.75 +  uint32_t src1, src2;
    1.76 +
    1.77 +  src1 = *src & 0x00ff00ff;
    1.78 +  src2 = (*src >> 8) & 0x00ff00ff;
    1.79 +
    1.80 +  for (; n > 0; n--) {
    1.81 +    uint32_t temp1, temp2;
    1.82 +    uint8_t m = *mask++;
    1.83 +
    1.84 +    /* Split the pixel into two sets of two channels, and multiply by the
    1.85 +     * mask.
    1.86 +     */
    1.87 +    temp1 = src1 * m;
    1.88 +    temp1 += 0x00800080;
    1.89 +    temp1 += (temp1 >> 8) & 0x00ff00ff;
    1.90 +    temp1 >>= 8;
    1.91 +    temp1 &= 0x00ff00ff;
    1.92 +
    1.93 +    temp2 = src2 * m;
    1.94 +    temp2 += 0x00800080;
    1.95 +    temp2 += (temp2 >> 8) & 0x00ff00ff;
    1.96 +    temp2 &= 0xff00ff00;
    1.97 +
    1.98 +    *dest++ = temp1 | temp2;
    1.99 +  }
   1.100 +}
   1.101 +OIL_DEFINE_IMPL (composite_in_argb_const_src_fast, composite_in_argb_const_src);
   1.102 +
   1.103 +static void
   1.104 +composite_in_argb_const_mask_fast (uint32_t *dest, const uint32_t *src,
   1.105 +    const uint8_t *mask, int n)
   1.106 +{
   1.107 +  uint8_t m = *mask;
   1.108 +
   1.109 +  for (; n > 0; n--) {
   1.110 +    uint32_t src1, src2;
   1.111 +
   1.112 +    /* Split the pixel into two sets of two channels, and multiply by the
   1.113 +     * mask.
   1.114 +     */
   1.115 +    src1 = *src & 0x00ff00ff;
   1.116 +    src1 *= m;
   1.117 +    src1 += 0x00800080;
   1.118 +    src1 += (src1 >> 8) & 0x00ff00ff;
   1.119 +    src1 >>= 8;
   1.120 +    src1 &= 0x00ff00ff;
   1.121 +
   1.122 +    src2 = (*src >> 8) & 0x00ff00ff;
   1.123 +    src2 *= m;
   1.124 +    src2 += 0x00800080;
   1.125 +    src2 += (src2 >> 8) & 0x00ff00ff;
   1.126 +    src2 &= 0xff00ff00;
   1.127 +
   1.128 +    *dest++ = src1 | src2;
   1.129 +    src++;
   1.130 +  }
   1.131 +}
   1.132 +OIL_DEFINE_IMPL (composite_in_argb_const_mask_fast,
   1.133 +    composite_in_argb_const_mask);
   1.134 +
   1.135 +static void
   1.136 +composite_over_argb_fast (uint32_t *dest, const uint32_t *src, int n)
   1.137 +{
   1.138 +  for (; n > 0; n--) {
   1.139 +    uint32_t d = *dest, s = *src, sa;
   1.140 +    uint32_t s1, s2, d1, d2;
   1.141 +
   1.142 +    sa = ~s >> 24;
   1.143 +
   1.144 +    s1 = s & 0x00ff00ff;
   1.145 +    d1 = d & 0x00ff00ff;
   1.146 +    d1 *= sa;
   1.147 +    d1 += 0x00800080;
   1.148 +    d1 += (d1 >> 8) & 0x00ff00ff;
   1.149 +    d1 >>= 8;
   1.150 +    d1 &= 0x00ff00ff;
   1.151 +    d1 += s1;
   1.152 +    d1 |= 0x01000100 - ((d1 >> 8) & 0x00ff00ff);
   1.153 +    d1 &= 0x00ff00ff;
   1.154 +
   1.155 +    s2 = (s >> 8) & 0x00ff00ff;
   1.156 +    d2 = (d >> 8) & 0x00ff00ff;
   1.157 +    d2 *= sa;
   1.158 +    d2 += 0x00800080;
   1.159 +    d2 += (d2 >> 8) & 0x00ff00ff;
   1.160 +    d2 >>= 8;
   1.161 +    d2 &= 0x00ff00ff;
   1.162 +    d2 += s2;
   1.163 +    d2 |= 0x01000100 - ((d2 >> 8) & 0x00ff00ff);
   1.164 +    d2 &= 0x00ff00ff;
   1.165 +
   1.166 +    *dest++ = d1 | (d2 << 8);
   1.167 +    src++;
   1.168 +  }
   1.169 +}
   1.170 +OIL_DEFINE_IMPL (composite_over_argb_fast, composite_over_argb);
   1.171 +
   1.172 +static void
   1.173 +composite_over_argb_const_src_fast (uint32_t *dest, const uint32_t *src, int n)
   1.174 +{
   1.175 +  uint32_t s = *src;
   1.176 +  uint32_t sa, s1, s2;
   1.177 +  sa = ~s >> 24;
   1.178 +
   1.179 +  s1 = s & 0x00ff00ff;
   1.180 +  s2 = (s >> 8) & 0x00ff00ff;
   1.181 +
   1.182 +  for (; n > 0; n--) {
   1.183 +    uint32_t d = *dest;
   1.184 +    uint32_t d1, d2;
   1.185 +
   1.186 +    d1 = d & 0x00ff00ff;
   1.187 +    d1 *= sa;
   1.188 +    d1 += 0x00800080;
   1.189 +    d1 += (d1 >> 8) & 0x00ff00ff;
   1.190 +    d1 >>= 8;
   1.191 +    d1 &= 0x00ff00ff;
   1.192 +    d1 += s1;
   1.193 +    d1 |= 0x01000100 - ((d1 >> 8) & 0x00ff00ff);
   1.194 +    d1 &= 0x00ff00ff;
   1.195 +
   1.196 +    d2 = (d >> 8) & 0x00ff00ff;
   1.197 +    d2 *= sa;
   1.198 +    d2 += 0x00800080;
   1.199 +    d2 += (d2 >> 8) & 0x00ff00ff;
   1.200 +    d2 >>= 8;
   1.201 +    d2 &= 0x00ff00ff;
   1.202 +    d2 += s2;
   1.203 +    d2 |= 0x01000100 - ((d2 >> 8) & 0x00ff00ff);
   1.204 +    d2 &= 0x00ff00ff;
   1.205 +
   1.206 +    *dest++ = d1 | (d2 << 8);
   1.207 +    src++;
   1.208 +  }
   1.209 +}
   1.210 +OIL_DEFINE_IMPL (composite_over_argb_const_src_fast,
   1.211 +    composite_over_argb_const_src);
   1.212 +
   1.213 +static void
   1.214 +composite_add_argb_fast (uint32_t *dest, const uint32_t *src, int n)
   1.215 +{
   1.216 +  for (; n > 0; n--) {
   1.217 +    uint32_t s = *src++, d = *dest;
   1.218 +    uint32_t s1, s2, d1, d2;
   1.219 +
   1.220 +    s1 = s & 0x00ff00ff;
   1.221 +    s2 = (s >> 8) & 0x00ff00ff;
   1.222 +    d1 = d & 0x00ff00ff;
   1.223 +    d2 = (d >> 8) & 0x00ff00ff;
   1.224 +
   1.225 +    d1 += s1;
   1.226 +    d1 |= 0x01000100 - ((d1 >> 8) & 0x00ff00ff);
   1.227 +    d1 &= 0x00ff00ff;
   1.228 +
   1.229 +    d2 += s2;
   1.230 +    d2 |= 0x01000100 - ((d2 >> 8) & 0x00ff00ff);
   1.231 +    d2 &= 0x00ff00ff;
   1.232 +
   1.233 +    *dest++ = d1 | (d2 << 8);
   1.234 +  }
   1.235 +}
   1.236 +OIL_DEFINE_IMPL (composite_add_argb_fast, composite_add_argb);
   1.237 +
   1.238 +static void
   1.239 +composite_add_argb_const_src_fast (uint32_t *dest, const uint32_t *src, int n)
   1.240 +{
   1.241 +  uint32_t s1, s2;
   1.242 +
   1.243 +  s1 = *src & 0x00ff00ff;
   1.244 +  s2 = (*src >> 8) & 0x00ff00ff;
   1.245 +  for (; n > 0; n--) {
   1.246 +    uint32_t d = *dest;
   1.247 +    uint32_t d1, d2;
   1.248 +
   1.249 +    d1 = d & 0x00ff00ff;
   1.250 +    d2 = (d >> 8) & 0x00ff00ff;
   1.251 +
   1.252 +    d1 += s1;
   1.253 +    d1 |= 0x01000100 - ((d1 >> 8) & 0x00ff00ff);
   1.254 +    d1 &= 0x00ff00ff;
   1.255 +
   1.256 +    d2 += s2;
   1.257 +    d2 |= 0x01000100 - ((d2 >> 8) & 0x00ff00ff);
   1.258 +    d2 &= 0x00ff00ff;
   1.259 +
   1.260 +    *dest++ = d1 | (d2 << 8);
   1.261 +  }
   1.262 +}
   1.263 +OIL_DEFINE_IMPL (composite_add_argb_const_src_fast,
   1.264 +    composite_add_argb_const_src);
   1.265 +
   1.266 +static void
   1.267 +composite_in_over_argb_fast (uint32_t *dest, const uint32_t *src,
   1.268 +    const uint8_t *mask, int n)
   1.269 +{
   1.270 +  for (; n > 0; n--) {
   1.271 +    uint32_t d = *dest, s = *src++;
   1.272 +    uint32_t s1, s2, d1, d2, sa;
   1.273 +    uint8_t m = *mask++;
   1.274 +
   1.275 +    s1 = s & 0x00ff00ff;
   1.276 +    s2 = (s >> 8) & 0x00ff00ff;
   1.277 +
   1.278 +    /* in */
   1.279 +    s1 *= m;
   1.280 +    s1 += 0x00800080;
   1.281 +    s1 += (s1 >> 8) & 0x00ff00ff;
   1.282 +    s1 >>= 8;
   1.283 +    s1 &= 0x00ff00ff;
   1.284 +
   1.285 +    s2 *= m;
   1.286 +    s2 += 0x00800080;
   1.287 +    s2 += (s2 >> 8) & 0x00ff00ff;
   1.288 +    s2 >>= 8;
   1.289 +    s2 &= 0x00ff00ff;
   1.290 +
   1.291 +    /* over */
   1.292 +    sa = (~s2 >> 16) & 0xff;
   1.293 +
   1.294 +    d1 = d & 0x00ff00ff;
   1.295 +    d1 *= sa;
   1.296 +    d1 += 0x00800080;
   1.297 +    d1 += (d1 >> 8) & 0x00ff00ff;
   1.298 +    d1 >>= 8;
   1.299 +    d1 &= 0x00ff00ff;
   1.300 +    d1 += s1;
   1.301 +    d1 |= 0x01000100 - ((d1 >> 8) & 0x00ff00ff);
   1.302 +    d1 &= 0x00ff00ff;
   1.303 +
   1.304 +    d2 = (d >> 8) & 0x00ff00ff;
   1.305 +    d2 *= sa;
   1.306 +    d2 += 0x00800080;
   1.307 +    d2 += (d2 >> 8) & 0x00ff00ff;
   1.308 +    d2 >>= 8;
   1.309 +    d2 &= 0x00ff00ff;
   1.310 +    d2 += s2;
   1.311 +    d2 |= 0x01000100 - ((d2 >> 8) & 0x00ff00ff);
   1.312 +    d2 &= 0x00ff00ff;
   1.313 +
   1.314 +    *dest++ = d1 | (d2 << 8);
   1.315 +  }
   1.316 +}
   1.317 +OIL_DEFINE_IMPL (composite_in_over_argb_fast, composite_in_over_argb);
   1.318 +
   1.319 +static void
   1.320 +composite_in_over_argb_const_src_fast (uint32_t *dest, const uint32_t *src,
   1.321 +    const uint8_t *mask, int n)
   1.322 +{
   1.323 +  uint32_t s = *src;
   1.324 +  uint32_t s1, s2;
   1.325 +
   1.326 +  s1 = s & 0x00ff00ff;
   1.327 +  s2 = (s >> 8) & 0x00ff00ff;
   1.328 +
   1.329 +  for (; n > 0; n--) {
   1.330 +    uint32_t d = *dest;
   1.331 +    uint32_t temp1, temp2, d1, d2, sa;
   1.332 +    uint8_t m = *mask++;
   1.333 +
   1.334 +    /* in */
   1.335 +    temp1 = s1 * m;
   1.336 +    temp1 += 0x00800080;
   1.337 +    temp1 += (temp1 >> 8) & 0x00ff00ff;
   1.338 +    temp1 >>= 8;
   1.339 +    temp1 &= 0x00ff00ff;
   1.340 +
   1.341 +    temp2 = s2 * m;
   1.342 +    temp2 += 0x00800080;
   1.343 +    temp2 += (temp2 >> 8) & 0x00ff00ff;
   1.344 +    temp2 >>= 8;
   1.345 +    temp2 &= 0x00ff00ff;
   1.346 +
   1.347 +    /* over */
   1.348 +    sa = (~temp2 >> 16) & 0xff;
   1.349 +
   1.350 +    d1 = d & 0x00ff00ff;
   1.351 +    d1 *= sa;
   1.352 +    d1 += 0x00800080;
   1.353 +    d1 += (d1 >> 8) & 0x00ff00ff;
   1.354 +    d1 >>= 8;
   1.355 +    d1 &= 0x00ff00ff;
   1.356 +    d1 += temp1;
   1.357 +    d1 |= 0x01000100 - ((d1 >> 8) & 0x00ff00ff);
   1.358 +    d1 &= 0x00ff00ff;
   1.359 +
   1.360 +    d2 = (d >> 8) & 0x00ff00ff;
   1.361 +    d2 *= sa;
   1.362 +    d2 += 0x00800080;
   1.363 +    d2 += (d2 >> 8) & 0x00ff00ff;
   1.364 +    d2 >>= 8;
   1.365 +    d2 &= 0x00ff00ff;
   1.366 +    d2 += temp2;
   1.367 +    d2 |= 0x01000100 - ((d2 >> 8) & 0x00ff00ff);
   1.368 +    d2 &= 0x00ff00ff;
   1.369 +
   1.370 +    *dest++ = d1 | (d2 << 8);
   1.371 +  }
   1.372 +}
   1.373 +OIL_DEFINE_IMPL (composite_in_over_argb_const_src_fast,
   1.374 +    composite_in_over_argb_const_src);
   1.375 +
   1.376 +static void
   1.377 +composite_in_over_argb_const_mask_fast (uint32_t *dest, const uint32_t *src,
   1.378 +    const uint8_t *mask, int n)
   1.379 +{
   1.380 +  uint8_t m = *mask;
   1.381 +  for (; n > 0; n--) {
   1.382 +    uint32_t d = *dest, s = *src++;
   1.383 +    uint32_t s1, s2, d1, d2, sa;
   1.384 +
   1.385 +    s1 = s & 0x00ff00ff;
   1.386 +    s2 = (s >> 8) & 0x00ff00ff;
   1.387 +
   1.388 +    /* in */
   1.389 +    s1 *= m;
   1.390 +    s1 += 0x00800080;
   1.391 +    s1 += (s1 >> 8) & 0x00ff00ff;
   1.392 +    s1 >>= 8;
   1.393 +    s1 &= 0x00ff00ff;
   1.394 +
   1.395 +    s2 *= m;
   1.396 +    s2 += 0x00800080;
   1.397 +    s2 += (s2 >> 8) & 0x00ff00ff;
   1.398 +    s2 >>= 8;
   1.399 +    s2 &= 0x00ff00ff;
   1.400 +
   1.401 +    /* over */
   1.402 +    sa = (~s2 >> 16) & 0xff;
   1.403 +
   1.404 +    d1 = d & 0x00ff00ff;
   1.405 +    d1 *= sa;
   1.406 +    d1 += 0x00800080;
   1.407 +    d1 += (d1 >> 8) & 0x00ff00ff;
   1.408 +    d1 >>= 8;
   1.409 +    d1 &= 0x00ff00ff;
   1.410 +    d1 += s1;
   1.411 +    d1 |= 0x01000100 - ((d1 >> 8) & 0x00ff00ff);
   1.412 +    d1 &= 0x00ff00ff;
   1.413 +
   1.414 +    d2 = (d >> 8) & 0x00ff00ff;
   1.415 +    d2 *= sa;
   1.416 +    d2 += 0x00800080;
   1.417 +    d2 += (d2 >> 8) & 0x00ff00ff;
   1.418 +    d2 >>= 8;
   1.419 +    d2 &= 0x00ff00ff;
   1.420 +    d2 += s2;
   1.421 +    d2 |= 0x01000100 - ((d2 >> 8) & 0x00ff00ff);
   1.422 +    d2 &= 0x00ff00ff;
   1.423 +
   1.424 +    *dest++ = d1 | (d2 << 8);
   1.425 +  }
   1.426 +}
   1.427 +OIL_DEFINE_IMPL (composite_in_over_argb_const_mask_fast,
   1.428 +    composite_in_over_argb_const_mask);
   1.429 +
   1.430 +#ifdef HAVE_UNALIGNED_ACCESS
   1.431 +static void
   1.432 +composite_add_u8_fast (uint8_t *dest, const uint8_t *src, int n)
   1.433 +{
   1.434 +  for (; n > 3; n-= 4) {
   1.435 +    uint32_t s = *(uint32_t *)src, d = *(uint32_t *)dest;
   1.436 +    uint32_t s1, s2, d1, d2;
   1.437 +
   1.438 +    s1 = s & 0x00ff00ff;
   1.439 +    s2 = (s >> 8) & 0x00ff00ff;
   1.440 +    d1 = d & 0x00ff00ff;
   1.441 +    d2 = (d >> 8) & 0x00ff00ff;
   1.442 +
   1.443 +    d1 += s1;
   1.444 +    d1 |= 0x01000100 - ((d1 >> 8) & 0x00ff00ff);
   1.445 +    d1 &= 0x00ff00ff;
   1.446 +
   1.447 +    d2 += s2;
   1.448 +    d2 |= 0x01000100 - ((d2 >> 8) & 0x00ff00ff);
   1.449 +    d2 &= 0x00ff00ff;
   1.450 +
   1.451 +    *(uint32_t *)dest = d1 | (d2 << 8);
   1.452 +    src += 4;
   1.453 +    dest += 4;
   1.454 +  }
   1.455 +  for (; n > 0; n--) {
   1.456 +    *dest = COMPOSITE_ADD(*dest, *src);
   1.457 +    src++;
   1.458 +    dest++;
   1.459 +  }
   1.460 +}
   1.461 +OIL_DEFINE_IMPL (composite_add_u8_fast, composite_add_u8);
   1.462 +#endif
   1.463 +
   1.464 +#ifdef HAVE_UNALIGNED_ACCESS
   1.465 +static void
   1.466 +composite_add_u8_const_src_fast (uint8_t *dest, const uint8_t *src, int n)
   1.467 +{
   1.468 +  uint32_t s;
   1.469 +
   1.470 +  s = *src | (*src << 16);
   1.471 +  for (; n > 3; n-= 4) {
   1.472 +    uint32_t d = *(uint32_t *)dest;
   1.473 +    uint32_t d1, d2;
   1.474 +
   1.475 +    d1 = d & 0x00ff00ff;
   1.476 +    d2 = (d >> 8) & 0x00ff00ff;
   1.477 +
   1.478 +    d1 += s;
   1.479 +    d1 |= 0x01000100 - ((d1 >> 8) & 0x00ff00ff);
   1.480 +    d1 &= 0x00ff00ff;
   1.481 +
   1.482 +    d2 += s;
   1.483 +    d2 |= 0x01000100 - ((d2 >> 8) & 0x00ff00ff);
   1.484 +    d2 &= 0x00ff00ff;
   1.485 +
   1.486 +    *(uint32_t *)dest = d1 | (d2 << 8);
   1.487 +    dest += 4;
   1.488 +  }
   1.489 +  for (; n > 0; n--) {
   1.490 +    *dest = COMPOSITE_ADD(*dest, *src);
   1.491 +    dest++;
   1.492 +  }
   1.493 +}
   1.494 +OIL_DEFINE_IMPL (composite_add_u8_const_src_fast, composite_add_u8_const_src);
   1.495 +#endif
   1.496 +
   1.497 +#ifdef HAVE_UNALIGNED_ACCESS
   1.498 +static void
   1.499 +composite_over_u8_fast (uint8_t *dest, const uint8_t *src, int n)
   1.500 +{
   1.501 +  for (; n > 3; n-= 4) {
   1.502 +    uint32_t d = *(uint32_t *)dest, s = *(uint32_t *)src;
   1.503 +    uint32_t d1, d2, s1, s2;
   1.504 +
   1.505 +    d1 = d & 0x00ff00ff;
   1.506 +    d2 = (d >> 8) & 0x00ff00ff;
   1.507 +    s1 = s & 0x00ff00ff;
   1.508 +    s2 = (s >> 8) & 0x00ff00ff;
   1.509 +
   1.510 +    d1 = ((d1 & 0xff) * (~s1 & 0xff)) |
   1.511 +	((d1 & 0x00ff0000) * (~s1 >> 16 & 0xff));
   1.512 +    d1 += 0x00800080;
   1.513 +    d1 += (d1 >> 8) & 0x00ff00ff;
   1.514 +    d1 >>= 8;
   1.515 +    d1 &= 0x00ff00ff;
   1.516 +    d1 += s1;
   1.517 +    d1 |= 0x01000100 - ((d1 >> 8) & 0x00ff00ff);
   1.518 +    d1 &= 0x00ff00ff;
   1.519 +
   1.520 +    d2 = ((d2 & 0xff) * (~s2 & 0xff)) |
   1.521 +	((d2 & 0x00ff0000) * (~s2 >> 16 & 0xff));
   1.522 +    d2 += 0x00800080;
   1.523 +    d2 += (d2 >> 8) & 0x00ff00ff;
   1.524 +    d2 >>= 8;
   1.525 +    d2 &= 0x00ff00ff;
   1.526 +    d2 += s2;
   1.527 +    d2 |= 0x01000100 - ((d2 >> 8) & 0x00ff00ff);
   1.528 +    d2 &= 0x00ff00ff;
   1.529 +
   1.530 +    *(uint32_t *)dest = d1 | (d2 << 8);
   1.531 +    dest += 4;
   1.532 +    src += 4;
   1.533 +  }
   1.534 +  for (; n > 0; n--) {
   1.535 +    *dest = COMPOSITE_OVER(*dest, *src, *src);
   1.536 +    dest++;
   1.537 +    src++;
   1.538 +  }
   1.539 +}
   1.540 +OIL_DEFINE_IMPL (composite_over_u8_fast, composite_over_u8);
   1.541 +#endif
   1.542 +
   1.543 +
   1.544 +#ifdef	__SYMBIAN32__
   1.545 + 
   1.546 +OilFunctionImpl* __oil_function_impl_composite_in_argb_fast() {
   1.547 +		return &_oil_function_impl_composite_in_argb_fast;
   1.548 +}
   1.549 +#endif
   1.550 +
   1.551 +#ifdef	__SYMBIAN32__
   1.552 + 
   1.553 +OilFunctionImpl* __oil_function_impl_composite_in_argb_const_src_fast() {
   1.554 +		return &_oil_function_impl_composite_in_argb_const_src_fast;
   1.555 +}
   1.556 +#endif
   1.557 +
   1.558 +#ifdef	__SYMBIAN32__
   1.559 + 
   1.560 +OilFunctionImpl* __oil_function_impl_composite_in_argb_const_mask_fast() {
   1.561 +		return &_oil_function_impl_composite_in_argb_const_mask_fast;
   1.562 +}
   1.563 +#endif
   1.564 +
   1.565 +#ifdef	__SYMBIAN32__
   1.566 + 
   1.567 +OilFunctionImpl* __oil_function_impl_composite_over_argb_fast() {
   1.568 +		return &_oil_function_impl_composite_over_argb_fast;
   1.569 +}
   1.570 +#endif
   1.571 +
   1.572 +#ifdef	__SYMBIAN32__
   1.573 + 
   1.574 +OilFunctionImpl* __oil_function_impl_composite_over_argb_const_src_fast() {
   1.575 +		return &_oil_function_impl_composite_over_argb_const_src_fast;
   1.576 +}
   1.577 +#endif
   1.578 +
   1.579 +#ifdef	__SYMBIAN32__
   1.580 + 
   1.581 +OilFunctionImpl* __oil_function_impl_composite_add_argb_fast() {
   1.582 +		return &_oil_function_impl_composite_add_argb_fast;
   1.583 +}
   1.584 +#endif
   1.585 +
   1.586 +#ifdef	__SYMBIAN32__
   1.587 + 
   1.588 +OilFunctionImpl* __oil_function_impl_composite_add_argb_const_src_fast() {
   1.589 +		return &_oil_function_impl_composite_add_argb_const_src_fast;
   1.590 +}
   1.591 +#endif
   1.592 +
   1.593 +#ifdef	__SYMBIAN32__
   1.594 + 
   1.595 +OilFunctionImpl* __oil_function_impl_composite_in_over_argb_fast() {
   1.596 +		return &_oil_function_impl_composite_in_over_argb_fast;
   1.597 +}
   1.598 +#endif
   1.599 +
   1.600 +#ifdef	__SYMBIAN32__
   1.601 + 
   1.602 +OilFunctionImpl* __oil_function_impl_composite_in_over_argb_const_src_fast() {
   1.603 +		return &_oil_function_impl_composite_in_over_argb_const_src_fast;
   1.604 +}
   1.605 +#endif
   1.606 +
   1.607 +#ifdef	__SYMBIAN32__
   1.608 + 
   1.609 +OilFunctionImpl* __oil_function_impl_composite_in_over_argb_const_mask_fast() {
   1.610 +		return &_oil_function_impl_composite_in_over_argb_const_mask_fast;
   1.611 +}
   1.612 +#endif
   1.613 +
   1.614 +#ifdef HAVE_UNALIGNED_ACCESS
   1.615 +#ifdef	__SYMBIAN32__
   1.616 + 
   1.617 +OilFunctionImpl* __oil_function_impl_composite_add_u8_fast() {
   1.618 +		return &_oil_function_impl_composite_add_u8_fast;
   1.619 +}
   1.620 +#endif
   1.621 +#endif
   1.622 +
   1.623 +#ifdef HAVE_UNALIGNED_ACCESS
   1.624 +#ifdef	__SYMBIAN32__
   1.625 + 
   1.626 +OilFunctionImpl* __oil_function_impl_composite_add_u8_const_src_fast() {
   1.627 +		return &_oil_function_impl_composite_add_u8_const_src_fast;
   1.628 +}
   1.629 +#endif
   1.630 +#endif
   1.631 +
   1.632 +#ifdef HAVE_UNALIGNED_ACCESS
   1.633 +#ifdef	__SYMBIAN32__
   1.634 + 
   1.635 +OilFunctionImpl* __oil_function_impl_composite_over_u8_fast() {
   1.636 +		return &_oil_function_impl_composite_over_u8_fast;
   1.637 +}
   1.638 +#endif
   1.639 +#endif