|
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 <liboilfunction.h> |
|
34 |
|
35 /** |
|
36 * oil_diff8x8_s16_u8: |
|
37 * @d_8x8: |
|
38 * @s1_8x8: |
|
39 * @ss1: |
|
40 * @s2_8x8: |
|
41 * @ss2: |
|
42 * |
|
43 * Calculates the difference of each value in @s1_8x8 and @s2_8x8 |
|
44 * and places the result in @d_8x8. Note that the destination type |
|
45 * is larger than the source type. |
|
46 */ |
|
47 OIL_DEFINE_CLASS (diff8x8_s16_u8, |
|
48 "int16_t *d_8x8, uint8_t *s1_8x8, int ss1, uint8_t *s2_8x8, int ss2"); |
|
49 /** |
|
50 * oil_diff8x8_const128_s16_u8: |
|
51 * @d_8x8: |
|
52 * @s1_8x8: |
|
53 * @ss1: |
|
54 * |
|
55 * Subtracts 128 from each value in @s1_8x8 |
|
56 * and places the result in @d_8x8. Note that the destination type |
|
57 * is larger than the source type. |
|
58 */ |
|
59 OIL_DEFINE_CLASS (diff8x8_const128_s16_u8, |
|
60 "int16_t *d_8x8, uint8_t *s1_8x8, int ss1"); |
|
61 /** |
|
62 * oil_diff8x8_average_s16_u8: |
|
63 * @d_8x8: |
|
64 * @s1_8x8: |
|
65 * @ss1: |
|
66 * @s2_8x8: |
|
67 * @ss2: |
|
68 * @s3_8x8: |
|
69 * @ss3: |
|
70 * |
|
71 * Calculates the difference of each value in @s1_8x8 and the |
|
72 * average of @s2_8x8 and @s3_8x8, |
|
73 * and places the result in @d_8x8. Note that the destination type |
|
74 * is larger than the source type. |
|
75 */ |
|
76 OIL_DEFINE_CLASS (diff8x8_average_s16_u8, |
|
77 "int16_t *d_8x8, uint8_t *s1_8x8, int ss1, uint8_t *s2_8x8, int ss2, uint8_t *s3_8x8, int ss3"); |
|
78 |
|
79 static void |
|
80 diff8x8_s16_u8_ref (int16_t *dest, uint8_t *src1, int ss1, uint8_t *src2, int ss2) |
|
81 { |
|
82 int i; |
|
83 |
|
84 /* For each block row */ |
|
85 for (i=0;i<8;i++ ){ |
|
86 dest[0] = ((int16_t)src1[0]) - ((int16_t)src2[0]); |
|
87 dest[1] = ((int16_t)src1[1]) - ((int16_t)src2[1]); |
|
88 dest[2] = ((int16_t)src1[2]) - ((int16_t)src2[2]); |
|
89 dest[3] = ((int16_t)src1[3]) - ((int16_t)src2[3]); |
|
90 dest[4] = ((int16_t)src1[4]) - ((int16_t)src2[4]); |
|
91 dest[5] = ((int16_t)src1[5]) - ((int16_t)src2[5]); |
|
92 dest[6] = ((int16_t)src1[6]) - ((int16_t)src2[6]); |
|
93 dest[7] = ((int16_t)src1[7]) - ((int16_t)src2[7]); |
|
94 |
|
95 /* Start next row */ |
|
96 src1 += ss1; |
|
97 src2 += ss2; |
|
98 dest += 8; |
|
99 } |
|
100 } |
|
101 OIL_DEFINE_IMPL_REF (diff8x8_s16_u8_ref, diff8x8_s16_u8); |
|
102 |
|
103 static void |
|
104 diff8x8_const128_s16_u8_ref (int16_t *dest, uint8_t *src1, int ss1) |
|
105 { |
|
106 int i; |
|
107 |
|
108 /* For each block row */ |
|
109 for (i=0;i<8;i++ ){ |
|
110 dest[0] = ((int16_t)src1[0]) - 128; |
|
111 dest[1] = ((int16_t)src1[1]) - 128; |
|
112 dest[2] = ((int16_t)src1[2]) - 128; |
|
113 dest[3] = ((int16_t)src1[3]) - 128; |
|
114 dest[4] = ((int16_t)src1[4]) - 128; |
|
115 dest[5] = ((int16_t)src1[5]) - 128; |
|
116 dest[6] = ((int16_t)src1[6]) - 128; |
|
117 dest[7] = ((int16_t)src1[7]) - 128; |
|
118 |
|
119 /* Start next row */ |
|
120 src1 += ss1; |
|
121 dest += 8; |
|
122 } |
|
123 } |
|
124 OIL_DEFINE_IMPL_REF (diff8x8_const128_s16_u8_ref, diff8x8_const128_s16_u8); |
|
125 |
|
126 static void |
|
127 diff8x8_average_s16_u8_ref (int16_t *dest, uint8_t *src1, int ss1, uint8_t *src2, int ss2, uint8_t *src3, int ss3) |
|
128 { |
|
129 int i; |
|
130 |
|
131 /* For each block row */ |
|
132 for (i=0;i<8;i++ ){ |
|
133 dest[0] = ((int16_t)src1[0]) - ((((int16_t)src2[0]) + ((int16_t)src3[0])) / 2); |
|
134 dest[1] = ((int16_t)src1[1]) - ((((int16_t)src2[1]) + ((int16_t)src3[1])) / 2); |
|
135 dest[2] = ((int16_t)src1[2]) - ((((int16_t)src2[2]) + ((int16_t)src3[2])) / 2); |
|
136 dest[3] = ((int16_t)src1[3]) - ((((int16_t)src2[3]) + ((int16_t)src3[3])) / 2); |
|
137 dest[4] = ((int16_t)src1[4]) - ((((int16_t)src2[4]) + ((int16_t)src3[4])) / 2); |
|
138 dest[5] = ((int16_t)src1[5]) - ((((int16_t)src2[5]) + ((int16_t)src3[5])) / 2); |
|
139 dest[6] = ((int16_t)src1[6]) - ((((int16_t)src2[6]) + ((int16_t)src3[6])) / 2); |
|
140 dest[7] = ((int16_t)src1[7]) - ((((int16_t)src2[7]) + ((int16_t)src3[7])) / 2); |
|
141 |
|
142 /* Start next row */ |
|
143 src1 += ss1; |
|
144 src2 += ss2; |
|
145 src3 += ss3; |
|
146 dest += 8; |
|
147 } |
|
148 } |
|
149 OIL_DEFINE_IMPL_REF (diff8x8_average_s16_u8_ref, diff8x8_average_s16_u8); |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 #ifdef __SYMBIAN32__ |
|
159 |
|
160 OilFunctionClass* __oil_function_class_diff8x8_s16_u8() { |
|
161 return &_oil_function_class_diff8x8_s16_u8; |
|
162 } |
|
163 #endif |
|
164 |
|
165 #ifdef __SYMBIAN32__ |
|
166 |
|
167 OilFunctionClass* __oil_function_class_diff8x8_const128_s16_u8() { |
|
168 return &_oil_function_class_diff8x8_const128_s16_u8; |
|
169 } |
|
170 #endif |
|
171 |
|
172 #ifdef __SYMBIAN32__ |
|
173 |
|
174 OilFunctionClass* __oil_function_class_diff8x8_average_s16_u8() { |
|
175 return &_oil_function_class_diff8x8_average_s16_u8; |
|
176 } |
|
177 #endif |
|
178 |
|
179 |
|
180 |
|
181 #ifdef __SYMBIAN32__ |
|
182 |
|
183 OilFunctionImpl* __oil_function_impl_diff8x8_s16_u8_ref() { |
|
184 return &_oil_function_impl_diff8x8_s16_u8_ref; |
|
185 } |
|
186 #endif |
|
187 |
|
188 #ifdef __SYMBIAN32__ |
|
189 |
|
190 OilFunctionImpl* __oil_function_impl_diff8x8_const128_s16_u8_ref() { |
|
191 return &_oil_function_impl_diff8x8_const128_s16_u8_ref; |
|
192 } |
|
193 #endif |
|
194 |
|
195 #ifdef __SYMBIAN32__ |
|
196 |
|
197 OilFunctionImpl* __oil_function_impl_diff8x8_average_s16_u8_ref() { |
|
198 return &_oil_function_impl_diff8x8_average_s16_u8_ref; |
|
199 } |
|
200 #endif |
|
201 |
|
202 |
|
203 |
|
204 #ifdef __SYMBIAN32__ |
|
205 |
|
206 EXPORT_C void** _oil_function_class_ptr_diff8x8_s16_u8 () { |
|
207 oil_function_class_ptr_diff8x8_s16_u8 = __oil_function_class_diff8x8_s16_u8(); |
|
208 return &oil_function_class_ptr_diff8x8_s16_u8->func; |
|
209 } |
|
210 #endif |
|
211 |
|
212 #ifdef __SYMBIAN32__ |
|
213 |
|
214 EXPORT_C void** _oil_function_class_ptr_diff8x8_const128_s16_u8 () { |
|
215 oil_function_class_ptr_diff8x8_const128_s16_u8 = __oil_function_class_diff8x8_const128_s16_u8(); |
|
216 return &oil_function_class_ptr_diff8x8_const128_s16_u8->func; |
|
217 } |
|
218 #endif |
|
219 |
|
220 #ifdef __SYMBIAN32__ |
|
221 |
|
222 EXPORT_C void** _oil_function_class_ptr_diff8x8_average_s16_u8 () { |
|
223 oil_function_class_ptr_diff8x8_average_s16_u8 = __oil_function_class_diff8x8_average_s16_u8(); |
|
224 return &oil_function_class_ptr_diff8x8_average_s16_u8->func; |
|
225 } |
|
226 #endif |
|
227 |