jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpU16U16Func.c
author bae
Fri, 15 Oct 2010 10:42:39 +0400
changeset 6814 c6e347fb5b20
parent 5506 202f599c92aa
permissions -rw-r--r--
6725821: Compiler warnings in medialib code Reviewed-by: igor, prr
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_ImageLookUp_U16_U16_124_D1(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 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
                                              const mlib_u16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
                                              const mlib_u16 *table2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
                                              const mlib_u16 *table3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
static void mlib_v_ImageLookUp_U16_U16_3_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
                                            mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
                                            mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
                                            const mlib_u16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
                                            const mlib_u16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
                                            const mlib_u16 *table2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#define VIS_LD_U16_I(X, Y)      vis_ld_u16_i((void *)(X), (Y))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
void mlib_v_ImageLookUp_U16_U16_124_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
                                       mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                                       mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
                                       const mlib_u16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                                       const mlib_u16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
                                       const mlib_u16 *table2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                                       const mlib_u16 *table3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  mlib_u16 *sp;            /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
  mlib_s32 s0, s1, s2, s3; /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
  mlib_u16 *dl;            /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
  mlib_u16 *dend;          /* pointer to end of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
  mlib_d64 *dp;            /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
  mlib_d64 t0, t1, t2;     /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
  mlib_d64 t3, acc0;       /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
  mlib_s32 emask;          /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
  mlib_s32 i, num;         /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  dl   = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  sp   = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
  dp   = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
  dend = dl + xsize - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
  vis_alignaddr((void *) 0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
  i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  if (xsize >= 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
    s0 = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
    s1 = sp[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    s2 = sp[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    s3 = sp[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    sp += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    for(i = 0; i <= xsize - 8; i+=4, sp += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
      t3 = VIS_LD_U16_I(table3, 2*s3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
      t2 = VIS_LD_U16_I(table2, 2*s2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
      t1 = VIS_LD_U16_I(table1, 2*s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
      t0 = VIS_LD_U16_I(table0, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
      s0 = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
      s1 = sp[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
      s2 = sp[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
      s3 = sp[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
      *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    t3 = VIS_LD_U16_I(table3, 2*s3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    t2 = VIS_LD_U16_I(table2, 2*s2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    t1 = VIS_LD_U16_I(table1, 2*s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    t0 = VIS_LD_U16_I(table0, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
  if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    num = (mlib_u16*) dend - (mlib_u16*) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    sp  += num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    num ++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    if (num == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
      t0  = VIS_LD_U16_I(table0, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    } else if (num  == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
      t0  = VIS_LD_U16_I(table1, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
      t0  = VIS_LD_U16_I(table0, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    } else if (num == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
      t0  = VIS_LD_U16_I(table2, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
      t0  = VIS_LD_U16_I(table1, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
      t0  = VIS_LD_U16_I(table0, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    emask = vis_edge16(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    vis_pst_16(acc0, dp, emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
void mlib_v_ImageLookUp_U16_U16_1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
                                  mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                                  mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                                  mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                                  mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
                                  mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
                                  const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
  mlib_u16 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
  mlib_u16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
  const mlib_u16 *tab = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
  mlib_s32 j, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
  for (j = 0; j < ysize; j ++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
    mlib_u16 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    mlib_u16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    mlib_s32 off, size = xsize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    off = ((8 - ((mlib_addr)dp & 7)) & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    off = (off < size) ? off : size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
    for (i = 0; i < off; i++, sp++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
      *dp++ = tab[sp[0]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
      size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
      mlib_v_ImageLookUp_U16_U16_124_D1(sp, dp, size, tab, tab, tab, tab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    sl = (mlib_u16 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    dl = (mlib_u16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
void mlib_v_ImageLookUp_U16_U16_2(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                                  mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
                                  mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                                  mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                                  mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                                  mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                                  const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
  mlib_u16  *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
  mlib_u16  *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
  const mlib_u16  *tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
  mlib_s32  j, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
  for (j = 0; j < ysize; j ++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    mlib_u16  *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    mlib_u16  *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    mlib_s32  off, size = xsize * 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    off = ((8 - ((mlib_addr)dp & 7)) & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    off = (off < size) ? off : size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    for (i = 0; i < off - 1; i+=2, sp += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
      *dp++ = tab0[sp[0]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
      *dp++ = tab1[sp[1]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
      size-=2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    if ((off & 1) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
      *dp++ = tab0[sp[0]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
      size--; sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
      tab = tab0; tab0 = tab1; tab1 = tab;
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
      mlib_v_ImageLookUp_U16_U16_124_D1(sp, dp, size, tab0, tab1, tab0, tab1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    sl = (mlib_u16 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    dl = (mlib_u16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
  }
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
void mlib_v_ImageLookUp_U16_U16_4(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
                                  mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
                                  mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
                                  mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
                                  mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
                                  mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
                                  const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
  mlib_u16  *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
  mlib_u16  *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
  const mlib_u16  *tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
  mlib_s32  j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
  for (j = 0; j < ysize; j ++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    mlib_u16  *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    mlib_u16  *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    const mlib_u16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    const mlib_u16 *tab3 = &table[3][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    mlib_s32  off, size = xsize * 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    off = ((8 - ((mlib_addr)dp & 7)) & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    off = (off < size) ? off : size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    if (off == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
      *dp++ = tab0[sp[0]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
      tab = tab0; tab0 = tab1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
      tab1 = tab2; tab2 = tab3; tab3 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
      size--; sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    } else if (off == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
      *dp++ = tab0[sp[0]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
      *dp++ = tab1[sp[1]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
      tab = tab0; tab0 = tab2; tab2 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
      tab = tab1; tab1 = tab3; tab3 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
      size-=2; sp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    } else if (off == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
      *dp++ = tab0[sp[0]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
      *dp++ = tab1[sp[1]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
      *dp++ = tab2[sp[2]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
      tab = tab3; tab3 = tab2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
      tab2 = tab1; tab1 = tab0; tab0 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
      size-=3; sp += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
      mlib_v_ImageLookUp_U16_U16_124_D1(sp, dp, size, tab0, tab1, tab2, tab3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    sl = (mlib_u16 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    dl = (mlib_u16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
void mlib_v_ImageLookUp_U16_U16_3_D1(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                                     mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
                                     mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
                                     const mlib_u16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                                     const mlib_u16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                                     const mlib_u16 *table2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
  mlib_u16 *sp;              /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
  mlib_s32 s0, s1, s2, s3;   /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
  mlib_u16 *dl;              /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
  mlib_u16 *dend;            /* pointer to end of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
  mlib_d64 *dp;              /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
  mlib_d64 t0, t1, t2, t3;   /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
  mlib_d64 acc0;             /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
  mlib_s32 emask;            /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
  mlib_s32 i, num;           /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
  const mlib_u16 *table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
  dl   = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
  sp   = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
  dp   = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
  dend = dl + xsize - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
  vis_alignaddr((void *) 0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
  i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
  if (xsize >= 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    s0 = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    s1 = sp[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    s2 = sp[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    s3 = sp[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    sp += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    for(i = 0; i <= xsize - 8; i+=4, sp += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
      t3 = VIS_LD_U16_I(table0, 2*s3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
      t2 = VIS_LD_U16_I(table2, 2*s2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
      t1 = VIS_LD_U16_I(table1, 2*s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
      t0 = VIS_LD_U16_I(table0, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
      s0 = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
      s1 = sp[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
      s2 = sp[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
      s3 = sp[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
      *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
      table = table0; table0 = table1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
      table1 = table2; table2 = table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    t3 = VIS_LD_U16_I(table0, 2*s3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    t2 = VIS_LD_U16_I(table2, 2*s2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    t1 = VIS_LD_U16_I(table1, 2*s1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    t0 = VIS_LD_U16_I(table0, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
    table = table0; table0 = table1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    table1 = table2; table2 = table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
  if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    num = (mlib_u16*) dend - (mlib_u16*) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    sp  += num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    num ++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    if (num == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
      t0  = VIS_LD_U16_I(table0, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    } else if (num  == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
      t0  = VIS_LD_U16_I(table1, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
      t0  = VIS_LD_U16_I(table0, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    } else if (num == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
      t0  = VIS_LD_U16_I(table2, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
      t0  = VIS_LD_U16_I(table1, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
      s0 = (mlib_s32) *sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
      sp --;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
      t0  = VIS_LD_U16_I(table0, 2*s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
    emask = vis_edge16(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    vis_pst_16(acc0, dp, emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
void mlib_v_ImageLookUp_U16_U16_3(const mlib_u16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
                                  mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
                                  mlib_u16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
                                  mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                                  mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                                  mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                                  const mlib_u16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
  mlib_u16 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
  mlib_u16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
  const mlib_u16 *tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
  mlib_s32 j, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
  for (j = 0; j < ysize; j ++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    mlib_u16  *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    mlib_u16  *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    const mlib_u16 *tab0 = &table[0][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    const mlib_u16 *tab1 = &table[1][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    const mlib_u16 *tab2 = &table[2][0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    mlib_s32  off, size = xsize * 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    off = ((8 - ((mlib_addr)dp & 7)) & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
    off = (off < size) ? off : size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    for (i = 0; i < off - 2; i += 3, sp += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
      *dp++ = tab0[sp[0]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
      *dp++ = tab1[sp[1]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
      *dp++ = tab2[sp[2]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
      size-=3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    off -= i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
    if (off == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
      *dp++ = tab0[sp[0]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
      tab = tab0; tab0 = tab1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
      tab1 = tab2; tab2 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
      size--; sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    } else if (off == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
      *dp++ = tab0[sp[0]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
      *dp++ = tab1[sp[1]];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
      tab = tab2; tab2 = tab1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
      tab1 = tab0; tab0 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
      size-=2; sp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
      mlib_v_ImageLookUp_U16_U16_3_D1(sp, dp, size, tab0, tab1, tab2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    sl = (mlib_u16 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    dl = (mlib_u16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
/***************************************************************/