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.
sl@0
     1
/*
sl@0
     2
 * LIBOIL - Library of Optimized Inner Loops
sl@0
     3
 * Copyright (c) 2003,2004 David A. Schleef <ds@schleef.org>
sl@0
     4
 * All rights reserved.
sl@0
     5
 *
sl@0
     6
 * Redistribution and use in source and binary forms, with or without
sl@0
     7
 * modification, are permitted provided that the following conditions
sl@0
     8
 * are met:
sl@0
     9
 * 1. Redistributions of source code must retain the above copyright
sl@0
    10
 *    notice, this list of conditions and the following disclaimer.
sl@0
    11
 * 2. Redistributions in binary form must reproduce the above copyright
sl@0
    12
 *    notice, this list of conditions and the following disclaimer in the
sl@0
    13
 *    documentation and/or other materials provided with the distribution.
sl@0
    14
 * 
sl@0
    15
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
sl@0
    16
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
sl@0
    17
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
sl@0
    18
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
sl@0
    19
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
sl@0
    20
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
sl@0
    21
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
sl@0
    22
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
sl@0
    23
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
sl@0
    24
 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
sl@0
    25
 * POSSIBILITY OF SUCH DAMAGE.
sl@0
    26
 */
sl@0
    27
//Portions Copyright (c)  2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
sl@0
    28
sl@0
    29
#ifdef HAVE_CONFIG_H
sl@0
    30
#include "config.h"
sl@0
    31
#endif
sl@0
    32
sl@0
    33
#include "liboil/liboilfunction.h"
sl@0
    34
#include "liboil/liboiltest.h"
sl@0
    35
sl@0
    36
/**
sl@0
    37
 * SECTION:liboilfuncs-doc:
sl@0
    38
 * @title: Miscellaneous
sl@0
    39
 * @short_description: Miscellaneous functions
sl@0
    40
 */
sl@0
    41
#define CLIP_DEFINE_REF(type) \
sl@0
    42
static void clip_ ## type ## _ref ( \
sl@0
    43
    oil_type_ ## type *dest, \
sl@0
    44
    int dstr, \
sl@0
    45
    oil_type_ ## type *src, \
sl@0
    46
    int sstr, int n, \
sl@0
    47
    oil_type_ ## type *min, oil_type_ ## type *max) \
sl@0
    48
{ \
sl@0
    49
  int i; \
sl@0
    50
  oil_type_ ## type x; \
sl@0
    51
  for(i=0;i<n;i++){ \
sl@0
    52
    x = OIL_GET(src,i*sstr,oil_type_ ## type); \
sl@0
    53
    if (x<*min) x = *min; \
sl@0
    54
    if (x>*max) x = *max; \
sl@0
    55
    OIL_GET(dest,i*dstr,oil_type_ ## type) = x; \
sl@0
    56
  } \
sl@0
    57
} \
sl@0
    58
static void clip_ ## type ## _test (OilTest *test) \
sl@0
    59
{ \
sl@0
    60
  oil_type_ ## type *lo = (oil_type_ ## type *) \
sl@0
    61
    oil_test_get_source_data (test, OIL_ARG_SRC2); \
sl@0
    62
  oil_type_ ## type *hi = (oil_type_ ## type *) \
sl@0
    63
    oil_test_get_source_data (test, OIL_ARG_SRC3); \
sl@0
    64
  if (*lo > *hi) { \
sl@0
    65
    oil_type_ ## type tmp; \
sl@0
    66
    tmp = *lo; \
sl@0
    67
    *lo = *hi; \
sl@0
    68
    *hi = tmp; \
sl@0
    69
  } \
sl@0
    70
} \
sl@0
    71
OIL_DEFINE_CLASS_FULL(clip_ ## type, \
sl@0
    72
    "oil_type_" #type " *dest, " \
sl@0
    73
    "int dstr, " \
sl@0
    74
    "oil_type_" #type " *src, " \
sl@0
    75
    "int sstr, int n, " \
sl@0
    76
    "oil_type_" #type " *s2_1, oil_type_" #type " *s3_1", \
sl@0
    77
    clip_ ## type ## _test); \
sl@0
    78
OIL_DEFINE_IMPL_REF(clip_ ## type ## _ref, clip_ ## type)
sl@0
    79
sl@0
    80
CLIP_DEFINE_REF (s8);
sl@0
    81
CLIP_DEFINE_REF (u8);
sl@0
    82
CLIP_DEFINE_REF (s16);
sl@0
    83
CLIP_DEFINE_REF (u16);
sl@0
    84
CLIP_DEFINE_REF (s32);
sl@0
    85
CLIP_DEFINE_REF (u32);
sl@0
    86
CLIP_DEFINE_REF (f32);
sl@0
    87
CLIP_DEFINE_REF (f64);
sl@0
    88
sl@0
    89
#ifdef	__SYMBIAN32__
sl@0
    90
 
sl@0
    91
OilFunctionClass* __oil_function_class_clip_u8() {
sl@0
    92
        return &_oil_function_class_clip_u8;
sl@0
    93
}
sl@0
    94
#endif
sl@0
    95
sl@0
    96
#ifdef	__SYMBIAN32__
sl@0
    97
 
sl@0
    98
OilFunctionClass* __oil_function_class_clip_s8() {
sl@0
    99
        return &_oil_function_class_clip_s8;
sl@0
   100
}
sl@0
   101
#endif
sl@0
   102
sl@0
   103
#ifdef	__SYMBIAN32__
sl@0
   104
 
sl@0
   105
OilFunctionClass* __oil_function_class_clip_s16() {
sl@0
   106
        return &_oil_function_class_clip_s16;
sl@0
   107
}
sl@0
   108
#endif
sl@0
   109
#ifdef	__SYMBIAN32__
sl@0
   110
 
sl@0
   111
OilFunctionClass* __oil_function_class_clip_u16() {
sl@0
   112
        return &_oil_function_class_clip_u16;
sl@0
   113
}
sl@0
   114
#endif
sl@0
   115
#ifdef	__SYMBIAN32__
sl@0
   116
 
sl@0
   117
OilFunctionClass* __oil_function_class_clip_s32() {
sl@0
   118
        return &_oil_function_class_clip_s32;
sl@0
   119
}
sl@0
   120
#endif
sl@0
   121
#ifdef	__SYMBIAN32__
sl@0
   122
 
sl@0
   123
OilFunctionClass* __oil_function_class_clip_u32() {
sl@0
   124
        return &_oil_function_class_clip_u32;
sl@0
   125
}
sl@0
   126
#endif
sl@0
   127
#ifdef	__SYMBIAN32__
sl@0
   128
 
sl@0
   129
OilFunctionClass* __oil_function_class_clip_f32() {
sl@0
   130
        return &_oil_function_class_clip_f32;
sl@0
   131
}
sl@0
   132
#endif
sl@0
   133
#ifdef	__SYMBIAN32__
sl@0
   134
 
sl@0
   135
OilFunctionClass* __oil_function_class_clip_f64() {
sl@0
   136
        return &_oil_function_class_clip_f64;
sl@0
   137
}
sl@0
   138
#endif
sl@0
   139
/**
sl@0
   140
 * oil_clip_s8:
sl@0
   141
 * @dest:
sl@0
   142
 * @dstr:
sl@0
   143
 * @src:
sl@0
   144
 * @sstr:
sl@0
   145
 * @n:
sl@0
   146
 * @s2_1:
sl@0
   147
 * @s3_1:
sl@0
   148
 *
sl@0
   149
 * Clips each value in @src to the range [@s2_1,@s3_1] and places
sl@0
   150
 * the result in @dest.
sl@0
   151
 */
sl@0
   152
sl@0
   153
/**
sl@0
   154
 * oil_clip_u8:
sl@0
   155
 * @dest:
sl@0
   156
 * @dstr:
sl@0
   157
 * @src:
sl@0
   158
 * @sstr:
sl@0
   159
 * @n:
sl@0
   160
 * @s2_1:
sl@0
   161
 * @s3_1:
sl@0
   162
 *
sl@0
   163
 * Clips each value in @src to the range [@s2_1,@s3_1] and places
sl@0
   164
 * the result in @dest.
sl@0
   165
 */
sl@0
   166
sl@0
   167
/**
sl@0
   168
 * oil_clip_s16:
sl@0
   169
 * @dest:
sl@0
   170
 * @dstr:
sl@0
   171
 * @src:
sl@0
   172
 * @sstr:
sl@0
   173
 * @n:
sl@0
   174
 * @s2_1:
sl@0
   175
 * @s3_1:
sl@0
   176
 *
sl@0
   177
 * Clips each value in @src to the range [@s2_1,@s3_1] and places
sl@0
   178
 * the result in @dest.
sl@0
   179
 */
sl@0
   180
sl@0
   181
/**
sl@0
   182
 * oil_clip_u16:
sl@0
   183
 * @dest:
sl@0
   184
 * @dstr:
sl@0
   185
 * @src:
sl@0
   186
 * @sstr:
sl@0
   187
 * @n:
sl@0
   188
 * @s2_1:
sl@0
   189
 * @s3_1:
sl@0
   190
 *
sl@0
   191
 * Clips each value in @src to the range [@s2_1,@s3_1] and places
sl@0
   192
 * the result in @dest.
sl@0
   193
 */
sl@0
   194
sl@0
   195
/**
sl@0
   196
 * oil_clip_s32:
sl@0
   197
 * @dest:
sl@0
   198
 * @dstr:
sl@0
   199
 * @src:
sl@0
   200
 * @sstr:
sl@0
   201
 * @n:
sl@0
   202
 * @s2_1:
sl@0
   203
 * @s3_1:
sl@0
   204
 *
sl@0
   205
 * Clips each value in @src to the range [@s2_1,@s3_1] and places
sl@0
   206
 * the result in @dest.
sl@0
   207
 */
sl@0
   208
sl@0
   209
/**
sl@0
   210
 * oil_clip_u32:
sl@0
   211
 * @dest:
sl@0
   212
 * @dstr:
sl@0
   213
 * @src:
sl@0
   214
 * @sstr:
sl@0
   215
 * @n:
sl@0
   216
 * @s2_1:
sl@0
   217
 * @s3_1:
sl@0
   218
 *
sl@0
   219
 * Clips each value in @src to the range [@s2_1,@s3_1] and places
sl@0
   220
 * the result in @dest.
sl@0
   221
 */
sl@0
   222
sl@0
   223
/**
sl@0
   224
 * oil_clip_f32:
sl@0
   225
 * @dest:
sl@0
   226
 * @dstr:
sl@0
   227
 * @src:
sl@0
   228
 * @sstr:
sl@0
   229
 * @n:
sl@0
   230
 * @s2_1:
sl@0
   231
 * @s3_1:
sl@0
   232
 *
sl@0
   233
 * Clips each value in @src to the range [@s2_1,@s3_1] and places
sl@0
   234
 * the result in @dest.
sl@0
   235
 */
sl@0
   236
sl@0
   237
/**
sl@0
   238
 * oil_clip_f64:
sl@0
   239
 * @dest:
sl@0
   240
 * @dstr:
sl@0
   241
 * @src:
sl@0
   242
 * @sstr:
sl@0
   243
 * @n:
sl@0
   244
 * @s2_1:
sl@0
   245
 * @s3_1:
sl@0
   246
 *
sl@0
   247
 * Clips each value in @src to the range [@s2_1,@s3_1] and places
sl@0
   248
 * the result in @dest.
sl@0
   249
 */
sl@0
   250
sl@0
   251
sl@0
   252
sl@0
   253
#ifdef	__SYMBIAN32__
sl@0
   254
 
sl@0
   255
OilFunctionImpl* __oil_function_impl_clip_s8_ref() {
sl@0
   256
		return &_oil_function_impl_clip_s8_ref;
sl@0
   257
}
sl@0
   258
#endif
sl@0
   259
sl@0
   260
#ifdef	__SYMBIAN32__
sl@0
   261
 
sl@0
   262
OilFunctionImpl* __oil_function_impl_clip_u8_ref() {
sl@0
   263
		return &_oil_function_impl_clip_u8_ref;
sl@0
   264
}
sl@0
   265
#endif
sl@0
   266
sl@0
   267
#ifdef	__SYMBIAN32__
sl@0
   268
 
sl@0
   269
OilFunctionImpl* __oil_function_impl_clip_s16_ref() {
sl@0
   270
		return &_oil_function_impl_clip_s16_ref;
sl@0
   271
}
sl@0
   272
#endif
sl@0
   273
sl@0
   274
#ifdef	__SYMBIAN32__
sl@0
   275
 
sl@0
   276
OilFunctionImpl* __oil_function_impl_clip_u16_ref() {
sl@0
   277
		return &_oil_function_impl_clip_u16_ref;
sl@0
   278
}
sl@0
   279
#endif
sl@0
   280
sl@0
   281
#ifdef	__SYMBIAN32__
sl@0
   282
 
sl@0
   283
OilFunctionImpl* __oil_function_impl_clip_s32_ref() {
sl@0
   284
		return &_oil_function_impl_clip_s32_ref;
sl@0
   285
}
sl@0
   286
#endif
sl@0
   287
sl@0
   288
#ifdef	__SYMBIAN32__
sl@0
   289
 
sl@0
   290
OilFunctionImpl* __oil_function_impl_clip_u32_ref() {
sl@0
   291
		return &_oil_function_impl_clip_u32_ref;
sl@0
   292
}
sl@0
   293
#endif
sl@0
   294
sl@0
   295
#ifdef	__SYMBIAN32__
sl@0
   296
 
sl@0
   297
OilFunctionImpl* __oil_function_impl_clip_f32_ref() {
sl@0
   298
		return &_oil_function_impl_clip_f32_ref;
sl@0
   299
}
sl@0
   300
#endif
sl@0
   301
sl@0
   302
#ifdef	__SYMBIAN32__
sl@0
   303
 
sl@0
   304
OilFunctionImpl* __oil_function_impl_clip_f64_ref() {
sl@0
   305
		return &_oil_function_impl_clip_f64_ref;
sl@0
   306
}
sl@0
   307
#endif
sl@0
   308
sl@0
   309
sl@0
   310
sl@0
   311
#ifdef	__SYMBIAN32__
sl@0
   312
 
sl@0
   313
EXPORT_C void** _oil_function_class_ptr_clip_u8 ()	{
sl@0
   314
	oil_function_class_ptr_clip_u8 = __oil_function_class_clip_u8();
sl@0
   315
	return &oil_function_class_ptr_clip_u8->func;
sl@0
   316
	}
sl@0
   317
#endif
sl@0
   318
sl@0
   319
#ifdef	__SYMBIAN32__
sl@0
   320
 
sl@0
   321
EXPORT_C void** _oil_function_class_ptr_clip_s8 ()	{
sl@0
   322
	oil_function_class_ptr_clip_s8 = __oil_function_class_clip_s8();
sl@0
   323
	return &oil_function_class_ptr_clip_s8->func;
sl@0
   324
	}
sl@0
   325
#endif
sl@0
   326
sl@0
   327
#ifdef	__SYMBIAN32__
sl@0
   328
 
sl@0
   329
EXPORT_C void** _oil_function_class_ptr_clip_s16 ()	{
sl@0
   330
	oil_function_class_ptr_clip_s16 = __oil_function_class_clip_s16();
sl@0
   331
	return &oil_function_class_ptr_clip_s16->func;
sl@0
   332
	}
sl@0
   333
#endif
sl@0
   334
sl@0
   335
#ifdef	__SYMBIAN32__
sl@0
   336
 
sl@0
   337
EXPORT_C void** _oil_function_class_ptr_clip_u16 ()	{
sl@0
   338
	oil_function_class_ptr_clip_u16 = __oil_function_class_clip_u16();
sl@0
   339
	return &oil_function_class_ptr_clip_u16->func;
sl@0
   340
	}
sl@0
   341
#endif
sl@0
   342
sl@0
   343
#ifdef	__SYMBIAN32__
sl@0
   344
 
sl@0
   345
EXPORT_C void** _oil_function_class_ptr_clip_s32 ()	{
sl@0
   346
	oil_function_class_ptr_clip_s32 = __oil_function_class_clip_s32();
sl@0
   347
	return &oil_function_class_ptr_clip_s32->func;
sl@0
   348
	}
sl@0
   349
#endif
sl@0
   350
sl@0
   351
#ifdef	__SYMBIAN32__
sl@0
   352
 
sl@0
   353
EXPORT_C void** _oil_function_class_ptr_clip_u32 ()	{
sl@0
   354
	oil_function_class_ptr_clip_u32 = __oil_function_class_clip_u32();
sl@0
   355
	return &oil_function_class_ptr_clip_u32->func;
sl@0
   356
	}
sl@0
   357
#endif
sl@0
   358
sl@0
   359
#ifdef	__SYMBIAN32__
sl@0
   360
 
sl@0
   361
EXPORT_C void** _oil_function_class_ptr_clip_f32 ()	{
sl@0
   362
	oil_function_class_ptr_clip_f32 = __oil_function_class_clip_f32();
sl@0
   363
	return &oil_function_class_ptr_clip_f32->func;
sl@0
   364
	}
sl@0
   365
#endif
sl@0
   366
sl@0
   367
#ifdef	__SYMBIAN32__
sl@0
   368
 
sl@0
   369
EXPORT_C void** _oil_function_class_ptr_clip_f64 ()	{
sl@0
   370
	oil_function_class_ptr_clip_f64 = __oil_function_class_clip_f64();
sl@0
   371
	return &oil_function_class_ptr_clip_f64->func;
sl@0
   372
	}
sl@0
   373
#endif
sl@0
   374