Developer Reference

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

GrayToRGB

Coverts a gray scale image to RGB/BGR by copying luminance component to color components.

Syntax

IppStatus ippiGrayToRGB_<mod>(const Ipp<datatype>*
pSrc
, int
srcStep
, Ipp<datatype>*
pDst
, int
dstStep
, IppiSize
roiSize
);
Supported values for
mod
:
8u_C1C3R
16u_C1C3R
32f_C1C3R
IppStatus ippiGrayToRGB_<mod>(const Ipp<datatype>*
pSrc
, int
srcStep
, Ipp<datatype>*
pDst
, int
dstStep
, IppiSize
roiSize
, Ipp<datatype>
aval
);
Supported values for
mod
:
8u_C1C4R
16u_C1C4R
32f_C1C4R
Include Files
ippcc.h
Domain Dependencies
Headers:
ippcore.h
,
ippvm.h
,
ipps.h
,
ippi.h
Libraries:
ippcore.lib
,
ippvm.lib
,
ipps.lib
,
ippi.lib
Parameters
pSrc
Pointer to the source image ROI.
srcStep
Distance, in bytes, between the starting points of consecutive lines in the source image.
pDst
Pointer to the destination image ROI.
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.
aval
Constant value to create the fourth channel.
Description
This function operates with ROI (see Regions of Interest in Intel IPP ).
This function converts a gray scale image to an RGB/BGR image by copying luminance component to color components.
Return Values
ippStsNoErr
Indicates no error. Any other value indicates an error.
ippStsNullPtrErr
Indicates an error when
pSrc
or
pDst
is
NULL
.
ippStsSizeErr
Indicates an error condition if
roiSize
has a field with a zero or negative value.

Example

The code example below demonstrates how to use the
ippiGrayToRGB_8u_C1C4R
function.
const int WIDTH = 2; const int HEIGHT = 1; Ipp8u pSrc[WIDTH * HEIGHT] = { 113,113, }; Ipp8u pDst[WIDTH * HEIGHT * 4]; int srcStep = WIDTH, dstStep = WIDTH * 4; IppiSize roiSize = {WIDTH, HEIGHT}; IppStatus status = ippiGrayToRGB_8u_C1C4R(pSrc, srcStep, pDst, dstStep, roiSize, 0xFF); if ( status == ippStsNoErr) { printf("PASS:\n(%3d %3d %3d %3d), (%3d %3d %3d %3d)\n", pDst[0], pDst[1], pDst[2], pDst[3], pDst[4], pDst[5], pDst[6], pDst[7]); } else printf("FAIL: status = %d\n", status);
Result:
PASS: (113 113 113 255), (113 113 113 255)

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