jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageAffine_BC.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) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/*
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
/*#define MLIB_VIS2*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define DTYPE  mlib_u8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
#define FILTER_BITS  8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#ifdef MLIB_VIS2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#define MLIB_WRITE_BMASK(bmask) vis_write_bmask(bmask, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
#define MLIB_WRITE_BMASK(bmask)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
#endif /* MLIB_VIS2 */
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 sPtr srcPixelPtr
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
#define NEXT_PIXEL_1BC_U8()                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
  xSrc = (X>>MLIB_SHIFT)-1;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
  ySrc = (Y>>MLIB_SHIFT)-1;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
  sPtr = (mlib_u8 *)lineAddr[ySrc] + xSrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
#ifndef MLIB_VIS2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#define ALIGN_ADDR(da, dp)                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
  da = vis_alignaddr(dp, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
#define ALIGN_ADDR(da, dp)                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
  vis_alignaddr(dp, 0);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  da = (mlib_d64*)(((mlib_addr)(dp)) &~ 7)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#endif /* MLIB_VIS2 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
#define LOAD_BC_U8_1CH_1PIXEL(mlib_filters_u8)                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
  row00 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
  row10 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
  row20 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
  row30 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
  filterposy = (Y >> FILTER_SHIFT) & FILTER_MASK;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
  yFilter = *((mlib_d64 *) ((mlib_u8 *)mlib_filters_u8 + filterposy)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
  filterposx = (X >> FILTER_SHIFT) & FILTER_MASK;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
  xFilter = *((mlib_d64 *)((mlib_u8 *)mlib_filters_u8 + filterposx));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
  X += dX;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
  Y += dY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
#ifndef MLIB_VIS2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
#define SUM_4x16(v1, v3)                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
  vis_alignaddr((void*)2, 0);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
  v0 = vis_faligndata(v3, v3);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
  v2 = vis_fpadd16(v3, v0);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
  v1 = vis_write_lo(v1, vis_fpadd16s(vis_read_hi(v2), vis_read_lo(v2)))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
#define SUM_4x16(v1, v3)                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
  v2 = vis_freg_pair(vis_fpadd16s(vis_read_hi(v3), vis_read_lo(v3)),  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                     vis_fpadd16s(vis_read_hi(v3), vis_read_lo(v3))); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
  v3 = vis_bshuffle(v2, v2);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
  v1 = vis_write_lo(v1, vis_fpadd16s(vis_read_hi(v3), vis_read_lo(v3)))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
#endif /* MLIB_VIS2 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
#define RESULT_1BC_U8_1PIXEL(ind)                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
  v0 = vis_fmul8x16au(vis_read_hi(row0##ind), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
  v1 = vis_fmul8x16al(vis_read_hi(row1##ind), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
  sum = vis_fpadd16(v0, v1);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
  v2 = vis_fmul8x16au(vis_read_hi(row2##ind), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
  sum = vis_fpadd16(sum, v2);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
  v3 = vis_fmul8x16al(vis_read_hi(row3##ind), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
  sum = vis_fpadd16(sum, v3);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
  v0 = vis_fmul8sux16(sum, xFilter);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
  v1 = vis_fmul8ulx16(sum, xFilter);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
  v3 = vis_fpadd16(v1, v0);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
  SUM_4x16(v1, v3);                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
  res = vis_write_lo(res, vis_fpack16(v1))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
#define BC_U8_1CH(index, ind1, ind2, mlib_filters_u8)                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
  v0 = vis_fmul8x16au(vis_read_hi(row0##ind1), vis_read_hi(yFilter));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
  filterposy = (Y >> FILTER_SHIFT);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
  v1 = vis_fmul8x16al(vis_read_hi(row1##ind1), vis_read_hi(yFilter));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
  row0##ind2 = vis_faligndata(data0, data1);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
  filterposx = (X >> FILTER_SHIFT);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
  sum = vis_fpadd16(v0, v1);                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
  v2 = vis_fmul8x16au(vis_read_hi(row2##ind1), vis_read_lo(yFilter));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
  X += dX;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
  row1##ind2 = vis_faligndata(data0, data1);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
  Y += dY;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
  sum = vis_fpadd16(sum, v2);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
  xSrc = (X>>MLIB_SHIFT)-1;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
  v3 = vis_fmul8x16al(vis_read_hi(row3##ind1), vis_read_lo(yFilter));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
  ySrc = (Y>>MLIB_SHIFT)-1;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
  sum = vis_fpadd16(sum, v3);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
  filterposy &= FILTER_MASK;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
  v0 = vis_fmul8sux16(sum, xFilter);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
  row2##ind2 = vis_faligndata(data0, data1);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
  v1 = vis_fmul8ulx16(sum, xFilter);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
  filterposx &= FILTER_MASK;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
  d##index = vis_fpadd16(v0, v1);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
  row3##ind2 = vis_faligndata(data0, data1);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
  yFilter = *((mlib_d64 *) ((mlib_u8 *)mlib_filters_u8 + filterposy)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
  xFilter = *((mlib_d64 *)((mlib_u8 *)mlib_filters_u8 + filterposx));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
  sPtr = (mlib_u8 *)lineAddr[ySrc] + xSrc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
#ifndef MLIB_VIS2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
#define FADD_1BC_U8()                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
  p0 = vis_fpadd16s(vis_read_hi(d0), vis_read_lo(d0));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
  p1 = vis_fpadd16s(vis_read_hi(d1), vis_read_lo(d1));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
  p2 = vis_fpadd16s(vis_read_hi(d2), vis_read_lo(d2));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
  p3 = vis_fpadd16s(vis_read_hi(d3), vis_read_lo(d3));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
  m02 = vis_fpmerge(p0, p2);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
  m13 = vis_fpmerge(p1, p3);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
  m0213 = vis_fpmerge(vis_read_hi(m02), vis_read_hi(m13));      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
  e0 = vis_fpmerge(vis_read_hi(m0213), vis_read_lo(m0213));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
  m0213 = vis_fpmerge(vis_read_lo(m02), vis_read_lo(m13));      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
  e1 = vis_fpmerge(vis_read_hi(m0213), vis_read_lo(m0213));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
  res = vis_fpadd16(e0, e1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
#define FADD_1BC_U8()                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
  v0 = vis_freg_pair(vis_fpadd16s(vis_read_hi(d0), vis_read_lo(d0)),  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                     vis_fpadd16s(vis_read_hi(d1), vis_read_lo(d1))); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
  v1 = vis_freg_pair(vis_fpadd16s(vis_read_hi(d2), vis_read_lo(d2)),  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                     vis_fpadd16s(vis_read_hi(d3), vis_read_lo(d3))); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
  v2 = vis_bshuffle(v0, v0);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
  v3 = vis_bshuffle(v1, v1);                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
  res = vis_freg_pair(vis_fpadd16s(vis_read_hi(v2), vis_read_lo(v2)), \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                      vis_fpadd16s(vis_read_hi(v3), vis_read_lo(v3)))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
#endif /* MLIB_VIS2 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
mlib_status mlib_ImageAffine_u8_1ch_bc (mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
  mlib_s32  filterposx, filterposy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
  mlib_d64  data0, data1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
  mlib_d64  sum;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
  mlib_d64  row00, row10, row20, row30;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
  mlib_d64  row01, row11, row21, row31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
  mlib_d64  xFilter, yFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
  mlib_d64  v0, v1, v2, v3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
  mlib_d64  d0, d1, d2, d3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
#ifndef MLIB_VIS2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
  mlib_f32  p0, p1, p2, p3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
  mlib_d64  e0, e1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
  mlib_d64  m02, m13, m0213;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
#endif /* MLIB_VIS2 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
  mlib_d64  *dpSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
  mlib_s32  align, cols, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
  mlib_d64  res;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
  const mlib_s16 *mlib_filters_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
  if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    mlib_filters_table = mlib_filters_u8_bc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
  } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    mlib_filters_table = mlib_filters_u8_bc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    vis_write_gsr(3 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
    MLIB_WRITE_BMASK(0x0145ABEF);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    CLIP(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    cols = xRight - xLeft + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    align = (4 - ((mlib_addr)dstPixelPtr) & 3) & 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    align = (cols < align)? cols : align;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    for (i = 0; i < align; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
      NEXT_PIXEL_1BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
      LOAD_BC_U8_1CH_1PIXEL(mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
      RESULT_1BC_U8_1PIXEL(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
      vis_st_u8(res, dstPixelPtr++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    if (i <= cols - 10) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
      NEXT_PIXEL_1BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
      LOAD_BC_U8_1CH_1PIXEL(mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
      NEXT_PIXEL_1BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
      BC_U8_1CH(0, 0, 1, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
      BC_U8_1CH(1, 1, 0, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
      BC_U8_1CH(2, 0, 1, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
      BC_U8_1CH(3, 1, 0, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
      FADD_1BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
      BC_U8_1CH(0, 0, 1, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
      BC_U8_1CH(1, 1, 0, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
      BC_U8_1CH(2, 0, 1, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
      BC_U8_1CH(3, 1, 0, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
      for (; i <= cols - 14; i+=4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
        *(mlib_f32*)dstPixelPtr = vis_fpack16(res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
        FADD_1BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
        BC_U8_1CH(0, 0, 1, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
        BC_U8_1CH(1, 1, 0, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
        BC_U8_1CH(2, 0, 1, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        BC_U8_1CH(3, 1, 0, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        dstPixelPtr += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
      *(mlib_f32*)dstPixelPtr = vis_fpack16(res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
      dstPixelPtr += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
      FADD_1BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
      *(mlib_f32*)dstPixelPtr = vis_fpack16(res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
      dstPixelPtr += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
      RESULT_1BC_U8_1PIXEL(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
      vis_st_u8(res, dstPixelPtr++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
      LOAD_BC_U8_1CH_1PIXEL(mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
      RESULT_1BC_U8_1PIXEL(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
      vis_st_u8(res, dstPixelPtr++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
      i += 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
    for (; i < cols; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
      NEXT_PIXEL_1BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
      LOAD_BC_U8_1CH_1PIXEL(mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
      RESULT_1BC_U8_1PIXEL(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
      vis_st_u8(res, dstPixelPtr++);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
#define FADD_2BC_U8()                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
  d0 = vis_fpadd16(d00, d10);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
  d1 = vis_fpadd16(d01, d11);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
  d2 = vis_fpadd16(d02, d12);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
  d3 = vis_fpadd16(d03, d13);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
  p0 = vis_fpadd16s(vis_read_hi(d0), vis_read_lo(d0));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
  p1 = vis_fpadd16s(vis_read_hi(d1), vis_read_lo(d1));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
  p2 = vis_fpadd16s(vis_read_hi(d2), vis_read_lo(d2));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
  p3 = vis_fpadd16s(vis_read_hi(d3), vis_read_lo(d3));          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
  e0 = vis_freg_pair(p0, p1);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
  e1 = vis_freg_pair(p2, p3);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
  res = vis_fpack16_pair(e0, e1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
#define LOAD_BC_U8_2CH_1PIXEL(mlib_filters_u8)                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
  filterposy = (Y >> FILTER_SHIFT) & FILTER_MASK;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
  yFilter = *((mlib_d64 *) ((mlib_u8 *)mlib_filters_u8 + filterposy)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
  filterposx = (X >> FILTER_SHIFT) & FILTER_MASK;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
  xFilter = *((mlib_d64 *)((mlib_u8 *)mlib_filters_u8 + filterposx));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
  X += dX;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
  Y += dY;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
  row0 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
  row1 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
  row2 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
  row3 = vis_faligndata(data0, data1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
#define NEXT_PIXEL_2BC_U8()                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
  xSrc = (X>>MLIB_SHIFT)-1;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
  ySrc = (Y>>MLIB_SHIFT)-1;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
  sPtr = (mlib_u8 *)lineAddr[ySrc] + (xSrc<<1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
#define RESULT_2BC_U8_1PIXEL()                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
  v00 = vis_fmul8x16au(vis_read_hi(row0), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
  dr = vis_fpmerge(vis_read_hi(xFilter), vis_read_lo(xFilter));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
  v01 = vis_fmul8x16au(vis_read_lo(row0), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
  dr = vis_fpmerge(vis_read_hi(dr), vis_read_lo(dr));            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
  v10 = vis_fmul8x16al(vis_read_hi(row1), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
  dr1 = vis_fpmerge(vis_read_lo(dr), vis_read_lo(dr));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
  v11 = vis_fmul8x16al(vis_read_lo(row1), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
  dr = vis_fpmerge(vis_read_hi(dr), vis_read_hi(dr));            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
  v20 = vis_fmul8x16au(vis_read_hi(row2), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
  xFilter0 = vis_fpmerge(vis_read_hi(dr), vis_read_hi(dr1));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
  v21 = vis_fmul8x16au(vis_read_lo(row2), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
  xFilter1 = vis_fpmerge(vis_read_lo(dr), vis_read_lo(dr1));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
  v30 = vis_fmul8x16al(vis_read_hi(row3), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
  sum0 = vis_fpadd16(v00, v10);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
  v31 = vis_fmul8x16al(vis_read_lo(row3), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
  sum1 = vis_fpadd16(v01, v11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
  sum0 = vis_fpadd16(sum0, v20);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
  sum1 = vis_fpadd16(sum1, v21);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
  sum0 = vis_fpadd16(sum0, v30);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
  sum1 = vis_fpadd16(sum1, v31);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
  v00 = vis_fmul8sux16(sum0, xFilter0);                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
  v01 = vis_fmul8sux16(sum1, xFilter1);                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
  v10 = vis_fmul8ulx16(sum0, xFilter0);                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
  sum0 = vis_fpadd16(v00, v10);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
  v11 = vis_fmul8ulx16(sum1, xFilter1);                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
  sum1 = vis_fpadd16(v01, v11);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
  d0 = vis_fpadd16(sum0, sum1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
  v00 = vis_write_lo(v00, vis_fpadd16s(vis_read_hi(d0),          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
                                       vis_read_lo(d0)));        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
  res = vis_write_lo(res, vis_fpack16(v00))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
#define BC_U8_2CH(index, mlib_filters_u8)                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
  v00 = vis_fmul8x16au(vis_read_hi(row0), vis_read_hi(yFilter));       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
  dr = vis_fpmerge(vis_read_hi(xFilter), vis_read_lo(xFilter));        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
  v01 = vis_fmul8x16au(vis_read_lo(row0), vis_read_hi(yFilter));       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
  dr = vis_fpmerge(vis_read_hi(dr), vis_read_lo(dr));                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
  v10 = vis_fmul8x16al(vis_read_hi(row1), vis_read_hi(yFilter));       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
  dr1 = vis_fpmerge(vis_read_lo(dr), vis_read_lo(dr));                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
  v11 = vis_fmul8x16al(vis_read_lo(row1), vis_read_hi(yFilter));       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
  dr = vis_fpmerge(vis_read_hi(dr), vis_read_hi(dr));                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
  v20 = vis_fmul8x16au(vis_read_hi(row2), vis_read_lo(yFilter));       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
  xFilter0 = vis_fpmerge(vis_read_hi(dr), vis_read_hi(dr1));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
  v21 = vis_fmul8x16au(vis_read_lo(row2), vis_read_lo(yFilter));       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
  xFilter1 = vis_fpmerge(vis_read_lo(dr), vis_read_lo(dr1));           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
  v30 = vis_fmul8x16al(vis_read_hi(row3), vis_read_lo(yFilter));       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
  v31 = vis_fmul8x16al(vis_read_lo(row3), vis_read_lo(yFilter));       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
  sum0 = vis_fpadd16(v00, v10);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
  filterposy = (Y >> FILTER_SHIFT);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
  row0 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
  filterposx = (X >> FILTER_SHIFT);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
  sum1 = vis_fpadd16(v01, v11);                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
  X += dX;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
  sum0 = vis_fpadd16(sum0, v20);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
  row1 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
  Y += dY;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
  sum1 = vis_fpadd16(sum1, v21);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
  xSrc = (X>>MLIB_SHIFT)-1;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
  ySrc = (Y>>MLIB_SHIFT)-1;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
  sum0 = vis_fpadd16(sum0, v30);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
  filterposy &= FILTER_MASK;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
  sum1 = vis_fpadd16(sum1, v31);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
  v00 = vis_fmul8sux16(sum0, xFilter0);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
  row2 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
  v01 = vis_fmul8sux16(sum1, xFilter1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
  v10 = vis_fmul8ulx16(sum0, xFilter0);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
  filterposx &= FILTER_MASK;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
  v11= vis_fmul8ulx16(sum1, xFilter1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
  d0##index = vis_fpadd16(v00, v10);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
  row3 = vis_faligndata(data0, data1);                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
  yFilter = *((mlib_d64 *) ((mlib_u8 *)mlib_filters_u8 + filterposy)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
  d1##index = vis_fpadd16(v01, v11);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
  xFilter = *((mlib_d64 *)((mlib_u8 *)mlib_filters_u8 + filterposx));  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
  sPtr = (mlib_u8 *)lineAddr[ySrc] + (xSrc<<1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
mlib_status mlib_ImageAffine_u8_2ch_bc (mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
  DTYPE  *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
  mlib_s32  filterposx, filterposy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
  mlib_d64  data0, data1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
  mlib_d64  sum0, sum1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
  mlib_d64  row0, row1, row2, row3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
  mlib_f32  p0, p1, p2, p3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
  mlib_d64  xFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
  mlib_d64  xFilter0, xFilter1, yFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
  mlib_d64  v00, v10, v20, v30;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
  mlib_d64  v01, v11, v21, v31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
  mlib_d64  d0, d1, d2, d3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
  mlib_d64  d00, d01, d02, d03;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
  mlib_d64  d10, d11, d12, d13;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
  mlib_d64  e0, e1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
  mlib_d64  *dpSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
  mlib_s32  cols, i, mask, off;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
  mlib_d64  dr, dr1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
  mlib_d64  res, *dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
  const mlib_s16 *mlib_filters_table;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
  if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    mlib_filters_table = mlib_filters_u8_bc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
  } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    mlib_filters_table = mlib_filters_u8_bc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    vis_write_gsr(3 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    CLIP(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    dstLineEnd  = (DTYPE*)dstData + 2 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    cols = xRight - xLeft + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    dp = vis_alignaddr(dstPixelPtr, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    off = dstPixelPtr - (mlib_u8*)dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
    dstLineEnd += 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
    mask = vis_edge8(dstPixelPtr, dstLineEnd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
    i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    if (i <= cols - 10) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
      NEXT_PIXEL_2BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
      LOAD_BC_U8_2CH_1PIXEL(mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
      NEXT_PIXEL_2BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
      BC_U8_2CH(0, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
      BC_U8_2CH(1, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
      BC_U8_2CH(2, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
      BC_U8_2CH(3, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
      FADD_2BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
      BC_U8_2CH(0, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
      BC_U8_2CH(1, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
      BC_U8_2CH(2, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
      BC_U8_2CH(3, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
      for (; i <= cols-14; i+=4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
        vis_pst_8(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
        vis_pst_8(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
        FADD_2BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
        BC_U8_2CH(0, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        BC_U8_2CH(1, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
        BC_U8_2CH(2, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        BC_U8_2CH(3, mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
      vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
      vis_pst_8(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
      vis_pst_8(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
      FADD_2BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
      vis_alignaddr((void *)(8 - (mlib_addr)dstPixelPtr), 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
      vis_pst_8(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
      vis_pst_8(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
      dstPixelPtr = (mlib_u8*)dp + off;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
      RESULT_2BC_U8_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
      vis_alignaddr((void *)7, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
      vis_st_u8(res, dstPixelPtr+1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
      vis_st_u8(res, dstPixelPtr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
      dstPixelPtr += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
      LOAD_BC_U8_2CH_1PIXEL(mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
      RESULT_2BC_U8_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
      vis_alignaddr((void *)7, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
      vis_st_u8(res, dstPixelPtr+1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
      vis_st_u8(res, dstPixelPtr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
      dstPixelPtr += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
      i += 10;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
    for (; i < cols; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
      NEXT_PIXEL_2BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
      LOAD_BC_U8_2CH_1PIXEL(mlib_filters_table);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
      RESULT_2BC_U8_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
      vis_alignaddr((void *)7, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
      vis_st_u8(res, dstPixelPtr+1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
      vis_st_u8(res, dstPixelPtr);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
      dstPixelPtr += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
#ifndef MLIB_VIS2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
#define FADD_3BC_U8()                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
  vis_alignaddr((void*)6, 0);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
  d3 = vis_faligndata(d0, d1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
  vis_alignaddr((void*)2, 0);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
  d4 = vis_faligndata(d1, d2);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
  d0 = vis_fpadd16(d0, d3);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
  d2 = vis_fpadd16(d2, d4);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
  d1 = vis_faligndata(d2, d2);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
  d0 = vis_fpadd16(d0, d1);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
  f0.f = vis_fpack16(d0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
#define FADD_3BC_U8()                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
  vis_alignaddr((void*)4, 0);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
  d3 = vis_bshuffle(d0, d1);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
  d1 = vis_faligndata(d1, d2);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
  d2 = vis_faligndata(d2, d2);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
  d4 = vis_bshuffle(d1, d2);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
  d0 = vis_fpadd16(d0, d3);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
  d1 = vis_fpadd16(d1, d4);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
  d0 = vis_fpadd16(d0, d1);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
  f0.f = vis_fpack16(d0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
#endif /* MLIB_VIS2 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
#define LOAD_BC_U8_3CH_1PIXEL(mlib_filters_u8, mlib_filters_u8_3)      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
  filterposy = (Y >> FILTER_SHIFT) & FILTER_MASK;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
  yFilter = *((mlib_d64 *) ((mlib_u8 *)mlib_filters_u8 + filterposy)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
  filterposx = (X >> FILTER_SHIFT) & FILTER_MASK;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
  xPtr=((mlib_d64 *)((mlib_u8 *)mlib_filters_u8_3+3*filterposx));      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
  xFilter0 = xPtr[0];                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
  xFilter1 = xPtr[1];                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
  xFilter2 = xPtr[2];                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
  X += dX;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
  Y += dY;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
  data2 = dpSrc[2];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
  row00 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
  row01 = vis_faligndata(data1, data2);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
  data2 = dpSrc[2];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
  row10 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
  row11 = vis_faligndata(data1, data2);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
  data2 = dpSrc[2];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
  row20 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
  row21 = vis_faligndata(data1, data2);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
  data2 = dpSrc[2];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
  row30 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
  row31 = vis_faligndata(data1, data2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
#define STORE_BC_U8_3CH_1PIXEL()                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
 dstPixelPtr[0] = f0.t[0];                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
 dstPixelPtr[1] = f0.t[1];                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
 dstPixelPtr[2] = f0.t[2];                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
 dstPixelPtr += 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
#define NEXT_PIXEL_3BC_U8()                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
  xSrc = (X>>MLIB_SHIFT)-1;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
  ySrc = (Y>>MLIB_SHIFT)-1;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
  sPtr = (mlib_u8 *)lineAddr[ySrc] + (3*xSrc)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
#define RESULT_3BC_U8_1PIXEL()                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
  v00 = vis_fmul8x16au(vis_read_hi(row00), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
  v01 = vis_fmul8x16au(vis_read_lo(row00), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
  v02 = vis_fmul8x16au(vis_read_hi(row01), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
  v10 = vis_fmul8x16al(vis_read_hi(row10), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
  v11 = vis_fmul8x16al(vis_read_lo(row10), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
  v12 = vis_fmul8x16al(vis_read_hi(row11), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
  v20 = vis_fmul8x16au(vis_read_hi(row20), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
  sum0 = vis_fpadd16(v00, v10);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
  v21 = vis_fmul8x16au(vis_read_lo(row20), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
  sum1 = vis_fpadd16(v01, v11);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
  v22 = vis_fmul8x16au(vis_read_hi(row21), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
  sum2 = vis_fpadd16(v02, v12);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
  v30 = vis_fmul8x16al(vis_read_hi(row30), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
  sum0 = vis_fpadd16(sum0, v20);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
  v31 = vis_fmul8x16al(vis_read_lo(row30), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
  sum1 = vis_fpadd16(sum1, v21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
  v32 = vis_fmul8x16al(vis_read_hi(row31), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
  sum2 = vis_fpadd16(sum2, v22);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
  sum0 = vis_fpadd16(sum0, v30);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
  sum1 = vis_fpadd16(sum1, v31);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
  v00 = vis_fmul8sux16(sum0, xFilter0);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
  sum2 = vis_fpadd16(sum2, v32);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
  v01 = vis_fmul8ulx16(sum0, xFilter0);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
  v10 = vis_fmul8sux16(sum1, xFilter1);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
  d0 = vis_fpadd16(v00, v01);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
  v11 = vis_fmul8ulx16(sum1, xFilter1);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
  v20 = vis_fmul8sux16(sum2, xFilter2);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
  d1 = vis_fpadd16(v10, v11);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
  v21 = vis_fmul8ulx16(sum2, xFilter2);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
  d2 = vis_fpadd16(v20, v21);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
  FADD_3BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
#define BC_U8_3CH(mlib_filters_u8, mlib_filters_u8_3)                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
  v00 = vis_fmul8x16au(vis_read_hi(row00), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
  v01 = vis_fmul8x16au(vis_read_lo(row00), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
  v02 = vis_fmul8x16au(vis_read_hi(row01), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
  ALIGN_ADDR(dpSrc, sPtr);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
  data0 = dpSrc[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
  filterposy = (Y >> FILTER_SHIFT);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
  v10 = vis_fmul8x16al(vis_read_hi(row10), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
  data1 = dpSrc[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
  v11 = vis_fmul8x16al(vis_read_lo(row10), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
  sum0 = vis_fpadd16(v00, v10);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
  data2 = dpSrc[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
  row00 = vis_faligndata(data0, data1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
  v12 = vis_fmul8x16al(vis_read_hi(row11), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
  row01 = vis_faligndata(data1, data2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
  filterposx = (X >> FILTER_SHIFT);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
  sPtr += srcYStride;                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
  ALIGN_ADDR(dpSrc, sPtr);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
  v20 = vis_fmul8x16au(vis_read_hi(row20), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
  sum1 = vis_fpadd16(v01, v11);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
  data0 = dpSrc[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
  X += dX;                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
  data1 = dpSrc[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
  v21 = vis_fmul8x16au(vis_read_lo(row20), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
  sum2 = vis_fpadd16(v02, v12);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
  data2 = dpSrc[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
  row10 = vis_faligndata(data0, data1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
  v22 = vis_fmul8x16au(vis_read_hi(row21), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
  row11 = vis_faligndata(data1, data2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
  sPtr += srcYStride;                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
  ALIGN_ADDR(dpSrc, sPtr);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
  Y += dY;                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
  xSrc = (X>>MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
  v30 = vis_fmul8x16al(vis_read_hi(row30), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
  sum0 = vis_fpadd16(sum0, v20);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
  data0 = dpSrc[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
  ySrc = (Y>>MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
  data1 = dpSrc[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
  v31 = vis_fmul8x16al(vis_read_lo(row30), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
  sum1 = vis_fpadd16(sum1, v21);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
  data2 = dpSrc[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
  filterposy &= FILTER_MASK;                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
  row20 = vis_faligndata(data0, data1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
  v32 = vis_fmul8x16al(vis_read_hi(row31), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
  row21 = vis_faligndata(data1, data2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
  sPtr += srcYStride;                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
  filterposx &= FILTER_MASK;                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
  sum2 = vis_fpadd16(sum2, v22);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
  ALIGN_ADDR(dpSrc, sPtr);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
  sum0 = vis_fpadd16(sum0, v30);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
  data0 = dpSrc[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
  sum1 = vis_fpadd16(sum1, v31);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
  v00 = vis_fmul8sux16(sum0, xFilter0);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
  data1 = dpSrc[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
  sum2 = vis_fpadd16(sum2, v32);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
  v01 = vis_fmul8ulx16(sum0, xFilter0);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
  data2 = dpSrc[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
  row30 = vis_faligndata(data0, data1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
  v10 = vis_fmul8sux16(sum1, xFilter1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
  d0 = vis_fpadd16(v00, v01);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
  row31 = vis_faligndata(data1, data2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
  yFilter = *((mlib_d64 *)((mlib_u8 *)mlib_filters_u8 + filterposy)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
  v11 = vis_fmul8ulx16(sum1, xFilter1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
  xPtr=((mlib_d64 *)((mlib_u8 *)mlib_filters_u8_3+3*filterposx));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
  xFilter0 = xPtr[0];                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
  v20 = vis_fmul8sux16(sum2, xFilter2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
  d1 = vis_fpadd16(v10, v11);                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
  xFilter1 = xPtr[1];                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
  v21 = vis_fmul8ulx16(sum2, xFilter2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
  xFilter2 = xPtr[2];                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
  sPtr = (mlib_u8 *)lineAddr[ySrc] + (3*xSrc);                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
  d2 = vis_fpadd16(v20, v21)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
mlib_status mlib_ImageAffine_u8_3ch_bc (mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
  mlib_s32  filterposx, filterposy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
  mlib_d64  data0, data1, data2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
  mlib_d64  sum0, sum1, sum2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
  mlib_d64  row00, row10, row20, row30;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
  mlib_d64  row01, row11, row21, row31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
  mlib_d64  xFilter0, xFilter1, xFilter2, yFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
  mlib_d64  v00, v10, v20, v30;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
  mlib_d64  v01, v11, v21, v31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
  mlib_d64  v02, v12, v22, v32;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
  mlib_d64  d0, d1, d2, d3, d4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
  mlib_d64  *dpSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
  mlib_s32  cols, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
  mlib_d64  *xPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
  union {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
    mlib_u8 t[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
    mlib_f32 f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
  } f0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
  const mlib_s16 *mlib_filters_table  ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
  const mlib_s16 *mlib_filters_table_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
  if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
    mlib_filters_table   = mlib_filters_u8_bc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
    mlib_filters_table_3 = mlib_filters_u8_bc_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
  } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
    mlib_filters_table   = mlib_filters_u8_bc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
    mlib_filters_table_3 = mlib_filters_u8_bc2_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
  vis_write_gsr(3 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
  MLIB_WRITE_BMASK(0x6789ABCD);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
  for (j = yStart; j <= yFinish; j ++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
    CLIP(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
    cols = xRight - xLeft + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
    i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
    if (i <= cols - 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
      NEXT_PIXEL_3BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
      LOAD_BC_U8_3CH_1PIXEL(mlib_filters_table, mlib_filters_table_3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
      NEXT_PIXEL_3BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
      BC_U8_3CH(mlib_filters_table, mlib_filters_table_3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
      FADD_3BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
      BC_U8_3CH(mlib_filters_table, mlib_filters_table_3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
      for (; i < cols-4; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
        STORE_BC_U8_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
        FADD_3BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
        BC_U8_3CH(mlib_filters_table, mlib_filters_table_3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
      STORE_BC_U8_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
      FADD_3BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
      STORE_BC_U8_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
      RESULT_3BC_U8_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
      STORE_BC_U8_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
      LOAD_BC_U8_3CH_1PIXEL(mlib_filters_table, mlib_filters_table_3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
      RESULT_3BC_U8_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
      STORE_BC_U8_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
      i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
    for (; i < cols; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
      NEXT_PIXEL_3BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
      LOAD_BC_U8_3CH_1PIXEL(mlib_filters_table, mlib_filters_table_3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
      RESULT_3BC_U8_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
      STORE_BC_U8_3CH_1PIXEL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
#define FADD_4BC_U8()                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
  d0 = vis_fpadd16(d00, d10);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
  d1 = vis_fpadd16(d20, d30);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
  d0 = vis_fpadd16(d0, d1);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
  d2 = vis_fpadd16(d01, d11);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
  d3 = vis_fpadd16(d21, d31);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
  d2 = vis_fpadd16(d2, d3);                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
  res = vis_fpack16_pair(d0, d2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
#define LOAD_BC_U8_4CH_1PIXEL(mlib_filters_u8, mlib_filters_u8_4)      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
  filterposy = (Y >> FILTER_SHIFT) & FILTER_MASK;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
  yFilter = *((mlib_d64 *) ((mlib_u8 *)mlib_filters_u8 + filterposy)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
  filterposx = (X >> FILTER_SHIFT) & FILTER_MASK;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
  xPtr=((mlib_d64 *)((mlib_u8 *)mlib_filters_u8_4+4*filterposx));      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
  xFilter0 = xPtr[0];                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
  xFilter1 = xPtr[1];                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
  xFilter2 = xPtr[2];                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
  xFilter3 = xPtr[3];                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
  X += dX;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
  Y += dY;                                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
  data2 = dpSrc[2];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
  row00 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
  row01 = vis_faligndata(data1, data2);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
  data2 = dpSrc[2];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
  row10 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
  row11 = vis_faligndata(data1, data2);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
  data2 = dpSrc[2];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
  row20 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
  row21 = vis_faligndata(data1, data2);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
  sPtr += srcYStride;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
  ALIGN_ADDR(dpSrc, sPtr);                                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
  data0 = dpSrc[0];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
  data1 = dpSrc[1];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
  data2 = dpSrc[2];                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
  row30 = vis_faligndata(data0, data1);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
  row31 = vis_faligndata(data1, data2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
#define NEXT_PIXEL_4BC_U8()                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
  xSrc = (X>>MLIB_SHIFT)-1;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
  ySrc = (Y>>MLIB_SHIFT)-1;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
  sPtr = (mlib_u8 *)lineAddr[ySrc] + (4*xSrc)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
#define RESULT_4BC_U8_1PIXEL(ind)                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
  v00 = vis_fmul8x16au(vis_read_hi(row00), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
  v01 = vis_fmul8x16au(vis_read_lo(row00), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
  v02 = vis_fmul8x16au(vis_read_hi(row01), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
  v03 = vis_fmul8x16au(vis_read_lo(row01), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
  v10 = vis_fmul8x16al(vis_read_hi(row10), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
  v11 = vis_fmul8x16al(vis_read_lo(row10), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
  sum0 = vis_fpadd16(v00, v10);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
  v12 = vis_fmul8x16al(vis_read_hi(row11), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
  sum1 = vis_fpadd16(v01, v11);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
  v13 = vis_fmul8x16al(vis_read_lo(row11), vis_read_hi(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
  sum2 = vis_fpadd16(v02, v12);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
  v20 = vis_fmul8x16au(vis_read_hi(row20), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
  sum3 = vis_fpadd16(v03, v13);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
  v21 = vis_fmul8x16au(vis_read_lo(row20), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
  sum0 = vis_fpadd16(sum0, v20);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
  v22 = vis_fmul8x16au(vis_read_hi(row21), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
  sum1 = vis_fpadd16(sum1, v21);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
  v23 = vis_fmul8x16au(vis_read_lo(row21), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
  sum2 = vis_fpadd16(sum2, v22);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
  v30 = vis_fmul8x16al(vis_read_hi(row30), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
  sum3 = vis_fpadd16(sum3, v23);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
  v31 = vis_fmul8x16al(vis_read_lo(row30), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
  sum0 = vis_fpadd16(sum0, v30);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
  v32 = vis_fmul8x16al(vis_read_hi(row31), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
  sum1 = vis_fpadd16(sum1, v31);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
  v33 = vis_fmul8x16al(vis_read_lo(row31), vis_read_lo(yFilter)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
  sum2 = vis_fpadd16(sum2, v32);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
  v00 = vis_fmul8sux16(sum0, xFilter0);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
  sum3 = vis_fpadd16(sum3, v33);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
  v01 = vis_fmul8ulx16(sum0, xFilter0);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
  v10 = vis_fmul8sux16(sum1, xFilter1);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
  d0##ind = vis_fpadd16(v00, v01);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
  v11 = vis_fmul8ulx16(sum1, xFilter1);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
  v20 = vis_fmul8sux16(sum2, xFilter2);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
  d1##ind = vis_fpadd16(v10, v11);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
  v21 = vis_fmul8ulx16(sum2, xFilter2);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
  v30 = vis_fmul8sux16(sum3, xFilter3);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
  d2##ind = vis_fpadd16(v20, v21);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
  v31 = vis_fmul8ulx16(sum3, xFilter3);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
  d3##ind = vis_fpadd16(v30, v31)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
#define BC_U8_4CH(ind, mlib_filters_u8, mlib_filters_u8_4)            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
  v00 = vis_fmul8x16au(vis_read_hi(row00), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
  v01 = vis_fmul8x16au(vis_read_lo(row00), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
  v02 = vis_fmul8x16au(vis_read_hi(row01), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
  v03 = vis_fmul8x16au(vis_read_lo(row01), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
  ALIGN_ADDR(dpSrc, sPtr);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
  data0 = dpSrc[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
  filterposy = (Y >> FILTER_SHIFT);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
  v10 = vis_fmul8x16al(vis_read_hi(row10), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
  data1 = dpSrc[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
  v11 = vis_fmul8x16al(vis_read_lo(row10), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
  sum0 = vis_fpadd16(v00, v10);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
  data2 = dpSrc[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
  row00 = vis_faligndata(data0, data1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
  v12 = vis_fmul8x16al(vis_read_hi(row11), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
  row01 = vis_faligndata(data1, data2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
  filterposx = (X >> FILTER_SHIFT);                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
  v13 = vis_fmul8x16al(vis_read_lo(row11), vis_read_hi(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
  sPtr += srcYStride;                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
  ALIGN_ADDR(dpSrc, sPtr);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
  v20 = vis_fmul8x16au(vis_read_hi(row20), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
  sum1 = vis_fpadd16(v01, v11);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
  data0 = dpSrc[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
  X += dX;                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
  data1 = dpSrc[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
  v21 = vis_fmul8x16au(vis_read_lo(row20), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
  sum2 = vis_fpadd16(v02, v12);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
  data2 = dpSrc[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
  row10 = vis_faligndata(data0, data1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
  v22 = vis_fmul8x16au(vis_read_hi(row21), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
  row11 = vis_faligndata(data1, data2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
  sPtr += srcYStride;                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
  ALIGN_ADDR(dpSrc, sPtr);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
  v23 = vis_fmul8x16au(vis_read_lo(row21), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
  sum3 = vis_fpadd16(v03, v13);                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
  Y += dY;                                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
  xSrc = (X>>MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
  v30 = vis_fmul8x16al(vis_read_hi(row30), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
  sum0 = vis_fpadd16(sum0, v20);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
  data0 = dpSrc[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
  ySrc = (Y>>MLIB_SHIFT)-1;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
  data1 = dpSrc[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
  v31 = vis_fmul8x16al(vis_read_lo(row30), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
  sum1 = vis_fpadd16(sum1, v21);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
  data2 = dpSrc[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
  filterposy &= FILTER_MASK;                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
  row20 = vis_faligndata(data0, data1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
  v32 = vis_fmul8x16al(vis_read_hi(row31), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
  row21 = vis_faligndata(data1, data2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
  sPtr += srcYStride;                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
  filterposx &= FILTER_MASK;                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
  v33 = vis_fmul8x16al(vis_read_lo(row31), vis_read_lo(yFilter));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
  sum2 = vis_fpadd16(sum2, v22);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
  ALIGN_ADDR(dpSrc, sPtr);                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
  sum3 = vis_fpadd16(sum3, v23);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
  sum0 = vis_fpadd16(sum0, v30);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
  data0 = dpSrc[0];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
  sum1 = vis_fpadd16(sum1, v31);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
  v00 = vis_fmul8sux16(sum0, xFilter0);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
  data1 = dpSrc[1];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
  sum2 = vis_fpadd16(sum2, v32);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
  v01 = vis_fmul8ulx16(sum0, xFilter0);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
  sum3 = vis_fpadd16(sum3, v33);                                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
  data2 = dpSrc[2];                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
  row30 = vis_faligndata(data0, data1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
  v10 = vis_fmul8sux16(sum1, xFilter1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
  d0##ind = vis_fpadd16(v00, v01);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
  row31 = vis_faligndata(data1, data2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
  yFilter = *((mlib_d64 *)((mlib_u8 *)mlib_filters_u8 + filterposy)); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
  v11 = vis_fmul8ulx16(sum1, xFilter1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
  xPtr=((mlib_d64 *)((mlib_u8 *)mlib_filters_u8_4+4*filterposx));     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
  xFilter0 = xPtr[0];                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
  v20 = vis_fmul8sux16(sum2, xFilter2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
  d1##ind = vis_fpadd16(v10, v11);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
  xFilter1 = xPtr[1];                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
  v21 = vis_fmul8ulx16(sum2, xFilter2);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
  xFilter2 = xPtr[2];                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
  v30 = vis_fmul8sux16(sum3, xFilter3);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
  d2##ind = vis_fpadd16(v20, v21);                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
  v31 = vis_fmul8ulx16(sum3, xFilter3);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
  xFilter3 = xPtr[3];                                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
  sPtr = (mlib_u8 *)lineAddr[ySrc] + (4*xSrc);                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
  d3##ind = vis_fpadd16(v30, v31)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
mlib_status mlib_ImageAffine_u8_4ch_bc (mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
  DTYPE  *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
  mlib_s32  filterposx, filterposy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
  mlib_d64  data0, data1, data2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
  mlib_d64  sum0, sum1, sum2, sum3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
  mlib_d64  row00, row10, row20, row30;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
  mlib_d64  row01, row11, row21, row31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
  mlib_d64  xFilter0, xFilter1, xFilter2, xFilter3, yFilter;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
  mlib_d64  v00, v10, v20, v30;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
  mlib_d64  v01, v11, v21, v31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
  mlib_d64  v02, v12, v22, v32;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
  mlib_d64  v03, v13, v23, v33;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
  mlib_d64  d0, d1, d2, d3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
  mlib_d64  d00, d10, d20, d30;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
  mlib_d64  d01, d11, d21, d31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
  mlib_d64  *dpSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
  mlib_s32  cols, i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
  mlib_d64  res, *dp, *xPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
  mlib_s32  mask, emask, gsrd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
  const mlib_s16 *mlib_filters_table  ;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
  const mlib_s16 *mlib_filters_table_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
  if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
    mlib_filters_table   = mlib_filters_u8_bc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
    mlib_filters_table_4 = mlib_filters_u8_bc_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
  } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
    mlib_filters_table   = mlib_filters_u8_bc2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
    mlib_filters_table_4 = mlib_filters_u8_bc2_4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
    vis_write_gsr(3 << 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
    CLIP(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
    dstLineEnd  = (DTYPE*)dstData + 4 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
    dstLineEnd += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
    dp = (mlib_d64*)vis_alignaddr(dstPixelPtr, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
    mask = vis_edge8(dstPixelPtr, dstLineEnd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
    gsrd = ((8 - (mlib_addr)dstPixelPtr) & 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
    cols = xRight - xLeft + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
    i = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
    if (i <= cols - 6) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
      NEXT_PIXEL_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
      LOAD_BC_U8_4CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
      NEXT_PIXEL_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
      BC_U8_4CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
      BC_U8_4CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
      FADD_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
      BC_U8_4CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
      BC_U8_4CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
      for (; i <= cols-8; i+=2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
        vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
        res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
        vis_pst_8(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
        vis_pst_8(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
        FADD_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
        BC_U8_4CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
        BC_U8_4CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
      vis_pst_8(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
      vis_pst_8(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
      FADD_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
      vis_pst_8(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
      vis_pst_8(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
      RESULT_4BC_U8_1PIXEL(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
      LOAD_BC_U8_4CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
      RESULT_4BC_U8_1PIXEL(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
      FADD_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
      vis_pst_8(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
      vis_pst_8(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
      i += 6;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
    if (i <= cols-4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
      NEXT_PIXEL_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
      LOAD_BC_U8_4CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
      NEXT_PIXEL_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
      BC_U8_4CH(0, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
      BC_U8_4CH(1, mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
      FADD_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
      vis_pst_8(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
      vis_pst_8(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
      RESULT_4BC_U8_1PIXEL(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
      LOAD_BC_U8_4CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
      RESULT_4BC_U8_1PIXEL(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
      FADD_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
      vis_pst_8(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
      vis_pst_8(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
      i += 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
    if (i <= cols-2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
      NEXT_PIXEL_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
      LOAD_BC_U8_4CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
      RESULT_4BC_U8_1PIXEL(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
      NEXT_PIXEL_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
      LOAD_BC_U8_4CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
      RESULT_4BC_U8_1PIXEL(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
      FADD_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
      vis_pst_8(res, dp++, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
      vis_pst_8(res, dp, ~mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
      i += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
    if (i < cols) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
      NEXT_PIXEL_4BC_U8();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
      LOAD_BC_U8_4CH_1PIXEL(mlib_filters_table, mlib_filters_table_4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
      RESULT_4BC_U8_1PIXEL(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
      d0 = vis_fpadd16(d00, d10);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
      d1 = vis_fpadd16(d20, d30);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
      d0 = vis_fpadd16(d0, d1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
      res = vis_fpack16_pair(d0, d0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
      vis_alignaddr((void *)gsrd, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
      res = vis_faligndata(res, res);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
      emask = vis_edge8(dp, dstLineEnd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
      vis_pst_8(res, dp++, emask & mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
      if ((mlib_u8*)dp <= (mlib_u8*)dstLineEnd) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
        mask = vis_edge8(dp, dstLineEnd);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
        vis_pst_8(res, dp, mask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
/***************************************************************/