GNU Radio 3.6.4.2 C++ API
volk_32f_convert_64f.h
Go to the documentation of this file.
00001 #ifndef INCLUDED_volk_32f_convert_64f_u_H
00002 #define INCLUDED_volk_32f_convert_64f_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 float values into double values
00011     \param dVector The converted double vector values
00012     \param fVector The float 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_32f_convert_64f_u_sse2(double* outputVector, const float* inputVector, unsigned int num_points){
00016   unsigned int number = 0;
00017 
00018   const unsigned int quarterPoints = num_points / 4;
00019 
00020   const float* inputVectorPtr = (const float*)inputVector;
00021   double* outputVectorPtr = outputVector;
00022   __m128d ret;
00023   __m128 inputVal;
00024 
00025   for(;number < quarterPoints; number++){
00026     inputVal = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
00027 
00028     ret = _mm_cvtps_pd(inputVal);
00029 
00030     _mm_storeu_pd(outputVectorPtr, ret);
00031     outputVectorPtr += 2;
00032 
00033     inputVal = _mm_movehl_ps(inputVal, inputVal);
00034 
00035     ret = _mm_cvtps_pd(inputVal);
00036 
00037     _mm_storeu_pd(outputVectorPtr, ret);
00038     outputVectorPtr += 2;
00039   }
00040 
00041   number = quarterPoints * 4;
00042   for(; number < num_points; number++){
00043     outputVector[number] = (double)(inputVector[number]);
00044   }
00045 }
00046 #endif /* LV_HAVE_SSE2 */
00047 
00048 
00049 #ifdef LV_HAVE_GENERIC
00050 /*!
00051   \brief Converts the float values into double values
00052   \param dVector The converted double vector values
00053   \param fVector The float vector values to be converted
00054   \param num_points The number of points in the two vectors to be converted
00055 */
00056 static inline void volk_32f_convert_64f_generic(double* outputVector, const float* inputVector, unsigned int num_points){
00057   double* outputVectorPtr = outputVector;
00058   const float* inputVectorPtr = inputVector;
00059   unsigned int number = 0;
00060 
00061   for(number = 0; number < num_points; number++){
00062     *outputVectorPtr++ = ((double)(*inputVectorPtr++));
00063   }
00064 }
00065 #endif /* LV_HAVE_GENERIC */
00066 
00067 
00068 
00069 
00070 #endif /* INCLUDED_volk_32f_convert_64f_u_H */
00071 #ifndef INCLUDED_volk_32f_convert_64f_a_H
00072 #define INCLUDED_volk_32f_convert_64f_a_H
00073 
00074 #include <inttypes.h>
00075 #include <stdio.h>
00076 
00077 #ifdef LV_HAVE_SSE2
00078 #include <emmintrin.h>
00079   /*!
00080     \brief Converts the float values into double values
00081     \param dVector The converted double vector values
00082     \param fVector The float vector values to be converted
00083     \param num_points The number of points in the two vectors to be converted
00084   */
00085 static inline void volk_32f_convert_64f_a_sse2(double* outputVector, const float* inputVector, unsigned int num_points){
00086   unsigned int number = 0;
00087 
00088   const unsigned int quarterPoints = num_points / 4;
00089 
00090   const float* inputVectorPtr = (const float*)inputVector;
00091   double* outputVectorPtr = outputVector;
00092   __m128d ret;
00093   __m128 inputVal;
00094 
00095   for(;number < quarterPoints; number++){
00096     inputVal = _mm_load_ps(inputVectorPtr); inputVectorPtr += 4;
00097 
00098     ret = _mm_cvtps_pd(inputVal);
00099 
00100     _mm_store_pd(outputVectorPtr, ret);
00101     outputVectorPtr += 2;
00102 
00103     inputVal = _mm_movehl_ps(inputVal, inputVal);
00104 
00105     ret = _mm_cvtps_pd(inputVal);
00106 
00107     _mm_store_pd(outputVectorPtr, ret);
00108     outputVectorPtr += 2;
00109   }
00110 
00111   number = quarterPoints * 4;
00112   for(; number < num_points; number++){
00113     outputVector[number] = (double)(inputVector[number]);
00114   }
00115 }
00116 #endif /* LV_HAVE_SSE2 */
00117 
00118 
00119 #ifdef LV_HAVE_GENERIC
00120 /*!
00121   \brief Converts the float values into double values
00122   \param dVector The converted double vector values
00123   \param fVector The float vector values to be converted
00124   \param num_points The number of points in the two vectors to be converted
00125 */
00126 static inline void volk_32f_convert_64f_a_generic(double* outputVector, const float* inputVector, unsigned int num_points){
00127   double* outputVectorPtr = outputVector;
00128   const float* inputVectorPtr = inputVector;
00129   unsigned int number = 0;
00130 
00131   for(number = 0; number < num_points; number++){
00132     *outputVectorPtr++ = ((double)(*inputVectorPtr++));
00133   }
00134 }
00135 #endif /* LV_HAVE_GENERIC */
00136 
00137 
00138 
00139 
00140 #endif /* INCLUDED_volk_32f_convert_64f_a_H */