123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- #include "arm_math.h"
- void arm_cmplx_mult_real_q31(
- q31_t * pSrcCmplx,
- q31_t * pSrcReal,
- q31_t * pCmplxDst,
- uint32_t numSamples)
- {
- q31_t inA1;
- #if defined (ARM_MATH_DSP)
-
- uint32_t blkCnt;
- q31_t inA2, inA3, inA4;
- q31_t inB1, inB2;
- q31_t out1, out2, out3, out4;
-
- blkCnt = numSamples >> 2U;
-
- while (blkCnt > 0U)
- {
-
-
-
- inA1 = *pSrcCmplx++;
- inA2 = *pSrcCmplx++;
-
- inB1 = *pSrcReal++;
- inB2 = *pSrcReal++;
-
- inA3 = *pSrcCmplx++;
- inA4 = *pSrcCmplx++;
-
- out1 = ((q63_t) inA1 * inB1) >> 32;
- out2 = ((q63_t) inA2 * inB1) >> 32;
- out3 = ((q63_t) inA3 * inB2) >> 32;
- out4 = ((q63_t) inA4 * inB2) >> 32;
-
- out1 = __SSAT(out1, 31);
- out2 = __SSAT(out2, 31);
- out3 = __SSAT(out3, 31);
- out4 = __SSAT(out4, 31);
-
- out1 = out1 << 1;
- out2 = out2 << 1;
- out3 = out3 << 1;
- out4 = out4 << 1;
-
- *pCmplxDst++ = out1;
- *pCmplxDst++ = out2;
- *pCmplxDst++ = out3;
- *pCmplxDst++ = out4;
-
- inA1 = *pSrcCmplx++;
- inA2 = *pSrcCmplx++;
-
- inB1 = *pSrcReal++;
- inB2 = *pSrcReal++;
-
- inA3 = *pSrcCmplx++;
- inA4 = *pSrcCmplx++;
-
- out1 = ((q63_t) inA1 * inB1) >> 32;
- out2 = ((q63_t) inA2 * inB1) >> 32;
- out3 = ((q63_t) inA3 * inB2) >> 32;
- out4 = ((q63_t) inA4 * inB2) >> 32;
-
- out1 = __SSAT(out1, 31);
- out2 = __SSAT(out2, 31);
- out3 = __SSAT(out3, 31);
- out4 = __SSAT(out4, 31);
-
- out1 = out1 << 1;
- out2 = out2 << 1;
- out3 = out3 << 1;
- out4 = out4 << 1;
-
- *pCmplxDst++ = out1;
- *pCmplxDst++ = out2;
- *pCmplxDst++ = out3;
- *pCmplxDst++ = out4;
-
- blkCnt--;
- }
-
- blkCnt = numSamples % 0x4U;
- while (blkCnt > 0U)
- {
-
-
-
- inA1 = *pSrcCmplx++;
- inA2 = *pSrcCmplx++;
-
- inB1 = *pSrcReal++;
-
- out1 = ((q63_t) inA1 * inB1) >> 32;
- out2 = ((q63_t) inA2 * inB1) >> 32;
-
- out1 = __SSAT(out1, 31);
- out2 = __SSAT(out2, 31);
-
- out1 = out1 << 1;
- out2 = out2 << 1;
-
- *pCmplxDst++ = out1;
- *pCmplxDst++ = out2;
-
- blkCnt--;
- }
- #else
-
- while (numSamples > 0U)
- {
-
-
- inA1 = *pSrcReal++;
-
- *pCmplxDst++ =
- (q31_t) clip_q63_to_q31(((q63_t) * pSrcCmplx++ * inA1) >> 31);
- *pCmplxDst++ =
- (q31_t) clip_q63_to_q31(((q63_t) * pSrcCmplx++ * inA1) >> 31);
-
- numSamples--;
- }
- #endif
- }
|