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