Intel® Integrated Performance Primitives
Deliberate problems developing high-performance vision, signal, security, and storage applications.

Getting started with IPP

Wenjun_H_
Beginner
854 Views

Hi,

I have not used IPP before and was tasked to do benchmarking of 2D correlation/convolution function with IPP. I have some questions which will aid in my development works.

1. How do I get a copy of the IPP? I need to use IPP on both Ubuntu and Windows machine, does it mean I need to get 2 license of IPP? How much does it cost?

2. Installation guide. Is there a easy-to-follow installation guide to install IPP on Windows and Ubuntu

3. What IPP functions is available for doing 2D correlation/convolution?

4. I intend to divide a image into overlapping image blocks and apply 2D correlation on each image blocks to achieve some performance boost. Is there similar works done previously?

Thanks.

 

 

0 Kudos
5 Replies
Pavel_B_Intel1
Employee
854 Views

Hi Wenjun,

Here you can download trial version of Intel Composer XE which contain IPP libraries inside: https://software.intel.com/en-us/intel-parallel-studio-xe/try-buy also on the page you can find information about cost.

Regarding installation guide - install is very simple, I guess you don't meet any problems with install.

Documentation for image processing (2D) functions is here: https://software.intel.com/en-us/node/503692#702422F6-C4B4-464F-A2CF-4E3ADCAD2C49 

Regarding p.4 your question I will ask Intel guys to help you.

Pavel

0 Kudos
Igor_A_Intel
Employee
854 Views

2D conv/crosscorr APIs are defined in ippi.h (and documented in the IPP manual):

/* ////////////////////////////////////////////////////////////////////////////
//   Names: ippiConv_32f_C1R, ippiConv_32f_C3R, ippiConv_32f_C4R
//          ippiConv_16s_C1R, ippiConv_16s_C3R, ippiConv_16s_C4R
//          ippiConv_8u_C1R,  ippiConv_8u_C3R,  ippiConv_8u_C4R
//  Purpose: Performs full or valid 2-D convolution of two images.
//           The result image size depends on operation shape selected in algType mask as follows:
//             (Wa+Wb-1)*(Ha+Hb-1) for ippiROIFull mask
//             (Wa-Wb+1)*(Ha-Hb+1) for ippiROIValid mask,
//           where Wa*Ha and Wb*Hb are the sizes of the image and template, respectively.
//          If the IppAlgMask value in algType is equal to ippAlgAuto, the optimal algorithm is selected
//          automatically. For big data size, the function uses 2D FFT algorithm.
//  Parameters:
//    pSrc1, pSrc2       - Pointers to the source images ROI.
//    src1Step, src2Step - Distances, in bytes, between the starting points of consecutive lines in the source images.
//    src1Size, src2Size - Size, in pixels, of the source images.
//    pDst               - Pointer to the destination image ROI.
//    dstStep            - Distance, in bytes, between the starting points of consecutive lines in the destination image.
//    divisor            - The integer value by which the computed result is divided (for operations on integer data only).
//    algType            - Bit-field mask for the algorithm type definition. Possible values are the results of composition of the IppAlgType and IppiROIShape values.
//                          Usage example: algType=(ippiROIFull|ippAlgFFT); - full-shaped convolution will be calculated using 2D FFT.
//    pBuffer            - Pointer to the buffer for internal calculations.
//  Returns:
//    ippStsNoErr      - OK.
//    ippStsNullPtrErr - Error when any of the specified pointers is NULL.
//    ippStsStepErr    - Error when src1Step, src2Step, or dstStep has a zero or negative value.
//    ippStsSizeErr    - Error when src1Size or src2Size has a zero or negative value.
//    ippStsDivisorErr - Error when divisor has the zero value.
//    ippStsAlgTypeErr - Error when :
//                         The result of the bitwise AND operation between algType and ippAlgMask differs from the ippAlgAuto, ippAlgDirect, or ippAlgFFT values.
//                         The result of the bitwise AND operation between algType and ippiROIMask differs from the ippiROIFull or ippiROIValid values.
*/
 

/* ////////////////////////////////////////////////////////////////////////////
//  Names: ippiCrossCorrNorm_32f_C1R
//         ippiCrossCorrNorm_16u32f_C1R
//         ippiCrossCorrNorm_8u32f_C1R
//         ippiCrossCorrNorm_8u_C1RSfs
//  Purpose: Computes normalized cross-correlation between an image and a template.
//           The result image size depends on operation shape selected in algType mask as follows :
//             (Wa+Wb-1)*(Ha+Hb-1) for ippiROIFull mask,
//             (Wa)*(Ha)           for ippiROISame mask,
//             (Wa-Wb+1)*(Ha-Hb+1) for ippiROIValid mask,
//           where Wa*Ha and Wb*Hb are the sizes of the image and template correspondingly.
//           Support of normalization operations (set in the algType mask) is set by selecting the following masks:
//             ippiNormNone   - the cross-correlation without normalization.
//             ippiNorm - the normalized cross-correlation.
//             ippiNormCoefficient  - the normalized correlation coefficients.
//           If the IppAlgMask value in algType is equal to ippAlgAuto, the optimal algorithm is selected automatically.
//           For big data size, the function uses 2D FFT algorithm.
//  Parameters:
//    pSrc        - Pointer to the source image ROI.
//    srcStep     - Distance, in bytes, between the starting points of consecutive lines in the source image.
//    srcRoiSize  - Size of the source ROI in pixels.
//    pTpl        - Pointer to the template image.
//    tplStep     - Distance, in bytes, between the starting points of consecutive lines in the template image.
//    tplRoiSize  - Size of the template ROI in pixels.
//    pDst        - Pointer to the destination image ROI.
//    dstStep     - Distance, in bytes, between the starting points of consecutive lines in the destination image.
//    scaleFactor - Scale factor.
//    algType     - Bit-field mask for the algorithm type definition. Possible values are the results of composition of the IppAlgType, IppiROIShape, and IppiNormOp values.
//                  Usage example: algType=(ippiROIFull|ippAlgFFT|ippiNormNone); - full-shaped cross-correlation will be calculated using 2D FFT without result normalization.
//    pBuffer     - Pointer to the work buffer.
//  Returns:
//    ippStsNoErr      OK.
//    ippStsNullPtrErr Error when any of the specified pointers is NULL.
//    ippStsStepErr    Error when the value of srcStep, tplStep, or dstStep is negative, or equal to zero.
//    ippStsSizeErr    Error when :
//                         srcRoiSize or tplRoiSize is negative, or equal to zero.
//                         The value of srcRoiSize is less than the corresponding value of tplRoiSize.
//    ippStsAlgTypeErr Error when :
//                         The result of the bitwise AND operation between the algType and ippAlgMask differs from the ippAlgAuto, ippAlgDirect, or ippAlgFFT values.
//                         The result of the bitwise AND operation between the algType and ippiROIMask differs from the ippiROIFull, ippiROISame, or ippiROIValid values.
//                         The result of the bitwise AND operation between the algType and ippiNormMask differs from the ippiNormNone, ippiNorm, or ippiNormCoefficient values.
*/
 

both functions already use internally overlapping image blocks algorithm - therefore no sense to apply the same externally

regards, Igor

0 Kudos
Wenjun_H_
Beginner
854 Views

Pavel Berdnikov:

Is it possible to buy just the IPP, in which case it will be more affordable?

Igor Astakhov:

The IPP manual did not mention how the 2D convolution/ NCC is implemented. How does the function decides what size is each image block?

To be clear about my meaning of overlapping image blocks:

I want to find the correlation between a full image [eg. 720 x 480] and a template image [eg. 40 x 40]. I intend to divide the full image into overlapping image block of size [eg. 120 x 120] with overlap border of 40 pixels. Hence I would have 9 x 6 image blocks. For each block, I would do 2D convolution/ NCC. I would then merge the results to get the correlation of the full image and template image.

0 Kudos
Chao_Y_Intel
Moderator
854 Views

Hello, 

For Intel IPP purchase, it is available by the following components: 
  Intel® Parallel Studio XE Suites/ Intel® System Studio Suite

The Composer Edition for these products including the Intel IPP, they are started from $699. 
Intel® Parallel Studio Composer Edition: https://software.intel.com/en-us/intel-parallel-studio-xe/try-buy
Intel® System Studio Composer Edition for Windows*: https://software.intel.com/en-us/intel-parallel-studio-xe/try-buy

Thanks,
Chao

0 Kudos
Igor_A_Intel
Employee
854 Views

Hi Wenjun,

for example MSDN doesn't provide any info on functions' internals - why do you expect such description from the IPP manual? For your particular case - 40x40 template - block size will be 64x64 or 128x128 (depends on the architecture) - the nearest power of two (or +1) - and function will use 2D FFT internally.

regards, Igor

0 Kudos
Reply