1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/liboil/src/deprecated/abs_c_dep.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,294 @@
1.4 +/*
1.5 + * LIBOIL - Library of Optimized Inner Loops
1.6 + * Copyright (c) 2003 David A. Schleef <ds@schleef.org>
1.7 + * All rights reserved.
1.8 + *
1.9 + * Redistribution and use in source and binary forms, with or without
1.10 + * modification, are permitted provided that the following conditions
1.11 + * are met:
1.12 + * 1. Redistributions of source code must retain the above copyright
1.13 + * notice, this list of conditions and the following disclaimer.
1.14 + * 2. Redistributions in binary form must reproduce the above copyright
1.15 + * notice, this list of conditions and the following disclaimer in the
1.16 + * documentation and/or other materials provided with the distribution.
1.17 + *
1.18 + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1.19 + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1.20 + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1.21 + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
1.22 + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1.23 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
1.24 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
1.25 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
1.26 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
1.27 + * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
1.28 + * POSSIBILITY OF SUCH DAMAGE.
1.29 + */
1.30 +//Portions Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
1.31 +
1.32 +#ifdef HAVE_CONFIG_H
1.33 +#include "config.h"
1.34 +#endif
1.35 +
1.36 +//#include "liboil_wsd_solutions.h"
1.37 +#include "liboil/liboilfunction.h"
1.38 +#include "liboil/simdpack/simdpack.h"
1.39 +#include <math.h>
1.40 +
1.41 +/*
1.42 +#if EMULATOR
1.43 +GET_GLOBAL_VAR_FROM_TLS(_class,abs_f32_f32,OilFunctionClass)
1.44 +#define _oil_function_class_abs_f32_f32 (*GET_OIL_WSD_VAR_NAME(_class,abs_f32_f32,g)())
1.45 +#else
1.46 +OIL_DEFINE_CLASS (abs_f32_f32, "float *dest, int dstr, float *src, int sstr, int n");
1.47 +#endif
1.48 +*/
1.49 +
1.50 +OIL_DEFINE_CLASS (abs_u8_s8, "uint8_t *dest, int dstr, int8_t *src, int sstr, int n");
1.51 +OIL_DEFINE_CLASS (abs_u16_s16, "uint16_t *dest, int dstr, int16_t *src, int sstr, int n");
1.52 +OIL_DEFINE_CLASS (abs_u32_s32, "uint32_t *dest, int dstr, int32_t *src, int sstr, int n");
1.53 +OIL_DEFINE_CLASS (abs_f32_f32, "float *dest, int dstr, float *src, int sstr, int n");
1.54 +OIL_DEFINE_CLASS (abs_f64_f64, "double *dest, int dstr, double *src, int sstr, int n");
1.55 +
1.56 +
1.57 +//static void abs_test (OilFunctionClass *klass, OilFunctionImpl *impl);
1.58 +
1.59 +#define ABS(x) ((x)>0 ? (x) : -(x))
1.60 +
1.61 +
1.62 +/**
1.63 + * oil_abs_u8_s8:
1.64 + * @dest: destination array
1.65 + * @dstr: stride of destination elements
1.66 + * @src: source array
1.67 + * @sstr: stride of source elements
1.68 + * @n: number of elements in arrays
1.69 + *
1.70 + * Calculates the absolute value of each element in the source array
1.71 + * and writes it into the destination array.
1.72 + */
1.73 +static void
1.74 +abs_u8_s8_ref (uint8_t *dest, int dstr, int8_t *src, int sstr, int n)
1.75 +{
1.76 + int i;
1.77 + int x;
1.78 +
1.79 + for (i=0; i<n; i++) {
1.80 + x = OIL_GET(src, i*sstr, int8_t);
1.81 + x = ABS(x);
1.82 + OIL_GET(dest, i*dstr, uint8_t) = x;
1.83 + }
1.84 +}
1.85 +OIL_DEFINE_IMPL_REF (abs_u8_s8_ref, abs_u8_s8);
1.86 +
1.87 +#ifdef __SYMBIAN32__
1.88 +
1.89 +OilFunctionImpl* __oil_function_impl_abs_u8_s8_ref()
1.90 + {
1.91 + return &_oil_function_impl_abs_u8_s8_ref;
1.92 + }
1.93 +#endif
1.94 +/**
1.95 + * oil_abs_u16_s16:
1.96 + * @dest: destination array
1.97 + * @dstr: stride of destination elements
1.98 + * @src: source array
1.99 + * @sstr: stride of source elements
1.100 + * @n: number of elements in arrays
1.101 + *
1.102 + * Calculates the absolute value of each element in the source array
1.103 + * and writes it into the destination array.
1.104 + */
1.105 +static void
1.106 +abs_u16_s16_ref (uint16_t *dest, int dstr, int16_t *src, int sstr, int n)
1.107 +{
1.108 + int i;
1.109 + int x;
1.110 +
1.111 + for (i=0; i<n; i++) {
1.112 + x = OIL_GET(src, i*sstr, int16_t);
1.113 + x = ABS(x);
1.114 + OIL_GET(dest, i*dstr, uint16_t) = x;
1.115 + }
1.116 +}
1.117 +OIL_DEFINE_IMPL_REF (abs_u16_s16_ref, abs_u16_s16);
1.118 +
1.119 +/**
1.120 + * oil_abs_u32_s32:
1.121 + * @dest: destination array
1.122 + * @dstr: stride of destination elements
1.123 + * @src: source array
1.124 + * @sstr: stride of source elements
1.125 + * @n: number of elements in arrays
1.126 + *
1.127 + * Calculates the absolute value of each element in the source array
1.128 + * and writes it into the destination array.
1.129 + */
1.130 +static void
1.131 +abs_u32_s32_ref (uint32_t *dest, int dstr, int32_t *src, int sstr, int n)
1.132 +{
1.133 + int i;
1.134 + int x;
1.135 +
1.136 + for (i=0; i<n; i++) {
1.137 + x = OIL_GET(src, i*sstr, int32_t);
1.138 + x = ABS(x);
1.139 + OIL_GET(dest, i*dstr, uint32_t) = x;
1.140 + }
1.141 +}
1.142 +OIL_DEFINE_IMPL_REF (abs_u32_s32_ref, abs_u32_s32);
1.143 +
1.144 +/**
1.145 + * oil_abs_f32_f32:
1.146 + * @dest: destination array
1.147 + * @dstr: stride of destination elements
1.148 + * @src: source array
1.149 + * @sstr: stride of source elements
1.150 + * @n: number of elements in arrays
1.151 + *
1.152 + * Calculates the absolute value of each element in the source array
1.153 + * and writes it into the destination array.
1.154 + */
1.155 +static void
1.156 +abs_f32_f32_ref (float *dest, int dstr, float *src, int sstr, int n)
1.157 +{
1.158 + int i;
1.159 +
1.160 + for (i=0; i<n; i++) {
1.161 + OIL_GET(dest, i*dstr, float) = fabs(OIL_GET(src, i*sstr, float));
1.162 + }
1.163 +}
1.164 +
1.165 +OIL_DEFINE_IMPL_REF (abs_f32_f32_ref, abs_f32_f32);
1.166 +
1.167 +
1.168 +#ifdef __SYMBIAN32__
1.169 +
1.170 +OilFunctionImpl* __oil_function_impl_abs_f32_f32_ref() {
1.171 + return &_oil_function_impl_abs_f32_f32_ref;
1.172 +}
1.173 +#endif
1.174 +
1.175 +
1.176 +/**
1.177 + * oil_abs_f64_f64:
1.178 + * @dest: destination array
1.179 + * @dstr: stride of destination elements
1.180 + * @src: source array
1.181 + * @sstr: stride of source elements
1.182 + * @n: number of elements in arrays
1.183 + *
1.184 + * Calculates the absolute value of each element in the source array
1.185 + * and writes it into the destination array.
1.186 + */
1.187 +static void
1.188 +abs_f64_f64_ref (double *dest, int dstr, double *src, int sstr, int n)
1.189 +{
1.190 + int i;
1.191 +
1.192 + for (i=0; i<n; i++) {
1.193 + OIL_GET(dest, i*dstr, double) = fabs(OIL_GET(src, i*sstr, double));
1.194 + }
1.195 +}
1.196 +
1.197 +OIL_DEFINE_IMPL_REF (abs_f64_f64_ref, abs_f64_f64);
1.198 +
1.199 +
1.200 +#ifdef __SYMBIAN32__
1.201 +
1.202 +OilFunctionClass* __oil_function_class_abs_f32_f32() {
1.203 + return &_oil_function_class_abs_f32_f32;
1.204 +}
1.205 +#endif
1.206 +
1.207 +#ifdef __SYMBIAN32__
1.208 +
1.209 +OilFunctionClass* __oil_function_class_abs_u8_s8() {
1.210 + return &_oil_function_class_abs_u8_s8;
1.211 +}
1.212 +#endif
1.213 +
1.214 +#ifdef __SYMBIAN32__
1.215 +
1.216 +OilFunctionClass* __oil_function_class_abs_u16_s16() {
1.217 + return &_oil_function_class_abs_u16_s16;
1.218 +}
1.219 +#endif
1.220 +
1.221 +#ifdef __SYMBIAN32__
1.222 +
1.223 +OilFunctionClass* __oil_function_class_abs_u32_s32() {
1.224 + return &_oil_function_class_abs_u32_s32;
1.225 +}
1.226 +#endif
1.227 +
1.228 +#ifdef __SYMBIAN32__
1.229 +
1.230 +OilFunctionClass* __oil_function_class_abs_f64_f64() {
1.231 + return &_oil_function_class_abs_f64_f64;
1.232 +}
1.233 +#endif
1.234 +
1.235 +#ifdef __SYMBIAN32__
1.236 +
1.237 +OilFunctionImpl* __oil_function_impl_abs_u16_s16_ref() {
1.238 + return &_oil_function_impl_abs_u16_s16_ref;
1.239 +}
1.240 +#endif
1.241 +
1.242 +#ifdef __SYMBIAN32__
1.243 +
1.244 +OilFunctionImpl* __oil_function_impl_abs_u32_s32_ref() {
1.245 + return &_oil_function_impl_abs_u32_s32_ref;
1.246 +}
1.247 +#endif
1.248 +
1.249 +#ifdef __SYMBIAN32__
1.250 +
1.251 +OilFunctionImpl* __oil_function_impl_abs_f64_f64_ref() {
1.252 + return &_oil_function_impl_abs_f64_f64_ref;
1.253 +}
1.254 +#endif
1.255 +
1.256 +
1.257 +
1.258 +#ifdef __SYMBIAN32__
1.259 +
1.260 +EXPORT_C void** _oil_function_class_ptr_abs_f32_f32 () {
1.261 + oil_function_class_ptr_abs_f32_f32 = __oil_function_class_abs_f32_f32();
1.262 + return &oil_function_class_ptr_abs_f32_f32->func;
1.263 + }
1.264 +#endif
1.265 +
1.266 +#ifdef __SYMBIAN32__
1.267 +
1.268 +EXPORT_C void** _oil_function_class_ptr_abs_u8_s8 () {
1.269 + oil_function_class_ptr_abs_u8_s8 = __oil_function_class_abs_u8_s8();
1.270 + return &oil_function_class_ptr_abs_u8_s8->func;
1.271 + }
1.272 +#endif
1.273 +
1.274 +#ifdef __SYMBIAN32__
1.275 +
1.276 +EXPORT_C void** _oil_function_class_ptr_abs_u16_s16 () {
1.277 + oil_function_class_ptr_abs_u16_s16 = __oil_function_class_abs_u16_s16();
1.278 + return &oil_function_class_ptr_abs_u16_s16->func;
1.279 + }
1.280 +#endif
1.281 +
1.282 +#ifdef __SYMBIAN32__
1.283 +
1.284 +EXPORT_C void** _oil_function_class_ptr_abs_u32_s32 () {
1.285 + oil_function_class_ptr_abs_u32_s32 = __oil_function_class_abs_u32_s32();
1.286 + return &oil_function_class_ptr_abs_u32_s32->func;
1.287 + }
1.288 +#endif
1.289 +
1.290 +#ifdef __SYMBIAN32__
1.291 +
1.292 +EXPORT_C void** _oil_function_class_ptr_abs_f64_f64 () {
1.293 + oil_function_class_ptr_abs_f64_f64 = __oil_function_class_abs_f64_f64();
1.294 + return &oil_function_class_ptr_abs_f64_f64->func;
1.295 + }
1.296 +#endif
1.297 +