os/ossrv/genericopenlibs/liboil/src/ref/recon8x8.c
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/ossrv/genericopenlibs/liboil/src/ref/recon8x8.c	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,224 @@
     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 <liboil/liboilfunction.h>
    1.37 +#include "liboil/simdpack/simdpack.h"
    1.38 +#include "liboil/liboilcolorspace.h"
    1.39 +
    1.40 +#ifdef __SYMBIAN32__
    1.41 +#ifdef __WINSCW__
    1.42 +#pragma warn_unusedarg off 
    1.43 +#endif//__WINSCW__
    1.44 +#endif//__SYMBIAN32__
    1.45 +
    1.46 +/**
    1.47 + * oil_recon8x8_intra:
    1.48 + * @d_8x8:
    1.49 + * @ds:
    1.50 + * @s_8x8:
    1.51 + *
    1.52 + * Adds 128 to each value in the source array, clamps to the range [0,255],
    1.53 + * and places the result in the destination array.
    1.54 + */
    1.55 +OIL_DEFINE_CLASS (recon8x8_intra,
    1.56 +    "uint8_t *d_8x8, int ds, int16_t *s_8x8");
    1.57 +/**
    1.58 + * oil_recon8x8_inter:
    1.59 + * @d_8x8:
    1.60 + * @ds:
    1.61 + * @s1_8x8:
    1.62 + * @ss1:
    1.63 + * @s2_8x8:
    1.64 + *
    1.65 + * Adds each element in @s1_8x8 and @s2_8x8, clamps to the range [0,255],
    1.66 + * and places the result in the destination array.
    1.67 + */
    1.68 +OIL_DEFINE_CLASS (recon8x8_inter,
    1.69 +    "uint8_t *d_8x8, int ds, uint8_t *s1_8x8, int ss1, int16_t *s2_8x8");
    1.70 +/**
    1.71 + * oil_recon8x8_inter2:
    1.72 + * @d_8x8:
    1.73 + * @ds:
    1.74 + * @s1_8x8:
    1.75 + * @ss1:
    1.76 + * @s2_8x8:
    1.77 + * @ss2:
    1.78 + * @s3_8x8:
    1.79 + *
    1.80 + * Adds each element in @s1_8x8 and @s2_8x8, divides by 2, and adds
    1.81 + * to @s3_8x8, clamps to the range [0,255], and places the result in
    1.82 + * the destination array.
    1.83 + */
    1.84 +OIL_DEFINE_CLASS (recon8x8_inter2,
    1.85 +    "uint8_t *d_8x8, int ds, uint8_t *s1_8x8, int ss1, uint8_t *s2_8x8, int ss2, int16_t *s3_8x8");
    1.86 +
    1.87 +
    1.88 +static void
    1.89 +recon8x8_intra_ref (uint8_t *dest, int ds, int16_t *change)
    1.90 +{
    1.91 +  uint32_t i;
    1.92 +
    1.93 +  for (i = 8; i; i--){
    1.94 +    dest[0] = oil_clamp_255(change[0] + 128);
    1.95 +    dest[1] = oil_clamp_255(change[1] + 128);
    1.96 +    dest[2] = oil_clamp_255(change[2] + 128);
    1.97 +    dest[3] = oil_clamp_255(change[3] + 128);
    1.98 +    dest[4] = oil_clamp_255(change[4] + 128);
    1.99 +    dest[5] = oil_clamp_255(change[5] + 128);
   1.100 +    dest[6] = oil_clamp_255(change[6] + 128);
   1.101 +    dest[7] = oil_clamp_255(change[7] + 128);
   1.102 +
   1.103 +    dest += ds;
   1.104 +    change += 8;
   1.105 +  }
   1.106 +}
   1.107 +
   1.108 +OIL_DEFINE_IMPL_REF (recon8x8_intra_ref, recon8x8_intra);
   1.109 +
   1.110 +static void
   1.111 +recon8x8_inter_ref (uint8_t *dest, int ds, uint8_t *src, int ss, int16_t *change, int dss)
   1.112 +{
   1.113 +  uint32_t i;
   1.114 +
   1.115 +  for (i = 8; i; i--){
   1.116 +    dest[0] = oil_clamp_255(src[0] + change[0]);
   1.117 +    dest[1] = oil_clamp_255(src[1] + change[1]);
   1.118 +    dest[2] = oil_clamp_255(src[2] + change[2]);
   1.119 +    dest[3] = oil_clamp_255(src[3] + change[3]);
   1.120 +    dest[4] = oil_clamp_255(src[4] + change[4]);
   1.121 +    dest[5] = oil_clamp_255(src[5] + change[5]);
   1.122 +    dest[6] = oil_clamp_255(src[6] + change[6]);
   1.123 +    dest[7] = oil_clamp_255(src[7] + change[7]);
   1.124 +
   1.125 +    change += 8;
   1.126 +    dest += ds;
   1.127 +    src += ss;
   1.128 +  }
   1.129 +}
   1.130 +
   1.131 +OIL_DEFINE_IMPL_REF (recon8x8_inter_ref, recon8x8_inter);
   1.132 +
   1.133 +static void
   1.134 +recon8x8_inter2_ref (uint8_t *dest, int ds, uint8_t *s1, int ss1, uint8_t *s2, int ss2, int16_t *change)
   1.135 +{
   1.136 +  uint32_t  i;
   1.137 +
   1.138 +  for (i = 8; i; i--){
   1.139 +    dest[0] = oil_clamp_255((((int16_t)s1[0] + (int16_t)s2[0]) >> 1) + change[0]);
   1.140 +    dest[1] = oil_clamp_255((((int16_t)s1[1] + (int16_t)s2[1]) >> 1) + change[1]);
   1.141 +    dest[2] = oil_clamp_255((((int16_t)s1[2] + (int16_t)s2[2]) >> 1) + change[2]);
   1.142 +    dest[3] = oil_clamp_255((((int16_t)s1[3] + (int16_t)s2[3]) >> 1) + change[3]);
   1.143 +    dest[4] = oil_clamp_255((((int16_t)s1[4] + (int16_t)s2[4]) >> 1) + change[4]);
   1.144 +    dest[5] = oil_clamp_255((((int16_t)s1[5] + (int16_t)s2[5]) >> 1) + change[5]);
   1.145 +    dest[6] = oil_clamp_255((((int16_t)s1[6] + (int16_t)s2[6]) >> 1) + change[6]);
   1.146 +    dest[7] = oil_clamp_255((((int16_t)s1[7] + (int16_t)s2[7]) >> 1) + change[7]);
   1.147 +
   1.148 +    change += 8;
   1.149 +    dest += ds;
   1.150 +    s1 += ss1;
   1.151 +    s2 += ss2;
   1.152 +  }
   1.153 +}
   1.154 +
   1.155 +OIL_DEFINE_IMPL_REF (recon8x8_inter2_ref, recon8x8_inter2);
   1.156 +
   1.157 +
   1.158 +#ifdef	__SYMBIAN32__
   1.159 + 
   1.160 +OilFunctionClass* __oil_function_class_recon8x8_intra() {
   1.161 +		return &_oil_function_class_recon8x8_intra;
   1.162 +}
   1.163 +#endif
   1.164 +
   1.165 +#ifdef	__SYMBIAN32__
   1.166 + 
   1.167 +OilFunctionClass* __oil_function_class_recon8x8_inter() {
   1.168 +		return &_oil_function_class_recon8x8_inter;
   1.169 +}
   1.170 +#endif
   1.171 +
   1.172 +#ifdef	__SYMBIAN32__
   1.173 + 
   1.174 +OilFunctionClass* __oil_function_class_recon8x8_inter2() {
   1.175 +		return &_oil_function_class_recon8x8_inter2;
   1.176 +}
   1.177 +#endif
   1.178 +
   1.179 +
   1.180 +
   1.181 +#ifdef	__SYMBIAN32__
   1.182 + 
   1.183 +OilFunctionImpl* __oil_function_impl_recon8x8_intra_ref() {
   1.184 +		return &_oil_function_impl_recon8x8_intra_ref;
   1.185 +}
   1.186 +#endif
   1.187 +
   1.188 +#ifdef	__SYMBIAN32__
   1.189 + 
   1.190 +OilFunctionImpl* __oil_function_impl_recon8x8_inter_ref() {
   1.191 +		return &_oil_function_impl_recon8x8_inter_ref;
   1.192 +}
   1.193 +#endif
   1.194 +
   1.195 +#ifdef	__SYMBIAN32__
   1.196 + 
   1.197 +OilFunctionImpl* __oil_function_impl_recon8x8_inter2_ref() {
   1.198 +		return &_oil_function_impl_recon8x8_inter2_ref;
   1.199 +}
   1.200 +#endif
   1.201 +
   1.202 +
   1.203 +
   1.204 +#ifdef	__SYMBIAN32__
   1.205 + 
   1.206 +EXPORT_C void** _oil_function_class_ptr_recon8x8_intra ()	{
   1.207 +	oil_function_class_ptr_recon8x8_intra = __oil_function_class_recon8x8_intra();
   1.208 +	return &oil_function_class_ptr_recon8x8_intra->func;
   1.209 +	}
   1.210 +#endif
   1.211 +
   1.212 +#ifdef	__SYMBIAN32__
   1.213 + 
   1.214 +EXPORT_C void** _oil_function_class_ptr_recon8x8_inter ()	{
   1.215 +	oil_function_class_ptr_recon8x8_inter = __oil_function_class_recon8x8_inter();
   1.216 +	return &oil_function_class_ptr_recon8x8_inter->func;
   1.217 +	}
   1.218 +#endif
   1.219 +
   1.220 +#ifdef	__SYMBIAN32__
   1.221 + 
   1.222 +EXPORT_C void** _oil_function_class_ptr_recon8x8_inter2 ()	{
   1.223 +	oil_function_class_ptr_recon8x8_inter2 = __oil_function_class_recon8x8_inter2();
   1.224 +	return &oil_function_class_ptr_recon8x8_inter2->func;
   1.225 +	}
   1.226 +#endif
   1.227 +