WinBlackman
给指定向量加blackman窗,其公式为:
其中,
函数接口声明如下:
- 数据的常规操作:
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);
- 数据的原址操作:
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);
参数
参数名 |
描述 |
取值范围 |
输入/输出 |
---|---|---|---|
dst |
指向目的向量的指针。 |
非空 |
输出 |
len |
向量长度。 |
(0,INT_MAX] |
输入 |
src |
指向源向量序列的指针。 |
非空 |
输入 |
srcDst |
做原址操作时指向源和目的向量的指针。 |
非空 |
输入&输出 |
alpha |
WinBlackman相关的调整参数。 |
视类型而定 |
输入 |
返回值
- 成功:返回HMPP_STS_NO_ERR。
- 失败:返回错误码。
错误码
错误码 |
描述 |
---|---|
HMPP_STS_NULL_PTR_ERR |
src、dst、srcDst入参中存在空指针。 |
HMPP_STS_SIZE_ERR |
WinBlackmanOpt类型接口len小于4,其他类型接口len小于3。 |
示例
#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; }
运行结果:
result = 0 dst = 0.000000 71.158592 -1730.999023 86508.515625 95192.570312 40.332100 -136154.843750 -1433.950806 940.880188 0.000000