Update contrib.
2 * LIBOIL - Library of Optimized Inner Loops
3 * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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.
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.
27 //Portions Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
33 #include <liboil/liboilfunction.h>
34 #include "liboil/simdpack/simdpack.h"
35 #include "liboil/liboilcolorspace.h"
39 #pragma warn_unusedarg off
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.
52 OIL_DEFINE_CLASS (recon8x8_intra,
53 "uint8_t *d_8x8, int ds, int16_t *s_8x8");
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.
65 OIL_DEFINE_CLASS (recon8x8_inter,
66 "uint8_t *d_8x8, int ds, uint8_t *s1_8x8, int ss1, int16_t *s2_8x8");
68 * oil_recon8x8_inter2:
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.
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");
86 recon8x8_intra_ref (uint8_t *dest, int ds, int16_t *change)
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);
105 OIL_DEFINE_IMPL_REF (recon8x8_intra_ref, recon8x8_intra);
108 recon8x8_inter_ref (uint8_t *dest, int ds, uint8_t *src, int ss, int16_t *change, int dss)
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]);
128 OIL_DEFINE_IMPL_REF (recon8x8_inter_ref, recon8x8_inter);
131 recon8x8_inter2_ref (uint8_t *dest, int ds, uint8_t *s1, int ss1, uint8_t *s2, int ss2, int16_t *change)
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]);
152 OIL_DEFINE_IMPL_REF (recon8x8_inter2_ref, recon8x8_inter2);
157 OilFunctionClass* __oil_function_class_recon8x8_intra() {
158 return &_oil_function_class_recon8x8_intra;
164 OilFunctionClass* __oil_function_class_recon8x8_inter() {
165 return &_oil_function_class_recon8x8_inter;
171 OilFunctionClass* __oil_function_class_recon8x8_inter2() {
172 return &_oil_function_class_recon8x8_inter2;
180 OilFunctionImpl* __oil_function_impl_recon8x8_intra_ref() {
181 return &_oil_function_impl_recon8x8_intra_ref;
187 OilFunctionImpl* __oil_function_impl_recon8x8_inter_ref() {
188 return &_oil_function_impl_recon8x8_inter_ref;
194 OilFunctionImpl* __oil_function_impl_recon8x8_inter2_ref() {
195 return &_oil_function_impl_recon8x8_inter2_ref;
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;
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;
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;