Rate This Document
Findability
Accuracy
Completeness
Readability

WinKaiser

Multiplies a specified vector by a Kaiser windowing function. The formula is as follows:

I0() indicates a first-order corrected 0-order Bessel function, and the calculation formula is as follows:

The function interface declaration is as follows:

  • Operations on integers:

    HmppResult HMPPS_WinKaiser_16s(const int16_t* src, int16_t* dst, int32_t len, float alpha);

    HmppResult HMPPS_WinKaiser_16sc(const Hmpp16sc* src, Hmpp16sc* dst, int32_t len, float alpha);

  • Operations on floating-point numbers:

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

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

    HmppResult HMPPS_WinKaiser_32fc(const Hmpp32fc* src, Hmpp32fc* dst, int32_t len, float alpha);

    HmppResult HMPPS_WinKaiser_64fc(const Hmpp64fc* src, Hmpp64fc* dst, int32_t len, double alpha);

  • In-place operations on integers:

    HmppResult HMPPS_WinKaiser_16s_I(int16_t* srcDst, int32_t len, float alpha);

    HmppResult HMPPS_WinKaiser_16sc_I(Hmpp16sc* srcDst, int32_t len, float alpha);

  • In-place operations on floating-point numbers:

    HmppResult HMPPS_WinKaiser_32f_I(float* srcDst, int32_t len, float alpha);

    HmppResult HMPPS_WinKaiser_64f_I(double* srcDst, int32_t len, double alpha);

    HmppResult HMPPS_WinKaiser_32fc_I(Hmpp32fc* srcDst, int32_t len, float alpha);

    HmppResult HMPPS_WinKaiser_64fc_I(Hmpp64fc* srcDst, int32_t len, double alpha);

Parameters

Parameter

Description

Value Range

Input/Output

src

Pointer to the source vector

The value cannot be NULL.

Input

dst

Pointer to the destination vector

The value cannot be NULL.

Output

srcDst

Pointer to the source vector for in-place operations

The value cannot be NULL.

Input/Output

len

Vector length

(0, INT_MAX]

Input

alpha

An adjustable parameter related to the Kaiser window equation

  • If alpha is of the double type, the condition that fabs(alpha)*(len-1)/2 <= 308 should be met.
  • If alpha is of the float type, the condition that fabs(alpha)*(len-1)/2 <= 38 should be met.

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 1.

HMPP_STS_HUGEWIN_ERR

The value of the Kaiser window is too large.

  • If alpha is of the double type, the value of fabs(alpha)*(len-1)/2 is greater than 308.
  • If alpha is of the float type, the value of fabs(alpha)*(len-1)/2 is greater than 38.

Example

#define BUFFER_SIZE_T 10

int main()
{
    int16_t src[BUFFER_SIZE_T] = {10, 11, 12, 13, 14, 15, 16, 17, 18, 19};
    float alpha = 0.5;  
    int16_t dst[BUFFER_SIZE_T];
    (void)HMPPS_Zero_16s(dst, BUFFER_SIZE_T); //Initialize all elements of dst to 0.

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

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

    return 0;
} 

Output:

result = 0
dst = 4 6 9 12 14 15 15 13 10 7