hppiGetMatrixData

Copy the data from a virtual matrix to the user-defined buffer.

Syntax

hppStatus hppiGetMatrixData(hppAccel accel,hppiMatrix* matrix, hpp32u pitch, void* pData, size_t* length);

Parameters

accel

The accelerator instance.

matrix

The matrix handle.

pitch

The pitch of the output buffer.

pData

Pointer to the buffer to store the matrix data. The length of the buffer must be sufficient to contain the pitch * matrix height bytes.

length

Length of the buffer pointed to by pData. If the buffer length in not sufficient to hold the matrix data, the function returns an error code, and the variable pointed by length is updated with the required minimum size for the buffer.

Description

This function copies the matrix data from the virtual matrix to the buffer pointed by user. To get the parameters values of the virtual matrix for copying, use the hppiInquireMatrix function.

Note

Before calling the hppiGetMatrixData function, you must use the virtual matrix at least once in a processing pipeline. Otherwise, the parameters of the virtual matrix are not set and the function returns zero values.

Return Values

HPP_STATUS_NO_ERROR

The operation is completed successfully.

HPP_STATUS_DEVICE_FAILED

The accel handle is invalid.

HPP_STATUS_HANDLE_INVALID

The matrix, pData, or length parameter is invalid.

HPP_STATUS_SIZE_MISMATCHED

The length value is less than pitch * matrix.

Example

The code example below demonstrates how to get the intermediate pipeline results from the virtual matrix tmp[0] using the hppiGetMatrixData function.

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

        st = hppCreateInstance(HPP_ACCEL_TYPE_GPU, 0, &instanceGPU);
        st = hppQueryMatrixAllocParams(instanceGPU, width, height, 
HPP_DATA_TYPE_8U, &pitch, &size);

        pData = malloc(size);
        inputMatrix = hppiCreateMatrix(HPP_DATA_TYPE_8U, width, height, pData, pitch);

        hppiVirtualMatrix* tmp = hppiCreateVirtualMatrices(instanceGPU, 2);

        hpp32u newWidth, newHeight, newPitch;
        size_t newSize;
        hppDataType newType;

        st = hppiFilterFixed(instanceGPU, inputMatrix, HPP_KERNEL_SOBEL_H, 
HPP_MASK_SIZE_3X3, tmp[0], HPP_DATA_TYPE_16S);
        st = hppWait(instanceGPU, HPP_TIME_OUT_INFINITE);

        st = hppiInquireMatrix(tmp[0], &newType, &newWidth, &newHeight);
        if(newType != HPP_DATA_TYPE_16S)
            return 0;
        newPitch = newWidth * 2; // 16s is 2-byte long
        newSize = newPitch * newHeight;
        short* pNewData = (short*) malloc(newSize);

        st = hppiGetMatrixData(instanceGPU, tmp[0], newPitch, pNewData, &newSize);

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.