Subversion Repositories canSerial

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. #include "ref.h"
  2.  
  3. void ref_cmplx_mult_real_f32(
  4.   float32_t * pSrcCmplx,
  5.   float32_t * pSrcReal,
  6.   float32_t * pCmplxDst,
  7.   uint32_t numSamples)
  8. {
  9.         uint32_t i;
  10.        
  11.         for(i=0;i<numSamples;i++)
  12.         {
  13.                 pCmplxDst[2*i+0] = pSrcCmplx[2*i+0] * pSrcReal[i];
  14.                 pCmplxDst[2*i+1] = pSrcCmplx[2*i+1] * pSrcReal[i];
  15.         }
  16. }
  17.  
  18. void ref_cmplx_mult_real_q31(
  19.   q31_t * pSrcCmplx,
  20.   q31_t * pSrcReal,
  21.   q31_t * pCmplxDst,
  22.   uint32_t numSamples)
  23. {
  24.         uint32_t i;
  25.         q31_t tempR, tempI;
  26.        
  27.         for(i=0;i<numSamples;i++)
  28.         {
  29.                 tempR = ((q63_t) pSrcCmplx[2*i+0] * pSrcReal[i]) >> 32;
  30.                 tempI = ((q63_t) pSrcCmplx[2*i+1] * pSrcReal[i]) >> 32;
  31.                 pCmplxDst[2*i+0] = ref_sat_n(tempR, 31) << 1;
  32.                 pCmplxDst[2*i+1] = ref_sat_n(tempI, 31) << 1;
  33.         }
  34. }
  35.  
  36. void ref_cmplx_mult_real_q15(
  37.   q15_t * pSrcCmplx,
  38.   q15_t * pSrcReal,
  39.   q15_t * pCmplxDst,
  40.   uint32_t numSamples)
  41. {
  42.         uint32_t i;
  43.         q31_t tempR, tempI;
  44.        
  45.         for(i=0;i<numSamples;i++)
  46.         {
  47.                 tempR = ((q31_t) pSrcCmplx[2*i+0] * pSrcReal[i]) >> 15;
  48.                 tempI = ((q31_t) pSrcCmplx[2*i+1] * pSrcReal[i]) >> 15;
  49.                 pCmplxDst[2*i+0] = ref_sat_q15(tempR);
  50.                 pCmplxDst[2*i+1] = ref_sat_q15(tempI);
  51.         }
  52. }
  53.