GNU Radio 3.6.5 C++ API

volk_32f_x2_interleave_32fc_a.h

Go to the documentation of this file.
00001 #ifndef INCLUDED_volk_32f_x2_interleave_32fc_a_H
00002 #define INCLUDED_volk_32f_x2_interleave_32fc_a_H
00003 
00004 #include <inttypes.h>
00005 #include <stdio.h>
00006 
00007 #ifdef LV_HAVE_SSE
00008 #include <xmmintrin.h>
00009 /*!
00010   \brief Interleaves the I & Q vector data into the complex vector
00011   \param iBuffer The I buffer data to be interleaved
00012   \param qBuffer The Q buffer data to be interleaved
00013   \param complexVector The complex output vector
00014   \param num_points The number of complex data values to be interleaved
00015 */
00016 static inline void volk_32f_x2_interleave_32fc_a_sse(lv_32fc_t* complexVector, const float* iBuffer, const float* qBuffer, unsigned int num_points){
00017   unsigned int number = 0;
00018   float* complexVectorPtr = (float*)complexVector;
00019   const float* iBufferPtr = iBuffer;
00020   const float* qBufferPtr = qBuffer;
00021 
00022   const uint64_t quarterPoints = num_points / 4;
00023 
00024   __m128 iValue, qValue, cplxValue;
00025   for(;number < quarterPoints; number++){
00026     iValue = _mm_load_ps(iBufferPtr);
00027     qValue = _mm_load_ps(qBufferPtr);
00028 
00029     // Interleaves the lower two values in the i and q variables into one buffer
00030     cplxValue = _mm_unpacklo_ps(iValue, qValue);
00031     _mm_store_ps(complexVectorPtr, cplxValue);
00032     complexVectorPtr += 4;
00033 
00034     // Interleaves the upper two values in the i and q variables into one buffer
00035     cplxValue = _mm_unpackhi_ps(iValue, qValue);
00036     _mm_store_ps(complexVectorPtr, cplxValue);
00037     complexVectorPtr += 4;
00038 
00039     iBufferPtr += 4;
00040     qBufferPtr += 4;
00041   }
00042 
00043   number = quarterPoints * 4;
00044   for(; number < num_points; number++){
00045     *complexVectorPtr++ = *iBufferPtr++;
00046     *complexVectorPtr++ = *qBufferPtr++;
00047   }
00048 }
00049 #endif /* LV_HAVE_SSE */
00050 
00051 #ifdef LV_HAVE_GENERIC
00052 /*!
00053   \brief Interleaves the I & Q vector data into the complex vector.
00054   \param iBuffer The I buffer data to be interleaved
00055   \param qBuffer The Q buffer data to be interleaved
00056   \param complexVector The complex output vector
00057   \param num_points The number of complex data values to be interleaved
00058 */
00059 static inline void volk_32f_x2_interleave_32fc_a_generic(lv_32fc_t* complexVector, const float* iBuffer, const float* qBuffer, unsigned int num_points){
00060   float* complexVectorPtr = (float*)complexVector;
00061   const float* iBufferPtr = iBuffer;
00062   const float* qBufferPtr = qBuffer;
00063   unsigned int number;
00064 
00065   for(number = 0; number < num_points; number++){
00066     *complexVectorPtr++ = *iBufferPtr++;
00067     *complexVectorPtr++ = *qBufferPtr++;
00068   }
00069 }
00070 #endif /* LV_HAVE_GENERIC */
00071 
00072 
00073 
00074 
00075 #endif /* INCLUDED_volk_32f_x2_interleave_32fc_a_H */