GNU Radio 3.7.3 C++ API
volk_8i_s32f_convert_32f.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_8i_s32f_convert_32f_u_H
2 #define INCLUDED_volk_8i_s32f_convert_32f_u_H
3 
4 #include <inttypes.h>
5 #include <stdio.h>
6 
7 #ifdef LV_HAVE_SSE4_1
8 #include <smmintrin.h>
9 
10  /*!
11  \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
12  \param inputVector The 8 bit input data buffer
13  \param outputVector The floating point output data buffer
14  \param scalar The value divided against each point in the output buffer
15  \param num_points The number of data values to be converted
16  \note Output buffer does NOT need to be properly aligned
17  */
18 static inline void volk_8i_s32f_convert_32f_u_sse4_1(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
19  unsigned int number = 0;
20  const unsigned int sixteenthPoints = num_points / 16;
21 
22  float* outputVectorPtr = outputVector;
23  const float iScalar = 1.0 / scalar;
24  __m128 invScalar = _mm_set_ps1( iScalar );
25  const int8_t* inputVectorPtr = inputVector;
26  __m128 ret;
27  __m128i inputVal;
28  __m128i interimVal;
29 
30  for(;number < sixteenthPoints; number++){
31  inputVal = _mm_loadu_si128((__m128i*)inputVectorPtr);
32 
33  interimVal = _mm_cvtepi8_epi32(inputVal);
34  ret = _mm_cvtepi32_ps(interimVal);
35  ret = _mm_mul_ps(ret, invScalar);
36  _mm_storeu_ps(outputVectorPtr, ret);
37  outputVectorPtr += 4;
38 
39  inputVal = _mm_srli_si128(inputVal, 4);
40  interimVal = _mm_cvtepi8_epi32(inputVal);
41  ret = _mm_cvtepi32_ps(interimVal);
42  ret = _mm_mul_ps(ret, invScalar);
43  _mm_storeu_ps(outputVectorPtr, ret);
44  outputVectorPtr += 4;
45 
46  inputVal = _mm_srli_si128(inputVal, 4);
47  interimVal = _mm_cvtepi8_epi32(inputVal);
48  ret = _mm_cvtepi32_ps(interimVal);
49  ret = _mm_mul_ps(ret, invScalar);
50  _mm_storeu_ps(outputVectorPtr, ret);
51  outputVectorPtr += 4;
52 
53  inputVal = _mm_srli_si128(inputVal, 4);
54  interimVal = _mm_cvtepi8_epi32(inputVal);
55  ret = _mm_cvtepi32_ps(interimVal);
56  ret = _mm_mul_ps(ret, invScalar);
57  _mm_storeu_ps(outputVectorPtr, ret);
58  outputVectorPtr += 4;
59 
60  inputVectorPtr += 16;
61  }
62 
63  number = sixteenthPoints * 16;
64  for(; number < num_points; number++){
65  outputVector[number] = (float)(inputVector[number]) * iScalar;
66  }
67 }
68 #endif /* LV_HAVE_SSE4_1 */
69 
70 #ifdef LV_HAVE_GENERIC
71  /*!
72  \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
73  \param inputVector The 8 bit input data buffer
74  \param outputVector The floating point output data buffer
75  \param scalar The value divided against each point in the output buffer
76  \param num_points The number of data values to be converted
77  \note Output buffer does NOT need to be properly aligned
78  */
79 static inline void volk_8i_s32f_convert_32f_generic(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
80  float* outputVectorPtr = outputVector;
81  const int8_t* inputVectorPtr = inputVector;
82  unsigned int number = 0;
83  const float iScalar = 1.0 / scalar;
84 
85  for(number = 0; number < num_points; number++){
86  *outputVectorPtr++ = ((float)(*inputVectorPtr++)) * iScalar;
87  }
88 }
89 #endif /* LV_HAVE_GENERIC */
90 
91 
92 
93 
94 #endif /* INCLUDED_VOLK_8s_CONVERT_32f_UNALIGNED8_H */
95 #ifndef INCLUDED_volk_8i_s32f_convert_32f_a_H
96 #define INCLUDED_volk_8i_s32f_convert_32f_a_H
97 
98 #include <inttypes.h>
99 #include <stdio.h>
100 
101 #ifdef LV_HAVE_SSE4_1
102 #include <smmintrin.h>
103 
104  /*!
105  \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
106  \param inputVector The 8 bit input data buffer
107  \param outputVector The floating point output data buffer
108  \param scalar The value divided against each point in the output buffer
109  \param num_points The number of data values to be converted
110  */
111 static inline void volk_8i_s32f_convert_32f_a_sse4_1(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
112  unsigned int number = 0;
113  const unsigned int sixteenthPoints = num_points / 16;
114 
115  float* outputVectorPtr = outputVector;
116  const float iScalar = 1.0 / scalar;
117  __m128 invScalar = _mm_set_ps1(iScalar);
118  const int8_t* inputVectorPtr = inputVector;
119  __m128 ret;
120  __m128i inputVal;
121  __m128i interimVal;
122 
123  for(;number < sixteenthPoints; number++){
124  inputVal = _mm_load_si128((__m128i*)inputVectorPtr);
125 
126  interimVal = _mm_cvtepi8_epi32(inputVal);
127  ret = _mm_cvtepi32_ps(interimVal);
128  ret = _mm_mul_ps(ret, invScalar);
129  _mm_store_ps(outputVectorPtr, ret);
130  outputVectorPtr += 4;
131 
132  inputVal = _mm_srli_si128(inputVal, 4);
133  interimVal = _mm_cvtepi8_epi32(inputVal);
134  ret = _mm_cvtepi32_ps(interimVal);
135  ret = _mm_mul_ps(ret, invScalar);
136  _mm_store_ps(outputVectorPtr, ret);
137  outputVectorPtr += 4;
138 
139  inputVal = _mm_srli_si128(inputVal, 4);
140  interimVal = _mm_cvtepi8_epi32(inputVal);
141  ret = _mm_cvtepi32_ps(interimVal);
142  ret = _mm_mul_ps(ret, invScalar);
143  _mm_store_ps(outputVectorPtr, ret);
144  outputVectorPtr += 4;
145 
146  inputVal = _mm_srli_si128(inputVal, 4);
147  interimVal = _mm_cvtepi8_epi32(inputVal);
148  ret = _mm_cvtepi32_ps(interimVal);
149  ret = _mm_mul_ps(ret, invScalar);
150  _mm_store_ps(outputVectorPtr, ret);
151  outputVectorPtr += 4;
152 
153  inputVectorPtr += 16;
154  }
155 
156  number = sixteenthPoints * 16;
157  for(; number < num_points; number++){
158  outputVector[number] = (float)(inputVector[number]) * iScalar;
159  }
160 }
161 #endif /* LV_HAVE_SSE4_1 */
162 
163 #ifdef LV_HAVE_GENERIC
164  /*!
165  \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
166  \param inputVector The 8 bit input data buffer
167  \param outputVector The floating point output data buffer
168  \param scalar The value divided against each point in the output buffer
169  \param num_points The number of data values to be converted
170  */
171 static inline void volk_8i_s32f_convert_32f_a_generic(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
172  float* outputVectorPtr = outputVector;
173  const int8_t* inputVectorPtr = inputVector;
174  unsigned int number = 0;
175  const float iScalar = 1.0 / scalar;
176 
177  for(number = 0; number < num_points; number++){
178  *outputVectorPtr++ = ((float)(*inputVectorPtr++)) * iScalar;
179  }
180 }
181 #endif /* LV_HAVE_GENERIC */
182 
183 #ifdef LV_HAVE_ORC
184  /*!
185  \brief Converts the input 8 bit integer data into floating point data, and divides the each floating point output data point by the scalar value
186  \param inputVector The 8 bit input data buffer
187  \param outputVector The floating point output data buffer
188  \param scalar The value divided against each point in the output buffer
189  \param num_points The number of data values to be converted
190  */
191 extern void volk_8i_s32f_convert_32f_a_orc_impl(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points);
192 static inline void volk_8i_s32f_convert_32f_u_orc(float* outputVector, const int8_t* inputVector, const float scalar, unsigned int num_points){
193  float invscalar = 1.0 / scalar;
194  volk_8i_s32f_convert_32f_a_orc_impl(outputVector, inputVector, invscalar, num_points);
195 }
196 #endif /* LV_HAVE_ORC */
197 
198 
199 
200 #endif /* INCLUDED_VOLK_8s_CONVERT_32f_ALIGNED8_H */
signed char int8_t
Definition: stdint.h:75