src/java.desktop/share/native/libawt/java2d/loops/AlphaMath.h
author ihse
Wed, 28 Mar 2018 23:56:08 +0200
changeset 49440 396ea30afbd5
parent 47216 71c04702a3d5
child 56721 01b558efd286
permissions -rw-r--r--
8200178: Remove mapfiles for JDK native libraries Reviewed-by: erikj, alanb, mchung, prr, weijun
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
49440
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
     2
 * Copyright (c) 2000, 2018, 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
#ifndef AlphaMath_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#define AlphaMath_h_Included
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
49440
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
    29
#include "jni.h"
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
    30
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
    31
JNIEXPORT extern unsigned char mul8table[256][256];
396ea30afbd5 8200178: Remove mapfiles for JDK native libraries
ihse
parents: 47216
diff changeset
    32
JNIEXPORT extern unsigned char div8table[256][256];
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
extern void initAlphaTables();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * Multiply and Divide macros for single byte (8-bit) quantities representing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * the values 0.0 to 1.0 as 0x00 to 0xff.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * MUL8 multiplies its operands together
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * DIV8 divides the first operand by the second, clipping to 0xff
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 *    (Note that since the divisor for DIV8 is likely to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 *     the alpha quantity which is likely to be the same for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 *     multiple adjacent invocations, the table is designed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *     with the first index being the divisor to hopefully
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 *     improve memory cache hits...)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
#define MUL8(a,b) mul8table[a][b]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
#define DIV8(a,b) div8table[b][a]
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * Multiply and Divide macros for operations involving a single short (16-bit)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * quantity and a single byte (8-bit) quantity.  Typically, promoting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * 8-bit value to 16 bits would lead to overflow when the operation occurs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * These macros have been modified somewhat so that overflow will not occur.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * MUL8_16 multiplies an 8-bit value by a 16-bit value (the order of operands
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 *         is unimportant since multiplication is a commutative operation)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * DIV16_8 divides the first (16-bit) operand by the second (8-bit) value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
#define MUL8_16(a,b) (((a) * (b)) / 255)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
#define DIV16_8(a,b) (((a) * 255) / (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * Multiply and Divide macros for single short (16-bit) quantities
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * representing the values 0.0 to 1.0 as 0x0000 to 0xffff.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * MUL16 multiplies its operands using the standard multiplication operator
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 *       and normalizes the result to the appropriate range
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * DIV16 divides the first operand by the second and normalizes the result
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 *       to a 16-bit value
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
#define MUL16(a,b) (((a) * (b)) / 65535)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
#define DIV16(a,b) (((a) * 65535) / (b))
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * Macro for the sum of two normalized (16-bit) products.  Refer to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * following equation and note that the right side reduces the number of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * divide operations in the left side and increases the precision of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * result:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 *   a*f1 + b*f2     a*f1 + b*f2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *   ----   ----  =  -----------     (where n in this case will be 65535)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 *     n      n           n
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
#define AddNormalizedProducts16(a, f1, b, f2) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    ((((a) * (f1)) + ((b) * (f2))) / 65535)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * The following macros help to generalize the MaskBlit and MaskFill loops
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * found in AlphaMacros.h.  The appropriate macros will be used based on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * strategy of the given loop.  The strategy types take the form:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 *   <number of components per pixel><component data type><colorspace>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * For example, these are the current strategy types:
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *   3ByteRgb    (currently only used as a glyph list blending strategy where
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *                the alpha value itself is neither blended nor stored)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 *   4ByteArgb   (eg. IntArgb, ThreeByteBgr, Ushort555Rgb, ByteIndexed, etc.)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 *   4ShortArgb  (not used currently; could be used when surface types using
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 *                16 bits per component are implemented)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 *   1ByteGray   (eg. ByteGray)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 *   1ShortGray  (eg. UshortGray)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * Note that the macros which operate on alpha values have the word "Alpha"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * somewhere in their name.  Those macros that only operate on the color/gray
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * components of a given strategy will have the word "Components" or "Comps"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * in their name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * MaxValFor ## STRATEGY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
#define MaxValFor4ByteArgb     0xff
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
#define MaxValFor1ByteGray     0xff
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
#define MaxValFor1ShortGray    0xffff
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * AlphaType ## STRATEGY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
#define AlphaType3ByteRgb      jint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
#define AlphaType4ByteArgb     jint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
#define AlphaType1ByteGray     jint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
#define AlphaType1ShortGray    juint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * ComponentType ## STRATEGY
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
#define ComponentType3ByteRgb      jint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
#define ComponentType4ByteArgb     jint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
#define ComponentType1ByteGray     jint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
#define ComponentType1ShortGray    juint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 * DeclareAlphaVarFor ## STRATEGY(VAR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 * jint a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
#define DeclareAlphaVarFor3ByteRgb(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    AlphaType3ByteRgb VAR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
#define DeclareAlphaVarFor4ByteArgb(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    AlphaType4ByteArgb VAR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
#define DeclareAlphaVarFor1ByteGray(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    AlphaType1ByteGray VAR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
#define DeclareAlphaVarFor1ShortGray(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    AlphaType1ShortGray VAR;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 * DeclareAndInitAlphaVarFor ## STRATEGY(VAR, initval)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 * jint a = initval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
#define DeclareAndInitAlphaVarFor4ByteArgb(VAR, initval) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    AlphaType4ByteArgb VAR = initval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
#define DeclareAndInitAlphaVarFor1ByteGray(VAR, initval) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    AlphaType1ByteGray VAR = initval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
#define DeclareAndInitAlphaVarFor1ShortGray(VAR, initval) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    AlphaType1ShortGray VAR = initval;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 * DeclareAndClearAlphaVarFor ## STRATEGY(VAR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 * jint a = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
#define DeclareAndClearAlphaVarFor4ByteArgb(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    DeclareAndInitAlphaVarFor4ByteArgb(VAR, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
#define DeclareAndClearAlphaVarFor1ByteGray(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    DeclareAndInitAlphaVarFor1ByteGray(VAR, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
#define DeclareAndClearAlphaVarFor1ShortGray(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    DeclareAndInitAlphaVarFor1ShortGray(VAR, 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * DeclareAndSetOpaqueAlphaVarFor ## STRATEGY(VAR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
 * jint a = 0xff;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
#define DeclareAndSetOpaqueAlphaVarFor4ByteArgb(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    DeclareAndInitAlphaVarFor4ByteArgb(VAR, MaxValFor4ByteArgb)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
#define DeclareAndSetOpaqueAlphaVarFor1ByteGray(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    DeclareAndInitAlphaVarFor1ByteGray(VAR, MaxValFor1ByteGray)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
#define DeclareAndSetOpaqueAlphaVarFor1ShortGray(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    DeclareAndInitAlphaVarFor1ShortGray(VAR, MaxValFor1ShortGray)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * DeclareAndInvertAlphaVarFor ## STRATEGY(VAR, invalpha)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 * jint a = 0xff - resA;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
#define DeclareAndInvertAlphaVarFor4ByteArgb(VAR, invalpha) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    DeclareAndInitAlphaVarFor4ByteArgb(VAR, MaxValFor4ByteArgb - invalpha)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
#define DeclareAndInvertAlphaVarFor1ByteGray(VAR, invalpha) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    DeclareAndInitAlphaVarFor1ByteGray(VAR, MaxValFor1ByteGray - invalpha)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
#define DeclareAndInvertAlphaVarFor1ShortGray(VAR, invalpha) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    DeclareAndInitAlphaVarFor1ShortGray(VAR, MaxValFor1ShortGray - invalpha)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 * DeclareCompVarsFor ## STRATEGY(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 * jint c;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
#define DeclareCompVarsFor3ByteRgb(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    ComponentType3ByteRgb PREFIX ## R, PREFIX ## G, PREFIX ## B;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
#define DeclareCompVarsFor4ByteArgb(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    ComponentType4ByteArgb PREFIX ## R, PREFIX ## G, PREFIX ## B;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
#define DeclareCompVarsFor1ByteGray(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    ComponentType1ByteGray PREFIX ## G;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
#define DeclareCompVarsFor1ShortGray(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    ComponentType1ShortGray PREFIX ## G;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 * DeclareAndInitExtraAlphaFor ## STRATEGY(VAR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
 * jint extraA = (int)(pCompInfo->details.extraAlpha * 255.0 + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
#define DeclareAndInitExtraAlphaFor4ByteArgb(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    AlphaType4ByteArgb VAR = \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
        (AlphaType4ByteArgb)(pCompInfo->details.extraAlpha * 255.0 + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
#define DeclareAndInitExtraAlphaFor1ByteGray(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    AlphaType1ByteGray VAR = \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
        (AlphaType1ByteGray)(pCompInfo->details.extraAlpha * 255.0 + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
#define DeclareAndInitExtraAlphaFor1ShortGray(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
    AlphaType1ShortGray VAR = \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
        (AlphaType1ShortGray)(pCompInfo->details.extraAlpha * 65535.0 + 0.5);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
 * PromoteByteAlphaFor ## STRATEGY(a)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
#define PromoteByteAlphaFor4ByteArgb(a)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
#define PromoteByteAlphaFor1ByteGray(a)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
#define PromoteByteAlphaFor1ShortGray(a) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    (a) = (((a) << 8) + (a))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
 * DeclareAndInitPathAlphaFor ## STRATEGY(VAR)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
 * jint pathA = *pMask++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
#define DeclareAndInitPathAlphaFor4ByteArgb(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    AlphaType4ByteArgb VAR = *pMask++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
#define DeclareAndInitPathAlphaFor1ByteGray(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    AlphaType1ByteGray VAR = *pMask++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
#define DeclareAndInitPathAlphaFor1ShortGray(VAR) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    AlphaType1ShortGray VAR = *pMask++;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
 * MultiplyAlphaFor ## STRATEGY(a, b)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
 * a * b
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
#define MultiplyAlphaFor4ByteArgb(a, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    MUL8(a, b)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
#define MultiplyAlphaFor1ByteGray(a, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    MUL8(a, b)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
#define MultiplyAlphaFor1ShortGray(a, b) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    MUL16(a, b)
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
 * MultiplyAndStore ## STRATEGY ## Comps(PROD_PREFIX, M1, M2_PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
 * c = m1 * m2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
#define MultiplyAndStore3Components(PROD_PREFIX, M1, M2_PREFIX, PRECISION) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
        PROD_PREFIX ## R = MUL ## PRECISION(M1, M2_PREFIX ## R); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
        PROD_PREFIX ## G = MUL ## PRECISION(M1, M2_PREFIX ## G); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
        PROD_PREFIX ## B = MUL ## PRECISION(M1, M2_PREFIX ## B); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
#define MultiplyAndStore1Component(PROD_PREFIX, M1, M2_PREFIX, PRECISION) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
    PROD_PREFIX ## G = MUL ## PRECISION(M1, M2_PREFIX ## G)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
#define MultiplyAndStore4ByteArgbComps(PROD_PREFIX, M1, M2_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    MultiplyAndStore3Components(PROD_PREFIX, M1, M2_PREFIX, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
#define MultiplyAndStore1ByteGrayComps(PROD_PREFIX, M1, M2_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    MultiplyAndStore1Component(PROD_PREFIX, M1, M2_PREFIX, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
#define MultiplyAndStore1ShortGrayComps(PROD_PREFIX, M1, M2_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
    MultiplyAndStore1Component(PROD_PREFIX, M1, M2_PREFIX, 16)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
 * DivideAndStore ## STRATEGY ## Comps(QUOT_PREFIX, D1_PREFIX, D2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
 * c = d1 / d2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
#define DivideAndStore3Components(QUOT_PREFIX, D1_PREFIX, D2, PRECISION) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
        QUOT_PREFIX ## R = DIV ## PRECISION(D1_PREFIX ## R, D2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
        QUOT_PREFIX ## G = DIV ## PRECISION(D1_PREFIX ## G, D2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
        QUOT_PREFIX ## B = DIV ## PRECISION(D1_PREFIX ## B, D2); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
#define DivideAndStore1Component(QUOT_PREFIX, D1_PREFIX, D2, PRECISION) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    QUOT_PREFIX ## G = DIV ## PRECISION(D1_PREFIX ## G, D2)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
#define DivideAndStore4ByteArgbComps(QUOT_PREFIX, D1_PREFIX, D2) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    DivideAndStore3Components(QUOT_PREFIX, D1_PREFIX, D2, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
#define DivideAndStore1ByteGrayComps(QUOT_PREFIX, D1_PREFIX, D2) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    DivideAndStore1Component(QUOT_PREFIX, D1_PREFIX, D2, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
#define DivideAndStore1ShortGrayComps(QUOT_PREFIX, D1_PREFIX, D2) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    DivideAndStore1Component(QUOT_PREFIX, D1_PREFIX, D2, 16)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
 * MultiplyAddAndStore ## STRATEGY ## Comps(RES_PREFIX, M1, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
 *                                          M2_PREFIX, A_PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
 * c = (m1 * m2) + a;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
#define MultiplyAddAndStore3Components(RES_PREFIX, M1, M2_PREFIX, A_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
                                       PRECISION) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
        RES_PREFIX ## R = MUL ## PRECISION(M1, M2_PREFIX ## R) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
                                                          A_PREFIX ## R; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
        RES_PREFIX ## G = MUL ## PRECISION(M1, M2_PREFIX ## G) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
                                                          A_PREFIX ## G; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
        RES_PREFIX ## B = MUL ## PRECISION(M1, M2_PREFIX ## B) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
                                                          A_PREFIX ## B; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
#define MultiplyAddAndStore1Component(RES_PREFIX, M1, M2_PREFIX, A_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
                                      PRECISION) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
    RES_PREFIX ## G = MUL ## PRECISION(M1, M2_PREFIX ## G) + A_PREFIX ## G
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
#define MultiplyAddAndStore4ByteArgbComps(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
                                          A_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    MultiplyAddAndStore3Components(RES_PREFIX, M1, M2_PREFIX, A_PREFIX, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
#define MultiplyAddAndStore1ByteGrayComps(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
                                          A_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
    MultiplyAddAndStore1Component(RES_PREFIX, M1, M2_PREFIX, A_PREFIX, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
#define MultiplyAddAndStore1ShortGrayComps(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
                                           A_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    MultiplyAddAndStore1Component(RES_PREFIX, M1, M2_PREFIX, A_PREFIX, 16)
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
 * MultMultAddAndStore ## STRATEGY ## Comps(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
 *                                          M3, M4_PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
 * c = (m1 * m2) + (m3 * m4);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
#define MultMultAddAndStore3Components(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
                                       M3, M4_PREFIX, PRECISION) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
        RES_PREFIX ## R = MUL ## PRECISION(M1, M2_PREFIX ## R) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
                          MUL ## PRECISION(M3, M4_PREFIX ## R); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
        RES_PREFIX ## G = MUL ## PRECISION(M1, M2_PREFIX ## G) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
                          MUL ## PRECISION(M3, M4_PREFIX ## G); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
        RES_PREFIX ## B = MUL ## PRECISION(M1, M2_PREFIX ## B) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                          MUL ## PRECISION(M3, M4_PREFIX ## B); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
#define MultMultAddAndStoreLCD3Components(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
                                       M3, M4_PREFIX, PRECISION) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
        RES_PREFIX ## R = MUL ## PRECISION(M1 ## R, M2_PREFIX ## R) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
                          MUL ## PRECISION(M3 ## R, M4_PREFIX ## R); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
        RES_PREFIX ## G = MUL ## PRECISION(M1 ## G, M2_PREFIX ## G) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
                          MUL ## PRECISION(M3 ## G, M4_PREFIX ## G); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
        RES_PREFIX ## B = MUL ## PRECISION(M1 ## B, M2_PREFIX ## B) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
                          MUL ## PRECISION(M3 ## B, M4_PREFIX ## B); \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
#define MultMultAddAndStore1Component(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
                                      M3, M4_PREFIX, PRECISION) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    RES_PREFIX ## G = MUL ## PRECISION(M1, M2_PREFIX ## G) + \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
                      MUL ## PRECISION(M3, M4_PREFIX ## G)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
#define MultMultAddAndStore3ByteRgbComps(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
                                         M3, M4_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    MultMultAddAndStore3Components(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
                                   M3, M4_PREFIX, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
#define MultMultAddAndStoreLCD3ByteRgbComps(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
                                         M3, M4_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
    MultMultAddAndStoreLCD3Components(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
                                   M3, M4_PREFIX, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
#define MultMultAddAndStore4ByteArgbComps(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
                                          M3, M4_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    MultMultAddAndStore3Components(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
                                   M3, M4_PREFIX, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
#define MultMultAddAndStoreLCD4ByteArgbComps(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
                                          M3, M4_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    MultMultAddAndStoreLCD3Components(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
                                      M3, M4_PREFIX, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
#define MultMultAddAndStore1ByteGrayComps(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
                                          M3, M4_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
    MultMultAddAndStore1Component(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
                                  M3, M4_PREFIX, 8)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
#define MultMultAddAndStore1ShortGrayComps(RES_PREFIX, M1, M2_PREFIX, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
                                           M3, M4_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
    RES_PREFIX ## G = AddNormalizedProducts16(M1, M2_PREFIX ## G, \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
                                              M3, M4_PREFIX ## G)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
 * Store ## STRATEGY ## CompsUsingOp(L_PREFIX, OP, R_PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
 * l op r;  // where op can be something like = or +=
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
#define Store3ComponentsUsingOp(L_PREFIX, OP, R_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
    do { \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
        L_PREFIX ## R OP R_PREFIX ## R; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
        L_PREFIX ## G OP R_PREFIX ## G; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
        L_PREFIX ## B OP R_PREFIX ## B; \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    } while (0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
#define Store1ComponentUsingOp(L_PREFIX, OP, R_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    L_PREFIX ## G OP R_PREFIX ## G
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
#define Store4ByteArgbCompsUsingOp(L_PREFIX, OP, R_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
    Store3ComponentsUsingOp(L_PREFIX, OP, R_PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
#define Store1ByteGrayCompsUsingOp(L_PREFIX, OP, R_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
    Store1ComponentUsingOp(L_PREFIX, OP, R_PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
#define Store1ShortGrayCompsUsingOp(L_PREFIX, OP, R_PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
    Store1ComponentUsingOp(L_PREFIX, OP, R_PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
 * Set ## STRATEGY ## CompsToZero(PREFIX)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
 * c = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
#define Set4ByteArgbCompsToZero(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
    PREFIX ## R = PREFIX ## G = PREFIX ## B = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
#define Set1ByteGrayCompsToZero(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
    PREFIX ## G = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
#define Set1ShortGrayCompsToZero(PREFIX) \
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
    PREFIX ## G = 0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
#endif /* AlphaMath_h_Included */