Access to memory is faster if pointers to the data are aligned, and Intel IPP functions perform better if they process data with aligned pointers.
The following Intel IPP functions can be used for pointer alignment, memory allocation and deallocation:
void* ippAlignPtr(void* ptr, int alignBytes)
Aligns a pointer, can align to the powers of 2, that is 2, 4, 8, 16 and so on.
void* ippMalloc(int length)
32-byte aligned memory allocation. Memory can be freed only with the function ippFree.
void ippFree(void* ptr)
frees memory allocated by the function ippMalloc.
Ipp<datatype>* ippsMalloc_<datatype>(int len)
32-byte aligned memory allocation for signal elements of different data types. Memory can be freed only with the function ippsFree.
void ippsFree(void* ptr)
Frees memory allocated by the function ippsMalloc.
Ipp<datatype>* ippiMalloc_<mod>(int widthPixels, int heightPixels, int* pStepBytes) -
32-byte aligned memory allocation for images where every line of the image is padded with zeros. Memory can be freed only with the function ippiFree.
void ippiFree(void* ptr) -
Frees memory allocated by the function ippiMalloc.
The amount of memory that can be allocated is determined by the operating system and system hardware, but it cannot exceed 2GB.
Intel IPP functions ippFree, ippsFree, and ippiFree can only be used to free memory allocated by the functions ippMalloc, ippsMalloc, and ippiMalloc respectively.
Intel IPP functions ippFree, ippsFree, and ippiFree cannot be used to free memory allocated by standard functions like malloc or calloc. The memory allocated by the Intel IPP functions ippMalloc, ippsMalloc, and ippiMalloc cannot be freed by the standard function free.
The following code example shows how to call the function ippiMalloc.
#include "stdafx.h" #include "ipp.h" #include "tools.h" int main(int argc, char *argv[]) { IppiSize size = {320, 240}; int stride; Ipp8u* pSrc = ippiMalloc_8u_C3(size.width, size.height, &stride); ippiImageJaehne_8u_C3R(pSrc, stride, size); int dstStride; Ipp8u* pDst = ippiMalloc_8u_C3(size.width, size.height, &dstStride); ippiCopy_8u_C3R(pSrc, stride, pDst, dstStride, size); IppiSize ROISize = { size.width/2, size.height/2 }; ippiCopy_8u_C3R(pSrc, stride, pDst, dstStride, ROISize); IppiPoint srcOffset = { size.width/4, size.height/4 }; ippiCopy_8u_C3R(pSrc + srcOffset.x*3 + srcOffset.y*stride, stride, pDst, dstStride, ROISize); return 0; }
Optimization Notice |
---|
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 |
Copyright © 2008 - 2011, Intel Corporation. All rights reserved.