diff -r 4332f0f7be53 -r acd3cd4aaceb genericopenlibs/liboil/src/ref/mas.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/genericopenlibs/liboil/src/ref/mas.c Tue Aug 31 16:54:36 2010 +0300 @@ -0,0 +1,907 @@ +//Portions Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. +/* +Copyright 2002,2003,2004,2005 David A. Schleef + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, + INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING + IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. +*/ +#include +#include +#include + +static void +mas_test (OilTest *test) +{ + int16_t *data; + int i; + int n; + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC1); + for(i=0;in;i++){ + //data[i] = oil_rand_s16()>>1; + data[i] = 0; + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2); + for(i=0;in;i++){ + data[i] = oil_rand_s16() >> 4; + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3); + n = oil_test_get_arg_post_n (test, OIL_ARG_SRC3); + if (n == 2) { + data[0] = 1; + data[1] = 1; + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC4); + data[0] = 1; + data[1] = 1; + } else { + for(i=0;i>4)/n; + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC4); + data[0] = (1<<11); + data[1] = 12; + } +} + +static void +mas2_across_test (OilTest *test) +{ + int16_t *data; + int i; + int n; + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC1); + for(i=0;in;i++){ + //data[i] = oil_rand_s16()>>1; + data[i] = 0; + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2); + for(i=0;in;i++){ + data[i] = oil_rand_s16()>>4; + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3); + for(i=0;in;i++){ + data[i] = oil_rand_s16()>>4; + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC4); + n = oil_test_get_arg_post_n (test, OIL_ARG_SRC4); + for(i=0;i>4)/n; + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC5); + data[0] = (1<<11); + data[1] = 12; +} + +static void +mas48_across_test (OilTest *test) +{ + int16_t *data; + int stride; + int i; + int j; + int n; + int m; + int sum; + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC1); + for(i=0;in;i++){ + //data[i] = oil_rand_s16()>>1; + data[i] = 0; + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2); + m = oil_test_get_arg_post_n (test, OIL_ARG_SRC2); + stride = oil_test_get_arg_stride (test, OIL_ARG_SRC2); + for(j=0;jn;i++){ + data[i] = oil_rand_s16()>>12; + } + data = OIL_OFFSET(data, stride); + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3); + n = oil_test_get_arg_post_n (test, OIL_ARG_SRC3); + sum = 0; +#if 0 + if (n==8) { + for(i=0;i<8;i++){ + data[i] = 1; + } + } else { + data[0] = -1; + data[1] = 9; + data[2] = 9; + data[3] = -1; + } +#endif + for(i=0;i>8)/n; + sum += data[i]; + } + data[i] = 128 - sum; + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC4); + data[0] = (1<<6); + data[1] = 7; +#if 0 + data[0] = (1<<(4-1)); + data[1] = 4; +#endif +} + +static void +mas10_u8_test (OilTest *test) +{ + static const int taps[] = { 3, -11, 25, -56, 167, 167, -56, 25, -11, 3 }; + int16_t *data; + int i; + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2); + for(i=0;i<10;i++){ + data[i] = taps[i]; + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3); + data[0] = 128; + data[1] = 8; +} + +static void +mas10_u8_l15_test (OilTest *test) +{ + static const int taps[] = { 0, -1, 3, -7, 21, 21, -7, 3, -1, 0 }; + int16_t *data; + int i; + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2); + for(i=0;i<10;i++){ + data[i] = taps[i]; + } + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3); + data[0] = 32; + data[1] = 6; +} + +static void +mas8_u8_test (OilTest *test) +{ + static const int taps[] = { -1, 3, -7, 21, 21, -7, 3, -1 }; + int16_t *data; + int i; +#if 0 + int n; + + data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC1); + n = oil_test_get_arg_post_n (test, OIL_ARG_SRC1); + for(i=0;i>= s4_2[1]; + d1[i] = s1[i] + x; + } +} +OIL_DEFINE_IMPL_REF (mas2_add_s16_ref, mas2_add_s16); + +void +mas4_add_s16_ref(int16_t *d1, int16_t *s1, int16_t *s2, int16_t *s3_4, + int16_t *s4_2, int n) +{ + int i; + int x; + + for(i=0;i>= s4_2[1]; + d1[i] = s1[i] + x; + } +} +OIL_DEFINE_IMPL_REF (mas4_add_s16_ref, mas4_add_s16); + +void +mas8_add_s16_ref(int16_t *d1, int16_t *s1, int16_t *s2, int16_t *s3_8, + int16_t *s4_2, int n) +{ + int i; + int j; + int x; + + for(i=0;i>= s4_2[1]; + d1[i] = s1[i] + x; + } +} +OIL_DEFINE_IMPL_REF (mas8_add_s16_ref, mas8_add_s16); + +void +mas2_across_add_s16_ref (int16_t *d, int16_t *s1, int16_t *s2, int16_t *s3, + int16_t *s4_2, int16_t *s5_2, int n) +{ + int i; + int x; + for(i=0;i>= s5_2[1]; + d[i] = s1[i] + x; + } +} +OIL_DEFINE_IMPL_REF (mas2_across_add_s16_ref, mas2_across_add_s16); + +void +mas4_across_add_s16_ref (int16_t *d, int16_t *s1, int16_t *s2_nx4, int sstr2, + int16_t *s3_4, int16_t *s4_2, int n) +{ + int i; + int j; + int x; + for(i=0;i>= s4_2[1]; + d[i] = s1[i] + x; + } +} +OIL_DEFINE_IMPL_REF (mas4_across_add_s16_ref, mas4_across_add_s16); + +void +mas8_across_add_s16_ref (int16_t *d, int16_t *s1, int16_t *s2_nx8, int sstr2, + int16_t *s3_8, int16_t *s4_2, int n) +{ + int i; + int j; + int x; + for(i=0;i>= s4_2[1]; + d[i] = s1[i] + x; + } +} +OIL_DEFINE_IMPL_REF (mas8_across_add_s16_ref, mas8_across_add_s16); + + +void +mas10_u8_ref (uint8_t *d, const uint8_t *s1_np9, const int16_t *s2_10, + const int16_t *s3_2, int n) +{ + int i; + int j; + int x; + + for(i=0;i>s3_2[1],0,255); + } +} +OIL_DEFINE_IMPL_REF (mas10_u8_ref, mas10_u8); + +void +mas10_u8_l15_ref (uint8_t *d, const uint8_t *s1_np9, const int16_t *s2_10, + const int16_t *s3_2, int n) +{ + mas10_u8_ref (d, s1_np9, s2_10, s3_2, n); +} +OIL_DEFINE_IMPL_REF (mas10_u8_l15_ref, mas10_u8_l15); + +void +mas10_u8_sym_l15_ref (uint8_t *d, const uint8_t *s1_np9, + const int16_t *s2_10, const int16_t *s3_2, int n) +{ + mas10_u8_ref (d, s1_np9, s2_10, s3_2, n); +} +OIL_DEFINE_IMPL_REF (mas10_u8_sym_l15_ref, mas10_u8_sym_l15); + +void +mas8_u8_ref (uint8_t *d, const uint8_t *s1_np7, const int16_t *s2_8, + const int16_t *s3_2, int n) +{ + int i; + int j; + int x; + + for(i=0;i>s3_2[1],0,255); + } +} +OIL_DEFINE_IMPL_REF (mas8_u8_ref, mas8_u8); + +void +mas8_u8_l15_ref (uint8_t *d, const uint8_t *s1_np7, const int16_t *s2_8, + const int16_t *s3_2, int n) +{ + mas8_u8_ref (d, s1_np7, s2_8, s3_2, n); +} +OIL_DEFINE_IMPL_REF (mas8_u8_l15_ref, mas8_u8_l15); + +void +mas8_u8_sym_l15_ref (uint8_t *d, const uint8_t *s1_np7, + const int16_t *s2_8, const int16_t *s3_2, int n) +{ + mas8_u8_ref (d, s1_np7, s2_8, s3_2, n); +} +OIL_DEFINE_IMPL_REF (mas8_u8_sym_l15_ref, mas8_u8_sym_l15); + +void +mas8_across_u8_ref (uint8_t *d, uint8_t *s1_nx8, int sstr1, + int16_t *s2_8, int16_t *s3_2, int n) +{ + int i; + int j; + int x; + for(i=0;i>= s3_2[1]; + d[i] = CLAMP(x,0,255); + } +} +OIL_DEFINE_IMPL_REF (mas8_across_u8_ref, mas8_across_u8); + +static void +mas12_addc_rshift_decim2_u8_ref (uint8_t *dest, const uint8_t *src, + const int16_t *taps, const int16_t *offsetshift, int n) +{ + int i; + int j; + int x; + + for(i=0;i> offsetshift[1],0,255); + } +} +OIL_DEFINE_IMPL_REF (mas12_addc_rshift_decim2_u8_ref, + mas12_addc_rshift_decim2_u8); + +#if 0 +void +mas12across_addc_rshift_u8_ref (uint8_t *dest, uint8_t **src, + const int16_t *taps, const int16_t *offsetshift, int n) +{ + int i; + int j; + int x; + + for(i=0;i> offsetshift[1],0,255); + } +} +OIL_DEFINE_IMPL_REF (mas12across_addc_rshift_u8_ref, + mas12across_addc_rshift_u8); +#endif + +static void +mas8_addc_rshift_decim2_u8_ref (uint8_t *dest, const uint8_t *src, + const int16_t *taps, const int16_t *offsetshift, int n) +{ + int i; + int j; + int x; + + for(i=0;i> offsetshift[1],0,255); + } +} +OIL_DEFINE_IMPL_REF (mas8_addc_rshift_decim2_u8_ref, + mas8_addc_rshift_decim2_u8); + + + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas2_add_s16() { + return &_oil_function_class_mas2_add_s16; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas4_add_s16() { + return &_oil_function_class_mas4_add_s16; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas8_add_s16() { + return &_oil_function_class_mas8_add_s16; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas2_across_add_s16() { + return &_oil_function_class_mas2_across_add_s16; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas4_across_add_s16() { + return &_oil_function_class_mas4_across_add_s16; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas8_across_add_s16() { + return &_oil_function_class_mas8_across_add_s16; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas10_u8() { + return &_oil_function_class_mas10_u8; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas10_u8_l15() { + return &_oil_function_class_mas10_u8_l15; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas10_u8_sym_l15() { + return &_oil_function_class_mas10_u8_sym_l15; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas8_u8() { + return &_oil_function_class_mas8_u8; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas8_u8_l15() { + return &_oil_function_class_mas8_u8_l15; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas8_u8_sym_l15() { + return &_oil_function_class_mas8_u8_sym_l15; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas12_addc_rshift_decim2_u8() { + return &_oil_function_class_mas12_addc_rshift_decim2_u8; +} +#endif + +#if 0 +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas12across_addc_rshift_u8() { + return &_oil_function_class_mas12across_addc_rshift_u8; +} +#endif +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas8_addc_rshift_decim2_u8() { + return &_oil_function_class_mas8_addc_rshift_decim2_u8; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionClass* __oil_function_class_mas8_across_u8() { + return &_oil_function_class_mas8_across_u8; +} +#endif + + + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas2_add_s16_ref() { + return &_oil_function_impl_mas2_add_s16_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas4_add_s16_ref() { + return &_oil_function_impl_mas4_add_s16_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas8_add_s16_ref() { + return &_oil_function_impl_mas8_add_s16_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas2_across_add_s16_ref() { + return &_oil_function_impl_mas2_across_add_s16_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas4_across_add_s16_ref() { + return &_oil_function_impl_mas4_across_add_s16_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas8_across_add_s16_ref() { + return &_oil_function_impl_mas8_across_add_s16_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas10_u8_ref() { + return &_oil_function_impl_mas10_u8_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas10_u8_l15_ref() { + return &_oil_function_impl_mas10_u8_l15_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas10_u8_sym_l15_ref() { + return &_oil_function_impl_mas10_u8_sym_l15_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas8_u8_ref() { + return &_oil_function_impl_mas8_u8_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas8_u8_l15_ref() { + return &_oil_function_impl_mas8_u8_l15_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas8_u8_sym_l15_ref() { + return &_oil_function_impl_mas8_u8_sym_l15_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas8_across_u8_ref() { + return &_oil_function_impl_mas8_across_u8_ref; +} +#endif + +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas12_addc_rshift_decim2_u8_ref() { + return &_oil_function_impl_mas12_addc_rshift_decim2_u8_ref; +} +#endif +#if 0 +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas12across_addc_rshift_u8_ref() { + return &_oil_function_impl_mas12across_addc_rshift_u8_ref; +} +#endif +#endif +#ifdef __SYMBIAN32__ + +OilFunctionImpl* __oil_function_impl_mas8_addc_rshift_decim2_u8_ref() { + return &_oil_function_impl_mas8_addc_rshift_decim2_u8_ref; +} +#endif + + + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas2_add_s16 () { + oil_function_class_ptr_mas2_add_s16 = __oil_function_class_mas2_add_s16(); + return &oil_function_class_ptr_mas2_add_s16->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas4_add_s16 () { + oil_function_class_ptr_mas4_add_s16 = __oil_function_class_mas4_add_s16(); + return &oil_function_class_ptr_mas4_add_s16->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas8_add_s16 () { + oil_function_class_ptr_mas8_add_s16 = __oil_function_class_mas8_add_s16(); + return &oil_function_class_ptr_mas8_add_s16->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas2_across_add_s16 () { + oil_function_class_ptr_mas2_across_add_s16 = __oil_function_class_mas2_across_add_s16(); + return &oil_function_class_ptr_mas2_across_add_s16->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas4_across_add_s16 () { + oil_function_class_ptr_mas4_across_add_s16 = __oil_function_class_mas4_across_add_s16(); + return &oil_function_class_ptr_mas4_across_add_s16->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas8_across_add_s16 () { + oil_function_class_ptr_mas8_across_add_s16 = __oil_function_class_mas8_across_add_s16(); + return &oil_function_class_ptr_mas8_across_add_s16->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas10_u8 () { + oil_function_class_ptr_mas10_u8 = __oil_function_class_mas10_u8(); + return &oil_function_class_ptr_mas10_u8->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas10_u8_l15 () { + oil_function_class_ptr_mas10_u8_l15 = __oil_function_class_mas10_u8_l15(); + return &oil_function_class_ptr_mas10_u8_l15->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas10_u8_sym_l15 () { + oil_function_class_ptr_mas10_u8_sym_l15 = __oil_function_class_mas10_u8_sym_l15(); + return &oil_function_class_ptr_mas10_u8_sym_l15->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas8_u8 () { + oil_function_class_ptr_mas8_u8 = __oil_function_class_mas8_u8(); + return &oil_function_class_ptr_mas8_u8->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas8_u8_l15 () { + oil_function_class_ptr_mas8_u8_l15 = __oil_function_class_mas8_u8_l15(); + return &oil_function_class_ptr_mas8_u8_l15->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas8_u8_sym_l15 () { + oil_function_class_ptr_mas8_u8_sym_l15 = __oil_function_class_mas8_u8_sym_l15(); + return &oil_function_class_ptr_mas8_u8_sym_l15->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas12_addc_rshift_decim2_u8 () { + oil_function_class_ptr_mas12_addc_rshift_decim2_u8 = __oil_function_class_mas12_addc_rshift_decim2_u8(); + return &oil_function_class_ptr_mas12_addc_rshift_decim2_u8->func; + } +#endif + +#if 0 +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas12across_addc_rshift_u8 () { + oil_function_class_ptr_mas12across_addc_rshift_u8 = __oil_function_class_mas12across_addc_rshift_u8(); + return &oil_function_class_ptr_mas12across_addc_rshift_u8->func; + } +#endif +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas8_addc_rshift_decim2_u8 () { + oil_function_class_ptr_mas8_addc_rshift_decim2_u8 = __oil_function_class_mas8_addc_rshift_decim2_u8(); + return &oil_function_class_ptr_mas8_addc_rshift_decim2_u8->func; + } +#endif + +#ifdef __SYMBIAN32__ + +EXPORT_C void** _oil_function_class_ptr_mas8_across_u8 () { + oil_function_class_ptr_mas8_across_u8 = __oil_function_class_mas8_across_u8(); + return &oil_function_class_ptr_mas8_across_u8->func; + } +#endif +