GNU Radio 3.6.5 C++ API

volk_32fc_deinterleave_64f_x2_a.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_volk_32fc_deinterleave_64f_x2_a_H
00002 #define INCLUDED_volk_32fc_deinterleave_64f_x2_a_H
00003 
00004 #include <inttypes.h>
00005 #include <stdio.h>
00006 
00007 #ifdef LV_HAVE_SSE2
00008 #include <emmintrin.h>
00009 /*!
00010   \brief Deinterleaves the lv_32fc_t vector into double I & Q vector data
00011   \param complexVector The complex input vector
00012   \param iBuffer The I buffer output data
00013   \param qBuffer The Q buffer output data
00014   \param num_points The number of complex data values to be deinterleaved
00015 */
00016 static inline void volk_32fc_deinterleave_64f_x2_a_sse2(double* iBuffer, double* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
00017   unsigned int number = 0;
00018 
00019     const float* complexVectorPtr = (float*)complexVector;
00020     double* iBufferPtr = iBuffer;
00021     double* qBufferPtr = qBuffer;
00022 
00023     const unsigned int halfPoints = num_points / 2;
00024     __m128 cplxValue, fVal;
00025     __m128d dVal;
00026 
00027     for(;number < halfPoints; number++){
00028 
00029       cplxValue = _mm_load_ps(complexVectorPtr);
00030       complexVectorPtr += 4;
00031 
00032       // Arrange in i1i2i1i2 format
00033       fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(2,0,2,0));
00034       dVal = _mm_cvtps_pd(fVal);
00035       _mm_store_pd(iBufferPtr, dVal);
00036 
00037       // Arrange in q1q2q1q2 format
00038       fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(3,1,3,1));
00039       dVal = _mm_cvtps_pd(fVal);
00040       _mm_store_pd(qBufferPtr, dVal);
00041 
00042       iBufferPtr += 2;
00043       qBufferPtr += 2;
00044     }
00045 
00046     number = halfPoints * 2;
00047     for(; number < num_points; number++){
00048       *iBufferPtr++ = *complexVectorPtr++;
00049       *qBufferPtr++ = *complexVectorPtr++;
00050     }
00051 }
00052 #endif /* LV_HAVE_SSE */
00053 
00054 #ifdef LV_HAVE_GENERIC
00055 /*!
00056   \brief Deinterleaves the lv_32fc_t vector into double I & Q vector data
00057   \param complexVector The complex input vector
00058   \param iBuffer The I buffer output data
00059   \param qBuffer The Q buffer output data
00060   \param num_points The number of complex data values to be deinterleaved
00061 */
00062 static inline void volk_32fc_deinterleave_64f_x2_a_generic(double* iBuffer, double* qBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
00063   unsigned int number = 0;
00064   const float* complexVectorPtr = (float*)complexVector;
00065   double* iBufferPtr = iBuffer;
00066   double* qBufferPtr = qBuffer;
00067 
00068   for(number = 0; number < num_points; number++){
00069     *iBufferPtr++ = (double)*complexVectorPtr++;
00070     *qBufferPtr++ = (double)*complexVectorPtr++;
00071   }
00072 }
00073 #endif /* LV_HAVE_GENERIC */
00074 
00075 
00076 
00077 
00078 #endif /* INCLUDED_volk_32fc_deinterleave_64f_x2_a_H */