GNU Radio Manual and C++ API Reference  3.7.5.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_NEON
52 #include <arm_neon.h>
53 /*!
54  \brief Interleaves the I & Q vector data into the complex vector.
55  \param iBuffer The I buffer data to be interleaved
56  \param qBuffer The Q buffer data to be interleaved
57  \param complexVector The complex output vector
58  \param num_points The number of complex data values to be interleaved
59 */
60 static inline void volk_32f_x2_interleave_32fc_neon(lv_32fc_t* complexVector, const float* iBuffer, const float* qBuffer, unsigned int num_points){
61  unsigned int quarter_points = num_points / 4;
62  unsigned int number;
63  float* complexVectorPtr = (float*) complexVector;
64 
65  float32x4x2_t complex_vec;
66  for(number=0; number < quarter_points; ++number) {
67  complex_vec.val[0] = vld1q_f32(iBuffer);
68  complex_vec.val[1] = vld1q_f32(qBuffer);
69  vst2q_f32(complexVectorPtr, complex_vec);
70  iBuffer += 4;
71  qBuffer += 4;
72  complexVectorPtr += 8;
73  }
74 
75  for(number=quarter_points * 4; number < num_points; ++number) {
76  *complexVectorPtr++ = *iBuffer++;
77  *complexVectorPtr++ = *qBuffer++;
78  }
79 
80 }
81 #endif /* LV_HAVE_NEON */
82 
83 
84 #ifdef LV_HAVE_GENERIC
85 /*!
86  \brief Interleaves the I & Q vector data into the complex vector.
87  \param iBuffer The I buffer data to be interleaved
88  \param qBuffer The Q buffer data to be interleaved
89  \param complexVector The complex output vector
90  \param num_points The number of complex data values to be interleaved
91 */
92 static inline void volk_32f_x2_interleave_32fc_generic(lv_32fc_t* complexVector, const float* iBuffer, const float* qBuffer, unsigned int num_points){
93  float* complexVectorPtr = (float*)complexVector;
94  const float* iBufferPtr = iBuffer;
95  const float* qBufferPtr = qBuffer;
96  unsigned int number;
97 
98  for(number = 0; number < num_points; number++){
99  *complexVectorPtr++ = *iBufferPtr++;
100  *complexVectorPtr++ = *qBufferPtr++;
101  }
102 }
103 #endif /* LV_HAVE_GENERIC */
104 
105 
106 
107 
108 #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