jdk/src/solaris/native/sun/awt/medialib/mlib_v_ImageChannelExtract.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) 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
 * FUNCTIONS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
 *      mlib_ImageChannelExtract  - Copy the selected channels of the source
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 *                                  image into the destination image
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * SYNOPSIS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 *      mlib_status mlib_ImageChannelExtract(mlib_image *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 *                                           mlib_image *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 *                                           mlib_s32   cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * ARGUMENT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *    dst     Pointer to destination image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 *    src     Pointer to source image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 *    cmask   Source channel selection mask.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 *    The least significant bit (LSB) is corresponding to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *    last channel in the source image data.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *    The bits with value 1 stand for the channels selected.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *    If more than N channels are selected, the leftmost N
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *    channels are extracted, where N is the number of channels
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *    in the destination image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * RESTRICTION
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 *    The src and dst must have the same width, height and data type.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 *    The src and dst can have 1, 2, 3 or 4 channels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 *    The src and dst can be either MLIB_BYTE, MLIB_SHORT,  MLIB_INT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *    MLIB_FLOAT or  MLIB_DOUBLE.
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
 *    Copy the selected channels of the source image into the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 *    destination image
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
#include <stdlib.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
#include "mlib_image.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
#include "mlib_ImageCheck.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
/* functions defined in mlib_ImageChannelExtract_1.c */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
mlib_v_ImageChannelExtract_U8(mlib_u8  *src,   mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
                              mlib_u8  *dst,   mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                              mlib_s32 channels, mlib_s32 channeld,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
                              mlib_s32 width,   mlib_s32 height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                              mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
mlib_v_ImageChannelExtract_S16(mlib_u16 *src,    mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
                               mlib_u16 *dst,    mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
                               mlib_s32 channels, mlib_s32 channeld,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
                               mlib_s32 width,    mlib_s32 height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
                               mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
mlib_v_ImageChannelExtract_S32(mlib_s32 *src,    mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
                               mlib_s32 *dst,    mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
                               mlib_s32 channels, mlib_s32 channeld,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
                               mlib_s32 width,    mlib_s32 height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
                               mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
mlib_v_ImageChannelExtract_D64(mlib_d64 *src,    mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
                               mlib_d64 *dst,    mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
                               mlib_s32 channels, mlib_s32 channeld,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
                               mlib_s32 width,    mlib_s32 height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
                               mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
void mlib_v_ImageChannelExtract_U8_2_1(mlib_u8  *sl,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
                                       mlib_u8 *dl,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
                                       mlib_s32 width,   mlib_s32 height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
void mlib_v_ImageChannelExtract_U8_3_2(mlib_u8  *sl,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
                                       mlib_u8 *dl,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
                                       mlib_s32 width,   mlib_s32 height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
                                       mlib_s32 count1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
void mlib_v_ImageChannelExtract_U8_4_2(mlib_u8  *sl,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
                                       mlib_u8  *dl,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
                                       mlib_s32 width,   mlib_s32 height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
                                       mlib_s32 count1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
void mlib_v_ImageChannelExtract_32_2_1(mlib_f32 *sl,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
                                       mlib_f32 *dl,   mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
                                       mlib_s32 width, mlib_s32 height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
void mlib_v_ImageChannelExtract_32_3_1(mlib_f32 *sl,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
                                       mlib_f32 *dl,   mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
                                       mlib_s32 width, mlib_s32 height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
void mlib_v_ImageChannelExtract_32_3_2(mlib_f32 *sp, mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
                                       mlib_f32 *dp, mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
                                       mlib_s32 width, mlib_s32 height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
                                       mlib_s32 deltac1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
void mlib_v_ImageChannelExtract_32_4_1(mlib_f32 *sl,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
                                       mlib_f32 *dl,   mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
                                       mlib_s32 width, mlib_s32 height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
void mlib_v_ImageChannelExtract_32_4_2(mlib_f32 *sp, mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
                                       mlib_f32 *dp, mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
                                       mlib_s32 width, mlib_s32 height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
                                       mlib_s32 deltac1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
void mlib_v_ImageChannelExtract_32_4_3(mlib_f32 *sl,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
                                       mlib_f32 *dl,   mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
                                       mlib_s32 width, mlib_s32 height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
                                       mlib_s32  mask_off);
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
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
mlib_v_ImageChannelExtract_U8_21_A8D1X8(mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
                                        mlib_u8  *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
                                        mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
                                        mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
mlib_v_ImageChannelExtract_U8_21_A8D2X8(mlib_u8  *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
                                        mlib_u8  *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
                                        mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
                                        mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
mlib_v_ImageChannelExtract_U8_21_D1(mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
                                    mlib_u8  *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
                                    mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
                                    mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
mlib_v_ImageChannelExtract_U8_21(mlib_u8  *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
                                 mlib_u8  *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
                                 mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
                                 mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
mlib_v_ImageChannelExtract_U8_31_A8D1X8(mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
                                        mlib_u8  *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
                                        mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
                                        mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
mlib_v_ImageChannelExtract_U8_31_A8D2X8(mlib_u8  *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
                                        mlib_u8  *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
                                        mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
                                        mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
mlib_v_ImageChannelExtract_U8_31_D1(mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
                                    mlib_u8  *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
                                    mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
                                    mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
mlib_v_ImageChannelExtract_U8_31(mlib_u8  *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
                                 mlib_u8  *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
                                 mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
                                 mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
mlib_v_ImageChannelExtract_U8_41_A8D1X8(mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
                                        mlib_u8  *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
                                        mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
                                        mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
mlib_v_ImageChannelExtract_U8_41_A8D2X8(mlib_u8  *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
                                        mlib_u8  *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
                                        mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
                                        mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
mlib_v_ImageChannelExtract_U8_41_D1(mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
                                    mlib_u8  *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
                                    mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                                    mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
mlib_v_ImageChannelExtract_U8_41(mlib_u8  *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
                                 mlib_u8  *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
                                 mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
                                 mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
mlib_v_ImageChannelExtract_S16_11_A8D1X4(mlib_s16 *src, mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
                                         mlib_s32 dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
mlib_v_ImageChannelExtract_S16_21_A8D1X4(mlib_s16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
                                         mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
                                         mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
                                         mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
mlib_v_ImageChannelExtract_S16_21_A8D2X4(mlib_s16 *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
                                         mlib_s16 *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
                                         mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
                                         mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
mlib_v_ImageChannelExtract_S16_21_D1(mlib_s16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
                                     mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
                                     mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
                                     mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
mlib_v_ImageChannelExtract_S16_21(mlib_s16 *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
                                  mlib_s16 *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
                                  mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
                                  mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
mlib_v_ImageChannelExtract_S16_31_A8D1X4(mlib_s16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
                                         mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
                                         mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
                                         mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
mlib_v_ImageChannelExtract_S16_31_A8D2X4(mlib_s16 *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
                                         mlib_s16 *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
                                         mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
                                         mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
mlib_v_ImageChannelExtract_S16_31_D1(mlib_s16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
                                     mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
                                     mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
                                     mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
mlib_v_ImageChannelExtract_S16_31(mlib_s16 *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
                                  mlib_s16 *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
                                  mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
                                  mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
mlib_v_ImageChannelExtract_S16_41_A8D1X4(mlib_s16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
                                         mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
                                         mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
                                         mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
mlib_v_ImageChannelExtract_S16_41_A8D2X4(mlib_s16 *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
                                         mlib_s16 *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
                                         mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
                                         mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
mlib_v_ImageChannelExtract_S16_41_D1(mlib_s16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
                                     mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
                                     mlib_s32 dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
                                     mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
mlib_v_ImageChannelExtract_S16_41(mlib_s16 *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
                                  mlib_s16 *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
                                  mlib_s32 xsize, mlib_s32 ysize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
                                  mlib_s32 cmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
/* functions defined in mlib_ImageChannelExtract_43.c */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
mlib_v_ImageChannelExtract_U8_43R_A8D1X8(mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
                                         mlib_u8  *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
                                         mlib_s32 dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
mlib_v_ImageChannelExtract_U8_43R_A8D2X8(mlib_u8  *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
                                         mlib_u8  *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
                                         mlib_s32 xsize, mlib_s32 ysize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
mlib_v_ImageChannelExtract_U8_43R_D1(mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
                                     mlib_u8  *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
                                     mlib_s32 dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
mlib_v_ImageChannelExtract_U8_43R(mlib_u8  *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
                                  mlib_u8  *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
                                  mlib_s32 xsize, mlib_s32 ysize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
mlib_v_ImageChannelExtract_S16_43R_A8D1X4(mlib_s16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
                                          mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
                                          mlib_s32 dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
mlib_v_ImageChannelExtract_S16_43R_A8D2X4(mlib_s16 *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
                                          mlib_s16 *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
                                          mlib_s32 xsize, mlib_s32 ysize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
mlib_v_ImageChannelExtract_S16_43R_D1(mlib_s16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
                                      mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
                                      mlib_s32 dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
mlib_v_ImageChannelExtract_S16_43R(mlib_s16 *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
                                   mlib_s16 *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
                                   mlib_s32 xsize, mlib_s32 ysize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
mlib_v_ImageChannelExtract_U8_43L_A8D1X8(mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
                                         mlib_u8  *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
                                         mlib_s32 dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
mlib_v_ImageChannelExtract_U8_43L_A8D2X8(mlib_u8  *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
                                         mlib_u8  *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
                                         mlib_s32 xsize, mlib_s32 ysize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
mlib_v_ImageChannelExtract_U8_43L_D1(mlib_u8  *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
                                     mlib_u8  *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
                                     mlib_s32 dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
mlib_v_ImageChannelExtract_U8_43L(mlib_u8  *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
                                  mlib_u8  *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
                                  mlib_s32 xsize, mlib_s32 ysize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
mlib_v_ImageChannelExtract_S16_43L_A8D1X4(mlib_s16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
                                          mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
                                          mlib_s32 dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
mlib_v_ImageChannelExtract_S16_43L_A8D2X4(mlib_s16 *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
                                          mlib_s16 *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
                                          mlib_s32 xsize, mlib_s32 ysize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
mlib_v_ImageChannelExtract_S16_43L_D1(mlib_s16 *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
                                      mlib_s16 *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
                                      mlib_s32 dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
void
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
mlib_v_ImageChannelExtract_S16_43L(mlib_s16 *src,  mlib_s32 slb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
                                   mlib_s16 *dst,  mlib_s32 dlb,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
                                   mlib_s32 xsize, mlib_s32 ysize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
/***************************************************************/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
#ifdef MLIB_TEST
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
mlib_status
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
mlib_v_ImageChannelExtract(mlib_image *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
                           mlib_image *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
                           mlib_s32   cmask)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
mlib_status
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
mlib_ImageChannelExtract(mlib_image *dst,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
                         mlib_image *src,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
                         mlib_s32   cmask)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
  const mlib_s32  X8 = 0x7;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
  const mlib_s32  X4 = 0x3;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
  const mlib_s32  X2 = 0x1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
  const mlib_s32  A8D1   = MLIB_IMAGE_ALIGNED8 | MLIB_IMAGE_ONEDVECTOR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
  const mlib_s32  A8D2X8 = MLIB_IMAGE_ALIGNED8 | MLIB_IMAGE_STRIDE8X | MLIB_IMAGE_WIDTH8X;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
  const mlib_s32  A8D2X4 = MLIB_IMAGE_ALIGNED8 | MLIB_IMAGE_STRIDE8X | MLIB_IMAGE_WIDTH4X;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
  const mlib_s32  A8D2X2 = MLIB_IMAGE_ALIGNED8 | MLIB_IMAGE_STRIDE8X | MLIB_IMAGE_WIDTH2X;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
  void      *sp;            /* pointer for pixel in src */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
  void      *dp;            /* pointer for pixel in dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
  mlib_s32  ncmask = 0;     /* normalized channel mask */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
  mlib_s32  channels;       /* number of channels for src */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
  mlib_s32  channeld;       /* number of channels for dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
  mlib_s32  width, height;  /* for src and dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
  mlib_s32  strides;        /* strides in bytes for src */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
  mlib_s32  strided;        /* strides in bytes for dst */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
  mlib_s32  flags;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
  mlib_s32  flagd;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
  mlib_s32  dsize;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
  int       delta0 = 0;     /* offset of first selected channel */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
  int       count1 = 0;     /* number of channels in first group */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
  int       i, bit1count = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
  MLIB_IMAGE_CHECK(src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
  MLIB_IMAGE_CHECK(dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
  MLIB_IMAGE_TYPE_EQUAL(src, dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
  MLIB_IMAGE_SIZE_EQUAL(src, dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
  channels = mlib_ImageGetChannels(src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
  channeld = mlib_ImageGetChannels(dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
  width    = mlib_ImageGetWidth(src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
  height   = mlib_ImageGetHeight(src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
  strides  = mlib_ImageGetStride(src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
  strided  = mlib_ImageGetStride(dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
  sp       = mlib_ImageGetData(src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
  dp       = mlib_ImageGetData(dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
  flags    = mlib_ImageGetFlags(src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
  flagd    = mlib_ImageGetFlags(dst);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
  dsize    = width * height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
  /* normalize the cmask, and count the number of bit with value 1 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
  for (i = (channels - 1); i >= 0; i--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    if (((cmask & (1 << i)) != 0) && (bit1count < channeld)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
      ncmask += (1 << i);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
      bit1count++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
  /* do not support the cases in which the number of selected channels is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
   * less than the nubmber of channels in the destination image */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
  if (bit1count < channeld) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    return MLIB_FAILURE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
  if (channels == channeld) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
#ifdef MLIB_TEST
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    mlib_v_ImageCopy(dst, src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    mlib_ImageCopy(dst, src);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
  switch (mlib_ImageGetType(src)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    case MLIB_BYTE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
      if (channeld == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
        switch (channels) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
          case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
            if (((flags & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
                ((flagd & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
                ((dsize & X8)   == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
              mlib_v_ImageChannelExtract_U8_21_A8D1X8((mlib_u8 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
                                                      (mlib_u8 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
                                                      dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
                                                      ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
            else if (((flags & A8D2X8) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                     ((flagd & A8D2X8) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
              mlib_v_ImageChannelExtract_U8_21_A8D2X8((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
                                                      (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                                                      width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
                                                      ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
            else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
                     ((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
              mlib_v_ImageChannelExtract_U8_21_D1((mlib_u8 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
                                                  (mlib_u8 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                                                  dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
                                                  ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
              mlib_v_ImageChannelExtract_U8_21((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
                                               (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
                                               width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
                                               ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
          case 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
            if (((flags & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
                ((flagd & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
                ((dsize & X8)   == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
              mlib_v_ImageChannelExtract_U8_31_A8D1X8((mlib_u8 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
                                                      (mlib_u8 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
                                                      dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
                                                      ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
            else if (((flags & A8D2X8) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
                     ((flagd & A8D2X8) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
              mlib_v_ImageChannelExtract_U8_31_A8D2X8((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
                                                      (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
                                                      width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
                                                      ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
            else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
                     ((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
              mlib_v_ImageChannelExtract_U8_31_D1((mlib_u8 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
                                                  (mlib_u8 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
                                                  dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
                                                  ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
              mlib_v_ImageChannelExtract_U8_31((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
                                               (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
                                               width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
                                               ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
          case 4:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
            if (((flags & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
                ((flagd & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
                ((dsize & X8)   == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
              mlib_v_ImageChannelExtract_U8_41_A8D1X8((mlib_u8 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
                                                      (mlib_u8 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
                                                      dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
                                                      ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
            else if (((flags & A8D2X8) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
                     ((flagd & A8D2X8) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
              mlib_v_ImageChannelExtract_U8_41_A8D2X8((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
                                                      (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
                                                      width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
                                                      ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
            else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
                     ((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
              mlib_v_ImageChannelExtract_U8_41_D1((mlib_u8 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
                                                  (mlib_u8 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
                                                  dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
                                                  ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
              mlib_v_ImageChannelExtract_U8_41((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
                                               (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
                                               width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
                                               ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
            return MLIB_FAILURE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
      else if ((channels == 4) && (channeld == 3) && (ncmask == 7)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
        if (((flags & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
            ((flagd & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
            ((dsize & X8)   == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
          mlib_v_ImageChannelExtract_U8_43R_A8D1X8((mlib_u8 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
                                                   (mlib_u8 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
                                                   dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
        else if (((flags & A8D2X8) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
                 ((flagd & A8D2X8) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
          mlib_v_ImageChannelExtract_U8_43R_A8D2X8((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
                                                   (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
                                                   width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
        else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
                 ((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
          mlib_v_ImageChannelExtract_U8_43R_D1((mlib_u8 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
                                               (mlib_u8 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
                                               dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
          mlib_v_ImageChannelExtract_U8_43R((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
                                            (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
                                            width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
      else if ((channels == 4) && (channeld == 3) && (ncmask == 14)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
        if (((flags & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
            ((flagd & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
            ((dsize & X8)   == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
          mlib_v_ImageChannelExtract_U8_43L_A8D1X8((mlib_u8 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
                                                   (mlib_u8 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
                                                   dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
        else if (((flags & A8D2X8) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
                 ((flagd & A8D2X8) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
          mlib_v_ImageChannelExtract_U8_43L_A8D2X8((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
                                                   (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
                                                   width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
        else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
                 ((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
          mlib_v_ImageChannelExtract_U8_43L_D1((mlib_u8 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
                                               (mlib_u8 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
                                               dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
          mlib_v_ImageChannelExtract_U8_43L((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
                                            (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
                                            width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
        return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
      break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
    case MLIB_SHORT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
      if (channeld == 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
        switch (channels) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
          case 2:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
            if (((flags & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
                ((flagd & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
                ((dsize & X4)   == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
              mlib_v_ImageChannelExtract_S16_21_A8D1X4((mlib_s16 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
                                                       (mlib_s16 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
                                                       dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
                                                       ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
            else if (((flags & A8D2X4) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
                     ((flagd & A8D2X4) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
              mlib_v_ImageChannelExtract_S16_21_A8D2X4((mlib_s16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
                                                       (mlib_s16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
                                                       width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
                                                       ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
            else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
                     ((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
              mlib_v_ImageChannelExtract_S16_21_D1((mlib_s16 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
                                                   (mlib_s16 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
                                                   dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
                                                   ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
              mlib_v_ImageChannelExtract_S16_21((mlib_s16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
                                                (mlib_s16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
                                                width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
                                                ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
          case 3:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
            if (((flags & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
                ((flagd & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
                ((dsize & X4)   == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
              mlib_v_ImageChannelExtract_S16_31_A8D1X4((mlib_s16 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
                                                       (mlib_s16 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
                                                       dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
                                                       ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
            else if (((flags & A8D2X4) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
                     ((flagd & A8D2X4) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
              mlib_v_ImageChannelExtract_S16_31_A8D2X4((mlib_s16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
                                                       (mlib_s16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
                                                       width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
                                                       ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
            else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
                     ((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
              mlib_v_ImageChannelExtract_S16_31_D1((mlib_s16 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
                                                   (mlib_s16 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
                                                   dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
                                                   ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
              mlib_v_ImageChannelExtract_S16_31((mlib_s16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
                                                (mlib_s16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
                                                width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
                                                ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
          case 4:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
            if (((flags & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
                ((flagd & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
                ((dsize & X4)   == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
              mlib_v_ImageChannelExtract_S16_41_A8D1X4((mlib_s16 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
                                                       (mlib_s16 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
                                                       dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
                                                       ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
            else if (((flags & A8D2X4) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
                     ((flagd & A8D2X4) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
              mlib_v_ImageChannelExtract_S16_41_A8D2X4((mlib_s16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
                                                       (mlib_s16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
                                                       width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
                                                       ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
            else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
                     ((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
              mlib_v_ImageChannelExtract_S16_41_D1((mlib_s16 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
                                                   (mlib_s16 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
                                                   dsize,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
                                                   ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
            else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
              mlib_v_ImageChannelExtract_S16_41((mlib_s16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
                                                (mlib_s16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
                                                width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
                                                ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
            return MLIB_FAILURE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
      else if ((channels == 4) && (channeld == 3) && (ncmask == 7)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
        if (((flags & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
            ((flagd & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
            ((dsize & X4)   == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
          mlib_v_ImageChannelExtract_S16_43R_A8D1X4((mlib_s16 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
                                                    (mlib_s16 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
                                                    dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
        else if (((flags & A8D2X4) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
                 ((flagd & A8D2X4) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
          mlib_v_ImageChannelExtract_S16_43R_A8D2X4((mlib_s16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
                                                    (mlib_s16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
                                                    width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
        else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
                 ((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
          mlib_v_ImageChannelExtract_S16_43R_D1((mlib_s16 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
                                                (mlib_s16 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
                                                dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
        else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
          mlib_v_ImageChannelExtract_S16_43R((mlib_s16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
                                             (mlib_s16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
                                             width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
        return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
      else if ((channels == 4) && (channeld == 3) && (ncmask == 14)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
        if (((flags & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
            ((flagd & A8D1) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
            ((dsize & X4)   == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
          mlib_v_ImageChannelExtract_S16_43L_A8D1X4((mlib_s16 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
                                                    (mlib_s16 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
                                                    dsize);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
        else if (((flags & A8D2X4) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
                 ((flagd & A8D2X4) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
          mlib_v_ImageChannelExtract_S16_43L_A8D2X4((mlib_s16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
                                                    (mlib_s16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
                                                    width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
        else if (((flags & MLIB_IMAGE_ONEDVECTOR) == 0) &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
                 ((flagd & MLIB_IMAGE_ONEDVECTOR) == 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
          mlib_v_ImageChannelExtract_S16_43L_D1((mlib_s16 *)sp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
                                                (mlib_s16 *)dp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
                                                dsize);
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
          mlib_v_ImageChannelExtract_S16_43L((mlib_s16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
                                             (mlib_s16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
                                             width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
        return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
      break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
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
  /* From C version */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
  for (i = (channels - 1); i >= 0; i--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
    if (!(ncmask & (1 << i))) delta0++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
    else break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
  for (; i >= 0; i--) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
    if (ncmask & (1 << i)) count1++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
    else break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
  switch (mlib_ImageGetType(src)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
    case MLIB_BYTE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
      {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
        mlib_u8 *sl = (mlib_u8 *)sp + delta0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
        mlib_u8 *dl = (mlib_u8 *)dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
        switch (channels*10 + channeld) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
          case 32:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
            mlib_v_ImageChannelExtract_U8_3_2(sl, strides, dl, strided, width, height, count1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
          case 42:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
            if (ncmask == 0xA || ncmask == 0x5) { /* mask 1010 or 0101 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
              mlib_v_ImageChannelExtract_U8_2_1(sl, strides, dl, strided, 2*width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
              return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
            mlib_v_ImageChannelExtract_U8_4_2(sl, strides, dl, strided, width, height, count1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
          case 43:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
            mlib_v_ImageChannelExtract_U8((mlib_u8 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
                                          (mlib_u8 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
                                          channels, channeld,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
                                          width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
                                          ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
          default: return MLIB_FAILURE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
    case MLIB_SHORT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
      mlib_v_ImageChannelExtract_S16((mlib_u16 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
                                     (mlib_u16 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
                                     channels,  channeld,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
                                     width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
                                     ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
      break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
    case MLIB_INT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
    case MLIB_FLOAT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
      {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
        mlib_f32 *sl = (mlib_f32 *)sp + delta0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
        mlib_f32 *dl = (mlib_f32 *)dp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
        strides /= 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
        strided /= 4;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
        switch (channels*10 + channeld) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
          case 21:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
            mlib_v_ImageChannelExtract_32_2_1(sl, strides, dl, strided, width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
          case 31:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
            mlib_v_ImageChannelExtract_32_3_1(sl, strides, dl, strided, width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
          case 32:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
            mlib_v_ImageChannelExtract_32_3_2(sl, strides, dl, strided, width, height, count1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
          case 41:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
            mlib_v_ImageChannelExtract_32_4_1(sl, strides, dl, strided, width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
          case 42:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
            if (ncmask == 0xA || ncmask == 0x5) { /* mask 1010 or 0101 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
              mlib_v_ImageChannelExtract_32_2_1(sl, strides, dl, strided, 2*width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
              mlib_v_ImageChannelExtract_32_4_2(sl, strides, dl, strided, width, height, count1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
          case 43:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
            mlib_v_ImageChannelExtract_32_4_3(sl, strides, dl, strided, width, height, count1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
            return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
          default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
            return MLIB_FAILURE;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
      }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
    case MLIB_DOUBLE:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
      mlib_v_ImageChannelExtract_D64((mlib_d64 *)sp, strides,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
                                     (mlib_d64 *)dp, strided,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
                                     channels,  channeld,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
                                     width, height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
                                     ncmask);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
      break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
    case MLIB_BIT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
    default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
      return MLIB_FAILURE;  /* MLIB_BIT is not supported here */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
  }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
  return MLIB_SUCCESS;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
/***************************************************************/