GNU Radio 3.6.4.2 C++ API
|
00001 #ifndef INCLUDED_volk_64f_convert_32f_u_H 00002 #define INCLUDED_volk_64f_convert_32f_u_H 00003 00004 #include <inttypes.h> 00005 #include <stdio.h> 00006 00007 #ifdef LV_HAVE_SSE2 00008 #include <emmintrin.h> 00009 /*! 00010 \brief Converts the double values into float values 00011 \param dVector The converted float vector values 00012 \param fVector The double vector values to be converted 00013 \param num_points The number of points in the two vectors to be converted 00014 */ 00015 static inline void volk_64f_convert_32f_u_sse2(float* outputVector, const double* inputVector, unsigned int num_points){ 00016 unsigned int number = 0; 00017 00018 const unsigned int quarterPoints = num_points / 4; 00019 00020 const double* inputVectorPtr = (const double*)inputVector; 00021 float* outputVectorPtr = outputVector; 00022 __m128 ret, ret2; 00023 __m128d inputVal1, inputVal2; 00024 00025 for(;number < quarterPoints; number++){ 00026 inputVal1 = _mm_loadu_pd(inputVectorPtr); inputVectorPtr += 2; 00027 inputVal2 = _mm_loadu_pd(inputVectorPtr); inputVectorPtr += 2; 00028 00029 ret = _mm_cvtpd_ps(inputVal1); 00030 ret2 = _mm_cvtpd_ps(inputVal2); 00031 00032 ret = _mm_movelh_ps(ret, ret2); 00033 00034 _mm_storeu_ps(outputVectorPtr, ret); 00035 outputVectorPtr += 4; 00036 } 00037 00038 number = quarterPoints * 4; 00039 for(; number < num_points; number++){ 00040 outputVector[number] = (float)(inputVector[number]); 00041 } 00042 } 00043 #endif /* LV_HAVE_SSE2 */ 00044 00045 00046 #ifdef LV_HAVE_GENERIC 00047 /*! 00048 \brief Converts the double values into float values 00049 \param dVector The converted float vector values 00050 \param fVector The double vector values to be converted 00051 \param num_points The number of points in the two vectors to be converted 00052 */ 00053 static inline void volk_64f_convert_32f_generic(float* outputVector, const double* inputVector, unsigned int num_points){ 00054 float* outputVectorPtr = outputVector; 00055 const double* inputVectorPtr = inputVector; 00056 unsigned int number = 0; 00057 00058 for(number = 0; number < num_points; number++){ 00059 *outputVectorPtr++ = ((float)(*inputVectorPtr++)); 00060 } 00061 } 00062 #endif /* LV_HAVE_GENERIC */ 00063 00064 00065 00066 00067 #endif /* INCLUDED_volk_64f_convert_32f_u_H */ 00068 #ifndef INCLUDED_volk_64f_convert_32f_a_H 00069 #define INCLUDED_volk_64f_convert_32f_a_H 00070 00071 #include <inttypes.h> 00072 #include <stdio.h> 00073 00074 #ifdef LV_HAVE_SSE2 00075 #include <emmintrin.h> 00076 /*! 00077 \brief Converts the double values into float values 00078 \param dVector The converted float vector values 00079 \param fVector The double vector values to be converted 00080 \param num_points The number of points in the two vectors to be converted 00081 */ 00082 static inline void volk_64f_convert_32f_a_sse2(float* outputVector, const double* inputVector, unsigned int num_points){ 00083 unsigned int number = 0; 00084 00085 const unsigned int quarterPoints = num_points / 4; 00086 00087 const double* inputVectorPtr = (const double*)inputVector; 00088 float* outputVectorPtr = outputVector; 00089 __m128 ret, ret2; 00090 __m128d inputVal1, inputVal2; 00091 00092 for(;number < quarterPoints; number++){ 00093 inputVal1 = _mm_load_pd(inputVectorPtr); inputVectorPtr += 2; 00094 inputVal2 = _mm_load_pd(inputVectorPtr); inputVectorPtr += 2; 00095 00096 ret = _mm_cvtpd_ps(inputVal1); 00097 ret2 = _mm_cvtpd_ps(inputVal2); 00098 00099 ret = _mm_movelh_ps(ret, ret2); 00100 00101 _mm_store_ps(outputVectorPtr, ret); 00102 outputVectorPtr += 4; 00103 } 00104 00105 number = quarterPoints * 4; 00106 for(; number < num_points; number++){ 00107 outputVector[number] = (float)(inputVector[number]); 00108 } 00109 } 00110 #endif /* LV_HAVE_SSE2 */ 00111 00112 00113 #ifdef LV_HAVE_GENERIC 00114 /*! 00115 \brief Converts the double values into float values 00116 \param dVector The converted float vector values 00117 \param fVector The double vector values to be converted 00118 \param num_points The number of points in the two vectors to be converted 00119 */ 00120 static inline void volk_64f_convert_32f_a_generic(float* outputVector, const double* inputVector, unsigned int num_points){ 00121 float* outputVectorPtr = outputVector; 00122 const double* inputVectorPtr = inputVector; 00123 unsigned int number = 0; 00124 00125 for(number = 0; number < num_points; number++){ 00126 *outputVectorPtr++ = ((float)(*inputVectorPtr++)); 00127 } 00128 } 00129 #endif /* LV_HAVE_GENERIC */ 00130 00131 00132 00133 00134 #endif /* INCLUDED_volk_64f_convert_32f_a_H */