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/liboiltest.h"
37 * SECTION:liboilfuncs-doc:
38 * @title: Miscellaneous
39 * @short_description: Miscellaneous functions
41 #define CLIP_DEFINE_REF(type) \
42 static void clip_ ## type ## _ref ( \
43 oil_type_ ## type *dest, \
45 oil_type_ ## type *src, \
47 oil_type_ ## type *min, oil_type_ ## type *max) \
50 oil_type_ ## type x; \
52 x = OIL_GET(src,i*sstr,oil_type_ ## type); \
53 if (x<*min) x = *min; \
54 if (x>*max) x = *max; \
55 OIL_GET(dest,i*dstr,oil_type_ ## type) = x; \
58 static void clip_ ## type ## _test (OilTest *test) \
60 oil_type_ ## type *lo = (oil_type_ ## type *) \
61 oil_test_get_source_data (test, OIL_ARG_SRC2); \
62 oil_type_ ## type *hi = (oil_type_ ## type *) \
63 oil_test_get_source_data (test, OIL_ARG_SRC3); \
65 oil_type_ ## type tmp; \
71 OIL_DEFINE_CLASS_FULL(clip_ ## type, \
72 "oil_type_" #type " *dest, " \
74 "oil_type_" #type " *src, " \
76 "oil_type_" #type " *s2_1, oil_type_" #type " *s3_1", \
77 clip_ ## type ## _test); \
78 OIL_DEFINE_IMPL_REF(clip_ ## type ## _ref, clip_ ## type)
82 CLIP_DEFINE_REF (s16);
83 CLIP_DEFINE_REF (u16);
84 CLIP_DEFINE_REF (s32);
85 CLIP_DEFINE_REF (u32);
86 CLIP_DEFINE_REF (f32);
87 CLIP_DEFINE_REF (f64);
91 OilFunctionClass* __oil_function_class_clip_u8() {
92 return &_oil_function_class_clip_u8;
98 OilFunctionClass* __oil_function_class_clip_s8() {
99 return &_oil_function_class_clip_s8;
105 OilFunctionClass* __oil_function_class_clip_s16() {
106 return &_oil_function_class_clip_s16;
111 OilFunctionClass* __oil_function_class_clip_u16() {
112 return &_oil_function_class_clip_u16;
117 OilFunctionClass* __oil_function_class_clip_s32() {
118 return &_oil_function_class_clip_s32;
123 OilFunctionClass* __oil_function_class_clip_u32() {
124 return &_oil_function_class_clip_u32;
129 OilFunctionClass* __oil_function_class_clip_f32() {
130 return &_oil_function_class_clip_f32;
135 OilFunctionClass* __oil_function_class_clip_f64() {
136 return &_oil_function_class_clip_f64;
149 * Clips each value in @src to the range [@s2_1,@s3_1] and places
150 * the result in @dest.
163 * Clips each value in @src to the range [@s2_1,@s3_1] and places
164 * the result in @dest.
177 * Clips each value in @src to the range [@s2_1,@s3_1] and places
178 * the result in @dest.
191 * Clips each value in @src to the range [@s2_1,@s3_1] and places
192 * the result in @dest.
205 * Clips each value in @src to the range [@s2_1,@s3_1] and places
206 * the result in @dest.
219 * Clips each value in @src to the range [@s2_1,@s3_1] and places
220 * the result in @dest.
233 * Clips each value in @src to the range [@s2_1,@s3_1] and places
234 * the result in @dest.
247 * Clips each value in @src to the range [@s2_1,@s3_1] and places
248 * the result in @dest.
255 OilFunctionImpl* __oil_function_impl_clip_s8_ref() {
256 return &_oil_function_impl_clip_s8_ref;
262 OilFunctionImpl* __oil_function_impl_clip_u8_ref() {
263 return &_oil_function_impl_clip_u8_ref;
269 OilFunctionImpl* __oil_function_impl_clip_s16_ref() {
270 return &_oil_function_impl_clip_s16_ref;
276 OilFunctionImpl* __oil_function_impl_clip_u16_ref() {
277 return &_oil_function_impl_clip_u16_ref;
283 OilFunctionImpl* __oil_function_impl_clip_s32_ref() {
284 return &_oil_function_impl_clip_s32_ref;
290 OilFunctionImpl* __oil_function_impl_clip_u32_ref() {
291 return &_oil_function_impl_clip_u32_ref;
297 OilFunctionImpl* __oil_function_impl_clip_f32_ref() {
298 return &_oil_function_impl_clip_f32_ref;
304 OilFunctionImpl* __oil_function_impl_clip_f64_ref() {
305 return &_oil_function_impl_clip_f64_ref;
313 EXPORT_C void** _oil_function_class_ptr_clip_u8 () {
314 oil_function_class_ptr_clip_u8 = __oil_function_class_clip_u8();
315 return &oil_function_class_ptr_clip_u8->func;
321 EXPORT_C void** _oil_function_class_ptr_clip_s8 () {
322 oil_function_class_ptr_clip_s8 = __oil_function_class_clip_s8();
323 return &oil_function_class_ptr_clip_s8->func;
329 EXPORT_C void** _oil_function_class_ptr_clip_s16 () {
330 oil_function_class_ptr_clip_s16 = __oil_function_class_clip_s16();
331 return &oil_function_class_ptr_clip_s16->func;
337 EXPORT_C void** _oil_function_class_ptr_clip_u16 () {
338 oil_function_class_ptr_clip_u16 = __oil_function_class_clip_u16();
339 return &oil_function_class_ptr_clip_u16->func;
345 EXPORT_C void** _oil_function_class_ptr_clip_s32 () {
346 oil_function_class_ptr_clip_s32 = __oil_function_class_clip_s32();
347 return &oil_function_class_ptr_clip_s32->func;
353 EXPORT_C void** _oil_function_class_ptr_clip_u32 () {
354 oil_function_class_ptr_clip_u32 = __oil_function_class_clip_u32();
355 return &oil_function_class_ptr_clip_u32->func;
361 EXPORT_C void** _oil_function_class_ptr_clip_f32 () {
362 oil_function_class_ptr_clip_f32 = __oil_function_class_clip_f32();
363 return &oil_function_class_ptr_clip_f32->func;
369 EXPORT_C void** _oil_function_class_ptr_clip_f64 () {
370 oil_function_class_ptr_clip_f64 = __oil_function_class_clip_f64();
371 return &oil_function_class_ptr_clip_f64->func;