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