jdk/src/share/native/sun/awt/medialib/mlib_c_ImageThresh1_U8.c
author ohair
Tue, 25 May 2010 15:58:33 -0700
changeset 5506 202f599c92aa
parent 2 90ce3da70b43
permissions -rw-r--r--
6943119: Rebrand source copyright notices Reviewed-by: darcy, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
 * FUNCTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *      mlib_ImageThresh1 - thresholding
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * SYNOPSIS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *      mlib_status mlib_ImageThresh1(mlib_image       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *                                    const mlib_image *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *                                    const mlib_s32   *thresh,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *                                    const mlib_s32   *ghigh,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *                                    const mlib_s32   *glow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * ARGUMENT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *      dst     pointer to output image
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *      src     pointer to input image
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *      thresh  array of thresholds
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *      ghigh   array of values above thresholds
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *      glow    array of values below thresholds
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * RESTRICTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *      The images must have the same size, and the same number
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *      of channels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *      The images can have 1, 2, 3, or 4 channels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *      The images can be in MLIB_BYTE, MLIB_SHORT or MLIB_INT data type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *      The type of the output image can be MLIB_BIT, or the same as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *      type of the input image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * DESCRIPTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 *      If the pixel band value is above the threshold for that channel,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *      set the destination to the ghigh value for that channel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *      Otherwise, set the destination to the glow value for that channel.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 *                      +- glow[c]   src[x][y][c] <= thresh[c]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 *      dst[x][y][c]  = |
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 *                      +- ghigh[c]  src[x][y][c] >  thresh[c]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
#include "mlib_image.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
#include "mlib_ImageCheck.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
#include "mlib_c_ImageThresh1.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
#define STYPE           mlib_u8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
#define TTYPE           mlib_s32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
#define T_SHIFT         31
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
#define DO_THRESH(s0, th, gl, gh)                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  (((gh) & (((th) - (TTYPE)(s0)) >> T_SHIFT)) |                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
   ((gl) &~ (((th) - (TTYPE)(s0)) >> T_SHIFT)))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
#define THRESH1_CMP_SHIFT(s0, th, sh)                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  ((((th) - (s0)) >> T_SHIFT) & (1 << (sh)))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
#define STRIP(pd, ps, w, h, ch, th, gh, gl) {                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    STYPE s0;                                                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    for ( i = 0; i < h; i++ ) {                                 \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
      for (j = 0; j < w; j ++)  {                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
        for (k = 0; k < ch; k++) {                              \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
          s0 = ((STYPE*)ps)[i*src_stride + j*ch + k];           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
          ((STYPE*)pd)[i*dst_stride + j*ch + k] =               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
                (s0 <= th[k]) ? gl[k]: gh[k];                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
        }                                                       \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
      }                                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    }                                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
#define INIT_THRESH0(n)                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
  thresh0 = thresh[n];                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
  ghigh0  = ghigh[n];                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
  glow0   = glow[n]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
#define INIT_THRESH1(n)                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
  thresh1 = thresh[n];                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
  ghigh1  = ghigh[n];                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
  glow1   = glow[n]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
#define INIT_THRESH2(n)                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
  thresh2 = thresh[n];                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
  ghigh2  = ghigh[n];                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
  glow2   = glow[n]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
#define INIT_THRESH3(n)                                         \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
  thresh3 = thresh[n];                                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
  ghigh3  = ghigh[n];                                           \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
  glow3   = glow[n]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
#define THRESH0(s0) DO_THRESH(s0, thresh0, glow0, ghigh0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
#define THRESH1(s0) DO_THRESH(s0, thresh1, glow1, ghigh1)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
#define THRESH2(s0) DO_THRESH(s0, thresh2, glow2, ghigh2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
#define THRESH3(s0) DO_THRESH(s0, thresh3, glow3, ghigh3)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
void mlib_c_ImageThresh1_U81(PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
  mlib_s32 *thresh = (void *)__thresh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
  mlib_s32 *ghigh = (void *)__ghigh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
  mlib_s32 *glow = (void *)__glow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
  STYPE *psrc_row = psrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
  STYPE *pdst_row = pdst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
  TTYPE thresh0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
  TTYPE ghigh0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
  TTYPE glow0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
  mlib_s32 i, j, k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
  if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    STRIP(pdst, psrc, width, height, 1, thresh, ghigh, glow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
  INIT_THRESH0(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
  for (i = 0; i < height; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    for (j = 0; j <= (width - 8); j += 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
      pdst_row[j] = THRESH0(psrc_row[j]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
      pdst_row[j + 1] = THRESH0(psrc_row[j + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
      pdst_row[j + 2] = THRESH0(psrc_row[j + 2]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
      pdst_row[j + 3] = THRESH0(psrc_row[j + 3]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
      pdst_row[j + 4] = THRESH0(psrc_row[j + 4]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
      pdst_row[j + 5] = THRESH0(psrc_row[j + 5]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
      pdst_row[j + 6] = THRESH0(psrc_row[j + 6]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
      pdst_row[j + 7] = THRESH0(psrc_row[j + 7]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    for (; j < width; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
      pdst_row[j] = THRESH0(psrc_row[j]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    psrc_row += src_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    pdst_row += dst_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
void mlib_c_ImageThresh1_U82(PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
  mlib_s32 *thresh = (void *)__thresh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
  mlib_s32 *ghigh = (void *)__ghigh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
  mlib_s32 *glow = (void *)__glow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
  STYPE *psrc_row = psrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
  STYPE *pdst_row = pdst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
  TTYPE thresh0, thresh1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
  TTYPE ghigh0, ghigh1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
  TTYPE glow0, glow1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
  mlib_s32 i, j, k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
  if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    STRIP(pdst, psrc, width, height, 2, thresh, ghigh, glow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
  INIT_THRESH0(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
  INIT_THRESH1(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
  width <<= 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
  for (i = 0; i < height; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    for (j = 0; j <= (width - 8); j += 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
      pdst_row[j] = THRESH0(psrc_row[j]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
      pdst_row[j + 1] = THRESH1(psrc_row[j + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
      pdst_row[j + 2] = THRESH0(psrc_row[j + 2]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
      pdst_row[j + 3] = THRESH1(psrc_row[j + 3]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
      pdst_row[j + 4] = THRESH0(psrc_row[j + 4]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
      pdst_row[j + 5] = THRESH1(psrc_row[j + 5]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
      pdst_row[j + 6] = THRESH0(psrc_row[j + 6]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
      pdst_row[j + 7] = THRESH1(psrc_row[j + 7]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    for (; j < width; j += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
      pdst_row[j] = THRESH0(psrc_row[j]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
      pdst_row[j + 1] = THRESH1(psrc_row[j + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    psrc_row += src_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    pdst_row += dst_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
  }
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
void mlib_c_ImageThresh1_U83(PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
  mlib_s32 *thresh = (void *)__thresh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
  mlib_s32 *ghigh = (void *)__ghigh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
  mlib_s32 *glow = (void *)__glow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
  STYPE *psrc_row = psrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
  STYPE *pdst_row = pdst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
  TTYPE thresh0, thresh1, thresh2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
  TTYPE ghigh0, ghigh1, ghigh2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
  TTYPE glow0, glow1, glow2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
  mlib_s32 i, j, k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
  if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    STRIP(pdst, psrc, width, height, 3, thresh, ghigh, glow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
  width = 3 * width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
  INIT_THRESH0(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
  INIT_THRESH1(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
  INIT_THRESH2(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
  for (i = 0; i < height; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    for (j = 0; j <= (width - 12); j += 12) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
      pdst_row[j] = THRESH0(psrc_row[j]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
      pdst_row[j + 1] = THRESH1(psrc_row[j + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
      pdst_row[j + 2] = THRESH2(psrc_row[j + 2]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
      pdst_row[j + 3] = THRESH0(psrc_row[j + 3]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
      pdst_row[j + 4] = THRESH1(psrc_row[j + 4]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
      pdst_row[j + 5] = THRESH2(psrc_row[j + 5]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
      pdst_row[j + 6] = THRESH0(psrc_row[j + 6]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
      pdst_row[j + 7] = THRESH1(psrc_row[j + 7]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
      pdst_row[j + 8] = THRESH2(psrc_row[j + 8]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
      pdst_row[j + 9] = THRESH0(psrc_row[j + 9]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
      pdst_row[j + 10] = THRESH1(psrc_row[j + 10]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
      pdst_row[j + 11] = THRESH2(psrc_row[j + 11]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    for (; j < width; j += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
      pdst_row[j] = THRESH0(psrc_row[j]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
      pdst_row[j + 1] = THRESH1(psrc_row[j + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
      pdst_row[j + 2] = THRESH2(psrc_row[j + 2]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    psrc_row += src_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    pdst_row += dst_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
void mlib_c_ImageThresh1_U84(PARAMS)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
  mlib_s32 *thresh = (void *)__thresh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
  mlib_s32 *ghigh = (void *)__ghigh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
  mlib_s32 *glow = (void *)__glow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
  STYPE *psrc_row = psrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
  STYPE *pdst_row = pdst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
  TTYPE thresh0, thresh1, thresh2, thresh3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
  TTYPE ghigh0, ghigh1, ghigh2, ghigh3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
  TTYPE glow0, glow1, glow2, glow3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
  mlib_s32 i, j, k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
  if (width < 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    STRIP(pdst, psrc, width, height, 4, thresh, ghigh, glow);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
  INIT_THRESH0(0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
  INIT_THRESH1(1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
  INIT_THRESH2(2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
  INIT_THRESH3(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
  width *= 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
  for (i = 0; i < height; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    for (j = 0; j <= (width - 8); j += 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
      pdst_row[j] = THRESH0(psrc_row[j]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
      pdst_row[j + 1] = THRESH1(psrc_row[j + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
      pdst_row[j + 2] = THRESH2(psrc_row[j + 2]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
      pdst_row[j + 3] = THRESH3(psrc_row[j + 3]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
      pdst_row[j + 4] = THRESH0(psrc_row[j + 4]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
      pdst_row[j + 5] = THRESH1(psrc_row[j + 5]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
      pdst_row[j + 6] = THRESH2(psrc_row[j + 6]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
      pdst_row[j + 7] = THRESH3(psrc_row[j + 7]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    if (j < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
      pdst_row[j] = THRESH0(psrc_row[j]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
      pdst_row[j + 1] = THRESH1(psrc_row[j + 1]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
      pdst_row[j + 2] = THRESH2(psrc_row[j + 2]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
      pdst_row[j + 3] = THRESH3(psrc_row[j + 3]);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    psrc_row += src_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    pdst_row += dst_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
void mlib_c_ImageThresh1_U81_1B(PARAMS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
                                mlib_s32 dbit_off)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
  mlib_s32 *thresh = (void *)__thresh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
  mlib_s32 *ghigh = (void *)__ghigh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
  mlib_s32 *glow = (void *)__glow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
  STYPE *psrc_row = psrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
  mlib_u8 *pdst_row = pdst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
  TTYPE thresh0 = thresh[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
  mlib_s32 mhigh, mlow, emask, dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
  mlib_s32 i, j, jbit, l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
  mhigh = (ghigh[0] > 0) ? 0xff : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
  mlow = (glow[0] > 0) ? 0xff : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
  for (i = 0; i < height; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    j = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    jbit = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    if (dbit_off) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
      mlib_s32 nume = 8 - dbit_off;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
      if (nume > width)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        nume = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
      dst0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
      emask = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
      for (; j < nume; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
        emask |= (1 << (7 - (dbit_off + j)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
      pdst_row[0] = (dst0 & emask) | (pdst_row[0] & ~emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    for (; j <= (width - 16); j += 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
      dst0 = THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
        THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh0, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
        THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh0, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
        THRESH1_CMP_SHIFT(psrc_row[j + 3], thresh0, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
        THRESH1_CMP_SHIFT(psrc_row[j + 4], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
        THRESH1_CMP_SHIFT(psrc_row[j + 5], thresh0, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
        THRESH1_CMP_SHIFT(psrc_row[j + 6], thresh0, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
        THRESH1_CMP_SHIFT(psrc_row[j + 7], thresh0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
      *(pdst_row + jbit) = (mlib_u8) dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
      dst0 = THRESH1_CMP_SHIFT(psrc_row[j + 8], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        THRESH1_CMP_SHIFT(psrc_row[j + 9], thresh0, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
        THRESH1_CMP_SHIFT(psrc_row[j + 10], thresh0, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        THRESH1_CMP_SHIFT(psrc_row[j + 11], thresh0, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
        THRESH1_CMP_SHIFT(psrc_row[j + 12], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        THRESH1_CMP_SHIFT(psrc_row[j + 13], thresh0, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
        THRESH1_CMP_SHIFT(psrc_row[j + 14], thresh0, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
        THRESH1_CMP_SHIFT(psrc_row[j + 15], thresh0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
      *(pdst_row + jbit) = (mlib_u8) dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    if (width - j >= 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
      dst0 = THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh0, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
        THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh0, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        THRESH1_CMP_SHIFT(psrc_row[j + 3], thresh0, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
        THRESH1_CMP_SHIFT(psrc_row[j + 4], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
        THRESH1_CMP_SHIFT(psrc_row[j + 5], thresh0, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
        THRESH1_CMP_SHIFT(psrc_row[j + 6], thresh0, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
        THRESH1_CMP_SHIFT(psrc_row[j + 7], thresh0, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
      *(pdst_row + jbit) = (mlib_u8) dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
      j += 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    if (j < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
      dst0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
      l = 7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
      for (; j < width; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j], thresh0, l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
        l--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
      emask = (0xFF << (l + 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
      pdst_row[jbit] = (dst0 & emask) | (pdst_row[jbit] & ~emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    psrc_row += src_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    pdst_row += dst_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
void mlib_c_ImageThresh1_U82_1B(PARAMS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                                mlib_s32 dbit_off)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
  mlib_s32 *thresh = (void *)__thresh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
  mlib_s32 *ghigh = (void *)__ghigh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
  mlib_s32 *glow = (void *)__glow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
  STYPE *psrc_row = psrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
  mlib_u8 *pdst_row = pdst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
  TTYPE thresh0 = thresh[0], thresh1 = thresh[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
  mlib_s32 mhigh0, mlow0, mhigh, mlow, emask, dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
  mlib_s32 i, j, jbit, l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
  mhigh0 = (ghigh[0] > 0) ? 0xaaa : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
  mhigh0 |= (ghigh[1] > 0) ? 0x555 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
  mlow0 = (glow[0] > 0) ? 0xaaa : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
  mlow0 |= (glow[1] > 0) ? 0x555 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
  width *= 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
  for (i = 0; i < height; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    thresh0 = thresh[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    thresh1 = thresh[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    j = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    jbit = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    mhigh = mhigh0 >> (dbit_off & 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
    mlow = mlow0 >> (dbit_off & 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
    if (dbit_off) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
      mlib_s32 nume = 8 - dbit_off;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
      if (nume > width)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
        nume = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
      dst0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
      emask = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
      for (; j <= (nume - 2); j += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        emask |= (3 << (6 - (dbit_off + j)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, 6 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
      if (j < nume) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
        emask |= (1 << (7 - (dbit_off + j)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
        /* swap threshes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        thresh0 = thresh[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        thresh1 = thresh[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
        j++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
      pdst_row[0] = (dst0 & emask) | (pdst_row[0] & ~emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    for (; j <= (width - 16); j += 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
      dst0 = THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
        THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh0, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
        THRESH1_CMP_SHIFT(psrc_row[j + 3], thresh1, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        THRESH1_CMP_SHIFT(psrc_row[j + 4], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
        THRESH1_CMP_SHIFT(psrc_row[j + 5], thresh1, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        THRESH1_CMP_SHIFT(psrc_row[j + 6], thresh0, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
        THRESH1_CMP_SHIFT(psrc_row[j + 7], thresh1, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
      *(pdst_row + jbit) = (mlib_u8) dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
      dst0 = THRESH1_CMP_SHIFT(psrc_row[j + 8], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        THRESH1_CMP_SHIFT(psrc_row[j + 9], thresh1, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        THRESH1_CMP_SHIFT(psrc_row[j + 10], thresh0, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        THRESH1_CMP_SHIFT(psrc_row[j + 11], thresh1, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
        THRESH1_CMP_SHIFT(psrc_row[j + 12], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
        THRESH1_CMP_SHIFT(psrc_row[j + 13], thresh1, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
        THRESH1_CMP_SHIFT(psrc_row[j + 14], thresh0, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
        THRESH1_CMP_SHIFT(psrc_row[j + 15], thresh1, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
      *(pdst_row + jbit) = (mlib_u8) dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
    if (width - j >= 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
      dst0 = THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh0, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
        THRESH1_CMP_SHIFT(psrc_row[j + 3], thresh1, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
        THRESH1_CMP_SHIFT(psrc_row[j + 4], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
        THRESH1_CMP_SHIFT(psrc_row[j + 5], thresh1, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        THRESH1_CMP_SHIFT(psrc_row[j + 6], thresh0, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        THRESH1_CMP_SHIFT(psrc_row[j + 7], thresh1, 0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
      *(pdst_row + jbit) = (mlib_u8) dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
      j += 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    if (j < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
      dst0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
      l = 7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
      for (; j <= (width - 2); j += 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j], thresh0, l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, l - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
        l -= 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
      if (j < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j], thresh0, l);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
        l--;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
      emask = (0xFF << (l + 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
      pdst_row[jbit] = (dst0 & emask) | (pdst_row[jbit] & ~emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
    psrc_row += src_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
    pdst_row += dst_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
void mlib_c_ImageThresh1_U83_1B(PARAMS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
                                mlib_s32 dbit_off)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
  mlib_s32 *thresh = (void *)__thresh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
  mlib_s32 *ghigh = (void *)__ghigh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
  mlib_s32 *glow = (void *)__glow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
  STYPE *psrc_row = psrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
  mlib_u8 *pdst_row = pdst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
  TTYPE thresh0, thresh1, thresh2, threshT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
  mlib_s32 mhigh = 0, mlow = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
  mlib_s32 mhigh0, mlow0, mhigh1, mlow1, mhigh2, mlow2, emask, dst0, dst1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
  mlib_s32 i, j, jbit, k, l;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
  if (ghigh[0] > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
    mhigh = 0x492492;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
  if (ghigh[1] > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
    mhigh |= 0x249249;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
  if (ghigh[2] > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
    mhigh |= 0x924924;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
  if (glow[0] > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    mlow = 0x492492;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
  if (glow[1] > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
    mlow |= 0x249249;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
  if (glow[2] > 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
    mlow |= 0x924924;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
  width = 3 * width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
  for (i = 0; i < height; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
    thresh0 = thresh[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
    thresh1 = thresh[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
    thresh2 = thresh[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
    j = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
    jbit = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
    mhigh0 = mhigh >> (dbit_off & 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
    mlow0 = mlow >> (dbit_off & 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
    mhigh1 = mhigh0 >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
    mlow1 = mlow0 >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
    mhigh2 = mhigh0 >> 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
    mlow2 = mlow0 >> 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
    if (dbit_off) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
      mlib_s32 nume = 8 - dbit_off;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
      if (nume > width)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
        nume = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
      dst0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
      emask = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
      for (; j <= (nume - 3); j += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
        emask |= (7 << (5 - (dbit_off + j)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, 6 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh2, 5 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
      for (; j < nume; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
        emask |= (1 << (7 - (dbit_off + j)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
        /* swap threshes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
        threshT = thresh0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
        thresh0 = thresh1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
        thresh1 = thresh2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
        thresh2 = threshT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
      dst0 = (mhigh0 & dst0) | (mlow0 & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
      pdst_row[0] = (dst0 & emask) | (pdst_row[0] & ~emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
      mhigh0 = mhigh >> (9 - nume);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
      mlow0 = mlow >> (9 - nume);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
      mhigh1 = mhigh0 >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
      mlow1 = mlow0 >> 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
      mhigh2 = mhigh0 >> 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
      mlow2 = mlow0 >> 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
    for (; j <= (width - 24); j += 24) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
      dst0 = (THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
              THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
              THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh2, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
              THRESH1_CMP_SHIFT(psrc_row[j + 3], thresh0, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
              THRESH1_CMP_SHIFT(psrc_row[j + 4], thresh1, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
              THRESH1_CMP_SHIFT(psrc_row[j + 5], thresh2, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
              THRESH1_CMP_SHIFT(psrc_row[j + 6], thresh0, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
              THRESH1_CMP_SHIFT(psrc_row[j + 7], thresh1, 0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
      dst0 = (mhigh0 & dst0) | (mlow0 & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
      *(pdst_row + jbit) = dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
      dst0 = (THRESH1_CMP_SHIFT(psrc_row[j + 8], thresh2, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
              THRESH1_CMP_SHIFT(psrc_row[j + 9], thresh0, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
              THRESH1_CMP_SHIFT(psrc_row[j + 10], thresh1, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
              THRESH1_CMP_SHIFT(psrc_row[j + 11], thresh2, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
              THRESH1_CMP_SHIFT(psrc_row[j + 12], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
              THRESH1_CMP_SHIFT(psrc_row[j + 13], thresh1, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
              THRESH1_CMP_SHIFT(psrc_row[j + 14], thresh2, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
              THRESH1_CMP_SHIFT(psrc_row[j + 15], thresh0, 0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
      dst0 = (mhigh1 & dst0) | (mlow1 & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
      *(pdst_row + jbit) = dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
      dst0 = (THRESH1_CMP_SHIFT(psrc_row[j + 16], thresh1, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
              THRESH1_CMP_SHIFT(psrc_row[j + 17], thresh2, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
              THRESH1_CMP_SHIFT(psrc_row[j + 18], thresh0, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
              THRESH1_CMP_SHIFT(psrc_row[j + 19], thresh1, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
              THRESH1_CMP_SHIFT(psrc_row[j + 20], thresh2, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
              THRESH1_CMP_SHIFT(psrc_row[j + 21], thresh0, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
              THRESH1_CMP_SHIFT(psrc_row[j + 22], thresh1, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
              THRESH1_CMP_SHIFT(psrc_row[j + 23], thresh2, 0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
      dst0 = (mhigh2 & dst0) | (mlow2 & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
      *(pdst_row + jbit) = dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
    if (j < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
      k = width - j;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
      dst0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
      l = 31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
      for (; j < width; j += 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
        dst0 |= (THRESH1_CMP_SHIFT(psrc_row[j], thresh0, l) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
                 THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, l - 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
                 THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh2, l - 2));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
        l -= 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
      l = (k + 7) >> 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
      k = (l << 3) - k;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
      emask = (0xFF << k);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
      if (l == 3) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
        dst1 = dst0 >> 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
        dst1 = (mhigh0 & dst1) | (mlow0 & ~dst1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
        pdst_row[jbit] = dst1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
        dst1 = (dst0 >> 16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
        dst1 = (mhigh1 & dst1) | (mlow1 & ~dst1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
        pdst_row[jbit + 1] = dst1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
        dst1 = (dst0 >> 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
        dst1 = (mhigh2 & dst1) | (mlow2 & ~dst1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
        pdst_row[jbit + 2] = (dst1 & emask) | (pdst_row[jbit + 2] & ~emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
      else if (l == 2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
        dst1 = dst0 >> 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
        dst1 = (mhigh0 & dst1) | (mlow0 & ~dst1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
        pdst_row[jbit] = dst1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
        dst1 = (dst0 >> 16);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
        dst1 = (mhigh1 & dst1) | (mlow1 & ~dst1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
        pdst_row[jbit + 1] = (dst1 & emask) | (pdst_row[jbit + 1] & ~emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
      else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
        dst1 = dst0 >> 24;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
        dst1 = (mhigh0 & dst1) | (mlow0 & ~dst1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
        pdst_row[jbit] = (dst1 & emask) | (pdst_row[jbit] & ~emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
    psrc_row += src_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
    pdst_row += dst_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
void mlib_c_ImageThresh1_U84_1B(PARAMS,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
                                mlib_s32 dbit_off)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
  mlib_s32 *thresh = (void *)__thresh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
  mlib_s32 *ghigh = (void *)__ghigh;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
  mlib_s32 *glow = (void *)__glow;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
  STYPE *psrc_row = psrc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
  mlib_u8 *pdst_row = pdst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
  TTYPE thresh0, thresh1, thresh2, thresh3, threshT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
  mlib_s32 mhigh0, mlow0, mhigh, mlow, emask, dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
  mlib_s32 i, j, jbit;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
  mhigh0 = (ghigh[0] > 0) ? 0x8888 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
  mhigh0 |= (ghigh[1] > 0) ? 0x4444 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
  mhigh0 |= (ghigh[2] > 0) ? 0x2222 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
  mhigh0 |= (ghigh[3] > 0) ? 0x1111 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
  mlow0 = (glow[0] > 0) ? 0x8888 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
  mlow0 |= (glow[1] > 0) ? 0x4444 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
  mlow0 |= (glow[2] > 0) ? 0x2222 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
  mlow0 |= (glow[3] > 0) ? 0x1111 : 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
  width *= 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
  for (i = 0; i < height; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
    thresh0 = thresh[0];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
    thresh1 = thresh[1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
    thresh2 = thresh[2];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
    thresh3 = thresh[3];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
    j = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
    jbit = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
    mhigh = mhigh0 >> dbit_off;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
    mlow = mlow0 >> dbit_off;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
    if (dbit_off) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
      mlib_s32 nume = 8 - dbit_off;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
      if (nume > width)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
        nume = width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
      dst0 = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
      emask = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
      for (; j <= (nume - 4); j += 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
        emask |= (0xf << (4 - (dbit_off + j)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, 6 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh2, 5 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j + 3], thresh3, 4 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
      for (; j < nume; j++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
        emask |= (1 << (7 - (dbit_off + j)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
        dst0 |= THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7 - (dbit_off + j));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
        /* swap threshes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
        threshT = thresh0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
        thresh0 = thresh1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
        thresh1 = thresh2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
        thresh2 = thresh3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
        thresh3 = threshT;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
      pdst_row[0] = (dst0 & emask) | (pdst_row[0] & ~emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
#ifdef __SUNPRO_C
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
#endif /* __SUNPRO_C */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
    for (; j <= (width - 16); j += 16) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
      dst0 = (THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
              THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
              THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh2, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
              THRESH1_CMP_SHIFT(psrc_row[j + 3], thresh3, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
              THRESH1_CMP_SHIFT(psrc_row[j + 4], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
              THRESH1_CMP_SHIFT(psrc_row[j + 5], thresh1, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
              THRESH1_CMP_SHIFT(psrc_row[j + 6], thresh2, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
              THRESH1_CMP_SHIFT(psrc_row[j + 7], thresh3, 0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
      pdst_row[jbit] = dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
      dst0 = (THRESH1_CMP_SHIFT(psrc_row[j + 8], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
              THRESH1_CMP_SHIFT(psrc_row[j + 9], thresh1, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
              THRESH1_CMP_SHIFT(psrc_row[j + 10], thresh2, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
              THRESH1_CMP_SHIFT(psrc_row[j + 11], thresh3, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
              THRESH1_CMP_SHIFT(psrc_row[j + 12], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
              THRESH1_CMP_SHIFT(psrc_row[j + 13], thresh1, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
              THRESH1_CMP_SHIFT(psrc_row[j + 14], thresh2, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
              THRESH1_CMP_SHIFT(psrc_row[j + 15], thresh3, 0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
      pdst_row[jbit] = dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
    if (j <= width - 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
      dst0 = (THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
              THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
              THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh2, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
              THRESH1_CMP_SHIFT(psrc_row[j + 3], thresh3, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
              THRESH1_CMP_SHIFT(psrc_row[j + 4], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
              THRESH1_CMP_SHIFT(psrc_row[j + 5], thresh1, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
              THRESH1_CMP_SHIFT(psrc_row[j + 6], thresh2, 1) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
              THRESH1_CMP_SHIFT(psrc_row[j + 7], thresh3, 0));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
      pdst_row[jbit] = dst0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
      jbit++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
      j += 8;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
    if (j < width) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
      dst0 = (THRESH1_CMP_SHIFT(psrc_row[j], thresh0, 7) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
              THRESH1_CMP_SHIFT(psrc_row[j + 1], thresh1, 6) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
              THRESH1_CMP_SHIFT(psrc_row[j + 2], thresh2, 5) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
              THRESH1_CMP_SHIFT(psrc_row[j + 3], thresh3, 4) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
              THRESH1_CMP_SHIFT(psrc_row[j + 4], thresh0, 3) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
              THRESH1_CMP_SHIFT(psrc_row[j + 5], thresh1, 2) |
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
              THRESH1_CMP_SHIFT(psrc_row[j + 6], thresh2, 1));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
      emask = (0xFF << (8 - (width - j)));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
      dst0 = (mhigh & dst0) | (mlow & ~dst0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
      pdst_row[jbit] = (dst0 & emask) | (pdst_row[jbit] & ~emask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
    psrc_row += src_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
    pdst_row += dst_stride;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
/***************************************************************/