Statistics
| Branch: | Tag: | Revision:

root / volk / include / volk / volk_16ic_deinterleave_real_16i_a16.h @ e3600f59

History | View | Annotate | Download (4.1 kB)

1
#ifndef INCLUDED_volk_16ic_deinterleave_real_16i_a16_H
2
#define INCLUDED_volk_16ic_deinterleave_real_16i_a16_H
3
4
#include <inttypes.h>
5
#include <stdio.h>
6
7
#if LV_HAVE_SSSE3
8
#include <tmmintrin.h>
9
/*!
10
  \brief Deinterleaves the complex 16 bit vector into I vector data
11
  \param complexVector The complex input vector
12
  \param iBuffer The I buffer output data
13
  \param num_points The number of complex data values to be deinterleaved
14
*/
15
static inline void volk_16ic_deinterleave_real_16i_a16_ssse3(int16_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
16
  unsigned int number = 0;
17
  const int16_t* complexVectorPtr = (int16_t*)complexVector;
18
  int16_t* iBufferPtr = iBuffer;
19
20
  __m128i iMoveMask1 = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 13, 12, 9, 8, 5, 4, 1, 0);
21
  __m128i iMoveMask2 = _mm_set_epi8(13, 12, 9, 8, 5, 4, 1, 0, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80);
22
23
  __m128i complexVal1, complexVal2, iOutputVal;
24
25
  unsigned int eighthPoints = num_points / 8;
26
27
  for(number = 0; number < eighthPoints; number++){
28
    complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr);  complexVectorPtr += 8;
29
    complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr);  complexVectorPtr += 8;
30
31
    complexVal1 = _mm_shuffle_epi8(complexVal1, iMoveMask1);
32
    complexVal2 = _mm_shuffle_epi8(complexVal2, iMoveMask2);
33
34
    iOutputVal = _mm_or_si128(complexVal1, complexVal2);
35
36
    _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
37
38
    iBufferPtr += 8;
39
  }
40
41
  number = eighthPoints * 8;
42
  for(; number < num_points; number++){
43
    *iBufferPtr++ = *complexVectorPtr++;
44
    complexVectorPtr++;
45
  }
46
}
47
#endif /* LV_HAVE_SSSE3 */
48
49
50
#if LV_HAVE_SSE2
51
#include <emmintrin.h>
52
/*!
53
  \brief Deinterleaves the complex 16 bit vector into I vector data
54
  \param complexVector The complex input vector
55
  \param iBuffer The I buffer output data
56
  \param num_points The number of complex data values to be deinterleaved
57
*/
58
static inline void volk_16ic_deinterleave_real_16i_a16_sse2(int16_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
59
  unsigned int number = 0;
60
  const int16_t* complexVectorPtr = (int16_t*)complexVector;
61
  int16_t* iBufferPtr = iBuffer;
62
  __m128i complexVal1, complexVal2, iOutputVal;
63
  __m128i lowMask = _mm_set_epi32(0x0, 0x0, 0xFFFFFFFF, 0xFFFFFFFF);
64
  __m128i highMask = _mm_set_epi32(0xFFFFFFFF, 0xFFFFFFFF, 0x0, 0x0);
65
66
  unsigned int eighthPoints = num_points / 8;
67
 
68
  for(number = 0; number < eighthPoints; number++){
69
    complexVal1 = _mm_load_si128((__m128i*)complexVectorPtr);  complexVectorPtr += 8;
70
    complexVal2 = _mm_load_si128((__m128i*)complexVectorPtr);  complexVectorPtr += 8;
71
72
    complexVal1 = _mm_shufflelo_epi16(complexVal1, _MM_SHUFFLE(3,1,2,0));
73
74
    complexVal1 = _mm_shufflehi_epi16(complexVal1, _MM_SHUFFLE(3,1,2,0));
75
76
    complexVal1 = _mm_shuffle_epi32(complexVal1, _MM_SHUFFLE(3,1,2,0));
77
78
    complexVal2 = _mm_shufflelo_epi16(complexVal2, _MM_SHUFFLE(3,1,2,0));
79
80
    complexVal2 = _mm_shufflehi_epi16(complexVal2, _MM_SHUFFLE(3,1,2,0));
81
82
    complexVal2 = _mm_shuffle_epi32(complexVal2, _MM_SHUFFLE(2,0,3,1));
83
84
    iOutputVal = _mm_or_si128(_mm_and_si128(complexVal1, lowMask), _mm_and_si128(complexVal2, highMask));
85
86
    _mm_store_si128((__m128i*)iBufferPtr, iOutputVal);
87
88
    iBufferPtr += 8;
89
  }
90
91
  number = eighthPoints * 8;
92
  for(; number < num_points; number++){
93
    *iBufferPtr++ = *complexVectorPtr++;
94
    complexVectorPtr++;
95
  }
96
}
97
#endif /* LV_HAVE_SSE2 */
98
99
#if LV_HAVE_GENERIC
100
/*!
101
  \brief Deinterleaves the complex 16 bit vector into I vector data
102
  \param complexVector The complex input vector
103
  \param iBuffer The I buffer output data
104
  \param num_points The number of complex data values to be deinterleaved
105
*/
106
static inline void volk_16ic_deinterleave_real_16i_a16_generic(int16_t* iBuffer, const lv_16sc_t* complexVector, unsigned int num_points){
107
  unsigned int number = 0;
108
  const int16_t* complexVectorPtr = (int16_t*)complexVector;
109
  int16_t* iBufferPtr = iBuffer;
110
  for(number = 0; number < num_points; number++){
111
    *iBufferPtr++ = *complexVectorPtr++;
112
    complexVectorPtr++;
113
  }
114
}
115
#endif /* LV_HAVE_GENERIC */
116
117
118
119
120
#endif /* INCLUDED_volk_16ic_deinterleave_real_16i_a16_H */