Layout Description

Layout description method is used when dealing with arrays of matrices, vectors or constants. Unlike the Pointer description method, which defines matrix elements by pointers and matrix layout by strides, the Layout method defines matrix elements by strides and matrix layout by pointers.

To describe an object by the Layout method, specify pointers to each matrix, vector or constant in the array, roiShift (in bytes), stride 2, and stride 1 (The concept of the roiShift parameter will be clarified later; in this discussion it is set to 0.). Note that no stride 0 specification is required. Create a special array of pointers with the length equal to the number of array components. Initialize the array by making its elements point to every matrix (vector or constant). Specify the strides required to define single matrix (vector).

IPP MX function that operates on objects described by the Layout method has suffix _L. If a function has the _L suffix, then arrays of matrices, vectors or constants must be defined by the Layout method and single matrices or vectors by the Standard method.

Layout Description

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

// Allocate memory for three continuous matrices
Ipp32f pFirstMatrix [6*5];
Ipp32f pSecondMatrix[6*5];
Ipp32f pThirdMatrix [6*5];
// Allocate special array for pointers to 3 matrices:
Ipp32f* ppLayout[3];
// Declare subsidiary descriptors
int roiShift;
int stride1, stride2;
   * * *
// Set pointers to matrices
ppLayout [0] = pFirstMatrix;
ppLayout [1] = pSecondMatrix;
ppLayout [2] = pThirdMatrix;
// Set roiShift
roiShift = 0;
// Set stride2
stride2 = sizeof(Ipp32f)*2;
// Set stride1
stride1 = sizeof(Ipp32f)*6;
// Call IPP MX function
ippm<Operation>_ma_32f_L(..., ppLayout, roiShift, stride1, stride2, ...);

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

// Allocate memory for three continuous vectors
Ipp32f pFirstVector [6];
Ipp32f pSecondVector[6];
Ipp32f pThirdVector [6];
// Allocate special array for pointers to 3 vectors
Ipp32f* ppLayout[3];
// Declare subsidiary descriptors
int roiShift;
int stride2;
   * * *
// Set pointers to vectors
ppLayout [0] = pFirstVector;
ppLayout [1] = pSecondVector;
ppLayout [2] = pThirdVector;
// Set roiShift
roiShift = 0;
// Set stride2
stride2 = sizeof(Ipp32f)*2;
// Call IPP MX function
ippm<Operation>_va_32f_L(..., ppLayout, roiShift, stride2, ...);

The following fragment of C code describes the constant array shown in Figure “Layout Description”, case C:

// Allocate memory for constant array Ipp32f pVal [20];
// Allocate special array for pointers to 3 constants
// example is for count=3
Ipp32f* ppValLayout[3];
// Declare subsidiary descriptors
int valRoiShift;
* * *
// Set pointers to constants
ppValLayout [0] = &pVal[0];
ppValLayout [1] = &pVal[8];
ppValLayout [2] = &pVal[11];
// Set roiShift
valRoiShift = 0;
* * *
// Call IPP MX function
ippm<Operation>_ca_32f_L(..., ppValLayout, valRoiShift, ...);


Submit feedback on this help topic

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