WXK
2025-02-11 e328ebef585cea2351b37117b2d5ac4978ecd3c0
keil/include/drivers/mk_lsp.h
@@ -51,6 +51,16 @@
 * @{
 */
/**
 * @brief Instance structure for the floating-point matrix structure.
 */
struct LSP_MATRIX_T
{
    uint16_t num_rows; /**< number of rows of the matrix.     */
    uint16_t num_cols; /**< number of columns of the matrix.  */
    float *data;       /**< points to the data of the matrix. */
};
#ifdef __cplusplus
extern "C" {
#endif
@@ -78,6 +88,33 @@
void lsp_add_f32(const float *pSrcA, const float *pSrcB, float *pDst, uint32_t blkCnt);
/**
 * @brief 8bit integer vector addition.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_add_int8(const int8_t *pSrcA, const int8_t *pSrcB, int16_t *pDst, uint32_t blkCnt);
/**
 * @brief 16bit integer vector addition.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_add_int16(const int16_t *pSrcA, const int16_t *pSrcB, int32_t *pDst, uint32_t blkCnt);
/**
 * @brief 32bit integer vector addition.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_add_int32(const int32_t *pSrcA, const int32_t *pSrcB, int32_t *pDst, uint32_t blkCnt);
/**
 * @brief Floating-point vector subtraction.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
@@ -85,6 +122,33 @@
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_sub_f32(const float *pSrcA, const float *pSrcB, float *pDst, uint32_t blkCnt);
/**
 * @brief 8bit integer vector subtraction.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_sub_int8(const int8_t *pSrcA, const int8_t *pSrcB, int16_t *pDst, uint32_t blkCnt);
/**
 * @brief 16bit integer vector subtraction.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_sub_int16(const int16_t *pSrcA, const int16_t *pSrcB, int32_t *pDst, uint32_t blkCnt);
/**
 * @brief 32bit integer vector subtraction.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_sub_int32(const int32_t *pSrcA, const int32_t *pSrcB, int32_t *pDst, uint32_t blkCnt);
/**
 * @brief Floating-point vector multiplication.
@@ -96,6 +160,33 @@
void lsp_mult_f32(const float *pSrcA, const float *pSrcB, float *pDst, uint32_t blkCnt);
/**
 * @brief 8bit integer vector multiplication.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_mult_int8(const int8_t *pSrcA, const int8_t *pSrcB, int16_t *pDst, uint32_t blkCnt);
/**
 * @brief 16bit integer vector multiplication.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_mult_int16(const int16_t *pSrcA, const int16_t *pSrcB, int32_t *pDst, uint32_t blkCnt);
/**
 * @brief 32bit integer vector multiplication.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_mult_int32(const int32_t *pSrcA, const int32_t *pSrcB, int32_t *pDst, uint32_t blkCnt);
/**
 * @brief Floating-point vector inverse.
 * @param[in]  pSrc       points to the instance of the input vector.
 * @param[out] pDst       points to the instance of the output vector.
@@ -104,13 +195,28 @@
void lsp_vinverse_f32(const float *pSrc, float *pDst, uint32_t blkCnt);
/**
 * @brief int16 vector inner product.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 * @brief 8bit integer vector inverse.
 * @param[in]  pSrc       points to the instance of the input vector.
 * @param[out] pDst       points to the instance of the output vector.
 * @param[in]  blkCnt     number of samples in intput vector
 */
void lsp_inner_product_int16(const int16_t *pSrcA, const int16_t *pSrcB, float *pDst, uint32_t blkCnt);
void lsp_vinverse_int8(const int8_t *pSrc, float *pDst, uint32_t blkCnt);
/**
 * @brief 16bit integer vector inverse.
 * @param[in]  pSrc       points to the instance of the input vector.
 * @param[out] pDst       points to the instance of the output vector.
 * @param[in]  blkCnt     number of samples in intput vector
 */
void lsp_vinverse_int16(const int16_t *pSrc, float *pDst, uint32_t blkCnt);
/**
 * @brief 32bit integer vector inverse.
 * @param[in]  pSrc       points to the instance of the input vector.
 * @param[out] pDst       points to the instance of the output vector.
 * @param[in]  blkCnt     number of samples in intput vector
 */
void lsp_vinverse_int32(const int32_t *pSrc, float *pDst, uint32_t blkCnt);
/**
 * @brief Floating-point vector inner product.
@@ -120,6 +226,45 @@
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_inner_product_f32(const float *pSrcA, const float *pSrcB, float *pDst, uint32_t blkCnt);
/**
 * @brief 8bit integer vector inner product.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_inner_product_int8(const int8_t *pSrcA, const int8_t *pSrcB, int32_t *pDst, uint32_t blkCnt);
/**
 * @brief 16bit integer vector inner product.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_inner_product_int16(const int16_t *pSrcA, const int16_t *pSrcB, float *pDst, uint32_t blkCnt);
/**
 * @brief 32bit integer vector inner product.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  pSrcB      points to the second input vector
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of samples in each vector
 */
void lsp_inner_product_int32(const int32_t *pSrcA, const int32_t *pSrcB, float *pDst, uint32_t blkCnt);
/**
 * @brief Floating-point vector inner product searching to find out the maximum or minimum result.
 * @param[in]  pSrcA      points to the first input vector
 * @param[in]  srcALen    the length of input vector SrcA, srcALen <= 16
 * @param[in]  pSrcB      points to the second input vector
 * @param[in]  iterations iteration times
 * @param[out] pDst       points to the output vector
 * @param[in]  isMax      maximum or minimum
 * @return the maximum or minimum inner product iteration count
 */
uint32_t lsp_correlate_f32(const float *pSrcA, uint32_t srcALen, const int8_t *pSrcB, uint32_t iterations, float *pDst, uint8_t isMax);
/**
 * @brief Multiplies a floating-point vector by a scalar.
@@ -136,7 +281,7 @@
 * @param[in]  pSrcB       points to the second input vector
 * @param[out] pDst        points to the output vector
 * @param[in]  numSamples  number of complex samples in each vector
 * @param[in]  isConj      conjugate
 * @param[in]  isConj      conjugate enbale or disable
 */
void lsp_cmplx_mult_cmplx_int8(const int8_t *pSrcA, const int8_t *pSrcB, int16_t *pDst, uint32_t numSamples, uint8_t isConj);
@@ -146,7 +291,7 @@
 * @param[in]  pSrcB       points to the second input vector
 * @param[out] pDst        points to the output vector
 * @param[in]  numSamples  number of complex samples in each vector
 * @param[in]  isConj      conjugate
 * @param[in]  isConj      conjugate enbale or disable
 */
void lsp_cmplx_mult_cmplx_int16(const int16_t *pSrcA, const int16_t *pSrcB, int32_t *pDst, uint32_t numSamples, uint8_t isConj);
@@ -156,7 +301,7 @@
 * @param[in]  pSrcB       points to the second input vector
 * @param[out] pDst        points to the output vector
 * @param[in]  numSamples  number of complex samples in each vector
 * @param[in]  isConj      conjugate
 * @param[in]  isConj      conjugate enbale or disable
 */
void lsp_cmplx_mult_cmplx_f32(const float *pSrcA, const float *pSrcB, float *pDst, uint32_t numSamples, uint8_t isConj);
@@ -166,7 +311,7 @@
 * @param[in]  pSrcB        points to the second input vector
 * @param[out] pDst         points to the output vector
 * @param[in]  numSamples   number of complex samples in each vector
 * @param[in]  isConj       conjugate
 * @param[in]  isConj       conjugate enbale or disable
 */
void lsp_cmplx_inner_product_int8(const int8_t *pSrcA, const int8_t *pSrcB, int32_t *pDst, uint32_t numSamples, uint8_t isConj);
@@ -176,7 +321,7 @@
 * @param[in]  pSrcB        points to the second input vector
 * @param[out] pDst         points to the output vector
 * @param[in]  numSamples   number of complex samples in each vector
 * @param[in]  isConj       conjugate
 * @param[in]  isConj       conjugate enbale or disable
 */
void lsp_cmplx_inner_product_int16(const int16_t *pSrcA, const int16_t *pSrcB, float *pDst, uint32_t numSamples, uint8_t isConj);
@@ -186,7 +331,7 @@
 * @param[in]  pSrcB        points to the second input vector
 * @param[out] pDst         points to the output vector
 * @param[in]  numSamples   number of complex samples in each vector
 * @param[in]  isConj       conjugate
 * @param[in]  isConj       conjugate enbale or disable
 */
void lsp_cmplx_inner_product_f32(const float *pSrcA, const float *pSrcB, float *pDst, uint32_t numSamples, uint8_t isConj);
@@ -197,10 +342,43 @@
 * @param[in]  im_scale   scale factor to be applied on imaginary part
 * @param[out] pDst       points to the output vector
 * @param[in]  blkCnt     number of complex samples in the vector
 * @param[in]  isConj     conjugate
 * @param[in]  isConj     conjugate enbale or disable
 */
void lsp_cmplx_scale_f32(const float *pSrc, float re_scale, float im_scale, float *pDst, uint32_t blkCnt, uint8_t isConj);
/**
 * @brief Floating-point matrix inverse.
 * @param[in]  pSrc     points to the instance of the input floating-point matrix structure.
 * @param[out] pDst     points to the instance of the output floating-point matrix structure.
 * @param[in]  rv       matrix regularization
 */
void lsp_cmplx_mat_inverse_f32(const struct LSP_MATRIX_T *pSrc, struct LSP_MATRIX_T *pDst, float rv);
/**
 * @brief Floating-point matrix LDL factorization.
 * @param[in]  pSrc     points to the instance of the input floating-point matrix structure.
 * @param[out] pDst     points to the instance of the output floating-point matrix structure.
 * @param[in]  rv       matrix regularization
 */
void lsp_cmplx_mat_ldl_f32(const struct LSP_MATRIX_T *pSrc, struct LSP_MATRIX_T *pDst, float rv);
/**
 * @brief Floating-point matrix multiplication
 * @param[in]  pSrcA     points to the first input matrix structure
 * @param[in]  pSrcB     points to the second input matrix structure
 * @param[out] pDst      points to output matrix structure
 */
void lsp_mat_mult_f32(const struct LSP_MATRIX_T *pSrcA, const struct LSP_MATRIX_T *pSrcB, struct LSP_MATRIX_T *pDst);
/**
 * @brief Floating-point complex matrix multiplication
 * @param[in]  pSrcA     points to the first input matrix structure
 * @param[in]  pSrcB     points to the second input matrix structure
 * @param[out] pDst      points to output matrix structure
 * @param[out] isConj    conjugate enbale or disable
 */
void lsp_cmplx_mat_mult_f32(const struct LSP_MATRIX_T *pSrcA, const struct LSP_MATRIX_T *pSrcB, struct LSP_MATRIX_T *pDst, uint8_t isConj);
#ifdef __cplusplus
}
#endif