sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005
|
sl@0
|
3 |
* Eric Anholt. All rights reserved.
|
sl@0
|
4 |
*
|
sl@0
|
5 |
* Redistribution and use in source and binary forms, with or without
|
sl@0
|
6 |
* modification, are permitted provided that the following conditions
|
sl@0
|
7 |
* are met:
|
sl@0
|
8 |
* 1. Redistributions of source code must retain the above copyright
|
sl@0
|
9 |
* notice, this list of conditions and the following disclaimer.
|
sl@0
|
10 |
* 2. Redistributions in binary form must reproduce the above copyright
|
sl@0
|
11 |
* notice, this list of conditions and the following disclaimer in the
|
sl@0
|
12 |
* documentation and/or other materials provided with the distribution.
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND
|
sl@0
|
15 |
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
sl@0
|
16 |
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
sl@0
|
17 |
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE
|
sl@0
|
18 |
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
sl@0
|
19 |
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
sl@0
|
20 |
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
sl@0
|
21 |
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
sl@0
|
22 |
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
sl@0
|
23 |
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
sl@0
|
24 |
* SUCH DAMAGE.
|
sl@0
|
25 |
*/
|
sl@0
|
26 |
//Portions Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
|
sl@0
|
27 |
|
sl@0
|
28 |
#ifdef HAVE_CONFIG_H
|
sl@0
|
29 |
#include "config.h"
|
sl@0
|
30 |
#endif
|
sl@0
|
31 |
#include <liboil/liboilclasses.h>
|
sl@0
|
32 |
#include <liboil/liboilfunction.h>
|
sl@0
|
33 |
|
sl@0
|
34 |
#ifdef HAVE_GCC_ASM
|
sl@0
|
35 |
#include <mmintrin.h>
|
sl@0
|
36 |
|
sl@0
|
37 |
static void
|
sl@0
|
38 |
composite_add_u8_const_src_mmx (uint8_t *dest, uint8_t *src1_1, int n)
|
sl@0
|
39 |
{
|
sl@0
|
40 |
__m64 xmm0;
|
sl@0
|
41 |
uint8_t add = *src1_1;
|
sl@0
|
42 |
|
sl@0
|
43 |
xmm0 = _mm_set1_pi8(add);
|
sl@0
|
44 |
for (; n >= 8; n -= 8) {
|
sl@0
|
45 |
*(__m64 *)dest = _mm_adds_pu8(xmm0, *(__m64 *)dest);
|
sl@0
|
46 |
dest += 8;
|
sl@0
|
47 |
}
|
sl@0
|
48 |
for (; n > 0; n--) {
|
sl@0
|
49 |
int val = *dest + add;
|
sl@0
|
50 |
if (val > 255)
|
sl@0
|
51 |
val = 255;
|
sl@0
|
52 |
*dest++ = val;
|
sl@0
|
53 |
}
|
sl@0
|
54 |
_mm_empty();
|
sl@0
|
55 |
}
|
sl@0
|
56 |
|
sl@0
|
57 |
OIL_DEFINE_IMPL_FULL (composite_add_u8_const_src_mmx,
|
sl@0
|
58 |
composite_add_u8_const_src, OIL_IMPL_FLAG_MMX);
|
sl@0
|
59 |
#endif
|
sl@0
|
60 |
|
sl@0
|
61 |
#if 0
|
sl@0
|
62 |
#ifdef __SYMBIAN32__
|
sl@0
|
63 |
|
sl@0
|
64 |
OilFunctionImpl* __oil_function_impl_composite_add_u8_const_src_mmx() {
|
sl@0
|
65 |
return &_oil_function_impl_composite_add_u8_const_src_mmx;
|
sl@0
|
66 |
}
|
sl@0
|
67 |
#endif
|
sl@0
|
68 |
#endif
|