Update contrib.
2 * LIBOIL - Library of Optimized Inner Loops
3 * Copyright (c) 2001,2002,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.
32 #include <liboil/liboil.h>
38 * oil_conv8x8_s16_f64:
44 * Converts elements in source array @s_8x8 to the destination
45 * type, placing the results in @d_8x8.
47 OIL_DEFINE_CLASS (conv8x8_s16_f64,
48 "int16_t * d_8x8, int dstr, double *s_8x8, int sstr");
50 * oil_conv8x8_f64_s16:
56 * Converts elements in source array @s_8x8 to the destination
57 * type, placing the results in @d_8x8. The conversion of source
58 * values outside the destination range are undefined and
59 * implementation dependent.
61 OIL_DEFINE_CLASS (conv8x8_f64_s16,
62 "double *d_8x8, int dstr, int16_t * s_8x8, int sstr");
64 * oil_clipconv8x8_u8_s16:
70 * Converts elements in source array @s_8x8 to the destination
71 * type, placing the results in @d_8x8. Source values outside
72 * the destination range are clipped to the destination range.
74 OIL_DEFINE_CLASS (clipconv8x8_u8_s16,
75 "uint8_t * d_8x8, int dstr, int16_t * s_8x8, int sstr");
77 #define BLOCK8x8_F64(ptr, stride, row, column) \
78 (*((double *)((unsigned char *)ptr + stride*row) + column))
80 #define BLOCK8x8_PTR_F64(ptr, stride, row, column) \
81 ((double *)((unsigned char *)ptr + stride*row) + column)
83 #define BLOCK8x8_S16(ptr, stride, row, column) \
84 (*((int16_t *)((unsigned char *)ptr + stride*row) + column))
86 #define BLOCK8x8_U8(ptr, stride, row, column) \
87 (*((uint8_t *)((unsigned char *)ptr + stride*row) + column))
91 conv8x8_s16_f64_c (int16_t * dest, int dstr, double *src, int sstr)
95 for (i = 0; i < 8; i++) {
96 for (j = 0; j < 8; j++) {
97 BLOCK8x8_S16 (dest, dstr, i, j) = floor (0.5 + BLOCK8x8_F64 (src, sstr, i, j));
102 OIL_DEFINE_IMPL_REF (conv8x8_s16_f64_c, conv8x8_s16_f64);
105 conv8x8_f64_s16_c (double *dest, int dstr, int16_t * src, int sstr)
109 for (i = 0; i < 8; i++) {
110 for (j = 0; j < 8; j++) {
111 BLOCK8x8_F64 (dest, dstr, i, j) = BLOCK8x8_S16 (src, sstr, i, j);
116 OIL_DEFINE_IMPL_REF (conv8x8_f64_s16_c, conv8x8_f64_s16);
119 clipconv8x8_u8_s16_c (uint8_t * dest, int dstr, int16_t * src, int sstr)
124 for (i = 0; i < 8; i++) {
125 for (j = 0; j < 8; j++) {
126 x = BLOCK8x8_S16 (src, sstr, i, j);
131 BLOCK8x8_U8 (dest, dstr, i, j) = x;
136 OIL_DEFINE_IMPL_REF (clipconv8x8_u8_s16_c, clipconv8x8_u8_s16);
141 OilFunctionClass* __oil_function_class_conv8x8_s16_f64() {
142 return &_oil_function_class_conv8x8_s16_f64;
148 OilFunctionClass* __oil_function_class_conv8x8_f64_s16() {
149 return &_oil_function_class_conv8x8_f64_s16;
155 OilFunctionClass* __oil_function_class_clipconv8x8_u8_s16() {
156 return &_oil_function_class_clipconv8x8_u8_s16;
164 OilFunctionImpl* __oil_function_impl_conv8x8_s16_f64_c() {
165 return &_oil_function_impl_conv8x8_s16_f64_c;
171 OilFunctionImpl* __oil_function_impl_conv8x8_f64_s16_c() {
172 return &_oil_function_impl_conv8x8_f64_s16_c;
178 OilFunctionImpl* __oil_function_impl_clipconv8x8_u8_s16_c() {
179 return &_oil_function_impl_clipconv8x8_u8_s16_c;
187 EXPORT_C void** _oil_function_class_ptr_conv8x8_s16_f64 () {
188 oil_function_class_ptr_conv8x8_s16_f64 = __oil_function_class_conv8x8_s16_f64();
189 return &oil_function_class_ptr_conv8x8_s16_f64->func;
195 EXPORT_C void** _oil_function_class_ptr_conv8x8_f64_s16 () {
196 oil_function_class_ptr_conv8x8_f64_s16 = __oil_function_class_conv8x8_f64_s16();
197 return &oil_function_class_ptr_conv8x8_f64_s16->func;
203 EXPORT_C void** _oil_function_class_ptr_clipconv8x8_u8_s16 () {
204 oil_function_class_ptr_clipconv8x8_u8_s16 = __oil_function_class_clipconv8x8_u8_s16();
205 return &oil_function_class_ptr_clipconv8x8_u8_s16->func;