Developer Reference

  • 2020
  • 05/26/2020
  • Public Content
Contents

Alpha Composition

The Intel IPP provides functions that composite two image buffers using either the opacity (alpha) channel in the images or provided alpha values.
These functions operate on image buffers with 8-bit or 16-bit data in RGB or RGBA format. In all compositing operations a resultant pixel in destination buffer
pDst
is created by overlaying a pixel from the foreground image buffer
pSrc1
over a pixel from the background image buffer
pSrc2
. The supported types of images combining by using alpha values are listed in the table below.
Types of Image Composing Operations
Type
 
Output Pixel
Description in Imaging Terms
 
Color Components
Alpha value
OVER
α
A
*
A
+(1-
α
A
)*
α
B
*
B
α
A
+(1-
α
A
)*
α
B
A
occludes
B
IN
α
A
*
A
*
α
B
α
A
*
α
B
A
within
B
.
A
acts as a matte for
B
.
A
shows only where
B
is visible.
OUT
α
A
*
A
*(1-
α
B
)
α
A
*(1-
α
B
)
A
outside
B
. NOT-
B
acts as a matte for
A
.
A
shows only where
B
is not visible.
ATOP
α
A
*
A
*
α
B
+(1-
α
A
)*
α
B
*
B
α
A
*
α
B
+(1-
α
A
)*
α
B
Combination of (
A
IN
B
) and (
B
OUT
A
).
B
is both back-ground and matte for
A
.
XOR
α
A
*
A
*(1-
α
B
)+(1-
α
A
)*
α
B
*
B
α
A
*(1-
α
B
)+(1-
α
A
)*
α
B
Combination of (
A
OUT
B
) and (
B
OUT
A
).
A
and
B
mutually exclude each other.
PLUS
α
A
*
A
+
α
B
*
B
α
A
+
α
B
Blend without precedence
In the formulas above, the input image buffers are denoted as
A
and
B
for simplicity. The Greek letter
α
with subscripts denotes the normalized (scaled) alpha value in the range 0 to 1. It is related to the integer alpha value
alpha
as:
α
= alpha / max_val
where
max_val
is 255 for 8-bit or 65535 for 16-bit unsigned pixel data.
For the
ippiAlphaComp
function that operates on 4-channel RGBA buffers only,
α
A
and
α
B
are the normalized alpha values of the two input image buffers, respectively.
For the
ippiAlphaCompC
function,
α
A
and
α
B
are the normalized constant alpha values that are passed as parameters to the function.
Note that in formulas for computing the resultant color channel values,
A
and
B
stand for the pixel color components of the respective input image buffers.
To save a significant amount of computation for some of the alpha compositing operations, use functions
AlphaPremul
,
AlphaPremulC
for pre-multiplying color channel values by the alpha values. This reduces the number of multiplications required in the compositing operations, which is especially efficient for repeated compositing of an image.
The type of composition operation that is performed by the function
AlphaComp
and
AlphaCompC
is specified by the parameter
alphaType
, the table below lists its possible values.
Possible Values of alphaType Parameter
Operation types
Parameter Value
OVER
ippAlphaOver
ippAlphaOverPremul
IN
ippAlphaIn
ippAlphaInPremul
OUT
ippAlphaOut
ippAlphaOutPremul
ATOP
ippAlphaATop
ippAlphaATopPremul
XOR
ippAlphaXor
ippAlphaXorPremul
PLUS
ippAlphaPlus
ippAlphaPlusPremul

Product and Performance Information

1

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804