genericopenlibs/liboil/src/ref/mas.c
branchRCL_3
changeset 56 acd3cd4aaceb
equal deleted inserted replaced
54:4332f0f7be53 56:acd3cd4aaceb
       
     1 //Portions Copyright (c)  2008-2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. 
       
     2 /*
       
     3 Copyright 2002,2003,2004,2005 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 #include <liboil/liboilfunction.h>
       
    28 #include <liboil/liboiltest.h>
       
    29 #include <liboil/liboilrandom.h>
       
    30 
       
    31 static void
       
    32 mas_test (OilTest *test)
       
    33 {
       
    34   int16_t *data;
       
    35   int i;
       
    36   int n;
       
    37 
       
    38   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC1);
       
    39   for(i=0;i<test->n;i++){
       
    40     //data[i] = oil_rand_s16()>>1;
       
    41     data[i] = 0;
       
    42   }
       
    43 
       
    44   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2);
       
    45   for(i=0;i<test->n;i++){
       
    46     data[i] = oil_rand_s16() >> 4;
       
    47   }
       
    48 
       
    49   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3);
       
    50   n = oil_test_get_arg_post_n (test, OIL_ARG_SRC3);
       
    51   if (n == 2) {
       
    52     data[0] = 1;
       
    53     data[1] = 1;
       
    54 
       
    55     data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC4);
       
    56     data[0] = 1;
       
    57     data[1] = 1;
       
    58   } else {
       
    59     for(i=0;i<n;i++){
       
    60       data[i] = (oil_rand_s16()>>4)/n;
       
    61     }
       
    62 
       
    63     data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC4);
       
    64     data[0] = (1<<11);
       
    65     data[1] = 12;
       
    66   }
       
    67 }
       
    68 
       
    69 static void
       
    70 mas2_across_test (OilTest *test)
       
    71 {
       
    72   int16_t *data;
       
    73   int i;
       
    74   int n;
       
    75 
       
    76   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC1);
       
    77   for(i=0;i<test->n;i++){
       
    78     //data[i] = oil_rand_s16()>>1;
       
    79     data[i] = 0;
       
    80   }
       
    81 
       
    82   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2);
       
    83   for(i=0;i<test->n;i++){
       
    84     data[i] = oil_rand_s16()>>4;
       
    85   }
       
    86 
       
    87   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3);
       
    88   for(i=0;i<test->n;i++){
       
    89     data[i] = oil_rand_s16()>>4;
       
    90   }
       
    91 
       
    92   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC4);
       
    93   n = oil_test_get_arg_post_n (test, OIL_ARG_SRC4);
       
    94   for(i=0;i<n;i++){
       
    95     data[i] = (oil_rand_s16()>>4)/n;
       
    96   }
       
    97 
       
    98   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC5);
       
    99   data[0] = (1<<11);
       
   100   data[1] = 12;
       
   101 }
       
   102 
       
   103 static void
       
   104 mas48_across_test (OilTest *test)
       
   105 {
       
   106   int16_t *data;
       
   107   int stride;
       
   108   int i;
       
   109   int j;
       
   110   int n;
       
   111   int m;
       
   112   int sum;
       
   113 
       
   114   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC1);
       
   115   for(i=0;i<test->n;i++){
       
   116     //data[i] = oil_rand_s16()>>1;
       
   117     data[i] = 0;
       
   118   }
       
   119 
       
   120   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2);
       
   121   m = oil_test_get_arg_post_n (test, OIL_ARG_SRC2);
       
   122   stride = oil_test_get_arg_stride (test, OIL_ARG_SRC2);
       
   123   for(j=0;j<m;j++){
       
   124     for(i=0;i<test->n;i++){
       
   125       data[i] = oil_rand_s16()>>12;
       
   126     }
       
   127     data = OIL_OFFSET(data, stride);
       
   128   }
       
   129 
       
   130   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3);
       
   131   n = oil_test_get_arg_post_n (test, OIL_ARG_SRC3);
       
   132   sum = 0;
       
   133 #if 0
       
   134   if (n==8) {
       
   135     for(i=0;i<8;i++){
       
   136       data[i] = 1;
       
   137     }
       
   138   } else {
       
   139     data[0] = -1;
       
   140     data[1] = 9;
       
   141     data[2] = 9;
       
   142     data[3] = -1;
       
   143   }
       
   144 #endif
       
   145   for(i=0;i<n-1;i++){
       
   146     data[i] = (oil_rand_s16()>>8)/n;
       
   147     sum += data[i];
       
   148   }
       
   149   data[i] = 128 - sum;
       
   150 
       
   151   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC4);
       
   152   data[0] = (1<<6);
       
   153   data[1] = 7;
       
   154 #if 0
       
   155   data[0] = (1<<(4-1));
       
   156   data[1] = 4;
       
   157 #endif
       
   158 }
       
   159 
       
   160 static void
       
   161 mas10_u8_test (OilTest *test)
       
   162 {
       
   163   static const int taps[] = { 3, -11, 25, -56, 167, 167, -56, 25, -11, 3 };
       
   164   int16_t *data;
       
   165   int i;
       
   166 
       
   167   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2);
       
   168   for(i=0;i<10;i++){
       
   169     data[i] = taps[i];
       
   170   }
       
   171 
       
   172   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3);
       
   173   data[0] = 128;
       
   174   data[1] = 8;
       
   175 }
       
   176 
       
   177 static void
       
   178 mas10_u8_l15_test (OilTest *test)
       
   179 {
       
   180   static const int taps[] = { 0, -1, 3, -7, 21, 21, -7, 3, -1, 0 };
       
   181   int16_t *data;
       
   182   int i;
       
   183 
       
   184   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2);
       
   185   for(i=0;i<10;i++){
       
   186     data[i] = taps[i];
       
   187   }
       
   188 
       
   189   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3);
       
   190   data[0] = 32;
       
   191   data[1] = 6;
       
   192 }
       
   193 
       
   194 static void
       
   195 mas8_u8_test (OilTest *test)
       
   196 {
       
   197   static const int taps[] = { -1, 3, -7, 21, 21, -7, 3, -1 };
       
   198   int16_t *data;
       
   199   int i;
       
   200 #if 0
       
   201   int n;
       
   202 
       
   203   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC1);
       
   204   n = oil_test_get_arg_post_n (test, OIL_ARG_SRC1);
       
   205   for(i=0;i<n;i++){
       
   206     data[i] = 100*((i%8)==4);
       
   207   }
       
   208 #endif
       
   209 
       
   210   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2);
       
   211   for(i=0;i<8;i++){
       
   212     data[i] = taps[i];
       
   213   }
       
   214 
       
   215   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3);
       
   216   data[0] = 32;
       
   217   data[1] = 6;
       
   218 
       
   219 }
       
   220 
       
   221 static void
       
   222 mas12_test (OilTest *test)
       
   223 {
       
   224   const int taps[12] = { 4, -4, -8, 4, 46, 86, 86, 46, 4, -8, -4, 4 };
       
   225   int16_t *data;
       
   226   int i;
       
   227 
       
   228   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2);
       
   229   for(i=0;i<12;i++){
       
   230     data[i] = taps[i];
       
   231   }
       
   232 
       
   233   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3);
       
   234   data[0] = (1<<11);
       
   235   data[1] = 12;
       
   236 }
       
   237 
       
   238 static void
       
   239 mas8_test (OilTest *test)
       
   240 {
       
   241   const int taps[8] = { -8, 4, 46, 86, 86, 46, 4, -8 };
       
   242   int16_t *data;
       
   243   int i;
       
   244 
       
   245   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC2);
       
   246   for(i=0;i<12;i++){
       
   247     data[i] = taps[i];
       
   248   }
       
   249 
       
   250   data = (int16_t *)oil_test_get_source_data (test, OIL_ARG_SRC3);
       
   251   data[0] = (1<<11);
       
   252   data[1] = 12;
       
   253 }
       
   254 
       
   255 OIL_DEFINE_CLASS_FULL (mas2_add_s16,
       
   256     "int16_t *d, int16_t *s1, int16_t *s2_np1, int16_t *s3_2, int16_t *s4_2, "
       
   257     "int n", mas_test);
       
   258 OIL_DEFINE_CLASS_FULL (mas4_add_s16,
       
   259     "int16_t *d, int16_t *s1, int16_t *s2_np3, int16_t *s3_4, int16_t *s4_2, "
       
   260     "int n", mas_test);
       
   261 OIL_DEFINE_CLASS_FULL (mas8_add_s16,
       
   262     "int16_t *d, int16_t *s1, int16_t *s2_np7, int16_t *s3_8, int16_t *s4_2, "
       
   263     "int n", mas_test);
       
   264 OIL_DEFINE_CLASS_FULL (mas2_across_add_s16,
       
   265     "int16_t *d, int16_t *s1, int16_t *s2, int16_t *s3, int16_t *s4_2, "
       
   266     "int16_t *s5_2, int n", mas2_across_test);
       
   267 OIL_DEFINE_CLASS_FULL (mas4_across_add_s16,
       
   268     "int16_t *d, int16_t *s1, int16_t *s2_nx4, int sstr2, int16_t *s3_4, "
       
   269     "int16_t *s4_2, int n", mas48_across_test);
       
   270 OIL_DEFINE_CLASS_FULL (mas8_across_add_s16,
       
   271     "int16_t *d, int16_t *s1, int16_t *s2_nx8, int sstr2, int16_t *s3_8, "
       
   272     "int16_t *s4_2, int n", mas48_across_test);
       
   273 OIL_DEFINE_CLASS_FULL (mas10_u8, "uint8_t *d, uint8_t *s1_np9, int16_t *s2_10, "
       
   274     "int16_t *s3_2, int n", mas10_u8_test);
       
   275 OIL_DEFINE_CLASS_FULL (mas10_u8_l15, "uint8_t *d, uint8_t *s1_np9, int16_t *s2_10, "
       
   276     "int16_t *s3_2, int n", mas10_u8_l15_test);
       
   277 OIL_DEFINE_CLASS_FULL (mas10_u8_sym_l15, "uint8_t *d, uint8_t *s1_np9, int16_t *s2_10, "
       
   278     "int16_t *s3_2, int n", mas10_u8_l15_test);
       
   279 OIL_DEFINE_CLASS_FULL (mas8_u8, "uint8_t *d, uint8_t *s1_np7, int16_t *s2_8, "
       
   280     "int16_t *s3_2, int n", mas8_u8_test);
       
   281 OIL_DEFINE_CLASS_FULL (mas8_u8_l15, "uint8_t *d, uint8_t *s1_np7, int16_t *s2_8, "
       
   282     "int16_t *s3_2, int n", mas8_u8_test);
       
   283 OIL_DEFINE_CLASS_FULL (mas8_u8_sym_l15, "uint8_t *d, uint8_t *s1_np7, int16_t *s2_8, "
       
   284     "int16_t *s3_2, int n", mas8_u8_test);
       
   285 OIL_DEFINE_CLASS_FULL (mas12_addc_rshift_decim2_u8,
       
   286     "uint8_t *d, uint8_t *s1_2xnp11, int16_t *s2_12, "
       
   287     "int16_t *s3_2, int n", mas12_test);
       
   288 #if 0
       
   289 OIL_DEFINE_CLASS_FULL (mas12across_addc_rshift_u8,
       
   290     "uint8_t *d, uint8_t **s1_a12, int16_t *s2_12, "
       
   291     "int16_t *s3_2, int n", mas12_test);
       
   292 #endif
       
   293 OIL_DEFINE_CLASS_FULL (mas8_addc_rshift_decim2_u8,
       
   294     "uint8_t *d, uint8_t *s1_2xnp9, int16_t *s2_8, "
       
   295     "int16_t *s3_2, int n", mas8_test);
       
   296 OIL_DEFINE_CLASS_FULL (mas8_across_u8, "uint8_t *d, uint8_t *s1_nx8, int sstr1, "
       
   297     "int16_t *s2_8, int16_t *s3_2, int n", mas8_u8_test);
       
   298 
       
   299 void
       
   300 mas2_add_s16_ref(int16_t *d1, int16_t *s1, int16_t *s2, int16_t *s3_2,
       
   301     int16_t *s4_2, int n)
       
   302 {
       
   303   int i;
       
   304   int x;
       
   305 
       
   306   for(i=0;i<n;i++){
       
   307     x = s4_2[0] + s2[i]*s3_2[0] + s2[i+1]*s3_2[1];
       
   308     x >>= s4_2[1];
       
   309     d1[i] = s1[i] + x;
       
   310   }
       
   311 }
       
   312 OIL_DEFINE_IMPL_REF (mas2_add_s16_ref, mas2_add_s16);
       
   313 
       
   314 void
       
   315 mas4_add_s16_ref(int16_t *d1, int16_t *s1, int16_t *s2, int16_t *s3_4,
       
   316     int16_t *s4_2, int n)
       
   317 {
       
   318   int i;
       
   319   int x;
       
   320 
       
   321   for(i=0;i<n;i++){
       
   322     x = s4_2[0] + s2[i]*s3_4[0] + s2[i+1]*s3_4[1] + s2[i+2]*s3_4[2] +
       
   323         s2[i+3]*s3_4[3];
       
   324     x >>= s4_2[1];
       
   325     d1[i] = s1[i] + x;
       
   326   }
       
   327 }
       
   328 OIL_DEFINE_IMPL_REF (mas4_add_s16_ref, mas4_add_s16);
       
   329 
       
   330 void
       
   331 mas8_add_s16_ref(int16_t *d1, int16_t *s1, int16_t *s2, int16_t *s3_8,
       
   332     int16_t *s4_2, int n)
       
   333 {
       
   334   int i;
       
   335   int j;
       
   336   int x;
       
   337 
       
   338   for(i=0;i<n;i++){
       
   339     x = s4_2[0];
       
   340     for(j=0;j<8;j++){
       
   341       x += s2[i+j]*s3_8[j];
       
   342     }
       
   343     x >>= s4_2[1];
       
   344     d1[i] = s1[i] + x;
       
   345   }
       
   346 }
       
   347 OIL_DEFINE_IMPL_REF (mas8_add_s16_ref, mas8_add_s16);
       
   348 
       
   349 void
       
   350 mas2_across_add_s16_ref (int16_t *d, int16_t *s1, int16_t *s2, int16_t *s3,
       
   351     int16_t *s4_2, int16_t *s5_2, int n)
       
   352 {
       
   353   int i;
       
   354   int x;
       
   355   for(i=0;i<n;i++){
       
   356     x = s5_2[0];
       
   357     x += s2[i]*s4_2[0] + s3[i]*s4_2[1];
       
   358     x >>= s5_2[1];
       
   359     d[i] = s1[i] + x;
       
   360   }
       
   361 }
       
   362 OIL_DEFINE_IMPL_REF (mas2_across_add_s16_ref, mas2_across_add_s16);
       
   363 
       
   364 void
       
   365 mas4_across_add_s16_ref (int16_t *d, int16_t *s1, int16_t *s2_nx4, int sstr2,
       
   366     int16_t *s3_4, int16_t *s4_2, int n)
       
   367 {
       
   368   int i;
       
   369   int j;
       
   370   int x;
       
   371   for(i=0;i<n;i++){
       
   372     x = s4_2[0];
       
   373     for(j=0;j<4;j++){
       
   374       x += OIL_GET(s2_nx4, i*sizeof(int16_t) + j*sstr2, int16_t)*s3_4[j];
       
   375     }
       
   376     x >>= s4_2[1];
       
   377     d[i] = s1[i] + x;
       
   378   }
       
   379 }
       
   380 OIL_DEFINE_IMPL_REF (mas4_across_add_s16_ref, mas4_across_add_s16);
       
   381 
       
   382 void
       
   383 mas8_across_add_s16_ref (int16_t *d, int16_t *s1, int16_t *s2_nx8, int sstr2,
       
   384     int16_t *s3_8, int16_t *s4_2, int n)
       
   385 {
       
   386   int i;
       
   387   int j;
       
   388   int x;
       
   389   for(i=0;i<n;i++){
       
   390     x = s4_2[0];
       
   391     for(j=0;j<8;j++){
       
   392       x += OIL_GET(s2_nx8, i*sizeof(int16_t) + j*sstr2, int16_t)*s3_8[j];
       
   393     }
       
   394     x >>= s4_2[1];
       
   395     d[i] = s1[i] + x;
       
   396   }
       
   397 }
       
   398 OIL_DEFINE_IMPL_REF (mas8_across_add_s16_ref, mas8_across_add_s16);
       
   399 
       
   400 
       
   401 void
       
   402 mas10_u8_ref (uint8_t *d, const uint8_t *s1_np9, const int16_t *s2_10,
       
   403     const int16_t *s3_2, int n)
       
   404 {
       
   405   int i;
       
   406   int j;
       
   407   int x;
       
   408 
       
   409   for(i=0;i<n;i++){
       
   410     x = 0;
       
   411     for(j=0;j<10;j++){
       
   412       x += s1_np9[i+j] * s2_10[j];
       
   413     }
       
   414     d[i] = CLAMP((x + s3_2[0])>>s3_2[1],0,255);
       
   415   }
       
   416 }
       
   417 OIL_DEFINE_IMPL_REF (mas10_u8_ref, mas10_u8);
       
   418 
       
   419 void
       
   420 mas10_u8_l15_ref (uint8_t *d, const uint8_t *s1_np9, const int16_t *s2_10,
       
   421     const int16_t *s3_2, int n)
       
   422 {
       
   423   mas10_u8_ref (d, s1_np9, s2_10, s3_2, n);
       
   424 }
       
   425 OIL_DEFINE_IMPL_REF (mas10_u8_l15_ref, mas10_u8_l15);
       
   426 
       
   427 void
       
   428 mas10_u8_sym_l15_ref (uint8_t *d, const uint8_t *s1_np9,
       
   429     const int16_t *s2_10, const int16_t *s3_2, int n)
       
   430 {
       
   431   mas10_u8_ref (d, s1_np9, s2_10, s3_2, n);
       
   432 }
       
   433 OIL_DEFINE_IMPL_REF (mas10_u8_sym_l15_ref, mas10_u8_sym_l15);
       
   434 
       
   435 void
       
   436 mas8_u8_ref (uint8_t *d, const uint8_t *s1_np7, const int16_t *s2_8,
       
   437         const int16_t *s3_2, int n)
       
   438 {
       
   439   int i;
       
   440   int j;
       
   441   int x;
       
   442 
       
   443   for(i=0;i<n;i++){
       
   444     x = 0;
       
   445     for(j=0;j<8;j++){
       
   446       x += s1_np7[i+j] * s2_8[j];
       
   447     }
       
   448     d[i] = CLAMP((x + s3_2[0])>>s3_2[1],0,255);
       
   449   }
       
   450 }
       
   451 OIL_DEFINE_IMPL_REF (mas8_u8_ref, mas8_u8);
       
   452 
       
   453 void
       
   454 mas8_u8_l15_ref (uint8_t *d, const uint8_t *s1_np7, const int16_t *s2_8,
       
   455     const int16_t *s3_2, int n)
       
   456 {
       
   457   mas8_u8_ref (d, s1_np7, s2_8, s3_2, n);
       
   458 }
       
   459 OIL_DEFINE_IMPL_REF (mas8_u8_l15_ref, mas8_u8_l15);
       
   460 
       
   461 void
       
   462 mas8_u8_sym_l15_ref (uint8_t *d, const uint8_t *s1_np7,
       
   463     const int16_t *s2_8, const int16_t *s3_2, int n)
       
   464 {
       
   465   mas8_u8_ref (d, s1_np7, s2_8, s3_2, n);
       
   466 }
       
   467 OIL_DEFINE_IMPL_REF (mas8_u8_sym_l15_ref, mas8_u8_sym_l15);
       
   468 
       
   469 void
       
   470 mas8_across_u8_ref (uint8_t *d, uint8_t *s1_nx8, int sstr1,
       
   471     int16_t *s2_8, int16_t *s3_2, int n)
       
   472 {
       
   473   int i;
       
   474   int j;
       
   475   int x;
       
   476   for(i=0;i<n;i++){
       
   477     x = s3_2[0];
       
   478     for(j=0;j<8;j++){
       
   479       x += OIL_GET(s1_nx8, i*sizeof(uint8_t) + j*sstr1, uint8_t)*s2_8[j];
       
   480     }
       
   481     x >>= s3_2[1];
       
   482     d[i] = CLAMP(x,0,255);
       
   483   }
       
   484 }
       
   485 OIL_DEFINE_IMPL_REF (mas8_across_u8_ref, mas8_across_u8);
       
   486 
       
   487 static void
       
   488 mas12_addc_rshift_decim2_u8_ref (uint8_t *dest, const uint8_t *src,
       
   489     const int16_t *taps, const int16_t *offsetshift, int n)
       
   490 {
       
   491   int i;
       
   492   int j;
       
   493   int x;
       
   494 
       
   495   for(i=0;i<n;i++){
       
   496     x = 0;
       
   497     for(j=0;j<12;j++){
       
   498       x += taps[j]*src[i*2 + j];
       
   499     }
       
   500     dest[i] = CLAMP((x + offsetshift[0]) >> offsetshift[1],0,255);
       
   501   }
       
   502 }
       
   503 OIL_DEFINE_IMPL_REF (mas12_addc_rshift_decim2_u8_ref,
       
   504     mas12_addc_rshift_decim2_u8);
       
   505 
       
   506 #if 0
       
   507 void
       
   508 mas12across_addc_rshift_u8_ref (uint8_t *dest, uint8_t **src,
       
   509     const int16_t *taps, const int16_t *offsetshift, int n)
       
   510 {
       
   511   int i;
       
   512   int j;
       
   513   int x;
       
   514 
       
   515   for(i=0;i<n;i++){
       
   516     x = 0;
       
   517     for(j=0;j<12;j++){
       
   518       x += taps[j]*src[j][i];
       
   519     }
       
   520     dest[i] = CLAMP((x + offsetshift[0]) >> offsetshift[1],0,255);
       
   521   }
       
   522 }
       
   523 OIL_DEFINE_IMPL_REF (mas12across_addc_rshift_u8_ref,
       
   524     mas12across_addc_rshift_u8);
       
   525 #endif
       
   526 
       
   527 static void
       
   528 mas8_addc_rshift_decim2_u8_ref (uint8_t *dest, const uint8_t *src,
       
   529     const int16_t *taps, const int16_t *offsetshift, int n)
       
   530 {
       
   531   int i;
       
   532   int j;
       
   533   int x;
       
   534 
       
   535   for(i=0;i<n;i++){
       
   536     x = 0;
       
   537     for(j=0;j<8;j++){
       
   538       x += taps[j]*src[i*2 + j];
       
   539     }
       
   540     dest[i] = CLAMP((x + offsetshift[0]) >> offsetshift[1],0,255);
       
   541   }
       
   542 }
       
   543 OIL_DEFINE_IMPL_REF (mas8_addc_rshift_decim2_u8_ref,
       
   544     mas8_addc_rshift_decim2_u8);
       
   545 
       
   546 
       
   547 
       
   548 #ifdef	__SYMBIAN32__
       
   549  
       
   550 OilFunctionClass* __oil_function_class_mas2_add_s16() {
       
   551 		return &_oil_function_class_mas2_add_s16;
       
   552 }
       
   553 #endif
       
   554 
       
   555 #ifdef	__SYMBIAN32__
       
   556  
       
   557 OilFunctionClass* __oil_function_class_mas4_add_s16() {
       
   558 		return &_oil_function_class_mas4_add_s16;
       
   559 }
       
   560 #endif
       
   561 
       
   562 #ifdef	__SYMBIAN32__
       
   563  
       
   564 OilFunctionClass* __oil_function_class_mas8_add_s16() {
       
   565 		return &_oil_function_class_mas8_add_s16;
       
   566 }
       
   567 #endif
       
   568 
       
   569 #ifdef	__SYMBIAN32__
       
   570  
       
   571 OilFunctionClass* __oil_function_class_mas2_across_add_s16() {
       
   572 		return &_oil_function_class_mas2_across_add_s16;
       
   573 }
       
   574 #endif
       
   575 
       
   576 #ifdef	__SYMBIAN32__
       
   577  
       
   578 OilFunctionClass* __oil_function_class_mas4_across_add_s16() {
       
   579 		return &_oil_function_class_mas4_across_add_s16;
       
   580 }
       
   581 #endif
       
   582 
       
   583 #ifdef	__SYMBIAN32__
       
   584  
       
   585 OilFunctionClass* __oil_function_class_mas8_across_add_s16() {
       
   586 		return &_oil_function_class_mas8_across_add_s16;
       
   587 }
       
   588 #endif
       
   589 
       
   590 #ifdef	__SYMBIAN32__
       
   591  
       
   592 OilFunctionClass* __oil_function_class_mas10_u8() {
       
   593 		return &_oil_function_class_mas10_u8;
       
   594 }
       
   595 #endif
       
   596 
       
   597 #ifdef	__SYMBIAN32__
       
   598  
       
   599 OilFunctionClass* __oil_function_class_mas10_u8_l15() {
       
   600 		return &_oil_function_class_mas10_u8_l15;
       
   601 }
       
   602 #endif
       
   603 
       
   604 #ifdef	__SYMBIAN32__
       
   605  
       
   606 OilFunctionClass* __oil_function_class_mas10_u8_sym_l15() {
       
   607 		return &_oil_function_class_mas10_u8_sym_l15;
       
   608 }
       
   609 #endif
       
   610 
       
   611 #ifdef	__SYMBIAN32__
       
   612  
       
   613 OilFunctionClass* __oil_function_class_mas8_u8() {
       
   614 		return &_oil_function_class_mas8_u8;
       
   615 }
       
   616 #endif
       
   617 
       
   618 #ifdef	__SYMBIAN32__
       
   619  
       
   620 OilFunctionClass* __oil_function_class_mas8_u8_l15() {
       
   621 		return &_oil_function_class_mas8_u8_l15;
       
   622 }
       
   623 #endif
       
   624 
       
   625 #ifdef	__SYMBIAN32__
       
   626  
       
   627 OilFunctionClass* __oil_function_class_mas8_u8_sym_l15() {
       
   628 		return &_oil_function_class_mas8_u8_sym_l15;
       
   629 }
       
   630 #endif
       
   631 
       
   632 #ifdef	__SYMBIAN32__
       
   633  
       
   634 OilFunctionClass* __oil_function_class_mas12_addc_rshift_decim2_u8() {
       
   635 		return &_oil_function_class_mas12_addc_rshift_decim2_u8;
       
   636 }
       
   637 #endif
       
   638 
       
   639 #if 0
       
   640 #ifdef	__SYMBIAN32__
       
   641  
       
   642 OilFunctionClass* __oil_function_class_mas12across_addc_rshift_u8() {
       
   643 		return &_oil_function_class_mas12across_addc_rshift_u8;
       
   644 }
       
   645 #endif
       
   646 #endif
       
   647 
       
   648 #ifdef	__SYMBIAN32__
       
   649  
       
   650 OilFunctionClass* __oil_function_class_mas8_addc_rshift_decim2_u8() {
       
   651 		return &_oil_function_class_mas8_addc_rshift_decim2_u8;
       
   652 }
       
   653 #endif
       
   654 
       
   655 #ifdef	__SYMBIAN32__
       
   656  
       
   657 OilFunctionClass* __oil_function_class_mas8_across_u8() {
       
   658 		return &_oil_function_class_mas8_across_u8;
       
   659 }
       
   660 #endif
       
   661 
       
   662 
       
   663 
       
   664 #ifdef	__SYMBIAN32__
       
   665  
       
   666 OilFunctionImpl* __oil_function_impl_mas2_add_s16_ref() {
       
   667 		return &_oil_function_impl_mas2_add_s16_ref;
       
   668 }
       
   669 #endif
       
   670 
       
   671 #ifdef	__SYMBIAN32__
       
   672  
       
   673 OilFunctionImpl* __oil_function_impl_mas4_add_s16_ref() {
       
   674 		return &_oil_function_impl_mas4_add_s16_ref;
       
   675 }
       
   676 #endif
       
   677 
       
   678 #ifdef	__SYMBIAN32__
       
   679  
       
   680 OilFunctionImpl* __oil_function_impl_mas8_add_s16_ref() {
       
   681 		return &_oil_function_impl_mas8_add_s16_ref;
       
   682 }
       
   683 #endif
       
   684 
       
   685 #ifdef	__SYMBIAN32__
       
   686  
       
   687 OilFunctionImpl* __oil_function_impl_mas2_across_add_s16_ref() {
       
   688 		return &_oil_function_impl_mas2_across_add_s16_ref;
       
   689 }
       
   690 #endif
       
   691 
       
   692 #ifdef	__SYMBIAN32__
       
   693  
       
   694 OilFunctionImpl* __oil_function_impl_mas4_across_add_s16_ref() {
       
   695 		return &_oil_function_impl_mas4_across_add_s16_ref;
       
   696 }
       
   697 #endif
       
   698 
       
   699 #ifdef	__SYMBIAN32__
       
   700  
       
   701 OilFunctionImpl* __oil_function_impl_mas8_across_add_s16_ref() {
       
   702 		return &_oil_function_impl_mas8_across_add_s16_ref;
       
   703 }
       
   704 #endif
       
   705 
       
   706 #ifdef	__SYMBIAN32__
       
   707  
       
   708 OilFunctionImpl* __oil_function_impl_mas10_u8_ref() {
       
   709 		return &_oil_function_impl_mas10_u8_ref;
       
   710 }
       
   711 #endif
       
   712 
       
   713 #ifdef	__SYMBIAN32__
       
   714  
       
   715 OilFunctionImpl* __oil_function_impl_mas10_u8_l15_ref() {
       
   716 		return &_oil_function_impl_mas10_u8_l15_ref;
       
   717 }
       
   718 #endif
       
   719 
       
   720 #ifdef	__SYMBIAN32__
       
   721  
       
   722 OilFunctionImpl* __oil_function_impl_mas10_u8_sym_l15_ref() {
       
   723 		return &_oil_function_impl_mas10_u8_sym_l15_ref;
       
   724 }
       
   725 #endif
       
   726 
       
   727 #ifdef	__SYMBIAN32__
       
   728  
       
   729 OilFunctionImpl* __oil_function_impl_mas8_u8_ref() {
       
   730 		return &_oil_function_impl_mas8_u8_ref;
       
   731 }
       
   732 #endif
       
   733 
       
   734 #ifdef	__SYMBIAN32__
       
   735  
       
   736 OilFunctionImpl* __oil_function_impl_mas8_u8_l15_ref() {
       
   737 		return &_oil_function_impl_mas8_u8_l15_ref;
       
   738 }
       
   739 #endif
       
   740 
       
   741 #ifdef	__SYMBIAN32__
       
   742  
       
   743 OilFunctionImpl* __oil_function_impl_mas8_u8_sym_l15_ref() {
       
   744 		return &_oil_function_impl_mas8_u8_sym_l15_ref;
       
   745 }
       
   746 #endif
       
   747 
       
   748 #ifdef	__SYMBIAN32__
       
   749  
       
   750 OilFunctionImpl* __oil_function_impl_mas8_across_u8_ref() {
       
   751 		return &_oil_function_impl_mas8_across_u8_ref;
       
   752 }
       
   753 #endif
       
   754 
       
   755 #ifdef	__SYMBIAN32__
       
   756  
       
   757 OilFunctionImpl* __oil_function_impl_mas12_addc_rshift_decim2_u8_ref() {
       
   758 		return &_oil_function_impl_mas12_addc_rshift_decim2_u8_ref;
       
   759 }
       
   760 #endif
       
   761 #if 0
       
   762 #ifdef	__SYMBIAN32__
       
   763  
       
   764 OilFunctionImpl* __oil_function_impl_mas12across_addc_rshift_u8_ref() {
       
   765 		return &_oil_function_impl_mas12across_addc_rshift_u8_ref;
       
   766 }
       
   767 #endif
       
   768 #endif
       
   769 #ifdef	__SYMBIAN32__
       
   770  
       
   771 OilFunctionImpl* __oil_function_impl_mas8_addc_rshift_decim2_u8_ref() {
       
   772 		return &_oil_function_impl_mas8_addc_rshift_decim2_u8_ref;
       
   773 }
       
   774 #endif
       
   775 
       
   776 
       
   777 
       
   778 #ifdef	__SYMBIAN32__
       
   779  
       
   780 EXPORT_C void** _oil_function_class_ptr_mas2_add_s16 ()	{
       
   781 	oil_function_class_ptr_mas2_add_s16 = __oil_function_class_mas2_add_s16();
       
   782 	return &oil_function_class_ptr_mas2_add_s16->func;
       
   783 	}
       
   784 #endif
       
   785 
       
   786 #ifdef	__SYMBIAN32__
       
   787  
       
   788 EXPORT_C void** _oil_function_class_ptr_mas4_add_s16 ()	{
       
   789 	oil_function_class_ptr_mas4_add_s16 = __oil_function_class_mas4_add_s16();
       
   790 	return &oil_function_class_ptr_mas4_add_s16->func;
       
   791 	}
       
   792 #endif
       
   793 
       
   794 #ifdef	__SYMBIAN32__
       
   795  
       
   796 EXPORT_C void** _oil_function_class_ptr_mas8_add_s16 ()	{
       
   797 	oil_function_class_ptr_mas8_add_s16 = __oil_function_class_mas8_add_s16();
       
   798 	return &oil_function_class_ptr_mas8_add_s16->func;
       
   799 	}
       
   800 #endif
       
   801 
       
   802 #ifdef	__SYMBIAN32__
       
   803  
       
   804 EXPORT_C void** _oil_function_class_ptr_mas2_across_add_s16 ()	{
       
   805 	oil_function_class_ptr_mas2_across_add_s16 = __oil_function_class_mas2_across_add_s16();
       
   806 	return &oil_function_class_ptr_mas2_across_add_s16->func;
       
   807 	}
       
   808 #endif
       
   809 
       
   810 #ifdef	__SYMBIAN32__
       
   811  
       
   812 EXPORT_C void** _oil_function_class_ptr_mas4_across_add_s16 ()	{
       
   813 	oil_function_class_ptr_mas4_across_add_s16 = __oil_function_class_mas4_across_add_s16();
       
   814 	return &oil_function_class_ptr_mas4_across_add_s16->func;
       
   815 	}
       
   816 #endif
       
   817 
       
   818 #ifdef	__SYMBIAN32__
       
   819  
       
   820 EXPORT_C void** _oil_function_class_ptr_mas8_across_add_s16 ()	{
       
   821 	oil_function_class_ptr_mas8_across_add_s16 = __oil_function_class_mas8_across_add_s16();
       
   822 	return &oil_function_class_ptr_mas8_across_add_s16->func;
       
   823 	}
       
   824 #endif
       
   825 
       
   826 #ifdef	__SYMBIAN32__
       
   827  
       
   828 EXPORT_C void** _oil_function_class_ptr_mas10_u8 ()	{
       
   829 	oil_function_class_ptr_mas10_u8 = __oil_function_class_mas10_u8();
       
   830 	return &oil_function_class_ptr_mas10_u8->func;
       
   831 	}
       
   832 #endif
       
   833 
       
   834 #ifdef	__SYMBIAN32__
       
   835  
       
   836 EXPORT_C void** _oil_function_class_ptr_mas10_u8_l15 ()	{
       
   837 	oil_function_class_ptr_mas10_u8_l15 = __oil_function_class_mas10_u8_l15();
       
   838 	return &oil_function_class_ptr_mas10_u8_l15->func;
       
   839 	}
       
   840 #endif
       
   841 
       
   842 #ifdef	__SYMBIAN32__
       
   843  
       
   844 EXPORT_C void** _oil_function_class_ptr_mas10_u8_sym_l15 ()	{
       
   845 	oil_function_class_ptr_mas10_u8_sym_l15 = __oil_function_class_mas10_u8_sym_l15();
       
   846 	return &oil_function_class_ptr_mas10_u8_sym_l15->func;
       
   847 	}
       
   848 #endif
       
   849 
       
   850 #ifdef	__SYMBIAN32__
       
   851  
       
   852 EXPORT_C void** _oil_function_class_ptr_mas8_u8 ()	{
       
   853 	oil_function_class_ptr_mas8_u8 = __oil_function_class_mas8_u8();
       
   854 	return &oil_function_class_ptr_mas8_u8->func;
       
   855 	}
       
   856 #endif
       
   857 
       
   858 #ifdef	__SYMBIAN32__
       
   859  
       
   860 EXPORT_C void** _oil_function_class_ptr_mas8_u8_l15 ()	{
       
   861 	oil_function_class_ptr_mas8_u8_l15 = __oil_function_class_mas8_u8_l15();
       
   862 	return &oil_function_class_ptr_mas8_u8_l15->func;
       
   863 	}
       
   864 #endif
       
   865 
       
   866 #ifdef	__SYMBIAN32__
       
   867  
       
   868 EXPORT_C void** _oil_function_class_ptr_mas8_u8_sym_l15 ()	{
       
   869 	oil_function_class_ptr_mas8_u8_sym_l15 = __oil_function_class_mas8_u8_sym_l15();
       
   870 	return &oil_function_class_ptr_mas8_u8_sym_l15->func;
       
   871 	}
       
   872 #endif
       
   873 
       
   874 #ifdef	__SYMBIAN32__
       
   875  
       
   876 EXPORT_C void** _oil_function_class_ptr_mas12_addc_rshift_decim2_u8 ()	{
       
   877 	oil_function_class_ptr_mas12_addc_rshift_decim2_u8 = __oil_function_class_mas12_addc_rshift_decim2_u8();
       
   878 	return &oil_function_class_ptr_mas12_addc_rshift_decim2_u8->func;
       
   879 	}
       
   880 #endif
       
   881 
       
   882 #if 0
       
   883 #ifdef	__SYMBIAN32__
       
   884  
       
   885 EXPORT_C void** _oil_function_class_ptr_mas12across_addc_rshift_u8 ()	{
       
   886 	oil_function_class_ptr_mas12across_addc_rshift_u8 = __oil_function_class_mas12across_addc_rshift_u8();
       
   887 	return &oil_function_class_ptr_mas12across_addc_rshift_u8->func;
       
   888 	}
       
   889 #endif
       
   890 #endif
       
   891 
       
   892 #ifdef	__SYMBIAN32__
       
   893  
       
   894 EXPORT_C void** _oil_function_class_ptr_mas8_addc_rshift_decim2_u8 ()	{
       
   895 	oil_function_class_ptr_mas8_addc_rshift_decim2_u8 = __oil_function_class_mas8_addc_rshift_decim2_u8();
       
   896 	return &oil_function_class_ptr_mas8_addc_rshift_decim2_u8->func;
       
   897 	}
       
   898 #endif
       
   899 
       
   900 #ifdef	__SYMBIAN32__
       
   901  
       
   902 EXPORT_C void** _oil_function_class_ptr_mas8_across_u8 ()	{
       
   903 	oil_function_class_ptr_mas8_across_u8 = __oil_function_class_mas8_across_u8();
       
   904 	return &oil_function_class_ptr_mas8_across_u8->func;
       
   905 	}
       
   906 #endif
       
   907