jdk/src/share/native/sun/awt/medialib/mlib_ImageAffine_BC_D64.c
author bae
Fri, 25 Mar 2011 12:50:59 +0300
changeset 8939 04615dca2a76
parent 5506 202f599c92aa
permissions -rw-r--r--
6989717: media native code compiler warnings Reviewed-by: jgodinez, prr
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * FUNCTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *      Image affine transformation with Bicubic filtering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * SYNOPSIS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *      mlib_status mlib_ImageAffine_[s32|f32|d64]_?ch_bc(mlib_s32 *leftEdges,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *                                                        mlib_s32 *rightEdges,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *                                                        mlib_s32 *xStarts,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *                                                        mlib_s32 *yStarts,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *                                                        mlib_s32 *sides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *                                                        mlib_u8  *dstData,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *                                                        mlib_u8  **lineAddr,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *                                                        mlib_s32 dstYStride,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *                                                        mlib_s32 is_affine,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *                                                        mlib_s32 srcYStride,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *                                                        mlib_filter filter)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * ARGUMENTS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *      leftEdges  array[dstHeight] of xLeft coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *      RightEdges array[dstHeight] of xRight coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *      xStarts    array[dstHeight] of xStart * 65536 coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *      yStarts    array[dstHeight] of yStart * 65536 coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *      sides      output array[4]. sides[0] is yStart, sides[1] is yFinish,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *                 sides[2] is dx * 65536, sides[3] is dy * 65536
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *      dstData    pointer to the first pixel on (yStart - 1) line
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *      lineAddr   array[srcHeight] of pointers to the first pixel on
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 *                 the corresponding lines
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *      dstYStride stride of destination image
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *      is_affine  indicator (Affine - GridWarp)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *      srcYStride stride of source image
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *      filter     type of resampling filter
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * DESCRIPTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *      The functions step along the lines from xLeft to xRight and apply
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *      the Bicubic and Bicubic2 filtering.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
#include "mlib_ImageAffine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
#define IMG_TYPE  5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#if IMG_TYPE == 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#define DTYPE  mlib_s32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#define FTYPE  mlib_d64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
#define FUN_NAME(CHAN) mlib_ImageAffine_s32_##CHAN##_bc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
#define STORE(res, x) SAT32(res)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
#elif IMG_TYPE == 4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
#define DTYPE  mlib_f32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
#define FTYPE  DTYPE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
#define FUN_NAME(CHAN) mlib_ImageAffine_f32_##CHAN##_bc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
#define STORE(res, x) res = (x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
#elif IMG_TYPE == 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
#define DTYPE  mlib_d64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
#define FTYPE  DTYPE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
#define FUN_NAME(CHAN) mlib_ImageAffine_d64_##CHAN##_bc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
#define STORE(res, x) res = (x)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
#endif /* IMG_TYPE == 3 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
#define CREATE_COEF_BICUBIC( X, Y, OPERATOR )                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
  dx = (X & MLIB_MASK) * scale;                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
  dy = (Y & MLIB_MASK) * scale;                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
  dx_2  = ((FTYPE)0.5)  * dx;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
  dy_2  = ((FTYPE)0.5)  * dy;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
  dx2   = dx   * dx;    dy2   = dy   * dy;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
  dx3_2 = dx_2 * dx2;   dy3_2 = dy_2 * dy2;                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
  dx3_3 = ((FTYPE)3.0)  * dx3_2;                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
  dy3_3 = ((FTYPE)3.0)  * dy3_2;                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
                                                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
  xf0 = dx2 - dx3_2 - dx_2;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
  xf1 = dx3_3 - ((FTYPE)2.5) * dx2 + ((FTYPE)1.0);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
  xf2 = ((FTYPE)2.0) * dx2 - dx3_3 + dx_2;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
  xf3 = dx3_2 - ((FTYPE)0.5) * dx2;                             \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
                                                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
  OPERATOR;                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                                                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
  yf0 = dy2 - dy3_2 - dy_2;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
  yf1 = dy3_3 - ((FTYPE)2.5) * dy2 + ((FTYPE)1.0);              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
  yf2 = ((FTYPE)2.0) * dy2 - dy3_3 + dy_2;                      \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
  yf3 = dy3_2 - ((FTYPE)0.5) * dy2
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 CREATE_COEF_BICUBIC_2( X, Y, OPERATOR )                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
  dx = (X & MLIB_MASK) * scale;                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
  dy = (Y & MLIB_MASK) * scale;                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
  dx2   = dx  * dx;    dy2   = dy  * dy;                        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
  dx3_2 = dx  * dx2;   dy3_2 = dy  * dy2;                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
  dx3_3 = ((FTYPE)2.0) * dx2;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
  dy3_3 = ((FTYPE)2.0) * dy2;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                                                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
  xf0 = dx3_3 - dx3_2 - dx;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
  xf1 = dx3_2 - dx3_3 + ((FTYPE)1.0);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
  xf2 = dx2   - dx3_2   + dx;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
  xf3 = dx3_2 - dx2;                                            \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
                                                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
  OPERATOR;                                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                                                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
  yf0 = dy3_3 - dy3_2 - dy;                                     \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
  yf1 = dy3_2 - dy3_3 + ((FTYPE)1.0);                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
  yf2 = dy2   - dy3_2   + dy;                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
  yf3 = dy3_2 - dy2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
mlib_status FUN_NAME(1ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    FTYPE xf0, xf1, xf2, xf3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    FTYPE yf0, yf1, yf2, yf3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    FTYPE dx, dx_2, dx2, dx3_2, dx3_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    FTYPE dy, dy_2, dy2, dy3_2, dy3_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    FTYPE c0, c1, c2, c3, val0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    FTYPE scale = 1 / 65536.f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    FTYPE s0, s1, s2, s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    FTYPE s4, s5, s6, s7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    CLIP(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    dstLineEnd = (DTYPE *) dstData + xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
      CREATE_COEF_BICUBIC(X, Y,;);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
      CREATE_COEF_BICUBIC_2(X, Y,;);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    xSrc = (X >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    ySrc = (Y >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + xSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    s1 = srcPixelPtr[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    s2 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
    s3 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    s5 = srcPixelPtr[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    s6 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    s7 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
      for (; dstPixelPtr <= (dstLineEnd - 1); dstPixelPtr++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
        c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
        c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
        srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
        c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[1] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
              srcPixelPtr[2] * xf2 + srcPixelPtr[3] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
        srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
        c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[1] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
              srcPixelPtr[2] * xf2 + srcPixelPtr[3] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
        CREATE_COEF_BICUBIC(X, Y, val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
        STORE(dstPixelPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
        xSrc = (X >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
        ySrc = (Y >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
        srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + xSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
        s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
        s1 = srcPixelPtr[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
        s2 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
        s3 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
        srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
        s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
        s5 = srcPixelPtr[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
        s6 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
        s7 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
      for (; dstPixelPtr <= (dstLineEnd - 1); dstPixelPtr++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
        Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
        c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
        c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
        srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
        c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[1] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
              srcPixelPtr[2] * xf2 + srcPixelPtr[3] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
        srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
        c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[1] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
              srcPixelPtr[2] * xf2 + srcPixelPtr[3] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
        CREATE_COEF_BICUBIC_2(X, Y, val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        STORE(dstPixelPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
        xSrc = (X >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
        ySrc = (Y >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + xSrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
        s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
        s1 = srcPixelPtr[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
        s2 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        s3 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
        srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
        s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
        s5 = srcPixelPtr[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
        s6 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
        s7 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[1] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
          srcPixelPtr[2] * xf2 + srcPixelPtr[3] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[1] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
          srcPixelPtr[2] * xf2 + srcPixelPtr[3] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    STORE(dstPixelPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
mlib_status FUN_NAME(2ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    FTYPE xf0, xf1, xf2, xf3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    FTYPE yf0, yf1, yf2, yf3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    FTYPE dx, dx_2, dx2, dx3_2, dx3_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    FTYPE dy, dy_2, dy2, dy3_2, dy3_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
    FTYPE c0, c1, c2, c3, val0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
    FTYPE scale = 1 / 65536.f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    FTYPE s0, s1, s2, s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    FTYPE s4, s5, s6, s7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    mlib_s32 k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    CLIP(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    dstLineEnd = (DTYPE *) dstData + 2 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    for (k = 0; k < 2; k++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
      mlib_s32 X1 = X;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
      mlib_s32 Y1 = Y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
      DTYPE *dPtr = dstPixelPtr + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
      if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
        CREATE_COEF_BICUBIC(X1, Y1,;);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
        CREATE_COEF_BICUBIC_2(X1, Y1,;);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
      xSrc = (X1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
      ySrc = (Y1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
      srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + 2 * xSrc + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
      s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
      s1 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
      s2 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
      s3 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
      srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
      s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
      s5 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
      s6 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
      s7 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
      if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        for (; dPtr <= (dstLineEnd - 1); dPtr += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
          X1 += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
          Y1 += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
          c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
          c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
          c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[2] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
                srcPixelPtr[4] * xf2 + srcPixelPtr[6] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
          c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[2] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
                srcPixelPtr[4] * xf2 + srcPixelPtr[6] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
          CREATE_COEF_BICUBIC(X1, Y1, val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
          STORE(dPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
          xSrc = (X1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
          ySrc = (Y1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
          srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + 2 * xSrc + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
          s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
          s1 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
          s2 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
          s3 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
          s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
          s5 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
          s6 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
          s7 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
        for (; dPtr <= (dstLineEnd - 1); dPtr += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
          X1 += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
          Y1 += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
          c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
          c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
          c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[2] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                srcPixelPtr[4] * xf2 + srcPixelPtr[6] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
          c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[2] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
                srcPixelPtr[4] * xf2 + srcPixelPtr[6] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
          CREATE_COEF_BICUBIC_2(X1, Y1, val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
            STORE(dPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
          xSrc = (X1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
          ySrc = (Y1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
          srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + 2 * xSrc + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
          s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
          s1 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
          s2 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
          s3 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
          s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
          s5 = srcPixelPtr[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
          s6 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
          s7 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
      c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
      c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
      srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
      c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[2] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
            srcPixelPtr[4] * xf2 + srcPixelPtr[6] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
      srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
      c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[2] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
            srcPixelPtr[4] * xf2 + srcPixelPtr[6] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
      val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
      STORE(dPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
mlib_status FUN_NAME(3ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
    FTYPE xf0, xf1, xf2, xf3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
    FTYPE yf0, yf1, yf2, yf3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
    FTYPE dx, dx_2, dx2, dx3_2, dx3_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
    FTYPE dy, dy_2, dy2, dy3_2, dy3_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
    FTYPE c0, c1, c2, c3, val0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    FTYPE scale = 1 / 65536.f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    FTYPE s0, s1, s2, s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    FTYPE s4, s5, s6, s7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    mlib_s32 k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    CLIP(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    dstLineEnd = (DTYPE *) dstData + 3 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    for (k = 0; k < 3; k++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
      mlib_s32 X1 = X;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
      mlib_s32 Y1 = Y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
      DTYPE *dPtr = dstPixelPtr + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
      if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
        CREATE_COEF_BICUBIC(X1, Y1,;);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        CREATE_COEF_BICUBIC_2(X1, Y1,;);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
      xSrc = (X1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
      ySrc = (Y1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
      srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + 3 * xSrc + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
      s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
      s1 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
      s2 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
      s3 = srcPixelPtr[9];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
      srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
      s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
      s5 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
      s6 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
      s7 = srcPixelPtr[9];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
      if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        for (; dPtr <= (dstLineEnd - 1); dPtr += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
          X1 += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
          Y1 += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
          c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
          c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
          c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[3] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
                srcPixelPtr[6] * xf2 + srcPixelPtr[9] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
          c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[3] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
                srcPixelPtr[6] * xf2 + srcPixelPtr[9] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
          CREATE_COEF_BICUBIC(X1, Y1, val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
          STORE(dPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
          xSrc = (X1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
          ySrc = (Y1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
          srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + 3 * xSrc + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
          s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
          s1 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
          s2 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
          s3 = srcPixelPtr[9];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
          s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
          s5 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
          s6 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
          s7 = srcPixelPtr[9];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
        for (; dPtr <= (dstLineEnd - 1); dPtr += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
          X1 += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
          Y1 += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
          c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
          c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
          c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[3] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
                srcPixelPtr[6] * xf2 + srcPixelPtr[9] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
          c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[3] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
                srcPixelPtr[6] * xf2 + srcPixelPtr[9] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
          CREATE_COEF_BICUBIC_2(X1, Y1, val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
            STORE(dPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
          xSrc = (X1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
          ySrc = (Y1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
          srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + 3 * xSrc + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
          s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
          s1 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
          s2 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
          s3 = srcPixelPtr[9];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
          s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
          s5 = srcPixelPtr[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
          s6 = srcPixelPtr[6];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
          s7 = srcPixelPtr[9];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
      c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
      c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
      srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
      c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[3] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
            srcPixelPtr[6] * xf2 + srcPixelPtr[9] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
      srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
      c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[3] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
            srcPixelPtr[6] * xf2 + srcPixelPtr[9] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
      val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
      STORE(dPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
mlib_status FUN_NAME(4ch)(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
  DECLAREVAR_BC();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
    FTYPE xf0, xf1, xf2, xf3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
    FTYPE yf0, yf1, yf2, yf3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
    FTYPE dx, dx_2, dx2, dx3_2, dx3_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
    FTYPE dy, dy_2, dy2, dy3_2, dy3_3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
    FTYPE c0, c1, c2, c3, val0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
    FTYPE scale = 1 / 65536.f;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    FTYPE s0, s1, s2, s3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    FTYPE s4, s5, s6, s7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
    mlib_s32 k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
    CLIP(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
    dstLineEnd = (DTYPE *) dstData + 4 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
    for (k = 0; k < 4; k++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
      mlib_s32 X1 = X;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
      mlib_s32 Y1 = Y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
      DTYPE *dPtr = dstPixelPtr + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
      if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
        CREATE_COEF_BICUBIC(X1, Y1,;);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
        CREATE_COEF_BICUBIC_2(X1, Y1,;);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
      xSrc = (X1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
      ySrc = (Y1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
      srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + 4 * xSrc + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
      s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
      s1 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
      s2 = srcPixelPtr[8];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
      s3 = srcPixelPtr[12];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
      srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
      s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
      s5 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
      s6 = srcPixelPtr[8];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
      s7 = srcPixelPtr[12];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
      if (filter == MLIB_BICUBIC) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
        for (; dPtr <= (dstLineEnd - 1); dPtr += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
          X1 += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
          Y1 += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
          c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
          c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
          c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[4] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
                srcPixelPtr[8] * xf2 + srcPixelPtr[12] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
          c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[4] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
                srcPixelPtr[8] * xf2 + srcPixelPtr[12] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
          CREATE_COEF_BICUBIC(X1, Y1, val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
          STORE(dPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
          xSrc = (X1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
          ySrc = (Y1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
          srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + 4 * xSrc + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
          s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
          s1 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
          s2 = srcPixelPtr[8];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
          s3 = srcPixelPtr[12];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
          s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
          s5 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
          s6 = srcPixelPtr[8];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
          s7 = srcPixelPtr[12];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
        for (; dPtr <= (dstLineEnd - 1); dPtr += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
          X1 += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
          Y1 += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
          c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
          c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
          c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[4] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
                srcPixelPtr[8] * xf2 + srcPixelPtr[12] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
          c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[4] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
                srcPixelPtr[8] * xf2 + srcPixelPtr[12] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
          CREATE_COEF_BICUBIC_2(X1, Y1, val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
            STORE(dPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
          xSrc = (X1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
          ySrc = (Y1 >> MLIB_SHIFT) - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
          srcPixelPtr = ((DTYPE **) lineAddr)[ySrc] + 4 * xSrc + k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
          s0 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
          s1 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
          s2 = srcPixelPtr[8];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
          s3 = srcPixelPtr[12];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
          srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
          s4 = srcPixelPtr[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
          s5 = srcPixelPtr[4];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
          s6 = srcPixelPtr[8];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
          s7 = srcPixelPtr[12];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
      c0 = (s0 * xf0 + s1 * xf1 + s2 * xf2 + s3 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
      c1 = (s4 * xf0 + s5 * xf1 + s6 * xf2 + s7 * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
      srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
      c2 = (srcPixelPtr[0] * xf0 + srcPixelPtr[4] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
            srcPixelPtr[8] * xf2 + srcPixelPtr[12] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
      srcPixelPtr = (DTYPE *) ((mlib_u8 *) srcPixelPtr + srcYStride);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
      c3 = (srcPixelPtr[0] * xf0 + srcPixelPtr[4] * xf1 +
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
            srcPixelPtr[8] * xf2 + srcPixelPtr[12] * xf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
      val0 = (c0 * yf0 + c1 * yf1 + c2 * yf2 + c3 * yf3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
      STORE(dPtr[0], val0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
/***************************************************************/