jdk/src/java.desktop/unix/native/libmlib_image/mlib_v_ImageChannelInsert_1.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) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 * FUNCTIONS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *      mlib_v_ImageChannelInsert_U8_12_D1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *      mlib_v_ImageChannelInsert_U8_13_D1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 *      mlib_v_ImageChannelInsert_U8_14_D1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * ARGUMENT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *      src     pointer to source image data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 *      dst     pointer to destination image data
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *      slb     source image line stride in bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *      dlb     destination image line stride in bytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *      dsize   image data size in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *      xsize   image width in pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *      ysize   image height in lines
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *      cmask   channel mask
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * DESCRIPTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *      Copy the 1-channel source image into the selected channel
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *      of the destination image -- VIS version low level functions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * NOTE
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *      These functions are separated from mlib_v_ImageChannelInsert.c
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *      for loop unrolling and structure clarity.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
#include "vis_proto.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
#include "mlib_image.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
#include "mlib_v_ImageChannelInsert.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
#define INSERT_U8_12(sd0, dd0, dd1)     /* channel duplicate */ \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
  dd0 = vis_fpmerge(vis_read_hi(sd0), vis_read_hi(sd0));        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
  dd1 = vis_fpmerge(vis_read_lo(sd0), vis_read_lo(sd0))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
/* insert one channel to a 2-channel image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
void mlib_v_ImageChannelInsert_U8_12_D1(const mlib_u8 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                                        mlib_u8       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                                        mlib_s32      dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                                        mlib_s32      cmask)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
  mlib_u8 *sa, *da;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
  mlib_u8 *dend, *dend2;                              /* end points in dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
  mlib_d64 *dp;                                       /* 8-byte aligned start points in dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
  mlib_d64 *sp;                                       /* 8-byte aligned start point in src */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
  mlib_d64 sd0, sd1;                                  /* 8-byte source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
  mlib_d64 dd0, dd1, dd2, dd3;                        /* 8-byte destination data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
  mlib_s32 soff;                                      /* offset of address in src */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
  mlib_s32 doff;                                      /* offset of address in dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
  mlib_s32 off;                                       /* offset of src over dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
  mlib_s32 emask;                                     /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
  mlib_s32 bmask;                                     /* channel mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
  mlib_s32 i, n;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
  bmask = cmask | (cmask << 2) | (cmask << 4) | (cmask << 6);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
  sa = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
  da = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
  /* prepare the source address */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
  sp = (mlib_d64 *) ((mlib_addr) sa & (~7));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
  soff = ((mlib_addr) sa & 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
  /* prepare the destination addresses */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
  dp = (mlib_d64 *) ((mlib_addr) da & (~7));
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
  doff = ((mlib_addr) da & 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
  dend = da + dsize * 2 - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
  dend2 = dend - 15;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
  /* calculate the src's offset over dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
  off = soff * 2 - doff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
  if (doff % 2 != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    bmask = (~bmask) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
  if (off == 0) {                           /* src and dst have same alignment */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    /* load 8 bytes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    sd0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    /* insert, including some garbage at the start point */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    INSERT_U8_12(sd0, dd0, dd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    /* store 16 bytes result */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    emask = vis_edge8(da, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    vis_pst_8(dd0, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
      vis_pst_8(dd1, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    if ((mlib_addr) dp <= (mlib_addr) dend2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
      n = ((mlib_u8 *) dend2 - (mlib_u8 *) dp) / 16 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
      /* 8-pixel column loop, emask not needed */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
      for (i = 0; i < n; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        sd0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
        INSERT_U8_12(sd0, dd0, dd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
        vis_pst_8(dd0, dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
        vis_pst_8(dd1, dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    /* end point handling */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
      sd0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
      INSERT_U8_12(sd0, dd0, dd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
      vis_pst_8(dd0, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
      if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
        vis_pst_8(dd1, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
  else if (off < 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    vis_alignaddr((void *)0, off);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    /* generate edge mask for the start point */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    emask = vis_edge8(da, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    /* load 8 bytes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    sd0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    /* insert and store 16 bytes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    INSERT_U8_12(sd0, dd0, dd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    vis_pst_8(vis_faligndata(dd0, dd0), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
      vis_pst_8(vis_faligndata(dd0, dd1), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    if ((mlib_addr) dp <= (mlib_addr) dend2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
      n = ((mlib_u8 *) dend2 - (mlib_u8 *) dp) / 16 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
      /* 8-pixel column loop, emask not needed */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
      for (i = 0; i < n; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
        dd2 = dd1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        sd0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
        INSERT_U8_12(sd0, dd0, dd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
        vis_pst_8(vis_faligndata(dd2, dd0), dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
        vis_pst_8(vis_faligndata(dd0, dd1), dp++, bmask);
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
    /* end point handling */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
      dd2 = dd1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
      sd0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
      INSERT_U8_12(sd0, dd0, dd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
      vis_pst_8(vis_faligndata(dd2, dd0), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
      if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        vis_pst_8(vis_faligndata(dd0, dd1), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
  else if (off < 8) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    vis_alignaddr((void *)0, off);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
    /* generate edge mask for the start point */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    emask = vis_edge8(da, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    /* load 16 bytes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    sd0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    /* insert and store 16 bytes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    INSERT_U8_12(sd0, dd0, dd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    INSERT_U8_12(sd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    vis_pst_8(vis_faligndata(dd0, dd1), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
      vis_pst_8(vis_faligndata(dd1, dd2), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    if ((mlib_addr) dp <= (mlib_addr) dend2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
      n = ((mlib_u8 *) dend2 - (mlib_u8 *) dp) / 16 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
      /* 8-pixel column loop, emask not needed */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
      for (i = 0; i < n; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
        dd0 = dd2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
        dd1 = dd3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
        sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
        INSERT_U8_12(sd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
        vis_pst_8(vis_faligndata(dd0, dd1), dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
        vis_pst_8(vis_faligndata(dd1, dd2), dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    /* end point handling */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
      dd0 = dd2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
      dd1 = dd3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
      sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
      INSERT_U8_12(sd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
      vis_pst_8(vis_faligndata(dd0, dd1), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
      if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
        emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
        vis_pst_8(vis_faligndata(dd1, dd2), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
  else {                                    /* (off >= 8) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    vis_alignaddr((void *)0, off);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    /* generate edge mask for the start point */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    emask = vis_edge8(da, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    /* load 16 bytes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    sd0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    /* insert and store 16 bytes */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    INSERT_U8_12(sd0, dd0, dd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    INSERT_U8_12(sd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    vis_pst_8(vis_faligndata(dd1, dd2), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
      vis_pst_8(vis_faligndata(dd2, dd3), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    if ((mlib_addr) dp <= (mlib_addr) dend2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
      n = ((mlib_u8 *) dend2 - (mlib_u8 *) dp) / 16 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
      /* 8-pixel column loop, emask not needed */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
      for (i = 0; i < n; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
        dd0 = dd2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
        dd1 = dd3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
        sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
        INSERT_U8_12(sd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
        vis_pst_8(vis_faligndata(dd1, dd2), dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
        vis_pst_8(vis_faligndata(dd2, dd3), dp++, bmask);
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
    /* end point handling */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
      dd0 = dd2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
      dd1 = dd3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
      sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
      INSERT_U8_12(sd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
      vis_pst_8(vis_faligndata(dd1, dd2), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
      if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
        emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
        vis_pst_8(vis_faligndata(dd2, dd3), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
#define LOAD_INSERT_STORE_U8(channeld)                          \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
  vis_alignaddr((void *)0, off);                                \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
  sd0 = sd1;                                                    \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
  sd1 = *sp++;                                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
  sd  = vis_faligndata(sd0, sd1);                               \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
  vis_alignaddr((void *)0, 1);                                  \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
  vis_st_u8(sd = vis_faligndata(sd, sd), da); da += channeld;   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
  vis_st_u8(sd = vis_faligndata(sd, sd), da); da += channeld;   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
  vis_st_u8(sd = vis_faligndata(sd, sd), da); da += channeld;   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
  vis_st_u8(sd = vis_faligndata(sd, sd), da); da += channeld;   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
  vis_st_u8(sd = vis_faligndata(sd, sd), da); da += channeld;   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
  vis_st_u8(sd = vis_faligndata(sd, sd), da); da += channeld;   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
  vis_st_u8(sd = vis_faligndata(sd, sd), da); da += channeld;   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
  vis_st_u8(sd = vis_faligndata(sd, sd), da); da += channeld
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
void mlib_v_ImageChannelInsert_U8_13_D1(const mlib_u8 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
                                        mlib_u8       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                                        mlib_s32      dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                                        mlib_s32      cmask)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
  mlib_u8 *sa, *da;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
  mlib_u8 *dend;                                      /* end point in destination */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
  mlib_d64 *sp;                                       /* 8-byte aligned start points in src */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
  mlib_d64 sd0, sd1, sd;                              /* 8-byte registers for source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
  mlib_s32 off;                                       /* offset of address alignment in src */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
  mlib_s32 i;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
  /* prepare the src address */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
  sa = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
  sp = (mlib_d64 *) ((mlib_addr) sa & (~7));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
  off = (mlib_addr) sa & 7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
  /* prepare the dst address */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
  da = dst + (2 / cmask);                   /* 4,2,1 -> 0,1,2 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
  dend = da + dsize * 3 - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
  sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
  for (i = 0; i < dsize / 8; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    LOAD_INSERT_STORE_U8(3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
  /* right end handling */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
  if ((mlib_addr) da <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
    vis_alignaddr((void *)0, off);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    sd0 = sd1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    sd = vis_faligndata(sd0, sd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    vis_alignaddr((void *)0, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    vis_st_u8(sd = vis_faligndata(sd, sd), da);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    da += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    if ((mlib_addr) da <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
      vis_st_u8(sd = vis_faligndata(sd, sd), da);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
      da += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
      if ((mlib_addr) da <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        vis_st_u8(sd = vis_faligndata(sd, sd), da);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
        da += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
        if ((mlib_addr) da <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
          vis_st_u8(sd = vis_faligndata(sd, sd), da);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
          da += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
          if ((mlib_addr) da <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
            vis_st_u8(sd = vis_faligndata(sd, sd), da);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
            da += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
            if ((mlib_addr) da <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
              vis_st_u8(sd = vis_faligndata(sd, sd), da);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
              da += 3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
              if ((mlib_addr) da <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
                vis_st_u8(sd = vis_faligndata(sd, sd), da);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
              }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
#define INSERT_U8_14(sd0, dd0, dd1, dd2, dd3)                   \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
  sda = vis_fpmerge(vis_read_hi(sd0), vis_read_hi(sd0));        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
  sdb = vis_fpmerge(vis_read_lo(sd0), vis_read_lo(sd0));        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
  dd0 = vis_fpmerge(vis_read_hi(sda), vis_read_hi(sda));        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
  dd1 = vis_fpmerge(vis_read_lo(sda), vis_read_lo(sda));        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
  dd2 = vis_fpmerge(vis_read_hi(sdb), vis_read_hi(sdb));        \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
  dd3 = vis_fpmerge(vis_read_lo(sdb), vis_read_lo(sdb))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
void mlib_v_ImageChannelInsert_U8_14_D1(const mlib_u8 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
                                        mlib_u8       *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
                                        mlib_s32      dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                                        mlib_s32      cmask)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
  mlib_u8 *sa, *da;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
  mlib_u8 *dend, *dend2;                              /* end points in dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
  mlib_d64 *dp;                                       /* 8-byte aligned start points in dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
  mlib_d64 *sp;                                       /* 8-byte aligned start point in src */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
  mlib_d64 sd0, sd1, sd;                              /* 8-byte source data */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
  mlib_d64 sda, sdb;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
  mlib_d64 dd0, dd1, dd2, dd3, dd4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
  mlib_s32 soff;                                      /* offset of address in src */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
  mlib_s32 doff;                                      /* offset of address in dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
  mlib_s32 emask;                                     /* edge mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
  mlib_s32 bmask;                                     /* channel mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
  mlib_s32 i, n;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
  sa = (void *)src;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
  da = dst;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
  bmask = cmask | (cmask << 4) | (cmask << 8);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
  /* prepare the source address */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
  sp = (mlib_d64 *) ((mlib_addr) sa & (~7));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
  soff = ((mlib_addr) sa & 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
  /* prepare the destination addresses */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
  dp = (mlib_d64 *) ((mlib_addr) da & (~7));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
  doff = ((mlib_addr) da & 7);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
  dend = da + dsize * 4 - 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
  dend2 = dend - 31;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
  bmask = (bmask >> (doff % 4)) & 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
  if (doff == 0) {                          /* dst is 8-byte aligned */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    vis_alignaddr((void *)0, soff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
    sd0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    sd = vis_faligndata(sd0, sd1);          /* the intermediate is aligned */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
    INSERT_U8_14(sd, dd0, dd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
    emask = vis_edge8(da, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    vis_pst_8(dd0, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
    if ((mlib_addr) dp <= (mlib_addr) dend) { /* for very small size */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
      vis_pst_8(dd1, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
      if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
        emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
        vis_pst_8(dd2, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
        if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
          emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
          vis_pst_8(dd3, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    if ((mlib_addr) dp <= (mlib_addr) dend2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
      n = ((mlib_u8 *) dend2 - (mlib_u8 *) dp) / 32 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
      /* 8-pixel column loop, emask not needed */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
      for (i = 0; i < n; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        sd0 = sd1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        sd = vis_faligndata(sd0, sd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        INSERT_U8_14(sd, dd0, dd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        vis_pst_8(dd0, dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        vis_pst_8(dd1, dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        vis_pst_8(dd2, dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        vis_pst_8(dd3, dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    /* end point handling */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
    if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
      sd0 = sd1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
      sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
      sd = vis_faligndata(sd0, sd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
      INSERT_U8_14(sd, dd0, dd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
      vis_pst_8(dd0, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
      if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
        emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
        vis_pst_8(dd1, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
        if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
          emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
          vis_pst_8(dd2, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
          if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
            emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
            vis_pst_8(dd3, dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
  else {                                    /* dst is not 8-byte aligned */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
    vis_alignaddr((void *)0, soff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
    sd0 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
    sd = vis_faligndata(sd0, sd1);          /* the intermediate is aligned */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    INSERT_U8_14(sd, dd0, dd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
    vis_alignaddr((void *)0, -doff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
    emask = vis_edge8(da, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
    vis_pst_8(vis_faligndata(dd0, dd0), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
    if ((mlib_addr) dp <= (mlib_addr) dend) { /* for very small size */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
      vis_pst_8(vis_faligndata(dd0, dd1), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
      if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
        vis_pst_8(vis_faligndata(dd1, dd2), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
        if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
          emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
          vis_pst_8(vis_faligndata(dd2, dd3), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    if ((mlib_addr) dp <= (mlib_addr) dend2) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
      n = ((mlib_u8 *) dend2 - (mlib_u8 *) dp) / 32 + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
      /* 8-pixel column loop, emask not needed */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
#pragma pipeloop(0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
      for (i = 0; i < n; i++) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
        dd4 = dd3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
        vis_alignaddr((void *)0, soff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        sd0 = sd1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
        sd = vis_faligndata(sd0, sd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
        INSERT_U8_14(sd, dd0, dd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        vis_alignaddr((void *)0, -doff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
        vis_pst_8(vis_faligndata(dd4, dd0), dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
        vis_pst_8(vis_faligndata(dd0, dd1), dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
        vis_pst_8(vis_faligndata(dd1, dd2), dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
        vis_pst_8(vis_faligndata(dd2, dd3), dp++, bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
    /* end point handling */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
      dd4 = dd3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
      vis_alignaddr((void *)0, soff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
      sd0 = sd1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
      sd1 = *sp++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
      sd = vis_faligndata(sd0, sd1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
      INSERT_U8_14(sd, dd0, dd1, dd2, dd3);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
      vis_alignaddr((void *)0, -doff);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
      emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
      vis_pst_8(vis_faligndata(dd4, dd0), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
      if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
        emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
        vis_pst_8(vis_faligndata(dd0, dd1), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
        if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
          emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
          vis_pst_8(vis_faligndata(dd1, dd2), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
          if ((mlib_addr) dp <= (mlib_addr) dend) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
            emask = vis_edge8(dp, dend);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
            vis_pst_8(vis_faligndata(dd2, dd3), dp++, emask & bmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
          }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
/***************************************************************/