Rate This Document
Findability
Accuracy
Completeness
Readability

ConvBiased

Calculates the linear convolution of the src1 vector (whose length is src1Len) and the src2 vector (whose length is src2Len). Use bias as the left offset to specify the starting element of src2. The calculated sequence dst is also moved by using bias as the left offset. Zeros are added to the empty bits. The formula is as follows:

,

Assume that the original array of src2 is x, and the length of x is xLen.

,

The function interface declaration is as follows:

Main function:

HmppResult HMPPS_ConvBiased_32f (const float* src1, int32_t src1Len, const float* src2, int32_t src2Len, float* dst, int32_t dstLen, int32_t bias);

Parameters

Parameter

Description

Value Range

Input/Output

src1

Pointer to the first source vector

The value cannot be NULL.

Input

src1Len

Length of the first source vector

(0, INT_MAX]

Input

scr2

Pointer to the second source vector

The value cannot be NULL.

Input

src2Len

Length of the second source vector

(0, INT_MAX]

Input

dst

Pointer to the destination vector

The value cannot be NULL.

Output

dstLen

Length of the destination vector

(0, INT_MAX]

Input

bias

Start element of the convolution

[INT_MIN, INT_MAX]

Input

Return Value

  • Success: HMPP_STS_NO_ERR
  • Failure: An error code is returned.

Error Codes

Error Code

Description

HMPP_STS_NO_ERR

No error occurs.

HMPP_STS_NULL_PTR_ERR

Any of the specified pointers is NULL.

HMPP_STS_SIZE_ERR

The value of srcLen or dstLen is less than or equal to 0.

Note

src1, src2, and dst cannot be the same array. Otherwise, the result may be incorrect.

Example

void Hilbert_Example()
{
    const int src1Len = 5;
    const int src2Len = 4;
    const int dstLen = 10;
    const int bias = 1;
    float src1[src1Len] = {2.1, -1.5, 3.5, 4.2, 1.7};
    float src2[src2Len] = {0.6, 1.3, -1.7, 2.1};
    float dst[dstLen];
    HMPPS_ConvBiased_32f(src1, src1Len, src2, src2Len, dst, dstLen, bias);
    for (int i = 0; i < dstLen; ++i) {
        printf("%.2f ", dst[i]);
    }
}

Output:

1.26 1.83 -3.42 9.62 0.529999 -4.93 -2.89 0 0 0