GNU Radio 3.7.3 C++ API
volk_16ic_s32f_deinterleave_real_32f.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_16ic_s32f_deinterleave_real_32f_a_H
2 #define INCLUDED_volk_16ic_s32f_deinterleave_real_32f_a_H
3 
4 #include <volk/volk_common.h>
5 #include <inttypes.h>
6 #include <stdio.h>
7 
8 #ifdef LV_HAVE_SSE4_1
9 #include <smmintrin.h>
10 /*!
11  \brief Deinterleaves the complex 16 bit vector into I float vector data
12  \param complexVector The complex input vector
13  \param iBuffer The I buffer output data
14  \param scalar The scaling value being multiplied against each data point
15  \param num_points The number of complex data values to be deinterleaved
16 */
17 static inline void volk_16ic_s32f_deinterleave_real_32f_a_sse4_1(float* iBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
18  float* iBufferPtr = iBuffer;
19 
20  unsigned int number = 0;
21  const unsigned int quarterPoints = num_points / 4;
22 
23  __m128 iFloatValue;
24 
25  const float iScalar= 1.0 / scalar;
26  __m128 invScalar = _mm_set_ps1(iScalar);
27  __m128i complexVal, iIntVal;
28  int8_t* complexVectorPtr = (int8_t*)complexVector;
29 
30  __m128i moveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
31 
32  for(;number < quarterPoints; number++){
33  complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
34  complexVal = _mm_shuffle_epi8(complexVal, moveMask);
35 
36  iIntVal = _mm_cvtepi16_epi32(complexVal);
37  iFloatValue = _mm_cvtepi32_ps(iIntVal);
38 
39  iFloatValue = _mm_mul_ps(iFloatValue, invScalar);
40 
41  _mm_store_ps(iBufferPtr, iFloatValue);
42 
43  iBufferPtr += 4;
44  }
45 
46  number = quarterPoints * 4;
47  int16_t* sixteenTComplexVectorPtr = (int16_t*)&complexVector[number];
48  for(; number < num_points; number++){
49  *iBufferPtr++ = ((float)(*sixteenTComplexVectorPtr++)) * iScalar;
50  sixteenTComplexVectorPtr++;
51  }
52 
53 }
54 #endif /* LV_HAVE_SSE4_1 */
55 
56 #ifdef LV_HAVE_SSE
57 #include <xmmintrin.h>
58 /*!
59  \brief Deinterleaves the complex 16 bit vector into I float vector data
60  \param complexVector The complex input vector
61  \param iBuffer The I buffer output data
62  \param scalar The scaling value being multiplied against each data point
63  \param num_points The number of complex data values to be deinterleaved
64 */
65 static inline void volk_16ic_s32f_deinterleave_real_32f_a_sse(float* iBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
66  float* iBufferPtr = iBuffer;
67 
68  unsigned int number = 0;
69  const unsigned int quarterPoints = num_points / 4;
70  __m128 iValue;
71 
72  const float iScalar = 1.0/scalar;
73  __m128 invScalar = _mm_set_ps1(iScalar);
74  int16_t* complexVectorPtr = (int16_t*)complexVector;
75 
76  __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
77 
78  for(;number < quarterPoints; number++){
79  floatBuffer[0] = (float)(*complexVectorPtr); complexVectorPtr += 2;
80  floatBuffer[1] = (float)(*complexVectorPtr); complexVectorPtr += 2;
81  floatBuffer[2] = (float)(*complexVectorPtr); complexVectorPtr += 2;
82  floatBuffer[3] = (float)(*complexVectorPtr); complexVectorPtr += 2;
83 
84  iValue = _mm_load_ps(floatBuffer);
85 
86  iValue = _mm_mul_ps(iValue, invScalar);
87 
88  _mm_store_ps(iBufferPtr, iValue);
89 
90  iBufferPtr += 4;
91  }
92 
93  number = quarterPoints * 4;
94  complexVectorPtr = (int16_t*)&complexVector[number];
95  for(; number < num_points; number++){
96  *iBufferPtr++ = ((float)(*complexVectorPtr++)) * iScalar;
97  complexVectorPtr++;
98  }
99 
100 }
101 #endif /* LV_HAVE_SSE */
102 
103 #ifdef LV_HAVE_GENERIC
104 /*!
105  \brief Deinterleaves the complex 16 bit vector into I float vector data
106  \param complexVector The complex input vector
107  \param iBuffer The I buffer output data
108  \param scalar The scaling value being multiplied against each data point
109  \param num_points The number of complex data values to be deinterleaved
110 */
111 static inline void volk_16ic_s32f_deinterleave_real_32f_generic(float* iBuffer, const lv_16sc_t* complexVector, const float scalar, unsigned int num_points){
112  unsigned int number = 0;
113  const int16_t* complexVectorPtr = (const int16_t*)complexVector;
114  float* iBufferPtr = iBuffer;
115  const float invScalar = 1.0 / scalar;
116  for(number = 0; number < num_points; number++){
117  *iBufferPtr++ = ((float)(*complexVectorPtr++)) * invScalar;
118  complexVectorPtr++;
119  }
120 }
121 #endif /* LV_HAVE_GENERIC */
122 
123 
124 
125 
126 #endif /* INCLUDED_volk_16ic_s32f_deinterleave_real_32f_a_H */
short complex lv_16sc_t
Definition: volk_complex.h:53
signed short int16_t
Definition: stdint.h:76
signed char int8_t
Definition: stdint.h:75
#define __VOLK_ATTR_ALIGNED(x)
Definition: volk_common.h:27