| #include "edge-impulse-sdk/dsp/config.hpp" |
| #if EIDSP_LOAD_CMSIS_DSP_SOURCES |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #include "edge-impulse-sdk/CMSIS/DSP/Include/dsp/complex_math_functions.h" |
|
|
| |
| |
| |
|
|
| |
| |
| |
| |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
|
|
| #if defined(ARM_MATH_MVEI) && !defined(ARM_MATH_AUTOVECTORIZE) |
| void arm_cmplx_mult_real_q31( |
| const q31_t * pSrcCmplx, |
| const q31_t * pSrcReal, |
| q31_t * pCmplxDst, |
| uint32_t numSamples) |
| { |
|
|
| static const uint32_t stride_cmplx_x_real_32[4] = { |
| 0, 0, 1, 1 |
| }; |
| q31x4_t rVec; |
| q31x4_t cmplxVec; |
| q31x4_t dstVec; |
| uint32x4_t strideVec; |
| uint32_t blockSizeC = numSamples * CMPLX_DIM; |
| uint32_t blkCnt; |
| q31_t in; |
|
|
| |
| |
| |
| strideVec = vld1q(stride_cmplx_x_real_32); |
|
|
| |
| blkCnt = blockSizeC >> 2; |
| while (blkCnt > 0U) |
| { |
| cmplxVec = vld1q(pSrcCmplx); |
| rVec = vldrwq_gather_shifted_offset_s32(pSrcReal, strideVec); |
| dstVec = vqdmulhq(cmplxVec, rVec); |
| vst1q(pCmplxDst, dstVec); |
|
|
| pSrcReal += 2; |
| pSrcCmplx += 4; |
| pCmplxDst += 4; |
| blkCnt --; |
| } |
|
|
| blkCnt = (blockSizeC & 3) >> 1; |
| while (blkCnt > 0U) |
| { |
| |
| |
| |
| in = *pSrcReal++; |
| |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| |
| |
| blkCnt--; |
| } |
| } |
| #else |
| void arm_cmplx_mult_real_q31( |
| const q31_t * pSrcCmplx, |
| const q31_t * pSrcReal, |
| q31_t * pCmplxDst, |
| uint32_t numSamples) |
| { |
| uint32_t blkCnt; |
| q31_t in; |
|
|
| #if defined (ARM_MATH_LOOPUNROLL) |
|
|
| |
| blkCnt = numSamples >> 2U; |
|
|
| while (blkCnt > 0U) |
| { |
| |
| |
|
|
| in = *pSrcReal++; |
| #if defined (ARM_MATH_DSP) |
| |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| #else |
| |
| *pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31); |
| *pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31); |
| #endif |
|
|
| in = *pSrcReal++; |
| #if defined (ARM_MATH_DSP) |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| #else |
| *pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31); |
| *pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31); |
| #endif |
|
|
| in = *pSrcReal++; |
| #if defined (ARM_MATH_DSP) |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| #else |
| *pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31); |
| *pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31); |
| #endif |
|
|
| in = *pSrcReal++; |
| #if defined (ARM_MATH_DSP) |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| #else |
| *pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31); |
| *pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31); |
| #endif |
|
|
| |
| blkCnt--; |
| } |
|
|
| |
| blkCnt = numSamples % 0x4U; |
|
|
| #else |
|
|
| |
| blkCnt = numSamples; |
|
|
| #endif |
|
|
| while (blkCnt > 0U) |
| { |
| |
| |
|
|
| in = *pSrcReal++; |
| #if defined (ARM_MATH_DSP) |
| |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| *pCmplxDst++ = (__SSAT((q31_t) (((q63_t) *pSrcCmplx++ * in) >> 32), 31) << 1); |
| #else |
| |
| *pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31); |
| *pCmplxDst++ = (q31_t) clip_q63_to_q31(((q63_t) *pSrcCmplx++ * in) >> 31); |
| #endif |
|
|
| |
| blkCnt--; |
| } |
|
|
| } |
| #endif |
|
|
| |
| |
| |
|
|
| #endif |
|
|