📄 dsp.h
字号:
/* (both srcV and dstV MUST have, */
/* at least, numElems elements). */
/* dstV[n] = srcV[n], 0 <= n < N */
/* (in place capable) */
int numElems, /* number elements to copy (N) */
fractional* dstV, /* ptr to destination vector */
fractional* srcV /* ptr to source vector */
/* dstV returned */
);
/*...........................................................................*/
extern fractional* VectorZeroPad ( /* Zero pad tail of a vector */
/* dstV[n] = srcV[n], 0 <= n < N */
/* dstV[n] = 0, N <= n < N+M */
/* (srcV MUST have length >= N) */
/* (dstV MUST have length N+M) */
/* (in place capable) */
int numElems, /* number elements in srcV (N) */
int numZeros, /* number zeros to append (M) */
fractional* dstV, /* ptr to destination vector */
fractional* srcV /* ptr to source vector */
/* dstV returned */
);
/*...........................................................................*/
extern fractional* VectorNegate ( /* Vector negate */
/* dstV[n] = (-1)*srcV[n]+0, 0<=n<N */
/* (in place capable) */
int numElems, /* number elements in srcV (N) */
fractional* dstV, /* ptr to destination vector */
fractional* srcV /* ptr to source vector */
/* dstV returned */
);
/*...........................................................................*/
extern fractional* VectorScale ( /* Vector scale */
/* dstV[elem] = sclVal*srcV[elem] */
/* (in place capable) */
int numElems, /* number elements in srcV (N) */
fractional* dstV, /* ptr to destination vector */
fractional* srcV, /* ptr to source vector */
fractional sclVal /* scale value (Q.15 fractional) */
/* dstV returned */
);
/*...........................................................................*/
extern fractional* VectorAdd ( /* Vector addition */
/* dstV[elem] = */
/* = srcV1[elem] + srcV2[elem] */
/* (in place capable) */
/* (with itself capable) */
int numElems, /* number elements in srcV[1,2] (N) */
fractional* dstV, /* ptr to destination vector */
fractional* srcV1, /* ptr to source vector one */
fractional* srcV2 /* ptr to source vector two */
/* dstV returned */
);
/*...........................................................................*/
extern fractional* VectorSubtract ( /* Vector subtraction */
/* dstV[elem] = */
/* = srcV1[elem] - srcV2[elem] */
/* (in place capable) */
/* (with itself capable) */
int numElems, /* number elements in srcV[1,2] (N) */
fractional* dstV, /* ptr to destination vector */
fractional* srcV1, /* ptr to source vector one */
fractional* srcV2 /* ptr to source vector two */
/* dstV returned */
);
/*...........................................................................*/
extern fractional* VectorMultiply ( /* Vector elem-to-elem multiply */
/* dstV[elem] = */
/* = srcV1[elem] * srcV2[elem] */
/* (in place capable) */
/* (with itself capable) */
int numElems, /* number elements in srcV[1,2] (N) */
fractional* dstV, /* ptr to destination vector */
fractional* srcV1, /* ptr to source vector one */
fractional* srcV2 /* ptr to source vector two */
/* dstV returned */
);
/*...........................................................................*/
extern fractional VectorDotProduct ( /* Vector dot product */
/* dotVal = */
/* = sum(srcV1[elem]*srcV2[elem]) */
/* (with itself capable) */
int numElems, /* number elements in srcV[1,2] (N) */
fractional* srcV1, /* ptr to source vector one */
fractional* srcV2 /* ptr to source vector two */
/* dot product value returned */
);
/*...........................................................................*/
extern fractional VectorPower ( /* Vector power */
/* powVal = */
/* = sum(srcV[elem]^2) */
int numElems, /* number elements in srcV (N) */
fractional* srcV /* ptr to source vector one */
/* power value returned */
);
/*...........................................................................*/
extern fractional* VectorConvolve ( /* Vector Convolution */
/* (with itself capable) */
int numElems1, /* number elements in srcV1 */
int numElems2, /* number elements in srcV2 */
/* numElems2 <= numElems1 */
fractional* dstV, /* ptr to destination vector */
/* with numElems1+numElems2-1 elems */
fractional* srcV1, /* ptr to source vector one */
fractional* srcV2 /* ptr to source vector two */
/* dstV returned */
);
/*...........................................................................*/
extern fractional* VectorCorrelate ( /* Vector Correlation */
/* (with itself capable) */
int numElems1, /* number elements in srcV1 */
int numElems2, /* number elements in srcV2 */
/* numElems2 <= numElems1 */
fractional* dstV, /* ptr to destination vector */
/* with numElems2+numElems1-1 elems */
fractional* srcV1, /* ptr to source vector one */
fractional* srcV2 /* ptr to source vector two */
/* dstV returned */
);
/*...........................................................................*/
/****************************************************************************
*
* Interface to windowing operations.
*
* A window is a vector with a specific value distribution within its
* domain ( 0 <= n < numElems). The particular value distribution depends
* on the window being generated.
*
* Given a vector, its value distribution may be modified by applying
* a window to it. In these cases, the window must have the same number
* of elements as the vector to modify.
*
* Before a vector can be windowed, the window must be created. Window
* initialization operations are provided which generate the values of
* the window elements. For higher numerical precision, these values are
* computed in floating point arithmetic, and the resulting quantities
* stored as Q.15 fractionals.
*
* To avoid excessive overhead when applying a window operation, and since
* given a window length the values of the window elements are fixed, a
* particular window could be generated once and used many times during
* the execution of the program. Thus, it is advisable to store the window
* returned by any of the initialization operations in a permanent (static)
* vector.
*
* Additional remarks.
*
* A) All the window initialization functions have been designed to generate
* window vectors allocated in default RAM memory space (X-Data and Y-Data).
*
* B) The windowing function is designed to operate on vectors allocated
* in default RAM memory space (X-Data and Y-Data).
*
****************************************************************************/
/* Windowing operation prototypes. */
extern fractional* BartlettInit ( /* Initialize a Bartlett window */
/* computed in floating point */
/* converted to fractionals */
int numElems, /* number elements in window */
fractional* window /* ptr to window */
/* window returned */
);
/*...........................................................................*/
extern fractional* BlackmanInit ( /* Initialize a Blackman window */
/* computed in floating point */
/* converted to fractionals */
int numElems, /* number elements in window */
fractional* window /* ptr to window */
/* window returned */
);
/*...........................................................................*/
extern fractional* HammingInit ( /* Initialize a Hamming window */
/* computed in floating point */
/* converted to fractionals */
int numElems, /* number elements in window */
fractional* window /* ptr to window */
/* window returned */
);
/*...........................................................................*/
extern fractional* HanningInit ( /* Initialize a Hanning window */
/* computed in floating point */
/* converted to fractionals */
int numElems, /* number elements in window */
fractional* window /* ptr to window */
/* window returned */
);
/*...........................................................................*/
extern fractional* KaiserInit ( /* Initialize a Kaiser window */
/* computed in floating point */
/* converted to fractionals */
int numElems, /* number elements in window */
fractional* window, /* ptr to window */
float betaVal /* shape parameter */
/* window returned */
);
/*...........................................................................*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -