root / volk / include / volk / volk_32f_convert_64f_ua16.h @ d486ff4b
History | View | Annotate | Download (2 kB)
| 1 | #ifndef INCLUDED_volk_32f_convert_64f_ua16_H
|
|---|---|
| 2 | #define INCLUDED_volk_32f_convert_64f_ua16_H
|
| 3 | |
| 4 | #include <inttypes.h> |
| 5 | #include <stdio.h> |
| 6 | |
| 7 | #if 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_ua16_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_ua16_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_ua16_H */ |