Statistics
| Branch: | Tag: | Revision:

root / volk / include / volk / volk_32fc_s32f_deinterleave_real_16i_a16.h @ 82cafc43

History | View | Annotate | Download (2.7 kB)

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