GNU Radio 3.6.5 C++ API

volk_64f_convert_32f_u.h

Go to the documentation of this file.
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_u_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 */