Pointer Description

Pointer method is used when you deal with objects of irregular structure. A convenient way to describe an irregular structure is creation of a mask for the data. The Pointer method creates masks for objects by direct pointing to every element of a vector (matrix). Pointers to the elements make up an array.

To describe an object by the Pointer method, specify the pointer to the array of pointers and roiShift in bytes (The concept of the roiShift parameter will be clarified later; in this discussion it is set to 0.) If the operation is performed on matrix or vector arrays, also specify the stride between the matrices (vectors), i.e. stride 0.

To apply the Pointer description method, first, create an array of pointers with the length equal to the number of elements in a single matrix (vector). Then initialize this array by making its elements point to every element of the single matrix (vector). When processing matrix or vector arrays, the pointers must point to the elements of the first matrix (vector).

IPP MX function that operates on objects described by the Pointer method has suffix _P. If a function has the _P suffix, then all objects, except constants, must be defined by Pointer method. Array of constants must be described by the Standard method. A singe constant is described as a value.

Pointer Description

The following fragment of C code describes the matrix array shown in Figure “Pointer Description”, case A:

// Allocate memory for the array of continuous matrices
Ipp32f  pMatrices[8*4*3];
// Assign pointer to the first continuous matrix
Ipp32f* pFirstMatrix = pMatrices;
// Allocate special array for pointers to matrix elements
Ipp32f* ppPointer[4*3];
// Declare subsidiary descriptors
int roiShift;
int stride0;
   * * *
// Set first row of matrix
ppPointer [0] = pFirstMatrix + 0;
ppPointer [1] = pFirstMatrix + 1;
ppPointer [2] = pFirstMatrix + 4;
ppPointer [3] = pFirstMatrix + 5;
// Set second row of matrix
ppPointer [4] = pFirstMatrix + 8 + 0;
ppPointer [5] = pFirstMatrix + 8 + 1;
ppPointer [6] = pFirstMatrix + 8 + 4;
ppPointer [7] = pFirstMatrix + 8 + 5;
// Set third row of matrix
ppPointer [ 8] = pFirstMatrix + 8*2 + 0;
ppPointer [ 9] = pFirstMatrix + 8*2 + 1;
ppPointer [10] = pFirstMatrix + 8*2 + 4;
ppPointer [11] = pFirstMatrix + 8*2 + 5;
// Set roiShift
roiShift = 0;
// Set stride0
stride0 = sizeof(Ipp32f)*8*4;
// Call IPP MX function
ippm<Operation>_ma_32f_P(..., ppPointer, roiShift, stride0, ...);

The following fragment of C code describes the vector array shown in Figure “Pointer Description”, case B:

// Allocate memory for the array of continuous vectors
Ipp32f  pVectors[8*3];
// Assign pointer to the first continuous vector
Ipp32f* pFirstVector = pVectors;
// Allocate special array for pointers to vector elements
Ipp32f* ppPointer[4];
// Declare subsidiary descriptors
int roiShift;
int stride0;
   * * *
// Set pointers
ppPointer [0] = pFirstVector + 0;
ppPointer [1] = pFirstVector + 1;
ppPointer [2] = pFirstVector + 4;
ppPointer [3] = pFirstVector + 5;
// Set roiShift
roiShift = 0;
// Set stride0
stride0 = sizeof(Ipp32f)*8;
// Call IPP MX function
ippm<Operation>_va_32f_P(..., ppPointer, roiShift, stride0, ...);

Single matrices and vectors are described in the same way without stride 0 specification.


Submit feedback on this help topic

Copyright © 2000 - 2011, Intel Corporation. All rights reserved.