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

Malloc

Allocates memory aligned to 64-byte boundary.

Syntax

Case 1: Memory allocation for blocks of 32-bit sizes

Ipp<datatype>* ippiMalloc_<mod>(int widthPixels, int heightPixels, int* pStepBytes);

Supported values for mod:

8u_C1 16u_C1 16s_C1 32s_C1 32f_C1 32sc_C1 32fc_C1
8u_C2 16u_C2 16s_C2 32s_C2 32f_C2 32sc_C2 32fc_C2
8u_C3 16u_C3 16s_C3 32s_C3 32f_C3 32sc_C3 32fc_C3
8u_C4 16u_C4 16s_C4 32s_C4 32f_C4 32sc_C4 32fc_C4
8u_AC4 16u_AC4 16s_AC4 32s_AC4 32f_AC4 32sc_AC4 32fc_AC4

Case 2: Memory allocation for platform-aware functions

Ipp<datatype>* ippiMalloc_<mod>(IppSizeL widthPixels, IppSizeL heightPixels, IppSizeL* pStepBytes);

Supported values for mod:

8u_C1_L 16u_C1_L 16s_C1_L 32s_C1_L 32f_C1_L 32sc_C1_L 32fc_C1_L
8u_C2_L 16u_C2_L 16s_C2_L 32s_C2_L 32f_C2_L 32sc_C2_L 32fc_C2_L
8u_C3_L 16u_C3_L 16s_C3_L 32s_C3_L 32f_C3_L 32sc_C3_L 32fc_C3_L
8u_C4_L 16u_C4_L 16s_C4_L 32s_C4_L 32f_C4_L 32sc_C4_L 32fc_C4_L
8u_AC4_L 16u_AC4_L 16s_AC4_L 32s_AC4_L 32f_AC4_L 32sc_AC4_L 32fc_AC4_L

Include Files

ippi.h

Flavors with the _L suffixippi_l.h

Domain Dependencies

Headers: ippcore.h, ippvm.h, ipps.h

Libraries: ippcore.lib, ippvm.lib, ipps.lib

Parameters

widthPixels

Width of an image, in pixels.

heightPixels

Height of an image, in pixels.

pStepBytes

Pointer to the distance, in bytes, between the starting points of consecutive lines in the image

Description

This function allocates a memory block aligned to 64-byte boundary for elements of different data types. Every line of the image is aligned in accordance with the pStepBytes parameter, which is calculated by the Malloc function and returned for further use.

The function Malloc allocates one continuous memory block. Functions that operate on planar images require an array of separate pointers (IppType* plane[3]) to each plane as an input. In this case, you should call the Malloc function three times.

The function allocates a maximum of 2,147,483,647 bytes. If larger blocks are needed user should use instead ippsMalloc_<mod>_L().

Example

The code example below demonstrates how to construct an array and set correct values to the pointers to use the allocated memory block with the Intel IPP functions operating on planar images. You need to specify pStepBytes for each plane. The example is given for the 8u data type.

int stepBytes[3]; 
Ipp8u* plane[3];
   plane[0] = ippiMalloc_8u_C1(widthPixels, heightPixels,
                               &(stepBytes [0]));
   plane[1] = ippiMalloc_8u_C1(widthPixels/2, heightPixels/2,
                               &(stepBytes [1]));
   plane[2] = ippiMalloc_8u_C1(widthPixels/2, heightPixels/2,
                               &(stepBytes [2]));

Return Values

The return value of Malloc function is a pointer to an aligned memory block.

If no memory is available in the system, the NULL value is returned.

To free the allocated memory block, use the Free function.