GNU Radio Manual and C++ API Reference  3.7.4.1
The Free & Open Software Radio Ecosystem
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
volk_32f_s32f_normalize.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_32f_s32f_normalize_a_H
2 #define INCLUDED_volk_32f_s32f_normalize_a_H
3 
4 #include <inttypes.h>
5 #include <stdio.h>
6 
7 #ifdef LV_HAVE_SSE
8 #include <xmmintrin.h>
9 /*!
10  \brief Normalizes all points in the buffer by the scalar value ( divides each data point by the scalar value )
11  \param vecBuffer The buffer of values to be vectorized
12  \param num_points The number of values in vecBuffer
13  \param scalar The scale value to be applied to each buffer value
14 */
15 static inline void volk_32f_s32f_normalize_a_sse(float* vecBuffer, const float scalar, unsigned int num_points){
16  unsigned int number = 0;
17  float* inputPtr = vecBuffer;
18 
19  const float invScalar = 1.0 / scalar;
20  __m128 vecScalar = _mm_set_ps1(invScalar);
21 
22  __m128 input1;
23 
24  const uint64_t quarterPoints = num_points / 4;
25  for(;number < quarterPoints; number++){
26 
27  input1 = _mm_load_ps(inputPtr);
28 
29  input1 = _mm_mul_ps(input1, vecScalar);
30 
31  _mm_store_ps(inputPtr, input1);
32 
33  inputPtr += 4;
34  }
35 
36  number = quarterPoints*4;
37  for(; number < num_points; number++){
38  *inputPtr *= invScalar;
39  inputPtr++;
40  }
41 }
42 #endif /* LV_HAVE_SSE */
43 
44 #ifdef LV_HAVE_GENERIC
45 /*!
46  \brief Normalizes the two input vectors and store their results in the third vector
47  \param cVector The vector where the results will be stored
48  \param aVector One of the vectors to be normalizeed
49  \param bVector One of the vectors to be normalizeed
50  \param num_points The number of values in aVector and bVector to be normalizeed together and stored into cVector
51 */
52 static inline void volk_32f_s32f_normalize_generic(float* vecBuffer, const float scalar, unsigned int num_points){
53  unsigned int number = 0;
54  float* inputPtr = vecBuffer;
55  const float invScalar = 1.0 / scalar;
56  for(number = 0; number < num_points; number++){
57  *inputPtr *= invScalar;
58  inputPtr++;
59  }
60 }
61 #endif /* LV_HAVE_GENERIC */
62 
63 #ifdef LV_HAVE_ORC
64 /*!
65  \brief Normalizes the two input vectors and store their results in the third vector
66  \param cVector The vector where the results will be stored
67  \param aVector One of the vectors to be normalizeed
68  \param bVector One of the vectors to be normalizeed
69  \param num_points The number of values in aVector and bVector to be normalizeed together and stored into cVector
70 */
71 extern void volk_32f_s32f_normalize_a_orc_impl(float* dst, float* src, const float scalar, unsigned int num_points);
72 static inline void volk_32f_s32f_normalize_u_orc(float* vecBuffer, const float scalar, unsigned int num_points){
73  float invscalar = 1.0 / scalar;
74  volk_32f_s32f_normalize_a_orc_impl(vecBuffer, vecBuffer, invscalar, num_points);
75 }
76 #endif /* LV_HAVE_GENERIC */
77 
78 
79 
80 
81 #endif /* INCLUDED_volk_32f_s32f_normalize_a_H */
unsigned __int64 uint64_t
Definition: stdint.h:90