~ubuntu-branches/ubuntu/trusty/gnuradio/trusty-updates

« back to all changes in this revision

Viewing changes to volk/include/volk/volk_64f_convert_32f_u.h

  • Committer: Package Import Robot
  • Author(s): A. Maitland Bottoms
  • Date: 2012-02-26 21:26:16 UTC
  • mfrom: (1.1.4)
  • Revision ID: package-import@ubuntu.com-20120226212616-vsfkbi1158xshdql
Tags: 3.5.1-1
* new upstream version, re-packaged from scratch with modern tools
    closes: #642716, #645332, #394849, #616832, #590048, #642580,
    #647018, #557050, #559640, #631863
* CMake build

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef INCLUDED_volk_64f_convert_32f_u_H
 
2
#define INCLUDED_volk_64f_convert_32f_u_H
 
3
 
 
4
#include <inttypes.h>
 
5
#include <stdio.h>
 
6
 
 
7
#ifdef LV_HAVE_SSE2
 
8
#include <emmintrin.h>
 
9
  /*!
 
10
    \brief Converts the double values into float values
 
11
    \param dVector The converted float vector values
 
12
    \param fVector The double 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_64f_convert_32f_u_sse2(float* outputVector, const double* inputVector, unsigned int num_points){
 
16
  unsigned int number = 0;
 
17
 
 
18
  const unsigned int quarterPoints = num_points / 4;
 
19
    
 
20
  const double* inputVectorPtr = (const double*)inputVector;
 
21
  float* outputVectorPtr = outputVector;
 
22
  __m128 ret, ret2;
 
23
  __m128d inputVal1, inputVal2;
 
24
 
 
25
  for(;number < quarterPoints; number++){
 
26
    inputVal1 = _mm_loadu_pd(inputVectorPtr); inputVectorPtr += 2;
 
27
    inputVal2 = _mm_loadu_pd(inputVectorPtr); inputVectorPtr += 2;
 
28
 
 
29
    ret = _mm_cvtpd_ps(inputVal1);
 
30
    ret2 = _mm_cvtpd_ps(inputVal2);
 
31
 
 
32
    ret = _mm_movelh_ps(ret, ret2);
 
33
 
 
34
    _mm_storeu_ps(outputVectorPtr, ret);
 
35
    outputVectorPtr += 4;
 
36
  }
 
37
 
 
38
  number = quarterPoints * 4;    
 
39
  for(; number < num_points; number++){
 
40
    outputVector[number] = (float)(inputVector[number]);
 
41
  }
 
42
}
 
43
#endif /* LV_HAVE_SSE2 */
 
44
 
 
45
 
 
46
#ifdef LV_HAVE_GENERIC
 
47
/*!
 
48
  \brief Converts the double values into float values
 
49
  \param dVector The converted float vector values
 
50
  \param fVector The double vector values to be converted
 
51
  \param num_points The number of points in the two vectors to be converted
 
52
*/
 
53
static inline void volk_64f_convert_32f_u_generic(float* outputVector, const double* inputVector, unsigned int num_points){
 
54
  float* outputVectorPtr = outputVector;
 
55
  const double* inputVectorPtr = inputVector;
 
56
  unsigned int number = 0;
 
57
 
 
58
  for(number = 0; number < num_points; number++){
 
59
    *outputVectorPtr++ = ((float)(*inputVectorPtr++));
 
60
  }
 
61
}
 
62
#endif /* LV_HAVE_GENERIC */
 
63
 
 
64
 
 
65
 
 
66
 
 
67
#endif /* INCLUDED_volk_64f_convert_32f_u_H */