GNU Radio 3.6.1 C++ API
volk_64f_convert_32f_a.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_64f_convert_32f_a_H
2 #define INCLUDED_volk_64f_convert_32f_a_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 double values into float values
11  \param dVector The converted float vector values
12  \param fVector The double 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_64f_convert_32f_a_sse2(float* outputVector, const double* inputVector, unsigned int num_points){
16  unsigned int number = 0;
17 
18  const unsigned int quarterPoints = num_points / 4;
19 
20  const double* inputVectorPtr = (const double*)inputVector;
21  float* outputVectorPtr = outputVector;
22  __m128 ret, ret2;
23  __m128d inputVal1, inputVal2;
24 
25  for(;number < quarterPoints; number++){
26  inputVal1 = _mm_load_pd(inputVectorPtr); inputVectorPtr += 2;
27  inputVal2 = _mm_load_pd(inputVectorPtr); inputVectorPtr += 2;
28 
29  ret = _mm_cvtpd_ps(inputVal1);
30  ret2 = _mm_cvtpd_ps(inputVal2);
31 
32  ret = _mm_movelh_ps(ret, ret2);
33 
34  _mm_store_ps(outputVectorPtr, ret);
35  outputVectorPtr += 4;
36  }
37 
38  number = quarterPoints * 4;
39  for(; number < num_points; number++){
40  outputVector[number] = (float)(inputVector[number]);
41  }
42 }
43 #endif /* LV_HAVE_SSE2 */
44 
45 
46 #ifdef LV_HAVE_GENERIC
47 /*!
48  \brief Converts the double values into float values
49  \param dVector The converted float vector values
50  \param fVector The double vector values to be converted
51  \param num_points The number of points in the two vectors to be converted
52 */
53 static inline void volk_64f_convert_32f_a_generic(float* outputVector, const double* inputVector, unsigned int num_points){
54  float* outputVectorPtr = outputVector;
55  const double* inputVectorPtr = inputVector;
56  unsigned int number = 0;
57 
58  for(number = 0; number < num_points; number++){
59  *outputVectorPtr++ = ((float)(*inputVectorPtr++));
60  }
61 }
62 #endif /* LV_HAVE_GENERIC */
63 
64 
65 
66 
67 #endif /* INCLUDED_volk_64f_convert_32f_a_H */