28.03.2017 Views

Primitives

ippi_0

ippi_0

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Both the source and destination images can have a ROI. In such cases the sizes of ROIs are assumed to be<br />

the same while offsets may differ. Image processing is performed on data of the source ROI, and the results<br />

are written to the destination ROI. In function call sequences, ROI is specified by:<br />

• roiSize parameter of the IppiSize type<br />

• pSrc and pDst pointers to the starts of source and destination ROI buffers<br />

• srcStep and dstStep parameters that are equal to distances in bytes between the starting points of<br />

consecutive lines in source and destination images, respectively.<br />

Thus, the srcStep and dstStep parameters set steps in bytes through image buffers to start processing a new<br />

line in the ROI of an image.<br />

The following code example illustrates the use of the dstStep parameter in function calls:<br />

Example<br />

IppStatus roi( void ) {<br />

Ipp8u x[8*3] = {0};<br />

IppiSize roiSize = {3,2};<br />

IppiPoint roiPoint = {2,1};<br />

/// place the pointer to the ROI start position<br />

return ippiSet_8u_C1R( 7, x+8*roiPoint.y+roiPoint.x, 8, roiSize );<br />

}<br />

The resulting image x contains the following data:<br />

00 00 00 00 00 00 00 00<br />

00 00 07 07 07 00 00 00<br />

00 00 07 07 07 00 00 00<br />

If ROI is present:<br />

• source and destination images can have different sizes;<br />

• lines may have padding at the end for aligning the line sizes;<br />

• application must correctly define the pSrc, pDst, and roiSize parameters.<br />

The pSrc and pDst parameters are the shifted pointers to the image data. For example, in case of ROI<br />

operations on 3-bytes-per-pixel image data (8u_C3R), pSrc points to the start of the source ROI buffer and<br />

can be interpreted as follows:<br />

pSrc = pSrcImg + 3*(srcImgSize.width * srcRoiOffset.y + srcRoiOffset.x),<br />

where<br />

Intel ® Integrated Performance <strong>Primitives</strong> Concepts 2<br />

pSrcImg<br />

srcImgSize<br />

srcRoiOffset<br />

points to the start of the source image buffer<br />

is the image size in pixels (of the IppiSize type)<br />

determines an offset of ROI relative to the start of the image as shown in<br />

Figure Image, ROI, and Offsets.<br />

Another example for operations on four-channel image of 32-bit floating point data type 32f_AC4:<br />

pSrc = (Ipp32f*)((Ipp8u*)pSrcImg + srcImgStep * srcRoiOffset.y<br />

+ 4*SizeOf(Ipp32f)*srcRoiOffset.x.<br />

In this example the multiplier 4 is used because the AC4 pixel consists of 4 values - R, G, B, A. Pointer type<br />

conversion is required as in Intel IPP all image steps are always in bytes, and it is not recommended to use<br />

step/SizeOf(Ipp32f) as in a general case step value may be not a multiple of 4.<br />

41

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!