root / volk / include / volk / volk_32f_convert_64f_u.h @ ee0ed0b7
History | View | Annotate | Download (2 kB)
| 1 | e3600f59 | Nick Foster | #ifndef INCLUDED_volk_32f_convert_64f_u_H
|
|---|---|---|---|
| 2 | e3600f59 | Nick Foster | #define INCLUDED_volk_32f_convert_64f_u_H
|
| 3 | 23914465 | Tom Rondeau | |
| 4 | 23914465 | Tom Rondeau | #include <inttypes.h> |
| 5 | 23914465 | Tom Rondeau | #include <stdio.h> |
| 6 | 23914465 | Tom Rondeau | |
| 7 | cef9e33e | Nick Foster | #ifdef LV_HAVE_SSE2
|
| 8 | 23914465 | Tom Rondeau | #include <emmintrin.h> |
| 9 | 23914465 | Tom Rondeau | /*!
|
| 10 | 23914465 | Tom Rondeau | \brief Converts the float values into double values |
| 11 | 23914465 | Tom Rondeau | \param dVector The converted double vector values |
| 12 | 23914465 | Tom Rondeau | \param fVector The float vector values to be converted |
| 13 | 23914465 | Tom Rondeau | \param num_points The number of points in the two vectors to be converted |
| 14 | 23914465 | Tom Rondeau | */ |
| 15 | e3600f59 | Nick Foster | static inline void volk_32f_convert_64f_u_sse2(double* outputVector, const float* inputVector, unsigned int num_points){ |
| 16 | 23914465 | Tom Rondeau | unsigned int number = 0; |
| 17 | 23914465 | Tom Rondeau | |
| 18 | 23914465 | Tom Rondeau | const unsigned int quarterPoints = num_points / 4; |
| 19 | f919f9dc | Tom Rondeau | |
| 20 | 23914465 | Tom Rondeau | const float* inputVectorPtr = (const float*)inputVector; |
| 21 | 23914465 | Tom Rondeau | double* outputVectorPtr = outputVector;
|
| 22 | 23914465 | Tom Rondeau | __m128d ret; |
| 23 | 23914465 | Tom Rondeau | __m128 inputVal; |
| 24 | 23914465 | Tom Rondeau | |
| 25 | 23914465 | Tom Rondeau | for(;number < quarterPoints; number++){
|
| 26 | 23914465 | Tom Rondeau | inputVal = _mm_loadu_ps(inputVectorPtr); inputVectorPtr += 4;
|
| 27 | f919f9dc | Tom Rondeau | |
| 28 | 23914465 | Tom Rondeau | ret = _mm_cvtps_pd(inputVal); |
| 29 | 23914465 | Tom Rondeau | |
| 30 | 23914465 | Tom Rondeau | _mm_storeu_pd(outputVectorPtr, ret); |
| 31 | 23914465 | Tom Rondeau | outputVectorPtr += 2;
|
| 32 | 23914465 | Tom Rondeau | |
| 33 | 23914465 | Tom Rondeau | inputVal = _mm_movehl_ps(inputVal, inputVal); |
| 34 | 23914465 | Tom Rondeau | |
| 35 | 23914465 | Tom Rondeau | ret = _mm_cvtps_pd(inputVal); |
| 36 | 23914465 | Tom Rondeau | |
| 37 | 23914465 | Tom Rondeau | _mm_storeu_pd(outputVectorPtr, ret); |
| 38 | 23914465 | Tom Rondeau | outputVectorPtr += 2;
|
| 39 | 23914465 | Tom Rondeau | } |
| 40 | 23914465 | Tom Rondeau | |
| 41 | f919f9dc | Tom Rondeau | number = quarterPoints * 4;
|
| 42 | 23914465 | Tom Rondeau | for(; number < num_points; number++){
|
| 43 | 23914465 | Tom Rondeau | outputVector[number] = (double)(inputVector[number]);
|
| 44 | 23914465 | Tom Rondeau | } |
| 45 | 23914465 | Tom Rondeau | } |
| 46 | 23914465 | Tom Rondeau | #endif /* LV_HAVE_SSE2 */ |
| 47 | 23914465 | Tom Rondeau | |
| 48 | 23914465 | Tom Rondeau | |
| 49 | 23914465 | Tom Rondeau | #ifdef LV_HAVE_GENERIC
|
| 50 | 23914465 | Tom Rondeau | /*!
|
| 51 | 23914465 | Tom Rondeau | \brief Converts the float values into double values |
| 52 | 23914465 | Tom Rondeau | \param dVector The converted double vector values |
| 53 | 23914465 | Tom Rondeau | \param fVector The float vector values to be converted |
| 54 | 23914465 | Tom Rondeau | \param num_points The number of points in the two vectors to be converted |
| 55 | 23914465 | Tom Rondeau | */ |
| 56 | e3600f59 | Nick Foster | static inline void volk_32f_convert_64f_u_generic(double* outputVector, const float* inputVector, unsigned int num_points){ |
| 57 | 23914465 | Tom Rondeau | double* outputVectorPtr = outputVector;
|
| 58 | 23914465 | Tom Rondeau | const float* inputVectorPtr = inputVector; |
| 59 | 23914465 | Tom Rondeau | unsigned int number = 0; |
| 60 | 23914465 | Tom Rondeau | |
| 61 | 23914465 | Tom Rondeau | for(number = 0; number < num_points; number++){ |
| 62 | 23914465 | Tom Rondeau | *outputVectorPtr++ = ((double)(*inputVectorPtr++));
|
| 63 | 23914465 | Tom Rondeau | } |
| 64 | 23914465 | Tom Rondeau | } |
| 65 | 23914465 | Tom Rondeau | #endif /* LV_HAVE_GENERIC */ |
| 66 | 23914465 | Tom Rondeau | |
| 67 | 23914465 | Tom Rondeau | |
| 68 | 23914465 | Tom Rondeau | |
| 69 | 23914465 | Tom Rondeau | |
| 70 | e3600f59 | Nick Foster | #endif /* INCLUDED_volk_32f_convert_64f_u_H */ |