GNU Radio 3.7.3 C++ API
volk_32f_convert_64f.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_32f_convert_64f_u_H
2 #define INCLUDED_volk_32f_convert_64f_u_H
3 
4 #include <inttypes.h>
5 #include <stdio.h>
6 
7 #ifdef LV_HAVE_SSE2
8 #include <emmintrin.h>
9  /*!
10  \brief Converts the float values into double values
11  \param dVector The converted double vector values
12  \param fVector The float vector values to be converted
13  \param num_points The number of points in the two vectors to be converted
14  */
15 static inline void volk_32f_convert_64f_u_sse2(double* outputVector, const float* inputVector, unsigned int num_points){
16  unsigned int number = 0;
17 
18  const unsigned int quarterPoints = num_points / 4;
19 
20  const float* inputVectorPtr = (const float*)inputVector;
21  double* outputVectorPtr = outputVector;
22  __m128d ret;
23  __m128 inputVal;
24 
25  for(;number < quarterPoints; number++){
26  inputVal = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
27 
28  ret = _mm_cvtps_pd(inputVal);
29 
30  _mm_storeu_pd(outputVectorPtr, ret);
31  outputVectorPtr += 2;
32 
33  inputVal = _mm_movehl_ps(inputVal, inputVal);
34 
35  ret = _mm_cvtps_pd(inputVal);
36 
37  _mm_storeu_pd(outputVectorPtr, ret);
38  outputVectorPtr += 2;
39  }
40 
41  number = quarterPoints * 4;
42  for(; number < num_points; number++){
43  outputVector[number] = (double)(inputVector[number]);
44  }
45 }
46 #endif /* LV_HAVE_SSE2 */
47 
48 
49 #ifdef LV_HAVE_GENERIC
50 /*!
51  \brief Converts the float values into double values
52  \param dVector The converted double vector values
53  \param fVector The float vector values to be converted
54  \param num_points The number of points in the two vectors to be converted
55 */
56 static inline void volk_32f_convert_64f_generic(double* outputVector, const float* inputVector, unsigned int num_points){
57  double* outputVectorPtr = outputVector;
58  const float* inputVectorPtr = inputVector;
59  unsigned int number = 0;
60 
61  for(number = 0; number < num_points; number++){
62  *outputVectorPtr++ = ((double)(*inputVectorPtr++));
63  }
64 }
65 #endif /* LV_HAVE_GENERIC */
66 
67 
68 
69 
70 #endif /* INCLUDED_volk_32f_convert_64f_u_H */
71 #ifndef INCLUDED_volk_32f_convert_64f_a_H
72 #define INCLUDED_volk_32f_convert_64f_a_H
73 
74 #include <inttypes.h>
75 #include <stdio.h>
76 
77 #ifdef LV_HAVE_SSE2
78 #include <emmintrin.h>
79  /*!
80  \brief Converts the float values into double values
81  \param dVector The converted double vector values
82  \param fVector The float vector values to be converted
83  \param num_points The number of points in the two vectors to be converted
84  */
85 static inline void volk_32f_convert_64f_a_sse2(double* outputVector, const float* inputVector, unsigned int num_points){
86  unsigned int number = 0;
87 
88  const unsigned int quarterPoints = num_points / 4;
89 
90  const float* inputVectorPtr = (const float*)inputVector;
91  double* outputVectorPtr = outputVector;
92  __m128d ret;
93  __m128 inputVal;
94 
95  for(;number < quarterPoints; number++){
96  inputVal = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
97 
98  ret = _mm_cvtps_pd(inputVal);
99 
100  _mm_store_pd(outputVectorPtr, ret);
101  outputVectorPtr += 2;
102 
103  inputVal = _mm_movehl_ps(inputVal, inputVal);
104 
105  ret = _mm_cvtps_pd(inputVal);
106 
107  _mm_store_pd(outputVectorPtr, ret);
108  outputVectorPtr += 2;
109  }
110 
111  number = quarterPoints * 4;
112  for(; number < num_points; number++){
113  outputVector[number] = (double)(inputVector[number]);
114  }
115 }
116 #endif /* LV_HAVE_SSE2 */
117 
118 
119 #ifdef LV_HAVE_GENERIC
120 /*!
121  \brief Converts the float values into double values
122  \param dVector The converted double vector values
123  \param fVector The float vector values to be converted
124  \param num_points The number of points in the two vectors to be converted
125 */
126 static inline void volk_32f_convert_64f_a_generic(double* outputVector, const float* inputVector, unsigned int num_points){
127  double* outputVectorPtr = outputVector;
128  const float* inputVectorPtr = inputVector;
129  unsigned int number = 0;
130 
131  for(number = 0; number < num_points; number++){
132  *outputVectorPtr++ = ((double)(*inputVectorPtr++));
133  }
134 }
135 #endif /* LV_HAVE_GENERIC */
136 
137 
138 
139 
140 #endif /* INCLUDED_volk_32f_convert_64f_a_H */