jdk/src/java.desktop/share/native/libmlib_image/mlib_ImageAffine_NN.c
author vadim
Fri, 13 May 2016 11:31:05 +0300
changeset 38415 acea5f7d354b
parent 25859 3317bb8137f4
permissions -rw-r--r--
8047931: Remove unused medialib code Reviewed-by: bae
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) 2000, 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
 *      Internal functions for mlib_ImageAffine with Nearest Neighbor filtering.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include "mlib_ImageAffine.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#define sp  srcPixelPtr
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
#define dp  dstPixelPtr
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#undef  DTYPE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
#define DTYPE mlib_s32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
#ifdef _MSC_VER
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
/* Workaround for MSC optimizer bug (known affected versions
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
   12.00.8168-12.00.8804). See bug 4893435 for details. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
#pragma optimize("gs", off)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
#endif /* _MSC_VER */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#ifdef i386 /* do not perform the coping by mlib_d64 data type for x86 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
mlib_status mlib_ImageAffine_s32_1ch_nn(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
  DECLAREVAR();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
  DTYPE *srcPixelPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    CLIP(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    dstLineEnd = (DTYPE *) dstData + xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    for (; dp <= dstLineEnd; dp++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
      sp = S_PTR(Y) + (X >> MLIB_SHIFT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
      dp[0] = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
      X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
      Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
mlib_status mlib_ImageAffine_s32_1ch_nn(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
  DECLAREVAR();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  DTYPE *srcPixelPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
  mlib_s32 i, size;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    d64_2x32 dd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    CLIP(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
    size = xRight - xLeft + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
    if ((mlib_addr) dp & 7) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
      sp = S_PTR(Y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
      *dp++ = sp[X >> MLIB_SHIFT];
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
      X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
      Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
      size--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    for (i = 0; i <= (size - 2); i += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
      mlib_f32 *sp0, *sp1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
      sp0 = (mlib_f32 *) S_PTR(Y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
      sp1 = (mlib_f32 *) S_PTR(Y + dY);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
      dd.f32s.f0 = sp0[X >> MLIB_SHIFT];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
      dd.f32s.f1 = sp1[(X + dX) >> MLIB_SHIFT];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
      *(mlib_d64 *) dp = dd.d64;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
      dp += 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
      X += 2 * dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
      Y += 2 * dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    if (size & 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
      sp = S_PTR(Y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
      *dp = sp[X >> MLIB_SHIFT];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
#endif /* i386 ( do not perform the coping by mlib_d64 data type for x86 ) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
mlib_status mlib_ImageAffine_s32_2ch_nn(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
  DECLAREVAR();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
  DTYPE *srcPixelPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    CLIP(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    dstLineEnd = (DTYPE *) dstData + 2 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    for (; dp <= dstLineEnd; dp += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
      sp = S_PTR(Y) + 2 * (X >> MLIB_SHIFT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
      dp[0] = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
      dp[1] = sp[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
      X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
      Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
mlib_status mlib_ImageAffine_s32_3ch_nn(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
  DECLAREVAR();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
  DTYPE *srcPixelPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    CLIP(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    dstLineEnd = (DTYPE *) dstData + 3 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    for (; dp <= dstLineEnd; dp += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
      sp = S_PTR(Y) + 3 * (X >> MLIB_SHIFT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
      dp[0] = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
      dp[1] = sp[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
      dp[2] = sp[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
      X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
      Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
mlib_status mlib_ImageAffine_s32_4ch_nn(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
  DECLAREVAR();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
  DTYPE *srcPixelPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    CLIP(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    dstLineEnd = (DTYPE *) dstData + 4 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    for (; dp <= dstLineEnd; dp += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
      sp = S_PTR(Y) + 4 * (X >> MLIB_SHIFT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
      dp[0] = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
      dp[1] = sp[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
      dp[2] = sp[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
      dp[3] = sp[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
      X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
      Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
#undef  DTYPE
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
#define DTYPE mlib_d64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
mlib_status mlib_ImageAffine_d64_1ch_nn(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
  DECLAREVAR();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
  DTYPE *srcPixelPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    CLIP(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    dstLineEnd = (DTYPE *) dstData + xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    for (; dp <= dstLineEnd; dp++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
      sp = S_PTR(Y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
      dp[0] = sp[X >> MLIB_SHIFT];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
      X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
      Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
mlib_status mlib_ImageAffine_d64_2ch_nn(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
  DECLAREVAR();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
  DTYPE *srcPixelPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    CLIP(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    dstLineEnd = (DTYPE *) dstData + 2 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    for (; dp <= dstLineEnd; dp += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
      sp = S_PTR(Y) + 2 * (X >> MLIB_SHIFT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
      dp[0] = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
      dp[1] = sp[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
      X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
      Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
mlib_status mlib_ImageAffine_d64_3ch_nn(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
  DECLAREVAR();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
  DTYPE *srcPixelPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    CLIP(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    dstLineEnd = (DTYPE *) dstData + 3 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    for (; dp <= dstLineEnd; dp += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
      sp = S_PTR(Y) + 3 * (X >> MLIB_SHIFT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
      dp[0] = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
      dp[1] = sp[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
      dp[2] = sp[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
      X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
      Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
mlib_status mlib_ImageAffine_d64_4ch_nn(mlib_affine_param *param)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
  DECLAREVAR();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
  DTYPE *srcPixelPtr;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
  DTYPE *dstLineEnd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
  for (j = yStart; j <= yFinish; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    CLIP(4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    dstLineEnd = (DTYPE *) dstData + 4 * xRight;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    for (; dp <= dstLineEnd; dp += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
      sp = S_PTR(Y) + 4 * (X >> MLIB_SHIFT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
      dp[0] = sp[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
      dp[1] = sp[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
      dp[2] = sp[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
      dp[3] = sp[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
      X += dX;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
      Y += dY;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
#ifdef _MSC_VER
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
/* Workaround for MSC optimizer bug (known affected versions
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
   12.00.8168-12.00.8804). See bug 4893435 for details. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
#pragma optimize("gs", on)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
#endif /* _MSC_VER */