jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageLookUpU8S16Func.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) 1998, 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_U8_S16_124_SrcOff0_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
                                                     mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
                                                     mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
                                                     const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
                                                     const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
                                                     const mlib_s16 *table2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
                                                     const mlib_s16 *table3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
static void mlib_v_ImageLookUp_U8_S16_124_SrcOff1_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
                                                     mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
                                                     mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
                                                     const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
                                                     const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
                                                     const mlib_s16 *table2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
                                                     const mlib_s16 *table3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
static void mlib_v_ImageLookUp_U8_S16_124_SrcOff2_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
                                                     mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
                                                     mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
                                                     const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
                                                     const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                                                     const mlib_s16 *table2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
                                                     const mlib_s16 *table3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
static void mlib_v_ImageLookUp_U8_S16_124_SrcOff3_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                                                     mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
                                                     mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
                                                     const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
                                                     const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                                                     const mlib_s16 *table2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
                                                     const mlib_s16 *table3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
static void mlib_v_ImageLookUp_U8_S16_3_SrcOff0_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                                                   mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                                                   mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                                                   const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                                                   const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                                                   const mlib_s16 *table2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
static void mlib_v_ImageLookUp_U8_S16_3_SrcOff1_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                                                   mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                                                   mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                                                   const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
                                                   const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
                                                   const mlib_s16 *table2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
static void mlib_v_ImageLookUp_U8_S16_3_SrcOff2_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                                                   mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                                                   mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                                                   const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
                                                   const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
                                                   const mlib_s16 *table2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
static void mlib_v_ImageLookUp_U8_S16_3_SrcOff3_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                                                   mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                                                   mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                                                   const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
                                                   const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
                                                   const mlib_s16 *table2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
#define VIS_LD_U16_I(X, Y)      vis_ld_u16_i((void *)(X), (Y))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
void mlib_v_ImageLookUp_U8_S16_124_SrcOff0_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                                              mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                                              mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
                                              const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
                                              const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                                              const mlib_s16 *table2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                                              const mlib_s16 *table3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
  mlib_u32 *sa;                        /* aligned pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
  mlib_u8 *sp;                         /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
  mlib_u32 s0;                         /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
  mlib_s16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
  mlib_s16 *dend;                      /* pointer to end of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
  mlib_d64 t0, t1, t2;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
  mlib_d64 t3, acc0;                   /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
  mlib_s32 emask;                      /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
  mlib_s32 i, num;                     /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
  sa = (mlib_u32 *) src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
  dend = dl + xsize - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
  i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
  if (xsize >= 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    s0 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    for (i = 0; i <= xsize - 8; i += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
      t3 = VIS_LD_U16_I(table3, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
      t2 = VIS_LD_U16_I(table2, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
      t1 = VIS_LD_U16_I(table1, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
      t0 = VIS_LD_U16_I(table0, (s0 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
      s0 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
      *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    t3 = VIS_LD_U16_I(table3, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    t2 = VIS_LD_U16_I(table2, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    t1 = VIS_LD_U16_I(table1, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    t0 = VIS_LD_U16_I(table0, (s0 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
  sp = (mlib_u8 *) sa;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
  if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    num = (mlib_s16 *) dend - (mlib_s16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    sp += num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    num++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    if (num == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    else if (num == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    else if (num == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
      t0 = VIS_LD_U16_I(table2, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    emask = vis_edge16(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    vis_pst_16(acc0, dp, emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
void mlib_v_ImageLookUp_U8_S16_124_SrcOff1_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
                                              mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                                              mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                                              const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                                              const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
                                              const mlib_s16 *table2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
                                              const mlib_s16 *table3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
  mlib_u32 *sa;                        /* aligned pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
  mlib_u8 *sp;                         /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
  mlib_u32 s0, s1;                     /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
  mlib_s16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
  mlib_s16 *dend;                      /* pointer to end of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
  mlib_d64 t0, t1, t2;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
  mlib_d64 t3, acc0;                   /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
  mlib_s32 emask;                      /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
  mlib_s32 i, num;                     /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
  sa = (mlib_u32 *) (src - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
  dend = dl + xsize - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
  s0 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
  if (xsize >= 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    s1 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    for (i = 0; i <= xsize - 8; i += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
      t3 = VIS_LD_U16_I(table3, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
      t2 = VIS_LD_U16_I(table2, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
      t1 = VIS_LD_U16_I(table1, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
      t0 = VIS_LD_U16_I(table0, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
      s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
      s1 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
      *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    t3 = VIS_LD_U16_I(table3, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    t2 = VIS_LD_U16_I(table2, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    t1 = VIS_LD_U16_I(table1, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    t0 = VIS_LD_U16_I(table0, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
  sp = (mlib_u8 *) sa;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
  sp -= 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
  if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    num = (mlib_s16 *) dend - (mlib_s16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    sp += num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    num++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    if (num == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    else if (num == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    else if (num == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
      t0 = VIS_LD_U16_I(table2, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    emask = vis_edge16(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    vis_pst_16(acc0, dp, emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
void mlib_v_ImageLookUp_U8_S16_124_SrcOff2_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
                                              mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                                              mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                                              const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                                              const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                                              const mlib_s16 *table2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
                                              const mlib_s16 *table3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
  mlib_u32 *sa;                        /* aligned pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
  mlib_u8 *sp;                         /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
  mlib_u32 s0, s1;                     /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
  mlib_s16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
  mlib_s16 *dend;                      /* pointer to end of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
  mlib_d64 t0, t1, t2;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
  mlib_d64 t3, acc0;                   /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
  mlib_s32 emask;                      /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
  mlib_s32 i, num;                     /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
  sa = (mlib_u32 *) (src - 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
  dend = dl + xsize - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
  s0 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
  if (xsize >= 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    s1 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    for (i = 0; i <= xsize - 8; i += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
      t3 = VIS_LD_U16_I(table3, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
      t2 = VIS_LD_U16_I(table2, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
      t1 = VIS_LD_U16_I(table1, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
      t0 = VIS_LD_U16_I(table0, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
      s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
      s1 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
      *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
    t3 = VIS_LD_U16_I(table3, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    t2 = VIS_LD_U16_I(table2, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    t1 = VIS_LD_U16_I(table1, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    t0 = VIS_LD_U16_I(table0, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
  sp = (mlib_u8 *) sa;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
  sp -= 2;
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_s16 *) dend - (mlib_s16 *) 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
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    else if (num == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
    else if (num == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
      t0 = VIS_LD_U16_I(table2, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    emask = vis_edge16(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    vis_pst_16(acc0, dp, emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
void mlib_v_ImageLookUp_U8_S16_124_SrcOff3_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
                                              mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
                                              mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
                                              const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                                              const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                                              const mlib_s16 *table2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
                                              const mlib_s16 *table3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
  mlib_u32 *sa;                        /* aligned pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
  mlib_u8 *sp;                         /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
  mlib_u32 s0, s1;                     /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
  mlib_s16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
  mlib_s16 *dend;                      /* pointer to end of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
  mlib_d64 t0, t1, t2;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
  mlib_d64 t3, acc0;                   /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
  mlib_s32 emask;                      /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
  mlib_s32 i, num;                     /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
  sa = (mlib_u32 *) (src - 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
  dend = dl + xsize - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
  s0 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
  if (xsize >= 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
    s1 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
    for (i = 0; i <= xsize - 8; i += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
      t3 = VIS_LD_U16_I(table3, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
      t2 = VIS_LD_U16_I(table2, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
      t1 = VIS_LD_U16_I(table1, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
      t0 = VIS_LD_U16_I(table0, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
      s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
      s1 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
      *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
    t3 = VIS_LD_U16_I(table3, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    t2 = VIS_LD_U16_I(table2, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
    t1 = VIS_LD_U16_I(table1, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    t0 = VIS_LD_U16_I(table0, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
    *dp++ = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
  sp = (mlib_u8 *) sa;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
  sp -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
  if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
    num = (mlib_s16 *) dend - (mlib_s16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
    sp += num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    num++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
    if (num == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    else if (num == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    else if (num == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
      t0 = VIS_LD_U16_I(table2, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    emask = vis_edge16(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
    vis_pst_16(acc0, dp, emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
void mlib_v_ImageLookUp_U8_S16_1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
                                 mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
                                 mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
                                 mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
                                 mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
                                 mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
                                 const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
  mlib_u8 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
  mlib_s16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
  const mlib_s16 *tab = table[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
  mlib_s32 j, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
  for (j = 0; j < ysize; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
    mlib_u8 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
    mlib_s16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
    mlib_s32 off, size = xsize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    off = ((8 - ((mlib_addr) dp & 7)) & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
    off = (off < size) ? off : size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    for (i = 0; i < off; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
      *dp++ = tab[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
      size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
      off = (mlib_addr) sp & 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
      if (off == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
        mlib_v_ImageLookUp_U8_S16_124_SrcOff0_D1(sp, dp, size, tab, tab, tab,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
                                                 tab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
      else if (off == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
        mlib_v_ImageLookUp_U8_S16_124_SrcOff1_D1(sp, dp, size, tab, tab, tab,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
                                                 tab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
      else if (off == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
        mlib_v_ImageLookUp_U8_S16_124_SrcOff2_D1(sp, dp, size, tab, tab, tab,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
                                                 tab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
        mlib_v_ImageLookUp_U8_S16_124_SrcOff3_D1(sp, dp, size, tab, tab, tab,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
                                                 tab);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
    sl = (mlib_u8 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    dl = (mlib_s16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
void mlib_v_ImageLookUp_U8_S16_2(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
                                 mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
                                 mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
                                 mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
                                 mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
                                 mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
                                 const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
  mlib_u8 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
  mlib_s16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
  const mlib_s16 *tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
  mlib_s32 j, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
  for (j = 0; j < ysize; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    mlib_u8 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
    mlib_s16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
    mlib_s32 off, size = xsize * 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
    const mlib_s16 *tab0 = table[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    const mlib_s16 *tab1 = table[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
    off = ((8 - ((mlib_addr) dp & 7)) & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
    off = (off < size) ? off : size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
    for (i = 0; i < off - 1; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
      *dp++ = tab0[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
      *dp++ = tab1[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
      size -= 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
    if ((off & 1) != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
      *dp++ = tab0[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
      size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
      tab = tab0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
      tab0 = tab1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
      tab1 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
      off = (mlib_addr) sp & 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
      if (off == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
        mlib_v_ImageLookUp_U8_S16_124_SrcOff0_D1(sp, dp, size, tab0, tab1, tab0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
                                                 tab1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
      else if (off == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
        mlib_v_ImageLookUp_U8_S16_124_SrcOff1_D1(sp, dp, size, tab0, tab1, tab0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
                                                 tab1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
      else if (off == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
        mlib_v_ImageLookUp_U8_S16_124_SrcOff2_D1(sp, dp, size, tab0, tab1, tab0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
                                                 tab1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
        mlib_v_ImageLookUp_U8_S16_124_SrcOff3_D1(sp, dp, size, tab0, tab1, tab0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
                                                 tab1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
    sl = (mlib_u8 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
    dl = (mlib_s16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
void mlib_v_ImageLookUp_U8_S16_4(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
                                 mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
                                 mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
                                 mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
                                 mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
                                 mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
                                 const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
  mlib_u8 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
  mlib_s16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
  const mlib_s16 *tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
  mlib_s32 j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
  for (j = 0; j < ysize; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
    mlib_u8 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
    mlib_s16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
    const mlib_s16 *tab0 = table[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
    const mlib_s16 *tab1 = table[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
    const mlib_s16 *tab2 = table[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
    const mlib_s16 *tab3 = table[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
    mlib_s32 off, size = xsize * 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
    off = ((8 - ((mlib_addr) dp & 7)) & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
    off = (off < size) ? off : size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
    if (off == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
      *dp++ = tab0[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
      tab = tab0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
      tab0 = tab1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
      tab1 = tab2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
      tab2 = tab3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
      tab3 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
      size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
    else if (off == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
      *dp++ = tab0[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
      *dp++ = tab1[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
      tab = tab0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
      tab0 = tab2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
      tab2 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
      tab = tab1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
      tab1 = tab3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
      tab3 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
      size -= 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
    else if (off == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
      *dp++ = tab0[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
      *dp++ = tab1[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
      *dp++ = tab2[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
      tab = tab3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
      tab3 = tab2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
      tab2 = tab1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
      tab1 = tab0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
      tab0 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
      size -= 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
      off = (mlib_addr) sp & 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
      if (off == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
        mlib_v_ImageLookUp_U8_S16_124_SrcOff0_D1(sp, dp, size, tab0, tab1, tab2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
                                                 tab3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
      else if (off == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
        mlib_v_ImageLookUp_U8_S16_124_SrcOff1_D1(sp, dp, size, tab0, tab1, tab2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
                                                 tab3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
      else if (off == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
        mlib_v_ImageLookUp_U8_S16_124_SrcOff2_D1(sp, dp, size, tab0, tab1, tab2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
                                                 tab3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
        mlib_v_ImageLookUp_U8_S16_124_SrcOff3_D1(sp, dp, size, tab0, tab1, tab2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
                                                 tab3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
    sl = (mlib_u8 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
    dl = (mlib_s16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
void mlib_v_ImageLookUp_U8_S16_3_SrcOff0_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
                                            mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
                                            mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
                                            const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
                                            const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
                                            const mlib_s16 *table2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
  mlib_u32 *sa;                        /* aligned pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
  mlib_u8 *sp;                         /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
  mlib_u32 s0, s1, s2;                 /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
  mlib_s16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
  mlib_s16 *dend;                      /* pointer to end of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
  mlib_d64 t0, t1, t2;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
  mlib_d64 t3, t4, t5;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
  mlib_d64 t6, t7, t8;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
  mlib_d64 t9, t10, t11;               /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
  mlib_d64 acc0, acc1, acc2;           /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
  mlib_s32 emask;                      /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
  mlib_s32 i, num;                     /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
  const mlib_s16 *table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
  sa = (mlib_u32 *) src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
  dend = dl + xsize - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
  i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
  if (xsize >= 12) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
    s0 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
    s1 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
    s2 = sa[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
    sa += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
    for (i = 0; i <= xsize - 24; i += 12, sa += 3, dp += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
      t3 = VIS_LD_U16_I(table0, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
      t2 = VIS_LD_U16_I(table2, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
      t1 = VIS_LD_U16_I(table1, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
      t0 = VIS_LD_U16_I(table0, (s0 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
      t7 = VIS_LD_U16_I(table1, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
      t6 = VIS_LD_U16_I(table0, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
      t5 = VIS_LD_U16_I(table2, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
      t4 = VIS_LD_U16_I(table1, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
      t11 = VIS_LD_U16_I(table2, (s2 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
      t10 = VIS_LD_U16_I(table1, (s2 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
      t9 = VIS_LD_U16_I(table0, (s2 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
      t8 = VIS_LD_U16_I(table2, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
      acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
      acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
      acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
      acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
      acc2 = vis_faligndata(t11, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
      acc2 = vis_faligndata(t10, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
      acc2 = vis_faligndata(t9, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
      acc2 = vis_faligndata(t8, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
      s0 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
      s1 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
      s2 = sa[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
      dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
      dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
      dp[2] = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
    t3 = VIS_LD_U16_I(table0, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
    t2 = VIS_LD_U16_I(table2, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
    t1 = VIS_LD_U16_I(table1, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
    t0 = VIS_LD_U16_I(table0, (s0 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
    t7 = VIS_LD_U16_I(table1, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
    t6 = VIS_LD_U16_I(table0, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
    t5 = VIS_LD_U16_I(table2, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
    t4 = VIS_LD_U16_I(table1, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
    t11 = VIS_LD_U16_I(table2, (s2 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
    t10 = VIS_LD_U16_I(table1, (s2 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
    t9 = VIS_LD_U16_I(table0, (s2 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
    t8 = VIS_LD_U16_I(table2, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
    acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
    acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
    acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
    acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
    acc2 = vis_faligndata(t11, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
    acc2 = vis_faligndata(t10, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
    acc2 = vis_faligndata(t9, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
    acc2 = vis_faligndata(t8, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
    dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
    dp[2] = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
    dp += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
    i += 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
  if (i <= xsize - 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
    s0 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
    s1 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
    t3 = VIS_LD_U16_I(table0, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
    t2 = VIS_LD_U16_I(table2, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
    t1 = VIS_LD_U16_I(table1, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
    t0 = VIS_LD_U16_I(table0, (s0 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
    t7 = VIS_LD_U16_I(table1, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
    t6 = VIS_LD_U16_I(table0, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
    t5 = VIS_LD_U16_I(table2, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
    t4 = VIS_LD_U16_I(table1, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
    acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
    acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
    acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
    acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
    dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
    table = table0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
    table0 = table2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
    table2 = table1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
    table1 = table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
    sa += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
    i += 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
    dp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
  if (i <= xsize - 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
    s0 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
    t3 = VIS_LD_U16_I(table0, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
    t2 = VIS_LD_U16_I(table2, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
    t1 = VIS_LD_U16_I(table1, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
    t0 = VIS_LD_U16_I(table0, (s0 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
    table = table0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
    table0 = table1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
    table1 = table2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
    table2 = table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
    sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
    i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
    dp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
  sp = (mlib_u8 *) sa;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
  if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
    num = (mlib_s16 *) dend - (mlib_s16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
    sp += num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
    num++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
    if (num == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
    else if (num == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
    else if (num == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
      t0 = VIS_LD_U16_I(table2, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
    emask = vis_edge16(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
    vis_pst_16(acc0, dp, emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
void mlib_v_ImageLookUp_U8_S16_3_SrcOff1_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
                                            mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
                                            mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
                                            const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
                                            const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
                                            const mlib_s16 *table2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
  mlib_u32 *sa;                        /* aligned pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
  mlib_u8 *sp;                         /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
  mlib_u32 s0, s1, s2, s3;             /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
  mlib_s16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
  mlib_s16 *dend;                      /* pointer to end of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
  mlib_d64 t0, t1, t2;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
  mlib_d64 t3, t4, t5;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
  mlib_d64 t6, t7, t8;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
  mlib_d64 t9, t10, t11;               /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
  mlib_d64 acc0, acc1, acc2;           /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
  mlib_s32 emask;                      /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
  mlib_s32 i, num;                     /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
  const mlib_s16 *table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
  sa = (mlib_u32 *) (src - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
  dend = dl + xsize - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
  i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
  s0 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
  if (xsize >= 12) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
    s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
    s2 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
    s3 = sa[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
    sa += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
    for (i = 0; i <= xsize - 24; i += 12, sa += 3, dp += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
      t3 = VIS_LD_U16_I(table0, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
      t2 = VIS_LD_U16_I(table2, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
      t1 = VIS_LD_U16_I(table1, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
      t0 = VIS_LD_U16_I(table0, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
      t7 = VIS_LD_U16_I(table1, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
      t6 = VIS_LD_U16_I(table0, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
      t5 = VIS_LD_U16_I(table2, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
      t4 = VIS_LD_U16_I(table1, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
      t11 = VIS_LD_U16_I(table2, (s3 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
      t10 = VIS_LD_U16_I(table1, (s2 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
      t9 = VIS_LD_U16_I(table0, (s2 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
      t8 = VIS_LD_U16_I(table2, (s2 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
      acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
      acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
      acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
      acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
      acc2 = vis_faligndata(t11, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
      acc2 = vis_faligndata(t10, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
      acc2 = vis_faligndata(t9, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
      acc2 = vis_faligndata(t8, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
      s0 = s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
      s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
      s2 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
      s3 = sa[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
      dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
      dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
      dp[2] = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
    t3 = VIS_LD_U16_I(table0, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
    t2 = VIS_LD_U16_I(table2, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
    t1 = VIS_LD_U16_I(table1, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
    t0 = VIS_LD_U16_I(table0, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
    t7 = VIS_LD_U16_I(table1, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
    t6 = VIS_LD_U16_I(table0, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
    t5 = VIS_LD_U16_I(table2, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
    t4 = VIS_LD_U16_I(table1, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
    t11 = VIS_LD_U16_I(table2, (s3 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
    t10 = VIS_LD_U16_I(table1, (s2 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
    t9 = VIS_LD_U16_I(table0, (s2 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
    t8 = VIS_LD_U16_I(table2, (s2 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
    acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
    acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
    acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
    acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
    acc2 = vis_faligndata(t11, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
    acc2 = vis_faligndata(t10, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
    acc2 = vis_faligndata(t9, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
    acc2 = vis_faligndata(t8, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
    dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
    dp[2] = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
    s0 = s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
    dp += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
    i += 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
  if (i <= xsize - 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
    s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
    s2 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
    t3 = VIS_LD_U16_I(table0, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
    t2 = VIS_LD_U16_I(table2, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
    t1 = VIS_LD_U16_I(table1, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
    t0 = VIS_LD_U16_I(table0, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
    t7 = VIS_LD_U16_I(table1, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
    t6 = VIS_LD_U16_I(table0, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
    t5 = VIS_LD_U16_I(table2, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
    t4 = VIS_LD_U16_I(table1, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
    acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
    acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
    acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
    acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
    dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
    table = table0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
    table0 = table2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
    table2 = table1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
    table1 = table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
    sa += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
    i += 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
    dp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
    s0 = s2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
  if (i <= xsize - 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
    s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
    t3 = VIS_LD_U16_I(table0, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
    t2 = VIS_LD_U16_I(table2, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
    t1 = VIS_LD_U16_I(table1, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
    t0 = VIS_LD_U16_I(table0, (s0 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
    table = table0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
    table0 = table1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
    table1 = table2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
    table2 = table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
    sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
    i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
    dp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
  sp = (mlib_u8 *) sa;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
  sp -= 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
  if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
    num = (mlib_s16 *) dend - (mlib_s16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
    sp += num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
    num++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
    if (num == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
    else if (num == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
    else if (num == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
      t0 = VIS_LD_U16_I(table2, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
    emask = vis_edge16(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
    vis_pst_16(acc0, dp, emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
void mlib_v_ImageLookUp_U8_S16_3_SrcOff2_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
                                            mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
                                            mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
                                            const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
                                            const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
                                            const mlib_s16 *table2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
  mlib_u32 *sa;                        /* aligned pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
  mlib_u8 *sp;                         /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
  mlib_u32 s0, s1, s2, s3;             /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
  mlib_s16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
  mlib_s16 *dend;                      /* pointer to end of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
  mlib_d64 t0, t1, t2;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
  mlib_d64 t3, t4, t5;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
  mlib_d64 t6, t7, t8;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
  mlib_d64 t9, t10, t11;               /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
  mlib_d64 acc0, acc1, acc2;           /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
  mlib_s32 emask;                      /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
  mlib_s32 i, num;                     /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
  const mlib_s16 *table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
  sa = (mlib_u32 *) (src - 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
  dend = dl + xsize - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
  i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
  s0 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
  if (xsize >= 12) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
    s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
    s2 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
    s3 = sa[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
    sa += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
    for (i = 0; i <= xsize - 24; i += 12, sa += 3, dp += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
      t3 = VIS_LD_U16_I(table0, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
      t2 = VIS_LD_U16_I(table2, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
      t1 = VIS_LD_U16_I(table1, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
      t0 = VIS_LD_U16_I(table0, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
      t7 = VIS_LD_U16_I(table1, (s2 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
      t6 = VIS_LD_U16_I(table0, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
      t5 = VIS_LD_U16_I(table2, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
      t4 = VIS_LD_U16_I(table1, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
      t11 = VIS_LD_U16_I(table2, (s3 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
      t10 = VIS_LD_U16_I(table1, (s3 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
      t9 = VIS_LD_U16_I(table0, (s2 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
      t8 = VIS_LD_U16_I(table2, (s2 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
      acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
      acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
      acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
      acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
      acc2 = vis_faligndata(t11, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
      acc2 = vis_faligndata(t10, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
      acc2 = vis_faligndata(t9, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
      acc2 = vis_faligndata(t8, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
      s0 = s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
      s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
      s2 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
      s3 = sa[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
      dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
      dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
      dp[2] = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
    t3 = VIS_LD_U16_I(table0, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
    t2 = VIS_LD_U16_I(table2, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
    t1 = VIS_LD_U16_I(table1, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
    t0 = VIS_LD_U16_I(table0, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
    t7 = VIS_LD_U16_I(table1, (s2 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
    t6 = VIS_LD_U16_I(table0, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
    t5 = VIS_LD_U16_I(table2, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
    t4 = VIS_LD_U16_I(table1, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
    t11 = VIS_LD_U16_I(table2, (s3 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
    t10 = VIS_LD_U16_I(table1, (s3 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
    t9 = VIS_LD_U16_I(table0, (s2 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
    t8 = VIS_LD_U16_I(table2, (s2 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
    acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
    acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
    acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
    acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
    acc2 = vis_faligndata(t11, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
    acc2 = vis_faligndata(t10, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
    acc2 = vis_faligndata(t9, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
    acc2 = vis_faligndata(t8, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
    dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
    dp[2] = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
    s0 = s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
    dp += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
    i += 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
  if (i <= xsize - 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
    s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
    s2 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
    t3 = VIS_LD_U16_I(table0, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
    t2 = VIS_LD_U16_I(table2, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
    t1 = VIS_LD_U16_I(table1, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
    t0 = VIS_LD_U16_I(table0, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
    t7 = VIS_LD_U16_I(table1, (s2 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
    t6 = VIS_LD_U16_I(table0, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
    t5 = VIS_LD_U16_I(table2, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
    t4 = VIS_LD_U16_I(table1, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
    acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
    acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
    acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
    acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
    dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
    table = table0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
    table0 = table2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
    table2 = table1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
    table1 = table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
    sa += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
    i += 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
    dp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
    s0 = s2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
  if (i <= xsize - 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
    s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
    t3 = VIS_LD_U16_I(table0, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
    t2 = VIS_LD_U16_I(table2, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
    t1 = VIS_LD_U16_I(table1, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
    t0 = VIS_LD_U16_I(table0, (s0 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
    table = table0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
    table0 = table1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
    table1 = table2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
    table2 = table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
    sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
    i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
    dp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
  sp = (mlib_u8 *) sa;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
  sp -= 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
  if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
    num = (mlib_s16 *) dend - (mlib_s16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
    sp += num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
    num++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
    if (num == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1363
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1364
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
    else if (num == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
    else if (num == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1379
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
      t0 = VIS_LD_U16_I(table2, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1383
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1384
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1385
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1386
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1390
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1391
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1397
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1398
    emask = vis_edge16(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1399
    vis_pst_16(acc0, dp, emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1400
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1401
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1402
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1403
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1404
void mlib_v_ImageLookUp_U8_S16_3_SrcOff3_D1(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1405
                                            mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1406
                                            mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1407
                                            const mlib_s16 *table0,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1408
                                            const mlib_s16 *table1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1409
                                            const mlib_s16 *table2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1410
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1411
  mlib_u32 *sa;                        /* aligned pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1412
  mlib_u8 *sp;                         /* pointer to source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1413
  mlib_u32 s0, s1, s2, s3;             /* source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1414
  mlib_s16 *dl;                        /* pointer to start of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1415
  mlib_s16 *dend;                      /* pointer to end of destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1416
  mlib_d64 *dp;                        /* aligned pointer to destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1417
  mlib_d64 t0, t1, t2;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1418
  mlib_d64 t3, t4, t5;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1419
  mlib_d64 t6, t7, t8;                 /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1420
  mlib_d64 t9, t10, t11;               /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1421
  mlib_d64 acc0, acc1, acc2;           /* destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1422
  mlib_s32 emask;                      /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1423
  mlib_s32 i, num;                     /* loop variable */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1424
  const mlib_s16 *table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1425
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1426
  sa = (mlib_u32 *) (src - 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1427
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1428
  dp = (mlib_d64 *) dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1429
  dend = dl + xsize - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1430
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1431
  vis_alignaddr((void *)0, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1432
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1433
  i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1434
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1435
  s0 = *sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1436
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1437
  if (xsize >= 12) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1438
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1439
    s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1440
    s2 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1441
    s3 = sa[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1442
    sa += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1443
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1444
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1445
    for (i = 0; i <= xsize - 24; i += 12, sa += 3, dp += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1446
      t3 = VIS_LD_U16_I(table0, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1447
      t2 = VIS_LD_U16_I(table2, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1448
      t1 = VIS_LD_U16_I(table1, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1449
      t0 = VIS_LD_U16_I(table0, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1450
      t7 = VIS_LD_U16_I(table1, (s2 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1451
      t6 = VIS_LD_U16_I(table0, (s2 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1452
      t5 = VIS_LD_U16_I(table2, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1453
      t4 = VIS_LD_U16_I(table1, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1454
      t11 = VIS_LD_U16_I(table2, (s3 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1455
      t10 = VIS_LD_U16_I(table1, (s3 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1456
      t9 = VIS_LD_U16_I(table0, (s3 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1457
      t8 = VIS_LD_U16_I(table2, (s2 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1458
      acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1459
      acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1460
      acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1461
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1462
      acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1463
      acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1464
      acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1465
      acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1466
      acc2 = vis_faligndata(t11, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1467
      acc2 = vis_faligndata(t10, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1468
      acc2 = vis_faligndata(t9, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1469
      acc2 = vis_faligndata(t8, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1470
      s0 = s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1471
      s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1472
      s2 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1473
      s3 = sa[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1474
      dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1475
      dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1476
      dp[2] = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1477
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1478
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1479
    t3 = VIS_LD_U16_I(table0, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1480
    t2 = VIS_LD_U16_I(table2, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1481
    t1 = VIS_LD_U16_I(table1, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1482
    t0 = VIS_LD_U16_I(table0, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1483
    t7 = VIS_LD_U16_I(table1, (s2 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1484
    t6 = VIS_LD_U16_I(table0, (s2 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1485
    t5 = VIS_LD_U16_I(table2, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1486
    t4 = VIS_LD_U16_I(table1, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1487
    t11 = VIS_LD_U16_I(table2, (s3 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1488
    t10 = VIS_LD_U16_I(table1, (s3 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1489
    t9 = VIS_LD_U16_I(table0, (s3 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1490
    t8 = VIS_LD_U16_I(table2, (s2 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1491
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1492
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1493
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1494
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1495
    acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1496
    acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1497
    acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1498
    acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1499
    acc2 = vis_faligndata(t11, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1500
    acc2 = vis_faligndata(t10, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1501
    acc2 = vis_faligndata(t9, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1502
    acc2 = vis_faligndata(t8, acc2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1503
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1504
    dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1505
    dp[2] = acc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1506
    s0 = s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1507
    dp += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1508
    i += 12;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1509
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1510
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1511
  if (i <= xsize - 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1512
    s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1513
    s2 = sa[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1514
    t3 = VIS_LD_U16_I(table0, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1515
    t2 = VIS_LD_U16_I(table2, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1516
    t1 = VIS_LD_U16_I(table1, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1517
    t0 = VIS_LD_U16_I(table0, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1518
    t7 = VIS_LD_U16_I(table1, (s2 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1519
    t6 = VIS_LD_U16_I(table0, (s2 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1520
    t5 = VIS_LD_U16_I(table2, (s2 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1521
    t4 = VIS_LD_U16_I(table1, (s1 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1522
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1523
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1524
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1525
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1526
    acc1 = vis_faligndata(t7, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1527
    acc1 = vis_faligndata(t6, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1528
    acc1 = vis_faligndata(t5, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1529
    acc1 = vis_faligndata(t4, acc1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1530
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1531
    dp[1] = acc1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1532
    table = table0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1533
    table0 = table2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1534
    table2 = table1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1535
    table1 = table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1536
    sa += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1537
    i += 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1538
    dp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1539
    s0 = s2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1540
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1541
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1542
  if (i <= xsize - 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1543
    s1 = sa[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1544
    t3 = VIS_LD_U16_I(table0, (s1 >> 7) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1545
    t2 = VIS_LD_U16_I(table2, (s1 >> 15) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1546
    t1 = VIS_LD_U16_I(table1, (s1 >> 23) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1547
    t0 = VIS_LD_U16_I(table0, (s0 << 1) & 0x1FE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1548
    acc0 = vis_faligndata(t3, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1549
    acc0 = vis_faligndata(t2, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1550
    acc0 = vis_faligndata(t1, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1551
    acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1552
    dp[0] = acc0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1553
    table = table0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1554
    table0 = table1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1555
    table1 = table2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1556
    table2 = table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1557
    sa++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1558
    i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1559
    dp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1560
    s0 = s1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1561
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1562
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1563
  sp = (mlib_u8 *) sa;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1564
  sp -= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1565
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1566
  if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1567
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1568
    num = (mlib_s16 *) dend - (mlib_s16 *) dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1569
    sp += num;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1570
    num++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1571
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1572
    if (num == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1573
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1574
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1575
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1576
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1577
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1578
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1579
    else if (num == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1580
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1581
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1582
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1583
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1584
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1585
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1586
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1587
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1588
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1589
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1590
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1591
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1592
    else if (num == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1593
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1594
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1595
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1596
      t0 = VIS_LD_U16_I(table2, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1597
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1598
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1599
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1600
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1601
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1602
      t0 = VIS_LD_U16_I(table1, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1603
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1604
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1605
      s0 = (mlib_s32) * sp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1606
      sp--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1607
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1608
      t0 = VIS_LD_U16_I(table0, 2 * s0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1609
      acc0 = vis_faligndata(t0, acc0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1610
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1611
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1612
    emask = vis_edge16(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1613
    vis_pst_16(acc0, dp, emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1614
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1615
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1616
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1617
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1618
void mlib_v_ImageLookUp_U8_S16_3(const mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1619
                                 mlib_s32       slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1620
                                 mlib_s16       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1621
                                 mlib_s32       dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1622
                                 mlib_s32       xsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1623
                                 mlib_s32       ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1624
                                 const mlib_s16 **table)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1625
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1626
  mlib_u8 *sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1627
  mlib_s16 *dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1628
  const mlib_s16 *tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1629
  mlib_s32 j, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1630
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1631
  sl = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1632
  dl = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1633
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1634
  /* row loop */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1635
  for (j = 0; j < ysize; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1636
    mlib_u8 *sp = sl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1637
    mlib_s16 *dp = dl;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1638
    const mlib_s16 *tab0 = table[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1639
    const mlib_s16 *tab1 = table[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1640
    const mlib_s16 *tab2 = table[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1641
    mlib_s32 off, size = xsize * 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1642
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1643
    off = ((8 - ((mlib_addr) dp & 7)) & 7) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1644
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1645
    off = (off < size) ? off : size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1646
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1647
    for (i = 0; i < off - 2; i += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1648
      *dp++ = tab0[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1649
      *dp++ = tab1[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1650
      *dp++ = tab2[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1651
      size -= 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1652
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1653
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1654
    off -= i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1655
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1656
    if (off == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1657
      *dp++ = tab0[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1658
      tab = tab0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1659
      tab0 = tab1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1660
      tab1 = tab2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1661
      tab2 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1662
      size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1663
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1664
    else if (off == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1665
      *dp++ = tab0[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1666
      *dp++ = tab1[(*sp++)];
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1667
      tab = tab2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1668
      tab2 = tab1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1669
      tab1 = tab0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1670
      tab0 = tab;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1671
      size -= 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1672
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1673
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1674
    if (size > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1675
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1676
      off = (mlib_addr) sp & 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1677
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1678
      if (off == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1679
        mlib_v_ImageLookUp_U8_S16_3_SrcOff0_D1(sp, dp, size, tab0, tab1, tab2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1680
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1681
      else if (off == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1682
        mlib_v_ImageLookUp_U8_S16_3_SrcOff1_D1(sp, dp, size, tab0, tab1, tab2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1683
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1684
      else if (off == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1685
        mlib_v_ImageLookUp_U8_S16_3_SrcOff2_D1(sp, dp, size, tab0, tab1, tab2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1686
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1687
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1688
        mlib_v_ImageLookUp_U8_S16_3_SrcOff3_D1(sp, dp, size, tab0, tab1, tab2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1689
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1690
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1691
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1692
    sl = (mlib_u8 *) ((mlib_u8 *) sl + slb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1693
    dl = (mlib_s16 *) ((mlib_u8 *) dl + dlb);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1694
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1695
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1696
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1697
/***************************************************************/