jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageAffine_BC_U16.c
author bae
Fri, 15 Oct 2010 10:42:39 +0400
changeset 6814 c6e347fb5b20
parent 5506 202f599c92aa
permissions -rw-r--r--
6725821: Compiler warnings in medialib code Reviewed-by: igor, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *      The functions step along the lines from xLeft to xRight and apply
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *      the bicubic filtering.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "vis_proto.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "mlib_ImageAffine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#include "mlib_v_ImageFilters.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#define DTYPE  mlib_s16
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define FILTER_BITS  9
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
#define sPtr srcPixelPtr
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#define NEXT_PIXEL_1BC_S16()                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
  xSrc = (X >> MLIB_SHIFT)-1;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
  ySrc = (Y >> MLIB_SHIFT)-1;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
  sPtr = (mlib_s16 *)lineAddr[ySrc] + xSrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#define LOAD_BC_S16_1CH_1PIXEL(mlib_filters_s16, mlib_filters_s16_4)    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
  row0 = vis_faligndata(data0, data1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
  row1 = vis_faligndata(data0, data1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
  row2 = vis_faligndata(data0, data1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
  row3 = vis_faligndata(data0, data1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
  filterposy = (Y >> FILTER_SHIFT) & FILTER_MASK;                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  yPtr = ((mlib_d64 *) ((mlib_u8 *)mlib_filters_s16_4 + filterposy*4)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
  yFilter0 = yPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
  yFilter1 = yPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
  yFilter2 = yPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
  yFilter3 = yPtr[3];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  filterposx = (X >> FILTER_SHIFT) & FILTER_MASK;                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
  xFilter = *((mlib_d64 *)((mlib_u8 *)mlib_filters_s16 + filterposx));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
  X += dX;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
  Y += dY
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
#define RESULT_1BC_S16_1PIXEL()                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
  u0 = vis_fmul8sux16(vis_fxor(row0, mask8000), yFilter0);               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
  u1 = vis_fmul8ulx16(vis_fxor(row0, mask8000), yFilter0);               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
  u2 = vis_fmul8sux16(vis_fxor(row1, mask8000), yFilter1);               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
  v0 = vis_fpadd16(u0, u1);                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
  u3 = vis_fmul8ulx16(vis_fxor(row1, mask8000), yFilter1);               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
  u0 = vis_fmul8sux16(vis_fxor(row2, mask8000), yFilter2);               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
  v1 = vis_fpadd16(u2, u3);                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
  u1 = vis_fmul8ulx16(vis_fxor(row2, mask8000), yFilter2);               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
  sum = vis_fpadd16(v0, v1);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
  u2 = vis_fmul8sux16(vis_fxor(row3, mask8000), yFilter3);               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
  v2 = vis_fpadd16(u0, u1);                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
  u3 = vis_fmul8ulx16(vis_fxor(row3, mask8000), yFilter3);               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
  sum = vis_fpadd16(sum, v2);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
  v3 = vis_fpadd16(u2, u3);                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
  sum = vis_fpadd16(sum, v3);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
  d00 = vis_fmul8sux16(sum, xFilter);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
  d10 = vis_fmul8ulx16(sum, xFilter);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
  d0 = vis_fpadd16(d00, d10);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
  p0 = vis_fpadd16s(vis_read_hi(d0), vis_read_lo(d0));                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
  d0 = vis_fmuld8sux16(f_x01000100, p0);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
  d1 = vis_write_lo(d1, vis_fpadd32s(vis_read_hi(d0), vis_read_lo(d0))); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
  res = vis_fxor(vis_fpackfix_pair(d1, d1), mask8000)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
#define BC_S16_1CH(ind, mlib_filters_s16, mlib_filters_s16_4)           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
  u0 = vis_fmul8sux16(vis_fxor(row0, mask8000), yFilter0);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
  u1 = vis_fmul8ulx16(vis_fxor(row0, mask8000), yFilter0);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
  u2 = vis_fmul8sux16(vis_fxor(row1, mask8000), yFilter1);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
  v0 = vis_fpadd16(u0, u1);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
  filterposy = (Y >> FILTER_SHIFT);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
  u3 = vis_fmul8ulx16(vis_fxor(row1, mask8000), yFilter1);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
  row0 = vis_faligndata(data0, data1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
  filterposx = (X >> FILTER_SHIFT);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
  u0 = vis_fmul8sux16(vis_fxor(row2, mask8000), yFilter2);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
  v1 = vis_fpadd16(u2, u3);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
  u1 = vis_fmul8ulx16(vis_fxor(row2, mask8000), yFilter2);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
  sum = vis_fpadd16(v0, v1);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
  X += dX;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
  row1 = vis_faligndata(data0, data1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
  u2 = vis_fmul8sux16(vis_fxor(row3, mask8000), yFilter3);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
  v2 = vis_fpadd16(u0, u1);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
  Y += dY;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
  xSrc = (X >> MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
  u3 = vis_fmul8ulx16(vis_fxor(row3, mask8000), yFilter3);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
  sum = vis_fpadd16(sum, v2);                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
  ySrc = (Y >> MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
  filterposy &= FILTER_MASK;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
  row2 = vis_faligndata(data0, data1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
  filterposx &= FILTER_MASK;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
  v3 = vis_fpadd16(u2, u3);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
  row3 = vis_faligndata(data0, data1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
  yPtr = ((mlib_d64 *) ((mlib_u8 *)mlib_filters_s16_4 + filterposy*4)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
  yFilter0 = yPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
  sum = vis_fpadd16(sum, v3);                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
  yFilter1 = yPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
  d0 = vis_fmul8sux16(sum, xFilter);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
  yFilter2 = yPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
  d1 = vis_fmul8ulx16(sum, xFilter);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
  yFilter3 = yPtr[3];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
  xFilter = *((mlib_d64 *)((mlib_u8 *)mlib_filters_s16 + filterposx));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
  d0##ind = vis_fpadd16(d0, d1);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
  sPtr = (mlib_s16 *)lineAddr[ySrc] + xSrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
#define FADD_1BC_S16()                                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
  p0 = vis_fpadd16s(vis_read_hi(d00), vis_read_lo(d00));              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
  p1 = vis_fpadd16s(vis_read_hi(d01), vis_read_lo(d01));              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
  p2 = vis_fpadd16s(vis_read_hi(d02), vis_read_lo(d02));              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
  p3 = vis_fpadd16s(vis_read_hi(d03), vis_read_lo(d03));              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
  d0 = vis_fmuld8sux16(f_x01000100, p0);                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
  d1 = vis_fmuld8sux16(f_x01000100, p1);                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
  d2 = vis_fmuld8sux16(f_x01000100, p2);                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
  d3 = vis_fmuld8sux16(f_x01000100, p3);                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
  d0 = vis_freg_pair(vis_fpadd32s(vis_read_hi(d0), vis_read_lo(d0)),  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
                     vis_fpadd32s(vis_read_hi(d1), vis_read_lo(d1))); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
  d1 = vis_freg_pair(vis_fpadd32s(vis_read_hi(d2), vis_read_lo(d2)),  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                     vis_fpadd32s(vis_read_hi(d3), vis_read_lo(d3))); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
  res = vis_fxor(vis_fpackfix_pair(d0, d1), mask8000)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
mlib_status mlib_ImageAffine_u16_1ch_bc (mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
  mlib_s32  filterposx, filterposy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
  mlib_d64  data0, data1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
  mlib_d64  sum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
  mlib_d64  row0, row1, row2, row3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
  mlib_f32  p0, p1, p2, p3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
  mlib_d64  xFilter, yFilter0, yFilter1, yFilter2, yFilter3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
  mlib_d64  v0, v1, v2, v3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
  mlib_d64  u0, u1, u2, u3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
  mlib_d64  d0, d1, d2, d3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
  mlib_d64  d00, d10, d01, d02, d03;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
  mlib_d64 *yPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
  mlib_d64 *dpSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
  mlib_s32  align, cols, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
  mlib_d64  res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
  mlib_f32  f_x01000100 = vis_to_float(0x01000100);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
  mlib_d64  mask8000 = vis_to_double_dup(0x80008000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
  const mlib_s16 *mlib_filters_table  ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
  const mlib_s16 *mlib_filters_table_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
  if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    mlib_filters_table   = mlib_filters_s16_bc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    mlib_filters_table_4 = mlib_filters_s16_bc_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
  } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    mlib_filters_table   = mlib_filters_s16_bc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    mlib_filters_table_4 = mlib_filters_s16_bc2_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
  srcYStride >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    vis_write_gsr(10 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    CLIP(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    cols = xRight - xLeft + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    align = (8 - ((mlib_addr)dstPixelPtr) & 7) & 7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    align >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    align = (cols < align)? cols : align;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    for (i = 0; i < align; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
      NEXT_PIXEL_1BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
      LOAD_BC_S16_1CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
      RESULT_1BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
      vis_st_u16(res, dstPixelPtr++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    if (i <= cols - 10) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
      NEXT_PIXEL_1BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
      LOAD_BC_S16_1CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
      NEXT_PIXEL_1BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
      BC_S16_1CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
      BC_S16_1CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
      BC_S16_1CH(2, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
      BC_S16_1CH(3, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
      FADD_1BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
      BC_S16_1CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
      BC_S16_1CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
      BC_S16_1CH(2, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
      BC_S16_1CH(3, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
      for (; i <= cols - 14; i += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
        *(mlib_d64*)dstPixelPtr = res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
        FADD_1BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
        BC_S16_1CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
        BC_S16_1CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
        BC_S16_1CH(2, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        BC_S16_1CH(3, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
        dstPixelPtr += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
      *(mlib_d64*)dstPixelPtr = res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
      dstPixelPtr += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
      FADD_1BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
      *(mlib_d64*)dstPixelPtr = res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
      dstPixelPtr += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
      RESULT_1BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
      vis_st_u16(res, dstPixelPtr++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
      LOAD_BC_S16_1CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
      RESULT_1BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
      vis_st_u16(res, dstPixelPtr++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
      i += 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    for (; i < cols; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
      NEXT_PIXEL_1BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
      LOAD_BC_S16_1CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
      RESULT_1BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
      vis_st_u16(res, dstPixelPtr++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
#define NEXT_PIXEL_2BC_S16()                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
  xSrc = (X >> MLIB_SHIFT)-1;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
  ySrc = (Y >> MLIB_SHIFT)-1;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
  sPtr = (mlib_s16 *)lineAddr[ySrc] + (xSrc << 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
#define LOAD_BC_S16_2CH_1PIXEL(mlib_filters_s16, mlib_filters_s16_4)    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
  row00 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
  row01 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
  row10 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
  row11 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
  row20 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
  row21 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
  row30 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
  row31 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
  filterposy = (Y >> FILTER_SHIFT) & FILTER_MASK;                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
  yPtr = ((mlib_d64 *) ((mlib_u8 *)mlib_filters_s16_4 + filterposy*4)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
  yFilter0 = yPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
  yFilter1 = yPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
  yFilter2 = yPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
  yFilter3 = yPtr[3];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
  filterposx = (X >> FILTER_SHIFT) & FILTER_MASK;                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
  xFilter = *((mlib_d64 *)((mlib_u8 *)mlib_filters_s16 + filterposx));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
  X += dX;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
  Y += dY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
#define RESULT_2BC_S16_1PIXEL()                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
  u00 = vis_fmul8sux16(vis_fxor(row00, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
  dr = vis_fpmerge(vis_read_hi(xFilter), vis_read_lo(xFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
  u01 = vis_fmul8ulx16(vis_fxor(row00, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
  dr = vis_fpmerge(vis_read_hi(dr), vis_read_lo(dr));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
  u10 = vis_fmul8sux16(vis_fxor(row01, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
  dr1 = vis_fpmerge(vis_read_lo(dr), vis_read_lo(dr));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
  u11 = vis_fmul8ulx16(vis_fxor(row01, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
  dr = vis_fpmerge(vis_read_hi(dr), vis_read_hi(dr));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
  u20 = vis_fmul8sux16(vis_fxor(row10, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
  v00 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
  u21 = vis_fmul8ulx16(vis_fxor(row10, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
  v01 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
  u00 = vis_fmul8sux16(vis_fxor(row11, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
  xFilter0 = vis_fpmerge(vis_read_hi(dr), vis_read_hi(dr1));    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
  u01 = vis_fmul8ulx16(vis_fxor(row11, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
  u10 = vis_fmul8sux16(vis_fxor(row20, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
  u11 = vis_fmul8ulx16(vis_fxor(row20, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
  v10 = vis_fpadd16(u20, u21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
  sum0 = vis_fpadd16(v00, v10);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
  u20 = vis_fmul8sux16(vis_fxor(row21, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
  v11 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
  u21 = vis_fmul8ulx16(vis_fxor(row21, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
  xFilter1 = vis_fpmerge(vis_read_lo(dr), vis_read_lo(dr1));    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
  u00 = vis_fmul8sux16(vis_fxor(row30, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
  v20 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
  sum1 = vis_fpadd16(v01, v11);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
  u01 = vis_fmul8ulx16(vis_fxor(row30, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
  sum0 = vis_fpadd16(sum0, v20);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
  v21 = vis_fpadd16(u20, u21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
  u10 = vis_fmul8sux16(vis_fxor(row31, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
  v30 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
  sum1 = vis_fpadd16(sum1, v21);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
  u11 = vis_fmul8ulx16(vis_fxor(row31, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
  sum0 = vis_fpadd16(sum0, v30);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
  v31 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
  sum1 = vis_fpadd16(sum1, v31);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
  d00 = vis_fmul8sux16(sum0, xFilter0);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
  d10 = vis_fmul8ulx16(sum0, xFilter0);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
  d20 = vis_fmul8sux16(sum1, xFilter1);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
  d30 = vis_fmul8ulx16(sum1, xFilter1);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
  d0 = vis_fpadd16(d00, d10);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
  d1 = vis_fpadd16(d20, d30);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
  d0 = vis_fpadd16(d0, d1);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
  p0 = vis_fpadd16s(vis_read_hi(d0), vis_read_lo(d0));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
  d0 = vis_fmuld8sux16(f_x01000100, p0);                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
  res = vis_fxor(vis_fpackfix_pair(d0, d0), mask8000)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
#define BC_S16_2CH(ind, mlib_filters_s16, mlib_filters_s16_4)           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
  u00 = vis_fmul8sux16(vis_fxor(row00, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
  dr = vis_fpmerge(vis_read_hi(xFilter), vis_read_lo(xFilter));         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
  u01 = vis_fmul8ulx16(vis_fxor(row00, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
  dr = vis_fpmerge(vis_read_hi(dr), vis_read_lo(dr));                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
  u10 = vis_fmul8sux16(vis_fxor(row01, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
  dr1 = vis_fpmerge(vis_read_lo(dr), vis_read_lo(dr));                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
  u11 = vis_fmul8ulx16(vis_fxor(row01, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
  dr = vis_fpmerge(vis_read_hi(dr), vis_read_hi(dr));                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
  u20 = vis_fmul8sux16(vis_fxor(row10, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
  v00 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
  u21 = vis_fmul8ulx16(vis_fxor(row10, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
  filterposy = (Y >> FILTER_SHIFT);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
  v01 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
  u00 = vis_fmul8sux16(vis_fxor(row11, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
  xFilter0 = vis_fpmerge(vis_read_hi(dr), vis_read_hi(dr1));            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
  u01 = vis_fmul8ulx16(vis_fxor(row11, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
  row00 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
  u10 = vis_fmul8sux16(vis_fxor(row20, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
  row01 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
  filterposx = (X >> FILTER_SHIFT);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
  u11 = vis_fmul8ulx16(vis_fxor(row20, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
  v10 = vis_fpadd16(u20, u21);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
  sum0 = vis_fpadd16(v00, v10);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
  X += dX;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
  u20 = vis_fmul8sux16(vis_fxor(row21, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
  v11 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
  row10 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
  u21 = vis_fmul8ulx16(vis_fxor(row21, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
  row11 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
  xFilter1 = vis_fpmerge(vis_read_lo(dr), vis_read_lo(dr1));            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
  u00 = vis_fmul8sux16(vis_fxor(row30, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
  v20 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
  Y += dY;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
  xSrc = (X >> MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
  sum1 = vis_fpadd16(v01, v11);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
  u01 = vis_fmul8ulx16(vis_fxor(row30, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
  sum0 = vis_fpadd16(sum0, v20);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
  ySrc = (Y >> MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
  v21 = vis_fpadd16(u20, u21);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
  u10 = vis_fmul8sux16(vis_fxor(row31, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
  v30 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
  filterposy &= FILTER_MASK;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
  row20 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
  sum1 = vis_fpadd16(sum1, v21);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
  u11 = vis_fmul8ulx16(vis_fxor(row31, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
  row21 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
  filterposx &= FILTER_MASK;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
  v31 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
  sum0 = vis_fpadd16(sum0, v30);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
  sum1 = vis_fpadd16(sum1, v31);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
  row30 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
  d0 = vis_fmul8sux16(sum0, xFilter0);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
  row31 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
  yPtr = ((mlib_d64 *) ((mlib_u8 *)mlib_filters_s16_4 + filterposy*4)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
  d1 = vis_fmul8ulx16(sum0, xFilter0);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
  yFilter0 = yPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
  d2 = vis_fmul8sux16(sum1, xFilter1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
  yFilter1 = yPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
  d3 = vis_fmul8ulx16(sum1, xFilter1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
  d0##ind = vis_fpadd16(d0, d1);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
  yFilter2 = yPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
  yFilter3 = yPtr[3];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
  d1##ind = vis_fpadd16(d2, d3);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
  xFilter = *((mlib_d64 *)((mlib_u8 *)mlib_filters_s16 + filterposx));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
  sPtr = (mlib_s16 *)lineAddr[ySrc] + (xSrc << 1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
#define FADD_2BC_S16()                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
  d0 = vis_fpadd16(d00, d10);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
  d2 = vis_fpadd16(d01, d11);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
  p0 = vis_fpadd16s(vis_read_hi(d0), vis_read_lo(d0));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
  p1 = vis_fpadd16s(vis_read_hi(d2), vis_read_lo(d2));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
  d0 = vis_fmuld8sux16(f_x01000100, p0);                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
  d1 = vis_fmuld8sux16(f_x01000100, p1);                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
  res = vis_fxor(vis_fpackfix_pair(d0, d1), mask8000)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
mlib_status mlib_ImageAffine_u16_2ch_bc (mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
  DTYPE  *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
  mlib_s32  filterposx, filterposy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
  mlib_d64  data0, data1, data2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
  mlib_d64  sum0, sum1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
  mlib_d64  row00, row10, row20, row30;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
  mlib_d64  row01, row11, row21, row31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
  mlib_f32  p0, p1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
  mlib_d64  xFilter, xFilter0, xFilter1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
  mlib_d64  yFilter0, yFilter1, yFilter2, yFilter3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
  mlib_d64  v00, v01, v10, v11, v20, v21, v30, v31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
  mlib_d64  u00, u01, u10, u11, u20, u21;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
  mlib_d64  d0, d1, d2, d3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
  mlib_d64  d00, d10, d20, d30, d01, d11;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
  mlib_d64  *yPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
  mlib_d64  *dp, *dpSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
  mlib_s32  cols, i, mask, emask;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
  mlib_d64  res, res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
  mlib_d64  dr, dr1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
  mlib_f32 f_x01000100 = vis_to_float(0x01000100);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
  mlib_d64  mask8000 = vis_to_double_dup(0x80008000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
  const mlib_s16 *mlib_filters_table  ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
  const mlib_s16 *mlib_filters_table_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
  if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
    mlib_filters_table   = mlib_filters_s16_bc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    mlib_filters_table_4 = mlib_filters_s16_bc_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
  } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
    mlib_filters_table   = mlib_filters_s16_bc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
    mlib_filters_table_4 = mlib_filters_s16_bc2_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
  srcYStride >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
    vis_write_gsr(10 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
    CLIP(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    dstLineEnd  = (DTYPE*)dstData + 2 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    cols = xRight - xLeft + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    dp = vis_alignaddr(dstPixelPtr, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
    dstLineEnd += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
    mask = vis_edge16(dstPixelPtr, dstLineEnd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
    i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
    if (i <= cols - 6) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
      NEXT_PIXEL_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
      LOAD_BC_S16_2CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
      NEXT_PIXEL_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
      BC_S16_2CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
      BC_S16_2CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
      FADD_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
      BC_S16_2CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
      BC_S16_2CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
      for (; i <= cols-8; i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
        vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
        res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
        vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
        vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
        FADD_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
        BC_S16_2CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
        BC_S16_2CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
      vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
      FADD_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
      vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
      RESULT_2BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
      res1 = res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
      LOAD_BC_S16_2CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
      RESULT_2BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
      res = vis_write_hi(res, vis_read_hi(res1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
      vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
      i += 6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
    if (i <= cols - 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
      NEXT_PIXEL_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
      LOAD_BC_S16_2CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
      NEXT_PIXEL_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
      BC_S16_2CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
      BC_S16_2CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
      FADD_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
      vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
      RESULT_2BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
      res1 = res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
      LOAD_BC_S16_2CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
      RESULT_2BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
      res = vis_write_hi(res, vis_read_hi(res1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
      vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
      i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
    if (i <= cols - 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
      NEXT_PIXEL_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
      LOAD_BC_S16_2CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
      RESULT_2BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
      res1 = res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
      NEXT_PIXEL_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
      LOAD_BC_S16_2CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
      RESULT_2BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
      res = vis_write_hi(res, vis_read_hi(res1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
      vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
      i += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    if (i < cols) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
      NEXT_PIXEL_2BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
      LOAD_BC_S16_2CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
      RESULT_2BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
      vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
      emask = vis_edge16(dp, dstLineEnd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
      vis_pst_16(res, dp++, mask & emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
      if ((mlib_s16*)dp <= dstLineEnd) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
        mask = vis_edge16(dp, dstLineEnd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
        vis_pst_16(res, dp, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
#define NEXT_PIXEL_3BC_S16()                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
  xSrc = (X >> MLIB_SHIFT)-1;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
  ySrc = (Y >> MLIB_SHIFT)-1;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
  sPtr = (mlib_s16 *)lineAddr[ySrc] + (xSrc*3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
#define LOAD_BC_S16_3CH_1PIXEL(mlib_filters_s16_3, mlib_filters_s16_4)  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
  row00 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
  row01 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
  row02 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
  row10 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
  row11 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
  row12 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
  row20 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
  row21 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
  row22 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
  row30 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
  row31 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
  row32 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
  filterposy = (Y >> FILTER_SHIFT) & FILTER_MASK;                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
  yPtr = ((mlib_d64 *) ((mlib_u8 *)mlib_filters_s16_4 + filterposy*4)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
  yFilter0 = yPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
  yFilter1 = yPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
  yFilter2 = yPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
  yFilter3 = yPtr[3];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
  filterposx = (X >> FILTER_SHIFT) & FILTER_MASK;                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
  xPtr = ((mlib_d64 *)((mlib_u8 *)mlib_filters_s16_3 + filterposx*3));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
  xFilter0 = xPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
  xFilter1 = xPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
  xFilter2 = xPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
  X += dX;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
  Y += dY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
#define STORE_BC_S16_3CH_1PIXEL()                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
  dstPixelPtr[0] = f0.t[0];                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
  dstPixelPtr[1] = f0.t[1];                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
  dstPixelPtr[2] = f0.t[2];                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
  dstPixelPtr += 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
#define RESULT_3BC_S16_1PIXEL()                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
  u00 = vis_fmul8sux16(vis_fxor(row00, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
  u01 = vis_fmul8ulx16(vis_fxor(row00, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
  u10 = vis_fmul8sux16(vis_fxor(row01, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
  u11 = vis_fmul8ulx16(vis_fxor(row01, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
  v00 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
  u20 = vis_fmul8sux16(vis_fxor(row02, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
  v01 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
  u21 = vis_fmul8ulx16(vis_fxor(row02, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
  u00 = vis_fmul8sux16(vis_fxor(row10, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
  u01 = vis_fmul8ulx16(vis_fxor(row10, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
  v02 = vis_fpadd16(u20, u21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
  u10 = vis_fmul8sux16(vis_fxor(row11, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
  u11 = vis_fmul8ulx16(vis_fxor(row11, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
  v10 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
  u20 = vis_fmul8sux16(vis_fxor(row12, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
  u21 = vis_fmul8ulx16(vis_fxor(row12, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
  u00 = vis_fmul8sux16(vis_fxor(row20, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
  v11 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
  u01 = vis_fmul8ulx16(vis_fxor(row20, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
  v12 = vis_fpadd16(u20, u21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
  u10 = vis_fmul8sux16(vis_fxor(row21, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
  u11 = vis_fmul8ulx16(vis_fxor(row21, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
  v20 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
  u20 = vis_fmul8sux16(vis_fxor(row22, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
  sum0 = vis_fpadd16(v00, v10);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
  u21 = vis_fmul8ulx16(vis_fxor(row22, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
  u00 = vis_fmul8sux16(vis_fxor(row30, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
  u01 = vis_fmul8ulx16(vis_fxor(row30, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
  v21 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
  sum1 = vis_fpadd16(v01, v11);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
  u10 = vis_fmul8sux16(vis_fxor(row31, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
  sum2 = vis_fpadd16(v02, v12);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
  v22 = vis_fpadd16(u20, u21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
  u11 = vis_fmul8ulx16(vis_fxor(row31, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
  sum0 = vis_fpadd16(sum0, v20);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
  u20 = vis_fmul8sux16(vis_fxor(row32, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
  v30 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
  sum1 = vis_fpadd16(sum1, v21);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
  u21 = vis_fmul8ulx16(vis_fxor(row32, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
  v31 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
  sum2 = vis_fpadd16(sum2, v22);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
  v32 = vis_fpadd16(u20, u21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
  sum0 = vis_fpadd16(sum0, v30);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
  row30 = vis_faligndata(data0, data1);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
  v00 = vis_fmul8sux16(sum0, xFilter0);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
  sum1 = vis_fpadd16(sum1, v31);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
  sum2 = vis_fpadd16(sum2, v32);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
  v01 = vis_fmul8ulx16(sum0, xFilter0);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
  v10 = vis_fmul8sux16(sum1, xFilter1);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
  v11 = vis_fmul8ulx16(sum1, xFilter1);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
  d0 = vis_fpadd16(v00, v01);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
  v20 = vis_fmul8sux16(sum2, xFilter2);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
  v21 = vis_fmul8ulx16(sum2, xFilter2);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
  d1 = vis_fpadd16(v10, v11);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
  d2 = vis_fpadd16(v20, v21);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
  vis_alignaddr((void*)6, 0);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
  d3 = vis_faligndata(d0, d1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
  vis_alignaddr((void*)2, 0);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
  d4 = vis_faligndata(d1, d2);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
  d0 = vis_fpadd16(d0, d3);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
  d2 = vis_fpadd16(d2, d4);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
  d1 = vis_faligndata(d2, d2);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
  d0 = vis_fpadd16(d0, d1);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
  d2 = vis_fmuld8sux16(f_x01000100, vis_read_hi(d0));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
  d3 = vis_fmuld8sux16(f_x01000100, vis_read_lo(d0));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
  f0.d = vis_fxor(vis_fpackfix_pair(d2, d3), mask8000)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
#define BC_S16_3CH(mlib_filters_s16_3, mlib_filters_s16_4)              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
  u00 = vis_fmul8sux16(vis_fxor(row00, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
  u01 = vis_fmul8ulx16(vis_fxor(row00, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
  u10 = vis_fmul8sux16(vis_fxor(row01, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
  u11 = vis_fmul8ulx16(vis_fxor(row01, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
  v00 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
  u20 = vis_fmul8sux16(vis_fxor(row02, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
  v01 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
  u21 = vis_fmul8ulx16(vis_fxor(row02, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
  u00 = vis_fmul8sux16(vis_fxor(row10, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
  u01 = vis_fmul8ulx16(vis_fxor(row10, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
  filterposy = (Y >> FILTER_SHIFT);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
  v02 = vis_fpadd16(u20, u21);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
  u10 = vis_fmul8sux16(vis_fxor(row11, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
  u11 = vis_fmul8ulx16(vis_fxor(row11, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
  v10 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
  u20 = vis_fmul8sux16(vis_fxor(row12, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
  row00 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
  u21 = vis_fmul8ulx16(vis_fxor(row12, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
  row01 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
  u00 = vis_fmul8sux16(vis_fxor(row20, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
  row02 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
  filterposx = (X >> FILTER_SHIFT);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
  v11 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
  u01 = vis_fmul8ulx16(vis_fxor(row20, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
  v12 = vis_fpadd16(u20, u21);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
  u10 = vis_fmul8sux16(vis_fxor(row21, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
  X += dX;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
  u11 = vis_fmul8ulx16(vis_fxor(row21, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
  v20 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
  u20 = vis_fmul8sux16(vis_fxor(row22, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
  sum0 = vis_fpadd16(v00, v10);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
  row10 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
  u21 = vis_fmul8ulx16(vis_fxor(row22, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
  row11 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
  u00 = vis_fmul8sux16(vis_fxor(row30, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
  row12 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
  u01 = vis_fmul8ulx16(vis_fxor(row30, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
  v21 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
  Y += dY;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
  xSrc = (X >> MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
  sum1 = vis_fpadd16(v01, v11);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
  u10 = vis_fmul8sux16(vis_fxor(row31, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
  sum2 = vis_fpadd16(v02, v12);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
  ySrc = (Y >> MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
  v22 = vis_fpadd16(u20, u21);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
  u11 = vis_fmul8ulx16(vis_fxor(row31, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
  sum0 = vis_fpadd16(sum0, v20);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
  u20 = vis_fmul8sux16(vis_fxor(row32, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
  v30 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
  filterposy &= FILTER_MASK;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
  row20 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
  sum1 = vis_fpadd16(sum1, v21);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
  u21 = vis_fmul8ulx16(vis_fxor(row32, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
  row21 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
  row22 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
  filterposx &= FILTER_MASK;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
  v31 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
  sum2 = vis_fpadd16(sum2, v22);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
  v32 = vis_fpadd16(u20, u21);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
  sum0 = vis_fpadd16(sum0, v30);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
  row30 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
  v00 = vis_fmul8sux16(sum0, xFilter0);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
  row31 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
  row32 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
  yPtr = ((mlib_d64 *) ((mlib_u8 *)mlib_filters_s16_4 + filterposy*4)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
  sum1 = vis_fpadd16(sum1, v31);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
  yFilter0 = yPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
  sum2 = vis_fpadd16(sum2, v32);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
  v01 = vis_fmul8ulx16(sum0, xFilter0);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
  yFilter1 = yPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
  v10 = vis_fmul8sux16(sum1, xFilter1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
  yFilter2 = yPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
  v11 = vis_fmul8ulx16(sum1, xFilter1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
  d0 = vis_fpadd16(v00, v01);                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
  yFilter3 = yPtr[3];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
  xPtr = ((mlib_d64 *)((mlib_u8 *)mlib_filters_s16_3 + filterposx*3));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
  v20 = vis_fmul8sux16(sum2, xFilter2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
  xFilter0 = xPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
  v21 = vis_fmul8ulx16(sum2, xFilter2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
  d1 = vis_fpadd16(v10, v11);                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
  xFilter1 = xPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
  d2 = vis_fpadd16(v20, v21);                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
  xFilter2 = xPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
  sPtr = (mlib_s16 *)lineAddr[ySrc] + (xSrc*3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
#define FADD_3BC_S16()                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
  vis_alignaddr((void*)6, 0);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
  d3 = vis_faligndata(d0, d1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
  vis_alignaddr((void*)2, 0);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
  d4 = vis_faligndata(d1, d2);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
  d0 = vis_fpadd16(d0, d3);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
  d2 = vis_fpadd16(d2, d4);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
  d1 = vis_faligndata(d2, d2);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
  d0 = vis_fpadd16(d0, d1);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
  d2 = vis_fmuld8sux16(f_x01000100, vis_read_hi(d0));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
  d3 = vis_fmuld8sux16(f_x01000100, vis_read_lo(d0));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
  f0.d = vis_fxor(vis_fpackfix_pair(d2, d3), mask8000)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
mlib_status mlib_ImageAffine_u16_3ch_bc (mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
  mlib_s32  filterposx, filterposy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
  mlib_d64  data0, data1, data2, data3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
  mlib_d64  sum0, sum1, sum2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
  mlib_d64  row00, row10, row20, row30;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
  mlib_d64  row01, row11, row21, row31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
  mlib_d64  row02, row12, row22, row32;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
  mlib_d64  xFilter0, xFilter1, xFilter2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
  mlib_d64  yFilter0, yFilter1, yFilter2, yFilter3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
  mlib_d64  v00, v01, v02, v10, v11, v12, v20, v21, v22, v30, v31, v32;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
  mlib_d64  u00, u01, u10, u11, u20, u21;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
  mlib_d64  d0, d1, d2, d3, d4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
  mlib_d64 *yPtr, *xPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
  mlib_d64 *dpSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
  mlib_s32  cols, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
  mlib_f32  f_x01000100 = vis_to_float(0x01000100);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
  mlib_d64  mask8000 = vis_to_double_dup(0x80008000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
  union {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
    mlib_s16 t[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
    mlib_d64 d;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
  } f0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
  const mlib_s16 *mlib_filters_table_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
  const mlib_s16 *mlib_filters_table_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
  if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
    mlib_filters_table_3 = mlib_filters_s16_bc_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
    mlib_filters_table_4 = mlib_filters_s16_bc_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
  } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
    mlib_filters_table_3 = mlib_filters_s16_bc2_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
    mlib_filters_table_4 = mlib_filters_s16_bc2_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
  srcYStride >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
    vis_write_gsr(10 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
    CLIP(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
    cols = xRight - xLeft + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
    i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
    if (i <= cols - 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
      NEXT_PIXEL_3BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
      LOAD_BC_S16_3CH_1PIXEL(mlib_filters_table_3, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
      NEXT_PIXEL_3BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
      BC_S16_3CH(mlib_filters_table_3, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
      FADD_3BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
      BC_S16_3CH(mlib_filters_table_3, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
      for (; i < cols-4; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
        STORE_BC_S16_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
        FADD_3BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
        BC_S16_3CH(mlib_filters_table_3, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
      STORE_BC_S16_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
      FADD_3BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
      STORE_BC_S16_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
      RESULT_3BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
      STORE_BC_S16_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
      LOAD_BC_S16_3CH_1PIXEL(mlib_filters_table_3, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
      RESULT_3BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
      STORE_BC_S16_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
      i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
    for (; i < cols; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
      NEXT_PIXEL_3BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
      LOAD_BC_S16_3CH_1PIXEL(mlib_filters_table_3, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
      RESULT_3BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
      STORE_BC_S16_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
#define NEXT_PIXEL_4BC_S16()                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
  xSrc = (X >> MLIB_SHIFT)-1;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
  ySrc = (Y >> MLIB_SHIFT)-1;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
  sPtr = (mlib_s16 *)lineAddr[ySrc] + (xSrc << 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
#define LOAD_BC_S16_4CH_1PIXEL(mlib_filters_s16_4)                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
  data4 = dpSrc[4];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
  row00 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
  row01 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
  row02 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
  row03 = vis_faligndata(data3, data4);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
  data4 = dpSrc[4];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
  row10 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
  row11 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
  row12 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
  row13 = vis_faligndata(data3, data4);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
  data4 = dpSrc[4];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
  row20 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
  row21 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
  row22 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
  row23 = vis_faligndata(data3, data4);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
  data4 = dpSrc[4];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
  row30 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
  row31 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
  row32 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
  row33 = vis_faligndata(data3, data4);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
  filterposy = (Y >> FILTER_SHIFT) & FILTER_MASK;                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
  yPtr = ((mlib_d64 *) ((mlib_u8 *)mlib_filters_s16_4 + filterposy*4)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
  yFilter0 = yPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
  yFilter1 = yPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
  yFilter2 = yPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
  yFilter3 = yPtr[3];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
  filterposx = (X >> FILTER_SHIFT) & FILTER_MASK;                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
  xPtr = ((mlib_d64 *)((mlib_u8 *)mlib_filters_s16_4 + filterposx*4));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
  xFilter0 = xPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
  xFilter1 = xPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
  xFilter2 = xPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
  xFilter3 = xPtr[3];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
  X += dX;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
  Y += dY
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
#define RESULT_4BC_S16_1PIXEL()                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
  u00 = vis_fmul8sux16(vis_fxor(row00, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
  u01 = vis_fmul8ulx16(vis_fxor(row00, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
  u10 = vis_fmul8sux16(vis_fxor(row01, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
  u11 = vis_fmul8ulx16(vis_fxor(row01, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
  v00 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
  u20 = vis_fmul8sux16(vis_fxor(row02, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
  v01 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
  u21 = vis_fmul8ulx16(vis_fxor(row02, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
  u30 = vis_fmul8sux16(vis_fxor(row03, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
  u31 = vis_fmul8ulx16(vis_fxor(row03, mask8000), yFilter0);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
  v02 = vis_fpadd16(u20, u21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
  u00 = vis_fmul8sux16(vis_fxor(row10, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
  u01 = vis_fmul8ulx16(vis_fxor(row10, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
  v03 = vis_fpadd16(u30, u31);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
  u10 = vis_fmul8sux16(vis_fxor(row11, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
  u11 = vis_fmul8ulx16(vis_fxor(row11, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
  v10 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
  u20 = vis_fmul8sux16(vis_fxor(row12, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
  v11 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
  u21 = vis_fmul8ulx16(vis_fxor(row12, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
  u30 = vis_fmul8sux16(vis_fxor(row13, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
  u31 = vis_fmul8ulx16(vis_fxor(row13, mask8000), yFilter1);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
  u00 = vis_fmul8sux16(vis_fxor(row20, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
  v12 = vis_fpadd16(u20, u21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
  u01 = vis_fmul8ulx16(vis_fxor(row20, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
  v13 = vis_fpadd16(u30, u31);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
  u10 = vis_fmul8sux16(vis_fxor(row21, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
  u11 = vis_fmul8ulx16(vis_fxor(row21, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
  v20 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
  u20 = vis_fmul8sux16(vis_fxor(row22, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
  sum0 = vis_fpadd16(v00, v10);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
  u21 = vis_fmul8ulx16(vis_fxor(row22, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
  u30 = vis_fmul8sux16(vis_fxor(row23, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
  u31 = vis_fmul8ulx16(vis_fxor(row23, mask8000), yFilter2);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
  u00 = vis_fmul8sux16(vis_fxor(row30, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
  u01 = vis_fmul8ulx16(vis_fxor(row30, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
  v21 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
  sum1 = vis_fpadd16(v01, v11);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
  u10 = vis_fmul8sux16(vis_fxor(row31, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
  sum2 = vis_fpadd16(v02, v12);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
  sum3 = vis_fpadd16(v03, v13);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
  v22 = vis_fpadd16(u20, u21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
  u11 = vis_fmul8ulx16(vis_fxor(row31, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
  sum0 = vis_fpadd16(sum0, v20);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
  u20 = vis_fmul8sux16(vis_fxor(row32, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
  u21 = vis_fmul8ulx16(vis_fxor(row32, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
  v23 = vis_fpadd16(u30, u31);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
  v30 = vis_fpadd16(u00, u01);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
  sum1 = vis_fpadd16(sum1, v21);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
  u30 = vis_fmul8sux16(vis_fxor(row33, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
  u31 = vis_fmul8ulx16(vis_fxor(row33, mask8000), yFilter3);    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
  v31 = vis_fpadd16(u10, u11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
  sum2 = vis_fpadd16(sum2, v22);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
  sum3 = vis_fpadd16(sum3, v23);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
  v32 = vis_fpadd16(u20, u21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
  sum0 = vis_fpadd16(sum0, v30);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
  v33 = vis_fpadd16(u30, u31);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
  v00 = vis_fmul8sux16(sum0, xFilter0);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
  sum1 = vis_fpadd16(sum1, v31);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
  sum2 = vis_fpadd16(sum2, v32);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
  v01 = vis_fmul8ulx16(sum0, xFilter0);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
  v10 = vis_fmul8sux16(sum1, xFilter1);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
  sum3 = vis_fpadd16(sum3, v33);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
  v11 = vis_fmul8ulx16(sum1, xFilter1);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
  d0 = vis_fpadd16(v00, v01);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
  v20 = vis_fmul8sux16(sum2, xFilter2);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
  v21 = vis_fmul8ulx16(sum2, xFilter2);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
  d1 = vis_fpadd16(v10, v11);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
  v30 = vis_fmul8sux16(sum3, xFilter3);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
  v31 = vis_fmul8ulx16(sum3, xFilter3);                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
  d2 = vis_fpadd16(v20, v21);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
  d3 = vis_fpadd16(v30, v31);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
  d0 = vis_fpadd16(d0, d1);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
  d2 = vis_fpadd16(d2, d3);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
  d0 = vis_fpadd16(d0, d2);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
  d2 = vis_fmuld8sux16(f_x01000100, vis_read_hi(d0));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
  d3 = vis_fmuld8sux16(f_x01000100, vis_read_lo(d0));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
  res = vis_fxor(vis_fpackfix_pair(d2, d3), mask8000)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
#define BC_S16_4CH(mlib_filters_s16_4)                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
  u00 = vis_fmul8sux16(vis_fxor(row00, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
  u01 = vis_fmul8ulx16(vis_fxor(row00, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
  u10 = vis_fmul8sux16(vis_fxor(row01, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
  u11 = vis_fmul8ulx16(vis_fxor(row01, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
  v00 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
  u20 = vis_fmul8sux16(vis_fxor(row02, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
  v01 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
  u21 = vis_fmul8ulx16(vis_fxor(row02, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
  u30 = vis_fmul8sux16(vis_fxor(row03, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
  u31 = vis_fmul8ulx16(vis_fxor(row03, mask8000), yFilter0);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
  v02 = vis_fpadd16(u20, u21);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
  u00 = vis_fmul8sux16(vis_fxor(row10, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
  u01 = vis_fmul8ulx16(vis_fxor(row10, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
  filterposy = (Y >> FILTER_SHIFT);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
  v03 = vis_fpadd16(u30, u31);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
  u10 = vis_fmul8sux16(vis_fxor(row11, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
  u11 = vis_fmul8ulx16(vis_fxor(row11, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
  v10 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
  u20 = vis_fmul8sux16(vis_fxor(row12, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
  v11 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
  data4 = dpSrc[4];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
  u21 = vis_fmul8ulx16(vis_fxor(row12, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
  row00 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
  u30 = vis_fmul8sux16(vis_fxor(row13, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
  row01 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
  u31 = vis_fmul8ulx16(vis_fxor(row13, mask8000), yFilter1);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
  row02 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
  u00 = vis_fmul8sux16(vis_fxor(row20, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
  row03 = vis_faligndata(data3, data4);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
  filterposx = (X >> FILTER_SHIFT);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
  v12 = vis_fpadd16(u20, u21);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
  u01 = vis_fmul8ulx16(vis_fxor(row20, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
  v13 = vis_fpadd16(u30, u31);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
  u10 = vis_fmul8sux16(vis_fxor(row21, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
  X += dX;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
  u11 = vis_fmul8ulx16(vis_fxor(row21, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
  v20 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
  u20 = vis_fmul8sux16(vis_fxor(row22, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
  sum0 = vis_fpadd16(v00, v10);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
  u21 = vis_fmul8ulx16(vis_fxor(row22, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
  data4 = dpSrc[4];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
  row10 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
  u30 = vis_fmul8sux16(vis_fxor(row23, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
  row11 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
  u31 = vis_fmul8ulx16(vis_fxor(row23, mask8000), yFilter2);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
  row12 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
  u00 = vis_fmul8sux16(vis_fxor(row30, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
  row13 = vis_faligndata(data3, data4);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
  u01 = vis_fmul8ulx16(vis_fxor(row30, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
  v21 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
  Y += dY;                                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
  xSrc = (X >> MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
  sum1 = vis_fpadd16(v01, v11);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
  u10 = vis_fmul8sux16(vis_fxor(row31, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
  sum2 = vis_fpadd16(v02, v12);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
  sum3 = vis_fpadd16(v03, v13);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
  ySrc = (Y >> MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
  v22 = vis_fpadd16(u20, u21);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
  u11 = vis_fmul8ulx16(vis_fxor(row31, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
  sum0 = vis_fpadd16(sum0, v20);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
  u20 = vis_fmul8sux16(vis_fxor(row32, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
  u21 = vis_fmul8ulx16(vis_fxor(row32, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
  v23 = vis_fpadd16(u30, u31);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
  data4 = dpSrc[4];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
  v30 = vis_fpadd16(u00, u01);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
  filterposy &= FILTER_MASK;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
  row20 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
  sum1 = vis_fpadd16(sum1, v21);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
  u30 = vis_fmul8sux16(vis_fxor(row33, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
  row21 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
  u31 = vis_fmul8ulx16(vis_fxor(row33, mask8000), yFilter3);            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
  row22 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
  row23 = vis_faligndata(data3, data4);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
  sPtr += srcYStride;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
  filterposx &= FILTER_MASK;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
  v31 = vis_fpadd16(u10, u11);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
  dpSrc = vis_alignaddr(sPtr, 0);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
  data0 = dpSrc[0];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
  sum2 = vis_fpadd16(sum2, v22);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
  sum3 = vis_fpadd16(sum3, v23);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
  data1 = dpSrc[1];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
  v32 = vis_fpadd16(u20, u21);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
  data2 = dpSrc[2];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
  sum0 = vis_fpadd16(sum0, v30);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
  data3 = dpSrc[3];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
  v33 = vis_fpadd16(u30, u31);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
  data4 = dpSrc[4];                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
  row30 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
  v00 = vis_fmul8sux16(sum0, xFilter0);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
  row31 = vis_faligndata(data1, data2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
  row32 = vis_faligndata(data2, data3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
  row33 = vis_faligndata(data3, data4);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
  yPtr = ((mlib_d64 *) ((mlib_u8 *)mlib_filters_s16_4 + filterposy*4)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
  sum1 = vis_fpadd16(sum1, v31);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
  yFilter0 = yPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
  sum2 = vis_fpadd16(sum2, v32);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1257
  v01 = vis_fmul8ulx16(sum0, xFilter0);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1258
  yFilter1 = yPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1259
  v10 = vis_fmul8sux16(sum1, xFilter1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1260
  sum3 = vis_fpadd16(sum3, v33);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1261
  yFilter2 = yPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1262
  v11 = vis_fmul8ulx16(sum1, xFilter1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1263
  d0 = vis_fpadd16(v00, v01);                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1264
  yFilter3 = yPtr[3];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1265
  xPtr = ((mlib_d64 *)((mlib_u8 *)mlib_filters_s16_4 + filterposx*4));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1266
  v20 = vis_fmul8sux16(sum2, xFilter2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1267
  xFilter0 = xPtr[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1268
  v21 = vis_fmul8ulx16(sum2, xFilter2);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1269
  d1 = vis_fpadd16(v10, v11);                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1270
  xFilter1 = xPtr[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1271
  v30 = vis_fmul8sux16(sum3, xFilter3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1272
  v31 = vis_fmul8ulx16(sum3, xFilter3);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1273
  d2 = vis_fpadd16(v20, v21);                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1274
  xFilter2 = xPtr[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1275
  d3 = vis_fpadd16(v30, v31);                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1276
  xFilter3 = xPtr[3];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1277
  sPtr = (mlib_s16 *)lineAddr[ySrc] + (xSrc << 2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1278
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1279
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1280
#define FADD_4BC_S16()                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1281
  d0 = vis_fpadd16(d0, d1);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1282
  d2 = vis_fpadd16(d2, d3);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1283
  d0 = vis_fpadd16(d0, d2);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1284
  d2 = vis_fmuld8sux16(f_x01000100, vis_read_hi(d0));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1285
  d3 = vis_fmuld8sux16(f_x01000100, vis_read_lo(d0));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1286
  res = vis_fxor(vis_fpackfix_pair(d2, d3), mask8000)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1287
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1288
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1289
mlib_status mlib_ImageAffine_u16_4ch_bc (mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1290
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1291
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1292
  DTYPE  *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1293
  mlib_s32  filterposx, filterposy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1294
  mlib_d64  data0, data1, data2, data3, data4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1295
  mlib_d64  sum0, sum1, sum2, sum3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1296
  mlib_d64  row00, row10, row20, row30;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1297
  mlib_d64  row01, row11, row21, row31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1298
  mlib_d64  row02, row12, row22, row32;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1299
  mlib_d64  row03, row13, row23, row33;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1300
  mlib_d64  xFilter0, xFilter1, xFilter2, xFilter3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1301
  mlib_d64  yFilter0, yFilter1, yFilter2, yFilter3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1302
  mlib_d64  v00, v01, v02, v03, v10, v11, v12, v13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1303
  mlib_d64  v20, v21, v22, v23, v30, v31, v32, v33;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1304
  mlib_d64  u00, u01, u10, u11, u20, u21, u30, u31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1305
  mlib_d64  d0, d1, d2, d3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1306
  mlib_d64 *yPtr, *xPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1307
  mlib_d64 *dp, *dpSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1308
  mlib_s32  cols, i, mask, gsrd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1309
  mlib_d64  res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1310
  mlib_f32  f_x01000100 = vis_to_float(0x01000100);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1311
  mlib_d64  mask8000 = vis_to_double_dup(0x80008000);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1312
  const mlib_s16 *mlib_filters_table_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1313
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1314
  if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1315
    mlib_filters_table_4 = mlib_filters_s16_bc_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1316
  } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1317
    mlib_filters_table_4 = mlib_filters_s16_bc2_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1318
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1319
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1320
  srcYStride >>= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1321
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1322
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1323
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1324
    vis_write_gsr(10 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1325
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1326
    CLIP(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1327
    dstLineEnd  = (DTYPE*)dstData + 4 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1328
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1329
    cols = xRight - xLeft + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1330
    dp = vis_alignaddr(dstPixelPtr, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1331
    dstLineEnd += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1332
    mask = vis_edge16(dstPixelPtr, dstLineEnd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1333
    gsrd = ((8 - (mlib_addr)dstPixelPtr) & 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1334
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1335
    i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1336
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1337
    if (i <= cols - 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1338
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1339
      NEXT_PIXEL_4BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1340
      LOAD_BC_S16_4CH_1PIXEL(mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1341
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1342
      NEXT_PIXEL_4BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1343
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1344
      BC_S16_4CH(mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1345
      FADD_4BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1346
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1347
      BC_S16_4CH(mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1348
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1349
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1350
      for (; i < cols-4; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1351
        vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1352
        res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1353
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1354
        vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1355
        vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1356
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1357
        FADD_4BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1358
        BC_S16_4CH(mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1359
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1360
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1361
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1362
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1363
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1364
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1365
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1366
      FADD_4BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1367
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1368
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1369
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1370
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1371
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1372
      RESULT_4BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1373
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1374
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1375
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1376
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1377
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1378
      LOAD_BC_S16_4CH_1PIXEL(mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1379
      RESULT_4BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1380
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1381
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1382
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1383
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1384
      i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1385
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1386
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1387
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1388
    for (; i < cols; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1389
      NEXT_PIXEL_4BC_S16();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1390
      LOAD_BC_S16_4CH_1PIXEL(mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1391
      RESULT_4BC_S16_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1392
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1393
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1394
      vis_pst_16(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1395
      vis_pst_16(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1396
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1397
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1398
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1399
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1400
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1401
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1402
/***************************************************************/