1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/ossrv/genericopenlibs/liboil/src/diff8x8.c Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,227 @@
1.4 +/*
1.5 + * LIBOIL - Library of Optimized Inner Loops
1.6 + * Copyright (c) 2003,2004 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 <liboilfunction.h>
1.37 +
1.38 +/**
1.39 + * oil_diff8x8_s16_u8:
1.40 + * @d_8x8:
1.41 + * @s1_8x8:
1.42 + * @ss1:
1.43 + * @s2_8x8:
1.44 + * @ss2:
1.45 + *
1.46 + * Calculates the difference of each value in @s1_8x8 and @s2_8x8
1.47 + * and places the result in @d_8x8. Note that the destination type
1.48 + * is larger than the source type.
1.49 + */
1.50 +OIL_DEFINE_CLASS (diff8x8_s16_u8,
1.51 + "int16_t *d_8x8, uint8_t *s1_8x8, int ss1, uint8_t *s2_8x8, int ss2");
1.52 +/**
1.53 + * oil_diff8x8_const128_s16_u8:
1.54 + * @d_8x8:
1.55 + * @s1_8x8:
1.56 + * @ss1:
1.57 + *
1.58 + * Subtracts 128 from each value in @s1_8x8
1.59 + * and places the result in @d_8x8. Note that the destination type
1.60 + * is larger than the source type.
1.61 + */
1.62 +OIL_DEFINE_CLASS (diff8x8_const128_s16_u8,
1.63 + "int16_t *d_8x8, uint8_t *s1_8x8, int ss1");
1.64 +/**
1.65 + * oil_diff8x8_average_s16_u8:
1.66 + * @d_8x8:
1.67 + * @s1_8x8:
1.68 + * @ss1:
1.69 + * @s2_8x8:
1.70 + * @ss2:
1.71 + * @s3_8x8:
1.72 + * @ss3:
1.73 + *
1.74 + * Calculates the difference of each value in @s1_8x8 and the
1.75 + * average of @s2_8x8 and @s3_8x8,
1.76 + * and places the result in @d_8x8. Note that the destination type
1.77 + * is larger than the source type.
1.78 + */
1.79 +OIL_DEFINE_CLASS (diff8x8_average_s16_u8,
1.80 + "int16_t *d_8x8, uint8_t *s1_8x8, int ss1, uint8_t *s2_8x8, int ss2, uint8_t *s3_8x8, int ss3");
1.81 +
1.82 +static void
1.83 +diff8x8_s16_u8_ref (int16_t *dest, uint8_t *src1, int ss1, uint8_t *src2, int ss2)
1.84 +{
1.85 + int i;
1.86 +
1.87 + /* For each block row */
1.88 + for (i=0;i<8;i++ ){
1.89 + dest[0] = ((int16_t)src1[0]) - ((int16_t)src2[0]);
1.90 + dest[1] = ((int16_t)src1[1]) - ((int16_t)src2[1]);
1.91 + dest[2] = ((int16_t)src1[2]) - ((int16_t)src2[2]);
1.92 + dest[3] = ((int16_t)src1[3]) - ((int16_t)src2[3]);
1.93 + dest[4] = ((int16_t)src1[4]) - ((int16_t)src2[4]);
1.94 + dest[5] = ((int16_t)src1[5]) - ((int16_t)src2[5]);
1.95 + dest[6] = ((int16_t)src1[6]) - ((int16_t)src2[6]);
1.96 + dest[7] = ((int16_t)src1[7]) - ((int16_t)src2[7]);
1.97 +
1.98 + /* Start next row */
1.99 + src1 += ss1;
1.100 + src2 += ss2;
1.101 + dest += 8;
1.102 + }
1.103 +}
1.104 +OIL_DEFINE_IMPL_REF (diff8x8_s16_u8_ref, diff8x8_s16_u8);
1.105 +
1.106 +static void
1.107 +diff8x8_const128_s16_u8_ref (int16_t *dest, uint8_t *src1, int ss1)
1.108 +{
1.109 + int i;
1.110 +
1.111 + /* For each block row */
1.112 + for (i=0;i<8;i++ ){
1.113 + dest[0] = ((int16_t)src1[0]) - 128;
1.114 + dest[1] = ((int16_t)src1[1]) - 128;
1.115 + dest[2] = ((int16_t)src1[2]) - 128;
1.116 + dest[3] = ((int16_t)src1[3]) - 128;
1.117 + dest[4] = ((int16_t)src1[4]) - 128;
1.118 + dest[5] = ((int16_t)src1[5]) - 128;
1.119 + dest[6] = ((int16_t)src1[6]) - 128;
1.120 + dest[7] = ((int16_t)src1[7]) - 128;
1.121 +
1.122 + /* Start next row */
1.123 + src1 += ss1;
1.124 + dest += 8;
1.125 + }
1.126 +}
1.127 +OIL_DEFINE_IMPL_REF (diff8x8_const128_s16_u8_ref, diff8x8_const128_s16_u8);
1.128 +
1.129 +static void
1.130 +diff8x8_average_s16_u8_ref (int16_t *dest, uint8_t *src1, int ss1, uint8_t *src2, int ss2, uint8_t *src3, int ss3)
1.131 +{
1.132 + int i;
1.133 +
1.134 + /* For each block row */
1.135 + for (i=0;i<8;i++ ){
1.136 + dest[0] = ((int16_t)src1[0]) - ((((int16_t)src2[0]) + ((int16_t)src3[0])) / 2);
1.137 + dest[1] = ((int16_t)src1[1]) - ((((int16_t)src2[1]) + ((int16_t)src3[1])) / 2);
1.138 + dest[2] = ((int16_t)src1[2]) - ((((int16_t)src2[2]) + ((int16_t)src3[2])) / 2);
1.139 + dest[3] = ((int16_t)src1[3]) - ((((int16_t)src2[3]) + ((int16_t)src3[3])) / 2);
1.140 + dest[4] = ((int16_t)src1[4]) - ((((int16_t)src2[4]) + ((int16_t)src3[4])) / 2);
1.141 + dest[5] = ((int16_t)src1[5]) - ((((int16_t)src2[5]) + ((int16_t)src3[5])) / 2);
1.142 + dest[6] = ((int16_t)src1[6]) - ((((int16_t)src2[6]) + ((int16_t)src3[6])) / 2);
1.143 + dest[7] = ((int16_t)src1[7]) - ((((int16_t)src2[7]) + ((int16_t)src3[7])) / 2);
1.144 +
1.145 + /* Start next row */
1.146 + src1 += ss1;
1.147 + src2 += ss2;
1.148 + src3 += ss3;
1.149 + dest += 8;
1.150 + }
1.151 +}
1.152 +OIL_DEFINE_IMPL_REF (diff8x8_average_s16_u8_ref, diff8x8_average_s16_u8);
1.153 +
1.154 +
1.155 +
1.156 +
1.157 +
1.158 +
1.159 +
1.160 +
1.161 +#ifdef __SYMBIAN32__
1.162 +
1.163 +OilFunctionClass* __oil_function_class_diff8x8_s16_u8() {
1.164 + return &_oil_function_class_diff8x8_s16_u8;
1.165 +}
1.166 +#endif
1.167 +
1.168 +#ifdef __SYMBIAN32__
1.169 +
1.170 +OilFunctionClass* __oil_function_class_diff8x8_const128_s16_u8() {
1.171 + return &_oil_function_class_diff8x8_const128_s16_u8;
1.172 +}
1.173 +#endif
1.174 +
1.175 +#ifdef __SYMBIAN32__
1.176 +
1.177 +OilFunctionClass* __oil_function_class_diff8x8_average_s16_u8() {
1.178 + return &_oil_function_class_diff8x8_average_s16_u8;
1.179 +}
1.180 +#endif
1.181 +
1.182 +
1.183 +
1.184 +#ifdef __SYMBIAN32__
1.185 +
1.186 +OilFunctionImpl* __oil_function_impl_diff8x8_s16_u8_ref() {
1.187 + return &_oil_function_impl_diff8x8_s16_u8_ref;
1.188 +}
1.189 +#endif
1.190 +
1.191 +#ifdef __SYMBIAN32__
1.192 +
1.193 +OilFunctionImpl* __oil_function_impl_diff8x8_const128_s16_u8_ref() {
1.194 + return &_oil_function_impl_diff8x8_const128_s16_u8_ref;
1.195 +}
1.196 +#endif
1.197 +
1.198 +#ifdef __SYMBIAN32__
1.199 +
1.200 +OilFunctionImpl* __oil_function_impl_diff8x8_average_s16_u8_ref() {
1.201 + return &_oil_function_impl_diff8x8_average_s16_u8_ref;
1.202 +}
1.203 +#endif
1.204 +
1.205 +
1.206 +
1.207 +#ifdef __SYMBIAN32__
1.208 +
1.209 +EXPORT_C void** _oil_function_class_ptr_diff8x8_s16_u8 () {
1.210 + oil_function_class_ptr_diff8x8_s16_u8 = __oil_function_class_diff8x8_s16_u8();
1.211 + return &oil_function_class_ptr_diff8x8_s16_u8->func;
1.212 + }
1.213 +#endif
1.214 +
1.215 +#ifdef __SYMBIAN32__
1.216 +
1.217 +EXPORT_C void** _oil_function_class_ptr_diff8x8_const128_s16_u8 () {
1.218 + oil_function_class_ptr_diff8x8_const128_s16_u8 = __oil_function_class_diff8x8_const128_s16_u8();
1.219 + return &oil_function_class_ptr_diff8x8_const128_s16_u8->func;
1.220 + }
1.221 +#endif
1.222 +
1.223 +#ifdef __SYMBIAN32__
1.224 +
1.225 +EXPORT_C void** _oil_function_class_ptr_diff8x8_average_s16_u8 () {
1.226 + oil_function_class_ptr_diff8x8_average_s16_u8 = __oil_function_class_diff8x8_average_s16_u8();
1.227 + return &oil_function_class_ptr_diff8x8_average_s16_u8->func;
1.228 + }
1.229 +#endif
1.230 +