Rate This Document
Findability
Accuracy
Completeness
Readability

WinHamming

Multiplies a vector by a Hamming window. The definition formula of Hamming window is as follows: .

The function interface is declared as follows:

  • Operations on integers:

    HmppResult HMPPS_WinHamming_16s(const int16_t *src, int16_t *dst, int32_t len);

    HmppResult HMPPS_WinHamming_16sc(const Hmpp16sc *src, Hmpp16sc *dst, int32_t len);

  • Operations on floating-point numbers:

    HmppResult HMPPS_WinHamming_32f(const float *src, float *dst, int32_t len);

    HmppResult HMPPS_WinHamming_64f(const double *src, double *dst, int32_t len);

    HmppResult HMPPS_WinHamming_32fc(const Hmpp32fc *src, Hmpp32fc *dst, int32_t len);

    HmppResult HMPPS_WinHamming_64fc(const Hmpp64fc *src, Hmpp64fc *dst, int32_t len);

  • In-place operations on integers:

    HmppResult HMPPS_WinHamming_16s_I(int16_t *srcDst, int32_t len);

    HmppResult HMPPS_WinHamming_16sc_I(Hmpp16sc *srcDst, int32_t len);

  • In-place operations on floating-point numbers:

    HmppResult HMPPS_WinHamming_32f_I(float *srcDst, int32_t len);

    HmppResult HMPPS_WinHamming_64f_I(double *srcDst, int32_t len);

    HmppResult HMPPS_WinHamming_32fc_I(Hmpp32fc *srcDst, int32_t len);

    HmppResult HMPPS_WinHamming_64fc_I(Hmpp64fc *srcDst, int32_t len);

Parameters

Parameter

Description

Value Range

Input/Output

src

Pointer to the source vector

Not null

Input

dst

Pointer to the destination vector

Not null

Output

srcDst

Pointer to the source vector for in-place operations

Not null

Input/Output

len

Vector length

[3, INT_MAX]

Input

Return Value

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

Error Codes

Error Code

Description

HMPP_STS_NULL_PTR_ERR

The value of src, dst, or srcDst is NULL.

HMPP_STS_SIZE_ERR

The value of len is less than 3.

Example

#define BUFFER_SIZE_T 10
void WinHammingExample(void)
{
    float src[BUFFER_SIZE_T] = {1.64, 1.63, -1.09, 0.71, -3.20, -0.43, 0.41, -4.83, 5.36, -4.40};
    float dst[BUFFER_SIZE_T];
    (void)HMPPS_Zero_32f(dst, BUFFER_SIZE_T); //Initialize all elements of dst to 0.

    HmppResult result = HMPPS_WinHamming_32f(src, dst, BUFFER_SIZE_T);
    printf("result = %d\n", result);
    if (result != HMPP_STS_NO_ERR) {
        return;
    }

    printf("dst =");
    for (int i = 0; i < BUFFER_SIZE_T; i++) {
        printf(" %f", dst[i]);
    }
    printf("\n");
}

Output:

result = 0
dst = 0.131200 0.305820 -0.501533 0.546700 -3.111228 -0.418071 0.315700 -2.222389 1.005641 -0.352000