GNU Radio Manual and C++ API Reference  3.7.6.1
The Free & Open Software Radio Ecosystem
volk_32fc_deinterleave_real_32f.h
Go to the documentation of this file.
1 /* -*- c++ -*- */
2 /*
3  * Copyright 2014 Free Software Foundation, Inc.
4  *
5  * This file is part of GNU Radio
6  *
7  * GNU Radio is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3, or (at your option)
10  * any later version.
11  *
12  * GNU Radio is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with GNU Radio; see the file COPYING. If not, write to
19  * the Free Software Foundation, Inc., 51 Franklin Street,
20  * Boston, MA 02110-1301, USA.
21  */
22 
23 #ifndef INCLUDED_volk_32fc_deinterleave_real_32f_a_H
24 #define INCLUDED_volk_32fc_deinterleave_real_32f_a_H
25 
26 #include <inttypes.h>
27 #include <stdio.h>
28 
29 #ifdef LV_HAVE_SSE
30 #include <xmmintrin.h>
31 /*!
32  \brief Deinterleaves the complex vector into I vector data
33  \param complexVector The complex input vector
34  \param iBuffer The I buffer output data
35  \param num_points The number of complex data values to be deinterleaved
36 */
37 static inline void volk_32fc_deinterleave_real_32f_a_sse(float* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
38  unsigned int number = 0;
39  const unsigned int quarterPoints = num_points / 4;
40 
41  const float* complexVectorPtr = (const float*)complexVector;
42  float* iBufferPtr = iBuffer;
43 
44  __m128 cplxValue1, cplxValue2, iValue;
45  for(;number < quarterPoints; number++){
46 
47  cplxValue1 = _mm_load_ps(complexVectorPtr);
48  complexVectorPtr += 4;
49 
50  cplxValue2 = _mm_load_ps(complexVectorPtr);
51  complexVectorPtr += 4;
52 
53  // Arrange in i1i2i3i4 format
54  iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
55 
56  _mm_store_ps(iBufferPtr, iValue);
57 
58  iBufferPtr += 4;
59  }
60 
61  number = quarterPoints * 4;
62  for(; number < num_points; number++){
63  *iBufferPtr++ = *complexVectorPtr++;
64  complexVectorPtr++;
65  }
66 }
67 #endif /* LV_HAVE_SSE */
68 
69 #ifdef LV_HAVE_GENERIC
70 /*!
71  \brief Deinterleaves the complex vector into I vector data
72  \param complexVector The complex input vector
73  \param iBuffer The I buffer output data
74  \param num_points The number of complex data values to be deinterleaved
75 */
76 static inline void volk_32fc_deinterleave_real_32f_generic(float* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
77  unsigned int number = 0;
78  const float* complexVectorPtr = (float*)complexVector;
79  float* iBufferPtr = iBuffer;
80  for(number = 0; number < num_points; number++){
81  *iBufferPtr++ = *complexVectorPtr++;
82  complexVectorPtr++;
83  }
84 }
85 #endif /* LV_HAVE_GENERIC */
86 
87 #ifdef LV_HAVE_NEON
88 #include <arm_neon.h>
89 /*!
90  \brief Deinterleaves the complex vector into I vector data
91  \param complexVector The complex input vector
92  \param iBuffer The I buffer output data
93  \param num_points The number of complex data values to be deinterleaved
94 */
95 static inline void volk_32fc_deinterleave_real_32f_neon(float* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
96  unsigned int number = 0;
97  unsigned int quarter_points = num_points / 4;
98  const float* complexVectorPtr = (float*)complexVector;
99  float* iBufferPtr = iBuffer;
100  float32x4x2_t complexInput;
101 
102  for(number = 0; number < quarter_points; number++){
103  complexInput = vld2q_f32(complexVectorPtr);
104  vst1q_f32( iBufferPtr, complexInput.val[0] );
105  complexVectorPtr += 8;
106  iBufferPtr += 4;
107  }
108 
109  for(number = quarter_points*4; number < num_points; number++){
110  *iBufferPtr++ = *complexVectorPtr++;
111  complexVectorPtr++;
112  }
113 }
114 #endif /* LV_HAVE_NEON */
115 
116 #endif /* INCLUDED_volk_32fc_deinterleave_real_32f_a_H */
float complex lv_32fc_t
Definition: volk_complex.h:56