os/ossrv/genericopenlibs/liboil/src/deprecated/clip_ref_c_dep.c
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
     1 /*
     2  * LIBOIL - Library of Optimized Inner Loops
     3  * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
     4  * All rights reserved.
     5  *
     6  * Redistribution and use in source and binary forms, with or without
     7  * modification, are permitted provided that the following conditions
     8  * are met:
     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.
    14  * 
    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.
    26  */
    27 //Portions Copyright (c)  2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
    28 
    29 #ifdef HAVE_CONFIG_H
    30 #include "config.h"
    31 #endif
    32 
    33 #include "liboil/liboilfunction.h"
    34 #include "liboil/liboiltest.h"
    35 
    36 /**
    37  * SECTION:liboilfuncs-doc:
    38  * @title: Miscellaneous
    39  * @short_description: Miscellaneous functions
    40  */
    41 #define CLIP_DEFINE_REF(type) \
    42 static void clip_ ## type ## _ref ( \
    43     oil_type_ ## type *dest, \
    44     int dstr, \
    45     oil_type_ ## type *src, \
    46     int sstr, int n, \
    47     oil_type_ ## type *min, oil_type_ ## type *max) \
    48 { \
    49   int i; \
    50   oil_type_ ## type x; \
    51   for(i=0;i<n;i++){ \
    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; \
    56   } \
    57 } \
    58 static void clip_ ## type ## _test (OilTest *test) \
    59 { \
    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); \
    64   if (*lo > *hi) { \
    65     oil_type_ ## type tmp; \
    66     tmp = *lo; \
    67     *lo = *hi; \
    68     *hi = tmp; \
    69   } \
    70 } \
    71 OIL_DEFINE_CLASS_FULL(clip_ ## type, \
    72     "oil_type_" #type " *dest, " \
    73     "int dstr, " \
    74     "oil_type_" #type " *src, " \
    75     "int sstr, int n, " \
    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)
    79 
    80 CLIP_DEFINE_REF (s8);
    81 CLIP_DEFINE_REF (u8);
    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);
    88 
    89 #ifdef	__SYMBIAN32__
    90  
    91 OilFunctionClass* __oil_function_class_clip_u8() {
    92         return &_oil_function_class_clip_u8;
    93 }
    94 #endif
    95 
    96 #ifdef	__SYMBIAN32__
    97  
    98 OilFunctionClass* __oil_function_class_clip_s8() {
    99         return &_oil_function_class_clip_s8;
   100 }
   101 #endif
   102 
   103 #ifdef	__SYMBIAN32__
   104  
   105 OilFunctionClass* __oil_function_class_clip_s16() {
   106         return &_oil_function_class_clip_s16;
   107 }
   108 #endif
   109 #ifdef	__SYMBIAN32__
   110  
   111 OilFunctionClass* __oil_function_class_clip_u16() {
   112         return &_oil_function_class_clip_u16;
   113 }
   114 #endif
   115 #ifdef	__SYMBIAN32__
   116  
   117 OilFunctionClass* __oil_function_class_clip_s32() {
   118         return &_oil_function_class_clip_s32;
   119 }
   120 #endif
   121 #ifdef	__SYMBIAN32__
   122  
   123 OilFunctionClass* __oil_function_class_clip_u32() {
   124         return &_oil_function_class_clip_u32;
   125 }
   126 #endif
   127 #ifdef	__SYMBIAN32__
   128  
   129 OilFunctionClass* __oil_function_class_clip_f32() {
   130         return &_oil_function_class_clip_f32;
   131 }
   132 #endif
   133 #ifdef	__SYMBIAN32__
   134  
   135 OilFunctionClass* __oil_function_class_clip_f64() {
   136         return &_oil_function_class_clip_f64;
   137 }
   138 #endif
   139 /**
   140  * oil_clip_s8:
   141  * @dest:
   142  * @dstr:
   143  * @src:
   144  * @sstr:
   145  * @n:
   146  * @s2_1:
   147  * @s3_1:
   148  *
   149  * Clips each value in @src to the range [@s2_1,@s3_1] and places
   150  * the result in @dest.
   151  */
   152 
   153 /**
   154  * oil_clip_u8:
   155  * @dest:
   156  * @dstr:
   157  * @src:
   158  * @sstr:
   159  * @n:
   160  * @s2_1:
   161  * @s3_1:
   162  *
   163  * Clips each value in @src to the range [@s2_1,@s3_1] and places
   164  * the result in @dest.
   165  */
   166 
   167 /**
   168  * oil_clip_s16:
   169  * @dest:
   170  * @dstr:
   171  * @src:
   172  * @sstr:
   173  * @n:
   174  * @s2_1:
   175  * @s3_1:
   176  *
   177  * Clips each value in @src to the range [@s2_1,@s3_1] and places
   178  * the result in @dest.
   179  */
   180 
   181 /**
   182  * oil_clip_u16:
   183  * @dest:
   184  * @dstr:
   185  * @src:
   186  * @sstr:
   187  * @n:
   188  * @s2_1:
   189  * @s3_1:
   190  *
   191  * Clips each value in @src to the range [@s2_1,@s3_1] and places
   192  * the result in @dest.
   193  */
   194 
   195 /**
   196  * oil_clip_s32:
   197  * @dest:
   198  * @dstr:
   199  * @src:
   200  * @sstr:
   201  * @n:
   202  * @s2_1:
   203  * @s3_1:
   204  *
   205  * Clips each value in @src to the range [@s2_1,@s3_1] and places
   206  * the result in @dest.
   207  */
   208 
   209 /**
   210  * oil_clip_u32:
   211  * @dest:
   212  * @dstr:
   213  * @src:
   214  * @sstr:
   215  * @n:
   216  * @s2_1:
   217  * @s3_1:
   218  *
   219  * Clips each value in @src to the range [@s2_1,@s3_1] and places
   220  * the result in @dest.
   221  */
   222 
   223 /**
   224  * oil_clip_f32:
   225  * @dest:
   226  * @dstr:
   227  * @src:
   228  * @sstr:
   229  * @n:
   230  * @s2_1:
   231  * @s3_1:
   232  *
   233  * Clips each value in @src to the range [@s2_1,@s3_1] and places
   234  * the result in @dest.
   235  */
   236 
   237 /**
   238  * oil_clip_f64:
   239  * @dest:
   240  * @dstr:
   241  * @src:
   242  * @sstr:
   243  * @n:
   244  * @s2_1:
   245  * @s3_1:
   246  *
   247  * Clips each value in @src to the range [@s2_1,@s3_1] and places
   248  * the result in @dest.
   249  */
   250 
   251 
   252 
   253 #ifdef	__SYMBIAN32__
   254  
   255 OilFunctionImpl* __oil_function_impl_clip_s8_ref() {
   256 		return &_oil_function_impl_clip_s8_ref;
   257 }
   258 #endif
   259 
   260 #ifdef	__SYMBIAN32__
   261  
   262 OilFunctionImpl* __oil_function_impl_clip_u8_ref() {
   263 		return &_oil_function_impl_clip_u8_ref;
   264 }
   265 #endif
   266 
   267 #ifdef	__SYMBIAN32__
   268  
   269 OilFunctionImpl* __oil_function_impl_clip_s16_ref() {
   270 		return &_oil_function_impl_clip_s16_ref;
   271 }
   272 #endif
   273 
   274 #ifdef	__SYMBIAN32__
   275  
   276 OilFunctionImpl* __oil_function_impl_clip_u16_ref() {
   277 		return &_oil_function_impl_clip_u16_ref;
   278 }
   279 #endif
   280 
   281 #ifdef	__SYMBIAN32__
   282  
   283 OilFunctionImpl* __oil_function_impl_clip_s32_ref() {
   284 		return &_oil_function_impl_clip_s32_ref;
   285 }
   286 #endif
   287 
   288 #ifdef	__SYMBIAN32__
   289  
   290 OilFunctionImpl* __oil_function_impl_clip_u32_ref() {
   291 		return &_oil_function_impl_clip_u32_ref;
   292 }
   293 #endif
   294 
   295 #ifdef	__SYMBIAN32__
   296  
   297 OilFunctionImpl* __oil_function_impl_clip_f32_ref() {
   298 		return &_oil_function_impl_clip_f32_ref;
   299 }
   300 #endif
   301 
   302 #ifdef	__SYMBIAN32__
   303  
   304 OilFunctionImpl* __oil_function_impl_clip_f64_ref() {
   305 		return &_oil_function_impl_clip_f64_ref;
   306 }
   307 #endif
   308 
   309 
   310 
   311 #ifdef	__SYMBIAN32__
   312  
   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;
   316 	}
   317 #endif
   318 
   319 #ifdef	__SYMBIAN32__
   320  
   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;
   324 	}
   325 #endif
   326 
   327 #ifdef	__SYMBIAN32__
   328  
   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;
   332 	}
   333 #endif
   334 
   335 #ifdef	__SYMBIAN32__
   336  
   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;
   340 	}
   341 #endif
   342 
   343 #ifdef	__SYMBIAN32__
   344  
   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;
   348 	}
   349 #endif
   350 
   351 #ifdef	__SYMBIAN32__
   352  
   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;
   356 	}
   357 #endif
   358 
   359 #ifdef	__SYMBIAN32__
   360  
   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;
   364 	}
   365 #endif
   366 
   367 #ifdef	__SYMBIAN32__
   368  
   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;
   372 	}
   373 #endif
   374