hppQueryMatrixAllocParams

Evaluate pitch and size of the user-supplied memory buffer for the shared matrix allocation.

Syntax

hppStatus hppQueryMatrixAllocParams(hppAccel accel, hpp32u width, hpp32u height, hppDataType type, hpp32u* nPitch, hpp32u* nSize);

Parameters

accel

The accelerator instance.

type

The matrix data type as defined by the hppDataType enumerator.

width, height

The width and height of the matrix.

nPitch

The pitch of the 2D image buffer, in bytes.

nSize

The length of the pData memory buffer, in bytes.

Description

This function evaluates pitch and length in bytes of the user-supplied memory buffer that is required to create shared matrix of certain width, height, and data type.

Return Values

HPP_STATUS_NO_ERROR

The operation is completed successfully.

HPP_STATUS_HANDLE_INVALID

Address specified by the nPitch or nSize parameters is invalid.

STATUS_DEVICE_FAILED

The accel handle is invalid.

HPP_STATUS_PARAM_UNSUPPORTED

The value of the width or height parameters is equal to zero.

HPP_STATUS_FEATURE_UNSUPPORTED

The function is called for the accelerator that does not support shared matrices.

Example

The example code below queries the accelerator instance for required parameters of the 640x480 matrix with one-channel 32-bit unsigned values, allocates the buffer, and initializes the inputMat shared matrix.

    hpp32u width = 640, height = 480, pitch, size;
    hppStatus st;
    void *pData;
    hppiMatrix *inputMat;

    st = hppQueryMatrixAllocParams(instanceGPU, width, height, HPP_DATA_TYPE_32U, 
                &pitch, &size);
    pData = malloc(size);
    inputMat = hppiCreateSharedMatrix(HPP_DATA_TYPE_32U, width, height, pData, pitch, size);

See Also

Reportez-vous à notre Notice d'optimisation pour plus d'informations sur les choix et l'optimisation des performances dans les produits logiciels Intel.