我要评分
获取效率
正确性
完整性
易理解

WinBlackman

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

In the preceding formula:

  • For a WinBlackman interface, the alpha value is transferred by the interface parameter.
  • For a WinBlackmanStd interface: alpha = -0.16.
  • For a WinBlackmanOpt interface, the calculation formula of alpha is as follows:

The function interface declaration is as follows:

  • Common data operations:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  • In-place operations on data:

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

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

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

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

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

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

    HmppResult HMPPS_WinBlackmanStd_16s_I(int16_t* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanStd_32f_I(float* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanStd_64f_I(double* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanStd_16sc_I(Hmpp16sc* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanStd_32fc_I(Hmpp32fc* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanStd_64fc_I(Hmpp64fc* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanOpt_16s_I(int16_t* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanOpt_32f_I(float* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanOpt_64f_I(double* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanOpt_16sc_I(Hmpp16sc* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanOpt_32fc_I(Hmpp32fc* srcDst, int32_t len);

    HmppResult HMPPS_WinBlackmanOpt_64fc_I(Hmpp64fc* srcDst, int32_t len);

Parameters

Parameter

Description

Value Range

Input/Output

dst

Pointer to the destination vector

The value cannot be NULL.

Output

len

Vector length

(0, INT_MAX]

Input

src

Pointer to the source vector sequence

The value cannot be NULL.

Input

srcDst

Pointer to the source and destination vectors for in-place operations

The value cannot be NULL.

Input/Output

alpha

An adjustment parameter related to WinBlackman

Depending on the type

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

For the WinBlackmanOpt interface, the value of len is less than 4. For other interfaces, the value of len is less than 3.

Example

#define BUFFER_SIZE_T 10

int WinBlackmanExample()
{
    int32_t i;
    float dst[BUFFER_SIZE_T] = {0.0};
    float alpha = 2.3399999;
    float src[BUFFER_SIZE_T] = {32.4324, 65.655998, -645.26532, 34534.34, 76547.547, 32.4324, -54353.234, -534.53448, 868.12323, 9.3542995};
    HmppResult result = HMPPS_WinBlackman_32f(src, dst, BUFFER_SIZE_T, alpha);
    printf("result = %d \ndst =", result);
    for (i = 0; i < BUFFER_SIZE_T; i++) {
        printf(" %f  ", dst[i]);
    }
    return 0;
}

Output:

result = 0
dst = 0.000000   71.158592   -1730.999023   86508.515625   95192.570312   40.332100   -136154.843750   -1433.950806   940.880188   0.000000