jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpSIU16U16Func.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_U16_2_DstA8D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
                                                   mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
                                                   mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
                                                   const mlib_u16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
static void mlib_v_ImageLookUpSI_U16_U16_2_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
                                              mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
                                              mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
                                              const mlib_u16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
static void mlib_v_ImageLookUpSI_U16_U16_3_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
                                              mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
                                              mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
                                              const mlib_u16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
static void mlib_v_ImageLookUpSI_U16_U16_4_DstOff0_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
                                                      mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
                                                      mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
                                                      const mlib_u16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
static void mlib_v_ImageLookUpSI_U16_U16_4_DstOff1_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                                                      mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
                                                      mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                                                      const mlib_u16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
static void mlib_v_ImageLookUpSI_U16_U16_4_DstOff2_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                                                      mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
                                                      mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                                                      const mlib_u16 **table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
static void mlib_v_ImageLookUpSI_U16_U16_4_DstOff3_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                                                      mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
                                                      mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                                                      const mlib_u16 **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_U16_2_DstA8D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                                            mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                                            mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                                            const mlib_u16 **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_u16 *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_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
  const mlib_u16 *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_U16_2_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                                       mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                                       mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                                       const mlib_u16 **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_u16 *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_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
  const mlib_u16 *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--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
  s0 <<= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
  if (xsize >= 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    s1 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    s2 = (sp[1] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    sp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    for (i = 0; i <= xsize - 4; i += 2, sp += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
      t3 = VIS_LD_U16_I(tab0, s2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
      t2 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
      t1 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
      t0 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
      s0 = s2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
      s1 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
      s2 = (sp[1] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    t3 = VIS_LD_U16_I(tab0, s2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    t2 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    t1 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    t0 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    s0 = s2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
  dl = (mlib_u16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
  if ((xsize & 1) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    s1 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    t1 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    t0 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    *(mlib_f32 *) dp = vis_read_hi(acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    dl += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
  s0 >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
  *dl = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
void mlib_v_ImageLookUpSI_U16_U16_2(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                                    mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                                    mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                                    mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
                                    mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
                                    mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                                    const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
  mlib_u16 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
  mlib_u16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
  mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
  const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
  const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
  for (j = 0; j < ysize; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    mlib_u16 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    mlib_u16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    mlib_s32 off, s0, size = xsize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    off = ((8 - ((mlib_addr) dp & 7)) & 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    if ((off >= 4) && (size > 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
      s0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
      *dp++ = tab0[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
      *dp++ = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
      size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
      if (((mlib_addr) dp & 7) == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        mlib_v_ImageLookUpSI_U16_U16_2_DstA8D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        mlib_v_ImageLookUpSI_U16_U16_2_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    sl = (mlib_u16 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    dl = (mlib_u16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
void mlib_v_ImageLookUpSI_U16_U16_3_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
                                       mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                                       mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                                       const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
  mlib_u16 *sp;                        /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
  mlib_u16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
  mlib_d64 t0, t1, t2, t3;             /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
  mlib_d64 acc0, acc1, acc2;           /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
  mlib_s32 i;                          /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
  const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
  const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
  const mlib_u16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
  mlib_s32 s00, s01, s02, s03;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
  sp = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
  i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
  if (xsize >= 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    s00 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    s01 = (sp[1] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    s02 = (sp[2] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    s03 = (sp[3] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    sp += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    for (i = 0; i <= xsize - 8; i += 4, sp += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
      t3 = VIS_LD_U16_I(tab0, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
      t2 = VIS_LD_U16_I(tab2, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
      t1 = VIS_LD_U16_I(tab1, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
      t0 = VIS_LD_U16_I(tab0, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
      t3 = VIS_LD_U16_I(tab1, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
      t2 = VIS_LD_U16_I(tab0, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
      t1 = VIS_LD_U16_I(tab2, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
      t0 = VIS_LD_U16_I(tab1, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
      acc1 = vis_faligndata(t3, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
      acc1 = vis_faligndata(t2, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
      acc1 = vis_faligndata(t1, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
      acc1 = vis_faligndata(t0, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
      t3 = VIS_LD_U16_I(tab2, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
      t2 = VIS_LD_U16_I(tab1, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
      t1 = VIS_LD_U16_I(tab0, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
      t0 = VIS_LD_U16_I(tab2, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
      acc2 = vis_faligndata(t3, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
      acc2 = vis_faligndata(t2, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
      acc2 = vis_faligndata(t1, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
      acc2 = vis_faligndata(t0, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
      s00 = (sp[0] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
      s01 = (sp[1] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
      s02 = (sp[2] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
      s03 = (sp[3] << 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
      *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
      *dp++ = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
      *dp++ = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
    t3 = VIS_LD_U16_I(tab0, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    t2 = VIS_LD_U16_I(tab2, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    t1 = VIS_LD_U16_I(tab1, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    t0 = VIS_LD_U16_I(tab0, s00);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    t3 = VIS_LD_U16_I(tab1, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    t2 = VIS_LD_U16_I(tab0, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    t1 = VIS_LD_U16_I(tab2, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    t0 = VIS_LD_U16_I(tab1, s01);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    acc1 = vis_faligndata(t3, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    acc1 = vis_faligndata(t2, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    acc1 = vis_faligndata(t1, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    acc1 = vis_faligndata(t0, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    t3 = VIS_LD_U16_I(tab2, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    t2 = VIS_LD_U16_I(tab1, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    t1 = VIS_LD_U16_I(tab0, s03);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    t0 = VIS_LD_U16_I(tab2, s02);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    acc2 = vis_faligndata(t3, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    acc2 = vis_faligndata(t2, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    acc2 = vis_faligndata(t1, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    acc2 = vis_faligndata(t0, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    *dp++ = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    *dp++ = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
  dl = (mlib_u16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
  for (; i < xsize; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    s00 = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    dl[0] = tab0[s00];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    dl[1] = tab1[s00];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    dl[2] = tab2[s00];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    dl += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
void mlib_v_ImageLookUpSI_U16_U16_3(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
                                    mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
                                    mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
                                    mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                                    mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
                                    mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
                                    const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
  mlib_u16 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
  mlib_u16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
  mlib_s32 i, j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
  const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
  const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
  const mlib_u16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
  for (j = 0; j < ysize; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    mlib_u16 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    mlib_u16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    mlib_s32 off, s0, size = xsize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    off = ((mlib_addr) dp & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    off = (off < size) ? off : size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    for (i = 0; i < off; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
      s0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
      *dp++ = tab0[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
      *dp++ = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
      *dp++ = tab2[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
      size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
      mlib_v_ImageLookUpSI_U16_U16_3_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    sl = (mlib_u16 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    dl = (mlib_u16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
void mlib_v_ImageLookUpSI_U16_U16_4_DstOff0_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                                               mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                                               mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
                                               const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
  mlib_u16 *sp;                        /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
  mlib_s32 s0;                         /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
  mlib_u16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
  mlib_d64 t0, t1, t2, t3;             /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
  mlib_d64 acc;                        /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
  mlib_s32 i;                          /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
  const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
  const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
  const mlib_u16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
  const mlib_u16 *tab3 = &table[3][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
  sp = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
  if (xsize >= 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
    s0 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    for (i = 0; i <= xsize - 2; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
      t3 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
      t2 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
      t1 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
      t0 = VIS_LD_U16_I(tab0, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
      s0 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    t3 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
    t2 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    t1 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    t0 = VIS_LD_U16_I(tab0, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
void mlib_v_ImageLookUpSI_U16_U16_4_DstOff1_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
                                               mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
                                               mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
                                               const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
  mlib_u16 *sp;                        /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
  mlib_s32 s0, s1;                     /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
  mlib_u16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
  mlib_d64 t0, t1, t2, t3;             /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
  mlib_d64 acc;                        /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
  mlib_s32 i;                          /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
  const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
  const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
  const mlib_u16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
  const mlib_u16 *tab3 = &table[3][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
  sp = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
  s0 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
  if (xsize >= 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
    s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    for (i = 0; i <= xsize - 2; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
      t3 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
      t2 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
      t1 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
      t0 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
      s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
      s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
    t3 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
    t2 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
    t1 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    t0 = VIS_LD_U16_I(tab1, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
  dl = (mlib_u16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
  s0 >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
  dl[0] = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
  dl[1] = tab2[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
  dl[2] = tab3[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
void mlib_v_ImageLookUpSI_U16_U16_4_DstOff2_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
                                               mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
                                               mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
                                               const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
  mlib_u16 *sp;                        /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
  mlib_s32 s0, s1;                     /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
  mlib_u16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
  mlib_d64 t0, t1, t2, t3;             /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
  mlib_d64 acc;                        /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
  mlib_s32 i;                          /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
  const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
  const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
  const mlib_u16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
  const mlib_u16 *tab3 = &table[3][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
  sp = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
  s0 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
  if (xsize >= 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
    s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
    for (i = 0; i <= xsize - 2; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
      t3 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
      t2 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
      t1 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
      t0 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
      s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
      s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
    t3 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
    t2 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
    t1 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
    t0 = VIS_LD_U16_I(tab2, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
  dl = (mlib_u16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
  s0 >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
  dl[0] = tab2[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
  dl[1] = tab3[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
void mlib_v_ImageLookUpSI_U16_U16_4_DstOff3_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
                                               mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
                                               mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
                                               const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
  mlib_u16 *sp;                        /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
  mlib_s32 s0, s1;                     /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
  mlib_u16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
  mlib_d64 t0, t1, t2, t3;             /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
  mlib_d64 acc;                        /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
  mlib_s32 i;                          /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
  const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
  const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
  const mlib_u16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
  const mlib_u16 *tab3 = &table[3][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
  sp = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
  s0 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
  if (xsize >= 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
    s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    for (i = 0; i <= xsize - 2; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
      t3 = VIS_LD_U16_I(tab2, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
      t2 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
      t1 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
      t0 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
      acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
      acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
      acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
      acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
      s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
      s1 = (*sp++) << 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
      *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
    t3 = VIS_LD_U16_I(tab2, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
    t2 = VIS_LD_U16_I(tab1, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    t1 = VIS_LD_U16_I(tab0, s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
    t0 = VIS_LD_U16_I(tab3, s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    acc = vis_faligndata(t3, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
    acc = vis_faligndata(t2, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
    acc = vis_faligndata(t1, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
    acc = vis_faligndata(t0, acc);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    *dp++ = acc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
  dl = (mlib_u16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
  s0 >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
  dl[0] = tab3[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
void mlib_v_ImageLookUpSI_U16_U16_4(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
                                    mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
                                    mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
                                    mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
                                    mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
                                    mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
                                    const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
  mlib_u16 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
  mlib_u16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
  mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
  const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
  const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
  const mlib_u16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
  for (j = 0; j < ysize; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
    mlib_u16 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
    mlib_u16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
    mlib_s32 off, s0, size = xsize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
      off = ((8 - ((mlib_addr) dp & 7)) & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
      if (off == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
        mlib_v_ImageLookUpSI_U16_U16_4_DstOff0_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
      else if (off == 1) {
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
        size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
        mlib_v_ImageLookUpSI_U16_U16_4_DstOff1_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
      else if (off == 2) {
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
        size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
        mlib_v_ImageLookUpSI_U16_U16_4_DstOff2_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
      else if (off == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
        s0 = *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
        *dp++ = tab0[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
        *dp++ = tab1[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
        *dp++ = tab2[s0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
        size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
        mlib_v_ImageLookUpSI_U16_U16_4_DstOff3_D1(sp, dp, size, table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
    sl = (mlib_u16 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
    dl = (mlib_u16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
/***************************************************************/