GNU Radio 3.7.3 C++ API
volk_32fc_s32f_deinterleave_real_16i.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H
2 #define INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H
3 
4 #include <volk/volk_common.h>
5 #include <inttypes.h>
6 #include <stdio.h>
7 
8 #ifdef LV_HAVE_SSE
9 #include <xmmintrin.h>
10 /*!
11  \brief Deinterleaves the complex vector, multiply the value by the scalar, convert to 16t, and in I vector data
12  \param complexVector The complex input vector
13  \param scalar The value to be multiply against each of the input values
14  \param iBuffer The I buffer output data
15  \param num_points The number of complex data values to be deinterleaved
16 */
17 static inline void volk_32fc_s32f_deinterleave_real_16i_a_sse(int16_t* iBuffer, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
18  unsigned int number = 0;
19  const unsigned int quarterPoints = num_points / 4;
20 
21  const float* complexVectorPtr = (float*)complexVector;
22  int16_t* iBufferPtr = iBuffer;
23 
24  __m128 vScalar = _mm_set_ps1(scalar);
25 
26  __m128 cplxValue1, cplxValue2, iValue;
27 
28  __VOLK_ATTR_ALIGNED(16) float floatBuffer[4];
29 
30  for(;number < quarterPoints; number++){
31  cplxValue1 = _mm_load_ps(complexVectorPtr);
32  complexVectorPtr += 4;
33 
34  cplxValue2 = _mm_load_ps(complexVectorPtr);
35  complexVectorPtr += 4;
36 
37  // Arrange in i1i2i3i4 format
38  iValue = _mm_shuffle_ps(cplxValue1, cplxValue2, _MM_SHUFFLE(2,0,2,0));
39 
40  iValue = _mm_mul_ps(iValue, vScalar);
41 
42  _mm_store_ps(floatBuffer, iValue);
43  *iBufferPtr++ = (int16_t)(floatBuffer[0]);
44  *iBufferPtr++ = (int16_t)(floatBuffer[1]);
45  *iBufferPtr++ = (int16_t)(floatBuffer[2]);
46  *iBufferPtr++ = (int16_t)(floatBuffer[3]);
47  }
48 
49  number = quarterPoints * 4;
50  iBufferPtr = &iBuffer[number];
51  for(; number < num_points; number++){
52  *iBufferPtr++ = (int16_t)(*complexVectorPtr++ * scalar);
53  complexVectorPtr++;
54  }
55 }
56 #endif /* LV_HAVE_SSE */
57 
58 #ifdef LV_HAVE_GENERIC
59 /*!
60  \brief Deinterleaves the complex vector, multiply the value by the scalar, convert to 16t, and in I vector data
61  \param complexVector The complex input vector
62  \param scalar The value to be multiply against each of the input values
63  \param iBuffer The I buffer output data
64  \param num_points The number of complex data values to be deinterleaved
65 */
66 static inline void volk_32fc_s32f_deinterleave_real_16i_generic(int16_t* iBuffer, const lv_32fc_t* complexVector, const float scalar, unsigned int num_points){
67  const float* complexVectorPtr = (float*)complexVector;
68  int16_t* iBufferPtr = iBuffer;
69  unsigned int number = 0;
70  for(number = 0; number < num_points; number++){
71  *iBufferPtr++ = (int16_t)(*complexVectorPtr++ * scalar);
72  complexVectorPtr++;
73  }
74 
75 }
76 #endif /* LV_HAVE_GENERIC */
77 
78 
79 
80 
81 #endif /* INCLUDED_volk_32fc_s32f_deinterleave_real_16i_a_H */
signed short int16_t
Definition: stdint.h:76
#define __VOLK_ATTR_ALIGNED(x)
Definition: volk_common.h:27
float complex lv_32fc_t
Definition: volk_complex.h:56