jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpSIU16S16Func.c
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include "vis_proto.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include "mlib_image.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include "mlib_v_ImageLookUpFunc.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
static void mlib_v_ImageLookUpSI_U16_S16_2_DstA8D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
                                                   mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
                                                   mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
                                                   const mlib_s16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
static void mlib_v_ImageLookUpSI_U16_S16_2_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
                                              mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
                                              mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
                                              const mlib_s16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
static void mlib_v_ImageLookUpSI_U16_S16_3_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
                                              mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
                                              mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
                                              const mlib_s16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
static void mlib_v_ImageLookUpSI_U16_S16_4_DstOff0_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
                                                      mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
                                                      mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
                                                      const mlib_s16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
static void mlib_v_ImageLookUpSI_U16_S16_4_DstOff1_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                                                      mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
                                                      mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                                                      const mlib_s16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
static void mlib_v_ImageLookUpSI_U16_S16_4_DstOff2_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                                                      mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
                                                      mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                                                      const mlib_s16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
static void mlib_v_ImageLookUpSI_U16_S16_4_DstOff3_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                                                      mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                                                      mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                                                      const mlib_s16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
#define VIS_LD_U16_I(X, Y)      vis_ld_u16_i((void *)(X), (Y))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
void mlib_v_ImageLookUpSI_U16_S16_2_DstA8D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                                            mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                                            mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                                            const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
  mlib_u16 *sp;              /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
  mlib_s32 s0, s1;           /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  mlib_s16 *dl;              /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
  mlib_d64 *dp;              /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
  mlib_d64 t0, t1, t2;       /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
  mlib_d64 t3, acc;          /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
  mlib_s32 i;                /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
  const mlib_s16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
  const mlib_s16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
  sp   = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
  dl   = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
  dp   = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
  vis_alignaddr((void *) 0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
  if (xsize >= 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    s0 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    s1 = (sp[1] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    sp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    for(i = 0; i <= xsize - 4; i+=2, sp+=2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
      t3 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
      t2 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
      t1 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
      t0 = VIS_LD_U16_I(tab0, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
      s0 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
      s1 = (sp[1] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    t3 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    t2 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    t1 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    t0 = VIS_LD_U16_I(tab0, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
  if ((xsize & 1) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    s0 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    t1 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    t0 = VIS_LD_U16_I(tab0, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    *(mlib_f32*)dp = vis_read_hi(acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
void mlib_v_ImageLookUpSI_U16_S16_2_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                                       mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                                       mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                                       const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
  mlib_u16 *sp;                /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
  mlib_s32 s0, s1, s2;         /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
  mlib_s16 *dl;                /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
  mlib_d64 *dp;                /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
  mlib_d64 t0, t1, t2;         /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
  mlib_d64 t3, acc;            /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
  mlib_s32 i;                  /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
  const mlib_s16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
  const mlib_s16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
  sp   = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
  dl   = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
  vis_alignaddr((void *) 0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
  s0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
  *dl++ = tab0[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
  dp   = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
  xsize--; s0 <<= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
  if (xsize >= 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    s1 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    s2 = (sp[1] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    sp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    for(i = 0; i <= xsize - 4; i+=2, sp+=2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
      t3 = VIS_LD_U16_I(tab0, s2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
      t2 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
      t1 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
      t0 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
      s0 = s2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
      s1 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
      s2 = (sp[1] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    t3 = VIS_LD_U16_I(tab0, s2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    t2 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    t1 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    t0 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    s0 = s2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
  dl = (mlib_s16*)dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
  if ((xsize & 1) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    s1 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    t1 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    t0 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    *(mlib_f32*)dp = vis_read_hi(acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    s0 = s1; dl += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
  s0 >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
  *dl = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
void mlib_v_ImageLookUpSI_U16_S16_2(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                                    mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                                    mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                                    mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                                    mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                                    mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                                    const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
  mlib_u16 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
  mlib_s16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
  mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
  const mlib_s16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
  const mlib_s16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
  for (j = 0; j < ysize; j ++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    mlib_u16 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    mlib_s16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    mlib_s32 off, s0, size = xsize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    off = ((8 - ((mlib_addr)dp & 7)) & 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    if ((off >= 4) && (size > 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
      s0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
      *dp++ = tab0[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
      *dp++ = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
      size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
      if (((mlib_addr)dp & 7) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        mlib_v_ImageLookUpSI_U16_S16_2_DstA8D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
      } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        mlib_v_ImageLookUpSI_U16_S16_2_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    sl = (mlib_u16 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    dl = (mlib_s16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
void mlib_v_ImageLookUpSI_U16_S16_3_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                                       mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                                       mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                                       const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
  mlib_u16 *sp;              /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
  mlib_s16 *dl;              /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
  mlib_d64 *dp;              /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
  mlib_d64 t0, t1, t2, t3;   /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
  mlib_d64 acc0, acc1, acc2; /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
  mlib_s32 i;                /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
  const mlib_s16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
  const mlib_s16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
  const mlib_s16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
  mlib_s32 s00, s01, s02, s03;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
  sp   = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
  dl   = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
  dp   = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
  vis_alignaddr((void *) 0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
  i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
  if (xsize >= 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    s00 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    s01 = (sp[1] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    s02 = (sp[2] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    s03 = (sp[3] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    sp += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    for(i = 0; i <= xsize - 8; i+=4, sp+=4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
      t3 = VIS_LD_U16_I(tab0, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
      t2 = VIS_LD_U16_I(tab2, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
      t1 = VIS_LD_U16_I(tab1, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
      t0 = VIS_LD_U16_I(tab0, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
      t3 = VIS_LD_U16_I(tab1, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
      t2 = VIS_LD_U16_I(tab0, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
      t1 = VIS_LD_U16_I(tab2, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
      t0 = VIS_LD_U16_I(tab1, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
      acc1 = vis_faligndata(t3, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
      acc1 = vis_faligndata(t2, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
      acc1 = vis_faligndata(t1, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
      acc1 = vis_faligndata(t0, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
      t3 = VIS_LD_U16_I(tab2, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
      t2 = VIS_LD_U16_I(tab1, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
      t1 = VIS_LD_U16_I(tab0, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
      t0 = VIS_LD_U16_I(tab2, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
      acc2 = vis_faligndata(t3, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
      acc2 = vis_faligndata(t2, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
      acc2 = vis_faligndata(t1, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
      acc2 = vis_faligndata(t0, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
      s00 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
      s01 = (sp[1] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
      s02 = (sp[2] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
      s03 = (sp[3] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
      *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
      *dp++ = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
      *dp++ = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    t3 = VIS_LD_U16_I(tab0, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    t2 = VIS_LD_U16_I(tab2, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    t1 = VIS_LD_U16_I(tab1, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    t0 = VIS_LD_U16_I(tab0, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    t3 = VIS_LD_U16_I(tab1, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    t2 = VIS_LD_U16_I(tab0, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    t1 = VIS_LD_U16_I(tab2, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    t0 = VIS_LD_U16_I(tab1, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    acc1 = vis_faligndata(t3, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    acc1 = vis_faligndata(t2, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    acc1 = vis_faligndata(t1, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    acc1 = vis_faligndata(t0, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    t3 = VIS_LD_U16_I(tab2, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    t2 = VIS_LD_U16_I(tab1, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    t1 = VIS_LD_U16_I(tab0, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    t0 = VIS_LD_U16_I(tab2, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    acc2 = vis_faligndata(t3, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    acc2 = vis_faligndata(t2, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    acc2 = vis_faligndata(t1, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    acc2 = vis_faligndata(t0, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    *dp++ = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    *dp++ = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
  dl = (mlib_s16*)dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
  for (; i < xsize; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    s00 = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    dl[0] = tab0[s00];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    dl[1] = tab1[s00];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    dl[2] = tab2[s00];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    dl += 3; sp ++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
void mlib_v_ImageLookUpSI_U16_S16_3(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
                                    mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
                                    mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
                                    mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
                                    mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                                    mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                                    const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
  mlib_u16 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
  mlib_s16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
  mlib_s32 i, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
  const mlib_s16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
  const mlib_s16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
  const mlib_s16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
  for (j = 0; j < ysize; j ++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    mlib_u16 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    mlib_s16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    mlib_s32 off, s0, size = xsize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    off = ((mlib_addr)dp & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    off = (off < size) ? off : size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    for (i = 0; i < off; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
      s0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
      *dp++ = tab0[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
      *dp++ = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
      *dp++ = tab2[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
      size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
      mlib_v_ImageLookUpSI_U16_S16_3_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    sl = (mlib_u16 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    dl = (mlib_s16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
void mlib_v_ImageLookUpSI_U16_S16_4_DstOff0_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
                                               mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
                                               mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                                               const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
  mlib_u16 *sp;              /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
  mlib_s32 s0;               /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
  mlib_s16 *dl;              /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
  mlib_d64 *dp;              /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
  mlib_d64 t0, t1, t2, t3;   /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
  mlib_d64 acc;              /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
  mlib_s32 i;                /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
  const mlib_s16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
  const mlib_s16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
  const mlib_s16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
  const mlib_s16 *tab3 = &table[3][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
  sp   = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
  dl   = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
  dp   = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
  vis_alignaddr((void *) 0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
  if (xsize >= 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
    s0 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
    for(i = 0; i <= xsize - 2; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
      t3 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
      t2 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
      t1 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
      t0 = VIS_LD_U16_I(tab0, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
      s0 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    t3 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    t2 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    t1 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
    t0 = VIS_LD_U16_I(tab0, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
void mlib_v_ImageLookUpSI_U16_S16_4_DstOff1_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
                                               mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
                                               mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
                                               const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
  mlib_u16 *sp;              /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
  mlib_s32 s0, s1;           /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
  mlib_s16 *dl;              /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
  mlib_d64 *dp;              /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
  mlib_d64 t0, t1, t2, t3;   /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
  mlib_d64 acc;              /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
  mlib_s32 i;                /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
  const mlib_s16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
  const mlib_s16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
  const mlib_s16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
  const mlib_s16 *tab3 = &table[3][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
  sp   = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
  dl   = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
  dp   = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
  vis_alignaddr((void *) 0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
  s0 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
  if (xsize >= 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
    for(i = 0; i <= xsize - 2; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
      t3 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
      t2 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
      t1 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
      t0 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
      s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
      s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
    t3 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
    t2 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
    t1 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
    t0 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
  dl = (mlib_s16*)dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
  s0 >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
  dl[0] = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
  dl[1] = tab2[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
  dl[2] = tab3[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
void mlib_v_ImageLookUpSI_U16_S16_4_DstOff2_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
                                               mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
                                               mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
                                               const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
  mlib_u16 *sp;              /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
  mlib_s32 s0, s1;           /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
  mlib_s16 *dl;              /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
  mlib_d64 *dp;              /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
  mlib_d64 t0, t1, t2, t3;   /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
  mlib_d64 acc;              /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
  mlib_s32 i;                /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
  const mlib_s16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
  const mlib_s16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
  const mlib_s16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
  const mlib_s16 *tab3 = &table[3][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
  sp   = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
  dl   = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
  dp   = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
  vis_alignaddr((void *) 0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
  s0 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
  if (xsize >= 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
    s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
    for(i = 0; i <= xsize - 2; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
      t3 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
      t2 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
      t1 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
      t0 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
      s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
      s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
    t3 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
    t2 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    t1 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
    t0 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
  dl = (mlib_s16*)dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
  s0 >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
  dl[0] = tab2[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
  dl[1] = tab3[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
void mlib_v_ImageLookUpSI_U16_S16_4_DstOff3_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
                                               mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
                                               mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
                                               const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
  mlib_u16 *sp;              /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
  mlib_s32 s0, s1;           /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
  mlib_s16 *dl;              /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
  mlib_d64 *dp;              /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
  mlib_d64 t0, t1, t2, t3;   /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
  mlib_d64 acc;              /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
  mlib_s32 i;                /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
  const mlib_s16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
  const mlib_s16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
  const mlib_s16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
  const mlib_s16 *tab3 = &table[3][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
  sp   = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
  dl   = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
  dp   = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
  vis_alignaddr((void *) 0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
  s0 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
  if (xsize >= 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
    s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    for(i = 0; i <= xsize - 2; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
      t3 = VIS_LD_U16_I(tab2, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
      t2 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
      t1 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
      t0 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
      s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
      s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
    t3 = VIS_LD_U16_I(tab2, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
    t2 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
    t1 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
    t0 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
  dl = (mlib_s16*)dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
  s0 >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
  dl[0] = tab3[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
void mlib_v_ImageLookUpSI_U16_S16_4(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
                                    mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
                                    mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
                                    mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
                                    mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
                                    mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
                                    const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
  mlib_u16 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
  mlib_s16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
  mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
  const mlib_s16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
  const mlib_s16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
  const mlib_s16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
  for (j = 0; j < ysize; j ++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
    mlib_u16 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
    mlib_s16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
    mlib_s32 off, s0, size = xsize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
      off =  ((8 - ((mlib_addr)dp & 7)) & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
      if (off == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
        mlib_v_ImageLookUpSI_U16_S16_4_DstOff0_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
      } else if (off == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
        s0 = *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
        *dp++ = tab0[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
        size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
        mlib_v_ImageLookUpSI_U16_S16_4_DstOff1_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
      } else if (off == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
        s0 = *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
        *dp++ = tab0[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
        *dp++ = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
        size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
        mlib_v_ImageLookUpSI_U16_S16_4_DstOff2_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
      } else if (off == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
        s0 = *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
        *dp++ = tab0[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
        *dp++ = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
        *dp++ = tab2[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
        size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
        mlib_v_ImageLookUpSI_U16_S16_4_DstOff3_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
    sl = (mlib_u16 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
    dl = (mlib_s16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
/***************************************************************/