WinHamming
向量与汉明窗相乘。汉明窗公式定义为:。
函数接口声明如下:
- 整型数的操作:
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);
- 浮点数的操作:
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);
- 整型数的原址操作:
HmppResult HMPPS_WinHamming_16s_I(int16_t *srcDst, int32_t len);
HmppResult HMPPS_WinHamming_16sc_I(Hmpp16sc *srcDst, int32_t len);
- 浮点数的原址操作:
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);
参数
参数名 |
描述 |
取值范围 |
输入/输出 |
---|---|---|---|
src |
指向源向量的指针。 |
非空 |
输入 |
dst |
指向目的向量的指针。 |
非空 |
输出 |
srcDst |
指向原址操作向量的指针。 |
非空 |
输入/输出 |
len |
向量长度。 |
[3, INT_MAX] |
输入 |
返回值
- 成功:返回HMPP_STS_NO_ERR。
- 失败:返回错误码。
错误码
错误码 |
描述 |
---|---|
HMPP_STS_NULL_PTR_ERR |
src、dst、srcDst这几个入参中存在空指针。 |
HMPP_STS_SIZE_ERR |
len小于3。 |
示例
#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); // 数组初始化,将dst所有元素初始化为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"); }
运行结果:
result = 0 dst = 0.131200 0.305820 -0.501533 0.546700 -3.111228 -0.418071 0.315700 -2.222389 1.005641 -0.352000