GNU Radio 3.6.3.1 C++ API
volk_8i_convert_16i_a.h
Go to the documentation of this file.
1 #ifndef INCLUDED_volk_8i_convert_16i_a_H
2 #define INCLUDED_volk_8i_convert_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  /*!
11  \brief Converts the input 8 bit integer data into 16 bit integer data
12  \param inputVector The 8 bit input data buffer
13  \param outputVector The 16 bit output data buffer
14  \param num_points The number of data values to be converted
15  */
16 static inline void volk_8i_convert_16i_a_sse4_1(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
17  unsigned int number = 0;
18  const unsigned int sixteenthPoints = num_points / 16;
19 
20  const __m128i* inputVectorPtr = (const __m128i*)inputVector;
21  __m128i* outputVectorPtr = (__m128i*)outputVector;
22  __m128i inputVal;
23  __m128i ret;
24 
25  for(;number < sixteenthPoints; number++){
26  inputVal = _mm_load_si128(inputVectorPtr);
27  ret = _mm_cvtepi8_epi16(inputVal);
28  ret = _mm_slli_epi16(ret, 8); // Multiply by 256
29  _mm_store_si128(outputVectorPtr, ret);
30 
31  outputVectorPtr++;
32 
33  inputVal = _mm_srli_si128(inputVal, 8);
34  ret = _mm_cvtepi8_epi16(inputVal);
35  ret = _mm_slli_epi16(ret, 8); // Multiply by 256
36  _mm_store_si128(outputVectorPtr, ret);
37 
38  outputVectorPtr++;
39 
40  inputVectorPtr++;
41  }
42 
43  number = sixteenthPoints * 16;
44  for(; number < num_points; number++){
45  outputVector[number] = (int16_t)(inputVector[number])*256;
46  }
47 }
48 #endif /* LV_HAVE_SSE4_1 */
49 
50 #ifdef LV_HAVE_GENERIC
51  /*!
52  \brief Converts the input 8 bit integer data into 16 bit integer data
53  \param inputVector The 8 bit input data buffer
54  \param outputVector The 16 bit output data buffer
55  \param num_points The number of data values to be converted
56  */
57 static inline void volk_8i_convert_16i_a_generic(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
58  int16_t* outputVectorPtr = outputVector;
59  const int8_t* inputVectorPtr = inputVector;
60  unsigned int number = 0;
61 
62  for(number = 0; number < num_points; number++){
63  *outputVectorPtr++ = ((int16_t)(*inputVectorPtr++)) * 256;
64  }
65 }
66 #endif /* LV_HAVE_GENERIC */
67 
68 #ifdef LV_HAVE_ORC
69  /*!
70  \brief Converts the input 8 bit integer data into 16 bit integer data
71  \param inputVector The 8 bit input data buffer
72  \param outputVector The 16 bit output data buffer
73  \param num_points The number of data values to be converted
74  */
75 extern void volk_8i_convert_16i_a_orc_impl(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points);
76 static inline void volk_8i_convert_16i_a_orc(int16_t* outputVector, const int8_t* inputVector, unsigned int num_points){
77  volk_8i_convert_16i_a_orc_impl(outputVector, inputVector, num_points);
78 }
79 #endif /* LV_HAVE_ORC */
80 
81 
82 
83 #endif /* INCLUDED_VOLK_8s_CONVERT_16s_ALIGNED8_H */