GNU Radio 3.7.3 C++ API
volk_8ic_deinterleave_real_16i.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_8ic_deinterleave_real_16i_a_H
2 #define INCLUDED_volk_8ic_deinterleave_real_16i_a_H
3 
4 #include <inttypes.h>
5 #include <stdio.h>
6 
7 #ifdef LV_HAVE_SSE4_1
8 #include <smmintrin.h>
9 /*!
10  \brief Deinterleaves the complex 8 bit vector into I 16 bit 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_8ic_deinterleave_real_16i_a_sse4_1(int16_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
16  unsigned int number = 0;
17  const int8_t* complexVectorPtr = (int8_t*)complexVector;
18  int16_t* iBufferPtr = iBuffer;
19  __m128i moveMask = _mm_set_epi8(0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 14, 12, 10, 8, 6, 4, 2, 0);
20  __m128i complexVal, outputVal;
21 
22  unsigned int eighthPoints = num_points / 8;
23 
24  for(number = 0; number < eighthPoints; number++){
25  complexVal = _mm_load_si128((__m128i*)complexVectorPtr); complexVectorPtr += 16;
26 
27  complexVal = _mm_shuffle_epi8(complexVal, moveMask);
28 
29  outputVal = _mm_cvtepi8_epi16(complexVal);
30  outputVal = _mm_slli_epi16(outputVal, 7);
31 
32  _mm_store_si128((__m128i*)iBufferPtr, outputVal);
33  iBufferPtr += 8;
34  }
35 
36  number = eighthPoints * 8;
37  for(; number < num_points; number++){
38  *iBufferPtr++ = ((int16_t)*complexVectorPtr++) * 128;
39  complexVectorPtr++;
40  }
41 }
42 #endif /* LV_HAVE_SSE4_1 */
43 
44 
45 #ifdef LV_HAVE_GENERIC
46 /*!
47  \brief Deinterleaves the complex 8 bit vector into I 16 bit vector data
48  \param complexVector The complex input vector
49  \param iBuffer The I buffer output data
50  \param num_points The number of complex data values to be deinterleaved
51 */
52 static inline void volk_8ic_deinterleave_real_16i_generic(int16_t* iBuffer, const lv_8sc_t* complexVector, unsigned int num_points){
53  unsigned int number = 0;
54  const int8_t* complexVectorPtr = (const int8_t*)complexVector;
55  int16_t* iBufferPtr = iBuffer;
56  for(number = 0; number < num_points; number++){
57  *iBufferPtr++ = ((int16_t)(*complexVectorPtr++)) * 128;
58  complexVectorPtr++;
59  }
60 }
61 #endif /* LV_HAVE_GENERIC */
62 
63 
64 
65 
66 #endif /* INCLUDED_volk_8ic_deinterleave_real_16i_a_H */
signed short int16_t
Definition: stdint.h:76
signed char int8_t
Definition: stdint.h:75
char complex lv_8sc_t
Provide typedefs and operators for all complex types in C and C++.
Definition: volk_complex.h:52