Developer Reference

  • 2020
  • 07/15/2020
  • Public Content
Contents

AlphaCompC

Combines two images using constant alpha values.

Syntax

Case 1: Not-in-place operation
IppStatus ippiAlphaCompC_<mod>
(
const Ipp<datatype>*
pSrc1
,
int
src1Step
,
Ipp<datatype>
alpha1
,
const Ipp<datatype>*
pSrc2
,
int
src2Step
,
Ipp<datatype>
alpha2
,
Ipp<datatype>*
pDst
,
int
dstStep
,
IppiSize
roiSize
,
IppiAlphaType
alphaType
);
Supported values for
mod
:
8u_C1R
8u_C3R
8u_C4R
8u_AC4R
16u_C1R
16u_C3R
16u_C4R
16u_AC4R
16s_C1R
32u_C1R
32s_C1R
32f_C1R
IppStatus ippiAlphaCompC_<mod>
(
const Ipp<datatype>* const
pSrc1
[4]
,
int
src1Step
,
Ipp<datatype>
alpha1
,
const Ipp<datatype>* const
pSrc2
[4]
,
int
src2Step
,
Ipp<datatype>
alpha2
,
Ipp<datatype>* const
pDst
[4]
,
int
dstStep
,
IppiSize
roiSize
,
IppiAlphaType
alphaType
);
Supported values for
mod
:
8u_AP4R
16u_AP4R
Case 2: In-place operation
IppStatus ippiAlphaCompC_<mod>
(
const Ipp<datatype>*
pSrc
,
int
srcStep
,
Ipp<datatype>
alpha1
,
Ipp<datatype>*
pSrcDst
,
int
srcDstStep
,
Ipp<datatype>
alpha2
,
IppiSize
roiSize
,
IppiAlphaType
alphaType
);
Supported values for
mod
:
8u_C1IR
16u_C1IR
16s_C1IR
32s_C1IR
32u_C1IR
32f_C1IR
8u_C3IR
16u_C3IR
8u_C4IR
16u_C4IR
8u_AC4IR
16u_AC4IR
IppStatus ippiAlphaCompC_<mod>
(
const Ipp<datatype>* const
pSrc
[4]
,
int
srcStep
,
Ipp<datatype>
alpha1
,
Ipp<datatype>* const
pSrcDst
[4]
,
int
srcDstStep
,
Ipp<datatype>
alpha2
,
IppiSize
roiSize
,
IppiAlphaType
alphaType
);
Supported values for
mod
:
8u_AP4IR
16u_AP4IR
Include Files
ippi.h
Domain Dependencies
Headers:
ippcore.h
,
ippvm.h
,
ipps.h
Libraries:
ippcore.lib
,
ippvm.lib
,
ipps.lib
Parameters
pSrc1
,
pSrc2
Pointers to the source image ROI for pixel-order data. An array of pointers to ROI in the separate source color planes in case of planar data.
src1Step
,
src2Step
Distances, in bytes, between the starting points of consecutive lines in the source images.
pSrcDst
Pointer to the source and destination buffer or an array of pointers to separate source and destination color planes for in-place operation.
pDst
Pointer to the destination image ROI for pixel-order data. An array of pointers to ROI in the separate destination color planes in case of planar data.
srcDstStep
Distance, in bytes, between the starting points of consecutive lines in the source and destination image for in-place operation.
dstStep
Distance, in bytes, between the starting points of consecutive lines in the destination image.
roiSize
Size of the source and destination ROI in pixels.
alpha1
,
alpha2
Constant alpha values to use for the compositing operation.
alphaType
The composition type to perform. See Table
“Possible Values of the Parameter alphaType”
for the type value and description.
Description
This function operates with ROI (see Regions of Interest in Intel IPP).
This function performs an image compositing operation on one-channel image buffers, three-channel RGB and four-channel RGBA image buffers and on planar images, using constant alpha values
alpha1
and
alpha2
. These values are passed to the function as parameters.
The compositing is done by overlaying pixels from the foreground image ROI
pSrc1
with pixels from the background image ROI
pSrc2
to produce pixels in the resultant image ROI
pDst
. The alpha values are normalized to the range [0..1].
The type of the compositing operation is indicated by the
alphaType
parameter. Use Table
“Possible Values of the Parameter alphaType”
to choose a valid
alphaType
value depending on the required composition type. For example, the resulting pixel color components for the OVER operation (see Table
“Types of Image Composing Operations”
) are computed as follows:
r
C
=
α
1
*
r
A
+(1 -
α
1
)*
α
2
*
r
B
g
C
=
α
1
*
g
A
+(1 -
α
1
)*
α
2
*
g
B
b
C
=
α
1
*
b
A
+(1 -
α
1
)*
α
2
*
b
B
where
α
1
,
α
2
are the normalised alpha values
alpha1
,
alpha2
.
This function can be used for unsigned pixel data only.
Return Values
ippStsNoErr
Indicates no error. Any other value indicates an error or a warning.
ippStsNullPtrErr
Indicates an error condition if one of the specified pointers is
NULL
.
ippStsSizeErr
Indicates an error condition if
roiSize
has a field with zero or negative value.

Example

The code example below shows how to use alpha composition function.
IppStatus acomp( void ) { Ipp8u imga[8*8], imgb[8*8], imgc[8*8]; IppiSize roi = { 8, 8 }; IppStatus st; ippiImageRamp_8u_C1R( imga, 8, roi, 0, 1, ippAxsHorizontal ); ippiImageRamp_8u_C1R( imgb, 8, roi, 0, 2, ippAxsHorizontal ); st = ippiAlphaCompC_8u_C1R( imga, 8, 255/3, imgb, 8, 255, imgc, 8, roi, ippAlphaOver ); printf( "over: a=%d,A=255/3; b=%d,B=255; c=%d // c=a*A+b*(1-A)*B\n",imga[6],imgb[6],imgc[6] ); return st; }
Output
over: a=6,A=255/3; b=12,B=255; c=10 // c=a*A+b*B*(1-A)

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