Intel IPP Integration Wrappers Developer Guide and Reference

ID 751823
Date 1/18/2023
Public
Document Table of Contents

Basic Classes

IwsRoi

Stores the geometric position and size of a vector. Extends the C IwsRoi structure.

class IwsRoi: public ::IwsRoi
{
public:
    // Default constructor. Sets values to zero
    IwsRoi()

    // One value template constructor. Sets position to zero and size to the same value. Useful for simple initialization, e.g.: roi = 0
    template<typename T>
    IwsRoi(
        T len // Length of a vector
    )

    // Constructor. Sets vector to specified values
    IwsRoi(
        IwSize _x,     // X coordinate of a vector
        IwSize _len    // Length of a vector
    )

    // Sets rectangle to specified values
    void Set(
        IwSize _x,     // X coordinate of a vector
        IwSize _len    // Length of a vector
    )

    // IwsRoi to IwiSize cast operator
    inline operator IwSize()  const { return len; }
};

IwsBorderSize

Stores the border size data.

class IwsBorderSize: public ::IwsBorderSize
{
public:
    // Default constructor. Sets values to zero
    IwsBorderSize();

    // One value template constructor. Sets border to same value. Useful for simple initialization, e.g.: border = 0
    template<typename T>
    IwsBorderSize(
        T border // Position of point
    );

    // Constructor. Sets border to the specified values
    IwsBorderSize(
        IwSize _left,   // Size of border to the left
        IwSize _right   // Size of border to the right
    );

    // Constructor from C IwsBorderSize structure
    IwsBorderSize(
        ::IwsBorderSize border // IwsBorderSize structure
    );

    // Constructor from the vector ROI
    IwsBorderSize(
        IwSize vectorSize,   // Size of the vector
        IwsRoi vectorRoi     // Vector ROI
    );

    // Sets border to the specified values
    void Set(
        IwSize _left,   // Size of border to the left
        IwSize _right   // Size of border to the right
    );

    // Sets border from the vector ROI
    void Set(
        IwSize vectorSize,   // Size of the vector
        IwsRoi vectorRoi     // Vector ROI
    );

    // Returns border size which contains maximum values of two border
    static IwsBorderSize Max(IwsBorderSize lhs, const IwsBorderSize &rhs);

    // Returns border size which contains minimum values of two border
    static IwsBorderSize Min(IwsBorderSize lhs, const IwsBorderSize &rhs);

    // Adds constant to the border
    inline IwsBorderSize& operator+=(const int &rhs);
    inline IwsBorderSize operator+(const int &rhs) const;

    // Subtracts constant from the border
    inline IwsBorderSize& operator-=(const int &rhs);
    inline IwsBorderSize operator-(const int &rhs) const;

    // Multiplies the border by the constant
    inline IwsBorderSize& operator*=(const double &rhs);
    inline IwsBorderSize operator*(const double &rhs) const;

    // Divides the border by the constant
    inline IwsBorderSize& operator/=(const double &rhs);
    inline IwsBorderSize operator/(const double &rhs) const;

    // Adds border to the border
    inline IwsBorderSize& operator+=(const IwsBorderSize &rhs);
    inline IwsBorderSize operator+(const IwsBorderSize &rhs) const;

    // Subtracts border from the border
    inline IwsBorderSize& operator-=(const IwsBorderSize &rhs);
    inline IwsBorderSize operator-(const IwsBorderSize &rhs) const;

};

IwsVector

Stores input and output data for signal processing functions.

class IwsVector: public ::IwsVector
{
public:
    // Default constructor. Sets values to zero
    IwsVector();

    // Copy constructor for C++ object. Performs lazy copy of an internal vector
    IwsVector(
        const IwsVector &vector           // Source vector
    );

    // Copy constructor for C object. Initializes vector structure with external buffer
    IwsVector(
        const ::IwsVector &vector         // Source vector
    );

    // Constructor with initialization. Initializes vector structure with external buffer
    IwsVector(
        IwSize          size,                           // Vector size, in elements
        IppDataType     dataType,                       // Vector element type
        IwsBorderSize   inMemBorder = IwsBorderSize(),  // Size of border around vector or NULL if there is no border
        void           *pBuffer     = NULL              // Pointer to the external buffer vector buffer
    );

    // Default destructor
    ~IwsVector();

    // Copy operator for C++ object. Performs lazy copy of an internal vector
    IwsVector& operator=(const IwsVector &vector);

    // Copy operator for C object. Initializes vector structure with external buffer
    IwsVector& operator=(const ::IwsVector &vector);

    // Initializes vector structure with external buffer
    // Returns:
    //      ippStsNoErr                         no errors
    IppStatus Init(
        IwSize          size,                           // Vector size, in elements
        IppDataType     dataType,                       // Vector element type
        IwsBorderSize   inMemBorder = IwsBorderSize(),  // Size of border around vector or NULL if there is no border
        void           *pBuffer     = NULL              // Pointer to the external buffer vector buffer
    );

    // Initializes vector structure with external read-only buffer
    // Returns:
    //      ippStsNoErr                         no errors
    IppStatus Init(
        IwSize          size,                           // Vector size, in elements
        IppDataType     dataType,                       // Vector element type
        IwsBorderSize   inMemBorder,                    // Size of border around vector or NULL if there is no border
        const void     *pBuffer                         // Pointer to the external buffer vector buffer
    );

    // Initializes vector structure and allocates vector data
    // Throws:
    //      ippStsDataTypeErr                   data type is illegal
    //      ippStsNumChannelsErr                channels value is illegal
    // Returns:
    //      ippStsNoErr                         no errors
    IppStatus Alloc(
        IwSize          size,                           // Vector size, in elements
        IppDataType     dataType,                       // Vector element type
        IwsBorderSize   inMemBorder = IwsBorderSize()   // Size of border around vector or NULL if there is no border
    );

    // Releases vector data if it was allocated by IwsVector::Alloc
    // Returns:
    //      ippStsNoErr                         no errors
    IppStatus Release();

    // Returns pointer to specified element position in vector buffer
    // Returns:
    //      Pointer to the vector data
    inline void* ptr(
        IwSize x  = 0  // elements shift
    ) const;

    // Returns pointer to specified element position in read-only vector buffer
    // Returns:
    //      Pointer to the vector data
    inline const void* ptrConst(
        IwSize x  = 0  // elements shift
    ) const;

    // Applies ROI to the current vector by adjusting size and starting point of the vector. Can be applied recursively.
    // This function saturates ROIs which step outside of the vector border.
    // If ROI has no intersection with the vector then resulted vector size will be 0x0
    // Throws:
    //      ippStsNullPtrErr                    unexpected NULL pointer
    // Returns:
    //      ippStsNoErr                         no errors
    IppStatus RoiSet(
        ipp::IwsRoi roi // Roi rectangle of the required sub-vector
    );

    // Returns sub-vector with size and starting point of the specified ROI
    // Returns:
    //      IwsVector object of sub-vector
    IwsVector GetRoiVector(
        ipp::IwsRoi roi             // Roi rectangle of the required sub-vector
    ) const;

    // Add border size to current inMem vector border, making vector size smaller. Resulted vector cannot be smaller than 1x1 elements
    // Throws:
    //      ippStsSizeErr                       ROI size is illegal
    //      ippStsNullPtrErr                    unexpected NULL pointer
    // Returns:
    //      ippStsNoErr                         no errors
    inline IwsVector& operator+=(const IwsBorderSize &rhs);
    inline IwsVector operator+(const IwsBorderSize &rhs) const;

    // Subtracts border size from current inMem vector border, making vector size bigger. Resulted border cannot be lesser than 0
    // Throws:
    //      ippStsOutOfRangeErr                 ROI is out of vector
    //      ippStsNullPtrErr                    unexpected NULL pointer
    inline IwsVector& operator-=(const IwsBorderSize &rhs);
    inline IwsVector operator-(const IwsBorderSize &rhs) const;

    // Set border size to current inMem vector border, adjusting vector size. Resulted vector cannot be smaller than 1x1 elements.
    // Throws:
    //      ippStsSizeErr                       ROI size is illegal
    //      ippStsNullPtrErr                    unexpected NULL pointer
    inline IwsVector& operator=(const IwsBorderSize &rhs);

    // Returns true if vector has an assigned buffer
    inline bool Exists() const;

    // Returns true if vector doesn't have an assigned buffer or its dimensions have zero size
    inline bool Empty() const;

    // Compares vector structures and returns true if structure parameters are compatible, e.g. copy operation can be performed without reallocation
    bool Similar(const ipp::IwsVector& rhs) const;

private:
    int *m_pRefCounter;  // Shared reference counter for allocated memory
};

IwsTile

Wrapper class for the basic IwsTile tiling API.

class IwsTile: public ::IwsTile
{
public:
    // Default constructor.
    IwsTile();

    // Constructor with initialization.
    IwsTile(
        const ::IwsRoi &tileRoi    // [in] Tile offset and size
    );

    // Basic tiling initializer for IwsTile structure.
    void SetTile(
        const ::IwsRoi &tileRoi    // [in] Tile offset and size
    );

    // Assignment operator from C IwsRoi structure.
    IwsTile& operator=(
        const ::IwsRoi &tileRoi    // [in] Tile offset and size
    );
};