GNU Radio Manual and C++ API Reference  3.7.6.1
The Free & Open Software Radio Ecosystem
volk_32fc_deinterleave_real_64f.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_64f_a_H
24 #define INCLUDED_volk_32fc_deinterleave_real_64f_a_H
25 
26 #include <inttypes.h>
27 #include <stdio.h>
28 
29 #ifdef LV_HAVE_SSE2
30 #include <emmintrin.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_64f_a_sse2(double* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
38  unsigned int number = 0;
39 
40  const float* complexVectorPtr = (float*)complexVector;
41  double* iBufferPtr = iBuffer;
42 
43  const unsigned int halfPoints = num_points / 2;
44  __m128 cplxValue, fVal;
45  __m128d dVal;
46  for(;number < halfPoints; number++){
47 
48  cplxValue = _mm_load_ps(complexVectorPtr);
49  complexVectorPtr += 4;
50 
51  // Arrange in i1i2i1i2 format
52  fVal = _mm_shuffle_ps(cplxValue, cplxValue, _MM_SHUFFLE(2,0,2,0));
53  dVal = _mm_cvtps_pd(fVal);
54  _mm_store_pd(iBufferPtr, dVal);
55 
56  iBufferPtr += 2;
57  }
58 
59  number = halfPoints * 2;
60  for(; number < num_points; number++){
61  *iBufferPtr++ = (double)*complexVectorPtr++;
62  complexVectorPtr++;
63  }
64 }
65 #endif /* LV_HAVE_SSE */
66 
67 #ifdef LV_HAVE_GENERIC
68 /*!
69  \brief Deinterleaves the complex vector into I vector data
70  \param complexVector The complex input vector
71  \param iBuffer The I buffer output data
72  \param num_points The number of complex data values to be deinterleaved
73 */
74 static inline void volk_32fc_deinterleave_real_64f_generic(double* iBuffer, const lv_32fc_t* complexVector, unsigned int num_points){
75  unsigned int number = 0;
76  const float* complexVectorPtr = (float*)complexVector;
77  double* iBufferPtr = iBuffer;
78  for(number = 0; number < num_points; number++){
79  *iBufferPtr++ = (double)*complexVectorPtr++;
80  complexVectorPtr++;
81  }
82 }
83 #endif /* LV_HAVE_GENERIC */
84 
85 
86 
87 
88 #endif /* INCLUDED_volk_32fc_deinterleave_real_64f_a_H */
float complex lv_32fc_t
Definition: volk_complex.h:56