Intel® Integrated Performance Primitives Developer Guide and Reference

ID 790148
Date 11/07/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

HLSToRGB

Converts an HLS image to the RGB color model.

Syntax

IppStatus ippiHLSToRGB_<mod>(const Ipp<datatype>* pSrc, int srcStep, Ipp<datatype>* pDst, int dstStep, IppiSize roiSize);

Supported values for mod:

8u_C3R 16u_C3R 16s_C3R 32f_C3R
8u_AC4R 16u_AC4R 16s_AC4R 32f_AC4R

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 starts of consecutive lines in the source image.

pDst

Pointer to the destination image ROI.

dstStep

Distance in bytes between starts of consecutive lines in the destination image.

roiSize

Size of the source and destination ROI in pixels.

Description

This function operates with ROI (see Regions of Interest in Intel IPP).

This function converts the HLS image pSrc to the R'B'G' image pDst. For function flavors operating on the floating point data, source HLS values must be in the range [0..1]. The conversion algorithm from HLS to RGB can be represented in pseudocode as follows:

if L <= 0.5 then      M2 = L *(1 + S) else      M2 = L + S - L * S M1 = 2 * L - M2 if S = 0 then    R = G = B = L else      h = H + 120      if h > 360 then           h = h - 360      if h  <  60 then           R = ( M1 + ( M2 - M1 ) * h / 60)      else if h < 180 then           R = M2      else if h < 240 then           R = M1 + ( M2 - M1 ) * ( 240 - h ) / 60      else           R = M1      h = H      if h  <  60 then           G = ( M1 + ( M2 - M1 ) * h / 60      else if h < 180 then           G = M2      else if h < 240 then           G = M1 + ( M2 - M1 ) * ( 240 - h ) / 60      else           G  = M1      h = H - 120      if h < 0 then           h += 360      if h  <  60 then           B = ( M1 + ( M2 - M1 ) * h / 60      else if h < 180 then           B = M2      else if h < 240 then           B = M1 + ( M2 - M1 ) * ( 240 - h ) / 60      else           B = M1

For floating point function flavors, the computed R',G',B' values are scaled to the range [0..1]. In case of integer function flavors, these values are scaled to the full range of the destination data type (see Table “Image Data Types and Ranges”).

Return Values

ippStsNoErr

Indicates no error. Any other value indicates an error.

ippStsNullPtrErr

Indicates an error condition if pSrc or pDst is NULL.

ippStsSizeErr

Indicates an error condition if roiSize has a field with a zero or negative value.