summaryrefslogtreecommitdiff
path: root/fw/cdc-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ComplexMathFunctions/cmplx_mult_real.c
diff options
context:
space:
mode:
authorjaseg <git@jaseg.net>2020-10-14 12:49:08 +0200
committerjaseg <git@jaseg.net>2020-10-14 12:49:08 +0200
commit3559d845d29272050d4d44e18e0bb84e676e48ff (patch)
treed8d6ce99e40b1a3745d76f0c9aac2f10e7286481 /fw/cdc-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ComplexMathFunctions/cmplx_mult_real.c
parent491b2acaaa9db1798445f3e174e68ada7424fc33 (diff)
parent6ab94e0b318884bbcb95e2ea3835f951502e1d99 (diff)
downloadminikbd-3559d845d29272050d4d44e18e0bb84e676e48ff.tar.gz
minikbd-3559d845d29272050d4d44e18e0bb84e676e48ff.tar.bz2
minikbd-3559d845d29272050d4d44e18e0bb84e676e48ff.zip
Merge firmware and pcb repos
Diffstat (limited to 'fw/cdc-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ComplexMathFunctions/cmplx_mult_real.c')
-rw-r--r--fw/cdc-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ComplexMathFunctions/cmplx_mult_real.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/fw/cdc-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ComplexMathFunctions/cmplx_mult_real.c b/fw/cdc-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ComplexMathFunctions/cmplx_mult_real.c
new file mode 100644
index 0000000..dc4928e
--- /dev/null
+++ b/fw/cdc-dials/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/RefLibs/src/ComplexMathFunctions/cmplx_mult_real.c
@@ -0,0 +1,52 @@
+#include "ref.h"
+
+void ref_cmplx_mult_real_f32(
+ float32_t * pSrcCmplx,
+ float32_t * pSrcReal,
+ float32_t * pCmplxDst,
+ uint32_t numSamples)
+{
+ uint32_t i;
+
+ for(i=0;i<numSamples;i++)
+ {
+ pCmplxDst[2*i+0] = pSrcCmplx[2*i+0] * pSrcReal[i];
+ pCmplxDst[2*i+1] = pSrcCmplx[2*i+1] * pSrcReal[i];
+ }
+}
+
+void ref_cmplx_mult_real_q31(
+ q31_t * pSrcCmplx,
+ q31_t * pSrcReal,
+ q31_t * pCmplxDst,
+ uint32_t numSamples)
+{
+ uint32_t i;
+ q31_t tempR, tempI;
+
+ for(i=0;i<numSamples;i++)
+ {
+ tempR = ((q63_t) pSrcCmplx[2*i+0] * pSrcReal[i]) >> 32;
+ tempI = ((q63_t) pSrcCmplx[2*i+1] * pSrcReal[i]) >> 32;
+ pCmplxDst[2*i+0] = ref_sat_n(tempR, 31) << 1;
+ pCmplxDst[2*i+1] = ref_sat_n(tempI, 31) << 1;
+ }
+}
+
+void ref_cmplx_mult_real_q15(
+ q15_t * pSrcCmplx,
+ q15_t * pSrcReal,
+ q15_t * pCmplxDst,
+ uint32_t numSamples)
+{
+ uint32_t i;
+ q31_t tempR, tempI;
+
+ for(i=0;i<numSamples;i++)
+ {
+ tempR = ((q31_t) pSrcCmplx[2*i+0] * pSrcReal[i]) >> 15;
+ tempI = ((q31_t) pSrcCmplx[2*i+1] * pSrcReal[i]) >> 15;
+ pCmplxDst[2*i+0] = ref_sat_q15(tempR);
+ pCmplxDst[2*i+1] = ref_sat_q15(tempI);
+ }
+}