|
1 /* |
|
2 * LIBOIL - Library of Optimized Inner Loops |
|
3 * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org> |
|
4 * All rights reserved. |
|
5 * |
|
6 * Redistribution and use in source and binary forms, with or without |
|
7 * modification, are permitted provided that the following conditions |
|
8 * are met: |
|
9 * 1. Redistributions of source code must retain the above copyright |
|
10 * notice, this list of conditions and the following disclaimer. |
|
11 * 2. Redistributions in binary form must reproduce the above copyright |
|
12 * notice, this list of conditions and the following disclaimer in the |
|
13 * documentation and/or other materials provided with the distribution. |
|
14 * |
|
15 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
|
16 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
|
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
|
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, |
|
19 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
|
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
|
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
|
23 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
|
24 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
|
25 * POSSIBILITY OF SUCH DAMAGE. |
|
26 */ |
|
27 //Portions Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. |
|
28 |
|
29 #ifdef HAVE_CONFIG_H |
|
30 #include "config.h" |
|
31 #endif |
|
32 |
|
33 #include <liboil/liboilfunction.h> |
|
34 #include "liboil/simdpack/simdpack.h" |
|
35 #include "liboil/liboilcolorspace.h" |
|
36 |
|
37 #ifdef __SYMBIAN32__ |
|
38 #ifdef __WINSCW__ |
|
39 #pragma warn_unusedarg off |
|
40 #endif//__WINSCW__ |
|
41 #endif//__SYMBIAN32__ |
|
42 |
|
43 /** |
|
44 * oil_recon8x8_intra: |
|
45 * @d_8x8: |
|
46 * @ds: |
|
47 * @s_8x8: |
|
48 * |
|
49 * Adds 128 to each value in the source array, clamps to the range [0,255], |
|
50 * and places the result in the destination array. |
|
51 */ |
|
52 OIL_DEFINE_CLASS (recon8x8_intra, |
|
53 "uint8_t *d_8x8, int ds, int16_t *s_8x8"); |
|
54 /** |
|
55 * oil_recon8x8_inter: |
|
56 * @d_8x8: |
|
57 * @ds: |
|
58 * @s1_8x8: |
|
59 * @ss1: |
|
60 * @s2_8x8: |
|
61 * |
|
62 * Adds each element in @s1_8x8 and @s2_8x8, clamps to the range [0,255], |
|
63 * and places the result in the destination array. |
|
64 */ |
|
65 OIL_DEFINE_CLASS (recon8x8_inter, |
|
66 "uint8_t *d_8x8, int ds, uint8_t *s1_8x8, int ss1, int16_t *s2_8x8"); |
|
67 /** |
|
68 * oil_recon8x8_inter2: |
|
69 * @d_8x8: |
|
70 * @ds: |
|
71 * @s1_8x8: |
|
72 * @ss1: |
|
73 * @s2_8x8: |
|
74 * @ss2: |
|
75 * @s3_8x8: |
|
76 * |
|
77 * Adds each element in @s1_8x8 and @s2_8x8, divides by 2, and adds |
|
78 * to @s3_8x8, clamps to the range [0,255], and places the result in |
|
79 * the destination array. |
|
80 */ |
|
81 OIL_DEFINE_CLASS (recon8x8_inter2, |
|
82 "uint8_t *d_8x8, int ds, uint8_t *s1_8x8, int ss1, uint8_t *s2_8x8, int ss2, int16_t *s3_8x8"); |
|
83 |
|
84 |
|
85 static void |
|
86 recon8x8_intra_ref (uint8_t *dest, int ds, int16_t *change) |
|
87 { |
|
88 uint32_t i; |
|
89 |
|
90 for (i = 8; i; i--){ |
|
91 dest[0] = oil_clamp_255(change[0] + 128); |
|
92 dest[1] = oil_clamp_255(change[1] + 128); |
|
93 dest[2] = oil_clamp_255(change[2] + 128); |
|
94 dest[3] = oil_clamp_255(change[3] + 128); |
|
95 dest[4] = oil_clamp_255(change[4] + 128); |
|
96 dest[5] = oil_clamp_255(change[5] + 128); |
|
97 dest[6] = oil_clamp_255(change[6] + 128); |
|
98 dest[7] = oil_clamp_255(change[7] + 128); |
|
99 |
|
100 dest += ds; |
|
101 change += 8; |
|
102 } |
|
103 } |
|
104 |
|
105 OIL_DEFINE_IMPL_REF (recon8x8_intra_ref, recon8x8_intra); |
|
106 |
|
107 static void |
|
108 recon8x8_inter_ref (uint8_t *dest, int ds, uint8_t *src, int ss, int16_t *change, int dss) |
|
109 { |
|
110 uint32_t i; |
|
111 |
|
112 for (i = 8; i; i--){ |
|
113 dest[0] = oil_clamp_255(src[0] + change[0]); |
|
114 dest[1] = oil_clamp_255(src[1] + change[1]); |
|
115 dest[2] = oil_clamp_255(src[2] + change[2]); |
|
116 dest[3] = oil_clamp_255(src[3] + change[3]); |
|
117 dest[4] = oil_clamp_255(src[4] + change[4]); |
|
118 dest[5] = oil_clamp_255(src[5] + change[5]); |
|
119 dest[6] = oil_clamp_255(src[6] + change[6]); |
|
120 dest[7] = oil_clamp_255(src[7] + change[7]); |
|
121 |
|
122 change += 8; |
|
123 dest += ds; |
|
124 src += ss; |
|
125 } |
|
126 } |
|
127 |
|
128 OIL_DEFINE_IMPL_REF (recon8x8_inter_ref, recon8x8_inter); |
|
129 |
|
130 static void |
|
131 recon8x8_inter2_ref (uint8_t *dest, int ds, uint8_t *s1, int ss1, uint8_t *s2, int ss2, int16_t *change) |
|
132 { |
|
133 uint32_t i; |
|
134 |
|
135 for (i = 8; i; i--){ |
|
136 dest[0] = oil_clamp_255((((int16_t)s1[0] + (int16_t)s2[0]) >> 1) + change[0]); |
|
137 dest[1] = oil_clamp_255((((int16_t)s1[1] + (int16_t)s2[1]) >> 1) + change[1]); |
|
138 dest[2] = oil_clamp_255((((int16_t)s1[2] + (int16_t)s2[2]) >> 1) + change[2]); |
|
139 dest[3] = oil_clamp_255((((int16_t)s1[3] + (int16_t)s2[3]) >> 1) + change[3]); |
|
140 dest[4] = oil_clamp_255((((int16_t)s1[4] + (int16_t)s2[4]) >> 1) + change[4]); |
|
141 dest[5] = oil_clamp_255((((int16_t)s1[5] + (int16_t)s2[5]) >> 1) + change[5]); |
|
142 dest[6] = oil_clamp_255((((int16_t)s1[6] + (int16_t)s2[6]) >> 1) + change[6]); |
|
143 dest[7] = oil_clamp_255((((int16_t)s1[7] + (int16_t)s2[7]) >> 1) + change[7]); |
|
144 |
|
145 change += 8; |
|
146 dest += ds; |
|
147 s1 += ss1; |
|
148 s2 += ss2; |
|
149 } |
|
150 } |
|
151 |
|
152 OIL_DEFINE_IMPL_REF (recon8x8_inter2_ref, recon8x8_inter2); |
|
153 |
|
154 |
|
155 #ifdef __SYMBIAN32__ |
|
156 |
|
157 OilFunctionClass* __oil_function_class_recon8x8_intra() { |
|
158 return &_oil_function_class_recon8x8_intra; |
|
159 } |
|
160 #endif |
|
161 |
|
162 #ifdef __SYMBIAN32__ |
|
163 |
|
164 OilFunctionClass* __oil_function_class_recon8x8_inter() { |
|
165 return &_oil_function_class_recon8x8_inter; |
|
166 } |
|
167 #endif |
|
168 |
|
169 #ifdef __SYMBIAN32__ |
|
170 |
|
171 OilFunctionClass* __oil_function_class_recon8x8_inter2() { |
|
172 return &_oil_function_class_recon8x8_inter2; |
|
173 } |
|
174 #endif |
|
175 |
|
176 |
|
177 |
|
178 #ifdef __SYMBIAN32__ |
|
179 |
|
180 OilFunctionImpl* __oil_function_impl_recon8x8_intra_ref() { |
|
181 return &_oil_function_impl_recon8x8_intra_ref; |
|
182 } |
|
183 #endif |
|
184 |
|
185 #ifdef __SYMBIAN32__ |
|
186 |
|
187 OilFunctionImpl* __oil_function_impl_recon8x8_inter_ref() { |
|
188 return &_oil_function_impl_recon8x8_inter_ref; |
|
189 } |
|
190 #endif |
|
191 |
|
192 #ifdef __SYMBIAN32__ |
|
193 |
|
194 OilFunctionImpl* __oil_function_impl_recon8x8_inter2_ref() { |
|
195 return &_oil_function_impl_recon8x8_inter2_ref; |
|
196 } |
|
197 #endif |
|
198 |
|
199 |
|
200 |
|
201 #ifdef __SYMBIAN32__ |
|
202 |
|
203 EXPORT_C void** _oil_function_class_ptr_recon8x8_intra () { |
|
204 oil_function_class_ptr_recon8x8_intra = __oil_function_class_recon8x8_intra(); |
|
205 return &oil_function_class_ptr_recon8x8_intra->func; |
|
206 } |
|
207 #endif |
|
208 |
|
209 #ifdef __SYMBIAN32__ |
|
210 |
|
211 EXPORT_C void** _oil_function_class_ptr_recon8x8_inter () { |
|
212 oil_function_class_ptr_recon8x8_inter = __oil_function_class_recon8x8_inter(); |
|
213 return &oil_function_class_ptr_recon8x8_inter->func; |
|
214 } |
|
215 #endif |
|
216 |
|
217 #ifdef __SYMBIAN32__ |
|
218 |
|
219 EXPORT_C void** _oil_function_class_ptr_recon8x8_inter2 () { |
|
220 oil_function_class_ptr_recon8x8_inter2 = __oil_function_class_recon8x8_inter2(); |
|
221 return &oil_function_class_ptr_recon8x8_inter2->func; |
|
222 } |
|
223 #endif |
|
224 |