jdk/src/share/native/sun/awt/medialib/mlib_c_ImageAffine_BL_U16.c
author lana
Thu, 26 Dec 2013 12:04:16 -0800
changeset 23010 6dadb192ad81
parent 5506 202f599c92aa
permissions -rw-r--r--
8029235: Update copyright year to match last edit in jdk8 jdk repository for 2013 Summary: updated files with 2011, 2012 and 2013 years according to the file's last updated date Reviewed-by: tbell, lancea, chegar
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * FUNCTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *      mlib_ImageAffine_u16_1ch_bl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *      mlib_ImageAffine_u16_2ch_bl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *      mlib_ImageAffine_u16_3ch_bl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *      mlib_ImageAffine_u16_4ch_bl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *        - image affine transformation with Bilinear filtering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * SYNOPSIS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *      mlib_status mlib_ImageAffine_u16_?ch_bl(mlib_s32 *leftEdges,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *                                              mlib_s32 *rightEdges,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *                                              mlib_s32 *xStarts,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *                                              mlib_s32 *yStarts,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *                                              mlib_s32 *sides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *                                              mlib_u8  *dstData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *                                              mlib_u8  **lineAddr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *                                              mlib_s32 dstYStride,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *                                              mlib_s32 is_affine,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *                                              mlib_s32 srcYStride)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * ARGUMENTS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *      leftEdges  array[dstHeight] of xLeft coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *      RightEdges array[dstHeight] of xRight coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *      xStarts    array[dstHeight] of xStart * 65536 coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *      yStarts    array[dstHeight] of yStart * 65536 coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *      sides      output array[4]. sides[0] is yStart, sides[1] is yFinish,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *                 sides[2] is dx * 65536, sides[3] is dy * 65536
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *      dstData    pointer to the first pixel on (yStart - 1) line
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *      lineAddr   array[srcHeight] of pointers to the first pixel on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *                 the corresponding lines
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *      dstYStride stride of destination image
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *      is_affine  indicator (Affine - GridWarp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *      srcYStride stride of source image
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * DESCRIPTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *      The functions step along the lines from xLeft to xRight and apply
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *      the bilinear filtering.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
#include "mlib_ImageAffine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
#define DTYPE  mlib_u16
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#define FTYPE  mlib_d64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#define TTYPE    mlib_s32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#define I2F(x)   (x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
#define ROUND(x) (x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
#define FUN_NAME(CHAN) mlib_ImageAffine_u16_##CHAN##_bl
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
#ifdef __sparc /* for SPARC, using floating-point multiplies is faster */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
#define GET_POINTERS(ind)                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
  fdx = (FTYPE)(X & MLIB_MASK) * scale;                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
  fdy = (FTYPE)(Y & MLIB_MASK) * scale;                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
  ySrc = MLIB_POINTER_SHIFT(Y);  Y += dY;                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
  xSrc = X >> MLIB_SHIFT;  X += dX;                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
  srcPixelPtr = MLIB_POINTER_GET(lineAddr, ySrc) + ind * xSrc;  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
  srcPixelPtr2 = (DTYPE *)((mlib_u8 *)srcPixelPtr + srcYStride)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
#define COUNT(ind)                                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
  pix0_##ind = a00_##ind + fdy * (a10_##ind - a00_##ind);       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
  pix1_##ind = a01_##ind + fdy * (a11_##ind - a01_##ind);       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
  res##ind = ROUND(pix0_##ind + fdx * (pix1_##ind - pix0_##ind))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
#define LOAD(ind, ind1, ind2)                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
  a00_##ind = I2F(srcPixelPtr[ind1]);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
  a01_##ind = I2F(srcPixelPtr[ind2]);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
  a10_##ind = I2F(srcPixelPtr2[ind1]);                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
  a11_##ind = I2F(srcPixelPtr2[ind2])
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
mlib_status FUN_NAME(1ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
  DECLAREVAR_BL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
  DTYPE *srcPixelPtr2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
  FTYPE scale = (FTYPE) 1.0 / MLIB_PREC;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    FTYPE fdx, fdy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    TTYPE a00_0, a01_0, a10_0, a11_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    FTYPE pix0_0, pix1_0, res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    CLIP(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    dstLineEnd = (DTYPE *) dstData + xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    GET_POINTERS(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    LOAD(0, 0, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    for (; dstPixelPtr < dstLineEnd; dstPixelPtr++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
      COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
      GET_POINTERS(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
      LOAD(0, 0, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
      dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
mlib_status FUN_NAME(2ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
  DECLAREVAR_BL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
  DTYPE *srcPixelPtr2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
  FTYPE scale = (FTYPE) 1.0 / MLIB_PREC;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    FTYPE fdx, fdy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    TTYPE a00_0, a01_0, a10_0, a11_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    TTYPE a00_1, a01_1, a10_1, a11_1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    FTYPE pix0_0, pix1_0, res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    FTYPE pix0_1, pix1_1, res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    CLIP(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    dstLineEnd = (DTYPE *) dstData + 2 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    GET_POINTERS(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    LOAD(0, 0, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    LOAD(1, 1, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    for (; dstPixelPtr < dstLineEnd; dstPixelPtr += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
      COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
      COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
      GET_POINTERS(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
      LOAD(0, 0, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
      LOAD(1, 1, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
      dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
      dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
mlib_status FUN_NAME(3ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
  DECLAREVAR_BL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
  DTYPE *srcPixelPtr2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
  FTYPE scale = (FTYPE) 1.0 / MLIB_PREC;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    FTYPE fdx, fdy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    FTYPE a00_0, a01_0, a10_0, a11_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    FTYPE a00_1, a01_1, a10_1, a11_1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    FTYPE a00_2, a01_2, a10_2, a11_2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    FTYPE pix0_0, pix1_0, res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    FTYPE pix0_1, pix1_1, res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    FTYPE pix0_2, pix1_2, res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    CLIP(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    dstLineEnd = (DTYPE *) dstData + 3 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    GET_POINTERS(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    LOAD(0, 0, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    LOAD(1, 1, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    LOAD(2, 2, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    for (; dstPixelPtr < dstLineEnd; dstPixelPtr += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
      COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
      COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
      COUNT(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
      GET_POINTERS(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
      LOAD(0, 0, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
      LOAD(1, 1, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
      LOAD(2, 2, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
      dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
      dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
      dstPixelPtr[2] = (DTYPE) res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    COUNT(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    dstPixelPtr[2] = (DTYPE) res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
mlib_status FUN_NAME(4ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
  DECLAREVAR_BL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
  DTYPE *srcPixelPtr2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
  FTYPE scale = (FTYPE) 1.0 / MLIB_PREC;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    FTYPE fdx, fdy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    TTYPE a00_0, a01_0, a10_0, a11_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    TTYPE a00_1, a01_1, a10_1, a11_1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    TTYPE a00_2, a01_2, a10_2, a11_2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    TTYPE a00_3, a01_3, a10_3, a11_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    FTYPE pix0_0, pix1_0, res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    FTYPE pix0_1, pix1_1, res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    FTYPE pix0_2, pix1_2, res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    FTYPE pix0_3, pix1_3, res3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    CLIP(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    dstLineEnd = (DTYPE *) dstData + 4 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    GET_POINTERS(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    LOAD(0, 0, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    LOAD(1, 1, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    LOAD(2, 2, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    LOAD(3, 3, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    for (; dstPixelPtr < dstLineEnd; dstPixelPtr += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
      COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
      COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
      COUNT(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
      COUNT(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
      GET_POINTERS(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
      LOAD(0, 0, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
      LOAD(1, 1, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
      LOAD(2, 2, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
      LOAD(3, 3, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
      dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
      dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
      dstPixelPtr[2] = (DTYPE) res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
      dstPixelPtr[3] = (DTYPE) res3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    COUNT(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    COUNT(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
    dstPixelPtr[2] = (DTYPE) res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    dstPixelPtr[3] = (DTYPE) res3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
#else       /* for x86, using integer multiplies is faster */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
/* for SHORT/USHORT decrease MLIB_SHIFT due to overflow in multiplies like fdy * (a10 - a00) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
#undef  MLIB_SHIFT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
#define MLIB_SHIFT  15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
#define MLIB_ROUND   (1 << (MLIB_SHIFT - 1))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
#define GET_POINTERS(ind)                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
  fdx = X & MLIB_MASK;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
  fdy = Y & MLIB_MASK;                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
  ySrc = MLIB_POINTER_SHIFT(Y);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
  xSrc = X >> MLIB_SHIFT;                                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
  srcPixelPtr = MLIB_POINTER_GET(lineAddr, ySrc) + ind * xSrc;   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
  srcPixelPtr2 = (DTYPE *)((mlib_u8 *)srcPixelPtr + srcYStride); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
  X += dX;                                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
  Y += dY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
#define COUNT(ind)                                                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
  pix0_##ind = a00_##ind + ((fdy * (a10_##ind - a00_##ind) + MLIB_ROUND) >> MLIB_SHIFT); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
  pix1_##ind = a01_##ind + ((fdy * (a11_##ind - a01_##ind) + MLIB_ROUND) >> MLIB_SHIFT); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
  res##ind = pix0_##ind + ((fdx * (pix1_##ind - pix0_##ind) + MLIB_ROUND) >> MLIB_SHIFT)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
#define LOAD(ind, ind1, ind2)                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
  a00_##ind = srcPixelPtr[ind1];                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
  a01_##ind = srcPixelPtr[ind2];                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
  a10_##ind = srcPixelPtr2[ind1];                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
  a11_##ind = srcPixelPtr2[ind2]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
mlib_status FUN_NAME(1ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
  DECLAREVAR_BL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
  DTYPE *srcPixelPtr2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
#if MLIB_SHIFT == 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
  dX = (dX + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
  dY = (dY + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    mlib_s32 fdx, fdy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    mlib_s32 a00_0, a01_0, a10_0, a11_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    mlib_s32 pix0_0, pix1_0, res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    CLIP(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    dstLineEnd = (DTYPE *) dstData + xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
#if MLIB_SHIFT == 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    X = X >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    Y = Y >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    if (warp_tbl != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
      dX = (dX + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
      dY = (dY + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    GET_POINTERS(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    LOAD(0, 0, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    for (; dstPixelPtr < dstLineEnd; dstPixelPtr++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
      COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
      GET_POINTERS(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
      LOAD(0, 0, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
      dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
    dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
mlib_status FUN_NAME(2ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
  DECLAREVAR_BL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
  DTYPE *srcPixelPtr2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
#if MLIB_SHIFT == 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
  dX = (dX + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
  dY = (dY + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    mlib_s32 fdx, fdy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    mlib_s32 a00_0, a01_0, a10_0, a11_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    mlib_s32 a00_1, a01_1, a10_1, a11_1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    mlib_s32 pix0_0, pix1_0, res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    mlib_s32 pix0_1, pix1_1, res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    CLIP(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    dstLineEnd = (DTYPE *) dstData + 2 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
#if MLIB_SHIFT == 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    X = X >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    Y = Y >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    if (warp_tbl != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
      dX = (dX + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
      dY = (dY + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    GET_POINTERS(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    LOAD(0, 0, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
    LOAD(1, 1, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    for (; dstPixelPtr < dstLineEnd; dstPixelPtr += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
      COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
      COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
      GET_POINTERS(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
      LOAD(0, 0, 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
      LOAD(1, 1, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
      dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
      dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
    COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
    COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
    dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
mlib_status FUN_NAME(3ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
  DECLAREVAR_BL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
  DTYPE *srcPixelPtr2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
#if MLIB_SHIFT == 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
  dX = (dX + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
  dY = (dY + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
    mlib_s32 fdx, fdy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    mlib_s32 a00_0, a01_0, a10_0, a11_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    mlib_s32 a00_1, a01_1, a10_1, a11_1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    mlib_s32 a00_2, a01_2, a10_2, a11_2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
    mlib_s32 pix0_0, pix1_0, res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
    mlib_s32 pix0_1, pix1_1, res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    mlib_s32 pix0_2, pix1_2, res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    CLIP(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
    dstLineEnd = (DTYPE *) dstData + 3 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
#if MLIB_SHIFT == 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
    X = X >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    Y = Y >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    if (warp_tbl != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
      dX = (dX + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
      dY = (dY + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
    GET_POINTERS(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
    LOAD(0, 0, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
    LOAD(1, 1, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
    LOAD(2, 2, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
    for (; dstPixelPtr < dstLineEnd; dstPixelPtr += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
      COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
      COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
      COUNT(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
      GET_POINTERS(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
      LOAD(0, 0, 3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
      LOAD(1, 1, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
      LOAD(2, 2, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
      dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
      dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
      dstPixelPtr[2] = (DTYPE) res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
    COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
    COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    COUNT(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
    dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
    dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
    dstPixelPtr[2] = (DTYPE) res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
mlib_status FUN_NAME(4ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
  DECLAREVAR_BL();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
  DTYPE *srcPixelPtr2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
#if MLIB_SHIFT == 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
  dX = (dX + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
  dY = (dY + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
    mlib_s32 fdx, fdy;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
    mlib_s32 a00_0, a01_0, a10_0, a11_0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
    mlib_s32 a00_1, a01_1, a10_1, a11_1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
    mlib_s32 a00_2, a01_2, a10_2, a11_2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    mlib_s32 a00_3, a01_3, a10_3, a11_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
    mlib_s32 pix0_0, pix1_0, res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
    mlib_s32 pix0_1, pix1_1, res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    mlib_s32 pix0_2, pix1_2, res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
    mlib_s32 pix0_3, pix1_3, res3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
    CLIP(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
    dstLineEnd = (DTYPE *) dstData + 4 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
#if MLIB_SHIFT == 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
    X = X >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
    Y = Y >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
    if (warp_tbl != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
      dX = (dX + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
      dY = (dY + 1) >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    GET_POINTERS(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    LOAD(0, 0, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    LOAD(1, 1, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
    LOAD(2, 2, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    LOAD(3, 3, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
    for (; dstPixelPtr < dstLineEnd; dstPixelPtr += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
      COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
      COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
      COUNT(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
      COUNT(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
      GET_POINTERS(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
      LOAD(0, 0, 4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
      LOAD(1, 1, 5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
      LOAD(2, 2, 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
      LOAD(3, 3, 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
      dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
      dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
      dstPixelPtr[2] = (DTYPE) res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
      dstPixelPtr[3] = (DTYPE) res3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
    COUNT(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
    COUNT(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
    COUNT(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
    COUNT(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
    dstPixelPtr[0] = (DTYPE) res0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
    dstPixelPtr[1] = (DTYPE) res1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
    dstPixelPtr[2] = (DTYPE) res2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    dstPixelPtr[3] = (DTYPE) res3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
#endif /* #ifdef __sparc */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
/***************************************************************/