GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
volk_32f_x2_interleave_32fc.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_32f_x2_interleave_32fc_a_H
2 #define INCLUDED_volk_32f_x2_interleave_32fc_a_H
3 
4 #include <inttypes.h>
5 #include <stdio.h>
6 
7 #ifdef LV_HAVE_SSE
8 #include <xmmintrin.h>
9 /*!
10  \brief Interleaves the I & Q vector data into the complex vector
11  \param iBuffer The I buffer data to be interleaved
12  \param qBuffer The Q buffer data to be interleaved
13  \param complexVector The complex output vector
14  \param num_points The number of complex data values to be interleaved
15 */
16 static inline void volk_32f_x2_interleave_32fc_a_sse(lv_32fc_t* complexVector, const float* iBuffer, const float* qBuffer, unsigned int num_points){
17  unsigned int number = 0;
18  float* complexVectorPtr = (float*)complexVector;
19  const float* iBufferPtr = iBuffer;
20  const float* qBufferPtr = qBuffer;
21 
22  const uint64_t quarterPoints = num_points / 4;
23 
24  __m128 iValue, qValue, cplxValue;
25  for(;number < quarterPoints; number++){
26  iValue = _mm_load_ps(iBufferPtr);
27  qValue = _mm_load_ps(qBufferPtr);
28 
29  // Interleaves the lower two values in the i and q variables into one buffer
30  cplxValue = _mm_unpacklo_ps(iValue, qValue);
31  _mm_store_ps(complexVectorPtr, cplxValue);
32  complexVectorPtr += 4;
33 
34  // Interleaves the upper two values in the i and q variables into one buffer
35  cplxValue = _mm_unpackhi_ps(iValue, qValue);
36  _mm_store_ps(complexVectorPtr, cplxValue);
37  complexVectorPtr += 4;
38 
39  iBufferPtr += 4;
40  qBufferPtr += 4;
41  }
42 
43  number = quarterPoints * 4;
44  for(; number < num_points; number++){
45  *complexVectorPtr++ = *iBufferPtr++;
46  *complexVectorPtr++ = *qBufferPtr++;
47  }
48 }
49 #endif /* LV_HAVE_SSE */
50 
51 #ifdef LV_HAVE_GENERIC
52 /*!
53  \brief Interleaves the I & Q vector data into the complex vector.
54  \param iBuffer The I buffer data to be interleaved
55  \param qBuffer The Q buffer data to be interleaved
56  \param complexVector The complex output vector
57  \param num_points The number of complex data values to be interleaved
58 */
59 static inline void volk_32f_x2_interleave_32fc_generic(lv_32fc_t* complexVector, const float* iBuffer, const float* qBuffer, unsigned int num_points){
60  float* complexVectorPtr = (float*)complexVector;
61  const float* iBufferPtr = iBuffer;
62  const float* qBufferPtr = qBuffer;
63  unsigned int number;
64 
65  for(number = 0; number < num_points; number++){
66  *complexVectorPtr++ = *iBufferPtr++;
67  *complexVectorPtr++ = *qBufferPtr++;
68  }
69 }
70 #endif /* LV_HAVE_GENERIC */
71 
72 
73 
74 
75 #endif /* INCLUDED_volk_32f_x2_interleave_32fc_a_H */
unsigned __int64 uint64_t
Definition: stdint.h:90
float complex lv_32fc_t
Definition: volk_complex.h:56